Ensure Telecom ServiceBinder class unlinks death recipient.

Telecom uses a death recipient to track binder failures.  Turns out it
did not actually unlink the death recipient.  Ooops.

Added code so that it unlinks in unbind() and also within the death
recipient itself (after death).

Test: Manual; ensure no longer getting system unlink warnings.
Bug: 78141360
Change-Id: If75b29ed3610af068dd2a8c23db4886a03f809a9
diff --git a/src/com/android/server/telecom/ServiceBinder.java b/src/com/android/server/telecom/ServiceBinder.java
index f7844b4..f15570b 100644
--- a/src/com/android/server/telecom/ServiceBinder.java
+++ b/src/com/android/server/telecom/ServiceBinder.java
@@ -303,6 +303,7 @@
             mIsBindingAborted = true;
         } else {
             logServiceDisconnected("unbind");
+            unlinkDeathRecipient();
             mContext.unbindService(mServiceConnection);
             mServiceConnection = null;
             setBinder(null);
@@ -371,9 +372,25 @@
      * Handles a service disconnection.
      */
     private void handleServiceDisconnected() {
+        unlinkDeathRecipient();
         setBinder(null);
     }
 
+    /**
+     * Handles un-linking the death recipient from the service's binder.
+     */
+    private void unlinkDeathRecipient() {
+        if (mServiceDeathRecipient != null && mBinder != null) {
+            boolean unlinked = mBinder.unlinkToDeath(mServiceDeathRecipient, 0);
+            if (!unlinked) {
+                Log.i(this, "unlinkDeathRecipient: failed to unlink %s", mComponentName);
+            }
+            mServiceDeathRecipient = null;
+        } else {
+            Log.w(this, "unlinkDeathRecipient: death recipient is null.");
+        }
+    }
+
     private void clearAbort() {
         mIsBindingAborted = false;
     }