Add hidden API to allow PendingIntent sender to allow/block BAL

For example, AlarmManagerService uses it to block all PendingIntent BAL,
so no apps can use alarm manager api to start activity from background.

The current default behavior is allowing PendingIntent to use caller's
foreground visibility to determine if BAL can be launched. We may want to
change this behavior becomes disallow by default, but it may need androidx
changes as SliceView is using PendingIntent.send() to launch apps and it
should allow apps to start BAL activity using Slice API.

For legacy app (targetSDK < T), even the flag is allowed, it won't use
caller's BAL permission to bypass BAL checking, to match the original
behavior.

Next step will be removing @hide and formalize the api.

Bug: 192341120
Test: atest BackgroundActivityLaunchTest
Test: Test AlarmManager API, PendingIntent won't cause BAL.
Change-Id: I89588473f0f028078adb9230caacb18ed4d6c504
7 files changed