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
tree: acb57e3b6d23e8e92023db6dbdd210bc6624c66a
  1. aidl/
  2. src/
  3. .gitignore
  4. Android.bp
  5. flags.aconfig
  6. mmd.rc
  7. OWNERS
  8. PREUPLOAD.cfg
  9. README.md
  10. rustfmt.toml
  11. TEST_MAPPING
README.md

mmd

TBD

Apply rustfmt

Before upload your changes, please apply rustfmt.

rustfmt +nightly **/*.rs