utils: bdaddr: Add service to set Bluetooth device (MAC) address

The Bluetooth chip does not come with a unique Bluetooth device (MAC)
address configured out of the box. This means that we manually need
to configure the device address.

Otherwise BT will stop working from v6.5 kernel version onwards.
Reference: https://bugs.linaro.org/show_bug.cgi?id=5998

Link: https://github.com/me176c-dev/android_device_asus_K013/commit/cbb7066
[AmitP: Kanged the service from above link, updated the commit
        message, built an rc and shell script around this service,
        and added SELinux policies.]
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Change-Id: I79a364917e0a4d879e4319b45b4c0f7cc7df83d3
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index c7eb6db..a74f361 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -61,6 +61,7 @@
 /vendor/bin/rmtfs									u:object_r:rmtfs_exec:s0
 /vendor/bin/tqftpserv									u:object_r:tqftpserv_exec:s0
 /vendor/bin/suspend_blocker								u:object_r:suspend_blocker_exec:s0
+/vendor/bin/set_bdaddr\.sh								u:object_r:set_bdaddr_exec:s0
 /vendor/bin/set_hw\.sh									u:object_r:set_hw_exec:s0
 /vendor/bin/set_udc\.sh									u:object_r:set_udc_exec:s0
 
diff --git a/sepolicy/set_bdaddr.te b/sepolicy/set_bdaddr.te
new file mode 100644
index 0000000..e81d6ab
--- /dev/null
+++ b/sepolicy/set_bdaddr.te
@@ -0,0 +1,11 @@
+type set_bdaddr, domain;
+type set_bdaddr_exec, exec_type, vendor_file_type, file_type;
+init_daemon_domain(set_bdaddr);
+
+# audit2allow
+allow set_bdaddr proc_cmdline:file { open read };
+allow set_bdaddr rootfs:dir { open read };
+allow set_bdaddr self:bluetooth_socket { bind create read write };
+allow set_bdaddr self:capability net_admin;
+allow set_bdaddr vendor_file:file execute_no_trans;
+allow set_bdaddr vendor_toolbox_exec:file execute_no_trans;