From c6f7234af774578fc567f3bf6699fac463f26243 Mon Sep 17 00:00:00 2001 From: Tony Layher Date: Fri, 13 Feb 2015 22:58:19 -0500 Subject: NFCService: Add sysprop to prevent FW download during boot with NFC off. * The SEC NFC chip used by samsung for the Note4, Alpha and S5-mini does not handle the download attempt on boot well if NFC is off. * If download is attempted while booting with NFC off, the NFC device is opened and never closed, resulting in a kernel wake lock. It also prevents turning NFC on due to the device already being open with the service in a tranisition from off -> on. * Devices can set the property ro.nfc.sec_hal to any value to signify the use of the sec NFC chip. (S3FWRN) Change-Id: Ifb28074eb473ab5b7e4b82a14336ee51972d3975 --- src/com/android/nfc/NfcService.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java index d8278833..cbdfc081 100755 --- a/src/com/android/nfc/NfcService.java +++ b/src/com/android/nfc/NfcService.java @@ -60,9 +60,11 @@ import android.os.PowerManager; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; +import android.text.TextUtils; import android.util.Log; import com.android.nfc.DeviceHost.DeviceHostListener; @@ -427,6 +429,15 @@ public class NfcService implements DeviceHostListener { } } + boolean isSecHal() { + String nfcSecHal = SystemProperties.get("ro.nfc.sec_hal"); + if (!TextUtils.isEmpty(nfcSecHal)) { + Log.i(TAG, "This device uses SEC NFC CHIP."); + return true; + } + return false; + } + /** * Manages tasks that involve turning on/off the NFC controller. *

@@ -489,7 +500,7 @@ public class NfcService implements DeviceHostListener { (!mIsAirplaneSensitive || !isAirplaneModeOn() || airplaneOverride)) { Log.d(TAG, "NFC is on. Doing normal stuff"); enableInternal(); - } else { + } else if (!isSecHal()) { Log.d(TAG, "NFC is off. Checking firmware version"); mDeviceHost.checkFirmware(); } -- cgit v1.2.3