jitsi / jitsi-meet-sdk-samples

Jitsi Meet mobile SDK examples (Android, iOS and React Native)
Apache License 2.0
283 stars 240 forks source link

The issue with targetSDK 14 #230

Open Alex10000001 opened 8 months ago

Alex10000001 commented 8 months ago

Issue: java.lang.IllegalAccessException accessing visual service WindowManager from a non-visual Context

Description:

When attempting to access the visual service WindowManager from a non-visual Context, specifically in the CameraSession and Camera2Session classes, an IllegalAccessException is thrown. This occurs within the org.webrtc package and seems to be related to device orientation retrieval.

Error Trace:

java.lang.IllegalAccessException: Tried to access visual service WindowManager from a non-visual Context:com.my.app.Application@4187070
    at android.app.ContextImpl.getSystemService(ContextImpl.java:2278)
    at android.content.ContextWrapper.getSystemService(ContextWrapper.java:951)
    at com.facebook.react.bridge.ReactContext.getSystemService(ReactContext.java:165)
    at org.webrtc.CameraSession.getDeviceOrientation(CameraSession.java:43)
    at org.webrtc.Camera2Session.getFrameOrientation(Camera2Session.java:414)
    at org.webrtc.Camera2Session.-$$Nest$mgetFrameOrientation(Unknown Source:0)
    at org.webrtc.Camera2Session$CaptureSessionCallback.lambda$onConfigured$0$org-webrtc-Camera2Session$CaptureSessionCallback(Camera2Session.java:204)
    at org.webrtc.Camera2Session$CaptureSessionCallback$$ExternalSyntheticLambda0.onFrame(Unknown Source:2)
    at org.webrtc.SurfaceTextureHelper.tryDeliverTextureFrame(SurfaceTextureHelper.java:370)
    at org.webrtc.SurfaceTextureHelper.lambda$new$0$org-webrtc-SurfaceTextureHelper(SurfaceTextureHelper.java:207)
    at org.webrtc.SurfaceTextureHelper$$ExternalSyntheticLambda0.onFrameAvailable(Unknown Source:2)
    at android.graphics.SurfaceTexture$1.handleMessage(SurfaceTexture.java:214)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:230)
    at android.os.Looper.loop(Looper.java:319)
    at android.os.HandlerThread.run(HandlerThread.java:67)

Steps to Reproduce:

  1. Attempt to access visual service WindowManager from a non-visual Context.
  2. Use classes CameraSession and Camera2Session within the org.webrtc package.
  3. Trigger any action related to device orientation retrieval.

Expected Behavior:

The application should be able to access the WindowManager service without encountering an IllegalAccessException when called from a non-visual Context.

Actual Behavior:

An IllegalAccessException is thrown, indicating an attempt to access WindowManager from a non-visual Context.

Environment:

Possible Solutions:

This issue needs to be addressed to ensure proper functionality and prevent runtime exceptions.

I passed activity context.

gradle: implementation("org.jitsi.react:jitsi-meet-sdk:9.0.0") { transitive = true }

saghul commented 8 months ago

Are you reproducing this with the sample app?

Alex10000001 commented 7 months ago

Are you reproducing this with the sample app?

No

saghul commented 7 months ago

Then unless you share some small sample code that reproduce the problem it's very hard for us to help you.

Alex10000001 commented 7 months ago

Let me know what details I have to provide for helping me?

Alex10000001 commented 7 months ago

Btw the app works fine with the version of the library: org.jitsi.react:jitsi-meet-sdk:5.1.0

saghul commented 7 months ago

We need a way to reproduce the problem.

That SDK is years old, so it's no longer relevant here.