Sometimes phones spontaneously reboot. The problem isn't too big a deal, unless your phone is encrypted. Then the phone sits, not taking calls, not pulling down email, and wasting battery life as it waits to decrypt.

In Android N, Google is making the experience less painful. When a device reboots on its own, you will retain the ability to receive phone calls. Email clients, instant messengers, and other apps will deliver notifications. Alarms will go off in the morning. In short, your phone will continue to do its job.

This is thanks to new functionality known as direct boot, which provides apps with the ability to perform limited tasks in a restricted mode. This is done using Android N's file-based encryption, which enables direct boot to set fine grained encryption policies for system and app data.

To take advantage of this feature, developers need to make their apps broadcast a LOCKED_BOOT_COMPLETED intent and determine which data should get unencrypted. Android will monitor for these apps, then make the specified data available before a device gets unlocked. All other data remains encrypted and unaccessible until a user unlocks their device.

The Droidcon video below breaks down this feature for developers who want their apps to play along nicely.

Once Android N starts rolling out to devices, more users may actually wake up and leave the house on time. Meanwhile, developers all over will start missing those nights they slept unaware of how many work-related emails came in at 2 AM.