Don't reuse NetworkFactory objects.
Currently, the bluetooth tethering code calls unregister() on its
NetworkFactory, and then expects to be able to reuse it later.
This is currently causing a crash when disabling bluetooth
tethering and in general is unsafe given NetworkFactory's design.
As a result, NetworkFactory is being turned into a one-time
object that cannot be reused.
This CL creates a new NetworkFactory every time the PAN profile
connects, instead of re-using the NetworkFactory created during
start(). Instead of determining whether start() has been called
by looking at whether mNetworkFactory is null, introduce an
mStarted boolean that is true iff start() has been called
Test: None
Bug: 148635501
Change-Id: I9b20d77ccc0d46fd3f1f52a63bee502d3f6e7a1e
Merged-In: I9b20d77ccc0d46fd3f1f52a63bee502d3f6e7a1e
2 files changed