You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by SharUpOff <gi...@git.apache.org> on 2017/07/24 12:59:49 UTC

[GitHub] cordova-plugin-splashscreen pull request #130: CB-13094: (android) Don't sho...

GitHub user SharUpOff opened a pull request:

    https://github.com/apache/cordova-plugin-splashscreen/pull/130

    CB-13094: (android) Don't show splash when activity being finished

    <!--
    Please make sure the checklist boxes are all checked before submitting the PR. The checklist
    is intended as a quick reference, for complete details please see our Contributor Guidelines:
    
    http://cordova.apache.org/contribute/contribute_guidelines.html
    
    Thanks!
    -->
    
    ### Platforms affected
    - android
    
    ### What does this PR do?
    - Prevent to show the splash dialog if the activity is in the process of finishing referenced to ([android docs](https://developer.android.com/reference/android/app/Activity.html#isFinishing()))
    
    
    ### What testing has been done on this change?
    - build and runtime is ok 
    - I think there are not need special tests
    
    ### Checklist
    - [x] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
    - [x] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
    - [ ] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/SharUpOff/cordova-plugin-splashscreen master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-splashscreen/pull/130.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #130
    
----
commit e5c6772f177a58c663efd3dbb8dbbc03ff9b463e
Author: Andrey Sharapov <an...@scat.su>
Date:   2017-07-24T12:36:34Z

    CB-13094: (android) Don't show splash when activity being finished

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-plugin-splashscreen pull request #130: CB-13094: (android) Don't sho...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-plugin-splashscreen/pull/130


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-plugin-splashscreen issue #130: CB-13094: (android) Don't show splas...

Posted by filmaj <gi...@git.apache.org>.
Github user filmaj commented on the issue:

    https://github.com/apache/cordova-plugin-splashscreen/pull/130
  
    Ah, great! Thanks for describing that. I will take a look at that.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-plugin-splashscreen issue #130: CB-13094: (android) Don't show splas...

Posted by infil00p <gi...@git.apache.org>.
Github user infil00p commented on the issue:

    https://github.com/apache/cordova-plugin-splashscreen/pull/130
  
    Going to about:blank is done as a garbage collection technique before closing out the WebView entirely so that the memory is freed.  There's a hilarious TODO here saying that it shouldn't destroy the WebView until about:blank is done loading.  
    
    But yeah, I agree with the fix.  The Splashscreen shouldn't try to attach a UI element to the Activity while the Activity is basically killing itself on a backbutton, or some other exit event, and that's clearly what's causing this behaviour.  
    
    Of course, if we never made this a plugin in the first place, we wouldn't have such a weird disconnect between this plugin and the platform code, so there is that.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-plugin-splashscreen issue #130: CB-13094: (android) Don't show splas...

Posted by filmaj <gi...@git.apache.org>.
Github user filmaj commented on the issue:

    https://github.com/apache/cordova-plugin-splashscreen/pull/130
  
    And @SharUpOff your intuition is confirmed: the logcat logs show that after pressing the back button in my app after loading it up, Cordova tries to load about:url:
    
    ```
    07-26 12:59:40.652  9214  9214 D CordovaActivity: Stopped the activity.
    07-26 12:59:40.652  9214  9214 D CordovaActivity: CordovaActivity.onDestroy()
    07-26 12:59:40.653  9214  9214 D CordovaWebViewImpl: >>> loadUrl(about:blank)
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-plugin-splashscreen issue #130: CB-13094: (android) Don't show splas...

Posted by SharUpOff <gi...@git.apache.org>.
Github user SharUpOff commented on the issue:

    https://github.com/apache/cordova-plugin-splashscreen/pull/130
  
    I got it so:
    ```javascript
    window.addEventListener('beforeunload', function()
    {
        navigator.splashscreen.show();
    });
    ```
    I show splash when reload my application without restarting cordova in some cases (language switching, debug mode, etc). Closing by "back" button fires "beforeunload" (to "about:blank" i think) and showing splash in same time activity being finished. Also i use crosswalk, maybe it fires "beforeunload", not the native WebView.
    
    Trace here:
    
    ```java
    FATAL EXCEPTION: main
    Process: scat.su.calltaxi, PID: 16999
    android.view.WindowManager$BadTokenException: Unable to add window – token android.os.BinderProxy@5d0142d is not valid; is your activity running?
    at android.view.ViewRootImpl.setView(ViewRootImpl.java:567)
    at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:310)
    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:86)
    at android.app.Dialog.show(Dialog.java:326)
    at org.apache.cordova.splashscreen.SplashScreen$5.run(SplashScreen.java:318)
    at android.app.Activity.runOnUiThread(Activity.java:5558)
    at org.apache.cordova.splashscreen.SplashScreen.showSplashScreen(SplashScreen.java:281)
    at org.apache.cordova.splashscreen.SplashScreen.onMessage(SplashScreen.java:189)
    at org.apache.cordova.PluginManager.postMessage(PluginManager.java:312)
    at org.apache.cordova.CordovaWebViewImpl.postMessage(CordovaWebViewImpl.java:377)
    at org.apache.cordova.splashscreen.SplashScreen$3.run(SplashScreen.java:169)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5517)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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

