Validate the ServiceRecord state while handling misbehaving FGS

Fix a race condition where the previous misbehaving FGS's notifcation
is being posted, but that FGS's being stopped, and meanwhile a new FGS
is coming up, the system would get confused and results in
IllegalStateException.

Bug: 182160371
Test: atest CtsAppTestCases:ServiceTest
Change-Id: If18e1d7ba88aef693349b82dc6e70f7d98c68665
Merged-In: If18e1d7ba88aef693349b82dc6e70f7d98c68665
(cherry picked from commit ae5a219b955d63cbfcc15465d145a9303aafb807)
1 file changed