apache/cordova-android — pull request #122 by martincgg (2014-09-22 19:54:47+00:00)
Title: [CB-6837][Android] Fix: leaked window when hitting back button while alert being rendered

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

When handleDestroy() method is called on the CordovaWebView, it will perform a call to ChromeClient 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.2.2 & 4.4.2.