Skip to content

Commit

Permalink
common: add policy for powershare HAL
Browse files Browse the repository at this point in the history
Co-Authored-By: Anay Wadhera <[email protected]>
Co-Authored-By: Jake Weinstein <[email protected]>
Co-Authored-By: Omkar Chandorkar <[email protected]>
Signed-off-by: xenxynon <[email protected]>
  • Loading branch information
4 people authored and xenxynon committed Dec 24, 2024
1 parent 7d8320e commit 7f423ce
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 1 deletion.
3 changes: 3 additions & 0 deletions private/platform_app.te
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
binder_use(platform_app)

# Allow PowerShare HAL service to be found
hal_client_domain(platform_app, hal_p404_powershare)
3 changes: 3 additions & 0 deletions private/system_server.te
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ set_prop(system_server, device_config_tethering_prop)

# CachedAppOptimizer
allow system_server zygote_tmpfs:file rw_file_perms;

# Powershare
hal_client_domain(system_server, hal_p404_powershare)
7 changes: 7 additions & 0 deletions public/attributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# HALs
attribute hal_p404_powershare;
expandattribute hal_p404_powershare true;
attribute hal_p404_powershare_client;
expandattribute hal_p404_powershare_client true;
attribute hal_p404_powershare_server;
expandattribute hal_p404_powershare_server false;
5 changes: 4 additions & 1 deletion public/file.te
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Fastcharge
type sysfs_fastcharge, sysfs_type, fs_type;
type sysfs_fastcharge, sysfs_type, fs_type;

# PowerShare
type sysfs_powershare, sysfs_type, fs_type;
3 changes: 3 additions & 0 deletions vendor/file_contexts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Usb
/(vendor|system/vendor)/bin/hw/android\.hardware\.usb@1\.0-service\.basic u:object_r:hal_usb_default_exec:s0

# Powershare
/(vendor|system/vendor)/bin/hw/vendor\.p404\.powershare-service u:object_r:hal_p404_powershare_default_exec:s0
6 changes: 6 additions & 0 deletions vendor/hal_aospa_powershare.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# HWBinder IPC from client to server
binder_call(hal_p404_powershare_client, hal_p404_powershare_server)
hal_attribute_service(hal_p404_powershare, hal_p404_powershare_service)
binder_call(hal_p404_powershare_server, servicemanager)
# Allow binder communication with platform_app
binder_call(hal_p404_powershare, platform_app)
7 changes: 7 additions & 0 deletions vendor/hal_p404_powershare_default.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type hal_p404_powershare_default, domain;
binder_use(hal_p404_powershare_default);
hal_server_domain(hal_p404_powershare_default, hal_p404_powershare)
type hal_p404_powershare_default_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(hal_p404_powershare_default)
# Allow PowerShare HAL to write to PowerShare sysfs node
allow hal_p404_powershare_default sysfs_powershare:file rw_file_perms;
1 change: 1 addition & 0 deletions vendor/service.te
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type hal_p404_powershare_service, service_manager_type, vendor_service;
1 change: 1 addition & 0 deletions vendor/service_contexts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vendor.p404.powershare.IPowerShare/default u:object_r:hal_p404_powershare_service:s0

0 comments on commit 7f423ce

Please sign in to comment.