Sync encryptedstorage after payload execution
Microdroid manager will syncfs the encryptedstore's filesystem post
payload is finished.
This patch also include refactoring of TestService to include quit()
method so that the service can be gracefully shutdown triggering the
sync above^.
Test: atest MicrodroidTests#encryptedStorageIsPersistent
Bug: 264520098
Change-Id: I1c196fda1fb0818c30cc55a64603bebd1077d09b
diff --git a/tests/testapk/src/native/testbinary.cpp b/tests/testapk/src/native/testbinary.cpp
index 4ba502a..365ea75 100644
--- a/tests/testapk/src/native/testbinary.cpp
+++ b/tests/testapk/src/native/testbinary.cpp
@@ -240,9 +240,6 @@
return ScopedAStatus::fromExceptionCodeWithMessage(EX_SERVICE_SPECIFIC,
msg.c_str());
}
- // TODO(b/264520098): Remove sync() once TestService supports quit() method
- // and Microdroid manager flushes filesystem caches on shutdown.
- sync();
return ScopedAStatus::ok();
}
@@ -255,6 +252,8 @@
}
return ScopedAStatus::ok();
}
+
+ ScopedAStatus quit() override { exit(0); }
};
auto testService = ndk::SharedRefBase::make<TestService>();