mirror of
https://github.com/Evolution-X-Devices/device_google_wahoo
synced 2026-01-27 17:09:46 +00:00
wahoo: Stop retry fingerprint init proecess after limited times
Add new mechanism for stopping FP HIDL after several times init fail. This prevents the case of FP HIDL keeping trying to do init process and raising CPU usage when sensor totally dead. After limited times init retry fail (default 10 times), FP HIDL will be stopped. init-fingerprint-sh is for stopping fps_hal after init retry fail serval times. It keeps running until max init retry or fps_hal running successfully. vendor.fps_hal restarts until max init retry times fail. Test: build pass and FP functionaily are good. Test: init process will be stopped after limited times retry fail Bug: 111710758 Change-Id: I8a19bdd351e5d712f8e23c6a0849acb1771e61e5 Signed-off-by: emilchung <emilchung@google.com>
This commit is contained in:
@@ -562,6 +562,8 @@ PRODUCT_COPY_FILES += \
|
||||
# Fingerprint HIDL implementation
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.biometrics.fingerprint@2.1-service.fpc
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(LOCAL_PATH)/init.fingerprint.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.fingerprint.sh \
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml
|
||||
|
||||
48
init.fingerprint.sh
Executable file
48
init.fingerprint.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/vendor/bin/sh
|
||||
# /vendor/bin/init.fingerprint.sh [max_init_retry_times]
|
||||
|
||||
# fps_hal service prop
|
||||
fps_svc_prop='init.svc.vendor.fps_hal'
|
||||
# fps_hal service name
|
||||
fps_svc_name='vendor.fps_hal'
|
||||
# fps_hal service init retry count
|
||||
init_retry_count_prop='vendor.fps.init_retry.count'
|
||||
# fps_hal service init succeed
|
||||
init_succeed_prop='vendor.fps.init.succeed'
|
||||
# Define maximum init retry times as default 10
|
||||
max_times=10
|
||||
|
||||
# Deal with the input parameter
|
||||
if [ "$#" -ge 1 ]; then
|
||||
# Check is it positive number or not
|
||||
# If so, then set maximum times as $1
|
||||
# If not, $max_times keeps in default value
|
||||
if [ "$1" -eq "$1" ] && [ "$1" -gt 0 ]; then
|
||||
max_times=$1
|
||||
echo $max_times
|
||||
fi
|
||||
fi
|
||||
|
||||
# fps_hal service init retry count
|
||||
init_retry_count=0
|
||||
|
||||
while [ "$init_retry_count" -le "$max_times" ]
|
||||
do
|
||||
# debouncing time for init processing
|
||||
sleep 5
|
||||
# Get fps_hal service state and count init retry times
|
||||
fps_svc_state=$(getprop $fps_svc_prop)
|
||||
if [ "$fps_svc_state" == "stopped" ]; then
|
||||
if [ "$init_retry_count" -lt "$max_times" ]; then
|
||||
init_retry_count=$((init_retry_count+1))
|
||||
setprop $init_retry_count_prop $init_retry_count
|
||||
setprop $init_succeed_prop false
|
||||
start $fps_svc_name
|
||||
else
|
||||
break;
|
||||
fi
|
||||
elif [ "$fps_svc_state" == "running" ]; then
|
||||
setprop $init_succeed_prop true
|
||||
break
|
||||
fi
|
||||
done
|
||||
@@ -879,3 +879,20 @@ on property:init.svc.bugreport=running
|
||||
|
||||
on property:init.svc.bugreport=stopped
|
||||
write /d/tracing/instances/pixel-trace/tracing_on 1
|
||||
|
||||
# init-fingerprint-sh is for stopping fps_hal after init retry fail serval times
|
||||
# It keeps running until max init retry or fps_hal running successfully
|
||||
# vendor.fps_hal restarts until max init retry times
|
||||
#
|
||||
# /vendor/bin/init.fingerprint.sh [max_init_retry_times]
|
||||
service init-fingerprint-sh /vendor/bin/init.fingerprint.sh 10
|
||||
group root
|
||||
user root
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
on property:sys.boot_completed=1
|
||||
start init-fingerprint-sh
|
||||
|
||||
on property:vendor.fps.init.succeed=true && property:init.svc.vendor.fps_hal=stopped
|
||||
start init-fingerprint-sh
|
||||
|
||||
1
sepolicy/vendor/file_contexts
vendored
1
sepolicy/vendor/file_contexts
vendored
@@ -181,6 +181,7 @@
|
||||
/vendor/bin/init\.radio\.sh u:object_r:init_radio_exec:s0
|
||||
/vendor/bin/ramoops u:object_r:ramoops_exec:s0
|
||||
/vendor/bin/init\.ramoops\.sh u:object_r:ramoops_exec:s0
|
||||
/vendor/bin/init\.fingerprint\.sh u:object_r:init-fingerprint_exec:s0
|
||||
|
||||
/vendor/bin/hw/android\.hardware\.bluetooth@1\.0-service-qti u:object_r:hal_bluetooth_default_exec:s0
|
||||
/vendor/bin/hw/android\.hardware\.drm@1\.1-service\.widevine u:object_r:hal_drm_widevine_exec:s0
|
||||
|
||||
10
sepolicy/vendor/init-fingerprint.te
vendored
Normal file
10
sepolicy/vendor/init-fingerprint.te
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
type init-fingerprint, domain;
|
||||
type init-fingerprint_exec, exec_type, vendor_file_type, file_type;
|
||||
|
||||
init_daemon_domain(init-fingerprint)
|
||||
|
||||
allow init-fingerprint vendor_shell_exec:file rx_file_perms;
|
||||
allow init-fingerprint vendor_toolbox_exec:file rx_file_perms;
|
||||
|
||||
set_prop(init-fingerprint, vendor_fingerprint_prop)
|
||||
set_prop(init-fingerprint, ctl_start_prop)
|
||||
3
sepolicy/vendor/property.te
vendored
3
sepolicy/vendor/property.te
vendored
@@ -25,3 +25,6 @@ type vendor_usb_config_prop, property_type;
|
||||
type vendor_charge_prop, property_type;
|
||||
type persist_nfc_prop, property_type;
|
||||
type vendor_ramoops_prop, property_type;
|
||||
|
||||
# fingerprint
|
||||
type vendor_fingerprint_prop, property_type;
|
||||
|
||||
4
sepolicy/vendor/property_contexts
vendored
4
sepolicy/vendor/property_contexts
vendored
@@ -212,3 +212,7 @@ persist.nfc. u:object_r:persist_nfc_prop:s0
|
||||
|
||||
# ramoops
|
||||
vendor.ramoops. u:object_r:vendor_ramoops_prop:s0
|
||||
|
||||
# fingerprint
|
||||
vendor.fps.init.succeed u:object_r:vendor_fingerprint_prop:s0
|
||||
vendor.fps.init_retry.count u:object_r:vendor_fingerprint_prop:s0
|
||||
|
||||
Reference in New Issue
Block a user