Merge "Reflect the initialization result to the system property"
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index 504d836..18c10e6 100755
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -1609,12 +1609,12 @@
 static jboolean nfcManager_doDownload(JNIEnv*, jobject) {
   DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
   NfcAdaptation& theInstance = NfcAdaptation::GetInstance();
-
+  bool result = JNI_FALSE;
   theInstance.Initialize();  // start GKI, NCI task, NFC task
-  theInstance.DownloadFirmware();
+  result = theInstance.DownloadFirmware();
   theInstance.Finalize();
   DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
-  return JNI_TRUE;
+  return result;
 }
 
 /*******************************************************************************
diff --git a/nci/src/com/android/nfc/dhimpl/NativeNfcManager.java b/nci/src/com/android/nfc/dhimpl/NativeNfcManager.java
index d92db5a..2c493d3 100755
--- a/nci/src/com/android/nfc/dhimpl/NativeNfcManager.java
+++ b/nci/src/com/android/nfc/dhimpl/NativeNfcManager.java
@@ -70,8 +70,8 @@
     public native int doGetLastError();
 
     @Override
-    public void checkFirmware() {
-        doDownload();
+    public boolean checkFirmware() {
+        return doDownload();
     }
 
     private native boolean doInitialize();
diff --git a/src/com/android/nfc/DeviceHost.java b/src/com/android/nfc/DeviceHost.java
index 3601d9a..5469fbf 100644
--- a/src/com/android/nfc/DeviceHost.java
+++ b/src/com/android/nfc/DeviceHost.java
@@ -172,7 +172,7 @@
      * <p>This is called from a thread
      * that may block for long periods of time during the update process.
      */
-    public void checkFirmware();
+    public boolean checkFirmware();
 
     public boolean initialize();
 
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index 3d49f25..8649f10 100644
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -618,6 +618,7 @@
                     disableInternal();
                     break;
                 case TASK_BOOT:
+                    boolean initialized;
                     if (mPrefs.getBoolean(PREF_FIRST_BOOT, true)) {
                         Log.i(TAG, "First Boot");
                         mPrefsEditor.putBoolean(PREF_FIRST_BOOT, false);
@@ -627,12 +628,14 @@
                     Log.d(TAG, "checking on firmware download");
                     if (mPrefs.getBoolean(PREF_NFC_ON, NFC_ON_DEFAULT)) {
                         Log.d(TAG, "NFC is on. Doing normal stuff");
-                        enableInternal();
+                        initialized = enableInternal();
                     } else {
                         Log.d(TAG, "NFC is off.  Checking firmware version");
-                        mDeviceHost.checkFirmware();
+                        initialized = mDeviceHost.checkFirmware();
                     }
-                    SystemProperties.set("nfc.initialized", "true");
+                    if (initialized) {
+                        SystemProperties.set("nfc.initialized", "true");
+                    }
                     break;
             }