Add a new field mAllowStartForegroundAtEntering.

To save the mAllowStartForeground value when the service is entering FGS
state.

The logging of FOREGROUND_SERVICE_STATE_CHANGED__STATE__ENTER event
could be deferred due to fgs notification deferred,
mAllowStartForeground value could be changed for example due to
stopService(). The FOREGROUND_SERVICE_STATE_CHANGED__STATE__ENTER event
will read from mAllowStartForegroundAtEntering instead of
mAllowStartForeground.

For the same reason, also add a new field mAllowWhileInUsePermissionInFgsAtEntering
to save mAllowWhileInUsePermissionInFgs value when the service is
entering FGS state.

Bug: 191054441
Test: build and run, monitor westworld event logs.
Change-Id: Iad4541068ab27cb7686899998d833a7c6ada3172
2 files changed