添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
豁达的企鹅  ·  [解决]C# ...·  8 月前    · 
留胡子的黄豆  ·  react native ...·  1 年前    · 
无聊的柚子  ·  Windows ...·  1 年前    · 
小眼睛的鼠标垫  ·  gdal for java ...·  1 年前    · 

切换多用户使用Camera.open报错cannot connect from device user 0, currently allowed device users: 10

最新推荐文章于 2022-12-30 17:36:48 发布
最新推荐文章于 2022-12-30 17:36:48 发布

最近在做faceunlock与多用户交互的一些东西,我的录入入口是写在Settings中的,Settings是会随着用户的切换更换进程的持有者就像其他普通用户一样,但我的比对是写在SystemUI的keyguard中的,SystemUI去请求Camera.open的时候就会报错

CameraService: CameraService::connect X (PID 1334) rejected (cannot connect from device user 0, currently allowed device users: 10)
CameraBase: An error occurred while connecting to camera 1: Status(-8): '1: validateClientPermissionsLocked:933: Callers from device user 0 are not currently allowed to connect to camera "1"'

主要是这句

cannot connect from device user 0, currently allowed device users: 10

意思就是说此进程请求的用户是0也就是主用户,但是当前设备的用户是10也就是其他用户,换句话说就是无论怎样更换用户SystemUI始终被主用户持有,因此其他用户在SystemUI中就无法打开Camera

往底层追究此逻辑在
/frameworks/av/services/camera/libcameraservice/CameraService.cpp

 // Only allow clients who are being used by the current foreground device user, unless calling
 // from our own process.
if (callingPid != getpid() && (mAllowedUsers.find(clientUserId) == mAllowedUsers.end())) {    //在这里比对了进程的pid和持有的userId
    ALOGE("CameraService::connect X (PID %d) rejected (cannot connect from "
            "device user %d, currently allowed device users: %s)", callingPid, clientUserId,
            toString(mAllowedUsers).string());
    return STATUS_ERROR_FMT(ERROR_PERMISSION_DENIED,
            "Callers from device user %d are not currently allowed to connect to camera \"%s\"",
            clientUserId, cameraId.string());

所以我们只要将这句改成

    if (callingPid != getpid()&& clientUserId != 0 && (mAllowedUsers.find(clientUserId) == mAllowedUsers.end())) 

就可以了,加入了进程持有者也可以是主用户的条件,这样一般用户也可以在SystemUI中打开Camera了

切换多用户使用Camera.open报错cannot connect from device user 0, currently allowed device users: 10 最近在做faceunlock与多用户交互的一些东西,我的录入入口是写在Settings中的,Settings是会随着用户的切换更换进程的持有者就像其他普通用户一样,但我的比对是写在SystemUI的keyguard中的,SystemUI去请求Camera.open的时候就会报错CameraService: CameraService::connect X (PID 1334) rejected ...
The Serial Peripheral Interface Bus or SPI bus is a synchronous serial data link standard named by Motorola that operates in full duplex mode. Devices communicate in master/slave mode where the master device initiates the data frame. Multiple slave devices are allowed with individual slave select (chip select) lines. Sometimes SPI is called a "four wire" serial bus, contrasting with three, two, and one wire serial buses. 但是在客户端不可以,服务启动时报错: java.sql.SQLException: null,  message from server: “Host ‘223.72.41.7’ is not allowed to connect to this MySQL server” 客户端访问时报错: 解决方法: 1,登陆服务器 mysql> use mysql; //用mysql database 2,查询user表如下: 3,mysql> update user set host=’%’ where u
 开启手电筒后打开切换到后台,再打开 相机 就会出现此提示Connect not to Camera, 原因 断定为 像个调用同一个进程导致冲突 解决方式: 再开启相机的时候,杀掉手电筒的后台进程加入下面权限 在Camera中的Camera.java的onCreate(),onReume()方法中加入如下代码: 注意导入包: importandroid.app.Activ
在学习camera的时候,遇见了An error occured while connecting to came的问题,这个问题可能出现的原因是: 1)在mainfest里面没有添加上相应的权限,权限如下: <uses-permission android:name...
本文是对android摄像头进行一些分析。在编译的时候发现了错误,报出了w/CameraBase:An error occurred while connecting to camera:0 以及 W/System.error:java.lang.RuntimeException:Fail to connect to camera service; (1)在java端掉用的代码如下: * Notify the host application that the given permission request * has been canceled. Any related UI should therefore be hidden. * @param request the PermissionRequest that needs be canceled. public void onPermissionReq
从零开始搭建一个项目骨架,最好选择合适,熟悉的技术,并且在未来易拓展,适合微服务化体系等。所以一般以Springboot作为我们的框架基础,这是离不开的了。 然后数据层,我们常用的是Mybatis,易上手,方便维护。但是单表操作比较困难,特别是添加字段或减少字段的时候,比较繁琐,所以这里我推荐使用Mybatis Plus,(为简化开发而生,只需简单配置,即可快速进行) CRUD 操作,从而节省大量时间。 作为一个项目骨架,权限也是我们不能忽略的,Apache Shiro 是一款强大易用的 Java 安全框架
要解决这个问题,您可以按照以下步骤操作: 1. 首先,您需要登录到 MySQL 服务器,使用具有管理员权限的账户,并检查 MySQL 服务器的访问控制设置。您可以使用以下命令查看访问控制列表: SELECT * FROM mysql.user WHERE User='root'\G 注意将 "root" 替换为您想要查询的用户名。 2. 如果您发现访问控制列表中没有包含您的 IP 地址,则需要添加您的 IP 地址到访问控制列表中。您可以使用以下命令添加一个新的用户,并为该用户授予访问权限: CREATE USER 'newuser'@'172.168.0.131' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'172.168.0.131'; FLUSH PRIVILEGES; 注意将 "newuser" 替换为您想要创建的用户名,将 "172.168.0.131" 替换为您的 IP 地址,将 "password" 替换为您的密码。 3. 如果您已经添加了您的 IP 地址到访问控制列表中,但仍然无法连接 MySQL 服务器,则可能是由于 MySQL 服务器的防火墙设置阻止了您的连接。您需要检查 MySQL 服务器所在的操作系统的防火墙设置,以确保允许来自您的 IP 地址的连接。 希望这些步骤可以帮助您解决问题。