Merge "Nfc adapter randomly returns null on devices having Nfc" into rvc-qpr-dev

This commit is contained in:
Alisher Alikhodjaev
2021-01-11 23:08:40 +00:00
committed by Android (Google) Code Review

View File

@@ -677,6 +677,12 @@ public final class NfcAdapter {
throw new IllegalArgumentException(
"context not associated with any application (using a mock context?)");
}
if (getServiceInterface() == null) {
// NFC is not available
return null;
}
/* use getSystemService() for consistency */
NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE);
if (manager == null) {