1service mmd /system/bin/mmd 2 class core 3 user mmd 4 group mmd system 5 critical 6 # For calling swapon syscall 7 capabilities SYS_ADMIN 8 disabled 9 10on boot 11 chown root mmd /sys/block/zram0/recompress 12 chmod 0220 /sys/block/zram0/recompress 13 chown root mmd /sys/block/zram0/writeback_limit 14 chmod 0664 /sys/block/zram0/writeback_limit 15 16 # /sys/block/zram0/idle and /sys/block/zram0/writeback are used by the 17 # system server managing zram writeback if mmd is disabled. This is 18 # duplicated as /system/core/rootdir/init.rc. But updating the same 19 # permission is safe to do. 20 chown root system /sys/block/zram0/idle 21 chmod 0220 /sys/block/zram0/idle 22 chown root system /sys/block/zram0/writeback 23 chmod 0220 /sys/block/zram0/writeback 24 25on property:sys.boot_completed=1 26 # Copy AConfig flag value to "mmd.enabled_aconfig" system property because 27 # AConfig flag does not support init "on property" trigger. 28 # mmd service starts only if AConfig flag is enabled when boot_completed. 29 # Copying the value on boot_completed once is enough because AConfig is 30 # static during a device lifetime. 31 exec /system/bin/mmd --set-property 32 33on property:mmd.enabled_aconfig=true 34 # Enable mmd daemon if the system property copied from AConfig flag by 35 # "/system/bin/mmd --set-property" is enabled. 36 37 # Zram setup requires permissions to the /dev/loop-control device and 38 # other zram sysfs files. Doing the setup as root to avoid granting mmd 39 # too many permissions for one time setup. 40 # This will be a no-op if mmd zram setup is disabled via system properties. 41 exec u:r:su:s0 root -- /system/bin/mmd --setup-zram 42 43 # Start mmd service after zram is set up. 44 enable mmd 45