Access denied finding property "vendor.camera.aux.packagelist"
-
Hello,
I am trying to build an app in which when you type an incorrect password a picture of the front camera is being made. I have written everything, but something with the permissions seems off.
When I try to take a picture I get
01-26 17:27:19.887 32022 32022 W libc : Access denied finding property "vendor.camera.aux.packagelist" 01-26 17:27:19.888 32022 32022 W libc : Access denied finding property "vendor.camera.aux.packagelist.ext" 01-26 17:27:19.906 32022 32022 W libc : Access denied finding property "vendor.camera.aux.packagelist" 01-26 17:27:19.906 32022 32022 W libc : Access denied finding property "vendor.camera.aux.packagelist.ext" 01-26 17:27:19.982 32022 32228 W libc : Access denied finding property "vendor.camera.aux.packagelist" 01-26 17:27:19.982 32022 32228 W libc : Access denied finding property "vendor.camera.aux.packagelist.ext" 01-26 17:27:20.000 32022 32228 D CameraExtStub: init android.hardware.camera2.impl.CameraExtImplXiaoMi 01-26 17:27:20.330 32022 32228 W BpBinder: Slow Binder: BpBinder transact took 309 ms, interface=android.hardware.ICameraService, code=3 oneway=false 01-26 17:27:20.340 32022 32228 W libc : Access denied finding property "vendor.camera.aux.packagelist" 01-26 17:27:20.341 32022 32228 W libc : Access denied finding property "vendor.camera.aux.packagelist.ext" 01-26 17:27:20.386 32022 32022 W libc : Access denied finding property "vendor.camera.aux.packagelist" 01-26 17:27:20.386 32022 32022 W libc : Access denied finding property "vendor.camera.aux.packagelist.ext" 01-26 17:27:20.393 32022 32243 W libc : Access denied finding property "vendor.camera.aux.packagelist" 01-26 17:27:20.393 32022 32243 W libc : Access denied finding property "vendor.camera.aux.packagelist.ext" 01-26 17:27:20.430 32022 32243 W libc : Access denied finding property "vendor.camera.aux.packagelist" 01-26 17:27:20.430 32022 32243 W libc : Access denied finding property "vendor.camera.aux.packagelist.ext" 01-26 17:27:20.480 32022 32257 W libc : Access denied finding property "vendor.camera.aux.packagelist" 01-26 17:27:20.480 32022 32257 W libc : Access denied finding property "vendor.camera.aux.packagelist.ext" 01-26 17:27:20.528 32022 32257 W libc : Access denied finding property "vendor.camera.aux.packagelist" 01-26 17:27:20.528 32022 32257 W libc : Access denied finding property "vendor.camera.aux.packagelist.ext" 01-26 17:27:23.112 32022 32022 I ForceDarkHelperStubImpl: setViewRootImplForceDark: false for org.qtproject.example
Here are my files:
AndroidManifest.xml
<?xml version="1.0"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.qtproject.example.androidnotifier" android:installLocation="auto" android:versionCode="1" android:versionName="1.0"> <!-- The comment below will be replaced with dependencies permissions upon deployment. Remove the comment if you do not require these default permissions. --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- The comment below will be replaced with dependencies permissions upon deployment. Remove the comment if you do not require these default features. --> <!--PERMISSIONS I HAVE WRITTEN FOR CAMERA--> <uses-feature android:name="android.hardware.camera" android:required="true" /> <uses-permission android:name="android.permission.CAMERA" /> <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" /> <application android:name="org.qtproject.qt.android.bindings.QtApplication" android:extractNativeLibs="true" android:label="Qt Notifier" android:requestLegacyExternalStorage="true" android:icon="@drawable/icon"> <activity android:name="org.qtproject.example.androidnotifier.MyActivity" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:label="Qt Notifier" android:launchMode="singleTop" android:screenOrientation="unspecified"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --" /> <meta-data android:name="android.app.extract_android_style" android:value="none" /> </activity> <receiver android:name="org.qtproject.example.androidnotifier.DemoDeviceAdminReceiver" android:permission="android.permission.BIND_DEVICE_ADMIN" android:exported="true"> <meta-data android:name="android.app.device_admin" android:resource="@xml/device_admin_sample" /> <intent-filter> <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" /> </intent-filter> </receiver> </application> </manifest>
device_admin_sample.xml
<?xml version="1.0" encoding="utf-8"?> <device-admin > <uses-policies> <limit-password /> <watch-login /> </uses-policies> </device-admin>
main.cpp
bool checkPermission() { auto r = QtAndroidPrivate::checkPermission(QtAndroidPrivate::Camera).result(); if (r == QtAndroidPrivate::Denied) { r = QtAndroidPrivate::requestPermission(QtAndroidPrivate::Camera).result(); if (r == QtAndroidPrivate::Denied) return false; } return true; } bool checkPermission1() { auto r = QtAndroidPrivate::checkPermission(QtAndroidPrivate::Storage).result(); if (r == QtAndroidPrivate::Denied) { r = QtAndroidPrivate::requestPermission(QtAndroidPrivate::Storage).result(); if (r == QtAndroidPrivate::Denied) return false; } return true; } #ifdef __cplusplus extern "C" { #endif JNIEXPORT void JNICALL Java_org_qtproject_example_androidnotifier_MyJavaNatives_passwordCallback(JNIEnv env, jobject obj, jint n) { QCamera *camera = new QCamera; QMediaCaptureSession m_captureSession; QImageCapture *m_imageCapture; camera = new QCamera(QMediaDevices::defaultVideoInput()); m_captureSession.setCamera(camera); m_imageCapture = new QImageCapture; m_captureSession.setImageCapture(m_imageCapture); camera->start(); m_imageCapture->captureToFile("/storage/emulated/0/Download/qt.jpeg"); delete camera; delete m_imageCapture; } #ifdef __cplusplus } #endif int main(int argc, char *argv[]) { QApplication a(argc, argv); checkPermission(); checkPermission1(); return a.exec(); }
I am using JNI ( Java Native Interface ), so when my password is written incorrectly Java_org_qtproject_example_androidnotifier_MyJavaNatives_passwordCallback gets called.
When I load my app I get 2 pop ups to grant the permission shows and I accept them.
When I type my password incorrectly it goes in the function that is expected to take a picture, but I get the errors I have provided at the top of the post, even though I have the necessary permissions.
Why is that ? I have written the necessary permissions in the AndroidManifest file and I do request them at run time. Could someone help me figure out what is wrong ?
-
Hello, I have tried a simpler codebase.
Currently I have main.cpp
int main(int argc, char *argv[]) { QApplication a(argc, argv); checkPermission(); checkPermission1(); QCamera *camera = new QCamera; QMediaCaptureSession m_captureSession; QImageCapture *m_imageCapture; camera = new QCamera(QCameraDevice::FrontFace); m_captureSession.setCamera(camera); m_imageCapture = new QImageCapture; m_captureSession.setImageCapture(m_imageCapture); camera->start(); int id = m_imageCapture->captureToFile("/storage/emulated/0/Download/f.jpeg"); qDebug() << "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAa"; return a.exec(); }
on Xiaomi Redmi Note 11 Pro 5G I get the very same error, but on Samsung A71 I don't have any errors, but the file still doesn't get saved.
Could someone please help me find out why that is ? What's the solution of this ?
-
Hello, I have tried a simpler codebase.
Currently I have main.cpp
int main(int argc, char *argv[]) { QApplication a(argc, argv); checkPermission(); checkPermission1(); QCamera *camera = new QCamera; QMediaCaptureSession m_captureSession; QImageCapture *m_imageCapture; camera = new QCamera(QCameraDevice::FrontFace); m_captureSession.setCamera(camera); m_imageCapture = new QImageCapture; m_captureSession.setImageCapture(m_imageCapture); camera->start(); int id = m_imageCapture->captureToFile("/storage/emulated/0/Download/f.jpeg"); qDebug() << "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAa"; return a.exec(); }
on Xiaomi Redmi Note 11 Pro 5G I get the very same error, but on Samsung A71 I don't have any errors, but the file still doesn't get saved.
Could someone please help me find out why that is ? What's the solution of this ?
@Ivelin said in Access denied finding property "vendor.camera.aux.packagelist":
camera->start();
int id = m_imageCapture->captureToFile("/storage/emulated/0/Download/f.jpeg");I guess you need to wait for camera to actually start (maybe https://doc.qt.io/qt-6/qcamera.html#active-prop)?
-
@Ivelin said in Access denied finding property "vendor.camera.aux.packagelist":
camera->start();
int id = m_imageCapture->captureToFile("/storage/emulated/0/Download/f.jpeg");I guess you need to wait for camera to actually start (maybe https://doc.qt.io/qt-6/qcamera.html#active-prop)?
-
@Ivelin said in Access denied finding property "vendor.camera.aux.packagelist":
camera->start();
int id = m_imageCapture->captureToFile("/storage/emulated/0/Download/f.jpeg");I guess you need to wait for camera to actually start (maybe https://doc.qt.io/qt-6/qcamera.html#active-prop)?
@jsulm, hello again.
Thankfully to your suggestion I've been able to get somewhere!
Here's what I have now
main.cpp
int main(int argc, char *argv[]) { QApplication a(argc, argv); checkPermission(); checkPermission1(); QWidget widget; QPushButton btn; btn.setMinimumSize(QSize(200, 200)); btn.setText("Take a picutre"); QVBoxLayout layout; layout.addWidget(&btn); widget.setLayout(&layout); QCamera *camera = new QCamera; QMediaCaptureSession m_captureSession; QImageCapture *m_imageCapture; camera = new QCamera(QCameraDevice::FrontFace); m_captureSession.setCamera(camera); m_imageCapture = new QImageCapture; m_captureSession.setImageCapture(m_imageCapture); camera->start(); QObject::connect(&btn, &QPushButton::clicked, [m_imageCapture, camera]() { qDebug() << camera->isActive() << " " << m_imageCapture->isReadyForCapture(); int id = m_imageCapture->captureToFile("/storage/emulated/0/Download/f.jpeg"); }); widget.show(); return a.exec(); }
The interesting part in this code is the qDebug outout for camera->isActive() and m_imageCapture->isReadyForCapture()!
camera->isActive() is true, but m_imageCature->isReadyForCapture() is false.
However, I have no idea why ?
Could someone take a look ? Why is m_imageCapture->isReadyForCapture() false ? How can I fix it?
-
@jsulm, hello again.
Thankfully to your suggestion I've been able to get somewhere!
Here's what I have now
main.cpp
int main(int argc, char *argv[]) { QApplication a(argc, argv); checkPermission(); checkPermission1(); QWidget widget; QPushButton btn; btn.setMinimumSize(QSize(200, 200)); btn.setText("Take a picutre"); QVBoxLayout layout; layout.addWidget(&btn); widget.setLayout(&layout); QCamera *camera = new QCamera; QMediaCaptureSession m_captureSession; QImageCapture *m_imageCapture; camera = new QCamera(QCameraDevice::FrontFace); m_captureSession.setCamera(camera); m_imageCapture = new QImageCapture; m_captureSession.setImageCapture(m_imageCapture); camera->start(); QObject::connect(&btn, &QPushButton::clicked, [m_imageCapture, camera]() { qDebug() << camera->isActive() << " " << m_imageCapture->isReadyForCapture(); int id = m_imageCapture->captureToFile("/storage/emulated/0/Download/f.jpeg"); }); widget.show(); return a.exec(); }
The interesting part in this code is the qDebug outout for camera->isActive() and m_imageCapture->isReadyForCapture()!
camera->isActive() is true, but m_imageCature->isReadyForCapture() is false.
However, I have no idea why ?
Could someone take a look ? Why is m_imageCapture->isReadyForCapture() false ? How can I fix it?
@Ivelin Connect a slot to https://doc.qt.io/qt-6/qimagecapture.html#readyForCaptureChanged - is it called?
You can also check https://doc.qt.io/qt-5/qcamera.html#captureMode-prop -
@Ivelin Connect a slot to https://doc.qt.io/qt-6/qimagecapture.html#readyForCaptureChanged - is it called?
You can also check https://doc.qt.io/qt-5/qcamera.html#captureMode-prop@jsulm, no it is not being called. Seems like a bug?
QMediaCaptureSession m_captureSession; QImageCapture *m_imageCapture = new QImageCapture; camera = new QCamera(QCameraDevice::FrontFace); m_captureSession.setCamera(camera); m_captureSession.setImageCapture(m_imageCapture); camera->start(); if (!m_imageCapture->isReadyForCapture()) { qDebug() << "Camera is not ready for capture"; } QObject::connect(&btn, &QPushButton::clicked, [m_imageCapture, camera]() { qDebug() << camera->isActive() << " " << m_imageCapture->isReadyForCapture(); int id = m_imageCapture->captureToFile("/storage/emulated/0/Download/f.jpeg"); }); QObject::connect(m_imageCapture, &QImageCapture::readyForCaptureChanged, []() { qDebug() << "READYYYYYYYYYYYYYYYYYY"; });
There is no "READYYYYYYYYYYYYYYYYYY" in my logs. I have tried both on Xiaomi and Samsung.
-
@jsulm, no it is not being called. Seems like a bug?
QMediaCaptureSession m_captureSession; QImageCapture *m_imageCapture = new QImageCapture; camera = new QCamera(QCameraDevice::FrontFace); m_captureSession.setCamera(camera); m_captureSession.setImageCapture(m_imageCapture); camera->start(); if (!m_imageCapture->isReadyForCapture()) { qDebug() << "Camera is not ready for capture"; } QObject::connect(&btn, &QPushButton::clicked, [m_imageCapture, camera]() { qDebug() << camera->isActive() << " " << m_imageCapture->isReadyForCapture(); int id = m_imageCapture->captureToFile("/storage/emulated/0/Download/f.jpeg"); }); QObject::connect(m_imageCapture, &QImageCapture::readyForCaptureChanged, []() { qDebug() << "READYYYYYYYYYYYYYYYYYY"; });
There is no "READYYYYYYYYYYYYYYYYYY" in my logs. I have tried both on Xiaomi and Samsung.
-
@jsulm, I am using Qt 6.2.4.
I try to stick to something older, so there is lower chance for bugs, unfortunately this doesn't seem to be the case, so I will try the latest one.
@Ivelin said in Access denied finding property "vendor.camera.aux.packagelist":
I try to stick to something older, so there is lower chance for bugs
Bugs get fixed in newer versions (of course new bugs are also introduced :-)).
-
@Ivelin said in Access denied finding property "vendor.camera.aux.packagelist":
I try to stick to something older, so there is lower chance for bugs
Bugs get fixed in newer versions (of course new bugs are also introduced :-)).
@jsulm, hello
Late update. It is not the version I am pretty sure.
The Qt 6.2 example for camera works just fine, so it must be something from my code.
Yes, I am still banging my head, so I can fix that problem. it is been a week now I am getting pretty desperate
The problem must be in the code.
Could someone please help me ? Any Ideas ?
-
@jsulm, I am using Qt 6.2.4.
I try to stick to something older, so there is lower chance for bugs, unfortunately this doesn't seem to be the case, so I will try the latest one.
-
@JoeCFD, I am going to try With Qt 6.6 ( latest current ), but again the qt camera example for qt 6.2 worked just fine, so I suppose it should be a problem in the code.
-
@Ivelin put or zip your whole test code somewhere for other people to be able to access for testing.
@JoeCFD, I will, but I just think that I have found something !
This is my current code:
int main(int argc, char *argv[]) { QApplication a(argc, argv); checkPermission(); checkPermission1(); QWidget widget; QPushButton btn; btn.setMinimumSize(QSize(200, 200)); btn.setText("Take a picutre"); QVBoxLayout layout; layout.addWidget(&btn); widget.setLayout(&layout); QCamera *camera = new QCamera; QMediaCaptureSession m_captureSession; QImageCapture *m_imageCapture; camera = new QCamera(QCameraDevice::FrontFace); m_captureSession.setCamera(camera); m_imageCapture = new QImageCapture; m_captureSession.setImageCapture(m_imageCapture); QObject::connect(camera, &QCamera::errorOccurred, [&camera]() { if (camera->error() != QCamera::NoError) qDebug() << "ERROR: " << camera->errorString(); }); QObject::connect(m_imageCapture, &QImageCapture::errorOccurred, [](int id, const QImageCapture::Error error, const QString &errorString) { qDebug() << "ERROR: " << errorString; }); camera->start(); QObject::connect(&btn, &QPushButton::clicked, [m_imageCapture, camera]() { qDebug() << camera->isActive() << " " << m_imageCapture->isReadyForCapture(); int id = m_imageCapture->captureToFile("/storage/emulated/0/Download/f.jpeg"); }); widget.show(); return a.exec(); }
After having those QObject:connect for rrorOccured when clicking the button, so I can take a picture I get:
ERROR: "Could not capture in stopped state"
Maybe this is a valid lead ?
Could someone take a look?