What is "Android Night Mode", what triggers it, and what are the consequences? I've just been reading in the tasker UserGuide on variables:


  Night Mode
  %NIGHT
  The current Android Night Mode.
  One of on, off or auto.
  If auto, Android will decide whether it should be in Night Mode itself.


Which raised the question: What is "Android Night Mode"? Obviously it is something Android itself implements and decides on whether it is active or not (mode: auto), and that decision can be overruled (mode: on/off). But what exactly does that mean to the user? What triggers it (time? light conditions?), and what are the consequences (mute? dim?)?

I've done a Google search on the terms – but all that came up with were either apps to toggle "night mode", or apps having a "night theme".

I've checked our site for questions on "night mode", but found no complete answer to my question there. Some indicators, though:


How does Google Maps Navigation know you are in a tunnel when it switches to night mode? indicates light conditions might be part of the equation, and the consequences involve adjustments to screen brightness – but I'm not sure whether that's all to it.
Is there an easy way to switch render effects? suggests there's a specific setting for it at least with cyanogenmod: Options › Cyanogen › Interface offers "night mode" and "blue" for "rendering mode" (uh?) at least. But seeing the path, this one is obviously a CM specific thing.
all other questions just had the words "night" and "mode", but were not referencing "night mode" (e.g.: "I have airplane mode enabled at night").


Is there any complete answer to my question?
"Night Mode" is actually pretty intuitive as far as the name goes.

The OS basically attempts to estimate both sunrise and sunset, based on the current date and your latitude relative to the equator. It then determines that it is "night" if the current time falls either before sunrise or after sunset.

You can find the code for this in the base frameworks, specifically in the TwilightCalculator. There is an associated service that attempts to refresh this sunrise/sunset data in the background if you move around, called TwilightService.

In the latter file, you can also see what Android does in the event that it does not have an accurate location (I would assume this occurs if you turn off location access and such):

// In the case there is no location available (e.g. GPS fix or network location
// is not available yet), the longitude of the location is estimated using the timezone,
// latitude and accuracy are set to get a good average.


It later sets the latitude value to 0 for the calculation, which would be the equator.

It also tries to schedule updates so that they only run at day/night boundaries if you're not moving around much. For example, if it's the middle of the day and it's already calculated sunset,  it won't run again until after sunset has passed (and if it's nighttime, it will run after tomorrow's calculated sunrise).

The affects of entering "Night Mode" are entirely app dependent. There is an API that lets apps query this information if they so choose, as well as APIs to instruct the system as to which UI modes they will support. It has no real immediate impact on the system itself, though.