Catch NoSuchElementException when unbinding print doc death recipient

Fixes: 177873499
Test: Manual
Change-Id: Ia77e6d2c9d7e552beb0a2df10d6d4f13c7230446
This commit is contained in:
Erik Wolsheimer 2021-06-18 15:21:11 -07:00
parent 7ed65c1d49
commit 2ccc6f1c06
2 changed files with 7 additions and 2 deletions

View File

@ -52,6 +52,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.NoSuchElementException;
public final class RemotePrintDocument {
private static final String LOG_TAG = "RemotePrintDocument";
@ -441,7 +442,12 @@ public final class RemotePrintDocument {
// Keep going - best effort...
}
mPrintDocumentAdapter.asBinder().unlinkToDeath(mDeathRecipient, 0);
try {
mPrintDocumentAdapter.asBinder().unlinkToDeath(mDeathRecipient, 0);
} catch (NoSuchElementException e) {
Log.w(LOG_TAG, "Error unlinking print document adapter death recipient.");
// Keep going - best effort...
}
}
private void scheduleCommand(AsyncCommand command) {

View File

@ -61,7 +61,6 @@ import android.print.PrinterId;
import android.print.PrinterInfo;
import android.printservice.PrintService;
import android.printservice.PrintServiceInfo;
import android.provider.DocumentsContract;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;