flight mode workaround

sampleuserhere

Active member
. It worked for SECURE but not GLOBAL (threw out error lines). And airplane_mode_radios is GLOBAL.

Afaik user has to grant WRITE_SETTINGS manually via the permission prompt or setting.


But several days ago, when i first read the value, it was from memory, set to sth like: bluetooth,nfc,wifi,wimax (don't think "cell" was there). And i cleared it, just for a test, but since then i am unable to SET it to anything. So WHY was i able to CLEAR it, but not SET it again??

Clear as it setting them to null or like what adb shell settings delete does?

If it's the former, try to set another setting. Some OS doesn't let the user to set certain setting.

Or the permission might be revoked at that time.

Are you using helper to change the setting ?

OS? (not Android version, but like MIUI or ONEUI )
 

md_sgf

Member
Also interesting that i CAN toggle airplane mode via Airplane Mode On/Off (adb hack), but CANNOT via System Setting .. [Global] airplane_mode = 1/0
 

Endercraft

Moderator (& bug finder :D)
I know there is a permission to write system settings - it should be required for secure settings too, but it seems to be a MIUI permission.
 

md_sgf

Member
Afaik user has to grant WRITE_SETTINGS manually via the permission prompt or setting.
Do you mean macrodroid asked me via a prompt?

I might try to grant WRITE_SETTINGS via adb? But in X-plore is under "Requested permissions", so does that mean macrodroid has the permissions? I presume so. So probably no point in using adb for this. But i'll try it anyway.

apk permissions 2.pngapk permissions 1.png
 

sampleuserhere

Active member
Do you mean macrodroid asked me via a prompt?

It should, It probably did when you try to change the setting for the first time.


I might try to grant WRITE_SETTINGS via adb? But in X-plore is under "Requested permissions", so does that mean macrodroid has the permissions? I presume so.
It has, but whether the permission been granted or revoked is worth checking. Check WRITE_SECURE_SETTINGS too.

Follow the instructions in the link below to check the status for the said permission. Check for both MD and MD Helper (since it seemed you execute the action with the helper.)



I know there is a permission to write system settings - it should be required for secure settings too, but it seems to be a MIUI permission.

I can't tell for sure, it should at least show up under special permissions section for each phone.

It seems like it does.
 
Last edited:

Dimlos

Well-known member
The system settings do not allow to toggle Airplane mode and it is halfway through.
Toggling the Airplane mode toggle in the settings on and off a few times will make it normal.

Airplane mode action is working on Android 11 Samsung devices.

If the Airplane Mode action does not work, the only way to switch it is to use the Intent and UI Interraction.
 

Attachments

  • Airplane mode.jpg
    Airplane mode.jpg
    97.8 KB · Views: 2
  • Settings.jpg
    Settings.jpg
    110.4 KB · Views: 2

Dimlos

Well-known member
Attached are sample macros for intent and UI interaction.
I am not sure if it will work on Android 10.
 

Attachments

  • Macro.jpg
    Macro.jpg
    342.5 KB · Views: 7
  • Airplane_Mode_Toggle.macro
    5.2 KB · Views: 3

sampleuserhere

Active member
The system settings do not allow to toggle Airplane mode and it is halfway through.
Toggling the Airplane mode toggle in the settings on and off a few times will make it normal.

Airplane mode action is working on Android 11 Samsung devices.

If the Airplane Mode action does not work, the only way to switch it is to use the Intent and UI Interraction.

Indeed, I confused it with system.

It seemed that he wanted to make the airplane mode to disable the cell radio when it's toggled on. By default, it should do it but it's not the case with his phone.
 

md_sgf

Member
Also interesting that i CAN toggle airplane mode via Airplane Mode On/Off (adb hack), but CANNOT via System Setting .. [Global] airplane_mode = 1/0
sampleuserhere suggested that MD helper may need permissions via adb, and yes it did.
So I opened MD helper first, and saw a whole heap of error messages (involving not having required permissions).
I gave MDh the permission via adb, and now i can set System Setting .. [Global] airplane_mode to 1/0, as well as [Global] airplane_mode_radios to whatever i want now! :D(y)
I'm unsure why MD didn't ask me to allow MDh the permissions. Maybe due to it being a separate app? I had no idea about it. I just ticked the checkbox and forgot about it! lol

I have set [Global] airplane_mode_radios to cell (as that is ALL i want flight mode to toggle). I JUST want to RELIABLY enable/disable txts/calls, like flight mode is SUPPOSED to do, but HASN'T been for months at least.
Still getting 1/2-blue button, & tapping it does nothing. But i'm also getting normal blue button as well (when flight mode is on). So things have improved.
But when i set [Global] airplane_mode to 0, i can see switch is off, but still plane icon in status bar. Ie settings switch says it's off, [Global] airplane_mode variable says it's off (as i show it's value in a popup message to confirm it has been changed), but status bar says it's (still) ON.

I am am almost there now!
I might not even require my "dummy" quick settings button any more!? (identical to system flight mode QS button, but runs a macro, which enables/disables flight mode programmatically).
 

md_sgf

Member
But when i set [Global] airplane_mode to 0, i can see switch is off, but still plane icon in status bar. Ie settings switch says it's off, [Global] airplane_mode variable says it's off (as i show it's value in a popup message to confirm it has been changed), but status bar says it's (still) ON.
No problem when use Airplane Mode On/Off action (ie status bar icon updates correctly). There's no need to use System Setting as i can just use this! (y)
 

justinscott

New member
It seems (for unknown reasons) flight mode does not work correctly on my phone. It appears to be always disabled (as can still do TXTs & calls when it shows as enabled, or at least very often it does). Most of the time the flight mode quick setting is 1/2 blue (dimmer blue).

What i would like to be able to do, if possible, is to disable/enable the mobile radio (just to disable/enable TXTs & calls). And i would then create my own quick setting, to replace the flight mode quick setting, which doesn't work properly.

Ideally i'd be able to use standard macrodroid for this, but not really sure if there is something for this. Shell script?
Do i need adb to grant permission??

So far i have tried these things...
System Setting action .. Global .. airplane_mode_on: x (as just toggles flight mode)
System Setting action .. Global .. airplane_mode_radios: x (stays at blank, whether flight mode on or off)
System Setting action .. Global .. airplane_mode_toggleable_radios: x (=bluetooth,wifi,nfc; not interested in these. i just want to affect the cell radio)
System Setting action .. Global .. cell_on: x (stays at "1"; can't set to "0")
System Setting action .. Global .. sim2_onoff_state: x (stays at "2"; can't set to "0")
So, I only recently discovered that the newer versions of Android (4.2 and above) no longer allow the use of Flight Mode toggles. On my phone, at least, I either have to dig around in settings or use the power button to enter flight mode now. I can't root this phone (not my own), has anyone discovered any ways to allow me to put a flight mode toggle as a button on one of my home screens?
 
Last edited by a moderator:

md_sgf

Member
has anyone discovered any ways to allow me to put a flight mode toggle as a button on one of my home screens?
You might be able to create a toggle switch using a widget maker app.
Or create a custom widget using macrodroid. And use Widget Button Modify to alter the color/icon when toggle it.
 
Top