BrowserComponent.execute() that works into the simulator but fails on a real android device

162 views
Skip to first unread message

Thomas

unread,
Apr 3, 2018, 10:48:08 PM4/3/18
to CodenameOne Discussions
I am trying to connect a CN1 app to a distant server using socket.io . For this, I use the native socket.io javascript lib that I call through a BrowserComponent. In the simulator, it works just fine. However, when I try on a real android device, nothing happen. My server do not receive any connection attempt but I don't see any error thrown in the console by the CN1 app. I made a custom logger to see what was going on on the javascript part and actually it appears that none of the call I made with BrowserComponent.execute() are executed when I am on the real android device. On the simulator, they are (I see the output of my logger in the console) but not in the real device (I don't see any output in my logger whereas it is called into each of my javascript calls passed through BrowserComponent.execute() and I also did an internalBrowser.execute("logger.log(\"SocketIO bridge started\")"); inside my internalBrowser.addWebEventListener("onLoad", ...) event but I don't see it either)
The BrowserComponent, that I made to display a "hello word" html message is correctly displayed though. So it seems that it is just the js bridge that is broken on the real android device (the Webview works as the "hello word" message is correctly displayed by the BrowserComponent).
I don't know what can be the origin of this error and how to fix it.

Here is the content of my device logcat:

