renyuneyun / Easer

User-defined explicit automation for Android
https://renyuneyun.github.io/Easer/
GNU General Public License v3.0
810 stars 93 forks source link

Easer can switch Do Not Disturb ON but not OFF #265

Open scruloose opened 5 years ago

scruloose commented 5 years ago

I have a script to turn Do Not Disturb mode ON and OFF depending on certain combinations of AC charging and time of day. The Profile to turn ON DND [Ringer Mode (checked) → 'Do not Disturb' → Priority] works as expected, which is easy to verify because the Android system notification for "Do not disturb is turned on" appears, and the DND button in the phone's quick-panel is illuminated. However, when the Profile to switch OFF DND [Ringer Mode (checked) → Normal] kicks in, nothing happens. The "Do not disturb is turned on" notification is still present, and the DND button in the phone's quick-panel is still illuminated. I have tested this by long-pressing the Ringer On profile directly in Easer's Data view and tapping "Trigger this Profile". Still nothing.

To Reproduce Steps to reproduce the behavior:

  1. Create a Profile with the action 'System config' → 'Ringer Mode" → 'Normal';
  2. Turn on DND (manually, by Easer script, or with Android schedule. Makes no difference);
  3. Trigger the Easer Profile to switch Ringer mode to Normal;
  4. Ringer mode does not change.

Expected behavior I expect that a Profile to set 'Ringer mode' to 'Normal' would turn off Do Not Disturb when triggered, thus leaving the phone in normal "Ring" mode.

Extra phone info (please complete the following information): Galaxy S9, non-rooted, running Android 9, up to date with Samsung OTA patches.

Additional info This seems similar to Issue #154, so I tried to follow the fix described by @bughunter2, but I can't find any such "silent mode switcher" permission:

I'm stumped. If there is a "silent mode switcher" permission that needs to be manually granted, where would I find it?

just-Nob commented 5 years ago

Hi @scruloose,

that's strange. I've tested it on my phone with my "test widget" as the script's trigger, and it works without any hassle.

On the other hand, I remember that a few weeks ago, I've had similar problems that it seemed like the DND mode was very tenacious. That time, I used a time event as the trigger, and I guess it was Easer v. 0.7.8-beta1 or -beta2. Unfortunately, I'm not able to reproduce that issue now.

I'm currently using Easer 0.7.8-beta3, running on 64 bit arm, Android Oreo 8.1.

renyuneyun commented 5 years ago

Could this be a duplicate of #154 ?

154 was due to permission. See this comment for the specific description.

scruloose commented 5 years ago

Sorry for the late reply—other projects intervened. ;-)

@renyuneyun: In the "Additional Info" section above, I compared my problem to issue #154 and described in some detail my attempts to find an applicable permission to grant as described in the comment you linked to.

Did I miss something? Is there anywhere else I should look for such a permission, beyond what I have already listed?

renyuneyun commented 4 years ago

My apologize for replying sooo late...

You need to go to: system setting --> apps --> special app permissions --> "DnD" permission .

The exact route may vary depending on your ROM, but should be similar.

scruloose commented 4 years ago

On my ROM (Samsung Galaxy S9 stock), it's called "special access" rather than "special app permissions" but DnD is in there, and it is already enabled.

Also under special access → notification access, there are three entries for Easer:

All three of them are already enabled.

Now that I have actually located the (cunningly hidden) "Silent Mode Switcher" permission and verified that it has already been granted, I think we can rule out issue #154 as the cause in my case.

renyuneyun commented 4 years ago

Hmm... interesting. (Apologize for not responding earlier. I was quite busy recently.)

There was actually once on my device that changing DnD doesn't work, but that's "not work" at all (and a reboot fixed it, because the service was not started by the system).

I googled and didn't get any real clue. But this post might be similar to yours. Could you please confirm whether it works or not on your case?

scruloose commented 4 years ago

I looked at that post and the discussion it links to, but it doesn't seem to be the same problem. They are discussing workarounds for being unable to turn DND off at all. I can turn DND off manually with no problem, just by tapping the button in the quick-panel. The built-in DND schedule turns it on and off just fine too.

It's only Easer that seems to be able to turn DND on consistently, but never off.

ddb1024 commented 3 years ago

I have a kind of similar Problem with the Silent Mode Switch, i can enable it, but can't disable it. But to enable Silent Mode i need to use Ringer Mode Normal The only other Mode that is working is: Ringer Mode Vibrate Do not Disturb does nothing. Notification Access settings are set like @scruloose already described. I tried the current beta, reinstalled the App, nothing worked. My Phone is a Xiaomi Poco X3 NFC. I have recently upgrade the Official Firmware to MIUI 12.0.8.0, Android 10>11. After then the behavior started.

racuna commented 1 year ago

Same problem here. In my previous phone, setting ringer to "normal" worked just fine to disable DnD. Now (MIUI 13 based on Android 11), that profile doesn't disable DnD