apache/cordova-android — pull request #123 by martincgg (2014-09-22 20:32:38+00:00)
Title: [CB-6837][Android 4.0.x branch] Fix: leaked window when hitting back button while alert being rendered

CB-6837
It is basically:
https://github.com/apache/cordova-android/pull/122
Only this is refactored for 4.0.x branch.

Description:
Created arrayList on AndroidChromeClient that it will register all showed AlertDialog, using AndroidChromeClient class, this applies to AlertDialogs object, included messages, prompts and confirm AlertDialog objects.

When handleDestroy() method is called on the AndroidWebView, it will perform a call to AndroidChromeClient class to destroy all AlerDialogs objects registered on the arrayList.
This would perform a cleanup before the CordovaActivity is destroyed.

dlg.show() returns an AlertDialog object, to be added to the arrayList.
It can be:
dialogsManager.add(dlg.show());
But I think it looks cleaner as currently is.

Tested on 4.4.2.