Add isZramMaintenanceSupported to IMmd
system_server needs to know whether the device supports zram
maintenance to stop calling doZramMaintenanceAsync() periodically on no
zram devices which is no-op and useless.
Since isZramMaintenanceSupported() is synchronous API, we rename
doZramMaintenance() as doZramMaintenanceAsync() to make it clear whether
API is synchronous or asynchronous.
isZramMaintenanceSupported() returns not based on system properties but
based on the zram status (i.e. zram writeback/recompression) in
ZramContext because system properties can be updated during runtime.
System properties should be examined on every doZramMaintenanceAsync()
timing. Also even if some zram feature (e.g. writeback/recompression) in
the system properties is enabled after zram setup, zram maintenance for
the feature is still no-op because enabling the feature status of zram
in kernel cannot be changed once zram starts working.
The result of isZramMaintenanceSupported() is consistent because the
status is loaded before mmd exposes the Binder API and the feature
contexts in ZramContext are not cleared or re-initialized after setup.
Bug: 375432472
Test: atest mmd_unit_tests
Change-Id: I284dada186c557be4bab260a13b68c472024f21c
2 files changed