I/Timeline( 4964): Timeline: Activity_launch_request time:526015920
I/ActivityManager( 2315): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.tbdlab.socketiotest/.MyApplicationStub bnds=[53,468][175,590] (has extras)} from uid 10023 on display 0
I/WtProcessController( 3763): mCurTask:1695
V/WindowManager( 2315): addAppToken: AppWindowToken{3d8c65ad token=Token{363692c4 ActivityRecord{5d79d7 u0 org.tbdlab.socketiotest/.MyApplicationStub t1695}}} to stack=1 task=1695 at 0
I/ViewRootImpl( 2315): CPU Rendering VSync enable = true
V/WindowManager( 2315): Adding window Window{2e13aae1 u0 Starting org.tbdlab.socketiotest} at 2 of 8 (after Window{1053c9dc u0 com.miui.home/com.miui.home.launcher.Launcher})
D/ScreenElementRoot( 4964): pause
D/ScreenElementRoot( 4964): pause
D/ScreenElementRoot( 4964): pause
D/ScreenElementRoot( 4964): pause
I/NotifierManager( 4964): onUnregister: miui.maml.NotifierManager$MultiBroadcastNotifier@19834b1e
I/RenderThread( 4964): RenderThread paused, waiting for signal
I/ActivityManager( 2315): Start proc 10827:org.tbdlab.socketiotest/u0a309 for activity org.tbdlab.socketiotest/.MyApplicationStub
D/TidaProvider(10827): TidaProvider()
I/WtProcessController( 3763): MOVE TO FOREGROUND: org.tbdlab.socketiotest 10309
I/StatusController( 3763): Last foreground:com.miui.home uid:10023 Current foreground:org.tbdlab.socketiotest uid:10309
I/WtProcessController( 3763): FOREGROUND INFO: name=org.tbdlab.socketiotest uid=10309 pid=10827 TaskId:1695
I/Timeline( 2315): Timeline: App_transition_ready time:526016049
I/ActivityManager( 2315): Killing 10273:fr.bouyguestelecom.ecm.android:equalone/u0a140 (adj 15): empty #17
D/ActivityManagerInjector( 2315): fr.bouyguestelecom.ecm.android:equalone is killed by AMS with adj 15 ,do not allow restart
D/ActivityManager( 2315): cleanUpApplicationRecord -- 10273
I/ViewRootImpl(10827): CPU Rendering VSync enable = true
D/OpenGLRenderer(10827): Use EGL_SWAP_BEHAVIOR_PRESERVED: true
D/Atlas   (10827): Validating map...
I/art     (10827): Background sticky concurrent mark sweep GC freed 5402(352KB) AllocSpace objects, 1(20KB) LOS objects, 0% free, 10MB/10MB, paused 29.805ms total 79.645ms
V/WindowManager( 2315): Adding window Window{eaec863 u0 org.tbdlab.socketiotest/org.tbdlab.socketiotest.MyApplicationStub} at 2 of 9 (before Window{2e13aae1 u0 Starting org.tbdlab.socketiotest})
I/Adreno-EGL(10827): <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8916_64_LA.BR.1.2.4_RB1__release_AU (Ic8ede1fb34)
I/Adreno-EGL(10827): OpenGL ES Shader Compiler Version: E031.25.03.04
I/Adreno-EGL(10827): Build Date: 12/10/15 Thu
I/Adreno-EGL(10827): Local Branch:
I/Adreno-EGL(10827): Remote Branch: quic/LA.BR.1.2.4_rb1.30
I/Adreno-EGL(10827): Local Patches: NONE
I/Adreno-EGL(10827): Reconstruct Branch: NOTHING
I/OpenGLRenderer(10827): Initialized EGL, version 1.4
D/OpenGLRenderer(10827): Enabling debug mode 0
I/qdutils (10827): PartialUpdate status: Disabled
I/qdutils (10827): Left Align: 0
I/qdutils (10827): Width Align: 0
I/qdutils (10827): Top Align: 0
I/qdutils (10827): Height Align: 0
I/qdutils (10827): Min ROI Width: 0
I/qdutils (10827): Min ROI Height: 0
I/qdutils (10827): Needs ROI Merge: 0
I/qdutils (10827): Dynamic Fps: Disabled
I/qdutils (10827): Min Panel fps: 0
I/qdutils (10827): Max Panel fps: 0
I/Codename One(10827): Resource not found: theme_phone.ovr
I/Codename One(10827): Resource not found: theme_android.ovr
I/Codename One(10827): Resource not found: theme_android-phone.ovr
I/Timeline( 2315): Timeline: App_transition_stopped time:526016330
I/ActivityManager( 2315): Displayed org.tbdlab.socketiotest/.MyApplicationStub: +407ms
I/Timeline( 2315): Timeline: Activity_windows_visible id: ActivityRecord{5d79d7 u0 org.tbdlab.socketiotest/.MyApplicationStub t1695} time:526016350
I/GoogleInputMethod( 4372): onFinishInput() : Dummy InputConnection bound
I/GoogleInputMethod( 4372): onStartInput() : Dummy InputConnection bound
I/Timeline(10827): Timeline: Activity_idle id: android.os.BinderProxy@22b1edbd time:526016365
D/SocketIOTest(10827): [EDT] 0:0:0,0 - Codename One revisions: 87d32ad479573c56f774b68faf42bfeb2ca86a22
D/SocketIOTest(10827): [EDT] 0:0:0,2 - WARNING: Theme sets the commandBehavior constant which is deprecated.  Please update the theme to NOT include this theme constant.  Using commandBehavior may cause your app to perform in unexpected ways.  In particular, using SIDE command behavior in conjunction with Toolbar.setOnTopSideMenu(true) may result in runtime exceptions.
D/SocketIOTest(10827): [EDT] 0:0:0,3 - WARNING: Display.setCommandBehavior() is deprecated, Using it may result in unexpected behaviour. In particular, using COMMAND_BEHAVIOR_SIDE_NAVIGATION in conjunction with Toolbar.setOnTopSideMenu(true) may result in runtime errors.
I/System.out(10827): showKeyboard false
W/linker  (10827): /data/app/com.google.android.webview-1/lib/arm64/libwebviewchromium.so: unused DT entry: type 0x6ffffffe arg 0x16450
W/linker  (10827): /data/app/com.google.android.webview-1/lib/arm64/libwebviewchromium.so: unused DT entry: type 0x6fffffff arg 0x3
D/Codename One(10827): sizechanged: 720 1230 com.codename1.impl.android.i@2ef5b5f1
D/BatteryService( 2315): Processing new values: chargerAcOnline=false, chargerUsbOnline=true, chargerWirelessOnline=false, batteryStatus=5, batteryHealth=2, batteryPresent=true, batteryLevel=100, batteryTechnology=Li-ion, batteryVoltage=4361, batteryTemperature=152, mBatteryLevelCritical=false, mPlugType=2
D/BatteryService( 2315): zhaoqf_sh batteryServices call state : 0 mPlugType : 2
I/WebViewFactory(10827): Loading com.google.android.webview version 65.0.3325.109 (code 332510950)
I/art     (10827): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.TokenBindingManagerAdapter>
I/art     (10827): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.TokenBindingManagerAdapter>
I/art     (10827): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.ServiceWorkerControllerAdapter>
I/art     (10827): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.ServiceWorkerControllerAdapter>
I/cr_LibraryLoader(10827): Time to load native libraries: 1 ms (timestamps 6502-6503)
I/chromium(10827): [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_LibraryLoader(10827): Expected native library version number "65.0.3325.109", actual native library version number "65.0.3325.109"
I/cr_BrowserStartup(10827): Initializing chromium process, singleProcess=true
I/cr_base (10827): Android Locale: en_US requires .pak files: []
I/art     (10827): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$WebResourceErrorImpl>
I/art     (10827): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$WebResourceErrorImpl>
I/art     (10827): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$7>
I/art     (10827): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$7>
I/art     (10827): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$3>
I/art     (10827): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$3>
D/ConnectivityService( 2315): listenForNetwork for NetworkRequest [ id=2858, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED] ]
D/ConnectivityService( 2315): handleRegisterNetworkRequest checking NetworkAgentInfo [WIFI () - 159]
D/ConnectivityManager.CallbackHandler(10827): CM callback handler got msg 524290
D/ConnectivityService( 2315): apparently satisfied.  currentScore=100
I/art     (10827): Rejecting re-init on previously-failed class java.lang.Class<org.chromium.content.browser.selection.FloatingActionModeCallback>
I/art     (10827): Rejecting re-init on previously-failed class java.lang.Class<org.chromium.content.browser.selection.FloatingActionModeCallback>
D/EgretLoader(10827): EgretLoader(Context context)
D/EgretLoader(10827): The context is not activity
D/ConnectivityService( 2315): listenForNetwork for NetworkRequest [ id=2859, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED] ]
D/ConnectivityManager.CallbackHandler(10827): CM callback handler got msg 524290
D/ConnectivityService( 2315): handleRegisterNetworkRequest checking NetworkAgentInfo [WIFI () - 159]
D/ConnectivityService( 2315): apparently satisfied.  currentScore=100
D/Codename One(10827): native focus gain
I/System.out(10827): showKeyboard false
I/SurfaceFlinger(  320): FPS: 35
E/libEGL  (10827): validate_display:255 error 3008 (EGL_BAD_DISPLAY)
D/BluetoothManagerService( 2315): Message: 20
D/BluetoothManagerService( 2315): Added callback: android.bluetooth.IBluetoothManagerCallback$Stub$Proxy@4dc2dc1:true
D/BluetoothAdapter(10827): 877159755: getState() :  mService = null. Returning STATE_OFF
W/ContentCatcher(10827): Failed to notify a WebView
W/AudioCapabilities(10827): Unsupported mime audio/evrc
W/AudioCapabilities(10827): Unsupported mime audio/qcelp
W/VideoCapabilities(10827): Unrecognized profile 2130706433 for video/avc
I/ViewRootImpl(10827): CPU Rendering VSync enable = true
V/WindowManager( 2315): not Base app: Adding window Window{2031e8bb u0 org.tbdlab.socketiotest/org.tbdlab.socketiotest.MyApplicationStub} at 3 of 9
W/AudioCapabilities(10827): Unsupported mime audio/qcelp
W/AudioCapabilities(10827): Unsupported mime audio/evrc
W/VideoCapabilities(10827): Unsupported mime video/mpeg2
W/VideoCapabilities(10827): Unsupported mime video/mpeg2
W/VideoCapabilities(10827): Unsupported mime video/x-ms-wmv
W/VideoCapabilities(10827): Unsupported mime video/divx
W/VideoCapabilities(10827): Unsupported mime video/divx311
W/Utils   (10827): could not parse size range '64x64-1920X1088'
W/VideoCapabilities(10827): Unsupported mime video/divx4
W/Utils   (10827): could not parse size range '64x64-1920X1080'
I/GoogleInputMethod( 4372): onFinishInput() : Dummy InputConnection bound
I/GoogleInputMethod( 4372): onStartInput() : Dummy InputConnection bound
W/VideoCapabilities(10827): Unsupported mime video/mp4v-esdp
W/cr_CrashFileManager(10827): /data/data/org.tbdlab.socketiotest/cache/WebView/Crash Reports does not exist or is not a directory
I/VideoCapabilities(10827): Unsupported profile 4 for video/mp4v-es
W/chromium(10827): [WARNING:render_frame_host_impl.cc(2750)] OnDidStopLoading was called twice.
V/WLAN_PSA(  381): NL MSG, len[048], NL type[0x11] WNI type[0x5050] len[028]
V/WLAN_PSA(  381): NL MSG, PID: 381
I/SurfaceFlinger(  320): FPS: 40

