Rewrite "Reset all maps in AndroidNetworkMonitor Start()/Stop()"

This reverts commit 8cd7b0a7babf3f58f6beab70fcabeb75e66c1bed.

The assumption in AndroidNetworkMonitor that an interface name
is unique has turned out to be incorrect :( for some (weird) devices,
i.e ccmni0.
It is unclear if it is a permanent setup or a transient state.

This cl/ changes the impl. to cope with that, the last
OnNetworkConnected_n "owns" the interface name, and when
OnNetworkDisconnected_n runs, we check if we're "owner"
and maybe set a new "owner" (if we're not "owner" we do nothing).

New testcases added.

I also
1) change NetworkMonitorInterface to return a struct
with all the information that is requested with interface name
as key.
2) Change Network.cc adding (debug) assertions that network
properties can't change inside a loop (in one thread).

Original change's description:
> Revert "Reset all maps in AndroidNetworkMonitor Start()/Stop()"
>
> This reverts commit 02293096f9689fee3d32defa77dca227cc1eee90.
>
> Reason for revert: mysterious crashes in android_network_monitor.cc
>
> Original change's description:
> > Reset all maps in AndroidNetworkMonitor Start()/Stop()
> >
> > This cl/ fixes another race condition with the recent additions
> > to NetworkMonitorAutoDetect (getAllNetworksFromCache).
> >
> > The getAllNetworksFromCache-feature uses the by the Android team
> > preferred way of enumerating networks, i.e to register network listeners.
> >
> > Th recent fix to add IsAdapterAvailable, https://webrtc-review.googlesource.com/c/src/+/257400
> > contained a bug in that the adapter_type_by_name_ map was not
> > reset either on disconnect or Start/Stop.
> >
> > This cl/ addresses that including unit test.
> > It also de-obfuscates NetworkMonitor so that it always
> > calls NotifyOfActiveNetworkList on startMonitoring even
> > if list.size() == 0. This should not matter but makes
> > code easier to understand.
> >
> > Bug: webrtc:13741
> > Change-Id: I438b877eebf769a8b2e7292b697ef1c0a349b24f
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258721
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#36530}
>
> Bug: webrtc:13741
> Change-Id: I36fbf63f658d3e8048e13959cbebfbd14df12b14
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264146
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#37016}

Bug: webrtc:13741
Change-Id: Ib4eb072b775e493b564528f0be94c685b70ec20f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264421
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37056}
10 files changed
tree: 9f2c84b223b28213fa91896c1bb00ad7ce35c1d2
  1. api/
  2. audio/
  3. build_overrides/
  4. call/
  5. common_audio/
  6. common_video/
  7. data/
  8. docs/
  9. examples/
  10. g3doc/
  11. infra/
  12. logging/
  13. media/
  14. modules/
  15. net/
  16. p2p/
  17. pc/
  18. resources/
  19. rtc_base/
  20. rtc_tools/
  21. sdk/
  22. stats/
  23. system_wrappers/
  24. test/
  25. tools_webrtc/
  26. video/
  27. .clang-format
  28. .git-blame-ignore-revs
  29. .gitignore
  30. .gn
  31. .mailmap
  32. .style.yapf
  33. .vpython
  34. .vpython3
  35. AUTHORS
  36. BUILD.gn
  37. CODE_OF_CONDUCT.md
  38. codereview.settings
  39. DEPS
  40. DIR_METADATA
  41. ENG_REVIEW_OWNERS
  42. g3doc.lua
  43. LICENSE
  44. license_template.txt
  45. native-api.md
  46. OWNERS
  47. PATENTS
  48. PRESUBMIT.py
  49. presubmit_test.py
  50. presubmit_test_mocks.py
  51. pylintrc
  52. README.chromium
  53. README.md
  54. WATCHLISTS
  55. webrtc.gni
  56. webrtc_lib_link_test.cc
  57. whitespace.txt
README.md

WebRTC is a free, open software project that provides browsers and mobile applications with Real-Time Communications (RTC) capabilities via simple APIs. The WebRTC components have been optimized to best serve this purpose.

Our mission: To enable rich, high-quality RTC applications to be developed for the browser, mobile platforms, and IoT devices, and allow them all to communicate via a common set of protocols.

The WebRTC initiative is a project supported by Google, Mozilla and Opera, amongst others.

Development

See here for instructions on how to get started developing with the native code.

Authoritative list of directories that contain the native API header files.

More info