Loading cmds/bootanimation/BootAnimation.cpp +39 −18 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ #define LOG_NDEBUG 0 #define LOG_TAG "BootAnimation" #include <vector> #include <stdint.h> #include <inttypes.h> #include <sys/inotify.h> Loading Loading @@ -80,6 +82,10 @@ static const char OEM_SHUTDOWNANIMATION_FILE[] = "/oem/media/shutdownanimation.z static const char PRODUCT_SHUTDOWNANIMATION_FILE[] = "/product/media/shutdownanimation.zip"; static const char SYSTEM_SHUTDOWNANIMATION_FILE[] = "/system/media/shutdownanimation.zip"; static constexpr const char* PRODUCT_USERSPACE_REBOOT_ANIMATION_FILE = "/product/media/userspace-reboot.zip"; static constexpr const char* OEM_USERSPACE_REBOOT_ANIMATION_FILE = "/oem/media/userspace-reboot.zip"; static constexpr const char* SYSTEM_USERSPACE_REBOOT_ANIMATION_FILE = "/system/media/userspace-reboot.zip"; static const char SYSTEM_DATA_DIR_PATH[] = "/data/system"; static const char SYSTEM_TIME_DIR_NAME[] = "time"; static const char SYSTEM_TIME_DIR_PATH[] = "/data/system/time"; Loading Loading @@ -341,6 +347,16 @@ bool BootAnimation::preloadAnimation() { return false; } bool BootAnimation::findBootAnimationFileInternal(const std::vector<std::string> &files) { for (const std::string& f : files) { if (access(f.c_str(), R_OK) == 0) { mZipFileName = f.c_str(); return true; } } return false; } void BootAnimation::findBootAnimationFile() { // If the device has encryption turned on or is in process // of being encrypted we show the encrypted boot animation. Loading @@ -351,28 +367,33 @@ void BootAnimation::findBootAnimationFile() { !strcmp("trigger_restart_min_framework", decrypt); if (!mShuttingDown && encryptedAnimation) { static const char* encryptedBootFiles[] = {PRODUCT_ENCRYPTED_BOOTANIMATION_FILE, SYSTEM_ENCRYPTED_BOOTANIMATION_FILE}; for (const char* f : encryptedBootFiles) { if (access(f, R_OK) == 0) { mZipFileName = f; static const std::vector<std::string> encryptedBootFiles = { PRODUCT_ENCRYPTED_BOOTANIMATION_FILE, SYSTEM_ENCRYPTED_BOOTANIMATION_FILE, }; if (findBootAnimationFileInternal(encryptedBootFiles)) { return; } } } const bool playDarkAnim = android::base::GetIntProperty("ro.boot.theme", 0) == 1; static const char* bootFiles[] = {APEX_BOOTANIMATION_FILE, playDarkAnim ? PRODUCT_BOOTANIMATION_DARK_FILE : PRODUCT_BOOTANIMATION_FILE, OEM_BOOTANIMATION_FILE, SYSTEM_BOOTANIMATION_FILE}; static const char* shutdownFiles[] = {PRODUCT_SHUTDOWNANIMATION_FILE, OEM_SHUTDOWNANIMATION_FILE, SYSTEM_SHUTDOWNANIMATION_FILE, ""}; for (const char* f : (!mShuttingDown ? bootFiles : shutdownFiles)) { if (access(f, R_OK) == 0) { mZipFileName = f; return; } static const std::vector<std::string> bootFiles = { APEX_BOOTANIMATION_FILE, playDarkAnim ? PRODUCT_BOOTANIMATION_DARK_FILE : PRODUCT_BOOTANIMATION_FILE, OEM_BOOTANIMATION_FILE, SYSTEM_BOOTANIMATION_FILE }; static const std::vector<std::string> shutdownFiles = { PRODUCT_SHUTDOWNANIMATION_FILE, OEM_SHUTDOWNANIMATION_FILE, SYSTEM_SHUTDOWNANIMATION_FILE, "" }; static const std::vector<std::string> userspaceRebootFiles = { PRODUCT_USERSPACE_REBOOT_ANIMATION_FILE, OEM_USERSPACE_REBOOT_ANIMATION_FILE, SYSTEM_USERSPACE_REBOOT_ANIMATION_FILE, }; if (android::base::GetBoolProperty("sys.init.userspace_reboot.in_progress", false)) { findBootAnimationFileInternal(userspaceRebootFiles); } else if (mShuttingDown) { findBootAnimationFileInternal(shutdownFiles); } else { findBootAnimationFileInternal(bootFiles); } } Loading cmds/bootanimation/BootAnimation.h +3 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ #ifndef ANDROID_BOOTANIMATION_H #define ANDROID_BOOTANIMATION_H #include <vector> #include <stdint.h> #include <sys/types.h> Loading Loading @@ -157,6 +159,7 @@ private: bool parseAnimationDesc(Animation&); bool preloadZip(Animation &animation); void findBootAnimationFile(); bool findBootAnimationFileInternal(const std::vector<std::string>& files); bool preloadAnimation(); void checkExit(); Loading Loading
cmds/bootanimation/BootAnimation.cpp +39 −18 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ #define LOG_NDEBUG 0 #define LOG_TAG "BootAnimation" #include <vector> #include <stdint.h> #include <inttypes.h> #include <sys/inotify.h> Loading Loading @@ -80,6 +82,10 @@ static const char OEM_SHUTDOWNANIMATION_FILE[] = "/oem/media/shutdownanimation.z static const char PRODUCT_SHUTDOWNANIMATION_FILE[] = "/product/media/shutdownanimation.zip"; static const char SYSTEM_SHUTDOWNANIMATION_FILE[] = "/system/media/shutdownanimation.zip"; static constexpr const char* PRODUCT_USERSPACE_REBOOT_ANIMATION_FILE = "/product/media/userspace-reboot.zip"; static constexpr const char* OEM_USERSPACE_REBOOT_ANIMATION_FILE = "/oem/media/userspace-reboot.zip"; static constexpr const char* SYSTEM_USERSPACE_REBOOT_ANIMATION_FILE = "/system/media/userspace-reboot.zip"; static const char SYSTEM_DATA_DIR_PATH[] = "/data/system"; static const char SYSTEM_TIME_DIR_NAME[] = "time"; static const char SYSTEM_TIME_DIR_PATH[] = "/data/system/time"; Loading Loading @@ -341,6 +347,16 @@ bool BootAnimation::preloadAnimation() { return false; } bool BootAnimation::findBootAnimationFileInternal(const std::vector<std::string> &files) { for (const std::string& f : files) { if (access(f.c_str(), R_OK) == 0) { mZipFileName = f.c_str(); return true; } } return false; } void BootAnimation::findBootAnimationFile() { // If the device has encryption turned on or is in process // of being encrypted we show the encrypted boot animation. Loading @@ -351,28 +367,33 @@ void BootAnimation::findBootAnimationFile() { !strcmp("trigger_restart_min_framework", decrypt); if (!mShuttingDown && encryptedAnimation) { static const char* encryptedBootFiles[] = {PRODUCT_ENCRYPTED_BOOTANIMATION_FILE, SYSTEM_ENCRYPTED_BOOTANIMATION_FILE}; for (const char* f : encryptedBootFiles) { if (access(f, R_OK) == 0) { mZipFileName = f; static const std::vector<std::string> encryptedBootFiles = { PRODUCT_ENCRYPTED_BOOTANIMATION_FILE, SYSTEM_ENCRYPTED_BOOTANIMATION_FILE, }; if (findBootAnimationFileInternal(encryptedBootFiles)) { return; } } } const bool playDarkAnim = android::base::GetIntProperty("ro.boot.theme", 0) == 1; static const char* bootFiles[] = {APEX_BOOTANIMATION_FILE, playDarkAnim ? PRODUCT_BOOTANIMATION_DARK_FILE : PRODUCT_BOOTANIMATION_FILE, OEM_BOOTANIMATION_FILE, SYSTEM_BOOTANIMATION_FILE}; static const char* shutdownFiles[] = {PRODUCT_SHUTDOWNANIMATION_FILE, OEM_SHUTDOWNANIMATION_FILE, SYSTEM_SHUTDOWNANIMATION_FILE, ""}; for (const char* f : (!mShuttingDown ? bootFiles : shutdownFiles)) { if (access(f, R_OK) == 0) { mZipFileName = f; return; } static const std::vector<std::string> bootFiles = { APEX_BOOTANIMATION_FILE, playDarkAnim ? PRODUCT_BOOTANIMATION_DARK_FILE : PRODUCT_BOOTANIMATION_FILE, OEM_BOOTANIMATION_FILE, SYSTEM_BOOTANIMATION_FILE }; static const std::vector<std::string> shutdownFiles = { PRODUCT_SHUTDOWNANIMATION_FILE, OEM_SHUTDOWNANIMATION_FILE, SYSTEM_SHUTDOWNANIMATION_FILE, "" }; static const std::vector<std::string> userspaceRebootFiles = { PRODUCT_USERSPACE_REBOOT_ANIMATION_FILE, OEM_USERSPACE_REBOOT_ANIMATION_FILE, SYSTEM_USERSPACE_REBOOT_ANIMATION_FILE, }; if (android::base::GetBoolProperty("sys.init.userspace_reboot.in_progress", false)) { findBootAnimationFileInternal(userspaceRebootFiles); } else if (mShuttingDown) { findBootAnimationFileInternal(shutdownFiles); } else { findBootAnimationFileInternal(bootFiles); } } Loading
cmds/bootanimation/BootAnimation.h +3 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ #ifndef ANDROID_BOOTANIMATION_H #define ANDROID_BOOTANIMATION_H #include <vector> #include <stdint.h> #include <sys/types.h> Loading Loading @@ -157,6 +159,7 @@ private: bool parseAnimationDesc(Animation&); bool preloadZip(Animation &animation); void findBootAnimationFile(); bool findBootAnimationFileInternal(const std::vector<std::string>& files); bool preloadAnimation(); void checkExit(); Loading