Fixed crash Unable to add window

Renamed onStop to onPause. onStop is not guaranteed to be called,
which is probably why we have some extra code duplication in the
finalize() method.

Added a new onDestroy to clean up all the pending callbacks.
At this stage, there is no window anymore and we should not
call showDialog.

Release the Handler in onDestroy.
Not doing so has been the source of memory leaks in the past.

Bug: 2501845
Change-Id: I35125fda1b53a6996b933056bafe2f0c04aea80a
1 file changed