Refactor zram compression algorithm setup logic
Setting up zram compression algorithm is indepdendent of zram setup
itself. We should use different function to setup zram compression
algorithm rather than adding optional parameter to activate_zram() to
keep activate_zram() simple.
This revert src/zram/setup.rs and src/zram/setup/tests.rs of
aosp/3391107 and make setup_zram() use
`SysfsZramApiImpl::write_comp_algorithm()` directly.
By separating the logic, users of libmmd can be flexible to handle the
error of writing comp_algorithm (whether fallback to default algorithm
or giving up using zram). It is possible with the previous
implementation by checking ZramActivationError::SetCompAlgorithm, but it
is complex.
This refactoring ends up removing the unit tests for comp_algorithm. It
is fine because `SysfsZramApiImpl::write_comp_algorithm()` is thin
enough to skip unit testing. The test should be done by integration
testing rather than unit testing. The integration test is skipped in
the first version of mmd, but will be added later.
Bug: 375432644
Test: atest libmmd_unit_tests
Change-Id: I5df7751c3c10ad497790497bbacc7263b343c61e
3 files changed