2018-04-10 16:33:33 +00:00
#!/system/bin/sh
set -e
2018-05-14 11:34:52 +00:00
fixSPL( ) {
2018-05-19 14:54:30 +00:00
if [ " $( getprop ro.product.cpu.abi) " = = "armeabi-v7a" ] ; then
setprop ro.keymaster.mod 'AOSP on ARM32'
else
setprop ro.keymaster.mod 'AOSP on ARM64'
fi
2018-05-14 11:34:52 +00:00
img = " $( find /dev/block -type l | grep by-name | grep /kernel$( getprop ro.boot.slot_suffix) | head -n 1) "
[ -z " $img " ] && img = " $( find /dev/block -type l | grep by-name | grep /boot$( getprop ro.boot.slot_suffix) | head -n 1) "
if [ -n " $img " ] ; then
#Rewrite SPL/Android version if needed
Arelease = " $( getSPL $img android) "
2018-05-19 14:54:30 +00:00
setprop ro.keymaster.xxx.release " $Arelease "
2018-05-14 11:34:52 +00:00
setprop ro.keymaster.xxx.security_patch " $( getSPL $img spl) "
2018-05-26 09:26:33 +00:00
for f in /vendor/lib64/hw/android.hardware.keymaster@3.0-impl-qti.so /system/lib64/vndk-26/libsoftkeymasterdevice.so /vendor/bin/teed /system/lib64/vndk/libsoftkeymasterdevice.so /system/lib/vndk/libsoftkeymasterdevice.so; do
2018-05-14 11:34:52 +00:00
[ ! -f $f ] && continue
2018-05-19 14:54:30 +00:00
ctxt = " $( ls -lZ $f | grep -oE 'u:object_r:[^:]*:s0' ) "
2018-05-26 09:26:33 +00:00
b = " $( echo " $f " | tr / _) "
2018-05-14 11:34:52 +00:00
2018-05-19 14:54:30 +00:00
mkdir -p /mnt/phh/
cp -a $f /mnt/phh/$b
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' \
-e 's/ro.product.model/ro.keymaster.mod/g' \
/mnt/phh/$b
chcon " $ctxt " /mnt/phh/$b
mount -o bind /mnt/phh/$b $f
2018-05-14 11:34:52 +00:00
done
2018-05-19 16:43:25 +00:00
if [ " $( getprop init.svc.keymaster-3-0) " = = "running" ] ; then
setprop ctl.restart keymaster-3-0
fi
if [ " $( getprop init.svc.teed) " = = "running" ] ; then
setprop ctl.restart teed
fi
2018-05-14 11:34:52 +00:00
fi
}
2018-04-24 20:36:59 +00:00
if mount -o remount,rw /system; then
2018-05-19 20:07:12 +00:00
resize2fs $( grep ' /system ' /proc/mounts | cut -d ' ' -f 1) || true
2018-04-24 20:36:59 +00:00
elif mount -o remount,rw /; then
2018-05-19 20:07:12 +00:00
resize2fs /dev/root || true
2018-04-10 16:33:33 +00:00
fi
2018-05-19 20:07:12 +00:00
mount -o remount,ro /system || true
mount -o remount,ro / || true
2018-04-10 16:33:33 +00:00
2018-05-14 11:34:52 +00:00
fixSPL
2018-04-24 20:36:59 +00:00
2018-04-30 11:56:06 +00:00
if grep vendor.huawei.hardware.biometrics.fingerprint /vendor/manifest.xml; then
mount -o bind system/phh/huawei/fingerprint.kl /vendor/usr/keylayout/fingerprint.kl
fi
2018-05-14 11:34:52 +00:00
2018-05-18 13:09:30 +00:00
if ! grep android.hardware.biometrics.fingerprint /vendor/manifest.xml; then
mount -o bind system/phh/empty /system/etc/permissions/android.hardware.fingerprint.xml
fi
2018-05-19 11:40:50 +00:00
if ! grep android.hardware.ir /vendor/manifest.xml; then
mount -o bind system/phh/empty /system/etc/permissions/android.hardware.consumerir.xml
fi