OSDN Git Service

bootanimation: Don't open non-existing bootanimation.zip
authorJim Huang <jserv@0xlab.org>
Mon, 9 Aug 2010 19:12:15 +0000 (03:12 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 29 Oct 2010 07:45:16 +0000 (15:45 +0800)
While booting from AOSP image, logcat always complains as following:
W/zipro   ( 1001): Unable to open zip '/data/local/bootanimation.zip':
No such file or directory
W/zipro   ( 1001): Unable to open zip '/system/media/bootanimation.zip':
No such file or directory

This patch avoids opening non-existing files.

Change-Id: I54cc03f125a5e16dbc930515bd2e43c623b63f8f

cmds/bootanimation/BootAnimation.cpp

index ac2eb0d..f4b48b6 100644 (file)
@@ -49,6 +49,9 @@
 
 #include "BootAnimation.h"
 
+#define USER_BOOTANIMATION_FILE "/data/local/bootanimation.zip"
+#define SYSTEM_BOOTANIMATION_FILE "/system/media/bootanimation.zip"
+
 namespace android {
 
 // ---------------------------------------------------------------------------
@@ -244,12 +247,12 @@ status_t BootAnimation::readyToRun() {
     mFlingerSurfaceControl = control;
     mFlingerSurface = s;
 
-    mAndroidAnimation = false;
-    status_t err = mZip.open("/data/local/bootanimation.zip");
-    if (err != NO_ERROR) {
-        err = mZip.open("/system/media/bootanimation.zip");
-        if (err != NO_ERROR) {
-            mAndroidAnimation = true;
+    mAndroidAnimation = true;
+    if ((access(USER_BOOTANIMATION_FILE, R_OK) == 0) ||
+        (access(SYSTEM_BOOTANIMATION_FILE, R_OK) == 0)) {
+        if ((mZip.open(USER_BOOTANIMATION_FILE) != NO_ERROR) ||
+            (mZip.open(SYSTEM_BOOTANIMATION_FILE) != NO_ERROR)) {
+            mAndroidAnimation = false;
         }
     }