Start a new topic
Solved

Issue with onCameraReleased

Hi All

I'm currently writing a nativescript-plugin for Wikitude, if you are not familiar with nativescript, it is a JS Framework that allows you to use Native Libraries with Frameworks like Angular for Mobile Applications...

If interested you can see my plugin here:
https://bitbucket.org/SD-CLIENTPROJ/nativescript-wikitude

The Issue i am having is that the Wikitude Viewer seems to hang "sometimes" if i have the Camera Lifecycle Events being listened to.
it freezes after onCameraReleased.

I can ofcourse disable this event-set for now, but as i am writing a generic plugin i would like to offer developers the full range of the SDK.
 


 


Hi Brendan,


Could you please provide further details on the issue:

  • Which version of the SDK are you using?
  • Are you using the JS API?
  • Please send the crash log
  • What device does this happen with (os Version and model)?

Thanks

Eva

Hi Eva, Thanks for getting back.

I am testing this on 7.2.1, but was also present on 7.1.0 (though, now it seems to happen everytime)
The Plugin is a wrap around your JS API SDK, Yes.
There is no crash log per-say, it seems it gets stuck in a loop and then gets booted, it does create a trace file, but im not sure if it is of use.

i'll attach that below.. .

I am testing on Android 8.0, OnePlus 3T.


In the Bitbucket Repo, there is a bunch of demo's, If you would like to test it, then you should be able to clone the repository, and run the demo's (i would recommend the demo-ng demo),

and to reproduce the issue again, you go through the permissions page, grant your permissions, and then press continue, it should open a page with wikitude... now when you press the device back button, the application freezes, and shortly kicks you off.



Many thanks.
Brendan

 

txt

Hi Brendan,



my best guess, without knowing anything about NativeScript or your code, is that you're having a blocked main thread. Here's how I think it happens:


The dispatchCallJSMethodNative function (or any of the related functions preceding it) acquires a lock and invokes onPause of the ArchitectView, onPause spawns a thread and waits for its completion (the spawning of the thread is irrelevant, onPause being a blocking function call is the important bit). This spawned thread then ultimately runs the onCameraReleased function which you pick up on and call dispatchCallJSMethodNative again, which, if my guess is correct, blocks indefinitely because it cannot acquire the lock due to it being locked already. 


Bottom line, you're not allowed to do that. It would be great if you could find out whether the locking happens in the manner I assume it does.



Here are the relevant parts of the call stack:


- main thread


  at java.lang.Object.wait(Native method)

  - waiting on <0x063cb3e5> (a java.lang.Object)

  at java.lang.Object.wait(Object.java:422)

  at java.lang.Thread.join(Thread.java:1260)

  - locked <0x063cb3e5> (a java.lang.Object)

  at java.lang.Thread.join(Thread.java:1336)

  at com.wikitude.common.rendering.internal.b.onPause(ProGuard:127)

  at com.wikitude.common.rendering.RenderSurfaceView.onPause(ProGuard:227)

  at com.wikitude.architect.ArchitectView.onPause(ProGuard:876)

  at com.tns.Runtime.callJSMethodNative(Native method)

  at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)

  at com.tns.Runtime.callJSMethodImpl(Runtime.java:970)

  at com.tns.Runtime.callJSMethod(Runtime.java:957)

  at com.tns.Runtime.callJSMethod(Runtime.java:941)

  at com.tns.Runtime.callJSMethod(Runtime.java:933)

  

  

- spawned from main


  at java.lang.Object.wait(Native method)

  - waiting on <0x0ba52399> (a com.tns.Runtime$3)

  at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1121)

  - locked <0x0ba52399> (a com.tns.Runtime$3)

  at com.tns.Runtime.callJSMethodImpl(Runtime.java:970)

  at com.tns.Runtime.callJSMethod(Runtime.java:957)

  at com.tns.Runtime.callJSMethod(Runtime.java:941)

  at com.tns.Runtime.callJSMethod(Runtime.java:933)

  at com.tns.gen.java.lang.Object_frnal_ts_helpers_l58_c38__CameraLifecycleListener.onCameraReleased(Object_frnal_ts_helpers_l58_c38__CameraLifecycleListener.java:21)

  at com.wikitude.architect.ArchitectView.onCameraReleased(ProGuard:323)

  at com.wikitude.common.camera.internal.CameraService.onCameraReleased(ProGuard:87)

  at com.wikitude.common.camera.internal.e.b(ProGuard:206)

  at com.wikitude.common.camera.internal.CameraService.c(ProGuard:64)

  at com.wikitude.common.services.internal.ServiceManagerInternal.stopService(ProGuard:76)

  at com.wikitude.common.rendering.internal.NativeRenderer.onPause(Native method)



- Daniel



Login or Signup to post a comment