Fix adbd on devices with integrity check

Some devices (Like Samsung Galaxy J6) has integrity check.
This means that all files outside of /system are signed by the OEM.
Since we replaced /sbin/adbd, that's an issue.
Workaround this by creating a new service, called adbd_system, which
will called instead of /sbin/adbd when needed
This commit is contained in:
Pierre-Hugues Husson 2018-12-03 21:16:52 +01:00
parent c2b6687a5a
commit 82aeb3d402
4 changed files with 20 additions and 1 deletions

View File

@ -101,3 +101,6 @@ SELINUX_IGNORE_NEVERALLOWS := true
# Universal NoCutoutOverlay # Universal NoCutoutOverlay
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
NoCutoutOverlay NoCutoutOverlay
PRODUCT_COPY_FILES += \
device/phh/treble/files/adbd.rc:system/etc/init/adbd.rc

8
files/adbd.rc Normal file
View File

@ -0,0 +1,8 @@
service adbd_system /system/bin/adbd --root_seclabel=u:r:su:s0
class core
socket adbd stream 660 system system
disabled
seclabel u:r:adbd:s0
on property:sys.usb.state=adb && property:sys.phh.five=true
start adbd_system

View File

@ -19,3 +19,6 @@ allow vndk_detect self:capability { sys_admin };
#mount -o bind /system/etc/usb_audio_policy_configuration.xml /vendor/etc/usb_audio_policy_configuration.xml #mount -o bind /system/etc/usb_audio_policy_configuration.xml /vendor/etc/usb_audio_policy_configuration.xml
allow init vendor_configs_file:file { getattr mounton }; allow init vendor_configs_file:file { getattr mounton };
#/sys/module/five
allow vndk_detect sysfs:file r_file_perms;
allow vndk_detect sysfs:dir r_dir_perms;

View File

@ -9,7 +9,12 @@ while read version;do
setprop persist.sys.vndk $version setprop persist.sys.vndk $version
done done
mount -o bind /system/bin/adbd /sbin/adbd if [ -d /sys/module/five ];then
mount -o bind /system/phh/empty /sbin/adbd
setprop sys.phh.five true
else
mount -o bind /system/bin/adbd /sbin/adbd
fi
if ( getprop ro.hardware | grep -qE '(kirin970|hi3660|hi6250|hi3670)' );then if ( getprop ro.hardware | grep -qE '(kirin970|hi3660|hi6250|hi3670)' );then
FOUND_HUAWEI=1 FOUND_HUAWEI=1
setprop persist.sys.bt_acl_bypass true setprop persist.sys.bt_acl_bypass true