Files
platform-external-webrtc/sdk/android
Saúl Ibarra Corretgé a14e6ed09a Catch SecurityException when opening camera
A managed device might have camera access restricted, which results in
the following crash:

Caused by android.os.ServiceSpecificException: validateClientPermissionsLocked:1044: Callers from device user 0 are not currently allowed to connect to camera "1"
       at android.os.Parcel.createException(Parcel.java:2085)
       at android.os.Parcel.readException(Parcel.java:2039)
       at android.os.Parcel.readException(Parcel.java:1987)
       at android.hardware.ICameraService$Stub$Proxy.connectDevice(ICameraService.java:624)
       at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:389)
       at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:588)
       at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:516)
       at org.webrtc.Camera2Session.openCamera(Camera2Session.java:359)
       at org.webrtc.Camera2Session.start(Camera2Session.java:322)
       at org.webrtc.Camera2Session.<init>(Camera2Session.java:298)
       at org.webrtc.Camera2Session.create(Camera2Session.java:276)
       at org.webrtc.Camera2Capturer.createCameraSession(Camera2Capturer.java:35)
       at org.webrtc.CameraCapturer$5.run(CameraCapturer.java:272)
       at android.os.Handler.handleCallback(Handler.java:883)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at android.os.Looper.loop(Looper.java:214)
       at android.os.HandlerThread.run(HandlerThread.java:67)

Change-Id: I5e7b8d238e9381d1f8a4fe9858e8eb480d578fa0
Bug: webrtc:13950
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258363
Commit-Queue: Xavier Lepaul‎ <xalep@webrtc.org>
Reviewed-by: Xavier Lepaul‎ <xalep@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36513}
2022-04-11 07:26:08 +00:00
..
2022-04-07 08:32:42 +00:00
2022-03-31 10:48:31 +00:00
2018-03-01 20:22:48 +00:00

This directory holds a Java implementation of the webrtc::PeerConnection API, as
well as the JNI glue C++ code that lets the Java implementation reuse the C++
implementation of the same API.

To build the Java API and related tests, make sure you have a WebRTC checkout
with Android specific parts. This can be used for linux development as well by
configuring gn appropriately, as it is a superset of the webrtc checkout:
fetch --nohooks webrtc_android
gclient sync

You also must generate GN projects with:
--args='target_os="android" target_cpu="arm"'

More information on getting the code, compiling and running the AppRTCMobile
app can be found at:
https://webrtc.org/native-code/android/

To use the Java API, start by looking at the public interface of
org.webrtc.PeerConnection{,Factory} and the org.webrtc.PeerConnectionTest.

To understand the implementation of the API, see the native code in src/jni/pc/.