I am going to build an AOSP 13 for a Pixel 4a device. I have embedded a few system apps related to OTA functionalities. So, the system needs to be set permissive after each boot operation. I know that the following rule works for userdebug and eng builds.
BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive
But I am going to deliver the device to a third-party user, and I need to produce a user build. However, the above-mentioned approach does not work for a user build. I know that I should either write a specific policy for this purpose or modify the system policies like allow and neverallow rules. Is there any experience, solution or tools that have already implemented this process?
Finally, I could handle the situation by hacking two functions of
selinux.cppplaced atsystem/core/initin AOSP 13 source code. According to the code demonstrated below, I just enforced selinux to setpermissivestate under any circumstances, regardless ofenforcingstatus coming from build types likeuserbuild by returningSELINUX_PERMISSIVEvalue for functionStatusFromProperty(), and returning false for functionIsEnforcing(). In these situations, selinux only sets to bepermissive.I have tested the above-mentioned code for a
userbuild on a Pixel 4a device with Android 13, and it really works!