Revert "Add mechanism for device-specific loop images"

This reverts commit fd6a2c226d.

Reason for revert: Mechanism already exists:
https://source.android.com/devices/tech/ota/nonab/device_code#recovery-ui-images

Change-Id: Ic7b640b5d435cfb6f5c2610a2534405fb9415936
This commit is contained in:
Joshua Lambert 2019-12-09 20:24:18 +00:00
parent fd6a2c226d
commit 94a83be42a

View file

@ -941,27 +941,17 @@ void ScreenRecoveryUI::LoadAnimation() {
closedir); closedir);
dirent* de; dirent* de;
std::vector<std::string> intro_frame_names; std::vector<std::string> intro_frame_names;
std::vector<std::string> default_loop_frame_names; std::vector<std::string> loop_frame_names;
std::vector<std::string> device_loop_frame_names;
// Create string format for device-specific loop animations.
std::string deviceformat = android::base::GetProperty("ro.product.product.name", "");
deviceformat += "%d%n.png";
while ((de = readdir(dir.get())) != nullptr) { while ((de = readdir(dir.get())) != nullptr) {
int value, num_chars; int value, num_chars;
if (sscanf(de->d_name, "intro%d%n.png", &value, &num_chars) == 1) { if (sscanf(de->d_name, "intro%d%n.png", &value, &num_chars) == 1) {
intro_frame_names.emplace_back(de->d_name, num_chars); intro_frame_names.emplace_back(de->d_name, num_chars);
} else if (sscanf(de->d_name, "loop%d%n.png", &value, &num_chars) == 1) { } else if (sscanf(de->d_name, "loop%d%n.png", &value, &num_chars) == 1) {
default_loop_frame_names.emplace_back(de->d_name, num_chars); loop_frame_names.emplace_back(de->d_name, num_chars);
} else if (sscanf(de->d_name, deviceformat.c_str(), &value, &num_chars) == 1) {
device_loop_frame_names.emplace_back(de->d_name, num_chars);
} }
} }
// Favor device-specific loop frames, if they exist.
auto& loop_frame_names =
device_loop_frame_names.empty() ? default_loop_frame_names : device_loop_frame_names;
size_t intro_frames = intro_frame_names.size(); size_t intro_frames = intro_frame_names.size();
size_t loop_frames = loop_frame_names.size(); size_t loop_frames = loop_frame_names.size();