[GitHub] cordova-plugin-splashscreen issue #130: CB-13094: (android) Don't show splas...

Posted by SharUpOff <gi...@git.apache.org>.
Github user SharUpOff commented on the issue:

    https://github.com/apache/cordova-plugin-splashscreen/pull/130
  
    @filmaj, thank you for the prompt response! (:


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-plugin-splashscreen issue #130: CB-13094: (android) Don't show splas...

Posted by filmaj <gi...@git.apache.org>.
Github user filmaj commented on the issue:

    https://github.com/apache/cordova-plugin-splashscreen/pull/130
  
    Confirmed that this patch fixes the crash. Merged it in.
    
    Thanks for the contribution @SharUpOff! + on your first ever GitHub PR, too


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-plugin-splashscreen issue #130: CB-13094: (android) Don't show splas...

Posted by filmaj <gi...@git.apache.org>.
Github user filmaj commented on the issue:

    https://github.com/apache/cordova-plugin-splashscreen/pull/130
  
    OK, I've been able to reproduce the behaviour - sort of. In my case, it wasn't that the my app showed the splashscreen, but that the app crashed while exiting!
    
    My test app was a fresh cordova project with cordova-android 6.2.3 and cordova-plugin-splashscreen 4.0.3 added. I added nothing to the default cordova app code other than attaching `splashscreen.show()` to the `beforeunload` method, as per your above comment.
    
    Here's my stack trace:
    
    ```
    07-26 12:59:40.652  9214  9214 D CordovaActivity: Stopped the activity.
    07-26 12:59:40.652  9214  9214 D CordovaActivity: CordovaActivity.onDestroy()
    07-26 12:59:40.653  9214  9214 D CordovaWebViewImpl: >>> loadUrl(about:blank)
    07-26 12:59:40.663  9214  9214 W cr_AwContents: WebView.destroy() called while WebView is still attached to window.
    07-26 12:59:40.726  1162  5658 W WindowManager: Attempted to add application window with unknown token Token{760cced ActivityRecord{f0b0f04 u0 io.cordova.hellocordova/.MainActivity t129 f}}.  Aborting.
    07-26 12:59:40.727  9214  9214 D AndroidRuntime: Shutting down VM
    --------- beginning of crash
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: FATAL EXCEPTION: main
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: Process: io.cordova.hellocordova, PID: 9214
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@1012df7 is not valid; is your activity running?
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at android.view.ViewRootImpl.setView(ViewRootImpl.java:679)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:342)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at android.app.Dialog.show(Dialog.java:329)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at org.apache.cordova.splashscreen.SplashScreen$5.run(SplashScreen.java:318)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at android.app.Activity.runOnUiThread(Activity.java:5869)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at org.apache.cordova.splashscreen.SplashScreen.showSplashScreen(SplashScreen.java:281)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at org.apache.cordova.splashscreen.SplashScreen.onMessage(SplashScreen.java:189)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at org.apache.cordova.PluginManager.postMessage(PluginManager.java:312)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at org.apache.cordova.CordovaWebViewImpl.postMessage(CordovaWebViewImpl.java:377)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at org.apache.cordova.splashscreen.SplashScreen$3.run(SplashScreen.java:169)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:751)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:154)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6121)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
    07-26 12:59:40.728  9214  9214 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
    ```
    
    This was on a Google Pixel running Android 7.1.2.
    
    Next up I'll test out your patch and see how the behaviour differs.
    
    FYI @infil00p.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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