Catch all exceptions when doing remote Binder calls.
When doing application callbacks for retrieving NDEF
data or notifying the application that an NDEF push
was completed, we should catch all exceptions, not
just RemoteExceptions.
Bug: 8179249
Change-Id: I35d30d52322f05b7998ef2e10f8da9d856a4b0d6
diff --git a/src/com/android/nfc/P2pLinkManager.java b/src/com/android/nfc/P2pLinkManager.java
index 317c866..97589c5 100755
--- a/src/com/android/nfc/P2pLinkManager.java
+++ b/src/com/android/nfc/P2pLinkManager.java
@@ -40,7 +40,6 @@
import android.os.AsyncTask;
import android.os.Handler;
import android.os.Message;
-import android.os.RemoteException;
import android.os.SystemClock;
import android.os.UserHandle;
import android.util.Log;
@@ -339,8 +338,8 @@
mMessageToSend = mCallbackNdef.createMessage();
mUrisToSend = mCallbackNdef.getUris();
return;
- } catch (RemoteException e) {
- // Ignore
+ } catch (Exception e) {
+ Log.e(TAG, "Failed NDEF callback: " + e.getMessage());
}
} else {
// This is not necessarily an error - we no longer unset callbacks from
@@ -690,7 +689,9 @@
if (mCallbackNdef != null) {
try {
mCallbackNdef.onNdefPushComplete();
- } catch (RemoteException e) { }
+ } catch (Exception e) {
+ Log.e(TAG, "Failed NDEF completed callback: " + e.getMessage());
+ }
}
}
break;