So I guess the fact that BrowserComponent.execute() calls are all ignored has something to do with  the Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium... messages but I don't know how to fix this...

my test device is runing android 5.1.1 with all libs up to date (android system webview, google play... )

Shai Almog

unread,
Apr 4, 2018, 12:59:00 AM4/4/18
to CodenameOne Discussions
There are some nuances with JS on device and external JS libraries. This is designed to prevent some security weaknesses but makes some code really awkward.
How did you include the JS code into the page? How is the HTML structured? Can you post something to github so we can have a look?

Thomas

unread,
Apr 5, 2018, 12:36:57 AM4/5/18
to CodenameOne Discussions
I tested my code again today (I was preparing something to post for you on github) and surprise!: The CN1 app was able to communicate with my socket.io server and I the javascript logs where correctly output in my device adb logcat (meaning BrowserComponent.execute() javascript calls where correctly executed ). I really don't know why it did not work yesterday and does today as I didn't change anything in my code (either in the CN1 app or the server). That is a complete mystery.
Anyway, I am now facing another issue.  My CN1 app is now able to send the socket.io handshake request to my server (that correctly receved it, as I can see in it's log) but the handshake is unable to succeed due to a CORS issue (only on the device, still works on the simulator. And I must say that the simulator and the server are run on 2 different PCs (and have 2 different IPs) so the situation is strictly the same in what concerns CORS when run on the simulator or on my real android device). 
In the adb logcat, I can see this error message:
 [main] 0:0:2,36 - [ERROR] Failed to load http://192.168.8.100:3030/socket.io/?EIO=3&transport=polling&t=MAJ14W8: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header has a value 'null' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access. On line 0 of file:///android_asset/socket_io.html
(192.168.8.100:3030 being my server url  and socket_io.html my embeded CN1 asset that loads the socket.io.js embeded asset script)  

This is kind of strange as if I call http://192.168.8.100:3030/socket.io/?EIO=3&transport=polling&t=MAJ14W8 inside my chrome browser,  in the response header I can see Access-Control-Allow-Origin: * so I don't get it why the BrowserComponent has a 'null' value for it...
Do you already experienced using a javascript lib with CORS permissions inside the BrowserComponent on android? 

I can post something on github for you to test if you want to (and have the time to look at it) but as my socket.io server is not public yet, you would also have to run a small socket.io server (or to find a public one) to be able to see the issue (I can post the code of a small soket.io server to use with the test CN1 app but it would requiere you to install node.js)

Steve Hannah

unread,
Apr 5, 2018, 7:25:47 AM4/5/18
to codenameone...@googlegroups.com
Try calling

myBrowserComponent.setProperty("AllowUniversalAccessFromFileURLs", Boolean.TRUE);

(on the BrowserComponent)

Before loading the page.



--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/55d571c9-f7b7-41ce-b64f-ec120c0aecd9%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Software Developer
Codename One

Thomas

unread,
Apr 5, 2018, 1:04:44 PM4/5/18
to CodenameOne Discussions
Unfortunately this isn't working. I still have the same error message.

I put my test code on github so you guys can have look if you want: https://github.com/ramsestom/CN1SocketIO_test

Steve Hannah

unread,
Apr 5, 2018, 5:04:00 PM4/5/18
to codenameone...@googlegroups.com
There was a bug that was causing setProperty() settings to be ignored.  I have fixed it in Git.

Should be available in the update tomorrow.

A workaround would be to use a local web server to serve the file and connect to it using http://localhost/... rather than using the jar://  (file://) protocol as this won't be subject to the same security constraints.  You can create a local web server using this module: https://github.com/shannah/CN1Webserver

Steve



On Thu, Apr 5, 2018 at 10:04 AM, Thomas <tomber...@gmail.com> wrote:
Unfortunately this isn't working. I still have the same error message.

I put my test code on github so you guys can have look if you want: https://github.com/ramsestom/CN1SocketIO_test


On Thursday, April 5, 2018 at 1:25:47 PM UTC+2, Steve Hannah wrote:
Try calling

myBrowserComponent.setProperty("AllowUniversalAccessFromFileURLs", Boolean.TRUE);

(on the BrowserComponent)

Before loading the page.


On Wed, Apr 4, 2018 at 9:36 PM, Thomas <tomber...@gmail.com> wrote:
I tested my code again today (I was preparing something to post for you on github) and surprise!: The CN1 app was able to communicate with my socket.io server and I the javascript logs where correctly output in my device adb logcat (meaning BrowserComponent.execute() javascript calls where correctly executed ). I really don't know why it did not work yesterday and does today as I didn't change anything in my code (either in the CN1 app or the server). That is a complete mystery.
Anyway, I am now facing another issue.  My CN1 app is now able to send the socket.io handshake request to my server (that correctly receved it, as I can see in it's log) but the handshake is unable to succeed due to a CORS issue (only on the device, still works on the simulator. And I must say that the simulator and the server are run on 2 different PCs (and have 2 different IPs) so the situation is strictly the same in what concerns CORS when run on the simulator or on my real android device). 
In the adb logcat, I can see this error message:
 [main] 0:0:2,36 - [ERROR] Failed to load http://192.168.8.100:3030/socket.io/?EIO=3&transport=polling&t=MAJ14W8: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header has a value 'null' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access. On line 0 of file:///android_asset/socket_io.html
(192.168.8.100:3030 being my server url  and socket_io.html my embeded CN1 asset that loads the socket.io.js embeded asset script)  

This is kind of strange as if I call http://192.168.8.100:3030/socket.io/?EIO=3&transport=polling&t=MAJ14W8 inside my chrome browser,  in the response header I can see Access-Control-Allow-Origin: * so I don't get it why the BrowserComponent has a 'null' value for it...
Do you already experienced using a javascript lib with CORS permissions inside the BrowserComponent on android? 

I can post something on github for you to test if you want to (and have the time to look at it) but as my socket.io server is not public yet, you would also have to run a small socket.io server (or to find a public one) to be able to see the issue (I can post the code of a small soket.io server to use with the test CN1 app but it would requiere you to install node.js)

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsubscr...@googlegroups.com.



--
Steve Hannah
Software Developer
Codename One

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.

For more options, visit https://groups.google.com/d/optout.

Shai Almog

unread,
Apr 6, 2018, 1:28:47 AM4/6/18
to CodenameOne Discussions
FYI this is deployed and should work now.

Thomas

unread,
Apr 6, 2018, 8:34:16 PM4/6/18
to CodenameOne Discussions
Thanks. I tested and the issue I had with the null origin is now gone. Meaning that internalBrowser.setProperty("AllowUniversalAccessFromFileURLs", Boolean.TRUE); is now probably correctly taken into account. 
However, I still can't make socket.io to work when using it on a real device.
First issue I have is that anything I log in my javascript logger (created as a JSobject using JavascriptContext, see my code on github if necessary) is not output in the device log (whereas it works fine in the simulator). Usual CN1 logs (from Log.p() calls from within the java code) are though. So this is kind of anoying to debug properly (as I can't correctly track what is happening in the javascript part).
The second issue is that any message I try to send from my CN1 app to my server never reach it. On my server log, I can see that the CN1 app now correctly create the handshake with the server and seems to correctly update the communication from XHR long polling transport to websockets. However, any new message that I try to send from the CN1 app to the server using this socket just never reach the server (but the connection seems to be correctly maintained open as, if I kill the CN1 app, I can see a deconnection event to be logged on my server). Actually messages I send with socket.io.emit are probably never send (but without a javascript logger difficult/impossible to track it down...)

I checked my device adb logcat and here is what I have:

D/CN1SocketIOTest(16239): [EDT] 0:0:0,0 - Codename One revisions: d4219a1b829854d15136d1fa3166990e01f1b197
I/ActivityManager( 2315): Displayed com.tbdlab.cn1socketiotest/.MyApplicationStub: +400ms
I/Timeline( 2315): Timeline: Activity_windows_visible id: ActivityRecord{1f2916fc u0 com.tbdlab.cn1socketiotest/.MyApplicationStub t1811} time:686055479
D/CN1SocketIOTest(16239): [EDT] 0:0:0,2 - WARNING: Theme sets the commandBehavior constant which is deprecated.  Please update the theme to NOT include this theme constant.  Using commandBehavior may cause your app to perform in unexpected ways.  In particular, using SIDE command behavior in conjunction with Toolbar.setOnTopSideMenu(true) may result in runtime exceptions.
D/CN1SocketIOTest(16239): [EDT] 0:0:0,3 - WARNING: Display.setCommandBehavior() is deprecated, Using it may result in unexpected behaviour. In particular, using COMMAND_BEHAVIOR_SIDE_NAVIGATION in conjunction with Toolbar.setOnTopSideMenu(true) may result in runtime errors.
D/CN1SocketIOTest(16239): [EDT] 0:0:0,8 - CN1 App started
I/GoogleInputMethod(28089): onFinishInput() : Dummy InputConnection bound
I/GoogleInputMethod(28089): onStartInput() : Dummy InputConnection bound
I/Timeline(16239): Timeline: Activity_idle id: android.os.BinderProxy@3b0a177b time:686055495
W/linker  (16239): /data/app/com.google.android.webview-1/lib/arm64/libwebviewchromium.so: unused DT entry: type 0x6ffffffe arg 0x16450
W/linker  (16239): /data/app/com.google.android.webview-1/lib/arm64/libwebviewchromium.so: unused DT entry: type 0x6fffffff arg 0x3
D/Codename One(16239): sizechanged: 720 1230 com.codename1.impl.android.i@2fd05d47
I/WebViewFactory(16239): Loading com.google.android.webview version 65.0.3325.109 (code 332510950)
I/art     (16239): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.TokenBindingManagerAdapter>
I/art     (16239): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.TokenBindingManagerAdapter>
I/art     (16239): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.ServiceWorkerControllerAdapter>
I/art     (16239): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.ServiceWorkerControllerAdapter>
I/cr_LibraryLoader(16239): Time to load native libraries: 0 ms (timestamps 5565-5565)
I/chromium(16239): [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_LibraryLoader(16239): Expected native library version number "65.0.3325.109", actual native library version number "65.0.3325.109"
I/cr_BrowserStartup(16239): Initializing chromium process, singleProcess=true
I/cr_base (16239): Android Locale: en_US requires .pak files: []
I/art     (16239): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$WebResourceErrorImpl>
I/art     (16239): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$WebResourceErrorImpl>
I/art     (16239): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$7>
I/art     (16239): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$7>
I/art     (16239): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$3>
I/art     (16239): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$3>
D/ConnectivityService( 2315): listenForNetwork for NetworkRequest [ id=3794, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED] ]
D/ConnectivityService( 2315): handleRegisterNetworkRequest checking NetworkAgentInfo [WIFI () - 175]
D/ConnectivityManager.CallbackHandler(16239): CM callback handler got msg 524290
D/ConnectivityService( 2315): apparently satisfied.  currentScore=100
I/art     (16239): Rejecting re-init on previously-failed class java.lang.Class<org.chromium.content.browser.selection.FloatingActionModeCallback>
I/art     (16239): Rejecting re-init on previously-failed class java.lang.Class<org.chromium.content.browser.selection.FloatingActionModeCallback>
D/EgretLoader(16239): EgretLoader(Context context)
D/EgretLoader(16239): The context is not activity
D/ConnectivityService( 2315): listenForNetwork for NetworkRequest [ id=3795, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED] ]
D/ConnectivityService( 2315): handleRegisterNetworkRequest checking NetworkAgentInfo [WIFI () - 175]
D/ConnectivityService( 2315): apparently satisfied.  currentScore=100
D/ConnectivityManager.CallbackHandler(16239): CM callback handler got msg 524290
D/Codename One(16239): native focus gain
I/System.out(16239): showKeyboard false
E/libEGL  (16239): validate_display:255 error 3008 (EGL_BAD_DISPLAY)
D/BluetoothManagerService( 2315): Message: 20
D/BluetoothManagerService( 2315): Added callback: android.bluetooth.IBluetoothManagerCallback$Stub$Proxy@17dcbb8c:true
D/BluetoothAdapter(16239): 167655033: getState() :  mService = null. Returning STATE_OFF
W/ContentCatcher(16239): Failed to notify a WebView
I/ViewRootImpl(16239): CPU Rendering VSync enable = true
V/WindowManager( 2315): not Base app: Adding window Window{2500eb8e u0 com.tbdlab.cn1socketiotest/com.tbdlab.cn1socketiotest.MyApplicationStub} at 3 of 9
W/AudioCapabilities(16239): Unsupported mime audio/evrc
W/AudioCapabilities(16239): Unsupported mime audio/qcelp
W/VideoCapabilities(16239): Unrecognized profile 2130706433 for video/avc
W/AudioCapabilities(16239): Unsupported mime audio/qcelp
W/AudioCapabilities(16239): Unsupported mime audio/evrc
W/VideoCapabilities(16239): Unsupported mime video/mpeg2
W/VideoCapabilities(16239): Unsupported mime video/mpeg2
W/VideoCapabilities(16239): Unsupported mime video/x-ms-wmv
W/VideoCapabilities(16239): Unsupported mime video/divx
W/VideoCapabilities(16239): Unsupported mime video/divx311
W/Utils   (16239): could not parse size range '64x64-1920X1088'
D/VM_BMS  (  523): wake_lock acquired
D/VM_BMS  (  523): New BMS data - Size=56
D/VM_BMS  (  523): Start process_bms_data
W/VideoCapabilities(16239): Unsupported mime video/divx4
D/VM_BMS  (  523): For batt_temp=180 fcc_mah=4035
D/VM_BMS  (  523): For ocv=4333591 batt_temp=180 soc=98
D/VM_BMS  (  523): fifo_count=5 acc_count=0
D/VM_BMS  (  523): INIT: ocv=4333591 last_ocv=4333591 batt_temp=180 soc=98
D/VM_BMS  (  523): For soc=98 batt_temp=180 slope=9400
D/VM_BMS  (  523): For soc=98 batt_temp=180 rbatt_sf=154
D/VM_BMS  (  523): rbatt_mohm_default=120, rbatt_mohm=184, sf=154 batt_temp=180
D/VM_BMS  (  523): For ocv=4333645 batt_temp=180 soc=98
D/VM_BMS  (  523): FIFO=0 fifo_avg=4.351626 rbatt=0.194000 slope=0.940000 ibatt=-0.092825 ocv=4.333645 soc=98 fcc_ah=4.035000 sample_count=128 sample_interval=70 seq_num=41172
D/VM_BMS  (  523): For soc=98 batt_temp=180 slope=9400
D/VM_BMS  (  523): For soc=98 batt_temp=180 rbatt_sf=154
D/VM_BMS  (  523): rbatt_mohm_default=120, rbatt_mohm=184, sf=154 batt_temp=180
D/VM_BMS  (  523): For ocv=4333805 batt_temp=180 soc=98
D/VM_BMS  (  523): FIFO=1 fifo_avg=4.387275 rbatt=0.194000 slope=0.940000 ibatt=-0.276033 ocv=4.333805 soc=98 fcc_ah=4.035000 sample_count=128 sample_interval=70 seq_num=41172
D/VM_BMS  (  523): For soc=98 batt_temp=180 slope=9400
D/VM_BMS  (  523): For soc=98 batt_temp=180 rbatt_sf=154
D/VM_BMS  (  523): rbatt_mohm_default=120, rbatt_mohm=184, sf=154 batt_temp=180
D/VM_BMS  (  523): For ocv=4333970 batt_temp=180 soc=98
D/VM_BMS  (  523): FIFO=2 fifo_avg=4.389042 rbatt=0.194000 slope=0.940000 ibatt=-0.284301 ocv=4.333970 soc=98 fcc_ah=4.035000 sample_count=128 sample_interval=70 seq_num=41172
D/VM_BMS  (  523): For soc=98 batt_temp=180 slope=9400
D/VM_BMS  (  523): For soc=98 batt_temp=180 rbatt_sf=154
D/VM_BMS  (  523): rbatt_mohm_default=120, rbatt_mohm=184, sf=154 batt_temp=180
D/VM_BMS  (  523): For ocv=4334182 batt_temp=180 soc=98
D/VM_BMS  (  523): FIFO=3 fifo_avg=4.404951 rbatt=0.194000 slope=0.940000 ibatt=-0.365336 ocv=4.334182 soc=98 fcc_ah=4.035000 sample_count=128 sample_interval=70 seq_num=41172
D/VM_BMS  (  523): For soc=98 batt_temp=180 slope=9400
D/VM_BMS  (  523): For soc=98 batt_temp=180 rbatt_sf=154
D/VM_BMS  (  523): rbatt_mohm_default=120, rbatt_mohm=184, sf=154 batt_temp=180
D/VM_BMS  (  523): For ocv=4334390 batt_temp=180 soc=98
I/SurfaceFlinger(  320): FPS: 35
D/VM_BMS  (  523): FIFO=4 fifo_avg=4.404066 rbatt=0.194000 slope=0.940000 ibatt=-0.359691 ocv=4.334390 soc=98 fcc_ah=4.035000 sample_count=128 sample_interval=70 seq_num=41172
I/VM_BMS  (  523): power_supply_update: ocv_uv=4334390 ibatt=-359690 soc=98 seq_num=41172
D/VM_BMS  (  523): End process_bms_data
D/VM_BMS  (  523): wake_lock released
W/Utils   (16239): could not parse size range '64x64-1920X1080'
W/VideoCapabilities(16239): Unsupported mime video/mp4v-esdp
I/GoogleInputMethod(28089): onFinishInput() : Dummy InputConnection bound
I/GoogleInputMethod(28089): onStartInput() : Dummy InputConnection bound
W/cr_CrashFileManager(16239): /data/data/com.tbdlab.cn1socketiotest/cache/WebView/Crash Reports does not exist or is not a directory
I/VideoCapabilities(16239): Unsupported profile 4 for video/mp4v-es
D/CN1SocketIOTest(16239): [EDT] 0:0:0,854 - Browser component onload called
V/WLAN_PSA(  381): NL MSG, len[048], NL type[0x11] WNI type[0x5050] len[028]
V/WLAN_PSA(  381): NL MSG, PID: 381
D/CN1SocketIOTest(16239): [EDT] 0:0:1,195 - Browser component onload end
W/chromium(16239): [WARNING:render_frame_host_impl.cc(2750)] OnDidStopLoading was called twice.
D/PerfShielderService( 2315): com.tbdlab.cn1socketiotest|com.tbdlab.cn1socketiotest/com.tbdlab.cn1socketiotest.MyApplicationStub|188|686056083155557|102|0
D/PerfShielderService( 2315): com.tbdlab.cn1socketiotest|com.tbdlab.cn1socketiotest/com.tbdlab.cn1socketiotest.MyApplicationStub|164|686056475839880|148|0
D/MiuiPerfServiceClient( 4323): interceptAndQueuing:16239|com.tbdlab.cn1socketiotest|188|102|restricted|null
I/SurfaceFlinger(  320): FPS: 35
D/MiuiPerfServiceClient( 4323): interceptAndQueuing:16239|com.tbdlab.cn1socketiotest|164|148|reclaim|null
V/WLAN_PSA(  381): NL MSG, len[4068], NL type[0x1C] WNI type[0x5900] len[52239]
V/WLAN_PSA(  381): NL MSG, PID: 381
D/BatteryService( 2315): Processing new values: chargerAcOnline=false, chargerUsbOnline=true, chargerWirelessOnline=false, batteryStatus=2, batteryHealth=2, batteryPresent=true, batteryLevel=100, batteryTechnology=Li-ion, batteryVoltage=4398, batteryTemperature=180, mBatteryLevelCritical=false, mPlugType=2
D/BatteryService( 2315): zhaoqf_sh batteryServices call state : 0 mPlugType : 2
D/ClClient(13574): Not sending keepalive.  Current connection state=STOPPED
W/        (16328): [ColorAdjust] gammamode=2, cemode=10
W/        (16328): [ColorAdjust] temp_gammavalue=2, temp_cevalue=10
W/        (16328): [ColorAdjust] Don't setGamma!
W/        (16328): [ColorAdjust] Don't setCe!
W/        (16328): [ColorAdjust] Set temp_prefer temp_ce!
I/SurfaceFlinger(  320): FPS: 18
I/MSM-irqbalance(  613): Decided to move IRQ215 from CPU5 to CPU4
D/BatteryService( 2315): Processing new values: chargerAcOnline=false, chargerUsbOnline=true, chargerWirelessOnline=false, batteryStatus=2, batteryHealth=2, batteryPresent=true, batteryLevel=100, batteryTechnology=Li-ion, batteryVoltage=4397, batteryTemperature=180, mBatteryLevelCritical=false, mPlugType=2
D/BatteryService( 2315): Sending ACTION_BATTERY_CHANGED.  level:100, scale:100, status:2, health:2, present:true, voltage: 4397, temperature: 180, technology: Li-ion, AC powered:false, USB powered:true, Wireless powered:false, icon:17303157, invalid charger:0
D/BatteryService( 2315): zhaoqf_sh batteryServices call state : 0 mPlugType : 2
D/BatteryController( 3553): action=android.intent.action.BATTERY_CHANGED; mCharging=true
I/BatteryInfoReceiver( 3730): ACTION_BATTERY_CHANGED
D/Codename One(16239): native focus loss
I/SurfaceFlinger(  320): FPS: 3
W/chromium(16239): [WARNING:render_frame_host_impl.cc(2750)] OnDidStopLoading was called twice.
D/BatteryService( 2315): Processing new values: chargerAcOnline=false, chargerUsbOnline=true, chargerWirelessOnline=false, batteryStatus=2, batteryHealth=2, batteryPresent=true, batteryLevel=100, batteryTechnology=Li-ion, batteryVoltage=4397, batteryTemperature=180, mBatteryLevelCritical=false, mPlugType=2
D/BatteryService( 2315): zhaoqf_sh batteryServices call state : 0 mPlugType : 2
W/chromium(16239): [WARNING:render_frame_host_impl.cc(2750)] OnDidStopLoading was called twice.
D/BatteryService( 2315): Processing new values: chargerAcOnline=false, chargerUsbOnline=true, chargerWirelessOnline=false, batteryStatus=2, batteryHealth=2, batteryPresent=true, batteryLevel=100, batteryTechnology=Li-ion, batteryVoltage=4397, batteryTemperature=180, mBatteryLevelCritical=false, mPlugType=2
D/BatteryService( 2315): zhaoqf_sh batteryServices call state : 0 mPlugType : 2
I/SurfaceFlinger(  320): FPS: 23
W/chromium(16239): [WARNING:render_frame_host_impl.cc(2750)] OnDidStopLoading was called twice.
V/WLAN_PSA(  381): NL MSG, len[4052], NL type[0x1C] WNI type[0x5900] len[48143]
V/WLAN_PSA(  381): NL MSG, PID: 381
D/BatteryService( 2315): Processing new values: chargerAcOnline=false, chargerUsbOnline=true, chargerWirelessOnline=false, batteryStatus=2, batteryHealth=2, batteryPresent=true, batteryLevel=100, batteryTechnology=Li-ion, batteryVoltage=4397, batteryTemperature=180, mBatteryLevelCritical=false, mPlugType=2
D/BatteryService( 2315): zhaoqf_sh batteryServices call state : 0 mPlugType : 2
D/BatteryService( 2315): Processing new values: chargerAcOnline=false, chargerUsbOnline=true, chargerWirelessOnline=false, batteryStatus=2, batteryHealth=2, batteryPresent=true, batteryLevel=100, batteryTechnology=Li-ion, batteryVoltage=4397, batteryTemperature=180, mBatteryLevelCritical=false, mPlugType=2
D/BatteryService( 2315): zhaoqf_sh batteryServices call state : 0 mPlugType : 2
V/WLAN_PSA(  381): NL MSG, len[048], NL type[0x11] WNI type[0x5050] len[028]
V/WLAN_PSA(  381): NL MSG, PID: 381
I/SurfaceFlinger(  320): FPS: 8
D/BatteryService( 2315): Processing new values: chargerAcOnline=false, chargerUsbOnline=true, chargerWirelessOnline=false, batteryStatus=2, batteryHealth=2, batteryPresent=true, batteryLevel=100, batteryTechnology=Li-ion, batteryVoltage=4397, batteryTemperature=180, mBatteryLevelCritical=false, mPlugType=2
D/BatteryService( 2315): zhaoqf_sh batteryServices call state : 0 mPlugType : 2
W/        (16338): [ColorAdjust] gammamode=2, cemode=10
W/        (16338): [ColorAdjust] temp_gammavalue=2, temp_cevalue=10
W/        (16338): [ColorAdjust] Don't setGamma!
W/        (16338): [ColorAdjust] Don't setCe!
W/        (16338): [ColorAdjust] Set temp_prefer temp_ce!
D/BatteryService( 2315): Processing new values: chargerAcOnline=false, chargerUsbOnline=true, chargerWirelessOnline=false, batteryStatus=2, batteryHealth=2, batteryPresent=true, batteryLevel=100, batteryTechnology=Li-ion, batteryVoltage=4397, batteryTemperature=180, mBatteryLevelCritical=false, mPlugType=2
D/BatteryService( 2315): zhaoqf_sh batteryServices call state : 0 mPlugType : 2
(only the lines for the Thread with ID: 16239 are probably relevant but I just kept all in case of...)

As you can see, the last log I have from my CN1 code is [EDT] 0:0:1,195 - Browser component onload end (which was callled from a Log.p() call from inside the BrowserComponent onLoad page event, see code on github). Any of the javascript logs never appeared (I waited for more than 60 in case the callbacks where a bit long but didn't see anything appear event though my first javascript call is internalBrowser.execute("logger.log(\"SocketIO bridge init\")"); so it sould pretty much immediate) 

The only thing I see in this log is W/chromium(16239): [WARNING:render_frame_host_impl.cc(2750)] OnDidStopLoading was called twice. that appears periodically (If I wait, this message comes back multiple times). But as it is just a warning I don't know if it can be the cause of my issue...

Shai Almog

unread,
Apr 7, 2018, 12:29:03 AM4/7/18
to CodenameOne Discussions
Steve is better at these things so I'll leave it to him. I do agree that debugging JS <-> Java is a pain in the neck. We made several attempts at simplifying it but mostly focusing around debugging on the simulator.

Is it possible that this is failing due to same origin?
I doubt that's the case if you opened the connection already but maybe injected code impacts this?

Steve Hannah

unread,
Apr 9, 2018, 7:31:15 AM4/9/18
to codenameone...@googlegroups.com
Just looking at your code.  Not sure why logging isn't working for you, but this code which instantiates your socket, may be problematic:

internalBrowser.execute("const socket = io('"+server_url+"')");

There is no guarantee that the Javascript expression executed in BrowserComponent.execute() is run in the global context.  It may be run inside the context of an anonymous function, so your "socket" variable won't be accessible from anywhere else. 

I would change it to

internalBrowser.execute("window.socket = io('"+server_url+"')");

Steve


--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.

For more options, visit https://groups.google.com/d/optout.

Thomas

unread,
Apr 10, 2018, 8:32:23 PM4/10/18
to CodenameOne Discussions
Changing const socket to window.socket solved the issue. Thanks a lot!
Regarding the javascript logging, it is partially working on the device now (so part of the problem seems to have been linked to the const socket instead of window.socket because changing that changed the javascript logging from zero to some). However, it seems that if the frequency of logging events is too high, only the last logging event is passed to the CN1 logger.  For example, in my onload browsercomponent event, I have two javascript log calls: internalBrowser.execute("logger.log(\"SocketIO bridge init\")"); and internalBrowser.execute("logger.log(\"SocketIO bridge started\")"); . But only the latest is thrown by CN1 in my adb logcat. 
Now, if I add the new js command: logger.log(\"emit "+eventName+"\"); before my js socket.emit() function , this is this emit hello log only that is thrown by CN1 in the adb logcat (because in my MyApplication class I have a socket.emit("hello"...) call that comes just after the socket initialisation (that will call the browsercomponent onload event)), the "SocketIO bridge started" log is not shown anymore. If I click on my emit event button, the "emit click" log is displayed though, meaning that the js logger is still functionnal (it is only if the frequency of log events is too high that there is an issue with only the latest log event beeing kept)
Reply all
Reply to author
Forward
0 new messages