Persistent Bluetooth / NFC in Airplane mode - YotaPhone

Hi all,
On my previous device (gt-i9502 dual sim Galaxy S4), I used a ROM in which you could find a setting to keep bluetooth enabled all the time, even when switching on the airplane mode. I was expecting that rooting my Yotaphone 2 would let me get that behavior again (out of the box, the bluetooth gets switched off when enabling airplane mode, which is, after all, the goal of airplane mode, but happens to be a pain when you use an Android Wear watch).
I've googled a bit for a solution, either an utility or customized setting app, and I found a very simple hack that I thought I'd share here in case other Yotaphone 2 users like me want this behavior:
What you need is:
1) a rooted Yotaphone 2
2) an sqlite database editor that can access system databases on rooted phones (I used Sqlite Editor by Speed Software, which is nice but not free, you can certainly find a freeware equivalent).
In your sqlite editor, look for the following file:
/data/data/com.android.providers.settings/databases/settings.db
When you open this file, in the "global" database, you'll find the two fields that we want to look at:
airplane_mode_radios
cell,bluetooth,wifi,nfc,wimax
airplane_mode_toggleable_radios
bluetooth,wifi,nfc
What this means is that by default, switching the airplane mode on/off will switch the cellular, bluetooth, wifi/wimax and nfc radios in the phone (in the airplane_mode_radio field) and that when airplane mode is activated, you can still manually re-enable bluetooth, wifi or nfc (airplane_mode_toggleable_radios field).
I use a nfc sticker on my bedstand, programmed as a shortcut to switch in and out of airplane mode, so in my case I simply modified the airplane_mode_radios field to remove bluetooth and nfc:
Edited airplane_mode_radios
cell,wifi,wimax
Kudos to cdl for the initial post on AndroidForums (http://androidforums.com/threads/ho...when-enabling-disabling-airplane-mode.659825/)

Related

Entering flight mode - best practices (RIL / TAPI etc)

Hi,
I am attempting to develop a program which must have good control over the state of the built in GPRS or CDMA unit of a Windows Mobile 2003 PDA device.
One requirement is to be able to enter “flight mode” on demand (when the user selects a menu option). The user can not select the connection manager notification and manually select the “enter flight mode” link as this is a fully locked down application (the user does not have access to it). Hence I am looking for ways to programmatically enter/leave/query the status of flight mode.
At present we are using Connection Manager to deal with connection management and RIL to deal with entering/leaving flight mode. In previous versions we used TAPI (the lineGetEquipmentState and lineSetEquipmentState functions) to enter/leave flight mode.
Both approaches (using RIL or TAPI) are causing us grief, mainly due to having to support numerous PDA devices from numerous OEMs.
How have other people approached entering a device into flight mode via code? I am interested in suggestions on the following issues we have having with various techniques, and wondering if anyone has a solution which works well across a wide range of devices (we support various Symbol, Intermec, HTC, HHP, and Panasonic devices to name a few).
Our current issues are as follows:
If using TAPI to enter flight mode:
On some devices such as the Intermec 760 after using lineSetEquipmentState to enter LINEEQUIPSTATE_MINIMUM, querying the state via lineGetEquipmentState only returns the error LINEERR_OPERATIONFAILED. Entering full power mode again means lineGetEquipmentState starts returning proper values again. However you can’t assume that lineGetEquipmentState returning LINERR_OPERATIONFAILED means being in flight mode as periodically some devices are returning this even while in full power mode (i.e. call it 5 times, three might return LINEERR_OPERATIONFAILED and the other two will return valid results).
Alternatively I have tried using the lineGetLineDevStatus function and checking flags within the returned dwDevStatusFlags field. For instance LINEDEVSTATUSFLAGS_CONNECTED or, LINEDEVSTATUSFLAGS_INSERVICE. Again in testing this on numerous devices (eg. Xda IIi and Intermec 760 for instance) both the connect and inservice fields appear to be constantly set, even if in a GPRS based devices there is no SIM card present.
If using RIL to enter flight mode:
We have also tried accessing RIL (using information from http://www.xda-developers.com/ was very helpful in using this “undocumented” API), via calling RIL_SetEquipmentState(RIL_EQSTATE_MINIMUM) and listening for RIL_NOTIFY_RADIOEQUIPMENTSTATECHANGED notifications to tell us when the radio enters/leaves various power states. The problem with this approach is that on some devices (in certain cases) we appear to never get a notification indicating that we have returned to FULL power mode, instead we get RIL_EQSTATE_UNKNOWN being constantly returned.
On one device using the RIL interface even appears to lock up the device (followed by a soft reset a couple of minutes later) while we attempt to enter flight mode by calling, RIL_Hangup, RIL_UnregisterFromNetwork and RIL_SetEquipmentState in that sequence.
I’m open to suggestions on how to enter flight mode via code. Does Microsoft provide an API to do this across all devices in a consistent manor? I guess from previous similar experiences that is wishing too much.
At present I am somewhat dubious about using the RIL interface to enter flight mode while also using Connection Manager at the same time to maintain a connection. At present before attempting to enter flight mode I’m calling ConnMgrReleaseConnection in order to try to tidy up Connection Manager’s state as much as possible, but is it possible that Connection Manager is still getting confused by me going in underneath it (via RIL) and “pulling the carpet out from underneath it”?
Thanks,
Christopher Fairbairn

application to control different phone profile

Hi,
are there any application to control different phone profile.
i would like to have at least three profile
a) in my home phone should ring, wireless connection should be via desired wifi connection (blue tooth and data connection via tmobile should be disable)
b) when i am in the car I need blue tooth enable, wifi disable
c) when i am at work, bluetooth disable, wifi disable, and data connectin via tmobile disable.
etc...
please advice me whether there is a application to do this.
thanks
ooo7
Toggle Settings from the market seems to do most of this, although not sure about turning off the data connection. You can set it to 2G though.
I think Locale would do some too - it can be set to behave in a certain way when at a certain location - I've NEVER used it though, just read about other users using it for this kind of function so check it out
hi,
thanks for your quick responses.
yes local will do some of it, but i mainly needed to change profile as an when i needed, i.e. not based on geographical location.
if you come across any other application please let me know. i am sure this sort of application will be really useful for lot of other people.
regards
ooo7
You can also try "Ear" it does almost everything except the data connection part
the 5 widgets you can get (hold finger on empty space -> htc widget -> settings) will do this... sure, you don't get the benefit of pre-sets (there _will_ be an app that will do this, somewhere) but it's totally flexible
you can certainly do the "wifi on / bluetooth & data off" and vice versa for leaving the house via locale... might be able to get by with manual toggles after that (or also have a location for work)
location works great!
try it!

