1#!/vendor/bin/sh 2# /vendor/bin/init.fingerprint.sh [max_init_retry_times] 3 4# fps_hal service prop 5fps_svc_prop='init.svc.vendor.fps_hal' 6# fps_hal service name 7fps_svc_name='vendor.fps_hal' 8# fps_hal service init retry count 9init_retry_count_prop='vendor.fps.init_retry.count' 10# fps_hal service init succeed 11init_succeed_prop='vendor.fps.init.succeed' 12# Define maximum init retry times as default 10 13max_times=10 14 15# Deal with the input parameter 16if [ "$#" -ge 1 ]; then 17 # Check is it positive number or not 18 # If so, then set maximum times as $1 19 # If not, $max_times keeps in default value 20 if [ "$1" -eq "$1" ] && [ "$1" -gt 0 ]; then 21 max_times=$1 22 echo $max_times 23 fi 24fi 25 26# fps_hal service init retry count 27init_retry_count=0 28 29while [ "$init_retry_count" -le "$max_times" ] 30do 31 # debouncing time for init processing 32 sleep 5 33 # Get fps_hal service state and count init retry times 34 fps_svc_state=$(getprop $fps_svc_prop) 35 if [ "$fps_svc_state" == "stopped" ]; then 36 if [ "$init_retry_count" -lt "$max_times" ]; then 37 init_retry_count=$((init_retry_count+1)) 38 setprop $init_retry_count_prop $init_retry_count 39 setprop $init_succeed_prop false 40 start $fps_svc_name 41 else 42 break; 43 fi 44 elif [ "$fps_svc_state" == "running" ]; then 45 setprop $init_succeed_prop true 46 break 47 fi 48done 49