AFAIK, only apps running as root (UID 0) (1) or system (UID 1000) (2) or with android.permission.MOUNT_UNMOUNT_FILESYSTEMS
(3) can do fstrim
. But third party apps can neither get UID 0
/1000
(without rooting phone), nor the said permission is for third party apps (4).
Also manually sending FITRIM ioctl
with fstrim
command requires at least capability SYS_ADMIN
(5), which is almost root if not full root.
The app you have mentioned asks for permissions CLEAR_APP_CACHE (delete all apps cache data) and KILL_BACKGROUND_PROCESSES (close other apps). So it's quite evident what it must be doing to give a feel of lag-free experience.
PS: You don't need to run fstrim
manually in most cases, OS can handle this. See this answer.