summaryrefslogtreecommitdiffstats
path: root/src/com/android/nfc
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2016-03-29 11:47:39 +0200
committerMartijn Coenen <maco@google.com>2016-03-29 11:47:39 +0200
commitd07906fe33dfe2a0da05cc8e7bf4bfbfcb17906b (patch)
treeba035ec7fa6b00da4fdd4a8133de1fff45ea393b /src/com/android/nfc
parent1d84b7386cc4e8e55a7085fd4b923cab26683f6b (diff)
downloadandroid_packages_apps_Nfc-d07906fe33dfe2a0da05cc8e7bf4bfbfcb17906b.tar.gz
android_packages_apps_Nfc-d07906fe33dfe2a0da05cc8e7bf4bfbfcb17906b.tar.bz2
android_packages_apps_Nfc-d07906fe33dfe2a0da05cc8e7bf4bfbfcb17906b.zip
Don't disable NFC in airplane mode.
Bug: 22985639 Change-Id: I78c351b335c779fb0c8361509d57a8d5fa6bed63
Diffstat (limited to 'src/com/android/nfc')
-rwxr-xr-xsrc/com/android/nfc/NfcService.java60
1 files changed, 1 insertions, 59 deletions
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index f33fe680..d1b7a469 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -104,7 +104,6 @@ public class NfcService 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 int MSG_NDEF_TAG = 0;
static final int MSG_LLCP_LINK_ACTIVATION = 1;
@@ -220,8 +219,6 @@ public class NfcService implements DeviceHostListener {
P2pLinkManager mP2pLinkManager;
TagService mNfcTagService;
NfcAdapterService mNfcAdapter;
- boolean mIsAirplaneSensitive;
- boolean mIsAirplaneToggleable;
boolean mIsDebugBuild;
boolean mIsHceCapable;
boolean mIsHceFCapable;
@@ -374,7 +371,6 @@ public class NfcService implements DeviceHostListener {
filter.addAction(Intent.ACTION_SCREEN_ON);
filter.addAction(Intent.ACTION_USER_PRESENT);
filter.addAction(Intent.ACTION_USER_SWITCHED);
- registerForAirplaneMode(filter);
mContext.registerReceiverAsUser(mReceiver, UserHandle.ALL, filter, null, null);
IntentFilter ownerFilter = new IntentFilter(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE);
@@ -425,22 +421,6 @@ public class NfcService implements DeviceHostListener {
}
}
- void registerForAirplaneMode(IntentFilter filter) {
- final String airplaneModeRadios = Settings.Global.getString(mContentResolver,
- Settings.Global.AIRPLANE_MODE_RADIOS);
- final String toggleableRadios = Settings.Global.getString(mContentResolver,
- Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
-
- mIsAirplaneSensitive = airplaneModeRadios == null ? true :
- airplaneModeRadios.contains(Settings.Global.RADIO_NFC);
- mIsAirplaneToggleable = toggleableRadios == null ? false :
- toggleableRadios.contains(Settings.Global.RADIO_NFC);
-
- if (mIsAirplaneSensitive) {
- filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
- }
- }
-
void updatePackageCache() {
PackageManager pm = mContext.getPackageManager();
List<PackageInfo> packages = pm.getInstalledPackagesAsUser(0, UserHandle.USER_SYSTEM);
@@ -506,9 +486,7 @@ public class NfcService 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() || airplaneOverride)) {
+ if (mPrefs.getBoolean(PREF_NFC_ON, NFC_ON_DEFAULT)) {
Log.d(TAG, "NFC is on. Doing normal stuff");
enableInternal();
} else {
@@ -711,15 +689,6 @@ public class NfcService implements DeviceHostListener {
saveNfcOnSetting(true);
- 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);
return true;
@@ -2083,23 +2052,6 @@ public class NfcService implements DeviceHostListener {
}
new ApplyRoutingTask().execute(Integer.valueOf(screenState));
- } else if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
- boolean isAirplaneModeOn = intent.getBooleanExtra("state", false);
- // Query the airplane mode from Settings.Global just to make sure that
- // some random app is not sending this intent
- if (isAirplaneModeOn != isAirplaneModeOn()) {
- return;
- }
- 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)) {
- new EnableDisableTask().execute(TASK_ENABLE);
- }
} else if (action.equals(Intent.ACTION_USER_SWITCHED)) {
int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0);
synchronized (this) {
@@ -2145,14 +2097,6 @@ public class NfcService implements DeviceHostListener {
};
/**
- * Returns true if airplane mode is currently on
- */
- boolean isAirplaneModeOn() {
- return Settings.Global.getInt(mContentResolver,
- Settings.Global.AIRPLANE_MODE_ON, 0) == 1;
- }
-
- /**
* for debugging only - no i18n
*/
static String stateToString(int state) {
@@ -2183,8 +2127,6 @@ public class NfcService implements DeviceHostListener {
pw.println("mState=" + stateToString(mState));
pw.println("mIsZeroClickRequested=" + mIsNdefPushEnabled);
pw.println("mScreenState=" + ScreenStateHelper.screenStateToString(mScreenState));
- pw.println("mIsAirplaneSensitive=" + mIsAirplaneSensitive);
- pw.println("mIsAirplaneToggleable=" + mIsAirplaneToggleable);
pw.println(mCurrentDiscoveryParameters);
mP2pLinkManager.dump(fd, pw, args);
if (mIsHceCapable) {