Hung Nguyen | 5537295 | 2024-11-09 22:47:22 -0800 | [diff] [blame] | 1 | service mmd /system/bin/mmd |
| 2 | class core |
| 3 | user mmd |
| 4 | group mmd system |
| 5 | critical |
| 6 | # For calling swapon syscall |
Shintaro Kawamura | 6e0e72d | 2024-11-21 15:11:58 +0900 | [diff] [blame] | 7 | capabilities SYS_ADMIN |
Shintaro Kawamura | 5972aae | 2024-11-21 22:45:04 +0900 | [diff] [blame] | 8 | disabled |
Shintaro Kawamura | 6e0e72d | 2024-11-21 15:11:58 +0900 | [diff] [blame] | 9 | |
| 10 | on boot |
Hung Nguyen | 58d5cc0 | 2024-11-18 11:11:43 -0800 | [diff] [blame^] | 11 | # Allow mmd to run mkswap on zram device |
| 12 | chown root mmd /dev/block/zram0 |
| 13 | chmod 0664 /dev/block/zram0 |
| 14 | # Allow mmd to update zram disk size |
| 15 | chown root mmd /sys/block/zram0/disksize |
| 16 | chmod 0664 /sys/block/zram0/disksize |
| 17 | |
Shintaro Kawamura | 6e0e72d | 2024-11-21 15:11:58 +0900 | [diff] [blame] | 18 | chown root mmd /sys/block/zram0/recompress |
| 19 | chmod 0220 /sys/block/zram0/recompress |
| 20 | chown root mmd /sys/block/zram0/writeback_limit |
| 21 | chmod 0664 /sys/block/zram0/writeback_limit |
| 22 | |
| 23 | # /sys/block/zram0/idle and /sys/block/zram0/writeback are used by the |
| 24 | # system server managing zram writeback if mmd is disabled. This is |
| 25 | # duplicated as /system/core/rootdir/init.rc. But updating the same |
| 26 | # permission is safe to do. |
| 27 | chown root system /sys/block/zram0/idle |
| 28 | chmod 0220 /sys/block/zram0/idle |
| 29 | chown root system /sys/block/zram0/writeback |
| 30 | chmod 0220 /sys/block/zram0/writeback |
Shintaro Kawamura | 5972aae | 2024-11-21 22:45:04 +0900 | [diff] [blame] | 31 | |
| 32 | on property:sys.boot_completed=1 |
| 33 | # Copy AConfig flag value to "mmd.enabled_aconfig" system property because |
| 34 | # AConfig flag does not support init "on property" trigger. |
| 35 | # mmd service starts only if AConfig flag is enabled when boot_completed. |
| 36 | # Copying the value on boot_completed once is enough because AConfig is |
| 37 | # static during a device lifetime. |
| 38 | exec /system/bin/mmd --set-property |
| 39 | |
| 40 | on property:mmd.enabled_aconfig=true |
| 41 | # Enable mmd daemon if the system property copied from AConfig flag by |
| 42 | # "/system/bin/mmd --set-property" is enabled. |
| 43 | enable mmd |