Fix potential negative duration in the ServiceState tracker

Use the current time while marking the end of foreground service.

Bug: 174786928
Bug: 175024931
Bug: 140997620
Test: atest FrameworksServicesTests:ActivityManagerTest
Change-Id: I0061b5ff202d46a3f85b22af42a8a6084151fc64
4 files changed