安卓多用户去除数量限制解决办法

多用户用来干嘛,反正我不管,有限制5个8个的,都觉得难受,我有用就对了。

多用户模式的启用

系统判断当前设备是否支持多用户模式的依据是配置文件config.xml中的config_multiuserMaximumUsers配置项。 其取值为整型,决定着当前设备支持的最大用户上限。默认值为1,即不支持多用户。如需启用多用户,则设置此值 为大于1的值。

具体代码的判断位置在UserManager.java:

 public static int getMaxSupportedUsers() {  
        // Don't allow multiple users on certain builds  
        if (android.os.Build.ID.startsWith("JVP")) return 1;  
        return SystemProperties.getInt("fw.max_users",  
                Resources.getSystem().getInteger(R.integer.config_multiuserMaximumUsers));  
    } 

从代码看,他会读取system/build.prop或者default.prop中的fw.max_users这个参数

我们root这个系统,用root explorer工具来修改,如果没有此项,添加即可。

或者修改boot.img文件

比如100个上限

fw.max_users=100

有些系统你改不了,那就usb调试模式,临时打开上限,创好用户以后就行。

adb shell setprop fw.max_users 100
adb shell setprop fw.show_multiuserui 1
adb shell pm get-max-users
adb shell pm create-user test1
adb shell pm create-user test2
adb shell pm create-user test3
adb shell pm create-user test4
adb shell pm create-user test5
adb shell pm create-user test6
adb shell pm create-user test7
adb shell pm create-user test8
adb shell pm create-user test9
adb shell pm create-user test10
adb shell pm list users

创建了test1到test10个用户,如果要删除用户那么

根据list users出来的用户名前面的id数字编号,执行下面命令

adb shell pm remove-user 14

同样,给指定用户安装应用

adb install --user 14 pathto/app.venski.apk

给所有创建的用户安装

adb install --user all pathto/app.venski.apk

参考资料

http://blog.sina.com.cn/s/blog_6100a4f10101hdjn.html

https://zhidao.baidu.com/question/617767010436330212.html

https://android.stackexchange.com/questions/165223/how-configure-more-than-5-multi-users

还有这个另类的做法也可以

https://sensepost.com/blog/2020/multiple-android-user-profiles/

点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注