Use the reason code from standby bucketing in bg restriction if needed

If the bg restriction level is inferred from the app standby bucket,
use the reason code from the app standby as the one of being in
such a bg restriction level.

Also fixed an issue where we'd need to restrict the offending bg apps
when it's backgrounded.

Bug: 225951652
Bug: 203105544
Test: atest FrameworksMockingServicesTests:BackgroundRestrictionTest
Change-Id: I5925e90e19d2f8c99d43c0637560d8629c887ed4
3 files changed