Initial implementation: Broadcasts on app launch.

Look for com.android.launcher3.action.LAUNCH to be sent when
an icon is clicked in Launcher. (Restricted to
com.android.launcher3.permission.RECEIVE_LAUNCH_BROADCASTS
which is a signature permission right now.

This is specifically tracking apps launched via shortcut
icon; any other method of launching apps (notifications,
recents, internal navigation, etc.) is outside of Launcher's
purview and hence not broadcast.

The broadcast currently includes, in the "intent" extra, the
Uri flattening of the specific shortcut clicked.

The file /data/data/<pkg>/files/launches.log contains a
binary log of all such launches, including additional info
like screen# that should probably be in the broadcast too.

This info is summarized in .../stats.log, which encodes a
simple histogram of app launches since basically forever.
This should probably be done over a sliding window, which
will require more processing on startup.

Bug: 10031590
Change-Id: Ifc5921d5dc20701c67678cbfdc89b03cacd62028
3 files changed