Skip to content

Camera (0.6.2+1) widget throws error while taking picture despite permissions #72961

@RudraNirvan

Description

@RudraNirvan

I am using the camera plugin in my Flutter app. Despite adding permissions to my AndroidManifest.xml, it still throws the following errors:

E/SensorManager(15340): registerListenerImpl sensorName:lsm6dsm Accelerometer Non-wakeup,isWakeUpSensor:false,callingApp: com.rudranirvan.logbook,callingPid:15340,callingUid:10664
I/CameraManagerGlobal(15340): Connecting to camera service
E/libc    (15340): Access denied finding property "vendor.camera.aux.packagelist"
E/libc    (15340): Access denied finding property "vendor.camera.aux.packagelist"
W/anirvan.logbook(15340): type=1400 audit(0.0:671026): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=17306 scontext=u:r:untrusted_app:s0:c152,c258,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
E/libc    (15340): Access denied finding property "vendor.camera.aux.packagelist"
W/anirvan.logbook(15340): type=1400 audit(0.0:671027): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=17306 scontext=u:r:untrusted_app:s0:c152,c258,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
W/CameraManagerGlobal(15340): [soar.cts] ignore the status update of camera: 2
E/libc    (15340): Access denied finding property "vendor.camera.aux.packagelist"
W/anirvan.logbook(15340): type=1400 audit(0.0:671028): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=17306 scontext=u:r:untrusted_app:s0:c152,c258,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
W/CameraManagerGlobal(15340): [soar.cts] ignore the status update of camera: 3
W/anirvan.logbook(15340): type=1400 audit(0.0:671029): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=17306 scontext=u:r:untrusted_app:s0:c152,c258,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
W/anirvan.logbook(15340): type=1400 audit(0.0:671030): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=17306 scontext=u:r:untrusted_app:s0:c152,c258,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
E/libc    (15340): Access denied finding property "vendor.camera.aux.packagelist"
W/CameraManagerGlobal(15340): [soar.cts] ignore the status update of camera: 4
E/libc    (15340): Access denied finding property "vendor.camera.aux.packagelist"
W/CameraManagerGlobal(15340): [soar.cts] ignore the status update of camera: 5
E/libc    (15340): Access denied finding property "vendor.camera.aux.packagelist"
E/libc    (15340): Access denied finding property "persist.vendor.camera.privapp.list"
E/libc    (15340): Access denied finding property "vendor.camera.aux.packagelist"
E/libc    (15340): Access denied finding property "vendor.camera.aux.packagelist"
D/OnePlusJankManager(15340):  Chor uploadMDM JANK_TYPE_ONCE mViewTitle = com.rudranirvan.logbook/com.rudranirvan.logbook.MainActivity--- jank level = 2
W/Gralloc3(15340): allocator 3.x is not supported

Note that I can see the CameraPreview on my phone, no issues with that. The problem happens when I try to take a picture using this:

XFile file = await _cameraController.takePicture()

