[Android] Improper handling of TorBootstrapChangeListener with respect to system onDestroy() calls for HomeActivity
Summary
Summarize the bug encountered concisely.
The function unregisterBootstrapStateChangeListener
is being called in HomeActivity.kt
's onDestroy()
, but without a check for isFinishing == true
. What this does is when the OS does optimizations (like if the app has been backgrounded for a while) it will call onDestroy() and then we unregister the activity's bootstrap state change listener, but because we only want it called if the activity is "finished" and not just being temporarily destroyed to free up resources by the OS. Fortunately, this would only cause issues with the html bootstrap as it should be the only thing using HomeActivity's bootstrap listener stuff. For instance, if the app stayed on the html bootstrap screen for a long enough time for onDestroy() to be called it would stop listening to new bootstrap events and likely require an app restart.