mirror of
https://github.com/Evolution-X-Devices/device_google_wahoo
synced 2026-01-27 18:19:03 +00:00
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>
49 lines
1.3 KiB
Bash
Executable File
49 lines
1.3 KiB
Bash
Executable File
#!/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
|