Current as of October 19, 2013 (M31)
At boot, the panel backlight's brightness is set to 40% (computed linearly) of its maximum level by the boot-splash Upstart job. This happens before the boot splash animation is displayed via the ply-image command.
After powerd starts, it chooses an initial backlight brightness based on the power source (either AC or battery) and the ambient light level (either very bright, i.e. direct sunlight, or something dimmer than that). Note that the brightness percentages appearing in powerd's log are not computed linearly; see policy::InternalBacklightController::PercentToLevel() for details.
Devices that lack ambient light sensors just use the "normal ambient light" levels listed above. Note that these levels may be set differently for different devices.
In the past, powerd made continuous adjustments to the screen brightness based on the ambient light level. This was distracting to users and also generally ineffective: the majority of indoor environments occupy the bottom end of the range reported by our ambient light sensors. Due to the coarse readings within this range, the automatically-chosen brightness levels were frequently undesirable. We decided to switch to just two levels: one that would work well in most indoor environments, and a very-bright level for outdoor environments.
When the power source or ambient light level changes, powerd transitions to the new brightness level. When the user presses the brightness-up or brightness-down keys, powerd animates to the requested level and stops making ambient-light-triggered automated adjustments until the system is rebooted.
The user-configured brightness is tracked separately for AC and battery power. When the power source changes after the user has manually set the brightness, powerd transitions to the appropriate user-configured level, with some constraints: the brightness should not decrease when switching to AC power or increase when switching to battery. The user-configured levels do not persist across reboots.
In the past, the previous user-configured level was restored at boot, but this was deliberately removed. A given device is frequently used in many different environments: dark rooms, well-lit rooms with lots of ambient light, etc. We decided that always booting with a reasonable default brightness was preferable to sometimes restoring a blindingly-high brightness when booting in a dark room or restoring an extremely-dim brightness when booting in a bright room.
When the user is inactive for an extended period of time, the screen is dimmed to 10% of its maximum level (computed linearly) and then turned off. The screen is turned back on in response to user activity (which is interpreted broadly: keyboard or touchpad activity, power source change, external display being connected or disconnected, etc.).