Bug 1374146 - handle already released death recipient exception. r?esawin draft
authorJohn Lin <jolin@mozilla.com>
Tue, 04 Jul 2017 15:43:13 +0800
changeset 604064 d77512d0d032955cb3ea674602c651cc6c5fc576
parent 603394 e6a7a778ba132b87f346a5458b0879c45a3061b7
child 605990 111e57fc59107d8930deebdbceec7f1930275256
push id66942
push userbmo:jolin@mozilla.com
push dateWed, 05 Jul 2017 07:45:23 +0000
reviewersesawin
bugs1374146
milestone56.0a1
Bug 1374146 - handle already released death recipient exception. r?esawin MozReview-Commit-ID: G5Nfd2z4QlN
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/RemoteManager.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/RemoteManager.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/RemoteManager.java
@@ -14,16 +14,17 @@ import android.media.MediaFormat;
 import android.os.DeadObjectException;
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.view.Surface;
 import android.util.Log;
 
 import java.util.LinkedList;
 import java.util.List;
+import java.util.NoSuchElementException;
 
 import org.mozilla.gecko.gfx.GeckoSurface;
 
 public final class RemoteManager implements IBinder.DeathRecipient {
     private static final String LOGTAG = "GeckoRemoteManager";
     private static final boolean DEBUG = false;
     private static RemoteManager sRemoteManager = null;
     private static ICrashReporter setCrashReporter = null;
@@ -53,17 +54,21 @@ public final class RemoteManager impleme
                 mRemote = IMediaManager.Stub.asInterface(service);
                 notify();
             }
         }
 
         @Override
         public void onServiceDisconnected(ComponentName name) {
             if (DEBUG) Log.d(LOGTAG, "service disconnected");
-            mRemote.asBinder().unlinkToDeath(RemoteManager.this, 0);
+            try {
+                mRemote.asBinder().unlinkToDeath(RemoteManager.this, 0);
+            } catch (NoSuchElementException e) {
+                Log.w(LOGTAG, "death recipient already released");
+            }
             synchronized (this) {
                 mRemote = null;
                 notify();
             }
         }
 
         private boolean connect() {
             Context appCtxt = GeckoAppShell.getApplicationContext();