cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Veniamin Craciun (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-13259) Crash on Samsung devices with android 6+
Date Wed, 17 Jan 2018 14:31:00 GMT

    [ https://issues.apache.org/jira/browse/CB-13259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16328826#comment-16328826
] 

Veniamin Craciun commented on CB-13259:
---------------------------------------

[~reinierpd], I added some checks before dismissing the dialog. 

And it looks like this right now. 
{code:java|title=InAppBrowser.java|borderStyle=solid}
public void closeDialog() {
...
    childView.setWebViewClient(
        // NB: wait for about:blank before dismissing
        public void onPageFinished(WebView view, String url) {
            Context context = view.getContext();			    
            
            if(dialog == null || !dialog.isShowing()){
                return;
            }
            
            if(context instanceof Activity) {
                if(!((Activity)context).isFinishing()) {
                    dialog.dismiss();
                    dialog = null;
                }
            }else {
                dialog.dismiss();
                dialog = null;
            }
        }
    });
...
{code}

> Crash on Samsung devices with android 6+
> ----------------------------------------
>
>                 Key: CB-13259
>                 URL: https://issues.apache.org/jira/browse/CB-13259
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-inappbrowser
>    Affects Versions: cordova@7.0.0
>         Environment: InAppBrowser 1.7.1
> OS: Android 6 and 7
> Samsung and Huawei devices
>            Reporter: Veniamin Craciun
>            Priority: Major
>
> Using latest version of cordova and InAppBrowser a crash occurs on Samsung and Huawei
devices that run Android 6 or 7. 
> Below is a google crash report from such device:
> {color:red}java.lang.IllegalArgumentException: 
>   at android.view.WindowManagerGlobal.findViewLocked (WindowManagerGlobal.java:473)
>   at android.view.WindowManagerGlobal.removeView (WindowManagerGlobal.java:382)
>   at android.view.WindowManagerImpl.removeViewImmediate (WindowManagerImpl.java:128)
>   at android.app.Dialog.dismissDialog (Dialog.java:610)
>   at android.app.Dialog.dismiss (Dialog.java:593)
>   at org.apache.cordova.inappbrowser.InAppBrowser$5$1.onPageFinished (InAppBrowser.java:434)
>   at com.android.webview.chromium.WebViewContentsClientAdapter.onPageFinished (WebViewContentsClientAdapter.java:196)
>   at org.chromium.android_webview.AwContentsClientCallbackHelper$MyHandler.handleMessage
(AwContentsClientCallbackHelper.java:65)
>   at android.os.Handler.dispatchMessage (Handler.java:102)
>   at android.os.Looper.loop (Looper.java:154)
>   at android.app.ActivityThread.main (ActivityThread.java:6682)
>   at java.lang.reflect.Method.invoke (Native Method)
>   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1520)
>   at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1410){color}
> I already searched such crash and I couldn't find any report of this for cordova or inappbrowser.
The problem seems to be occuring [here|https://github.com/apache/cordova-plugin-inappbrowser/blob/master/src/android/InAppBrowser.java#L434]
that's because on samsung device it's needed to verify if dialog.isShowing() as stated from
a StackOverflow [answer|https://stackoverflow.com/a/19511069/6723787]. That being said I think
the bug can be easily solved by changing one line. I also want to mention that app only crashes
if user has enabled "Don't keep activities" on Settings->Developer Options.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message