Skip to content
Snippets Groups Projects
Commit 168435fe authored by Alex Klyubin's avatar Alex Klyubin
Browse files

Switch Bluetooth HAL policy to _client/_server

This switches Bluetooth HAL policy to the design which enables us to
conditionally remove unnecessary rules from domains which are clients
of Bluetooth HAL.

Domains which are clients of Bluetooth HAL, such as bluetooth domain,
are granted rules targeting hal_bluetooth only when the Bluetooth HAL
runs in passthrough mode (i.e., inside the client's process). When the
HAL runs in binderized mode (i.e., in another process/domain, with
clients talking to the HAL over HwBinder IPC), rules targeting
hal_bluetooth are not granted to client domains.

Domains which offer a binderized implementation of Bluetooth HAL, such
as hal_bluetooth_default domain, are always granted rules targeting
hal_bluetooth.

Test: Toggle Bluetooth off and on
Test: Pair with another Android, and transfer a file to that Android
      over Bluetooth
Test: Pair with a Bluetooth speaker, play music through that
      speaker over Bluetooth
Test: Add bluetooth_hidl_hal_test to device.mk, build & add to device,
      adb shell stop,
      adb shell /data/nativetest64/bluetooth_hidl_hal_test/bluetooth_hidl_hal_test
Bug: 34170079
Change-Id: I05c3ccf1e98cbbc1450a81bb1000c4fb75eb8a83
parent 3a8426bf
No related branches found
No related tags found
No related merge requests found
......@@ -22,14 +22,6 @@ allow bluetooth bluetooth_logs_data_file:file create_file_perms;
# Socket creation under /data/misc/bluedroid.
allow bluetooth bluetooth_socket:sock_file create_file_perms;
# bluetooth factory file accesses.
r_dir_file(bluetooth, bluetooth_efs_file)
allow bluetooth { uhid_device hci_attach_dev }:chr_file rw_file_perms;
# sysfs access.
r_dir_file(bluetooth, sysfs_type)
allow bluetooth sysfs_bluetooth_writable:file rw_file_perms;
allow bluetooth self:capability net_admin;
allow bluetooth self:capability2 wake_alarm;
......@@ -64,9 +56,7 @@ unix_socket_connect(bluetooth, sap_uim, rild)
# /data/data/com.android.shell/files/bugreports/bugreport-*.
allow bluetooth shell_data_file:file read;
# Perform HwBinder IPC.
hwbinder_use(bluetooth)
binder_call(bluetooth, hal_bluetooth)
hal_client_domain(bluetooth, hal_bluetooth)
binder_call(bluetooth, hal_telephony)
read_runtime_log_tags(bluetooth)
......
type hal_bluetooth_default, domain;
hal_impl_domain(hal_bluetooth_default, hal_bluetooth)
hal_server_domain(hal_bluetooth_default, hal_bluetooth)
type hal_bluetooth_default_exec, exec_type, file_type;
init_daemon_domain(hal_bluetooth_default)
......
......@@ -181,7 +181,6 @@ binder_service(system_server)
# Perform HwBinder IPC.
hwbinder_use(system_server)
hwallocator_use(system_server)
binder_call(system_server, hal_bluetooth)
binder_call(system_server, hal_boot)
binder_call(system_server, hal_contexthub)
binder_call(system_server, hal_fingerprint)
......
......@@ -127,6 +127,8 @@ attribute hal_audio;
attribute hal_audio_client;
attribute hal_audio_server;
attribute hal_bluetooth;
attribute hal_bluetooth_client;
attribute hal_bluetooth_server;
attribute hal_camera;
attribute hal_camera_client;
attribute hal_camera_server;
......
r_dir_file(hal_bluetooth, system_file)
# call into the Bluetooth process (callbacks)
binder_call(hal_bluetooth, bluetooth)
# HwBinder IPC from clients into server, and callbacks
binder_call(hal_bluetooth_client, hal_bluetooth_server)
binder_call(hal_bluetooth_server, hal_bluetooth_client)
wakelock_use(hal_bluetooth);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment