diff options
Diffstat (limited to 'cmds/bootanimation')
-rw-r--r-- | cmds/bootanimation/Android.mk | 20 | ||||
-rw-r--r-- | cmds/bootanimation/AudioPlayer.cpp | 11 | ||||
-rw-r--r-- | cmds/bootanimation/AudioPlayer.h | 5 | ||||
-rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 28 | ||||
-rw-r--r-- | cmds/bootanimation/bootanimation_main.cpp | 14 |
5 files changed, 36 insertions, 42 deletions
diff --git a/cmds/bootanimation/Android.mk b/cmds/bootanimation/Android.mk index d6ecbe3..2ee586f 100644 --- a/cmds/bootanimation/Android.mk +++ b/cmds/bootanimation/Android.mk @@ -2,22 +2,24 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ - bootanimation_main.cpp \ - AudioPlayer.cpp \ - BootAnimation.cpp + bootanimation_main.cpp \ + AudioPlayer.cpp \ + BootAnimation.cpp LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES +LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code + LOCAL_C_INCLUDES += external/tinyalsa/include LOCAL_SHARED_LIBRARIES := \ - libcutils \ - liblog \ - libandroidfw \ - libutils \ - libbinder \ + libcutils \ + liblog \ + libandroidfw \ + libutils \ + libbinder \ libui \ - libskia \ + libskia \ libEGL \ libGLESv1_CM \ libgui \ diff --git a/cmds/bootanimation/AudioPlayer.cpp b/cmds/bootanimation/AudioPlayer.cpp index 471b77f..2932130 100644 --- a/cmds/bootanimation/AudioPlayer.cpp +++ b/cmds/bootanimation/AudioPlayer.cpp @@ -98,16 +98,16 @@ static bool setMixerValue(struct mixer* mixer, const char* name, const char* val ALOGE("mixer_ctl_set_value failed for %s %d", name, intValue); } } else { - ALOGE("Could not parse %s as int for %d", intValue, name); + ALOGE("Could not parse %s as int for %s", values, name); } break; case MIXER_CTL_TYPE_ENUM: if (sscanf(values, "%s", stringValue) == 1) { if (mixer_ctl_set_enum_by_string(ctl, stringValue) != 0) { - ALOGE("mixer_ctl_set_enum_by_string failed for %s %%s", name, stringValue); + ALOGE("mixer_ctl_set_enum_by_string failed for %s %s", name, stringValue); } } else { - ALOGE("Could not parse %s as enum for %d", stringValue, name); + ALOGE("Could not parse %s as enum for %s", values, name); } break; default: @@ -193,7 +193,7 @@ bool AudioPlayer::init(const char* config) return false; } -void AudioPlayer::playFile(struct FileMap* fileMap) { +void AudioPlayer::playFile(FileMap* fileMap) { // stop any currently playing sound requestExitAndWait(); @@ -207,7 +207,6 @@ bool AudioPlayer::threadLoop() struct pcm *pcm = NULL; bool moreChunks = true; const struct chunk_fmt* chunkFmt = NULL; - void* buffer = NULL; int bufferSize; const uint8_t* wavData; size_t wavLength; @@ -306,7 +305,7 @@ bool AudioPlayer::threadLoop() exit: if (pcm) pcm_close(pcm); - mCurrentFile->release(); + delete mCurrentFile; mCurrentFile = NULL; return false; } diff --git a/cmds/bootanimation/AudioPlayer.h b/cmds/bootanimation/AudioPlayer.h index 7e82a07..1def0ae 100644 --- a/cmds/bootanimation/AudioPlayer.h +++ b/cmds/bootanimation/AudioPlayer.h @@ -18,6 +18,7 @@ #define _BOOTANIMATION_AUDIOPLAYER_H #include <utils/Thread.h> +#include <utils/FileMap.h> namespace android { @@ -28,7 +29,7 @@ public: virtual ~AudioPlayer(); bool init(const char* config); - void playFile(struct FileMap* fileMap); + void playFile(FileMap* fileMap); private: virtual bool threadLoop(); @@ -39,7 +40,7 @@ private: int mPeriodSize; int mPeriodCount; - struct FileMap* mCurrentFile; + FileMap* mCurrentFile; }; } // namespace android diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 7ecac9b..21dc1e2 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -23,6 +23,7 @@ #include <fcntl.h> #include <utils/misc.h> #include <signal.h> +#include <time.h> #include <cutils/properties.h> @@ -41,9 +42,13 @@ #include <gui/Surface.h> #include <gui/SurfaceComposerClient.h> +// TODO: Fix Skia. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" #include <SkBitmap.h> #include <SkStream.h> #include <SkImageDecoder.h> +#pragma GCC diagnostic pop #include <GLES/gl.h> #include <GLES/glext.h> @@ -57,10 +62,6 @@ #define SYSTEM_ENCRYPTED_BOOTANIMATION_FILE "/system/media/bootanimation-encrypted.zip" #define EXIT_PROP_NAME "service.bootanim.exit" -extern "C" int clock_nanosleep(clockid_t clock_id, int flags, - const struct timespec *request, - struct timespec *remain); - namespace android { static const int ANIM_ENTRY_NAME_MAX = 256; @@ -108,7 +109,7 @@ void BootAnimation::binderDied(const wp<IBinder>&) status_t BootAnimation::initTexture(Texture* texture, AssetManager& assets, const char* name) { Asset* asset = assets.open(name, Asset::ACCESS_BUFFER); - if (!asset) + if (asset == NULL) return NO_INIT; SkBitmap bitmap; SkImageDecoder::DecodeMemory(asset->getBuffer(false), asset->getLength(), @@ -167,7 +168,7 @@ status_t BootAnimation::initTexture(const Animation::Frame& frame) SkBitmap bitmap; SkMemoryStream stream(frame.map->getDataPtr(), frame.map->getDataLength()); SkImageDecoder* codec = SkImageDecoder::Factory(&stream); - if (codec) { + if (codec != NULL) { codec->setDitherImage(false); codec->decode(&stream, &bitmap, kN32_SkColorType, @@ -178,7 +179,7 @@ status_t BootAnimation::initTexture(const Animation::Frame& frame) // FileMap memory is never released until application exit. // Release it now as the texture is already loaded and the memory used for // the packed resource can be released. - frame.map->release(); + delete frame.map; // ensure we can call getPixels(). No need to call unlock, since the // bitmap will go out of scope when we return from this method. @@ -255,7 +256,7 @@ status_t BootAnimation::readyToRun() { EGL_DEPTH_SIZE, 0, EGL_NONE }; - EGLint w, h, dummy; + EGLint w, h; EGLint numConfigs; EGLConfig config; EGLSurface surface; @@ -445,7 +446,7 @@ bool BootAnimation::readFile(const char* name, String8& outString) } outString.setTo((char const*)entryMap->getDataPtr(), entryMap->getDataLength()); - entryMap->release(); + delete entryMap; return true; } @@ -473,7 +474,7 @@ bool BootAnimation::movie() // Parse the description file for (;;) { const char* endl = strstr(s, "\n"); - if (!endl) break; + if (endl == NULL) break; String8 line(s, endl - s); const char* l = line.string(); int fps, width, height, count, pause; @@ -575,7 +576,6 @@ bool BootAnimation::movie() const int xc = (mWidth - animation.width) / 2; const int yc = ((mHeight - animation.height) / 2); - nsecs_t lastFrame = systemTime(); nsecs_t frameDuration = s2ns(1) / animation.fps; Region clearReg(Rect(mWidth, mHeight)); @@ -623,9 +623,9 @@ bool BootAnimation::movie() Region::const_iterator tail(clearReg.end()); glEnable(GL_SCISSOR_TEST); while (head != tail) { - const Rect& r(*head++); - glScissor(r.left, mHeight - r.bottom, - r.width(), r.height()); + const Rect& r2(*head++); + glScissor(r2.left, mHeight - r2.bottom, + r2.width(), r2.height()); glClear(GL_COLOR_BUFFER_BIT); } glDisable(GL_SCISSOR_TEST); diff --git a/cmds/bootanimation/bootanimation_main.cpp b/cmds/bootanimation/bootanimation_main.cpp index 417e138..48a34e7 100644 --- a/cmds/bootanimation/bootanimation_main.cpp +++ b/cmds/bootanimation/bootanimation_main.cpp @@ -16,31 +16,23 @@ #define LOG_TAG "BootAnimation" -#include <cutils/properties.h> - #include <binder/IPCThreadState.h> #include <binder/ProcessState.h> #include <binder/IServiceManager.h> - +#include <cutils/properties.h> +#include <sys/resource.h> #include <utils/Log.h> #include <utils/threads.h> -#if defined(HAVE_PTHREADS) -# include <pthread.h> -# include <sys/resource.h> -#endif - #include "BootAnimation.h" using namespace android; // --------------------------------------------------------------------------- -int main(int argc, char** argv) +int main() { -#if defined(HAVE_PTHREADS) setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_DISPLAY); -#endif char value[PROPERTY_VALUE_MAX]; property_get("debug.sf.nobootanimation", value, "0"); |