Rework adding bg activity starts whitelisting token for broadcasts

Add token around the places we call scheduleTempWhitelistLocked().

Move to a timeout-based mechanism - allow the receiver to open
activities from background for at least the time it's running,
but extend the privilege if it finished sooner than the allowed
timeout.

Also, make the timeout configurable in BroadcastConstants.

Bug: 123384391
Bug: 123711192
Bug: 110956953
Test: atest WmTests:ActivityStarterTests
Test: manual with Play "finished install" notifications that do
      broadcast trampoline, Chrome bookmarks widget, BBC News widget,
      Citymapper "get me somewhere" notification

Change-Id: I814472187bec4b4a1ce48112e7b666efd2d04ef6
4 files changed