Add mechanism for device-specific loop images
Bug: 144974129 Test: Manual - Testing OTA and Factory Reset 1) Tested with matching device name ({devicename}00000.png) 2) Tested with no matching device name (uses loop00000.png default) 3) Tested with empty string device name (uses loop00000.png default) Change-Id: I4c73af82ab8826d1a43fe193a7616bc219d536e4
This commit is contained in:
parent
2a9ddbb108
commit
fd6a2c226d
1 changed files with 12 additions and 2 deletions
|
@ -941,17 +941,27 @@ void ScreenRecoveryUI::LoadAnimation() {
|
|||
closedir);
|
||||
dirent* de;
|
||||
std::vector<std::string> intro_frame_names;
|
||||
std::vector<std::string> loop_frame_names;
|
||||
std::vector<std::string> default_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) {
|
||||
int value, num_chars;
|
||||
if (sscanf(de->d_name, "intro%d%n.png", &value, &num_chars) == 1) {
|
||||
intro_frame_names.emplace_back(de->d_name, num_chars);
|
||||
} else if (sscanf(de->d_name, "loop%d%n.png", &value, &num_chars) == 1) {
|
||||
loop_frame_names.emplace_back(de->d_name, num_chars);
|
||||
default_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 loop_frames = loop_frame_names.size();
|
||||
|
||||
|
|
Loading…
Reference in a new issue