From 322c9daeeb8064d8001482f6337ca6561284e86d Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Wed, 21 Jun 2023 00:28:25 +0000 Subject: [PATCH] nfc(api): Restore behavior from Android T When Nfc service is not ready, dont fetch NfcManager to avoid getting into a state where the app keeps getting a bad NfcManager. Restoring the fix from aosp/1498599. Bug: 286025476 Change-Id: I4aaa0a87c38eaddccc566c18b75cd1acedc29d75 Test: Manual tests --- core/java/android/nfc/NfcAdapter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java index cacde7f4a5471..9e97216ac632e 100644 --- a/core/java/android/nfc/NfcAdapter.java +++ b/core/java/android/nfc/NfcAdapter.java @@ -711,6 +711,7 @@ public final class NfcAdapter { /* Stale sService pointer */ if (sIsInitialized) sIsInitialized = false; } + return null; } /* Try to initialize the service */ NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE);