Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23abf11a authored by Jack Yu's avatar Jack Yu Committed by Alisher Alikhodjaev
Browse files

Nfc adapter randomly returns null on devices having Nfc

Try to get NfcAdapter from NfcManager only when nfc service interface is
ready.

Bug: 173184157
Test: manaul test
Change-Id: Ifcb0f60e23f01cafd8b6b5f6bc8522773ece23a6
(cherry picked from commit 3217255a)
parent 44889fb4
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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) {