Bug 982663: collect and transmit app usage metrics

What happens when the user locks the screen and then returns to it? Visually, the app does not appear to close and re-open. Does this code get run in that case?  Or do we report that the foreground app is in use the entire time that the phone is locked?