First need to be added in system.prop
persist.sys.camera_switch=1
After that, it will take effect in the build.prop under out after make, or export the build.prop when debugging, add it manually, and then push in to replace it, adb shell chmod -R 644 system/build.prop push every time After one time, you need to run this command, otherwise it will not be able to boot
Then the code is called as
import android.os.SystemProperties;
SystemProperties.set("persist.sys.camera_switch","1"); The characters cannot exceed 31, otherwise an error will be reportedString getState=SystemProperties.get("persist.sys.camera_switch");