summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2012-01-10 14:41:42 -0800
committerMartijn Coenen <maco@google.com>2012-01-10 14:52:15 -0800
commit1668f533e6a2f041703919bafa4c3ceee62dbc38 (patch)
tree59697c7ebfa6ca43534ecb4b50b93a52595b7938 /src/com
parent128f32befd09c124cbede2dad169824abd44cdf9 (diff)
downloadpackages_apps_nfc-1668f533e6a2f041703919bafa4c3ceee62dbc38.zip
packages_apps_nfc-1668f533e6a2f041703919bafa4c3ceee62dbc38.tar.gz
packages_apps_nfc-1668f533e6a2f041703919bafa4c3ceee62dbc38.tar.bz2
Make airplane override for NFC persistent.
Make behavior identical to wifi/bluetooth. Bug: 5455123 Change-Id: I8c10888b7d3129723c6520dc0e81fa1793ae542c
Diffstat (limited to 'src/com')
-rwxr-xr-xsrc/com/android/nfc/NfcService.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index 2ec937e..7fef485 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -97,6 +97,7 @@ public class NfcService extends Application implements DeviceHostListener {
static final boolean NDEF_PUSH_ON_DEFAULT = true;
static final String PREF_FIRST_BEAM = "first_beam";
static final String PREF_FIRST_BOOT = "first_boot";
+ static final String PREF_AIRPLANE_OVERRIDE = "airplane_override";
static final boolean PN544_QUIRK_DISCONNECT_BEFORE_RECONFIGURE = true;
@@ -457,8 +458,9 @@ public class NfcService extends Application implements DeviceHostListener {
break;
case TASK_BOOT:
Log.d(TAG,"checking on firmware download");
+ boolean airplaneOverride = mPrefs.getBoolean(PREF_AIRPLANE_OVERRIDE, false);
if (mPrefs.getBoolean(PREF_NFC_ON, NFC_ON_DEFAULT) &&
- !(mIsAirplaneSensitive && isAirplaneModeOn())) {
+ (!mIsAirplaneSensitive || !isAirplaneModeOn() || airplaneOverride)) {
Log.d(TAG,"NFC is on. Doing normal stuff");
enableInternal();
} else {
@@ -647,9 +649,15 @@ public class NfcService extends Application implements DeviceHostListener {
NfcService.enforceAdminPerm(mContext);
saveNfcOnSetting(true);
- if (mIsAirplaneSensitive && isAirplaneModeOn() && !mIsAirplaneToggleable) {
- Log.i(TAG, "denying enable() request (airplane mode)");
- return false;
+
+ if (mIsAirplaneSensitive && isAirplaneModeOn()) {
+ if (!mIsAirplaneToggleable) {
+ Log.i(TAG, "denying enable() request (airplane mode)");
+ return false;
+ }
+ // Make sure the override survives a reboot
+ mPrefsEditor.putBoolean(PREF_AIRPLANE_OVERRIDE, true);
+ mPrefsEditor.apply();
}
new EnableDisableTask().execute(TASK_ENABLE);
@@ -1825,6 +1833,8 @@ public class NfcService extends Application implements DeviceHostListener {
if (!mIsAirplaneSensitive) {
return;
}
+ mPrefsEditor.putBoolean(PREF_AIRPLANE_OVERRIDE, false);
+ mPrefsEditor.apply();
if (isAirplaneModeOn) {
new EnableDisableTask().execute(TASK_DISABLE);
} else if (!isAirplaneModeOn && mPrefs.getBoolean(PREF_NFC_ON, NFC_ON_DEFAULT)) {