Bluetooth sepolicy patch
I have created a flashable zip that fixes the sepolicy for the bluetooth loader instead of having to disable selinux and use permissive mode. This is a much better option than disabling selinux. After installing latest CM12.1 ROM and the bluetooth sepolicy patch, I rebooted to the system and I removed my bluetooth devices to pair them again. After pairing my bluetooth devices with the sepolicy patch applied, everything was fixed and I could restart the service and all the bluetooth devices still reconnect.
Requirement: This is only for bumped ROMS and kernels.
Note: There is no more need to use permissive mode to fix bluetooth. This bluetooth sepolicy patch needs to be reinstalled after flashing a new rom or kernel.
Instructions:
1) Flash Bumped ROM (and bumped custom kernel optionally)
2) Flash Bluetooth sepolicy patch
3) Reboot to system
v500-bluetooth-sepolicy-signed.zip
Code:
#!/sbin/sh
+
+cd /tmp
+mkdir ramdisk
+cd ramdisk
+gunzip -c ../boot.img-ramdisk.gz | cpio -i
+sed -i '/seclabel u:r:bluetooth_loader:s0/d' init.awifi.rc
+find . | cpio -o -H newc | gzip > ../boot.img-ramdisk-new.gz
+cd ..
+
echo \#!/sbin/sh > /tmp/createnewboot.sh
-echo /tmp/mkbootimg --kernel /tmp/boot.img-zImage --ramdisk /tmp/boot.img-ramdisk.gz --cmdline \"$(cat /tmp/boot.img-cmdline) androidboot.selinux=permissive selinux=0\" --base 0x$(cat /tmp/boot.img-base) --pagesize 2048 --ramdiskaddr 0x82200000 --output /tmp/newboot.img >> /tmp/createnewboot.sh
+echo /tmp/mkbootimg --kernel /tmp/boot.img-zImage --ramdisk /tmp/boot.img-ramdisk-new.gz --cmdline \"$(cat /tmp/boot.img-cmdline)\" --base 0x$(cat /tmp/boot.img-base) --pagesize 2048 --ramdiskaddr 0x82200000 --output /tmp/newboot.img >> /tmp/createnewboot.sh
chmod 777 /tmp/createnewboot.sh
/tmp/createnewboot.sh
return $?
Thanks
@jsevi83 for providing sepolicy patches. That was a big help.