Use flag to confirm whether callback should unregister

This CL before, this class use isAvailable() to check whether
should register/unregister callback.
UI will be updated when this callback called.
But in one case, the isAvailable() state will not consistent
on onStart() and onStop().
The isAvailable() state will not consistent when user disconnect
device then forgot the device.
It's will cause callback not unregister when meet this case.
Then callback will duplicate call many times cause UI update not smoth.

This CL use flag to confirm the callback will unreigser on onStop().

Bug: 146617530
Bug: 145647143
Test: make -j42 RunSettingsRoboTests
Change-Id: I2b503ca9a7040b94ccc64ae196dad5a228fcbc6a
2 files changed