Skip to content

Commit

Permalink
Merge pull request #3 from ralph950412/rice
Browse files Browse the repository at this point in the history
sm8350-common: googlebattery: Add IGoogleBattery
  • Loading branch information
fahmidislamsoum authored Aug 6, 2022
2 parents db4c472 + 30c0442 commit 12f36b6
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions sepolicy/vendor/file.te
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type sysfs_charge, sysfs_type, fs_type;
1 change: 1 addition & 0 deletions sepolicy/vendor/file_contexts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Battery
/vendor/bin/batteryd u:object_r:batteryd_exec:s0
/vendor/bin/batterysecret u:object_r:batterysecret_exec:s0
/vendor/bin/hw/vendor\.google\.google_battery@1\.0-service-vendor u:object_r:hal_googlebattery_exec:s0
/mnt/vendor/persist/subsys(/.*)? u:object_r:persist_subsys_file:s0
/sys/devices/platform/soc/soc:qcom,pmic_glink/soc:qcom,pmic_glink:qcom,ucsi/typec/port0/data_role u:object_r:vendor_sysfs_usb_supply:s0

Expand Down
2 changes: 2 additions & 0 deletions sepolicy/vendor/genfs_contexts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Battery
genfscon sysfs /class/qcom-battery u:object_r:vendor_sysfs_battery_supply:s0
genfscon sysfs /devices/platform/soc/soc:google,battery/power_supply/battery/charge_deadline u:object_r:sysfs_charge:s0
genfscon sysfs /devices/platform/soc/soc:google,battery/power_supply/battery/charge_stage u:object_r:sysfs_charge:s0

# Display
genfscon sysfs /devices/platform/soc/soc:qcom,dsi-display-primary u:object_r:vendor_sysfs_graphics:s0
Expand Down
13 changes: 13 additions & 0 deletions sepolicy/vendor/hal_googlebattery.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type hal_googlebattery, domain;
type hal_googlebattery_exec, exec_type, vendor_file_type, file_type;

init_daemon_domain(hal_googlebattery)

r_dir_file(hal_googlebattery, sysfs_batteryinfo)

allow hal_googlebattery sysfs_charge:file rw_file_perms;
allow hal_googlebattery self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl;

hwbinder_use(hal_googlebattery)
add_hwservice(hal_googlebattery, hal_googlebattery_hwservice)
get_prop(hal_googlebattery, hwservicemanager_prop)
1 change: 1 addition & 0 deletions sepolicy/vendor/hwservice.te
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type hal_googlebattery_hwservice, hwservice_manager_type;
3 changes: 3 additions & 0 deletions sepolicy/vendor/hwservice_contexts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ vendor.xiaomi.hardware.mlipay::IMlipayService u:

# Radio
vendor.qti.hardware.radio.ims::IImsRadio u:object_r:hal_telephony_hwservice:s0

# Turbo adapter
vendor.google.google_battery::IGoogleBattery u:object_r:hal_googlebattery_hwservice:s0
3 changes: 3 additions & 0 deletions sepolicy/vendor/platform_app.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# allow SystemUI to find and bind Google Battery HAL
allow platform_app hal_googlebattery_hwservice:hwservice_manager find;
binder_call(platform_app, hal_googlebattery)
3 changes: 3 additions & 0 deletions sepolicy/vendor/system_app.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# To allow Settings to find and bind Google Battery HAL
allow system_app hal_googlebattery_hwservice:hwservice_manager find;
binder_call(system_app, hal_googlebattery)
3 changes: 3 additions & 0 deletions sepolicy/vendor/turbo_adapter.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# To find and bind Google Battery HAL
allow turbo_adapter hal_googlebattery_hwservice:hwservice_manager find;
binder_call(turbo_adapter, hal_googlebattery)

0 comments on commit 12f36b6

Please sign in to comment.