summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2012-02-27 09:45:22 -0800
committerMartijn Coenen <maco@google.com>2012-02-27 14:33:35 -0800
commit9a93cf5cf4b845c7983f202fe0e03615f31f6db0 (patch)
treea576cc4c6d7f54c010144e8ededf145b2c7d9214
parente288a8c852ad826efcb2ef5a318394974918209d (diff)
downloadpackages_apps_nfc-9a93cf5cf4b845c7983f202fe0e03615f31f6db0.zip
packages_apps_nfc-9a93cf5cf4b845c7983f202fe0e03615f31f6db0.tar.gz
packages_apps_nfc-9a93cf5cf4b845c7983f202fe0e03615f31f6db0.tar.bz2
Fix crash when disabling NFC with target in field.
Change-Id: I6c8d85278bc1379d40d83ec4d3df5797e4643e10
-rwxr-xr-xsrc/com/android/nfc/NfcService.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index cebce23..e07e822 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -1353,6 +1353,12 @@ public class NfcService extends Application implements DeviceHostListener {
}
}
+ boolean isNfcEnabledOrShuttingDown() {
+ synchronized (this) {
+ return (mState == NfcAdapter.STATE_ON || mState == NfcAdapter.STATE_TURNING_OFF);
+ }
+ }
+
boolean isNfcEnabled() {
synchronized (this) {
return mState == NfcAdapter.STATE_ON;
@@ -1388,7 +1394,7 @@ public class NfcService extends Application implements DeviceHostListener {
*/
void applyRouting(boolean force) {
synchronized (this) {
- if (!isNfcEnabled() || mOpenEe != null) {
+ if (!isNfcEnabledOrShuttingDown() || mOpenEe != null) {
// PN544 cannot be reconfigured while EE is open
return;
}
@@ -1454,7 +1460,7 @@ public class NfcService extends Application implements DeviceHostListener {
/** Disconnect any target if present */
void maybeDisconnectTarget() {
- if (!isNfcEnabled()) {
+ if (!isNfcEnabledOrShuttingDown()) {
return;
}
Object[] objectsToDisconnect;