blob: 3cfb4ed925010b47da36b4533588f8f22df6c814 [file] [log] [blame]
Pierre-Hugues Hussonf1811092018-04-10 18:33:33 +02001#!/system/bin/sh
2
3set -e
4
Pierre-Hugues Husson16ea1682018-04-15 19:19:47 +02005if mount -o remount,rw /system;then
6 resize2fs $(grep ' /system ' /proc/mounts |cut -d ' ' -f 1)
7elif mount -o remount,rw /;then
8 resize2fs /dev/root
9fi
Pierre-Hugues Hussonf1811092018-04-10 18:33:33 +020010mount -o remount,ro /system
Pierre-Hugues Husson16ea1682018-04-15 19:19:47 +020011mount -o remount,ro /
Pierre-Hugues Husson520fea12018-04-24 22:36:59 +020012
13img="$(find /dev/block -type l |grep by-name |grep /kernel$(getprop ro.boot.slot_suffix) |head -n 1)"
14[ -z "$img" ] && img="$(find /dev/block -type l |grep by-name |grep /boot$(getprop ro.boot.slot_suffix) |head -n 1)"
Pierre-Hugues Husson29622ec2018-04-30 13:56:06 +020015if [ -n "$img" ];then
16 #Rewrite SPL/Android version if needed
17 Arelease="$(getSPL $img android)"
18 setprop ro.keymaster.xxx.release $Arelease
19 setprop ro.keymaster.xxx.security_patch "$(getSPL $img spl)"
Pierre-Hugues Husson520fea12018-04-24 22:36:59 +020020
Pierre-Hugues Husson29622ec2018-04-30 13:56:06 +020021 #Only Android 8.0 needs this
22 if ! echo "$Arelease" |grep -qF 8.0;then
23 exit 0
24 fi
Pierre-Hugues Husson520fea12018-04-24 22:36:59 +020025
Pierre-Hugues Husson29622ec2018-04-30 13:56:06 +020026 for f in /vendor/lib64/hw/android.hardware.keymaster@3.0-impl-qti.so /system/lib64/vndk-26/libsoftkeymasterdevice.so;do
27 [ ! -f $f ] && continue
28 b="$(basename "$f")"
29
30 mkdir -p /dev/phh/
31 cp $f /dev/phh/$b
32 sed -i -e 's/ro.build.version.release/ro.keymaster.xxx.release/g' -e 's/ro.build.version.security_patch/ro.keymaster.xxx.security_patch/g' /dev/phh/$b
33 if echo $f |grep vendor;then
34 chcon u:object_r:vendor_file:s0 /dev/phh/$b
35 else
36 chcon u:object_r:system_file:s0 /dev/phh/$b
37 fi
38 chmod 0644 /dev/phh/$b
39 mount -o bind /dev/phh/$b $f
40 done
41 setprop ctl.restart keymaster-3-0
Pierre-Hugues Husson520fea12018-04-24 22:36:59 +020042fi
43
Pierre-Hugues Husson29622ec2018-04-30 13:56:06 +020044if grep vendor.huawei.hardware.biometrics.fingerprint /vendor/manifest.xml;then
45 mount -o bind system/phh/huawei/fingerprint.kl /vendor/usr/keylayout/fingerprint.kl
46fi