You can enable ADB by editing certain build.prop options which can be done without data access. Then, like you already mentioned, you can easily control your phone with scrcpy.
For an in-depth explanation on how to achieve this head over to this XDA Thread. It boils down to these 7 steps:
- Boot into the recovery
- With ADB, add the following lines to
# Enable ADB
# Disable authorization
- Reboot to system
- ADB should be enabled now, use scrcpy to enter your decryption secret
- Wait until the persistent storage is mounted (e.g. by checking if the directory
/data/adb/service.d/ exists) and then IMMEDIATELY push a script with the following content into the
/data/adb/service.d/ directory and make it executeable (via
adb push /path/to/script.sh /data/adb/service.d; adb shell chmod 777 /data/adb/service.d/script.sh
resetprop persist.service.adb.enable 1
resetprop persist.service.debuggable 1
resetprop persist.sys.usb.config mtp,adb
resetprop ro.adb.secure 0
resetprop ro.secure 0
resetprop ro.debuggable 1
echo "1" > /data/property/persist.service.adb.enable
echo "1" > /data/property/persist.service.debuggable
echo "mtp,adb" > /data/property/persist.sys.usb.config
- Reboot again
- Enjoy your ADB access!
Note that in order to get this to work you need to have Magisk installed. If that's not the case it should already work after step 2, if it doesn't you can try to just execute the last three lines of the script as soon as the persistent storage is mounted.