你只活一次 要悦己
脚本配置
- Android_source/device/sprd/***/test/test_chmod.rc
service test_chmod /vendor/bin/test_chmod.shuser rootdisabledoneshoton property:sys.test_chmod=truestart test_chmod
- Android_source/device/sprd/***/test/test_chmod.sh
#!/system/bin/shchmod -R 0777 /storage/emulated/0/Android/data/com.***.***/
- Android_source/device/sprd///BoardConfig.mk
# add chmod config
PRODUCT_COPY_FILES += device/sprd/***/test/test_chmod.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/test_chmod.rc
PRODUCT_COPY_FILES += device/sprd/***/test/test_chmod.sh:$(TARGET_COPY_OUT_VENDOR)/bin/test_chmod.sh
SE策略
- Android_source/vendor/***/sepolicy/file_contexts
# add chmod config/vendor/bin/test_chmod.sh u:object_r:test_exec:s0
- Android_source/vendor/***/sepolicy/test.te
# audioserver - audio services daemontype test, domain;tyep test_exec, exec_type, file_type, vendor_file_type;init_daemon_domain(test)
- Android_source/vendor/***/sepolicy/init.te
allow init test:process sigkill;allow init test:process { getpgid sigkill signal setpgid };
代码调用
SystemProperties.set("sys.test_chmod","true");//执行权限顺序,根据实际情况添加延迟//SystemClock.sleep(2000);