首先需在system.prop中添加
persist.sys.camera_switch=1
之后需要make后才会在out下面的build.prop中生效,然后重新烧机器,或者调试的时候将build.prop导出来,手动添加,然后再push进去替换,adb shell chmod -R 644 system/build.prop 每次push一次之后,需要运行此命令 否则会开机开不了
然后代码中调用为
import android.os.SystemProperties;
SystemProperties.set("persist.sys.camera_switch","1"); 字符不能超过31个,否则会报错String getState=SystemProperties.get("persist.sys.camera_switch");