Remove WM lock from the path of service operations

The method WPC#areBackgroundFgsStartsAllowed may be called
frequently from ActiveServices when checking if foreground
service is allowed to start. Because it usually has no window
related operation, there should not have lock contention
from window manager.

This only changes to use fine grained lock and volatile fields.
The logic is the same as original.

Bug: 177268056
Test: BackgroundActivityLaunchTest ActivityRecordTests

Change-Id: Ia3ef5b436ff09ea0968776fa7c8ea86112e356d2
4 files changed