The debugger never reaches the next line and the above pasted error log gets displayed. I have also included the following permissions in my AndroidManifest.xml just to be sure (note that the camera and audio permission is already included in the plugin's AndroidManifest.xml):

    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-feature android:name="android.hardware.camera" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Expected results: Expected "takePicture()" to capture the image and share the file path.

Actual results: The camera preview works as expected, however, the "takePicture()" does nothing (check error log above).

Logs
   info • Name non-constant identifiers using lowerCamelCase • lib/biz/ocr/parsers/test_ocr_parser.dart:8:20 • non_constant_identifier_names
   info • Name non-constant identifiers using lowerCamelCase • lib/biz/ocr/parsers/test_ocr_parser.dart:11:23 • non_constant_identifier_names
   info • Name non-constant identifiers using lowerCamelCase • lib/biz/ocr/parsers/test_ocr_parser.dart:14:23 • non_constant_identifier_names
   info • Name non-constant identifiers using lowerCamelCase • lib/biz/ocr/parsers/test_ocr_parser.dart:17:23 • non_constant_identifier_names
   info • Name non-constant identifiers using lowerCamelCase • lib/biz/ocr/parsers/test_ocr_parser.dart:21:23 • non_constant_identifier_names
   info • Name non-constant identifiers using lowerCamelCase • lib/biz/ocr/parsers/test_ocr_parser.dart:25:23 • non_constant_identifier_names
   info • Name non-constant identifiers using lowerCamelCase • lib/biz/ocr/parsers/test_ocr_parser.dart:31:23 • non_constant_identifier_names
   info • The value of the local variable 'languages' isn't used • lib/biz/ocr/parsers/test_ocr_parser.dart:41:38 • unused_local_variable
   info • The value of the local variable 'element' isn't used • lib/biz/ocr/parsers/test_ocr_parser.dart:46:26 • unused_local_variable
   info • Name non-constant identifiers using lowerCamelCase • lib/biz/utils.dart:6:27 • non_constant_identifier_names
   info • Name non-constant identifiers using lowerCamelCase • lib/biz/utils.dart:7:27 • non_constant_identifier_names
   info • Unused import: 'package:intl/intl.dart' • lib/components/auto_complete_text_input_field.dart:2:8 • unused_import
   info • Unused import: 'package:logbook/state/app_state.dart' • lib/components/auto_complete_text_input_field.dart:4:8 • unused_import
   info • Unused import: 'package:provider/provider.dart' • lib/components/auto_complete_text_input_field.dart:5:8 • unused_import
   info • Name non-constant identifiers using lowerCamelCase • lib/constants/constants.dart:1:14 • non_constant_identifier_names
   info • Unused import: 'package:logbook/constants/styles.dart' • lib/screens/add_log/add_log_screen.dart:3:8 • unused_import
   info • This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: AddLogScreen.flightLog • lib/screens/add_log/add_log_screen.dart:8:7 • must_be_immutable
   info • Unused import: 'package:intl/intl.dart' • lib/screens/add_log/components/add_log_form.dart:2:8 • unused_import
   info • This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: AddLogForm.flightLog • lib/screens/add_log/components/add_log_form.dart:12:7 • must_be_immutable
   info • Unused import: 'dart:io' • lib/screens/add_log/components/add_log_main_body.dart:1:8 • unused_import
   info • Unused import: 'package:logbook/state/app_state.dart' • lib/screens/add_log/components/add_log_main_body.dart:8:8 • unused_import
   info • Unused import: 'package:provider/provider.dart' • lib/screens/add_log/components/add_log_main_body.dart:9:8 • unused_import
   info • This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: AddLogMainBody.flightLog • lib/screens/add_log/components/add_log_main_body.dart:12:7 •
          must_be_immutable
   info • The value of the local variable 'element' isn't used • lib/screens/capture_log/capture_log_main_body.dart:217:26 • unused_local_variable
   info • Unused import: 'package:firebase_ml_vision/firebase_ml_vision.dart' • lib/screens/capture_log/capture_log_main_body_v2.dart:8:8 • unused_import
   info • Unused import: 'package:logbook/biz/ocr/ocr_reader.dart' • lib/screens/capture_log/capture_log_main_body_v2.dart:11:8 • unused_import
   info • Unused import: 'package:logbook/state/app_state.dart' • lib/screens/capture_log/capture_log_main_body_v2.dart:13:8 • unused_import
   info • Unused import: 'package:provider/provider.dart' • lib/screens/capture_log/capture_log_main_body_v2.dart:15:8 • unused_import
   info • Unused import: 'package:logbook/screens/capture_log/capture_log_main_body_v2.dart' • lib/screens/capture_log/capture_log_screen.dart:3:8 • unused_import
   info • Unused import: 'package:logbook/components/no_account_text.dart' • lib/screens/forgot_password/components/forgot_password_form.dart:5:8 • unused_import
   info • This function has a return type of 'double', but doesn't end with a return statement • lib/size_config.dart:17:10 • missing_return

31 issues found. (ran in 5.5s)
flutter doctor -v
[✓] Flutter (Channel stable, 1.22.5, on macOS 11.0.1 20B29 darwin-x64, locale en-US)
    • Flutter version 1.22.5 at /Users/rudra.nirvan/flutter/flutter
    • Framework revision 7891006299 (2 weeks ago), 2020-12-10 11:54:40 -0800
    • Engine revision ae90085a84
    • Dart version 2.10.4

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/rudra.nirvan/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.2.1, Build version 11B500
    • CocoaPods version 1.10.0

[!] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[!] IntelliJ IDEA Ultimate Edition (version 2019.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[!] IntelliJ IDEA Community Edition (version 2020.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[!] VS Code (version 1.51.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (1 available)
    • GM1911 (mobile) • 29ce22b8 • android-arm64 • Android 10 (API 29)

! Doctor found issues in 4 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in triagePresently being triaged by the triage team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions