cordova-android icon indicating copy to clipboard operation
cordova-android copied to clipboard

Flash of the app's background color when resuming from the background

Open CodeWithOz opened this issue 4 years ago • 0 comments

Bug Report

Problem

The app's background color regularly flashes over the contents of the app when I resume the app from the background

What is expected to happen?

The app resumes without such a flash

What does actually happen?

See the problem statement

Information

https://user-images.githubusercontent.com/28525986/125789780-476eac7a-e616-40ac-af23-51fa78aa5574.mp4

In the video above, the white is the normal app content, and the green is the background color of the app (not the DOM, the Android view itself). You can see that as I return the app to the foreground from the app switcher, there's a brief period where the green color overrides the white. I used those 2 colors just to highlight the bug, but the problem is the same with the app's actual contents i.e. when I return to the app, the app's background (white in my case) flashes over the app's contents (i.e. the DOM). I'm not sure what's going on, it looks it's something happening with the webview itself. I am fairly certain it's not a style invalidation problem because style invalidations or repaints of the DOM don't show up when I profile the bug using dev tools. In fact in dev tools, the DOM is never repainted and there's no flash. Things I've tried:

  • disabling the onDeviceResume and onDevicePause callbacks. When I say disable I mean that I put return; statements to make sure that those callbacks don't execute any logic. This didn't stop the problem
  • using a transparent app background color. I thought this would allow the app's contents to show even when the background color is overlaying the contents, but instead it only made the flash dark (i.e. no background color for the app to show). This suggests that something is actually removing and restoring the Android view, but I don't know how to check for this
  • removing all the contents of the DOM (i.e. setting display: none; to all visible content, and also to the <html> and <body> elements in another test). This essentially hides everything on screen, leaving only the app's background. In my video, that would mean only the green would be showing. The flash doesn't happen when I do this, perhaps unsurprisingly
  • removing some of the heavier plugins I use, particularly this background geolocation plugin and the the google maps plugin, but the problem doesn't go away
  • using the basic cordova sample app to try to reproduce the problem but I haven't succeeded yet, the bug hasn't occurred

Command or Code

N/A, please see the description above

Environment, Platform, Device

  • cordova android: versions 9 and 10
  • device: Tecno Pop2 Plus

Version information

  • cordova CLI: 10
  • plugins:
    • branch-cordova-sdk 3.2.0 "branch-cordova-sdk"
    • cordova-android-support-gradle-release 3.0.1 "cordova-android-support-gradle-release"
    • cordova-plugin-android-notch 1.0.0 "AndroidNotch"
    • cordova-plugin-android-permissions 1.0.2 "Permissions"
    • cordova-plugin-camera 4.1.0 "Camera"
    • cordova-plugin-compat 1.2.0 "Compat"
    • cordova-plugin-contacts 3.0.1 "Contacts"
    • cordova-plugin-device 2.0.3 "Device"
    • cordova-plugin-enable-multidex 0.2.0 "Enable Multidex"
    • cordova-plugin-file-transfer 1.7.1 "File Transfer"
    • cordova-plugin-file 6.0.2 "File"
    • cordova-plugin-googleplus 5.3.2 "Google SignIn"
    • cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
    • cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
    • cordova-plugin-ionic-webview 2.5.1 "cordova-plugin-ionic-webview"
    • cordova-plugin-ios-camera-permissions 1.2.0 "iOS Permissions"
    • cordova-plugin-media-capture 3.0.3 "Capture"
    • cordova-plugin-network-information 2.0.2 "Network Information"
    • cordova-plugin-purchase 9.0.0 "Purchase"
    • cordova-plugin-splashscreen 5.0.3 "Splashscreen"
    • cordova-plugin-video-editor 1.1.3 "VideoEditor"
    • cordova-plugin-whitelist 1.3.4 "Whitelist"
    • cordova-plugin-x-socialsharing 5.6.3 "SocialSharing"
    • cordova-sqlite-storage 5.0.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"
    • cordova.plugins.diagnostic 5.0.1 "Diagnostic"
    • es6-promise-plugin 4.2.2 "Promise"
    • pushwoosh-cordova-plugin 7.18.7 "Pushwoosh"

Checklist

  • [x] I searched for existing GitHub issues
  • [x] I updated all Cordova tooling to most recent version
  • [x] I included all the necessary information above

CodeWithOz avatar Jul 15 '21 12:07 CodeWithOz