apache / apache/cordova-plugin-inappbrowser
[Android] Getting BadTokenException
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
# Bug Report
## Problem
### What is expected to happen?
Should not get BadTokenException and crash the app.
### What does actually happen?
Detected multiple devices getting this exception.
**Device info:** Samsung Galaxy Note10+, Huawei P30, Oppo Reno, Oppo R17, others
android.view.WindowManager$BadTokenException:
at android.view.ViewRootImpl.setView (ViewRootImpl.java:1122)
at android.view.WindowManagerGlobal.addView (WindowManagerGlobal.java:450)
at android.view.WindowManagerImpl.addView (WindowManagerImpl.java:95)
at android.app.Dialog.show (Dialog.java:473)
at org.apache.cordova.inappbrowser.InAppBrowser$7.run (InAppBrowser.java:1083)
at android.app.Activity.runOnUiThread (Activity.java:6974)
at org.apache.cordova.inappbrowser.InAppBrowser.showWebPage (InAppBrowser.java:1093)
at org.apache.cordova.inappbrowser.InAppBrowser$1.run (InAppBrowser.java:251)
at android.os.Handler.handleCallback (Handler.java:883)
at android.os.Handler.dispatchMessage (Handler.java:100)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:8016)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1076)
### Environment, Platform, Device
Installed platforms:
android 9.0.0
ios 5.1.1
### Version information
cordova-clipboard 1.3.0 "Clipboard"
cordova-custom-config 5.1.0 "cordova-custom-config"
cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
cordova-plugin-advanced-http 2.5.1 "Advanced HTTP plugin"
cordova-plugin-android-imei 1.0.0 "Android IMEI"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-call-number 1.0.1 "Cordova Call Number Plugin"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-email 1.2.7 "EmailComposer"
cordova-plugin-exit 1.0.3 "Exit"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-fingerprint-aio 2.0.0 "FingerprintAllInOne"
cordova-plugin-firebasex 11.0.1 "Google Firebase Plugin"
cordova-plugin-inappbrowser 4.0.0 "InAppBrowser"
cordova-plugin-iroot 0.8.1 "iRoot"
cordova-plugin-market 1.2.0 "Market"
cordova-plugin-nativestorage 2.3.2 "NativeStorage"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-networkinterface 2.0.0 "NetworkInterface"
cordova-plugin-privacyscreen-storyboard 0.3.1 "PrivacyScreenPlugin-Storyboard"
cordova-plugin-screen-orientation 3.0.2 "Screen Orientation"
cordova-plugin-secure-storage-echo 5.1.1 "SecureStorage"
cordova-plugin-splashscreen 5.0.4 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-tapjackingprotection 0.1.1 "TapjackingProtectionPlugin"
cordova-plugin-timer 1.0.1 "Native timer"
cordova-plugin-touch-id 3.3.1 "Touch ID"
cordova-plugin-uniquedeviceid 1.3.2 "UniqueDeviceID"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-plugin-wkwebview-engine 1.2.1 "Cordova WKWebView Engine"
cordova-plugin-wkwebviewxhrfix 0.1.0 "WKWebView XHR Fix"
cordova-plugin-x-socialsharing 5.6.8 "SocialSharing"
cordova-save-image-gallery 0.0.26 "saveImageGallery"
cordova.plugins.diagnostic 5.0.2 "Diagnostic"
es6-promise-plugin 4.2.2 "Promise"
## 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
Contributor guide
Research direction
Start in InAppBrowser.java at the stack-trace locations around lines 1083, 1093, and 251, focusing on the Dialog.show call on Android. Try to reproduce the crash on Android 9 with the reported devices or comparable configurations. Done means opening the InAppBrowser no longer crashes with BadTokenException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100