Revert "BG-FGS-start while-in-use permission restriction improve..."

Revert "Add test cases for background startForeground() improvement."

Revert submission 15081873-cherrypick-security_backport_183147114-an8dvy98fv

Reason for revert: https://b.corp.google.com/issues/197066403#comment15
After the app calls Service.startForeground() to put the app into foreground service mode, the service has mAllowWhileInUsePermissionInFgs set, if it is true, the app/service can access location/camera/micophone.

Some apps may call Service.startForeground() again (for any reason, could be a app's unintentional redundant call, could be that app want to update the notification of the foreground service), but at this moment the app has went into background mode, although the foreground service is still running. The second or later Service.startForeground() call may set mAllowWhileInUsePermissionInFgs to false and the app may lose location/camera/micophone access. This is incorrect because the foreground service is still running and we expect location/camera/micophone access to continue.

The Samsung Voice Recorder app has run into this situation.

Reverted Changes:
I0aca484e5:BG-FGS-start while-in-use permission restriction i...
I4988dbba1:Add test cases for background startForeground() im...
Bug: 183147114
Bug: 197066403
Change-Id: Iad32e4391fa15bc252e50f9b858fe2e5225edb19
Merged-In: Idc88f274c7a323d175d65bb47eca041772ae9bb7
3 files changed