summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2012-02-27 14:34:10 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-02-27 14:34:10 -0800
commit51c2c8f3f8495c9521f15748495b2786cdf97744 (patch)
tree7866c3d39752f20d7cd7ad34f00ae9780d529f8d /src
parent13505b59355630901ec90d3415c1ceb29b7fa6df (diff)
parent9a93cf5cf4b845c7983f202fe0e03615f31f6db0 (diff)
downloadpackages_apps_nfc-51c2c8f3f8495c9521f15748495b2786cdf97744.zip
packages_apps_nfc-51c2c8f3f8495c9521f15748495b2786cdf97744.tar.gz
packages_apps_nfc-51c2c8f3f8495c9521f15748495b2786cdf97744.tar.bz2
Merge "Fix crash when disabling NFC with target in field."
Diffstat (limited to 'src')
-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;