Fix NetworkStatsObserversTest

This patch fixes several spurious unit tests in
NetworkStatsObserversTest by using the updated waitForIdleHandler of
ConnectivityServiceTest. More specifically this fixes the following
tests:
  - testUnregister_knownRequest_releasesCaller
  - testUpdateStats_deviceAccess_notifies
  - testUpdateStats_userAccess_usageSameUser_notifies
  - testUpdateStats_defaultAccess_notifiesSameUid

This patch also removes the dummy message with type -1 sent at the end
of tests in NetworkStatsObserversTest and the associated assert, because
nothing is exercised or asserted immediately after.

This patch also updates NetworkStatsObserversTest to not depend on the
deprecated junit.framework.TestCase.

Bug: 32561414
Test: runtest -x frameworks/base/tests/../NetworkStatsObserversTest.java
Change-Id: I4fc909ee9bacc964c859fa7a3db34f9dc86b89cf
1 file changed