Access denied finding property “camera.hal1.packagelist”

我们两清 提交于 2020-08-21 05:48:31

问题


While using camera in service mobile screen is getting un-touchable(locked by transparent window ) and only below error is occuring

Access denied finding property "camera.hal1.packagelist"

what will be the reason and its solution? Please help..


回答1:


I was working with the OpenCV tutorial code for camera app on android. I encountered the same error, and after looking at the answers I indeed missed one permission.

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Although the app doesn't save any data externally, without this permission, the access denied error occurs. Hope it helps.




回答2:


I got the same error in my app, i was using surface view and had it weight set to zero. I changed it back to 1 and the error got resolved. Do check your xml code, it may help.




回答3:


I had the same problem with the Camera 1 API on my Test device "LG V30". I found out, that this message (Access denied finding property "camera.hal1.packagelist") appeared when I opened the camera like this:

int numberOfCameras = Camera.getNumberOfCameras();
CameraInfo cameraInfo = new CameraInfo();
for (int i = 0; i < numberOfCameras; i++) {
    Camera.getCameraInfo(i, cameraInfo);
    if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
        camera = Camera.open(i);
        cameraId = i;
    }
}

Important is, that this only happened for the LG V30, which has 2 back cameras (numberOfCameras=3).

After some testing I found out, that this works for this device:

/** A safe way to get an instance of the Camera object. */
public static Camera getCameraInstance(){
    Camera c = null;
    try {
        c = Camera.open(); // attempt to get a Camera instance
    }
    catch (Exception e){
        // Camera is not available (in use or does not exist)
    }
    return c; // returns null if camera is unavailable
}

The example code above will access the first, back-facing camera on a device with more than one camera. Here you can find a detailed description.




回答4:


Please see if you asking for the Camera permission from the user. Just specifying the permission in manifest is not gonna work above a certain Android level.
This will solve your problem.

How to ask for permission follow this link.




回答5:


about Access denied finding property like error

  • less possible reason: lack related user permission
    • which
      • should added related config
        • <uses-permission android:name="android.permission.xxx"/>
      • when running app, first popup window for grant related permission, user self should Accept it
        • to give/grant the permission to app
  • most possible reason = probably:
    • cause by (previous log, you can see it logcat) the warning log:
      • type=1400 audit(xxx): avc: denied { xxx } for name=xxx dev=xxx ino=xxx scontext=xxx tcontext=xxx tclass=xxx permissive=0

how to fix avc: denied error ?

  • Simple:
    • refer offical doc Validating SELinux | Android Open Source Project try use audit2allow and related tool to fix.
  • Detailed:
    • refer my another post's anwser


来源:https://stackoverflow.com/questions/48260712/access-denied-finding-property-camera-hal1-packagelist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!