diff options
author | Nick Pelly <npelly@google.com> | 2011-06-28 18:11:07 -0700 |
---|---|---|
committer | android-merger <android-build@android.com> | 2011-06-29 11:17:17 -0700 |
commit | e4d9ddebb676325c6abfe3b0d4c0aefa8a17d952 (patch) | |
tree | 725db4c75dbd5a788229fa0f0bb6f31b5b7c82f7 | |
parent | 95b352ec03226adf812d63e6fee568b1a4581021 (diff) | |
download | packages_apps_nfc-e4d9ddebb676325c6abfe3b0d4c0aefa8a17d952.zip packages_apps_nfc-e4d9ddebb676325c6abfe3b0d4c0aefa8a17d952.tar.gz packages_apps_nfc-e4d9ddebb676325c6abfe3b0d4c0aefa8a17d952.tar.bz2 |
Do not change NFC on/off preference while executing SE reset.
Bug: 4967769
Change-Id: I7a72cbe831d4b3f44bed7feeea8abaf468cdc19b
Signed-off-by: Nick Pelly <npelly@google.com>
-rwxr-xr-x | src/com/android/nfc/NfcService.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java index 0095761..283d72d 100755 --- a/src/com/android/nfc/NfcService.java +++ b/src/com/android/nfc/NfcService.java @@ -338,7 +338,7 @@ public class NfcService extends Application { public void run() { boolean nfc_on = mPrefs.getBoolean(PREF_NFC_ON, NFC_ON_DEFAULT); if (nfc_on) { - _enable(false); + _enable(false, true); } resetSeOnFirstBoot(); } @@ -365,7 +365,7 @@ public class NfcService extends Application { boolean previouslyEnabled = isEnabled(); if (!previouslyEnabled) { reset(); - isSuccess = _enable(previouslyEnabled); + isSuccess = _enable(previouslyEnabled, true); } return isSuccess; } @@ -378,7 +378,7 @@ public class NfcService extends Application { if (DBG) Log.d(TAG, "Disabling NFC. previous=" + previouslyEnabled); if (previouslyEnabled) { - isSuccess = _disable(previouslyEnabled); + isSuccess = _disable(previouslyEnabled, true); } return isSuccess; } @@ -1918,7 +1918,7 @@ public class NfcService extends Application { } } - private boolean _enable(boolean oldEnabledState) { + private boolean _enable(boolean oldEnabledState, boolean savePref) { applyProperties(); boolean isSuccess = mManager.initialize(); @@ -1937,12 +1937,14 @@ public class NfcService extends Application { mIsNfcEnabled = false; } - updateNfcOnSetting(oldEnabledState); + if (savePref) { + updateNfcOnSetting(oldEnabledState); + } return isSuccess; } - private boolean _disable(boolean oldEnabledState) { + private boolean _disable(boolean oldEnabledState, boolean savePref) { /* sometimes mManager.deinitialize() hangs, watch-dog it */ WatchDogThread watchDog = new WatchDogThread(); watchDog.start(); @@ -1972,7 +1974,9 @@ public class NfcService extends Application { mNdefPushClient.setForegroundMessage(null); } - updateNfcOnSetting(oldEnabledState); + if (savePref) { + updateNfcOnSetting(oldEnabledState); + } watchDog.cancel(); return isSuccess; @@ -2087,7 +2091,7 @@ public class NfcService extends Application { boolean tempEnable = !mIsNfcEnabled; if (tempEnable) { - if (!_enable(false)) { + if (!_enable(false, false)) { Log.w(TAG, "Could not enable NFC to reset EE!"); return; } @@ -2098,7 +2102,7 @@ public class NfcService extends Application { if (handle == 0) { Log.e(TAG, "Could not open the secure element!"); if (tempEnable) { - _disable(true); + _disable(true, false); } return; } @@ -2114,7 +2118,7 @@ public class NfcService extends Application { mSecureElement.doDisconnect(handle); if (tempEnable) { - _disable(true); + _disable(true, false); } } |