Add a direct reference to HfaLogic in HfaService
The reason HFA Activation wouldn't complete is because HfaLogic was
trying to bounce the radio power. It turns the radio power off, waits
for it to go off and then turn radio power back on. The problem was that
it never go notified that the radio power was successfully turned off
thus HfaLogic never turned it back on and activation never finishes.
I added debug and eventually found that PhoneBase#notifyServiceStateChanged
was not sending a notification to HfaLogic even though I saw that it was
registering. Turns out that RegistrantList uses a WeakReference and that
HfaService did not have a reference to HfaLogic and this caused the
HfaLogic to be garbage collected. I'm not exactly sure when the collection
happens because as I added more debug the bug disappeared. But I do see the
WeakReference going to null which can only happen because HfaLogic was
garbage collected.
My solution is to have HfaService reference HfaLogic. Another solution
was to change the WeakReference to a direct reference. But the
WeakReference is how its always been and jsh pointed out the
WeakReference reduces memory leaks if entities that register but fail
to unregister can still be garbage collected if the only reference is
the WeakReference.
Bug: 10905304
Change-Id: Iec07c6aa5e0de2340d4922bb0ee67f8bd9f3c95d
1 file changed