Toggling Night Mode with Tasker on Android Pie

  1. Adam.rosenthal Gingerbread Jan 2, 2019

    Adam.rosenthal, Jan 2, 2019 :
    Before the recent Pie update, I had some Tasker profiles set up to automatically toggle night mode on and off because the built in "Turn on Automatically" settings aren't enough for what I want to do. This all worked perfectly on Oreo by modifying the secure setting for night-display-activated. After the Pie update however, modifying the same secure setting now only updates the quick tile for night mode but night mode doesn't actually turn on or off. When I use the secure settings find in Tasker and toggle the quick tile directly, it recognizes that the same secure setting is changed as I would have expected. I can only assume some other hidden setting must also be modified or some service is triggered, but I have no idea what either of those would be.

    Has anyone else run into this same problem and came upon a solution that wouldn't involve using auto input?

    Since it might matter, I am running stock OOS 9.0.0 on my unrooted 5.
    Last edited: Jan 2, 2019

  2. Andy L. Gingerbread Jan 2, 2019

    Andy L., Jan 2, 2019 :
    As you mentioned in the post, the same thing happened to me. Interestingly though, using a flow to change the integer values of the night_display_activated setting, both the switch toggle and quick settings tile gets stuck in their current state; manually toggling night mode will still turn it on or off depending on its original state, but it will immediately reset itself to its original state.

    Anyway, while searching up the setting, I did come across a similar setting named night_display_auto_mode which still uses the same integer values, but does the job just fine for me.

    F.Y.I I'm doing this on Automagic on Beta 24 for 5T, but it should still give you the same result. Give it a try and see how it goes.

    Adam.rosenthal likes this.
  3. Adam.rosenthal Gingerbread Jan 2, 2019

    Adam.rosenthal, Jan 2, 2019 :
    That worked perfectly. I didn't even bother trying it before because I assumed it was only associated with the built in time control. Bad assumption.

    Thanks for the help! Hopefully this can help someone else too

  4. Andy L. Gingerbread Jan 2, 2019

    Andy L., Jan 2, 2019 :
    I think changing this setting may be the same as Night Mode being toggled on schedule depending on the start and end time you've set, while the other one (night-display-activated) is the same as just manually toggling it.

    Anyway, great to hear you got it working. I'm glad to have helped!

    Adam.rosenthal likes this.
  5. bartekzn Cupcake Jun 17, 2019

    bartekzn, Jun 17, 2019 :

    Hi Andy,

    Many thanks for your hint!
    I was trying to get it to work by changing night_display_activated'', but it was only changing the tile without any effect.
    I tested changing 'night_display_auto_mode' with Tasker + AutoTools Secure Settings and it works too. One thing I had to change though was to switch Night Mode from always on to schedule.
    I like to have Night Mode always on to reduce the strain on my eyes and only disable it for photo-related applications.
    So in the end I set the Night Mode to 'Custom Schedule' from 4:00am to 3:59am (24h less one minute) and am using Tasker with AutoTools to toggle it via 'night_display_auto_mode'.

    Thanks again for your post, I was finally able to make this work since updating to Pie broke it the old way.

    Andy L. likes this.
  6. Andy L. Gingerbread Jun 20, 2019

    Andy L., Jun 20, 2019 :
    Yes, it makes sense if you have to turn it off first or change it to scheduled as it overrides the automatic setting just like with Do Not Disturb mode.