Loading core/java/android/nfc/NfcAdapter.java +5 −2 Original line number Diff line number Diff line Loading @@ -357,8 +357,11 @@ public final class NfcAdapter { throw new IllegalArgumentException("context cannot be null"); } context = context.getApplicationContext(); /* use getSystemService() instead of just instantiating to take * advantage of the context's cached NfcManager & NfcAdapter */ if (context == null) { throw new IllegalArgumentException( "context not associated with any application (using a mock context?)"); } /* use getSystemService() for consistency */ NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE); if (manager == null) { // NFC not available Loading core/java/android/nfc/NfcManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,10 @@ public final class NfcManager { public NfcManager(Context context) { NfcAdapter adapter; context = context.getApplicationContext(); if (context == null) { throw new IllegalArgumentException( "context not associated with any application (using a mock context?)"); } try { adapter = NfcAdapter.getNfcAdapter(context); } catch (UnsupportedOperationException e) { Loading Loading
core/java/android/nfc/NfcAdapter.java +5 −2 Original line number Diff line number Diff line Loading @@ -357,8 +357,11 @@ public final class NfcAdapter { throw new IllegalArgumentException("context cannot be null"); } context = context.getApplicationContext(); /* use getSystemService() instead of just instantiating to take * advantage of the context's cached NfcManager & NfcAdapter */ if (context == null) { throw new IllegalArgumentException( "context not associated with any application (using a mock context?)"); } /* use getSystemService() for consistency */ NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE); if (manager == null) { // NFC not available Loading
core/java/android/nfc/NfcManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,10 @@ public final class NfcManager { public NfcManager(Context context) { NfcAdapter adapter; context = context.getApplicationContext(); if (context == null) { throw new IllegalArgumentException( "context not associated with any application (using a mock context?)"); } try { adapter = NfcAdapter.getNfcAdapter(context); } catch (UnsupportedOperationException e) { Loading