Answer the question
In order to leave comments, you need to log in
Who can help with Camera 2 API preview connection error?
Good afternoon, forum users! I ask enlightened colleagues to help) On the screen, instead of a camera, I see a rectangle painted over in GRAY color.
Error logs:
2020-03-09 16:04:42.392 10004-10004/com.example.geocam W/ActivityThread: handleWindowVisibility: no activity for token [email protected]
2020-03-09 16:04:43.131 10004-10004/com.example.geocam W/ActivityThread: handleWindowVisibility: no activity for token [email protected]
2020-03-09 16:04:43.187 10004-10004/com.example.geocam I/CameraManagerGlobal: Connecting to camera service
2020-03-09 16:04:43.189 10004-10004/com.example.geocam E/libc: Access denied finding property "vendor.camera.aux.packagelist"
2020-03-09 16:04:43.183 10004-10004/com.example.geocam W/.example.geocam: type=1400 audit(0.0:68683): avc: denied { read } for name="u:object_r:vendor_camera_prop:s0" dev="tmpfs" ino=4391 scontext=u:r:untrusted_app:s0:c162,c256,c512,c768 tcontext=u:object_r:vendor_camera_prop:s0 tclass=file permissive=0
2020-03-09 16:04:43.183 10004-10004/com.example.geocam I/chatty: uid=10162(com.example.geocam) identical 5 lines
2020-03-09 16:04:43.183 10004-10004/com.example.geocam W/Binder:10004_3: type=1400 audit(0.0:68689): avc: denied { read } for name="u:object_r:vendor_camera_prop:s0" dev="tmpfs" ino=4391 scontext=u:r:untrusted_app:s0:c162,c256,c512,c768 tcontext=u:object_r:vendor_camera_prop:s0 tclass=file permissive=0
2020-03-09 16:04:43.189 10004-10004/com.example.geocam E/libc: Access denied finding property "vendor.camera.aux.packagelist"
2020-03-09 16:04:43.183 10004-10004/com.example.geocam W/Binder:10004_3: type=1400 audit(0.0:68690): avc: denied { read } for name="u:object_r:vendor_camera_prop:s0" dev="tmpfs" ino=4391 scontext=u:r:untrusted_app:s0:c162,c256,c512,c768 tcontext=u:object_r:vendor_camera_prop:s0 tclass=file permissive=0
2020-03-09 16:04:43.190 10004-10004/com.example.geocam E/libc: Access denied finding property "vendor.camera.aux.packagelist"
2020-03-09 16:04:43.190 10004-10004/com.example.geocam W/CameraManagerGlobal: [soar.cts] ignore the status update of camera: 2
2020-03-09 16:04:43.190 10004-10004/com.example.geocam E/libc: Access denied finding property "vendor.camera.aux.packagelist"
2020-03-09 16:04:43.190 10004-10004/com.example.geocam W/CameraManagerGlobal: [soar.cts] ignore the status update of camera: 3
2020-03-09 16:04:43.190 10004-10004/com.example.geocam E/libc: Access denied finding property "vendor.camera.aux.packagelist"
2020-03-09 16:04:43.190 10004-10004/com.example.geocam E/libc: Access denied finding property "vendor.camera.aux.packagelist"
2020-03-09 16:04:43.190 10004-10004/com.example.geocam I/geoCamLogs: Камера ID: 0
2020-03-09 16:04:43.190 10004-10019/com.example.geocam E/libc: Access denied finding property "vendor.camera.aux.packagelist"
2020-03-09 16:04:43.190 10004-10019/com.example.geocam I/chatty: uid=10162(com.example.geocam) Binder:10004_3 identical 1 line
2020-03-09 16:04:43.191 10004-10019/com.example.geocam E/libc: Access denied finding property "vendor.camera.aux.packagelist"
2020-03-09 16:04:43.191 10004-10019/com.example.geocam W/CameraManagerGlobal: ignore the torch status update of camera: 2
2020-03-09 16:04:43.191 10004-10004/com.example.geocam I/geoCamLogs: Камера ID: 1
2020-03-09 16:04:43.191 10004-10019/com.example.geocam E/libc: Access denied finding property "vendor.camera.aux.packagelist"
2020-03-09 16:04:43.191 10004-10019/com.example.geocam W/CameraManagerGlobal: ignore the torch status update of camera: 3
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
if (checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED
||
(ContextCompat.checkSelfPermission(CameraActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)
) {
requestPermissions(new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
}
Answer the question
In order to leave comments, you need to log in
The answer is actually very stupid))) There is an additional permission check in the method call to open the camera. In it, in comparison, he put the wrong sign. This is:
if (checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
mCameraManager.openCamera(mCameraID, mCameraCallback, null);
}else{
Log.e(LOG_TAG, "Нет разрешения для запуска камеры");
}
if (checkSelfPermission(Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
mCameraManager.openCamera(mCameraID, mCameraCallback, null);
}else{
Log.e(LOG_TAG, "Нет разрешения для запуска камеры");
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question