tests: Add tests for ScreenRecoveryUI.
In order to support that, this CL adds Paths::set_resource_dir() to
override the default resource dir ("/res/images/") that's only available
under recovery. Note that since there're external modules depending on
libminui, it adds a separate function of res_set_resource_dir(), instead
of requiring the dependency on libotautil for everyone.
Test: mmma -j bootable/recovery
Test: Run recovery_unit_test on marlin.
Change-Id: I0a7dcf4476808bea9e634eaffc9676f6cbaf92b7
diff --git a/screen_ui.cpp b/screen_ui.cpp
index 90e0e30..9198073 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -41,9 +41,10 @@
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
-#include <minui/minui.h>
#include "device.h"
+#include "minui/minui.h"
+#include "otautil/paths.h"
#include "ui.h"
// Return the current time as a double (including fractions of a second).
@@ -754,7 +755,8 @@
}
void ScreenRecoveryUI::LoadAnimation() {
- std::unique_ptr<DIR, decltype(&closedir)> dir(opendir("/res/images"), closedir);
+ std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(Paths::Get().resource_dir().c_str()),
+ closedir);
dirent* de;
std::vector<std::string> intro_frame_names;
std::vector<std::string> loop_frame_names;