This is based on an excellent Stack Exchange answer by REJH (go there and give him an upvote).
It seems like this will crash apps if used on Android 10. See issue #2 for discussion.
- Download an app that can copy a file to system directories. I used Root Browser Classic.
- Download disable-direct-share.xml.
- Enable root access for Apps in your device's Developer options.
- Use the app to copy the file to
/data/system/ifw/
.
- Turn on "Android debugging" in your device's Developer options.
- Enable root access for ADB.
- Make sure your device is visible when running
adb devices
. - Launch adb with root privileges:
adb root
- Download
disable-direct-share.xml
:wget https://raw.githubusercontent.com/stefansundin/android-disable-direct-share/master/disable-direct-share.xml
- Install:
adb push disable-direct-share.xml /data/system/ifw/
Uninstall with:
$ adb shell ls /data/system/ifw/
disable-direct-share.xml
$ adb shell rm /data/system/ifw/disable-direct-share.xml
- Download disable-direct-share-v1.zip.
- Download disable-direct-share-v1-uninstall.zip so that you can easily uninstall it at a later time.
- Reboot into TWRP and flash the zip file. Do not use zip signature verification.
See this repository: https://github.com/AndroPlus-org/magisk-module-direct-share-disabler