BT in airplane mode

Hi guys,
do you know a way or app that will allow me bluetooth in airplane mode?
It is ****ty thing 'cause when I take off and I am permitted to use any device like my mobile I can not use BT in airplane mode, I have BT headset. If I turn off airplane mode then mobile will scan for cellular network and drain my battery.
This is possible in WinMobile. I can not believe that nobody has thought about it.
I have found one app that is not working on DHD and one workaround.
http://www.androidzoom.com/android_applications/travel_and_local/airplane-mode-wifi-tool_fmc.html
Open your dialer, dial *#*#4636#*#* (4636 = info, btw) this will open at test menu. Navigate to "phone info", scroll down to "turn radio off" and presto, you have gps, wifi and bluetooth, but no data, sms, or voice. I would be careful messing with other settings in this menu, by the way.
Is there any tweak or app?
Issue 9142: Inconsistency in Airplane mode (Bluetooth)
http://code.google.com/p/android/issues/detail?id=9142

Remove Wifi functionality?

So my work has banned all cellphones and wifi capable devices. I work graveyards and absolutely DEPEND on my Nook for reading all night long. Is there a way with Root Explorer or ADB that I can totally kill Wifi?
I want to be able to hit the wifi toggle and show a supervisor that it won't work.
Hopefully someone can help...
You can do it quite easily with Tasker. Disclaimer: the way I did it, each time you hit the toggle, it will show the hollow (not connected) wifi bars for half a second, then nothing. This is on cm7 by the way.
There is a 2 week trial of Tasker if you want to try it. There may well be a better way to do it in Tasker too.
Context: State > Net > Wifi Connected (any time wifi tries to connect it will do the following)
Task: Net > Wifi > Set to Off (it sets wifi off)
Exit Task: Net > Wifi > Set to Off (this sets it off so it doesn't continuously attempt to reconnect)
Only a few clicks in Tasker to re-enable wifi if you need it too.
Thanks for the reply, I figured out a way with Root Explorer while I was at work last night. I navigated to /system/lib/modules and renamed the only file there (something like wlan.ko but longer) with an added .kill suffix to the end. No need to reboot or anything. Hitting the wifi toggle now does nothing, going into wireless settings and pressing the wifi on toggle shows ERROR where it would normally say TURNING ON or SCANNING or whatever. Easy to reverse when needed.
Thanks again!

Systemless root + Secure Settings + Android Pay = Problem

Back story: I've always rooted in the past, but purely for entertainment / backup purposes. Now however, I actually NEED root for my phone to function as I believe it should due to a "glitch" in the system. Please reference the thread that I started in the google help forums here (sorry can't post outside links):
I'm a new Project Fi customer with a Nexus 6P. The phone is fantastic, but I'm having a problem making calls while at home. The Project Fi CSR that I chatted with was not very helpful and was only able to tell me what I already knew.
The problem is that one of my neighbors has a Sprint "home cell tower" device (I believe it's an Airave but no way to know for sure) that my phone connects to when I attempt to place a call. When I hit send, I hear 3 beeps followed by an automated message "We are unable to complete your call at this time, please try again later; Message 12: Switch 2195"
Currently, my only option if I want to make a call is to turn on "airplane mode" and then turn wi-fi back on so that it reconnects to my home wi-fi and then place the call. Obviously this is not ideal as it's not really practical to turn airplane mode off and on when I come and go from my house.
Is there another option that I am missing. It seems almost too obvious that there should be a "prefer wi-fi calling when available" toggle somewhere, but I don't believe there is.
Any ideas / suggestions?
Click to expand...
Click to collapse
and which I proceeded to find a solution for as detailed here (sorry can't post outside links):
I've found a better solution (or at least a more convenient one) to this problem. This solution is also workable for people who feel that wi-fi calling would be more reliable in specific places than their cellular connection for making phone calls. The only caveat: you need to root your phone for Tasker and System Settings to function as required for these tasks. I have used the apps Tasker and Secure Settings to set up a rule for my phone that will automatically turn off the cellular radios and leave wi-fi on when I'm at home. When my phone connects to my home wi-fi as identified by the SSID of my home wireless router, Tasker initiates the Task to turn the cell radios off thus forcing all incoming and outgoing calls be routed over wi-fi. When my wi-fi connection is lost (when I leave home), Tasker initiates another task to turn the cellular radios back on. This has been working flawlessly for about 3 weeks on my phone, and requires absolutely no user input after the initial setup. I highly recommend this solution as it is far more convenient than having to use separate dialer apps when at home and away.
Click to expand...
Click to collapse
Long story short, I need to use Tasker and Secure Settings to manipulate airplane mode based on my location as determined by the wifi SSID to which my phone is connected. I ALSO would like to be able to use Android Pay. Unfortunately, Android Pay doesn't work unless I remove SU from the /su/xbin_bind folder, and if I do that, then Secure Settings doesn't work.
I attempted to use tasker to automate the renaming of the SU file when the Android Pay app is started and then rename the file back to SU after Android Pay closes, but the results only work sometimes... it's flaky at best and I don't know why. Sometimes Android Pay works, sometimes not, other times Secure Settings Works, and sometimes not.
Does anyone have any suggestions for me? Is there going to be an update to Secure Settings so it will work with systemless root without having the create the symlinks? Is there a way to use Tasker to turn off the cell radios only without the need for the Secure Settings app? (I'm a relative novice with Tasker)
Thanks,
Adam
Oops! Posted in wrong section. Mods, please move.
mntnbkr said:
Does anyone have any suggestions for me? Is there going to be an update to Secure Settings so it will work with systemless root without having the create the symlinks? Is there a way to use Tasker to turn off the cell radios only without the need for the Secure Settings app? (I'm a relative novice with Tasker)
Thanks,
Adam
Click to expand...
Click to collapse
Don't bet on a Secure Settings update. It seems a dead project.
You can do it without secure settings, as you're rooted (as per this post)
In tasker, instead, set your task to perform Code -> Run shell -> Command: "settings put global airplane_mode_on 1; ; am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true" -> Check Use Root checkbox, for going into airplane, change 1 to 0 and true to false to disable and return to normal operation.
rgawenda said:
Don't bet on a Secure Settings update. It seems a dead project.
You can do it without secure settings, as you're rooted (as per this post)
In tasker, instead, set your task to perform Code -> Run shell -> Command: "settings put global airplane_mode_on 1; ; am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true" -> Check Use Root checkbox, for going into airplane, change 1 to 0 and true to false to disable and return to normal operation.
Click to expand...
Click to collapse
Thanks for the reply and info! I'm not terribly proficient with Tasker, but I'm going to give your suggestion a shot. If it works, that would be great!:good:

Categories

Resources