resolved conflicts for merge of 3fe7ee65 to ics-mr1-plus-aosp

Change-Id: Ia7e1cd869779e9f512e840b768f5b43992c8a122
diff --git a/api/current.txt b/api/current.txt
index 68fb4bc..2914942 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -7496,6 +7496,7 @@
     method public java.lang.String getOriginalMimeType(android.net.Uri);
     method public int openConvertSession(java.lang.String);
     method public int processDrmInfo(android.drm.DrmInfo);
+    method public void release();
     method public int removeAllRights();
     method public int removeRights(java.lang.String);
     method public int removeRights(android.net.Uri);
diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp
index f2be29f..6fe358c 100644
--- a/cmds/app_process/app_main.cpp
+++ b/cmds/app_process/app_main.cpp
@@ -72,7 +72,7 @@
         char* slashClassName = toSlashClassName(mClassName);
         mClass = env->FindClass(slashClassName);
         if (mClass == NULL) {
-            LOGE("ERROR: could not find class '%s'\n", mClassName);
+            ALOGE("ERROR: could not find class '%s'\n", mClassName);
         }
         free(slashClassName);
 
@@ -82,7 +82,7 @@
     virtual void onStarted()
     {
         sp<ProcessState> proc = ProcessState::self();
-        LOGV("App process: starting thread pool.\n");
+        ALOGV("App process: starting thread pool.\n");
         proc->startThreadPool();
 
         AndroidRuntime* ar = AndroidRuntime::getRuntime();
@@ -94,7 +94,7 @@
     virtual void onZygoteInit()
     {
         sp<ProcessState> proc = ProcessState::self();
-        LOGV("App process: starting thread pool.\n");
+        ALOGV("App process: starting thread pool.\n");
         proc->startThreadPool();
     }
 
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index 154dbb8..0d5b4ca 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -69,7 +69,7 @@
 
 void BootAnimation::onFirstRef() {
     status_t err = mSession->linkToComposerDeath(this);
-    LOGE_IF(err, "linkToComposerDeath failed (%s) ", strerror(-err));
+    ALOGE_IF(err, "linkToComposerDeath failed (%s) ", strerror(-err));
     if (err == NO_ERROR) {
         run("BootAnimation", PRIORITY_DISPLAY);
     }
@@ -83,7 +83,7 @@
 void BootAnimation::binderDied(const wp<IBinder>& who)
 {
     // woah, surfaceflinger died!
-    LOGD("SurfaceFlinger died, exiting...");
+    ALOGD("SurfaceFlinger died, exiting...");
 
     // calling requestExit() is not enough here because the Surface code
     // might be blocked on a condition variable that will never be updated.
@@ -374,7 +374,7 @@
     size_t numEntries = zip.getNumEntries();
     ZipEntryRO desc = zip.findEntryByName("desc.txt");
     FileMap* descMap = zip.createEntryFileMap(desc);
-    LOGE_IF(!descMap, "descMap is null");
+    ALOGE_IF(!descMap, "descMap is null");
     if (!descMap) {
         return false;
     }
@@ -394,13 +394,13 @@
         int fps, width, height, count, pause;
         char path[256];
         if (sscanf(l, "%d %d %d", &width, &height, &fps) == 3) {
-            //LOGD("> w=%d, h=%d, fps=%d", fps, width, height);
+            //ALOGD("> w=%d, h=%d, fps=%d", fps, width, height);
             animation.width = width;
             animation.height = height;
             animation.fps = fps;
         }
         if (sscanf(l, "p %d %d %s", &count, &pause, path) == 3) {
-            //LOGD("> count=%d, pause=%d, path=%s", count, pause, path);
+            //ALOGD("> count=%d, pause=%d, path=%s", count, pause, path);
             Animation::Part part;
             part.count = count;
             part.pause = pause;
diff --git a/cmds/bootanimation/bootanimation_main.cpp b/cmds/bootanimation/bootanimation_main.cpp
index 5f8b744..ff809d3 100644
--- a/cmds/bootanimation/bootanimation_main.cpp
+++ b/cmds/bootanimation/bootanimation_main.cpp
@@ -47,7 +47,7 @@
     char value[PROPERTY_VALUE_MAX];
     property_get("debug.sf.nobootanimation", value, "0");
     int noBootAnimation = atoi(value);
-    LOGI_IF(noBootAnimation,  "boot animation disabled");
+    ALOGI_IF(noBootAnimation,  "boot animation disabled");
     if (!noBootAnimation) {
 
         sp<ProcessState> proc(ProcessState::self());
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index 60af415..3613101 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -84,9 +84,9 @@
     dump_file("BUDDYINFO", "/proc/buddyinfo");
 
     if (screenshot_path[0]) {
-        LOGI("taking screenshot\n");
+        ALOGI("taking screenshot\n");
         run_command(NULL, 5, "su", "root", "screenshot", screenshot_path, NULL);
-        LOGI("wrote screenshot: %s\n", screenshot_path);
+        ALOGI("wrote screenshot: %s\n", screenshot_path);
     }
 
     run_command("SYSTEM LOG", 20, "logcat", "-v", "threadtime", "-d", "*:v", NULL);
@@ -289,7 +289,7 @@
     int use_socket = 0;
     int do_fb = 0;
 
-    LOGI("begin\n");
+    ALOGI("begin\n");
 
     /* set as high priority, and protect from OOM killer */
     setpriority(PRIO_PROCESS, 0, -20);
@@ -335,15 +335,15 @@
         /* switch to non-root user and group */
         gid_t groups[] = { AID_LOG, AID_SDCARD_RW, AID_MOUNT, AID_INET };
         if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) {
-            LOGE("Unable to setgroups, aborting: %s\n", strerror(errno));
+            ALOGE("Unable to setgroups, aborting: %s\n", strerror(errno));
             return -1;
         }
         if (setgid(AID_SHELL) != 0) {
-            LOGE("Unable to setgid, aborting: %s\n", strerror(errno));
+            ALOGE("Unable to setgid, aborting: %s\n", strerror(errno));
             return -1;
         }
         if (setuid(AID_SHELL) != 0) {
-            LOGE("Unable to setuid, aborting: %s\n", strerror(errno));
+            ALOGE("Unable to setuid, aborting: %s\n", strerror(errno));
             return -1;
         }
     }
@@ -404,7 +404,7 @@
         fprintf(stderr, "rename(%s, %s): %s\n", tmp_path, path, strerror(errno));
     }
 
-    LOGI("done\n");
+    ALOGI("done\n");
 
     return 0;
 }
diff --git a/cmds/dumpsys/dumpsys.cpp b/cmds/dumpsys/dumpsys.cpp
index fdc5d5d..7dad6b6 100644
--- a/cmds/dumpsys/dumpsys.cpp
+++ b/cmds/dumpsys/dumpsys.cpp
@@ -31,7 +31,7 @@
     sp<IServiceManager> sm = defaultServiceManager();
     fflush(stdout);
     if (sm == NULL) {
-		LOGE("Unable to get default service manager!");
+		ALOGE("Unable to get default service manager!");
         aerr << "dumpsys: Unable to get default service manager!" << endl;
         return 20;
     }
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 4ede33f..dd92bbe 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -30,47 +30,47 @@
     char libdir[PKG_PATH_MAX];
 
     if ((uid < AID_SYSTEM) || (gid < AID_SYSTEM)) {
-        LOGE("invalid uid/gid: %d %d\n", uid, gid);
+        ALOGE("invalid uid/gid: %d %d\n", uid, gid);
         return -1;
     }
 
     if (create_pkg_path(pkgdir, pkgname, PKG_DIR_POSTFIX, 0)) {
-        LOGE("cannot create package path\n");
+        ALOGE("cannot create package path\n");
         return -1;
     }
 
     if (create_pkg_path(libdir, pkgname, PKG_LIB_POSTFIX, 0)) {
-        LOGE("cannot create package lib path\n");
+        ALOGE("cannot create package lib path\n");
         return -1;
     }
 
     if (mkdir(pkgdir, 0751) < 0) {
-        LOGE("cannot create dir '%s': %s\n", pkgdir, strerror(errno));
+        ALOGE("cannot create dir '%s': %s\n", pkgdir, strerror(errno));
         return -errno;
     }
     if (chmod(pkgdir, 0751) < 0) {
-        LOGE("cannot chmod dir '%s': %s\n", pkgdir, strerror(errno));
+        ALOGE("cannot chmod dir '%s': %s\n", pkgdir, strerror(errno));
         unlink(pkgdir);
         return -errno;
     }
     if (chown(pkgdir, uid, gid) < 0) {
-        LOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno));
+        ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno));
         unlink(pkgdir);
         return -errno;
     }
     if (mkdir(libdir, 0755) < 0) {
-        LOGE("cannot create dir '%s': %s\n", libdir, strerror(errno));
+        ALOGE("cannot create dir '%s': %s\n", libdir, strerror(errno));
         unlink(pkgdir);
         return -errno;
     }
     if (chmod(libdir, 0755) < 0) {
-        LOGE("cannot chmod dir '%s': %s\n", libdir, strerror(errno));
+        ALOGE("cannot chmod dir '%s': %s\n", libdir, strerror(errno));
         unlink(libdir);
         unlink(pkgdir);
         return -errno;
     }
     if (chown(libdir, AID_SYSTEM, AID_SYSTEM) < 0) {
-        LOGE("cannot chown dir '%s': %s\n", libdir, strerror(errno));
+        ALOGE("cannot chown dir '%s': %s\n", libdir, strerror(errno));
         unlink(libdir);
         unlink(pkgdir);
         return -errno;
@@ -100,7 +100,7 @@
         return -1;
 
     if (rename(oldpkgdir, newpkgdir) < 0) {
-        LOGE("cannot rename dir '%s' to '%s': %s\n", oldpkgdir, newpkgdir, strerror(errno));
+        ALOGE("cannot rename dir '%s' to '%s': %s\n", oldpkgdir, newpkgdir, strerror(errno));
         return -errno;
     }
     return 0;
@@ -127,11 +127,11 @@
         return -1;
     }
     if (mkdir(pkgdir, 0751) < 0) {
-        LOGE("cannot create dir '%s': %s\n", pkgdir, strerror(errno));
+        ALOGE("cannot create dir '%s': %s\n", pkgdir, strerror(errno));
         return -errno;
     }
     if (chown(pkgdir, uid, uid) < 0) {
-        LOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno));
+        ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno));
         unlink(pkgdir);
         return -errno;
     }
@@ -165,7 +165,7 @@
     if (statfs(android_data_dir.path, &sfs) == 0) {
         return sfs.f_bavail * sfs.f_bsize;
     } else {
-        LOGE("Couldn't statfs %s: %s\n", android_data_dir.path, strerror(errno));
+        ALOGE("Couldn't statfs %s: %s\n", android_data_dir.path, strerror(errno));
         return -1;
     }
 }
@@ -189,17 +189,17 @@
     avail = disk_free();
     if (avail < 0) return -1;
 
-    LOGI("free_cache(%" PRId64 ") avail %" PRId64 "\n", free_size, avail);
+    ALOGI("free_cache(%" PRId64 ") avail %" PRId64 "\n", free_size, avail);
     if (avail >= free_size) return 0;
 
     if (create_persona_path(datadir, 0)) {
-        LOGE("couldn't get directory for persona 0");
+        ALOGE("couldn't get directory for persona 0");
         return -1;
     }
 
     d = opendir(datadir);
     if (d == NULL) {
-        LOGE("cannot open %s: %s\n", datadir, strerror(errno));
+        ALOGE("cannot open %s: %s\n", datadir, strerror(errno));
         return -1;
     }
     dfd = dirfd(d);
@@ -243,9 +243,9 @@
     if (create_cache_path(src_dex, src)) return -1;
     if (create_cache_path(dst_dex, dst)) return -1;
 
-    LOGV("move %s -> %s\n", src_dex, dst_dex);
+    ALOGV("move %s -> %s\n", src_dex, dst_dex);
     if (rename(src_dex, dst_dex) < 0) {
-        LOGE("Couldn't move %s: %s\n", src_dex, strerror(errno));
+        ALOGE("Couldn't move %s: %s\n", src_dex, strerror(errno));
         return -1;
     } else {
         return 0;
@@ -259,9 +259,9 @@
     if (validate_apk_path(path)) return -1;
     if (create_cache_path(dex_path, path)) return -1;
 
-    LOGV("unlink %s\n", dex_path);
+    ALOGV("unlink %s\n", dex_path);
     if (unlink(dex_path) < 0) {
-        LOGE("Couldn't unlink %s: %s\n", dex_path, strerror(errno));
+        ALOGE("Couldn't unlink %s: %s\n", dex_path, strerror(errno));
         return -1;
     } else {
         return 0;
@@ -281,12 +281,12 @@
     if (stat(pkgpath, &s) < 0) return -1;
 
     if (chown(pkgpath, s.st_uid, gid) < 0) {
-        LOGE("failed to chgrp '%s': %s\n", pkgpath, strerror(errno));
+        ALOGE("failed to chgrp '%s': %s\n", pkgpath, strerror(errno));
         return -1;
     }
 
     if (chmod(pkgpath, S_IRUSR|S_IWUSR|S_IRGRP) < 0) {
-        LOGE("failed to chmod '%s': %s\n", pkgpath, strerror(errno));
+        ALOGE("failed to chmod '%s': %s\n", pkgpath, strerror(errno));
         return -1;
     }
 
@@ -443,7 +443,7 @@
 
     execl(DEX_OPT_BIN, DEX_OPT_BIN, "--zip", zip_num, odex_num, input_file_name,
         dexopt_flags, (char*) NULL);
-    LOGE("execl(%s) failed: %s\n", DEX_OPT_BIN, strerror(errno));
+    ALOGE("execl(%s) failed: %s\n", DEX_OPT_BIN, strerror(errno));
 }
 
 static int wait_dexopt(pid_t pid, const char* apk_path)
@@ -463,16 +463,16 @@
         }
     }
     if (got_pid != pid) {
-        LOGW("waitpid failed: wanted %d, got %d: %s\n",
+        ALOGW("waitpid failed: wanted %d, got %d: %s\n",
             (int) pid, (int) got_pid, strerror(errno));
         return 1;
     }
 
     if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
-        LOGV("DexInv: --- END '%s' (success) ---\n", apk_path);
+        ALOGV("DexInv: --- END '%s' (success) ---\n", apk_path);
         return 0;
     } else {
-        LOGW("DexInv: --- END '%s' --- status=0x%04x, process failed\n",
+        ALOGW("DexInv: --- END '%s' --- status=0x%04x, process failed\n",
             apk_path, status);
         return status;      /* always nonzero */
     }
@@ -515,43 +515,43 @@
 
     zip_fd = open(apk_path, O_RDONLY, 0);
     if (zip_fd < 0) {
-        LOGE("dexopt cannot open '%s' for input\n", apk_path);
+        ALOGE("dexopt cannot open '%s' for input\n", apk_path);
         return -1;
     }
 
     unlink(dex_path);
     odex_fd = open(dex_path, O_RDWR | O_CREAT | O_EXCL, 0644);
     if (odex_fd < 0) {
-        LOGE("dexopt cannot open '%s' for output\n", dex_path);
+        ALOGE("dexopt cannot open '%s' for output\n", dex_path);
         goto fail;
     }
     if (fchown(odex_fd, AID_SYSTEM, uid) < 0) {
-        LOGE("dexopt cannot chown '%s'\n", dex_path);
+        ALOGE("dexopt cannot chown '%s'\n", dex_path);
         goto fail;
     }
     if (fchmod(odex_fd,
                S_IRUSR|S_IWUSR|S_IRGRP |
                (is_public ? S_IROTH : 0)) < 0) {
-        LOGE("dexopt cannot chmod '%s'\n", dex_path);
+        ALOGE("dexopt cannot chmod '%s'\n", dex_path);
         goto fail;
     }
 
-    LOGV("DexInv: --- BEGIN '%s' ---\n", apk_path);
+    ALOGV("DexInv: --- BEGIN '%s' ---\n", apk_path);
 
     pid_t pid;
     pid = fork();
     if (pid == 0) {
         /* child -- drop privileges before continuing */
         if (setgid(uid) != 0) {
-            LOGE("setgid(%d) failed during dexopt\n", uid);
+            ALOGE("setgid(%d) failed during dexopt\n", uid);
             exit(64);
         }
         if (setuid(uid) != 0) {
-            LOGE("setuid(%d) during dexopt\n", uid);
+            ALOGE("setuid(%d) during dexopt\n", uid);
             exit(65);
         }
         if (flock(odex_fd, LOCK_EX | LOCK_NB) != 0) {
-            LOGE("flock(%s) failed: %s\n", dex_path, strerror(errno));
+            ALOGE("flock(%s) failed: %s\n", dex_path, strerror(errno));
             exit(66);
         }
 
@@ -560,7 +560,7 @@
     } else {
         res = wait_dexopt(pid, apk_path);
         if (res != 0) {
-            LOGE("dexopt failed on '%s' res = %d\n", dex_path, res);
+            ALOGE("dexopt failed on '%s' res = %d\n", dex_path, res);
             goto fail;
         }
     }
@@ -591,11 +591,11 @@
         if (path[basepos] == '/') {
             path[basepos] = 0;
             if (lstat(path, statbuf) < 0) {
-                LOGV("Making directory: %s\n", path);
+                ALOGV("Making directory: %s\n", path);
                 if (mkdir(path, mode) == 0) {
                     chown(path, uid, gid);
                 } else {
-                    LOGW("Unable to make directory %s: %s\n", path, strerror(errno));
+                    ALOGW("Unable to make directory %s: %s\n", path, strerror(errno));
                 }
             }
             path[basepos] = '/';
@@ -616,22 +616,22 @@
     int dstend = strlen(dstpath);
     
     if (lstat(srcpath, statbuf) < 0) {
-        LOGW("Unable to stat %s: %s\n", srcpath, strerror(errno));
+        ALOGW("Unable to stat %s: %s\n", srcpath, strerror(errno));
         return 1;
     }
     
     if ((statbuf->st_mode&S_IFDIR) == 0) {
         mkinnerdirs(dstpath, dstbasepos, S_IRWXU|S_IRWXG|S_IXOTH,
                 dstuid, dstgid, statbuf);
-        LOGV("Renaming %s to %s (uid %d)\n", srcpath, dstpath, dstuid);
+        ALOGV("Renaming %s to %s (uid %d)\n", srcpath, dstpath, dstuid);
         if (rename(srcpath, dstpath) >= 0) {
             if (chown(dstpath, dstuid, dstgid) < 0) {
-                LOGE("cannot chown %s: %s\n", dstpath, strerror(errno));
+                ALOGE("cannot chown %s: %s\n", dstpath, strerror(errno));
                 unlink(dstpath);
                 return 1;
             }
         } else {
-            LOGW("Unable to rename %s to %s: %s\n",
+            ALOGW("Unable to rename %s to %s: %s\n",
                 srcpath, dstpath, strerror(errno));
             return 1;
         }
@@ -640,7 +640,7 @@
 
     d = opendir(srcpath);
     if (d == NULL) {
-        LOGW("Unable to opendir %s: %s\n", srcpath, strerror(errno));
+        ALOGW("Unable to opendir %s: %s\n", srcpath, strerror(errno));
         return 1;
     }
 
@@ -655,12 +655,12 @@
         }
         
         if ((srcend+strlen(name)) >= (PKG_PATH_MAX-2)) {
-            LOGW("Source path too long; skipping: %s/%s\n", srcpath, name);
+            ALOGW("Source path too long; skipping: %s/%s\n", srcpath, name);
             continue;
         }
         
         if ((dstend+strlen(name)) >= (PKG_PATH_MAX-2)) {
-            LOGW("Destination path too long; skipping: %s/%s\n", dstpath, name);
+            ALOGW("Destination path too long; skipping: %s/%s\n", dstpath, name);
             continue;
         }
         
@@ -716,7 +716,7 @@
         } else {
             subfd = openat(dfd, name, O_RDONLY);
             if (subfd < 0) {
-                LOGW("Unable to open update commands at %s%s\n",
+                ALOGW("Unable to open update commands at %s%s\n",
                         UPDATE_COMMANDS_DIR_PREFIX, name);
                 continue;
             }
@@ -732,7 +732,7 @@
                 }
                 if (bufi < bufe) {
                     buf[bufi] = 0;
-                    LOGV("Processing line: %s\n", buf+bufp);
+                    ALOGV("Processing line: %s\n", buf+bufp);
                     hasspace = 0;
                     while (bufp < bufi && isspace(buf[bufp])) {
                         hasspace = 1;
@@ -742,12 +742,12 @@
                         // skip comments and empty lines.
                     } else if (hasspace) {
                         if (dstpkg[0] == 0) {
-                            LOGW("Path before package line in %s%s: %s\n",
+                            ALOGW("Path before package line in %s%s: %s\n",
                                     UPDATE_COMMANDS_DIR_PREFIX, name, buf+bufp);
                         } else if (srcpkg[0] == 0) {
                             // Skip -- source package no longer exists.
                         } else {
-                            LOGV("Move file: %s (from %s to %s)\n", buf+bufp, srcpkg, dstpkg);
+                            ALOGV("Move file: %s (from %s to %s)\n", buf+bufp, srcpkg, dstpkg);
                             if (!create_move_path(srcpath, srcpkg, buf+bufp, 0) &&
                                     !create_move_path(dstpath, dstpkg, buf+bufp, 0)) {
                                 movefileordir(srcpath, dstpath,
@@ -758,7 +758,7 @@
                     } else {
                         char* div = strchr(buf+bufp, ':');
                         if (div == NULL) {
-                            LOGW("Bad package spec in %s%s; no ':' sep: %s\n",
+                            ALOGW("Bad package spec in %s%s; no ':' sep: %s\n",
                                     UPDATE_COMMANDS_DIR_PREFIX, name, buf+bufp);
                         } else {
                             *div = 0;
@@ -767,14 +767,14 @@
                                 strcpy(dstpkg, buf+bufp);
                             } else {
                                 srcpkg[0] = dstpkg[0] = 0;
-                                LOGW("Package name too long in %s%s: %s\n",
+                                ALOGW("Package name too long in %s%s: %s\n",
                                         UPDATE_COMMANDS_DIR_PREFIX, name, buf+bufp);
                             }
                             if (strlen(div) < PKG_NAME_MAX) {
                                 strcpy(srcpkg, div);
                             } else {
                                 srcpkg[0] = dstpkg[0] = 0;
-                                LOGW("Package name too long in %s%s: %s\n",
+                                ALOGW("Package name too long in %s%s: %s\n",
                                         UPDATE_COMMANDS_DIR_PREFIX, name, div);
                             }
                             if (srcpkg[0] != 0) {
@@ -785,7 +785,7 @@
                                     }
                                 } else {
                                     srcpkg[0] = 0;
-                                    LOGW("Can't create path %s in %s%s\n",
+                                    ALOGW("Can't create path %s in %s%s\n",
                                             div, UPDATE_COMMANDS_DIR_PREFIX, name);
                                 }
                                 if (srcpkg[0] != 0) {
@@ -802,11 +802,11 @@
                                         }
                                     } else {
                                         srcpkg[0] = 0;
-                                        LOGW("Can't create path %s in %s%s\n",
+                                        ALOGW("Can't create path %s in %s%s\n",
                                                 div, UPDATE_COMMANDS_DIR_PREFIX, name);
                                     }
                                 }
-                                LOGV("Transfering from %s to %s: uid=%d\n",
+                                ALOGV("Transfering from %s to %s: uid=%d\n",
                                     srcpkg, dstpkg, dstuid);
                             }
                         }
@@ -815,7 +815,7 @@
                 } else {
                     if (bufp == 0) {
                         if (bufp < bufe) {
-                            LOGW("Line too long in %s%s, skipping: %s\n",
+                            ALOGW("Line too long in %s%s, skipping: %s\n",
                                     UPDATE_COMMANDS_DIR_PREFIX, name, buf);
                         }
                     } else if (bufp < bufe) {
@@ -825,7 +825,7 @@
                     }
                     readlen = read(subfd, buf+bufe, PKG_PATH_MAX-bufe);
                     if (readlen < 0) {
-                        LOGW("Failure reading update commands in %s%s: %s\n",
+                        ALOGW("Failure reading update commands in %s%s: %s\n",
                                 UPDATE_COMMANDS_DIR_PREFIX, name, strerror(errno));
                         break;
                     } else if (readlen == 0) {
@@ -833,7 +833,7 @@
                     }
                     bufe += readlen;
                     buf[bufe] = 0;
-                    LOGV("Read buf: %s\n", buf);
+                    ALOGV("Read buf: %s\n", buf);
                 }
             }
             close(subfd);
@@ -852,30 +852,30 @@
 
     const size_t libdirLen = strlen(dataDir) + strlen(PKG_LIB_POSTFIX);
     if (libdirLen >= PKG_PATH_MAX) {
-        LOGE("library dir len too large");
+        ALOGE("library dir len too large");
         return -1;
     }
 
     if (snprintf(libdir, sizeof(libdir), "%s%s", dataDir, PKG_LIB_POSTFIX) != (ssize_t)libdirLen) {
-        LOGE("library dir not written successfully: %s\n", strerror(errno));
+        ALOGE("library dir not written successfully: %s\n", strerror(errno));
         return -1;
     }
 
     if (stat(dataDir, &s) < 0) return -1;
 
     if (chown(dataDir, 0, 0) < 0) {
-        LOGE("failed to chown '%s': %s\n", dataDir, strerror(errno));
+        ALOGE("failed to chown '%s': %s\n", dataDir, strerror(errno));
         return -1;
     }
 
     if (chmod(dataDir, 0700) < 0) {
-        LOGE("failed to chmod '%s': %s\n", dataDir, strerror(errno));
+        ALOGE("failed to chmod '%s': %s\n", dataDir, strerror(errno));
         rc = -1;
         goto out;
     }
 
     if (lstat(libdir, &libStat) < 0) {
-        LOGE("couldn't stat lib dir: %s\n", strerror(errno));
+        ALOGE("couldn't stat lib dir: %s\n", strerror(errno));
         rc = -1;
         goto out;
     }
@@ -893,13 +893,13 @@
     }
 
     if (symlink(asecLibDir, libdir) < 0) {
-        LOGE("couldn't symlink directory '%s' -> '%s': %s\n", libdir, asecLibDir, strerror(errno));
+        ALOGE("couldn't symlink directory '%s' -> '%s': %s\n", libdir, asecLibDir, strerror(errno));
         rc = -errno;
         goto out;
     }
 
     if (lchown(libdir, AID_SYSTEM, AID_SYSTEM) < 0) {
-        LOGE("cannot chown dir '%s': %s\n", libdir, strerror(errno));
+        ALOGE("cannot chown dir '%s': %s\n", libdir, strerror(errno));
         unlink(libdir);
         rc = -errno;
         goto out;
@@ -907,12 +907,12 @@
 
 out:
     if (chmod(dataDir, s.st_mode) < 0) {
-        LOGE("failed to chmod '%s': %s\n", dataDir, strerror(errno));
+        ALOGE("failed to chmod '%s': %s\n", dataDir, strerror(errno));
         return -errno;
     }
 
     if (chown(dataDir, s.st_uid, s.st_gid) < 0) {
-        LOGE("failed to chown '%s' : %s\n", dataDir, strerror(errno));
+        ALOGE("failed to chown '%s' : %s\n", dataDir, strerror(errno));
         return -errno;
     }
 
@@ -931,28 +931,28 @@
     }
 
     if (snprintf(libdir, sizeof(libdir), "%s%s", dataDir, PKG_LIB_POSTFIX) != (ssize_t)libdirLen) {
-        LOGE("library dir not written successfully: %s\n", strerror(errno));
+        ALOGE("library dir not written successfully: %s\n", strerror(errno));
         return -1;
     }
 
     if (stat(dataDir, &s) < 0) {
-        LOGE("couldn't state data dir");
+        ALOGE("couldn't state data dir");
         return -1;
     }
 
     if (chown(dataDir, 0, 0) < 0) {
-        LOGE("failed to chown '%s': %s\n", dataDir, strerror(errno));
+        ALOGE("failed to chown '%s': %s\n", dataDir, strerror(errno));
         return -1;
     }
 
     if (chmod(dataDir, 0700) < 0) {
-        LOGE("failed to chmod '%s': %s\n", dataDir, strerror(errno));
+        ALOGE("failed to chmod '%s': %s\n", dataDir, strerror(errno));
         rc = -1;
         goto out;
     }
 
     if (lstat(libdir, &libStat) < 0) {
-        LOGE("couldn't stat lib dir: %s\n", strerror(errno));
+        ALOGE("couldn't stat lib dir: %s\n", strerror(errno));
         rc = -1;
         goto out;
     }
@@ -970,13 +970,13 @@
     }
 
     if (mkdir(libdir, 0755) < 0) {
-        LOGE("cannot create dir '%s': %s\n", libdir, strerror(errno));
+        ALOGE("cannot create dir '%s': %s\n", libdir, strerror(errno));
         rc = -errno;
         goto out;
     }
 
     if (chown(libdir, AID_SYSTEM, AID_SYSTEM) < 0) {
-        LOGE("cannot chown dir '%s': %s\n", libdir, strerror(errno));
+        ALOGE("cannot chown dir '%s': %s\n", libdir, strerror(errno));
         unlink(libdir);
         rc = -errno;
         goto out;
@@ -984,12 +984,12 @@
 
 out:
     if (chmod(dataDir, s.st_mode) < 0) {
-        LOGE("failed to chmod '%s': %s\n", dataDir, strerror(errno));
+        ALOGE("failed to chmod '%s': %s\n", dataDir, strerror(errno));
         return -1;
     }
 
     if (chown(dataDir, s.st_uid, s.st_gid) < 0) {
-        LOGE("failed to chown '%s' : %s\n", dataDir, strerror(errno));
+        ALOGE("failed to chown '%s' : %s\n", dataDir, strerror(errno));
         return -1;
     }
 
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index feb6b92..569b491 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -157,11 +157,11 @@
         r = read(s, buf + n, count - n);
         if (r < 0) {
             if (errno == EINTR) continue;
-            LOGE("read error: %s\n", strerror(errno));
+            ALOGE("read error: %s\n", strerror(errno));
             return -1;
         }
         if (r == 0) {
-            LOGE("eof\n");
+            ALOGE("eof\n");
             return -1; /* EOF */
         }
         n += r;
@@ -178,7 +178,7 @@
         r = write(s, buf + n, count - n);
         if (r < 0) {
             if (errno == EINTR) continue;
-            LOGE("write error: %s\n", strerror(errno));
+            ALOGE("write error: %s\n", strerror(errno));
             return -1;
         }
         n += r;
@@ -200,7 +200,7 @@
     unsigned short count;
     int ret = -1;
 
-//    LOGI("execute('%s')\n", cmd);
+//    ALOGI("execute('%s')\n", cmd);
 
         /* default reply is "" */
     reply[0] = 0;
@@ -213,7 +213,7 @@
             n++;
             arg[n] = cmd;
             if (n == TOKEN_MAX) {
-                LOGE("too many arguments\n");
+                ALOGE("too many arguments\n");
                 goto done;
             }
         }
@@ -223,7 +223,7 @@
     for (i = 0; i < sizeof(cmds) / sizeof(cmds[0]); i++) {
         if (!strcmp(cmds[i].name,arg[0])) {
             if (n != cmds[i].numargs) {
-                LOGE("%s requires %d arguments (%d given)\n",
+                ALOGE("%s requires %d arguments (%d given)\n",
                      cmds[i].name, cmds[i].numargs, n);
             } else {
                 ret = cmds[i].func(arg + 1, reply);
@@ -231,7 +231,7 @@
             goto done;
         }
     }
-    LOGE("unsupported command '%s'\n", arg[0]);
+    ALOGE("unsupported command '%s'\n", arg[0]);
 
 done:
     if (reply[0]) {
@@ -242,7 +242,7 @@
     if (n > BUFFER_MAX) n = BUFFER_MAX;
     count = n;
 
-//    LOGI("reply: '%s'\n", cmd);
+//    ALOGI("reply: '%s'\n", cmd);
     if (writex(s, &count, sizeof(count))) return -1;
     if (writex(s, cmd, count)) return -1;
     return 0;
@@ -290,7 +290,7 @@
 
     android_system_dirs.dirs = calloc(android_system_dirs.count, sizeof(dir_rec_t));
     if (android_system_dirs.dirs == NULL) {
-        LOGE("Couldn't allocate array for dirs; aborting\n");
+        ALOGE("Couldn't allocate array for dirs; aborting\n");
         return -1;
     }
 
@@ -351,22 +351,22 @@
     int lsocket, s, count;
 
     if (initialize_globals() < 0) {
-        LOGE("Could not initialize globals; exiting.\n");
+        ALOGE("Could not initialize globals; exiting.\n");
         exit(1);
     }
 
     if (initialize_directories() < 0) {
-        LOGE("Could not create directories; exiting.\n");
+        ALOGE("Could not create directories; exiting.\n");
         exit(1);
     }
 
     lsocket = android_get_control_socket(SOCKET_PATH);
     if (lsocket < 0) {
-        LOGE("Failed to get socket from environment: %s\n", strerror(errno));
+        ALOGE("Failed to get socket from environment: %s\n", strerror(errno));
         exit(1);
     }
     if (listen(lsocket, 5)) {
-        LOGE("Listen on socket failed: %s\n", strerror(errno));
+        ALOGE("Listen on socket failed: %s\n", strerror(errno));
         exit(1);
     }
     fcntl(lsocket, F_SETFD, FD_CLOEXEC);
@@ -375,30 +375,30 @@
         alen = sizeof(addr);
         s = accept(lsocket, &addr, &alen);
         if (s < 0) {
-            LOGE("Accept failed: %s\n", strerror(errno));
+            ALOGE("Accept failed: %s\n", strerror(errno));
             continue;
         }
         fcntl(s, F_SETFD, FD_CLOEXEC);
 
-        LOGI("new connection\n");
+        ALOGI("new connection\n");
         for (;;) {
             unsigned short count;
             if (readx(s, &count, sizeof(count))) {
-                LOGE("failed to read size\n");
+                ALOGE("failed to read size\n");
                 break;
             }
             if ((count < 1) || (count >= BUFFER_MAX)) {
-                LOGE("invalid size %d\n", count);
+                ALOGE("invalid size %d\n", count);
                 break;
             }
             if (readx(s, buf, count)) {
-                LOGE("failed to read command\n");
+                ALOGE("failed to read command\n");
                 break;
             }
             buf[count] = 0;
             if (execute(s, buf)) break;
         }
-        LOGI("closing connection\n");
+        ALOGI("closing connection\n");
         close(s);
     }
 
diff --git a/cmds/installd/utils.c b/cmds/installd/utils.c
index a53a93c..52ec9e8 100644
--- a/cmds/installd/utils.c
+++ b/cmds/installd/utils.c
@@ -42,7 +42,7 @@
      if (append_and_increment(&dst, dir->path, &dst_size) < 0
              || append_and_increment(&dst, pkgname, &dst_size) < 0
              || append_and_increment(&dst, postfix, &dst_size) < 0) {
-         LOGE("Error building APK path");
+         ALOGE("Error building APK path");
          return -1;
      }
 
@@ -76,14 +76,14 @@
 
     if (append_and_increment(&dst, android_data_dir.path, &dst_size) < 0
             || append_and_increment(&dst, persona_prefix, &dst_size) < 0) {
-        LOGE("Error building prefix for APK path");
+        ALOGE("Error building prefix for APK path");
         return -1;
     }
 
     if (persona != 0) {
         int ret = snprintf(dst, dst_size, "%d/", persona);
         if (ret < 0 || (size_t) ret != uid_len + 1) {
-            LOGW("Error appending UID to APK path");
+            ALOGW("Error appending UID to APK path");
             return -1;
         }
     }
@@ -117,18 +117,18 @@
 
     if (append_and_increment(&dst, android_data_dir.path, &dst_size) < 0
             || append_and_increment(&dst, persona_prefix, &dst_size) < 0) {
-        LOGE("Error building prefix for user path");
+        ALOGE("Error building prefix for user path");
         return -1;
     }
 
     if (persona != 0) {
         if (dst_size < uid_len + 1) {
-            LOGE("Error building user path");
+            ALOGE("Error building user path");
             return -1;
         }
         int ret = snprintf(dst, dst_size, "%d/", persona);
         if (ret < 0 || (size_t) ret != uid_len) {
-            LOGE("Error appending persona id to path");
+            ALOGE("Error appending persona id to path");
             return -1;
         }
     }
@@ -163,7 +163,7 @@
         } else if (*x == '.') {
             if ((x == pkgname) || (x[1] == '.') || (x[1] == 0)) {
                     /* periods must not be first, last, or doubled */
-                LOGE("invalid package name '%s'\n", pkgname);
+                ALOGE("invalid package name '%s'\n", pkgname);
                 return -1;
             }
         } else if (*x == '-') {
@@ -172,7 +172,7 @@
             alpha = 1;
         } else {
                 /* anything not A-Z, a-z, 0-9, _, or . is invalid */
-            LOGE("invalid package name '%s'\n", pkgname);
+            ALOGE("invalid package name '%s'\n", pkgname);
             return -1;
         }
 
@@ -184,7 +184,7 @@
         x++;
         while (*x) {
             if (!isalnum(*x)) {
-                LOGE("invalid package name '%s' should include only numbers after -\n", pkgname);
+                ALOGE("invalid package name '%s' should include only numbers after -\n", pkgname);
                 return -1;
             }
             x++;
@@ -222,13 +222,13 @@
 
             subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY);
             if (subfd < 0) {
-                LOGE("Couldn't openat %s: %s\n", name, strerror(errno));
+                ALOGE("Couldn't openat %s: %s\n", name, strerror(errno));
                 result = -1;
                 continue;
             }
             subdir = fdopendir(subfd);
             if (subdir == NULL) {
-                LOGE("Couldn't fdopendir %s: %s\n", name, strerror(errno));
+                ALOGE("Couldn't fdopendir %s: %s\n", name, strerror(errno));
                 close(subfd);
                 result = -1;
                 continue;
@@ -238,12 +238,12 @@
             }
             closedir(subdir);
             if (unlinkat(dfd, name, AT_REMOVEDIR) < 0) {
-                LOGE("Couldn't unlinkat %s: %s\n", name, strerror(errno));
+                ALOGE("Couldn't unlinkat %s: %s\n", name, strerror(errno));
                 result = -1;
             }
         } else {
             if (unlinkat(dfd, name, 0) < 0) {
-                LOGE("Couldn't unlinkat %s: %s\n", name, strerror(errno));
+                ALOGE("Couldn't unlinkat %s: %s\n", name, strerror(errno));
                 result = -1;
             }
         }
@@ -261,14 +261,14 @@
 
     d = opendir(pathname);
     if (d == NULL) {
-        LOGE("Couldn't opendir %s: %s\n", pathname, strerror(errno));
+        ALOGE("Couldn't opendir %s: %s\n", pathname, strerror(errno));
         return -errno;
     }
     res = _delete_dir_contents(d, ignore);
     closedir(d);
     if (also_delete_dir) {
         if (rmdir(pathname)) {
-            LOGE("Couldn't rmdir %s: %s\n", pathname, strerror(errno));
+            ALOGE("Couldn't rmdir %s: %s\n", pathname, strerror(errno));
             res = -1;
         }
     }
@@ -282,12 +282,12 @@
 
     fd = openat(dfd, name, O_RDONLY | O_DIRECTORY);
     if (fd < 0) {
-        LOGE("Couldn't openat %s: %s\n", name, strerror(errno));
+        ALOGE("Couldn't openat %s: %s\n", name, strerror(errno));
         return -1;
     }
     d = fdopendir(fd);
     if (d == NULL) {
-        LOGE("Couldn't fdopendir %s: %s\n", name, strerror(errno));
+        ALOGE("Couldn't fdopendir %s: %s\n", name, strerror(errno));
         close(fd);
         return -1;
     }
@@ -307,7 +307,7 @@
         const size_t dir_len = android_system_dirs.dirs[i].len;
         if (!strncmp(path, android_system_dirs.dirs[i].path, dir_len)) {
             if (path[dir_len] == '.' || strchr(path + dir_len, '/') != NULL) {
-                LOGE("invalid system apk path '%s' (trickery)\n", path);
+                ALOGE("invalid system apk path '%s' (trickery)\n", path);
                 return -1;
             }
             return 0;
@@ -326,7 +326,7 @@
     const char* path = getenv(var);
     int ret = get_path_from_string(rec, path);
     if (ret < 0) {
-        LOGW("Problem finding value for environment variable %s\n", var);
+        ALOGW("Problem finding value for environment variable %s\n", var);
     }
     return ret;
 }
@@ -377,7 +377,7 @@
 
             if (append_and_increment(&dst, path, &dst_size) < 0
                     || append_and_increment(&dst, "/", &dst_size)) {
-                LOGE("Error canonicalizing path");
+                ALOGE("Error canonicalizing path");
                 return -1;
             }
 
@@ -395,7 +395,7 @@
     if (dst->path == NULL
             || snprintf(dst->path, dstSize, "%s%s", src->path, suffix)
                     != (ssize_t) dst->len) {
-        LOGE("Could not allocate memory to hold appended path; aborting\n");
+        ALOGE("Could not allocate memory to hold appended path; aborting\n");
         return -1;
     }
 
@@ -422,7 +422,7 @@
         dir_len = android_asec_dir.len;
         allowsubdir = 1;
     } else {
-        LOGE("invalid apk path '%s' (bad prefix)\n", path);
+        ALOGE("invalid apk path '%s' (bad prefix)\n", path);
         return -1;
     }
 
@@ -435,7 +435,7 @@
         ++subdir;
         if (!allowsubdir
                 || (path_len > (size_t) (subdir - path) && (strchr(subdir, '/') != NULL))) {
-            LOGE("invalid apk path '%s' (subdir?)\n", path);
+            ALOGE("invalid apk path '%s' (subdir?)\n", path);
             return -1;
         }
     }
@@ -446,7 +446,7 @@
      */
     if (path[dir_len] == '.'
             || (subdir != NULL && ((*subdir == '.') || (strchr(subdir, '/') != NULL)))) {
-        LOGE("invalid apk path '%s' (trickery)\n", path);
+        ALOGE("invalid apk path '%s' (trickery)\n", path);
         return -1;
     }
 
diff --git a/cmds/ip-up-vpn/ip-up-vpn.c b/cmds/ip-up-vpn/ip-up-vpn.c
index 0e6286f..9fcc950 100644
--- a/cmds/ip-up-vpn/ip-up-vpn.c
+++ b/cmds/ip-up-vpn/ip-up-vpn.c
@@ -67,7 +67,7 @@
 {
     FILE *state = fopen(DIR ".tmp", "wb");
     if (!state) {
-        LOGE("Cannot create state: %s", strerror(errno));
+        ALOGE("Cannot create state: %s", strerror(errno));
         return 1;
     }
 
@@ -97,7 +97,7 @@
             while (!ioctl(s, SIOCDELRT, &rt));
         }
         if (errno != ESRCH) {
-            LOGE("Cannot remove host route: %s", strerror(errno));
+            ALOGE("Cannot remove host route: %s", strerror(errno));
             return 1;
         }
 
@@ -105,7 +105,7 @@
         rt.rt_flags |= RTF_GATEWAY;
         if (!set_address(&rt.rt_gateway, argv[1]) ||
                 (ioctl(s, SIOCADDRT, &rt) && errno != EEXIST)) {
-            LOGE("Cannot create host route: %s", strerror(errno));
+            ALOGE("Cannot create host route: %s", strerror(errno));
             return 1;
         }
 
@@ -113,21 +113,21 @@
         ifr.ifr_flags = IFF_UP;
         strncpy(ifr.ifr_name, interface, IFNAMSIZ);
         if (ioctl(s, SIOCSIFFLAGS, &ifr)) {
-            LOGE("Cannot bring up %s: %s", interface, strerror(errno));
+            ALOGE("Cannot bring up %s: %s", interface, strerror(errno));
             return 1;
         }
 
         /* Set the address. */
         if (!set_address(&ifr.ifr_addr, address) ||
                 ioctl(s, SIOCSIFADDR, &ifr)) {
-            LOGE("Cannot set address: %s", strerror(errno));
+            ALOGE("Cannot set address: %s", strerror(errno));
             return 1;
         }
 
         /* Set the netmask. */
         if (set_address(&ifr.ifr_netmask, env("INTERNAL_NETMASK4"))) {
             if (ioctl(s, SIOCSIFNETMASK, &ifr)) {
-                LOGE("Cannot set netmask: %s", strerror(errno));
+                ALOGE("Cannot set netmask: %s", strerror(errno));
                 return 1;
             }
         }
@@ -140,13 +140,13 @@
         fprintf(state, "%s\n", env("INTERNAL_DNS4_LIST"));
         fprintf(state, "%s\n", env("DEFAULT_DOMAIN"));
     } else {
-        LOGE("Cannot parse parameters");
+        ALOGE("Cannot parse parameters");
         return 1;
     }
 
     fclose(state);
     if (chmod(DIR ".tmp", 0444) || rename(DIR ".tmp", DIR "state")) {
-        LOGE("Cannot write state: %s", strerror(errno));
+        ALOGE("Cannot write state: %s", strerror(errno));
         return 1;
     }
     return 0;
diff --git a/cmds/keystore/keystore.cpp b/cmds/keystore/keystore.cpp
index 4b4b9b9..05f77e5 100644
--- a/cmds/keystore/keystore.cpp
+++ b/cmds/keystore/keystore.cpp
@@ -133,7 +133,7 @@
         const char* randomDevice = "/dev/urandom";
         mRandom = ::open(randomDevice, O_RDONLY);
         if (mRandom == -1) {
-            LOGE("open: %s: %s", randomDevice, strerror(errno));
+            ALOGE("open: %s: %s", randomDevice, strerror(errno));
             return false;
         }
         return true;
@@ -754,11 +754,11 @@
 int main(int argc, char* argv[]) {
     int controlSocket = android_get_control_socket("keystore");
     if (argc < 2) {
-        LOGE("A directory must be specified!");
+        ALOGE("A directory must be specified!");
         return 1;
     }
     if (chdir(argv[1]) == -1) {
-        LOGE("chdir: %s: %s", argv[1], strerror(errno));
+        ALOGE("chdir: %s: %s", argv[1], strerror(errno));
         return 1;
     }
 
@@ -767,7 +767,7 @@
         return 1;
     }
     if (listen(controlSocket, 3) == -1) {
-        LOGE("listen: %s", strerror(errno));
+        ALOGE("listen: %s", strerror(errno));
         return 1;
     }
 
@@ -785,7 +785,7 @@
         socklen_t size = sizeof(cred);
         int credResult = getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &cred, &size);
         if (credResult != 0) {
-            LOGW("getsockopt: %s", strerror(errno));
+            ALOGW("getsockopt: %s", strerror(errno));
         } else {
             int8_t request;
             if (recv_code(sock, &request)) {
@@ -796,7 +796,7 @@
                 } else {
                     send_code(sock, response);
                 }
-                LOGI("uid: %d action: %c -> %d state: %d -> %d retry: %d",
+                ALOGI("uid: %d action: %c -> %d state: %d -> %d retry: %d",
                      cred.uid,
                      request, response,
                      old_state, keyStore.getState(),
@@ -805,6 +805,6 @@
         }
         close(sock);
     }
-    LOGE("accept: %s", strerror(errno));
+    ALOGE("accept: %s", strerror(errno));
     return 1;
 }
diff --git a/cmds/screencap/screencap.cpp b/cmds/screencap/screencap.cpp
index 7a599e9..bee5880 100644
--- a/cmds/screencap/screencap.cpp
+++ b/cmds/screencap/screencap.cpp
@@ -28,6 +28,7 @@
 
 #include <SkImageEncoder.h>
 #include <SkBitmap.h>
+#include <SkData.h>
 #include <SkStream.h>
 
 using namespace android;
@@ -168,7 +169,9 @@
             SkDynamicMemoryWStream stream;
             SkImageEncoder::EncodeStream(&stream, b,
                     SkImageEncoder::kPNG_Type, SkImageEncoder::kDefaultQuality);
-            write(fd, stream.getStream(), stream.getOffset());
+            SkData* streamData = stream.copyToData();
+            write(fd, streamData->data(), streamData->size());
+            streamData->unref();
         } else {
             write(fd, &w, 4);
             write(fd, &h, 4);
diff --git a/cmds/screenshot/screenshot.c b/cmds/screenshot/screenshot.c
index 048636c..cca80c3 100644
--- a/cmds/screenshot/screenshot.c
+++ b/cmds/screenshot/screenshot.c
@@ -26,20 +26,20 @@
 
     fb = fileno(fb_in);
     if(fb < 0) {
-        LOGE("failed to open framebuffer\n");
+        ALOGE("failed to open framebuffer\n");
         return;
     }
     fb_in = fdopen(fb, "r");
 
     if(ioctl(fb, FBIOGET_VSCREENINFO, &vinfo) < 0) {
-        LOGE("failed to get framebuffer info\n");
+        ALOGE("failed to get framebuffer info\n");
         return;
     }
     fcntl(fb, F_SETFD, FD_CLOEXEC);
 
     png = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
     if (png == NULL) {
-        LOGE("failed png_create_write_struct\n");
+        ALOGE("failed png_create_write_struct\n");
         fclose(fb_in);
         return;
     }
@@ -47,13 +47,13 @@
     png_init_io(png, fb_out);
     info = png_create_info_struct(png);
     if (info == NULL) {
-        LOGE("failed png_create_info_struct\n");
+        ALOGE("failed png_create_info_struct\n");
         png_destroy_write_struct(&png, NULL);
         fclose(fb_in);
         return;
     }
     if (setjmp(png_jmpbuf(png))) {
-        LOGE("failed png setjmp\n");
+        ALOGE("failed png setjmp\n");
         png_destroy_write_struct(&png, NULL);
         fclose(fb_in);
         return;
@@ -68,7 +68,7 @@
 
     rowlen=vinfo.xres * bytespp;
     if (rowlen > sizeof(imgbuf)) {
-        LOGE("crazy rowlen: %d\n", rowlen);
+        ALOGE("crazy rowlen: %d\n", rowlen);
         png_destroy_write_struct(&png, NULL);
         fclose(fb_in);
         return;
diff --git a/cmds/servicemanager/binder.c b/cmds/servicemanager/binder.c
index b03b620..918d4d4 100644
--- a/cmds/servicemanager/binder.c
+++ b/cmds/servicemanager/binder.c
@@ -219,7 +219,7 @@
         case BR_TRANSACTION: {
             struct binder_txn *txn = (void *) ptr;
             if ((end - ptr) * sizeof(uint32_t) < sizeof(struct binder_txn)) {
-                LOGE("parse: txn too small!\n");
+                ALOGE("parse: txn too small!\n");
                 return -1;
             }
             binder_dump_txn(txn);
@@ -240,7 +240,7 @@
         case BR_REPLY: {
             struct binder_txn *txn = (void*) ptr;
             if ((end - ptr) * sizeof(uint32_t) < sizeof(struct binder_txn)) {
-                LOGE("parse: reply too small!\n");
+                ALOGE("parse: reply too small!\n");
                 return -1;
             }
             binder_dump_txn(txn);
@@ -266,7 +266,7 @@
             r = -1;
             break;
         default:
-            LOGE("parse: OOPS %d\n", cmd);
+            ALOGE("parse: OOPS %d\n", cmd);
             return -1;
         }
     }
@@ -375,17 +375,17 @@
         res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr);
 
         if (res < 0) {
-            LOGE("binder_loop: ioctl failed (%s)\n", strerror(errno));
+            ALOGE("binder_loop: ioctl failed (%s)\n", strerror(errno));
             break;
         }
 
         res = binder_parse(bs, 0, readbuf, bwr.read_consumed, func);
         if (res == 0) {
-            LOGE("binder_loop: unexpected reply?!\n");
+            ALOGE("binder_loop: unexpected reply?!\n");
             break;
         }
         if (res < 0) {
-            LOGE("binder_loop: io error %d %s\n", res, strerror(errno));
+            ALOGE("binder_loop: io error %d %s\n", res, strerror(errno));
             break;
         }
     }
diff --git a/cmds/servicemanager/service_manager.c b/cmds/servicemanager/service_manager.c
index 2df450f3..42d8977 100644
--- a/cmds/servicemanager/service_manager.c
+++ b/cmds/servicemanager/service_manager.c
@@ -11,8 +11,8 @@
 #include "binder.h"
 
 #if 0
-#define LOGI(x...) fprintf(stderr, "svcmgr: " x)
-#define LOGE(x...) fprintf(stderr, "svcmgr: " x)
+#define ALOGI(x...) fprintf(stderr, "svcmgr: " x)
+#define ALOGE(x...) fprintf(stderr, "svcmgr: " x)
 #else
 #define LOG_TAG "ServiceManager"
 #include <cutils/log.h>
@@ -115,7 +115,7 @@
 void svcinfo_death(struct binder_state *bs, void *ptr)
 {
     struct svcinfo *si = ptr;
-    LOGI("service '%s' died\n", str8(si->name));
+    ALOGI("service '%s' died\n", str8(si->name));
     if (si->ptr) {
         binder_release(bs, si->ptr);
         si->ptr = 0;
@@ -133,7 +133,7 @@
     struct svcinfo *si;
     si = find_svc(s, len);
 
-//    LOGI("check_service('%s') ptr = %p\n", str8(s), si ? si->ptr : 0);
+//    ALOGI("check_service('%s') ptr = %p\n", str8(s), si ? si->ptr : 0);
     if (si && si->ptr) {
         return si->ptr;
     } else {
@@ -146,13 +146,13 @@
                    void *ptr, unsigned uid)
 {
     struct svcinfo *si;
-//    LOGI("add_service('%s',%p) uid=%d\n", str8(s), ptr, uid);
+//    ALOGI("add_service('%s',%p) uid=%d\n", str8(s), ptr, uid);
 
     if (!ptr || (len == 0) || (len > 127))
         return -1;
 
     if (!svc_can_register(uid, s)) {
-        LOGE("add_service('%s',%p) uid=%d - PERMISSION DENIED\n",
+        ALOGE("add_service('%s',%p) uid=%d - PERMISSION DENIED\n",
              str8(s), ptr, uid);
         return -1;
     }
@@ -160,7 +160,7 @@
     si = find_svc(s, len);
     if (si) {
         if (si->ptr) {
-            LOGE("add_service('%s',%p) uid=%d - ALREADY REGISTERED, OVERRIDE\n",
+            ALOGE("add_service('%s',%p) uid=%d - ALREADY REGISTERED, OVERRIDE\n",
                  str8(s), ptr, uid);
             svcinfo_death(bs, si);
         }
@@ -168,7 +168,7 @@
     } else {
         si = malloc(sizeof(*si) + (len + 1) * sizeof(uint16_t));
         if (!si) {
-            LOGE("add_service('%s',%p) uid=%d - OUT OF MEMORY\n",
+            ALOGE("add_service('%s',%p) uid=%d - OUT OF MEMORY\n",
                  str8(s), ptr, uid);
             return -1;
         }
@@ -198,7 +198,7 @@
     void *ptr;
     uint32_t strict_policy;
 
-//    LOGI("target=%p code=%d pid=%d uid=%d\n",
+//    ALOGI("target=%p code=%d pid=%d uid=%d\n",
 //         txn->target, txn->code, txn->sender_pid, txn->sender_euid);
 
     if (txn->target != svcmgr_handle)
@@ -246,7 +246,7 @@
         return -1;
     }
     default:
-        LOGE("unknown code %d\n", txn->code);
+        ALOGE("unknown code %d\n", txn->code);
         return -1;
     }
 
@@ -262,7 +262,7 @@
     bs = binder_open(128*1024);
 
     if (binder_become_context_manager(bs)) {
-        LOGE("cannot become context manager (%s)\n", strerror(errno));
+        ALOGE("cannot become context manager (%s)\n", strerror(errno));
         return -1;
     }
 
diff --git a/cmds/stagefright/record.cpp b/cmds/stagefright/record.cpp
index b718299..613435d 100644
--- a/cmds/stagefright/record.cpp
+++ b/cmds/stagefright/record.cpp
@@ -96,7 +96,7 @@
         ++mNumFramesOutput;
 
         // printf("DummySource::read - returning buffer\n");
-        // LOGI("DummySource::read - returning buffer");
+        // ALOGI("DummySource::read - returning buffer");
         return OK;
     }
 
diff --git a/cmds/stagefright/sf2.cpp b/cmds/stagefright/sf2.cpp
index f547e01..ae80f88 100644
--- a/cmds/stagefright/sf2.cpp
+++ b/cmds/stagefright/sf2.cpp
@@ -454,7 +454,7 @@
 
                 if (sizeNeeded > sizeLeft) {
                     if (outBuffer->size() == 0) {
-                        LOGE("Unable to fit even a single input buffer of size %d.",
+                        ALOGE("Unable to fit even a single input buffer of size %d.",
                              sizeNeeded);
                     }
                     CHECK_GT(outBuffer->size(), 0u);
@@ -500,7 +500,7 @@
                 break;  // Don't coalesce
             }
 
-            LOGV("coalesced %d input buffers", n);
+            ALOGV("coalesced %d input buffers", n);
 
             if (outBuffer->size() == 0) {
                 CHECK_NE(mFinalResult, (status_t)OK);
diff --git a/cmds/stagefright/stream.cpp b/cmds/stagefright/stream.cpp
index bd430d1..0d6c738 100644
--- a/cmds/stagefright/stream.cpp
+++ b/cmds/stagefright/stream.cpp
@@ -90,7 +90,7 @@
 
 #if 0
     if (mNumPacketsSent >= 20000) {
-        LOGI("signalling discontinuity now");
+        ALOGI("signalling discontinuity now");
 
         off64_t offset = 0;
         CHECK((offset % 188) == 0);
@@ -308,7 +308,7 @@
     ssize_t displayWidth = composerClient->getDisplayWidth(0);
     ssize_t displayHeight = composerClient->getDisplayHeight(0);
 
-    LOGV("display is %d x %d\n", displayWidth, displayHeight);
+    ALOGV("display is %d x %d\n", displayWidth, displayHeight);
 
     sp<SurfaceControl> control =
         composerClient->createSurface(
diff --git a/cmds/system_server/library/system_init.cpp b/cmds/system_server/library/system_init.cpp
index 59360d3..bfbc138 100644
--- a/cmds/system_server/library/system_init.cpp
+++ b/cmds/system_server/library/system_init.cpp
@@ -42,7 +42,7 @@
 
     virtual void binderDied(const wp<IBinder>& who)
     {
-        LOGI("Grim Reaper killing system_server...");
+        ALOGI("Grim Reaper killing system_server...");
         kill(getpid(), SIGKILL);
     }
 };
@@ -53,12 +53,12 @@
 
 extern "C" status_t system_init()
 {
-    LOGI("Entered system_init()");
+    ALOGI("Entered system_init()");
 
     sp<ProcessState> proc(ProcessState::self());
 
     sp<IServiceManager> sm = defaultServiceManager();
-    LOGI("ServiceManager: %p\n", sm.get());
+    ALOGI("ServiceManager: %p\n", sm.get());
 
     sp<GrimReaper> grim = new GrimReaper();
     sm->asBinder()->linkToDeath(grim, grim.get(), 0);
@@ -82,10 +82,10 @@
     // All other servers should just start the Android runtime at
     // the beginning of their processes's main(), before calling
     // the init function.
-    LOGI("System server: starting Android runtime.\n");
+    ALOGI("System server: starting Android runtime.\n");
     AndroidRuntime* runtime = AndroidRuntime::getRuntime();
 
-    LOGI("System server: starting Android services.\n");
+    ALOGI("System server: starting Android services.\n");
     JNIEnv* env = runtime->getJNIEnv();
     if (env == NULL) {
         return UNKNOWN_ERROR;
@@ -100,10 +100,10 @@
     }
     env->CallStaticVoidMethod(clazz, methodId);
 
-    LOGI("System server: entering thread pool.\n");
+    ALOGI("System server: entering thread pool.\n");
     ProcessState::self()->startThreadPool();
     IPCThreadState::self()->joinThreadPool();
-    LOGI("System server: exiting thread pool.\n");
+    ALOGI("System server: exiting thread pool.\n");
 
     return NO_ERROR;
 }
diff --git a/cmds/system_server/system_main.cpp b/cmds/system_server/system_main.cpp
index d67329d..ddff065 100644
--- a/cmds/system_server/system_main.cpp
+++ b/cmds/system_server/system_main.cpp
@@ -44,12 +44,12 @@
 
 int main(int argc, const char* const argv[])
 {
-    LOGI("System server is starting with pid=%d.\n", getpid());
+    ALOGI("System server is starting with pid=%d.\n", getpid());
 
     blockSignals();
     
     // You can trust me, honestly!
-    LOGW("*** Current priority: %d\n", getpriority(PRIO_PROCESS, 0));
+    ALOGW("*** Current priority: %d\n", getpriority(PRIO_PROCESS, 0));
     setpriority(PRIO_PROCESS, 0, -1);
 
     system_init();    
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index cc3219b..780ec11 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -1030,7 +1030,8 @@
     }
 
     /**
-     * Notify registered observers that a row was updated.
+     * Notify registered observers that a row was updated and attempt to sync changes
+     * to the network.
      * To register, call {@link #registerContentObserver(android.net.Uri , boolean, android.database.ContentObserver) registerContentObserver()}.
      * By default, CursorAdapter objects will get this notification.
      *
@@ -1045,10 +1046,14 @@
      * Notify registered observers that a row was updated.
      * To register, call {@link #registerContentObserver(android.net.Uri , boolean, android.database.ContentObserver) registerContentObserver()}.
      * By default, CursorAdapter objects will get this notification.
+     * If syncToNetwork is true, this will attempt to schedule a local sync using the sync
+     * adapter that's registered for the authority of the provided uri. No account will be
+     * passed to the sync adapter, so all matching accounts will be synchronized.
      *
      * @param uri
      * @param observer The observer that originated the change, may be <code>null</null>
      * @param syncToNetwork If true, attempt to sync the change to the network.
+     * @see #requestSync(android.accounts.Account, String, android.os.Bundle)
      */
     public void notifyChange(Uri uri, ContentObserver observer, boolean syncToNetwork) {
         try {
diff --git a/core/java/android/view/GestureDetector.java b/core/java/android/view/GestureDetector.java
old mode 100644
new mode 100755
index a496a9e..5c8b236
--- a/core/java/android/view/GestureDetector.java
+++ b/core/java/android/view/GestureDetector.java
@@ -193,8 +193,7 @@
         }
     }
 
-    // TODO: ViewConfiguration
-    private int mBiggerTouchSlopSquare = 20 * 20;
+    private int mBiggerTouchSlopSquare;
 
     private int mTouchSlopSquare;
     private int mDoubleTapSlopSquare;
@@ -408,6 +407,14 @@
         }
         mTouchSlopSquare = touchSlop * touchSlop;
         mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
+
+        // The biggerTouchSlop should be a little bit bigger than touchSlop
+        // and mBiggerTouchSlopSquare should not be over mDoubleTapSlopSquare.
+        int biggerTouchSlop = (int)(touchSlop * 1.25f);
+        mBiggerTouchSlopSquare = biggerTouchSlop * biggerTouchSlop;
+        if (mBiggerTouchSlopSquare > mDoubleTapSlopSquare) {
+            mBiggerTouchSlopSquare = mDoubleTapSlopSquare;
+        }
     }
 
     /**
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index 66fca80..a810cf6 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -869,6 +869,7 @@
         loader.setCacheMode(headers.containsKey("If-Modified-Since")
                 || headers.containsKey("If-None-Match") ? 
                         WebSettings.LOAD_NO_CACHE : cacheMode);
+        loader.executeLoad();
         // Set referrer to current URL?
         return !synchronous ? loadListener : null;
     }
diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java
index 427fd3e..e67e4bb 100644
--- a/core/java/android/widget/LinearLayout.java
+++ b/core/java/android/widget/LinearLayout.java
@@ -307,7 +307,7 @@
             if (child != null && child.getVisibility() != GONE) {
                 if (hasDividerBeforeChildAt(i)) {
                     final LayoutParams lp = (LayoutParams) child.getLayoutParams();
-                    final int top = child.getTop() - lp.topMargin;
+                    final int top = child.getTop() - lp.topMargin - mDividerHeight;
                     drawHorizontalDivider(canvas, top);
                 }
             }
@@ -334,7 +334,7 @@
             if (child != null && child.getVisibility() != GONE) {
                 if (hasDividerBeforeChildAt(i)) {
                     final LayoutParams lp = (LayoutParams) child.getLayoutParams();
-                    final int left = child.getLeft() - lp.leftMargin;
+                    final int left = child.getLeft() - lp.leftMargin - mDividerWidth;
                     drawVerticalDivider(canvas, left);
                 }
             }
diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java
index ec3790e..6499f9a 100644
--- a/core/java/android/widget/Spinner.java
+++ b/core/java/android/widget/Spinner.java
@@ -26,6 +26,7 @@
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
+import android.util.DisplayMetrics;
 import android.view.Gravity;
 import android.view.View;
 import android.view.ViewGroup;
@@ -38,13 +39,13 @@
  *
  * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-spinner.html">Spinner
  * tutorial</a>.</p>
- * 
+ *
  * @attr ref android.R.styleable#Spinner_prompt
  */
 @Widget
 public class Spinner extends AbsSpinner implements OnClickListener {
     private static final String TAG = "Spinner";
-    
+
     // Only measure this many items to get a decent max width.
     private static final int MAX_ITEMS_MEASURED = 15;
 
@@ -52,7 +53,7 @@
      * Use a dialog window for selecting spinner options.
      */
     public static final int MODE_DIALOG = 0;
-    
+
     /**
      * Use a dropdown anchored to the Spinner for selecting spinner options.
      */
@@ -732,13 +733,30 @@
 
         @Override
         public void show() {
+            final Drawable background = getBackground();
+            int bgOffset = 0;
+            if (background != null) {
+                background.getPadding(mTempRect);
+                bgOffset = -mTempRect.left;
+            } else {
+                mTempRect.left = mTempRect.right = 0;
+            }
+
             final int spinnerPaddingLeft = Spinner.this.getPaddingLeft();
             if (mDropDownWidth == WRAP_CONTENT) {
                 final int spinnerWidth = Spinner.this.getWidth();
                 final int spinnerPaddingRight = Spinner.this.getPaddingRight();
+
+                int contentWidth =  measureContentWidth(
+                        (SpinnerAdapter) mAdapter, getBackground());
+                final int contentWidthLimit = mContext.getResources()
+                        .getDisplayMetrics().widthPixels - mTempRect.left - mTempRect.right;
+                if (contentWidth > contentWidthLimit) {
+                    contentWidth = contentWidthLimit;
+                }
+
                 setContentWidth(Math.max(
-                        measureContentWidth((SpinnerAdapter) mAdapter, getBackground()),
-                        spinnerWidth - spinnerPaddingLeft - spinnerPaddingRight));
+                       contentWidth, spinnerWidth - spinnerPaddingLeft - spinnerPaddingRight));
             } else if (mDropDownWidth == MATCH_PARENT) {
                 final int spinnerWidth = Spinner.this.getWidth();
                 final int spinnerPaddingRight = Spinner.this.getPaddingRight();
@@ -746,12 +764,6 @@
             } else {
                 setContentWidth(mDropDownWidth);
             }
-            final Drawable background = getBackground();
-            int bgOffset = 0;
-            if (background != null) {
-                background.getPadding(mTempRect);
-                bgOffset = -mTempRect.left;
-            }
             setHorizontalOffset(bgOffset + spinnerPaddingLeft);
             setInputMethodMode(ListPopupWindow.INPUT_METHOD_NOT_NEEDED);
             super.show();
diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java
index afca2db..62373fc 100644
--- a/core/java/android/widget/TimePicker.java
+++ b/core/java/android/widget/TimePicker.java
@@ -212,6 +212,7 @@
                     button.requestFocus();
                     mIsAm = !mIsAm;
                     updateAmPmControl();
+                    onTimeChanged();
                 }
             });
         } else {
@@ -226,6 +227,7 @@
                     picker.requestFocus();
                     mIsAm = !mIsAm;
                     updateAmPmControl();
+                    onTimeChanged();
                 }
             });
             mAmPmSpinnerInput = (EditText) mAmPmSpinner.findViewById(R.id.numberpicker_input);
diff --git a/core/java/com/google/android/mms/ContentType.java b/core/java/com/google/android/mms/ContentType.java
index b066fad..12a1343 100644
--- a/core/java/com/google/android/mms/ContentType.java
+++ b/core/java/com/google/android/mms/ContentType.java
@@ -39,6 +39,7 @@
     public static final String IMAGE_GIF         = "image/gif";
     public static final String IMAGE_WBMP        = "image/vnd.wap.wbmp";
     public static final String IMAGE_PNG         = "image/png";
+    public static final String IMAGE_X_MS_BMP    = "image/x-ms-bmp";
 
     public static final String AUDIO_UNSPECIFIED = "audio/*";
     public static final String AUDIO_AAC         = "audio/aac";
@@ -58,6 +59,7 @@
     public static final String AUDIO_X_MPEG      = "audio/x-mpeg";
     public static final String AUDIO_X_MPG       = "audio/x-mpg";
     public static final String AUDIO_3GPP        = "audio/3gpp";
+    public static final String AUDIO_X_WAV       = "audio/x-wav";
     public static final String AUDIO_OGG         = "application/ogg";
 
     public static final String VIDEO_UNSPECIFIED = "video/*";
@@ -89,6 +91,7 @@
         sSupportedContentTypes.add(IMAGE_WBMP);
         sSupportedContentTypes.add(IMAGE_PNG);
         sSupportedContentTypes.add(IMAGE_JPG);
+        sSupportedContentTypes.add(IMAGE_X_MS_BMP);
         //supportedContentTypes.add(IMAGE_SVG); not yet supported.
 
         sSupportedContentTypes.add(AUDIO_AAC);
@@ -106,6 +109,7 @@
         sSupportedContentTypes.add(AUDIO_X_MPEG3);
         sSupportedContentTypes.add(AUDIO_X_MPEG);
         sSupportedContentTypes.add(AUDIO_X_MPG);
+        sSupportedContentTypes.add(AUDIO_X_WAV);
         sSupportedContentTypes.add(AUDIO_3GPP);
         sSupportedContentTypes.add(AUDIO_OGG);
 
@@ -127,6 +131,7 @@
         sSupportedImageTypes.add(IMAGE_WBMP);
         sSupportedImageTypes.add(IMAGE_PNG);
         sSupportedImageTypes.add(IMAGE_JPG);
+        sSupportedImageTypes.add(IMAGE_X_MS_BMP);
 
         // add supported audio types
         sSupportedAudioTypes.add(AUDIO_AAC);
@@ -145,6 +150,7 @@
         sSupportedAudioTypes.add(AUDIO_X_MPEG3);
         sSupportedAudioTypes.add(AUDIO_X_MPEG);
         sSupportedAudioTypes.add(AUDIO_X_MPG);
+        sSupportedAudioTypes.add(AUDIO_X_WAV);
         sSupportedAudioTypes.add(AUDIO_3GPP);
         sSupportedAudioTypes.add(AUDIO_OGG);
 
diff --git a/core/java/com/google/android/mms/pdu/PduComposer.java b/core/java/com/google/android/mms/pdu/PduComposer.java
index 8940945..d426f89 100644
--- a/core/java/com/google/android/mms/pdu/PduComposer.java
+++ b/core/java/com/google/android/mms/pdu/PduComposer.java
@@ -835,9 +835,7 @@
         appendOctet(PduHeaders.CONTENT_TYPE);
 
         //  Message body
-        makeMessageBody();
-
-        return PDU_COMPOSE_SUCCESS;  // Composing the message is OK
+        return makeMessageBody();
     }
 
     /**
diff --git a/core/java/com/google/android/mms/pdu/PduPersister.java b/core/java/com/google/android/mms/pdu/PduPersister.java
index c4be513..54c7e6d 100644
--- a/core/java/com/google/android/mms/pdu/PduPersister.java
+++ b/core/java/com/google/android/mms/pdu/PduPersister.java
@@ -765,7 +765,7 @@
                         Log.v(TAG, "Saving data to: " + uri);
                     }
 
-                    byte[] buffer = new byte[256];
+                    byte[] buffer = new byte[8192];
                     for (int len = 0; (len = is.read(buffer)) != -1; ) {
                         os.write(buffer, 0, len);
                     }
diff --git a/core/jni/ActivityManager.cpp b/core/jni/ActivityManager.cpp
index 0bd14fa..0f9d0bb 100644
--- a/core/jni/ActivityManager.cpp
+++ b/core/jni/ActivityManager.cpp
@@ -48,7 +48,7 @@
                 }
             } else {
                 // An exception was thrown back; fall through to return failure
-                LOGD("openContentUri(%s) caught exception %d\n",
+                ALOGD("openContentUri(%s) caught exception %d\n",
                         String8(uri).string(), exceptionCode);
             }
         }
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index c00e6c9..1c0d7cf 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -286,7 +286,7 @@
     JNIEnv* env;
     jmethodID methodId;
 
-    LOGD("Calling main entry %s", className);
+    ALOGD("Calling main entry %s", className);
 
     env = getJNIEnv();
     if (clazz == NULL || env == NULL) {
@@ -295,7 +295,7 @@
 
     methodId = env->GetStaticMethodID(clazz, "main", "([Ljava/lang/String;)V");
     if (methodId == NULL) {
-        LOGE("ERROR: could not find method %s.main(String[])\n", className);
+        ALOGE("ERROR: could not find method %s.main(String[])\n", className);
         return UNKNOWN_ERROR;
     }
 
@@ -397,7 +397,7 @@
     sigemptyset(&mask);
     sigaddset(&mask, SIGPIPE);
     if (sigprocmask(SIG_BLOCK, &mask, NULL) != 0)
-        LOGW("WARNING: SIGPIPE not blocked\n");
+        ALOGW("WARNING: SIGPIPE not blocked\n");
 }
 
 /*
@@ -416,7 +416,7 @@
     }
     strncat(language, propLang, 2);
     strncat(region, propRegn, 2);
-    //LOGD("language=%s region=%s\n", language, region);
+    //ALOGD("language=%s region=%s\n", language, region);
 }
 
 /*
@@ -629,7 +629,7 @@
         "-agentlib:jdwp=transport=dt_android_adb,suspend=n,server=y";
     mOptions.add(opt);
 
-    LOGD("CheckJNI is %s\n", checkJni ? "ON" : "OFF");
+    ALOGD("CheckJNI is %s\n", checkJni ? "ON" : "OFF");
     if (checkJni) {
         /* extended JNI checking */
         opt.optionString = "-Xcheck:jni";
@@ -704,15 +704,15 @@
         /* accept "all" to mean "all classes and packages" */
         if (strcmp(enableAssertBuf+4, "all") == 0)
             enableAssertBuf[3] = '\0';
-        LOGI("Assertions enabled: '%s'\n", enableAssertBuf);
+        ALOGI("Assertions enabled: '%s'\n", enableAssertBuf);
         opt.optionString = enableAssertBuf;
         mOptions.add(opt);
     } else {
-        LOGV("Assertions disabled\n");
+        ALOGV("Assertions disabled\n");
     }
 
     if (jniOptsBuf[10] != '\0') {
-        LOGI("JNI options: '%s'\n", jniOptsBuf);
+        ALOGI("JNI options: '%s'\n", jniOptsBuf);
         opt.optionString = jniOptsBuf;
         mOptions.add(opt);
     }
@@ -766,7 +766,7 @@
      * JNI calls.
      */
     if (JNI_CreateJavaVM(pJavaVM, pEnv, &initArgs) < 0) {
-        LOGE("JNI_CreateJavaVM failed\n");
+        ALOGE("JNI_CreateJavaVM failed\n");
         goto bail;
     }
 
@@ -798,7 +798,7 @@
  */
 void AndroidRuntime::start(const char* className, const char* options)
 {
-    LOGD("\n>>>>>> AndroidRuntime START %s <<<<<<\n",
+    ALOGD("\n>>>>>> AndroidRuntime START %s <<<<<<\n",
             className != NULL ? className : "(unknown)");
 
     blockSigpipe();
@@ -825,7 +825,7 @@
     }
 
     //const char* kernelHack = getenv("LD_ASSUME_KERNEL");
-    //LOGD("Found LD_ASSUME_KERNEL='%s'\n", kernelHack);
+    //ALOGD("Found LD_ASSUME_KERNEL='%s'\n", kernelHack);
 
     /* start the virtual machine */
     JNIEnv* env;
@@ -838,7 +838,7 @@
      * Register android functions.
      */
     if (startReg(env) < 0) {
-        LOGE("Unable to register all android natives\n");
+        ALOGE("Unable to register all android natives\n");
         return;
     }
 
@@ -869,13 +869,13 @@
     char* slashClassName = toSlashClassName(className);
     jclass startClass = env->FindClass(slashClassName);
     if (startClass == NULL) {
-        LOGE("JavaVM unable to locate class '%s'\n", slashClassName);
+        ALOGE("JavaVM unable to locate class '%s'\n", slashClassName);
         /* keep going */
     } else {
         jmethodID startMeth = env->GetStaticMethodID(startClass, "main",
             "([Ljava/lang/String;)V");
         if (startMeth == NULL) {
-            LOGE("JavaVM unable to find main() in '%s'\n", className);
+            ALOGE("JavaVM unable to find main() in '%s'\n", className);
             /* keep going */
         } else {
             env->CallStaticVoidMethod(startClass, startMeth, strArray);
@@ -888,16 +888,16 @@
     }
     free(slashClassName);
 
-    LOGD("Shutting down VM\n");
+    ALOGD("Shutting down VM\n");
     if (mJavaVM->DetachCurrentThread() != JNI_OK)
-        LOGW("Warning: unable to detach main thread\n");
+        ALOGW("Warning: unable to detach main thread\n");
     if (mJavaVM->DestroyJavaVM() != 0)
-        LOGW("Warning: VM did not shut down cleanly\n");
+        ALOGW("Warning: VM did not shut down cleanly\n");
 }
 
 void AndroidRuntime::onExit(int code)
 {
-    LOGV("AndroidRuntime onExit calling exit(%d)", code);
+    ALOGV("AndroidRuntime onExit calling exit(%d)", code);
     exit(code);
 }
 
@@ -943,7 +943,7 @@
 
     result = vm->AttachCurrentThread(pEnv, (void*) &args);
     if (result != JNI_OK)
-        LOGI("NOTE: attach of thread '%s' failed\n", threadName);
+        ALOGI("NOTE: attach of thread '%s' failed\n", threadName);
 
     return result;
 }
@@ -961,7 +961,7 @@
 
     result = vm->DetachCurrentThread();
     if (result != JNI_OK)
-        LOGE("ERROR: thread detach failed\n");
+        ALOGE("ERROR: thread detach failed\n");
     return result;
 }
 
@@ -1064,7 +1064,7 @@
     for (size_t i = 0; i < count; i++) {
         if (array[i].mProc(env) < 0) {
 #ifndef NDEBUG
-            LOGD("----------!!! %s failed to load\n", array[i].mName);
+            ALOGD("----------!!! %s failed to load\n", array[i].mName);
 #endif
             return -1;
         }
@@ -1217,7 +1217,7 @@
      */
     androidSetCreateThreadFunc((android_create_thread_fn) javaCreateThreadEtc);
 
-    LOGV("--- registering native functions ---\n");
+    ALOGV("--- registering native functions ---\n");
 
     /*
      * Every "register" function calls one or more things that return
diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp
index 7724646..c8ddccb 100644
--- a/core/jni/android/graphics/Canvas.cpp
+++ b/core/jni/android/graphics/Canvas.cpp
@@ -67,7 +67,7 @@
     static void freeCaches(JNIEnv* env, jobject) {
         // these are called in no particular order
         SkImageRef_GlobalPool::SetRAMUsed(0);
-        SkGraphics::SetFontCacheUsed(0);
+        SkGraphics::PurgeFontCache();
     }
     
     static jboolean isOpaque(JNIEnv* env, jobject jcanvas) {
@@ -442,7 +442,7 @@
 #endif
         canvas->drawPicture(*picture);
 #ifdef TIME_DRAW
-        LOGD("---- picture playback %d ms\n", get_thread_msec() - now);
+        ALOGD("---- picture playback %d ms\n", get_thread_msec() - now);
 #endif
     }
 
@@ -770,7 +770,7 @@
         value = TextLayoutCache::getInstance().getValue(paint, textArray, start, count,
                 contextCount, flags);
         if (value == NULL) {
-            LOGE("Cannot get TextLayoutCache value");
+            ALOGE("Cannot get TextLayoutCache value");
             return ;
         }
 #else
diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp
index 64bd207..47ffd94 100644
--- a/core/jni/android/graphics/Graphics.cpp
+++ b/core/jni/android/graphics/Graphics.cpp
@@ -40,7 +40,7 @@
 
 bool GraphicsJNI::hasException(JNIEnv *env) {
     if (env->ExceptionCheck() != 0) {
-        LOGE("*** Uncaught exception returned from Java call!\n");
+        ALOGE("*** Uncaught exception returned from Java call!\n");
         env->ExceptionDescribe();
         return true;
     }
diff --git a/core/jni/android/graphics/HarfbuzzSkia.cpp b/core/jni/android/graphics/HarfbuzzSkia.cpp
index f6f7b45..29064e0 100644
--- a/core/jni/android/graphics/HarfbuzzSkia.cpp
+++ b/core/jni/android/graphics/HarfbuzzSkia.cpp
@@ -98,7 +98,7 @@
     for (unsigned i = 0; i < numGlyphs; ++i) {
         advances[i] = SkScalarToHBFixed(scalarAdvances[i]);
 #if DEBUG_ADVANCES
-        LOGD("glyphsToAdvances -- advances[%d]=%d", i, advances[i]);
+        ALOGD("glyphsToAdvances -- advances[%d]=%d", i, advances[i]);
 #endif
     }
     delete glyphs16;
diff --git a/core/jni/android/graphics/NinePatch.cpp b/core/jni/android/graphics/NinePatch.cpp
index 0c8a8a3..f3b28a9 100644
--- a/core/jni/android/graphics/NinePatch.cpp
+++ b/core/jni/android/graphics/NinePatch.cpp
@@ -82,7 +82,7 @@
 
             if (destDensity == srcDensity || destDensity == 0
                     || srcDensity == 0) {
-                LOGV("Drawing unscaled 9-patch: (%g,%g)-(%g,%g)",
+                ALOGV("Drawing unscaled 9-patch: (%g,%g)-(%g,%g)",
                         SkScalarToFloat(bounds.fLeft), SkScalarToFloat(bounds.fTop),
                         SkScalarToFloat(bounds.fRight), SkScalarToFloat(bounds.fBottom));
                 NinePatch_Draw(canvas, bounds, *bitmap, *chunk, paint, NULL);
@@ -97,7 +97,7 @@
                 bounds.fBottom = SkScalarDiv(bounds.fBottom-bounds.fTop, scale);
                 bounds.fLeft = bounds.fTop = 0;
 
-                LOGV("Drawing scaled 9-patch: (%g,%g)-(%g,%g) srcDensity=%d destDensity=%d",
+                ALOGV("Drawing scaled 9-patch: (%g,%g)-(%g,%g) srcDensity=%d destDensity=%d",
                         SkScalarToFloat(bounds.fLeft), SkScalarToFloat(bounds.fTop),
                         SkScalarToFloat(bounds.fRight), SkScalarToFloat(bounds.fBottom),
                         srcDensity, destDensity);
diff --git a/core/jni/android/graphics/NinePatchImpl.cpp b/core/jni/android/graphics/NinePatchImpl.cpp
index a3e36ee..1d0bb506 100644
--- a/core/jni/android/graphics/NinePatchImpl.cpp
+++ b/core/jni/android/graphics/NinePatchImpl.cpp
@@ -135,7 +135,7 @@
 #ifdef USE_TRACE
     if (canvas) {
         const SkMatrix& m = canvas->getTotalMatrix();
-        LOGV("ninepatch [%g %g %g] [%g %g %g]\n",
+        ALOGV("ninepatch [%g %g %g] [%g %g %g]\n",
                  SkScalarToFloat(m[0]), SkScalarToFloat(m[1]), SkScalarToFloat(m[2]),
                  SkScalarToFloat(m[3]), SkScalarToFloat(m[4]), SkScalarToFloat(m[5]));
     }
@@ -143,10 +143,10 @@
 
 #ifdef USE_TRACE
     if (gTrace) {
-        LOGV("======== ninepatch bounds [%g %g]\n", SkScalarToFloat(bounds.width()), SkScalarToFloat(bounds.height()));
-        LOGV("======== ninepatch paint bm [%d,%d]\n", bitmap.width(), bitmap.height());
-        LOGV("======== ninepatch xDivs [%d,%d]\n", chunk.xDivs[0], chunk.xDivs[1]);
-        LOGV("======== ninepatch yDivs [%d,%d]\n", chunk.yDivs[0], chunk.yDivs[1]);
+        ALOGV("======== ninepatch bounds [%g %g]\n", SkScalarToFloat(bounds.width()), SkScalarToFloat(bounds.height()));
+        ALOGV("======== ninepatch paint bm [%d,%d]\n", bitmap.width(), bitmap.height());
+        ALOGV("======== ninepatch xDivs [%d,%d]\n", chunk.xDivs[0], chunk.xDivs[1]);
+        ALOGV("======== ninepatch yDivs [%d,%d]\n", chunk.yDivs[0], chunk.yDivs[1]);
     }
 #endif
 
@@ -155,7 +155,7 @@
         (paint && paint->getXfermode() == NULL && paint->getAlpha() == 0))
     {
 #ifdef USE_TRACE
-        if (gTrace) LOGV("======== abort ninepatch draw\n");
+        if (gTrace) ALOGV("======== abort ninepatch draw\n");
 #endif
         return;
     }
@@ -201,7 +201,7 @@
     int numFixedYPixelsRemaining = bitmapHeight - numStretchyYPixelsRemaining;
 
 #ifdef USE_TRACE
-    LOGV("NinePatch [%d %d] bounds [%g %g %g %g] divs [%d %d]\n",
+    ALOGV("NinePatch [%d %d] bounds [%g %g %g %g] divs [%d %d]\n",
              bitmap.width(), bitmap.height(),
              SkScalarToFloat(bounds.fLeft), SkScalarToFloat(bounds.fTop),
              SkScalarToFloat(bounds.width()), SkScalarToFloat(bounds.height()),
@@ -297,7 +297,7 @@
                     }
                     SkIRect idst;
                     dst.round(&idst);
-                    //LOGI("Adding trans rect: (%d,%d)-(%d,%d)\n",
+                    //ALOGI("Adding trans rect: (%d,%d)-(%d,%d)\n",
                     //     idst.fLeft, idst.fTop, idst.fRight, idst.fBottom);
                     (*outRegion)->op(idst, SkRegion::kUnion_Op);
                 }
@@ -305,12 +305,12 @@
             }
             if (canvas) {
 #ifdef USE_TRACE
-                LOGV("-- src [%d %d %d %d] dst [%g %g %g %g]\n",
+                ALOGV("-- src [%d %d %d %d] dst [%g %g %g %g]\n",
                          src.fLeft, src.fTop, src.width(), src.height(),
                          SkScalarToFloat(dst.fLeft), SkScalarToFloat(dst.fTop),
                          SkScalarToFloat(dst.width()), SkScalarToFloat(dst.height()));
                 if (2 == src.width() && SkIntToScalar(5) == dst.width()) {
-                    LOGV("--- skip patch\n");
+                    ALOGV("--- skip patch\n");
                 }
 #endif
                 drawStretchyPatch(canvas, src, dst, bitmap, *paint, initColor,
diff --git a/core/jni/android/graphics/SurfaceTexture.cpp b/core/jni/android/graphics/SurfaceTexture.cpp
index de2d8c4..3d350ed 100644
--- a/core/jni/android/graphics/SurfaceTexture.cpp
+++ b/core/jni/android/graphics/SurfaceTexture.cpp
@@ -112,7 +112,7 @@
         JavaVM* vm = AndroidRuntime::getJavaVM();
         int result = vm->AttachCurrentThread(&env, (void*) &args);
         if (result != JNI_OK) {
-            LOGE("thread attach failed: %#x", result);
+            ALOGE("thread attach failed: %#x", result);
             return NULL;
         }
         *needsDetach = true;
@@ -124,7 +124,7 @@
     JavaVM* vm = AndroidRuntime::getJavaVM();
     int result = vm->DetachCurrentThread();
     if (result != JNI_OK) {
-        LOGE("thread detach failed: %#x", result);
+        ALOGE("thread detach failed: %#x", result);
     }
 }
 
@@ -136,7 +136,7 @@
         env->DeleteGlobalRef(mWeakThiz);
         env->DeleteGlobalRef(mClazz);
     } else {
-        LOGW("leaking JNI object references");
+        ALOGW("leaking JNI object references");
     }
     if (needsDetach) {
         detachJNI();
@@ -150,7 +150,7 @@
     if (env != NULL) {
         env->CallStaticVoidMethod(mClazz, fields.postEvent, mWeakThiz);
     } else {
-        LOGW("onFrameAvailable event will not posted");
+        ALOGW("onFrameAvailable event will not posted");
     }
     if (needsDetach) {
         detachJNI();
@@ -164,14 +164,14 @@
     fields.surfaceTexture = env->GetFieldID(clazz,
             ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID, "I");
     if (fields.surfaceTexture == NULL) {
-        LOGE("can't find android/graphics/SurfaceTexture.%s",
+        ALOGE("can't find android/graphics/SurfaceTexture.%s",
                 ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID);
     }
 
     fields.postEvent = env->GetStaticMethodID(clazz, "postEventFromNative",
             "(Ljava/lang/Object;)V");
     if (fields.postEvent == NULL) {
-        LOGE("can't find android/graphics/SurfaceTexture.postEventFromNative");
+        ALOGE("can't find android/graphics/SurfaceTexture.postEventFromNative");
     }
 }
 
diff --git a/core/jni/android/graphics/TextLayout.cpp b/core/jni/android/graphics/TextLayout.cpp
index 9b424f2..4b0006a 100644
--- a/core/jni/android/graphics/TextLayout.cpp
+++ b/core/jni/android/graphics/TextLayout.cpp
@@ -78,7 +78,7 @@
             }
         }
         count = end;
-        // LOG(LOG_INFO, "CSRTL", "start %d count %d ccount %d\n", start, count, contextCount);
+        // ALOG(LOG_INFO, "CSRTL", "start %d count %d ccount %d\n", start, count, contextCount);
         ubidi_writeReverse(buffer, count, shaped, count, UBIDI_DO_MIRRORING | UBIDI_OUTPUT_REVERSE
                            | UBIDI_KEEP_BASE_COMBINING, &status);
         if (U_SUCCESS(status)) {
@@ -125,7 +125,7 @@
 
             int rc = ubidi_countRuns(bidi, &status);
             if (U_SUCCESS(status)) {
-                // LOG(LOG_INFO, "LAYOUT", "para bidiReq=%d dir=%d rc=%d\n", bidiReq, dir, rc);
+                // ALOG(LOG_INFO, "LAYOUT", "para bidiReq=%d dir=%d rc=%d\n", bidiReq, dir, rc);
 
                 int32_t slen = 0;
                 for (int i = 0; i < rc; ++i) {
@@ -164,7 +164,7 @@
         UErrorCode status = U_ZERO_ERROR;
         len = layoutLine(text, len, bidiFlags, dir, buffer, status); // might change len, dir
         if (!U_SUCCESS(status)) {
-            LOG(LOG_WARN, "LAYOUT", "drawText error %d\n", status);
+            ALOG(LOG_WARN, "LAYOUT", "drawText error %d\n", status);
             free(buffer);
             return false; // can't render
         }
@@ -228,7 +228,7 @@
     if (U_SUCCESS(status)) {
         return true;
     } else {
-        LOGW("drawTextRun error %d\n", status);
+        ALOGW("drawTextRun error %d\n", status);
     }
     return false;
 }
@@ -350,7 +350,7 @@
     jfloat totalAdvance = 0;
     if (widths < count) {
 #if DEBUG_ADVANCES
-    LOGD("ICU -- count=%d", widths);
+    ALOGD("ICU -- count=%d", widths);
 #endif
         // Skia operates on code points, not code units, so surrogate pairs return only
         // one value. Expand the result so we have one value per UTF-16 code unit.
@@ -367,17 +367,17 @@
                 outAdvances[p++] = 0;
             }
 #if DEBUG_ADVANCES
-            LOGD("icu-adv = %f - total = %f", outAdvances[i], totalAdvance);
+            ALOGD("icu-adv = %f - total = %f", outAdvances[i], totalAdvance);
 #endif
         }
     } else {
 #if DEBUG_ADVANCES
-    LOGD("ICU -- count=%d", count);
+    ALOGD("ICU -- count=%d", count);
 #endif
         for (size_t i = 0; i < count; i++) {
             totalAdvance += outAdvances[i] = SkScalarToFloat(scalarArray[i]);
 #if DEBUG_ADVANCES
-            LOGD("icu-adv = %f - total = %f", outAdvances[i], totalAdvance);
+            ALOGD("icu-adv = %f - total = %f", outAdvances[i], totalAdvance);
 #endif
         }
     }
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp
index 4f90bbf..fdedb24 100644
--- a/core/jni/android/graphics/TextLayoutCache.cpp
+++ b/core/jni/android/graphics/TextLayoutCache.cpp
@@ -47,12 +47,12 @@
 
     mDebugLevel = readRtlDebugLevel();
     mDebugEnabled = mDebugLevel & kRtlDebugCaches;
-    LOGD("Using debug level: %d - Debug Enabled: %d", mDebugLevel, mDebugEnabled);
+    ALOGD("Using debug level: %d - Debug Enabled: %d", mDebugLevel, mDebugEnabled);
 
     mCacheStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
 
     if (mDebugEnabled) {
-        LOGD("Initialization is done - Start time: %lld", mCacheStartTime);
+        ALOGD("Initialization is done - Start time: %lld", mCacheStartTime);
     }
 
     mInitialized = true;
@@ -89,7 +89,7 @@
         size_t totalSizeToDelete = text.getSize() + desc->getSize();
         mSize -= totalSizeToDelete;
         if (mDebugEnabled) {
-            LOGD("Cache value deleted, size = %d", totalSizeToDelete);
+            ALOGD("Cache value deleted, size = %d", totalSizeToDelete);
         }
         desc.clear();
     }
@@ -138,7 +138,7 @@
             // Cleanup to make some room if needed
             if (mSize + size > mMaxSize) {
                 if (mDebugEnabled) {
-                    LOGD("Need to clean some entries for making some room for a new entry");
+                    ALOGD("Need to clean some entries for making some room for a new entry");
                 }
                 while (mSize + size > mMaxSize) {
                     // This will call the callback
@@ -157,7 +157,7 @@
                 // Update timing information for statistics
                 value->setElapsedTime(endTime - startTime);
 
-                LOGD("CACHE MISS: Added entry with "
+                ALOGD("CACHE MISS: Added entry with "
                         "count=%d, entry size %d bytes, remaining space %d bytes"
                         " - Compute time in nanos: %d - Text='%s' ",
                         count, size, mMaxSize - mSize, value->getElapsedTime(),
@@ -165,7 +165,7 @@
             }
         } else {
             if (mDebugEnabled) {
-                LOGD("CACHE MISS: Calculated but not storing entry because it is too big "
+                ALOGD("CACHE MISS: Calculated but not storing entry because it is too big "
                         "with start=%d count=%d contextCount=%d, "
                         "entry size %d bytes, remaining space %d bytes"
                         " - Compute time in nanos: %lld - Text='%s'",
@@ -183,7 +183,7 @@
             if (value->getElapsedTime() > 0) {
                 float deltaPercent = 100 * ((value->getElapsedTime() - elapsedTimeThruCacheGet)
                         / ((float)value->getElapsedTime()));
-                LOGD("CACHE HIT #%d with start=%d count=%d contextCount=%d"
+                ALOGD("CACHE HIT #%d with start=%d count=%d contextCount=%d"
                         "- Compute time in nanos: %d - "
                         "Cache get time in nanos: %lld - Gain in percent: %2.2f - Text='%s' ",
                         mCacheHitCount, start, count, contextCount,
@@ -201,17 +201,17 @@
 void TextLayoutCache::dumpCacheStats() {
     float remainingPercent = 100 * ((mMaxSize - mSize) / ((float)mMaxSize));
     float timeRunningInSec = (systemTime(SYSTEM_TIME_MONOTONIC) - mCacheStartTime) / 1000000000;
-    LOGD("------------------------------------------------");
-    LOGD("Cache stats");
-    LOGD("------------------------------------------------");
-    LOGD("pid       : %d", getpid());
-    LOGD("running   : %.0f seconds", timeRunningInSec);
-    LOGD("entries   : %d", mCache.size());
-    LOGD("size      : %d bytes", mMaxSize);
-    LOGD("remaining : %d bytes or %2.2f percent", mMaxSize - mSize, remainingPercent);
-    LOGD("hits      : %d", mCacheHitCount);
-    LOGD("saved     : %lld milliseconds", mNanosecondsSaved / 1000000);
-    LOGD("------------------------------------------------");
+    ALOGD("------------------------------------------------");
+    ALOGD("Cache stats");
+    ALOGD("------------------------------------------------");
+    ALOGD("pid       : %d", getpid());
+    ALOGD("running   : %.0f seconds", timeRunningInSec);
+    ALOGD("entries   : %d", mCache.size());
+    ALOGD("size      : %d bytes", mMaxSize);
+    ALOGD("remaining : %d bytes or %2.2f percent", mMaxSize - mSize, remainingPercent);
+    ALOGD("hits      : %d", mCacheHitCount);
+    ALOGD("saved     : %lld milliseconds", mNanosecondsSaved / 1000000);
+    ALOGD("------------------------------------------------");
 }
 
 /**
@@ -319,7 +319,7 @@
     computeValuesWithHarfbuzz(paint, chars, start, count, contextCount, dirFlags,
             &mAdvances, &mTotalAdvance, &mGlyphs);
 #if DEBUG_ADVANCES
-    LOGD("Advances - start=%d, count=%d, countextCount=%d, totalAdvance=%f", start, count,
+    ALOGD("Advances - start=%d, count=%d, countextCount=%d, totalAdvance=%f", start, count,
             contextCount, mTotalAdvance);
 #endif
 }
@@ -434,14 +434,14 @@
             if (bidi) {
                 UErrorCode status = U_ZERO_ERROR;
 #if DEBUG_GLYPHS
-                LOGD("computeValuesWithHarfbuzz -- bidiReq=%d", bidiReq);
+                ALOGD("computeValuesWithHarfbuzz -- bidiReq=%d", bidiReq);
 #endif
                 ubidi_setPara(bidi, chars, contextCount, bidiReq, NULL, &status);
                 if (U_SUCCESS(status)) {
                     int paraDir = ubidi_getParaLevel(bidi) & kDirection_Mask; // 0 if ltr, 1 if rtl
                     ssize_t rc = ubidi_countRuns(bidi, &status);
 #if DEBUG_GLYPHS
-                    LOGD("computeValuesWithHarfbuzz -- dirFlags=%d run-count=%d paraDir=%d",
+                    ALOGD("computeValuesWithHarfbuzz -- dirFlags=%d run-count=%d paraDir=%d",
                             dirFlags, rc, paraDir);
 #endif
                     if (U_SUCCESS(status) && rc == 1) {
@@ -449,7 +449,7 @@
                         isRTL = (paraDir == 1);
                         useSingleRun = true;
                     } else if (!U_SUCCESS(status) || rc < 1) {
-                        LOGW("computeValuesWithHarfbuzz -- need to force to single run");
+                        ALOGW("computeValuesWithHarfbuzz -- need to force to single run");
                         isRTL = (paraDir == 1);
                         useSingleRun = true;
                     } else {
@@ -462,7 +462,7 @@
                             if (startRun == -1 || lengthRun == -1) {
                                 // Something went wrong when getting the visual run, need to clear
                                 // already computed data before doing a single run pass
-                                LOGW("computeValuesWithHarfbuzz -- visual run is not valid");
+                                ALOGW("computeValuesWithHarfbuzz -- visual run is not valid");
                                 outGlyphs->clear();
                                 outAdvances->clear();
                                 *outTotalAdvance = 0;
@@ -489,7 +489,7 @@
                             isRTL = (runDir == UBIDI_RTL);
                             jfloat runTotalAdvance = 0;
 #if DEBUG_GLYPHS
-                            LOGD("computeValuesWithHarfbuzz -- run-start=%d run-len=%d isRTL=%d",
+                            ALOGD("computeValuesWithHarfbuzz -- run-start=%d run-len=%d isRTL=%d",
                                     startRun, lengthRun, isRTL);
 #endif
                             computeRunValuesWithHarfbuzz(shaperItem, paint,
@@ -500,13 +500,13 @@
                         }
                     }
                 } else {
-                    LOGW("computeValuesWithHarfbuzz -- cannot set Para");
+                    ALOGW("computeValuesWithHarfbuzz -- cannot set Para");
                     useSingleRun = true;
                     isRTL = (bidiReq = 1) || (bidiReq = UBIDI_DEFAULT_RTL);
                 }
                 ubidi_close(bidi);
             } else {
-                LOGW("computeValuesWithHarfbuzz -- cannot ubidi_open()");
+                ALOGW("computeValuesWithHarfbuzz -- cannot ubidi_open()");
                 useSingleRun = true;
                 isRTL = (bidiReq = 1) || (bidiReq = UBIDI_DEFAULT_RTL);
             }
@@ -515,7 +515,7 @@
         // Default single run case
         if (useSingleRun){
 #if DEBUG_GLYPHS
-            LOGD("computeValuesWithHarfbuzz -- Using a SINGLE Run "
+            ALOGD("computeValuesWithHarfbuzz -- Using a SINGLE Run "
                     "-- run-start=%d run-len=%d isRTL=%d", start, count, isRTL);
 #endif
             computeRunValuesWithHarfbuzz(shaperItem, paint,
@@ -527,14 +527,14 @@
         freeShaperItem(shaperItem);
 
 #if DEBUG_GLYPHS
-        LOGD("computeValuesWithHarfbuzz -- total-glyphs-count=%d", outGlyphs->size());
+        ALOGD("computeValuesWithHarfbuzz -- total-glyphs-count=%d", outGlyphs->size());
 #endif
 }
 
 static void logGlyphs(HB_ShaperItem shaperItem) {
-    LOGD("Got glyphs - count=%d", shaperItem.num_glyphs);
+    ALOGD("Got glyphs - count=%d", shaperItem.num_glyphs);
     for (size_t i = 0; i < shaperItem.num_glyphs; i++) {
-        LOGD("      glyph[%d]=%d - offset.x=%f offset.y=%f", i, shaperItem.glyphs[i],
+        ALOGD("      glyph[%d]=%d - offset.x=%f offset.y=%f", i, shaperItem.glyphs[i],
                 HBFixedToFloat(shaperItem.offsets[i].x),
                 HBFixedToFloat(shaperItem.offsets[i].y));
     }
@@ -552,17 +552,17 @@
     shapeRun(shaperItem, start, count, isRTL);
 
 #if DEBUG_GLYPHS
-    LOGD("HARFBUZZ -- num_glypth=%d - kerning_applied=%d", shaperItem.num_glyphs,
+    ALOGD("HARFBUZZ -- num_glypth=%d - kerning_applied=%d", shaperItem.num_glyphs,
             shaperItem.kerning_applied);
-    LOGD("         -- string= '%s'", String8(shaperItem.string + start, count).string());
-    LOGD("         -- isDevKernText=%d", paint->isDevKernText());
+    ALOGD("         -- string= '%s'", String8(shaperItem.string + start, count).string());
+    ALOGD("         -- isDevKernText=%d", paint->isDevKernText());
 
     logGlyphs(shaperItem);
 #endif
 
     if (shaperItem.advances == NULL || shaperItem.num_glyphs == 0) {
 #if DEBUG_GLYPHS
-    LOGD("HARFBUZZ -- advances array is empty or num_glypth = 0");
+    ALOGD("HARFBUZZ -- advances array is empty or num_glypth = 0");
 #endif
         outAdvances->insertAt(0, outAdvances->size(), count);
         *outTotalAdvance = 0;
@@ -588,7 +588,7 @@
 
 #if DEBUG_ADVANCES
     for (size_t i = 0; i < count; i++) {
-        LOGD("hb-adv[%d] = %f - log_clusters = %d - total = %f", i,
+        ALOGD("hb-adv[%d] = %f - log_clusters = %d - total = %f", i,
                 (*outAdvances)[i], shaperItem.log_clusters[i], totalAdvance);
     }
 #endif
@@ -599,7 +599,7 @@
         for (size_t i = 0; i < countGlyphs; i++) {
             jchar glyph = (jchar) shaperItem.glyphs[(!isRTL) ? i : countGlyphs - 1 - i];
 #if DEBUG_GLYPHS
-            LOGD("HARFBUZZ  -- glyph[%d]=%d", i, glyph);
+            ALOGD("HARFBUZZ  -- glyph[%d]=%d", i, glyph);
 #endif
             outGlyphs->add(glyph);
         }
diff --git a/core/jni/android/opengl/util.cpp b/core/jni/android/opengl/util.cpp
index 6a049e0..929df540 100644
--- a/core/jni/android/opengl/util.cpp
+++ b/core/jni/android/opengl/util.cpp
@@ -73,10 +73,10 @@
 static
 void
 print_poly(const char* label, Poly* pPoly) {
-    LOGI("%s: %d verts", label, pPoly->n);
+    ALOGI("%s: %d verts", label, pPoly->n);
     for(int i = 0; i < pPoly->n; i++) {
         Poly_vert* pV = & pPoly->vert[i];
-        LOGI("[%d] %g, %g, %g %g", i, pV->sx, pV->sy, pV->sz, pV->sw);
+        ALOGI("[%d] %g, %g, %g %g", i, pV->sx, pV->sy, pV->sz, pV->sw);
     }
 }
 #endif
@@ -1062,7 +1062,7 @@
         result = AndroidRuntime::registerNativeMethods(env,
                 cri->classPath, cri->methods, cri->methodCount);
         if (result < 0) {
-            LOGE("Failed to register %s: %d", cri->classPath, result);
+            ALOGE("Failed to register %s: %d", cri->classPath, result);
             break;
         }
     }
diff --git a/core/jni/android_app_NativeActivity.cpp b/core/jni/android_app_NativeActivity.cpp
index b1ea90b..ac4fe5b 100644
--- a/core/jni/android_app_NativeActivity.cpp
+++ b/core/jni/android_app_NativeActivity.cpp
@@ -36,7 +36,7 @@
 #include "android_view_KeyEvent.h"
 
 #define LOG_TRACE(...)
-//#define LOG_TRACE(...) LOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)
+//#define LOG_TRACE(...) ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)
 
 namespace android
 {
@@ -84,8 +84,8 @@
     
     if (res == sizeof(work)) return;
     
-    if (res < 0) LOGW("Failed writing to work fd: %s", strerror(errno));
-    else LOGW("Truncated writing to work fd: %d", res);
+    if (res < 0) ALOGW("Failed writing to work fd: %s", strerror(errno));
+    else ALOGW("Truncated writing to work fd: %d", res);
 }
 
 static bool read_work(int fd, ActivityWork* outWork) {
@@ -93,8 +93,8 @@
     // no need to worry about EINTR, poll loop will just come back again.
     if (res == sizeof(ActivityWork)) return true;
     
-    if (res < 0) LOGW("Failed reading work fd: %s", strerror(errno));
-    else LOGW("Truncated reading work fd: %d", res);
+    if (res < 0) ALOGW("Failed reading work fd: %s", strerror(errno));
+    else ALOGW("Truncated reading work fd: %d", res);
     return false;
 }
 
@@ -108,7 +108,7 @@
         mWorkWrite(workWrite), mConsumer(channel), mSeq(0) {
     int msgpipe[2];
     if (pipe(msgpipe)) {
-        LOGW("could not create pipe: %s", strerror(errno));
+        ALOGW("could not create pipe: %s", strerror(errno));
         mDispatchKeyRead = mDispatchKeyWrite = -1;
     } else {
         mDispatchKeyRead = msgpipe[0];
@@ -187,7 +187,7 @@
                 }
             }
             if (*outEvent == NULL) {
-                LOGW("getEvent couldn't find inflight for seq %d", finish.seq);
+                ALOGW("getEvent couldn't find inflight for seq %d", finish.seq);
             }
         }
         mLock.unlock();
@@ -203,7 +203,7 @@
     
     int32_t res = mConsumer.receiveDispatchSignal();
     if (res != android::OK) {
-        LOGE("channel '%s' ~ Failed to receive dispatch signal.  status=%d",
+        ALOGE("channel '%s' ~ Failed to receive dispatch signal.  status=%d",
                 mConsumer.getChannel()->getName().string(), res);
         return -1;
     }
@@ -211,7 +211,7 @@
     InputEvent* myEvent = NULL;
     res = mConsumer.consume(this, &myEvent);
     if (res != android::OK) {
-        LOGW("channel '%s' ~ Failed to consume input event.  status=%d",
+        ALOGW("channel '%s' ~ Failed to consume input event.  status=%d",
                 mConsumer.getChannel()->getName().string(), res);
         mConsumer.sendFinishedSignal(false);
         return -1;
@@ -265,7 +265,7 @@
             if (inflight.doFinish) {
                 int32_t res = mConsumer.sendFinishedSignal(handled);
                 if (res != android::OK) {
-                    LOGW("Failed to send finished signal on channel '%s'.  status=%d",
+                    ALOGW("Failed to send finished signal on channel '%s'.  status=%d",
                             mConsumer.getChannel()->getName().string(), res);
                 }
             }
@@ -281,7 +281,7 @@
     }
     mLock.unlock();
     
-    LOGW("finishEvent called for unknown event: %p", event);
+    ALOGW("finishEvent called for unknown event: %p", event);
 }
 
 void AInputQueue::dispatchEvent(android::KeyEvent* event) {
@@ -398,7 +398,7 @@
         }
     }
 
-    LOGW("preDispatchKey called for unknown event: %p", keyEvent);
+    ALOGW("preDispatchKey called for unknown event: %p", keyEvent);
     return false;
 }
 
@@ -412,8 +412,8 @@
 
     if (res == sizeof(dummy)) return;
 
-    if (res < 0) LOGW("Failed writing to dispatch fd: %s", strerror(errno));
-    else LOGW("Truncated writing to dispatch fd: %d", res);
+    if (res < 0) ALOGW("Failed writing to dispatch fd: %s", strerror(errno));
+    else ALOGW("Truncated writing to dispatch fd: %d", res);
 }
 
 namespace android {
@@ -548,7 +548,7 @@
 
 static bool checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {
    if (env->ExceptionCheck()) {
-       LOGE("An exception was thrown by callback '%s'.", methodName);
+       ALOGE("An exception was thrown by callback '%s'.", methodName);
        LOGE_EX(env);
        env->ExceptionClear();
        return true;
@@ -585,7 +585,7 @@
                     checkAndClearExceptionFromCallback(code->env, "dispatchUnhandledKeyEvent");
                     code->env->DeleteLocalRef(inputEventObj);
                 } else {
-                    LOGE("Failed to obtain key event for dispatchUnhandledKeyEvent.");
+                    ALOGE("Failed to obtain key event for dispatchUnhandledKeyEvent.");
                     handled = false;
                 }
                 code->nativeInputQueue->finishEvent(keyEvent, handled, true);
@@ -600,7 +600,7 @@
                     checkAndClearExceptionFromCallback(code->env, "preDispatchKeyEvent");
                     code->env->DeleteLocalRef(inputEventObj);
                 } else {
-                    LOGE("Failed to obtain key event for preDispatchKeyEvent.");
+                    ALOGE("Failed to obtain key event for preDispatchKeyEvent.");
                 }
             }
         } break;
@@ -629,7 +629,7 @@
             checkAndClearExceptionFromCallback(code->env, "hideIme");
         } break;
         default:
-            LOGW("Unknown work command: %d", work.cmd);
+            ALOGW("Unknown work command: %d", work.cmd);
             break;
     }
     
@@ -660,21 +660,21 @@
         env->ReleaseStringUTFChars(funcName, funcStr);
         
         if (code->createActivityFunc == NULL) {
-            LOGW("ANativeActivity_onCreate not found");
+            ALOGW("ANativeActivity_onCreate not found");
             delete code;
             return 0;
         }
         
         code->looper = android_os_MessageQueue_getLooper(env, messageQueue);
         if (code->looper == NULL) {
-            LOGW("Unable to retrieve MessageQueue's Looper");
+            ALOGW("Unable to retrieve MessageQueue's Looper");
             delete code;
             return 0;
         }
         
         int msgpipe[2];
         if (pipe(msgpipe)) {
-            LOGW("could not create pipe: %s", strerror(errno));
+            ALOGW("could not create pipe: %s", strerror(errno));
             delete code;
             return 0;
         }
@@ -690,7 +690,7 @@
         
         code->ANativeActivity::callbacks = &code->callbacks;
         if (env->GetJavaVM(&code->vm) < 0) {
-            LOGW("NativeActivity GetJavaVM failed");
+            ALOGW("NativeActivity GetJavaVM failed");
             delete code;
             return 0;
         }
@@ -1060,7 +1060,7 @@
         
 int register_android_app_NativeActivity(JNIEnv* env)
 {
-    //LOGD("register_android_app_NativeActivity");
+    //ALOGD("register_android_app_NativeActivity");
     jclass clazz;
     FIND_CLASS(clazz, kNativeActivityPathName);
 
diff --git a/core/jni/android_app_backup_FullBackup.cpp b/core/jni/android_app_backup_FullBackup.cpp
index 6ef62a9..066a23e 100644
--- a/core/jni/android_app_backup_FullBackup.cpp
+++ b/core/jni/android_app_backup_FullBackup.cpp
@@ -97,12 +97,12 @@
 
     // Validate
     if (!writer) {
-        LOGE("No output stream provided [%s]", path.string());
+        ALOGE("No output stream provided [%s]", path.string());
         return -1;
     }
 
     if (path.length() < rootpath.length()) {
-        LOGE("file path [%s] shorter than root path [%s]",
+        ALOGE("file path [%s] shorter than root path [%s]",
                 path.string(), rootpath.string());
         return -1;
     }
diff --git a/core/jni/android_backup_BackupDataInput.cpp b/core/jni/android_backup_BackupDataInput.cpp
index c174a41..2fb0076 100644
--- a/core/jni/android_backup_BackupDataInput.cpp
+++ b/core/jni/android_backup_BackupDataInput.cpp
@@ -80,7 +80,7 @@
         return 0;
     }
     default:
-        LOGD("Unknown header type: 0x%08x\n", type);
+        ALOGD("Unknown header type: 0x%08x\n", type);
         return -1;
     }
 
@@ -133,7 +133,7 @@
 
 int register_android_backup_BackupDataInput(JNIEnv* env)
 {
-    //LOGD("register_android_backup_BackupDataInput");
+    //ALOGD("register_android_backup_BackupDataInput");
 
     jclass clazz = env->FindClass("android/app/backup/BackupDataInput$EntityHeader");
     LOG_FATAL_IF(clazz == NULL, "Unable to find class android.app.backup.BackupDataInput.EntityHeader");
diff --git a/core/jni/android_backup_BackupDataOutput.cpp b/core/jni/android_backup_BackupDataOutput.cpp
index 144a10c..f4b5dca 100644
--- a/core/jni/android_backup_BackupDataOutput.cpp
+++ b/core/jni/android_backup_BackupDataOutput.cpp
@@ -107,7 +107,7 @@
 
 int register_android_backup_BackupDataOutput(JNIEnv* env)
 {
-    //LOGD("register_android_backup_BackupDataOutput");
+    //ALOGD("register_android_backup_BackupDataOutput");
     return AndroidRuntime::registerNativeMethods(env, "android/app/backup/BackupDataOutput",
             g_methods, NELEM(g_methods));
 }
diff --git a/core/jni/android_backup_BackupHelperDispatcher.cpp b/core/jni/android_backup_BackupHelperDispatcher.cpp
index 49f1cd4..3e36677 100644
--- a/core/jni/android_backup_BackupHelperDispatcher.cpp
+++ b/core/jni/android_backup_BackupHelperDispatcher.cpp
@@ -58,7 +58,7 @@
     int remainingHeader = flattenedHeader.headerSize - sizeof(flattenedHeader.headerSize);
 
     if (flattenedHeader.headerSize < (int)sizeof(chunk_header_v1)) {
-        LOGW("Skipping unknown header: %d bytes", flattenedHeader.headerSize);
+        ALOGW("Skipping unknown header: %d bytes", flattenedHeader.headerSize);
         if (remainingHeader > 0) {
             lseek(fd, remainingHeader, SEEK_CUR);
             // >0 means skip this chunk
@@ -69,13 +69,13 @@
     amt = read(fd, &flattenedHeader.version,
             sizeof(chunk_header_v1)-sizeof(flattenedHeader.headerSize));
     if (amt <= 0) {
-        LOGW("Failed reading chunk header");
+        ALOGW("Failed reading chunk header");
         return -1;
     }
     remainingHeader -= sizeof(chunk_header_v1)-sizeof(flattenedHeader.headerSize);
 
     if (flattenedHeader.version != VERSION_1_HEADER) {
-        LOGW("Skipping unknown header version: 0x%08x, %d bytes", flattenedHeader.version,
+        ALOGW("Skipping unknown header version: 0x%08x, %d bytes", flattenedHeader.version,
                 flattenedHeader.headerSize);
         if (remainingHeader > 0) {
             lseek(fd, remainingHeader, SEEK_CUR);
@@ -85,23 +85,23 @@
     }
 
 #if 0
-    LOGD("chunk header:");
-    LOGD("  headerSize=%d", flattenedHeader.headerSize);
-    LOGD("  version=0x%08x", flattenedHeader.version);
-    LOGD("  dataSize=%d", flattenedHeader.dataSize);
-    LOGD("  nameLength=%d", flattenedHeader.nameLength);
+    ALOGD("chunk header:");
+    ALOGD("  headerSize=%d", flattenedHeader.headerSize);
+    ALOGD("  version=0x%08x", flattenedHeader.version);
+    ALOGD("  dataSize=%d", flattenedHeader.dataSize);
+    ALOGD("  nameLength=%d", flattenedHeader.nameLength);
 #endif
 
     if (flattenedHeader.dataSize < 0 || flattenedHeader.nameLength < 0 ||
             remainingHeader < flattenedHeader.nameLength) {
-        LOGW("Malformed V1 header remainingHeader=%d dataSize=%d nameLength=%d", remainingHeader,
+        ALOGW("Malformed V1 header remainingHeader=%d dataSize=%d nameLength=%d", remainingHeader,
                 flattenedHeader.dataSize, flattenedHeader.nameLength);
         return -1;
     }
 
     buf = keyPrefix.lockBuffer(flattenedHeader.nameLength);
     if (buf == NULL) {
-        LOGW("unable to allocate %d bytes", flattenedHeader.nameLength);
+        ALOGW("unable to allocate %d bytes", flattenedHeader.nameLength);
         return -1;
     }
 
diff --git a/core/jni/android_bluetooth_BluetoothAudioGateway.cpp b/core/jni/android_bluetooth_BluetoothAudioGateway.cpp
index 29c9c2d..3b8fb79 100755
--- a/core/jni/android_bluetooth_BluetoothAudioGateway.cpp
+++ b/core/jni/android_bluetooth_BluetoothAudioGateway.cpp
@@ -90,7 +90,7 @@
 #endif
 
 static void classInitNative(JNIEnv* env, jclass clazz) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
 
     /* in */
@@ -123,11 +123,11 @@
 }
 
 static void initializeNativeDataNative(JNIEnv* env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = (native_data_t *)calloc(1, sizeof(native_data_t));
     if (NULL == nat) {
-        LOGE("%s: out of memory!", __FUNCTION__);
+        ALOGE("%s: out of memory!", __FUNCTION__);
         return;
     }
 
@@ -138,8 +138,8 @@
         env->GetIntField(object, field_mHandsfreeAgRfcommChannel);
     nat->hs_ag_rfcomm_channel =
         env->GetIntField(object, field_mHeadsetAgRfcommChannel);
-    LOGV("HF RFCOMM channel = %d.", nat->hf_ag_rfcomm_channel);
-    LOGV("HS RFCOMM channel = %d.", nat->hs_ag_rfcomm_channel);
+    ALOGV("HF RFCOMM channel = %d.", nat->hf_ag_rfcomm_channel);
+    ALOGV("HS RFCOMM channel = %d.", nat->hs_ag_rfcomm_channel);
 
     /* Set the default values of these to -1. */
     env->SetIntField(object, field_mConnectingHeadsetRfcommChannel, -1);
@@ -151,7 +151,7 @@
 }
 
 static void cleanupNativeDataNative(JNIEnv* env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
@@ -166,7 +166,7 @@
 static int set_nb(int sk, bool nb) {
     int flags = fcntl(sk, F_GETFL);
     if (flags < 0) {
-        LOGE("Can't get socket flags with fcntl(): %s (%d)",
+        ALOGE("Can't get socket flags with fcntl(): %s (%d)",
              strerror(errno), errno);
         close(sk);
         return -1;
@@ -175,7 +175,7 @@
     if (nb) flags |= O_NONBLOCK;
     int status = fcntl(sk, F_SETFL, flags);
     if (status < 0) {
-        LOGE("Can't set socket to nonblocking mode with fcntl(): %s (%d)",
+        ALOGE("Can't set socket to nonblocking mode with fcntl(): %s (%d)",
              strerror(errno), errno);
         close(sk);
         return -1;
@@ -198,7 +198,7 @@
     int alen = sizeof(raddr);
     int nsk = accept(ag_fd, (struct sockaddr *) &raddr, &alen);
     if (nsk < 0) {
-        LOGE("Error on accept from socket fd %d: %s (%d).",
+        ALOGE("Error on accept from socket fd %d: %s (%d).",
              ag_fd,
              strerror(errno),
              errno);
@@ -215,7 +215,7 @@
     get_bdaddr_as_string(&raddr.rc_bdaddr, addr);
     env->SetObjectField(object, out_address, env->NewStringUTF(addr));
 
-    LOGI("Successful accept() on AG socket %d: new socket %d, address %s, RFCOMM channel %d",
+    ALOGI("Successful accept() on AG socket %d: new socket %d, address %s, RFCOMM channel %d",
          ag_fd,
          nsk,
          addr,
@@ -240,11 +240,11 @@
                          out_fd, out_address, out_channel);
     }
     else {
-        LOGI("fd = %d, FD_ISSET() = %d",
+        ALOGI("fd = %d, FD_ISSET() = %d",
              ag_fd,
              FD_ISSET(ag_fd, &rset));
         if (ag_fd >= 0 && !FD_ISSET(ag_fd, &rset)) {
-            LOGE("WTF???");
+            ALOGE("WTF???");
             return -1;
         }
     }
@@ -256,7 +256,7 @@
 
 static jboolean waitForHandsfreeConnectNative(JNIEnv* env, jobject object,
                                               jint timeout_ms) {
-//    LOGV("%s", __FUNCTION__);
+//    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
 
     env->SetIntField(object, field_mTimeoutRemainingMs, timeout_ms);
@@ -265,32 +265,32 @@
     native_data_t *nat = get_native_data(env, object);
 #if USE_ACCEPT_DIRECTLY
     if (nat->hf_ag_rfcomm_channel > 0) {
-        LOGI("Setting HF AG server socket to RFCOMM port %d!",
+        ALOGI("Setting HF AG server socket to RFCOMM port %d!",
              nat->hf_ag_rfcomm_channel);
         struct timeval tv;
         int len = sizeof(tv);
         if (getsockopt(nat->hf_ag_rfcomm_channel,
                        SOL_SOCKET, SO_RCVTIMEO, &tv, &len) < 0) {
-            LOGE("getsockopt(%d, SOL_SOCKET, SO_RCVTIMEO): %s (%d)",
+            ALOGE("getsockopt(%d, SOL_SOCKET, SO_RCVTIMEO): %s (%d)",
                  nat->hf_ag_rfcomm_channel,
                  strerror(errno),
                  errno);
             return JNI_FALSE;
         }
-        LOGI("Current HF AG server socket RCVTIMEO is (%d(s), %d(us))!",
+        ALOGI("Current HF AG server socket RCVTIMEO is (%d(s), %d(us))!",
              (int)tv.tv_sec, (int)tv.tv_usec);
         if (timeout_ms >= 0) {
             tv.tv_sec = timeout_ms / 1000;
             tv.tv_usec = 1000 * (timeout_ms % 1000);
             if (setsockopt(nat->hf_ag_rfcomm_channel,
                            SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) {
-                LOGE("setsockopt(%d, SOL_SOCKET, SO_RCVTIMEO): %s (%d)",
+                ALOGE("setsockopt(%d, SOL_SOCKET, SO_RCVTIMEO): %s (%d)",
                      nat->hf_ag_rfcomm_channel,
                      strerror(errno),
                      errno);
                 return JNI_FALSE;
             }
-            LOGI("Changed HF AG server socket RCVTIMEO to (%d(s), %d(us))!",
+            ALOGI("Changed HF AG server socket RCVTIMEO to (%d(s), %d(us))!",
                  (int)tv.tv_sec, (int)tv.tv_usec);
         }
 
@@ -310,19 +310,19 @@
     FD_ZERO(&rset);
     int cnt = 0;
     if (nat->hf_ag_rfcomm_channel > 0) {
-        LOGI("Setting HF AG server socket to RFCOMM port %d!",
+        ALOGI("Setting HF AG server socket to RFCOMM port %d!",
              nat->hf_ag_rfcomm_channel);
         cnt++;
         FD_SET(nat->hf_ag_rfcomm_sock, &rset);
     }
     if (nat->hs_ag_rfcomm_channel > 0) {
-        LOGI("Setting HS AG server socket to RFCOMM port %d!",
+        ALOGI("Setting HS AG server socket to RFCOMM port %d!",
              nat->hs_ag_rfcomm_channel);
         cnt++;
         FD_SET(nat->hs_ag_rfcomm_sock, &rset);
     }
     if (cnt == 0) {
-        LOGE("Neither HF nor HS listening sockets are open!");
+        ALOGE("Neither HF nor HS listening sockets are open!");
         return JNI_FALSE;
     }
 
@@ -339,16 +339,16 @@
                    (timeout_ms < 0 ? NULL : &to));
     if (timeout_ms > 0) {
         jint remaining = to.tv_sec*1000 + to.tv_usec/1000;
-        LOGI("Remaining time %ldms", (long)remaining);
+        ALOGI("Remaining time %ldms", (long)remaining);
         env->SetIntField(object, field_mTimeoutRemainingMs,
                          remaining);
     }
 
-    LOGI("listening select() returned %d", n);
+    ALOGI("listening select() returned %d", n);
 
     if (n <= 0) {
         if (n < 0)  {
-            LOGE("listening select() on RFCOMM sockets: %s (%d)",
+            ALOGE("listening select() on RFCOMM sockets: %s (%d)",
                  strerror(errno),
                  errno);
         }
@@ -372,7 +372,7 @@
     struct pollfd fds[2];
     int cnt = 0;
     if (nat->hf_ag_rfcomm_channel > 0) {
-//        LOGI("Setting HF AG server socket %d to RFCOMM port %d!",
+//        ALOGI("Setting HF AG server socket %d to RFCOMM port %d!",
 //             nat->hf_ag_rfcomm_sock,
 //             nat->hf_ag_rfcomm_channel);
         fds[cnt].fd = nat->hf_ag_rfcomm_sock;
@@ -380,7 +380,7 @@
         cnt++;
     }
     if (nat->hs_ag_rfcomm_channel > 0) {
-//        LOGI("Setting HS AG server socket %d to RFCOMM port %d!",
+//        ALOGI("Setting HS AG server socket %d to RFCOMM port %d!",
 //             nat->hs_ag_rfcomm_sock,
 //             nat->hs_ag_rfcomm_channel);
         fds[cnt].fd = nat->hs_ag_rfcomm_sock;
@@ -388,30 +388,30 @@
         cnt++;
     }
     if (cnt == 0) {
-        LOGE("Neither HF nor HS listening sockets are open!");
+        ALOGE("Neither HF nor HS listening sockets are open!");
         return JNI_FALSE;
     }
     n = poll(fds, cnt, timeout_ms);
     if (n <= 0) {
         if (n < 0)  {
-            LOGE("listening poll() on RFCOMM sockets: %s (%d)",
+            ALOGE("listening poll() on RFCOMM sockets: %s (%d)",
                  strerror(errno),
                  errno);
         }
         else {
             env->SetIntField(object, field_mTimeoutRemainingMs, 0);
-//            LOGI("listening poll() on RFCOMM socket timed out");
+//            ALOGI("listening poll() on RFCOMM socket timed out");
         }
         return JNI_FALSE;
     }
 
-    //LOGI("listening poll() on RFCOMM socket returned %d", n);
+    //ALOGI("listening poll() on RFCOMM socket returned %d", n);
     int err = 0;
     for (cnt = 0; cnt < (int)(sizeof(fds)/sizeof(fds[0])); cnt++) {
-        //LOGI("Poll on fd %d revent = %d.", fds[cnt].fd, fds[cnt].revents);
+        //ALOGI("Poll on fd %d revent = %d.", fds[cnt].fd, fds[cnt].revents);
         if (fds[cnt].fd == nat->hf_ag_rfcomm_sock) {
             if (fds[cnt].revents & (POLLIN | POLLPRI | POLLOUT)) {
-                LOGI("Accepting HF connection.\n");
+                ALOGI("Accepting HF connection.\n");
                 err += do_accept(env, object, fds[cnt].fd,
                                field_mConnectingHandsfreeSocketFd,
                                field_mConnectingHandsfreeAddress,
@@ -421,7 +421,7 @@
         }
         else if (fds[cnt].fd == nat->hs_ag_rfcomm_sock) {
             if (fds[cnt].revents & (POLLIN | POLLPRI | POLLOUT)) {
-                LOGI("Accepting HS connection.\n");
+                ALOGI("Accepting HS connection.\n");
                 err += do_accept(env, object, fds[cnt].fd,
                                field_mConnectingHeadsetSocketFd,
                                field_mConnectingHeadsetAddress,
@@ -432,7 +432,7 @@
     } /* for */
 
     if (n != 0) {
-        LOGI("Bogus poll(): %d fake pollfd entrie(s)!", n);
+        ALOGI("Bogus poll(): %d fake pollfd entrie(s)!", n);
         return JNI_FALSE;
     }
 
@@ -445,7 +445,7 @@
 }
 
 static jboolean setUpListeningSocketsNative(JNIEnv* env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
 
@@ -475,7 +475,7 @@
 
     sk = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
     if (sk < 0) {
-        LOGE("Can't create RFCOMM socket");
+        ALOGE("Can't create RFCOMM socket");
         return -1;
     }
 
@@ -486,7 +486,7 @@
     }
 
     if (lm && setsockopt(sk, SOL_RFCOMM, RFCOMM_LM, &lm, sizeof(lm)) < 0) {
-        LOGE("Can't set RFCOMM link mode");
+        ALOGE("Can't set RFCOMM link mode");
         close(sk);
         return -1;
     }
@@ -497,7 +497,7 @@
     laddr.rc_channel = channel;
 
     if (bind(sk, (struct sockaddr *)&laddr, sizeof(laddr)) < 0) {
-        LOGE("Can't bind RFCOMM socket");
+        ALOGE("Can't bind RFCOMM socket");
         close(sk);
         return -1;
     }
@@ -511,20 +511,20 @@
     private native void tearDownListeningSocketsNative();
 */
 static void tearDownListeningSocketsNative(JNIEnv *env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
 
     if (nat->hf_ag_rfcomm_sock > 0) {
         if (close(nat->hf_ag_rfcomm_sock) < 0) {
-            LOGE("Could not close HF server socket: %s (%d)\n",
+            ALOGE("Could not close HF server socket: %s (%d)\n",
                  strerror(errno), errno);
         }
         nat->hf_ag_rfcomm_sock = -1;
     }
     if (nat->hs_ag_rfcomm_sock > 0) {
         if (close(nat->hs_ag_rfcomm_sock) < 0) {
-            LOGE("Could not close HS server socket: %s (%d)\n",
+            ALOGE("Could not close HS server socket: %s (%d)\n",
                  strerror(errno), errno);
         }
         nat->hs_ag_rfcomm_sock = -1;
diff --git a/core/jni/android_bluetooth_BluetoothSocket.cpp b/core/jni/android_bluetooth_BluetoothSocket.cpp
index 488b5c24..d9ff36a 100644
--- a/core/jni/android_bluetooth_BluetoothSocket.cpp
+++ b/core/jni/android_bluetooth_BluetoothSocket.cpp
@@ -70,12 +70,12 @@
 
 static void initSocketFromFdNative(JNIEnv *env, jobject obj, jint fd) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     struct asocket *s = asocket_init(fd);
 
     if (!s) {
-        LOGV("asocket_init() failed, throwing");
+        ALOGV("asocket_init() failed, throwing");
         jniThrowIOException(env, errno);
         return;
     }
@@ -89,7 +89,7 @@
 
 static void initSocketNative(JNIEnv *env, jobject obj) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     int fd;
     int lm = 0;
@@ -116,7 +116,7 @@
     }
 
     if (fd < 0) {
-        LOGV("socket() failed, throwing");
+        ALOGV("socket() failed, throwing");
         jniThrowIOException(env, errno);
         return;
     }
@@ -140,7 +140,7 @@
 
     if (lm) {
         if (setsockopt(fd, SOL_RFCOMM, RFCOMM_LM, &lm, sizeof(lm))) {
-            LOGV("setsockopt(RFCOMM_LM) failed, throwing");
+            ALOGV("setsockopt(RFCOMM_LM) failed, throwing");
             jniThrowIOException(env, errno);
             return;
         }
@@ -149,13 +149,13 @@
     if (type == TYPE_RFCOMM) {
         sndbuf = RFCOMM_SO_SNDBUF;
         if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(sndbuf))) {
-            LOGV("setsockopt(SO_SNDBUF) failed, throwing");
+            ALOGV("setsockopt(SO_SNDBUF) failed, throwing");
             jniThrowIOException(env, errno);
             return;
         }
     }
 
-    LOGV("...fd %d created (%s, lm = %x)", fd, TYPE_AS_STR(type), lm);
+    ALOGV("...fd %d created (%s, lm = %x)", fd, TYPE_AS_STR(type), lm);
 
     initSocketFromFdNative(env, obj, fd);
     return;
@@ -165,7 +165,7 @@
 
 static void connectNative(JNIEnv *env, jobject obj) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     int ret;
     jint type;
@@ -232,7 +232,7 @@
 
 connect:
     ret = asocket_connect(s, addr, addr_sz, -1);
-    LOGV("...connect(%d, %s) = %d (errno %d)",
+    ALOGV("...connect(%d, %s) = %d (errno %d)",
             s->fd, TYPE_AS_STR(type), ret, errno);
 
     if (ret && errno == EALREADY && retry < 2) {
@@ -240,7 +240,7 @@
          * retry the connect. Unfortunately we have to create a new fd.
          * It's not ideal to switch the fd underneath the object, but
          * is currently safe */
-        LOGD("Hit bug 5082381 (EALREADY on ACL collision), trying workaround");
+        ALOGD("Hit bug 5082381 (EALREADY on ACL collision), trying workaround");
         usleep(100000);
         retry++;
         abortNative(env, obj);
@@ -252,7 +252,7 @@
         goto connect;
     }
     if (!ret && retry > 0)
-        LOGD("...workaround ok");
+        ALOGD("...workaround ok");
 
     if (ret)
         jniThrowIOException(env, errno);
@@ -265,7 +265,7 @@
 /* Returns errno instead of throwing, so java can check errno */
 static int bindListenNative(JNIEnv *env, jobject obj) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     jint type;
     socklen_t addr_sz;
@@ -313,16 +313,16 @@
     }
 
     if (bind(s->fd, addr, addr_sz)) {
-        LOGV("...bind(%d) gave errno %d", s->fd, errno);
+        ALOGV("...bind(%d) gave errno %d", s->fd, errno);
         return errno;
     }
 
     if (listen(s->fd, 1)) {
-        LOGV("...listen(%d) gave errno %d", s->fd, errno);
+        ALOGV("...listen(%d) gave errno %d", s->fd, errno);
         return errno;
     }
 
-    LOGV("...bindListenNative(%d) success", s->fd);
+    ALOGV("...bindListenNative(%d) success", s->fd);
 
     return 0;
 
@@ -332,7 +332,7 @@
 
 static jobject acceptNative(JNIEnv *env, jobject obj, int timeout) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     int fd;
     jint type;
@@ -380,7 +380,7 @@
 
     fd = asocket_accept(s, addr, &addr_sz, timeout);
 
-    LOGV("...accept(%d, %s) = %d (errno %d)",
+    ALOGV("...accept(%d, %s) = %d (errno %d)",
             s->fd, TYPE_AS_STR(type), fd, errno);
 
     if (fd < 0) {
@@ -405,7 +405,7 @@
 
 static jint availableNative(JNIEnv *env, jobject obj) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     int available;
     struct asocket *s = get_socketData(env, obj);
@@ -428,7 +428,7 @@
 static jint readNative(JNIEnv *env, jobject obj, jbyteArray jb, jint offset,
         jint length) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     int ret;
     jbyte *b;
@@ -471,7 +471,7 @@
 static jint writeNative(JNIEnv *env, jobject obj, jbyteArray jb, jint offset,
         jint length) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     int ret, total;
     jbyte *b;
@@ -519,7 +519,7 @@
 
 static void abortNative(JNIEnv *env, jobject obj) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     struct asocket *s = get_socketData(env, obj);
 
     if (!s)
@@ -527,7 +527,7 @@
 
     asocket_abort(s);
 
-    LOGV("...asocket_abort(%d) complete", s->fd);
+    ALOGV("...asocket_abort(%d) complete", s->fd);
     return;
 #endif
     jniThrowIOException(env, ENOSYS);
@@ -535,7 +535,7 @@
 
 static void destroyNative(JNIEnv *env, jobject obj) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     struct asocket *s = get_socketData(env, obj);
     int fd = s->fd;
 
@@ -544,7 +544,7 @@
 
     asocket_destroy(s);
 
-    LOGV("...asocket_destroy(%d) complete", fd);
+    ALOGV("...asocket_destroy(%d) complete", fd);
     return;
 #endif
     jniThrowIOException(env, ENOSYS);
diff --git a/core/jni/android_bluetooth_HeadsetBase.cpp b/core/jni/android_bluetooth_HeadsetBase.cpp
index 5b21c56..a982182 100644
--- a/core/jni/android_bluetooth_HeadsetBase.cpp
+++ b/core/jni/android_bluetooth_HeadsetBase.cpp
@@ -69,12 +69,12 @@
     errno = 0;
     ret = write(fd, line, len);
     if (ret < 0) {
-        LOGE("%s: write() failed: %s (%d)", __FUNCTION__, strerror(errno),
+        ALOGE("%s: write() failed: %s (%d)", __FUNCTION__, strerror(errno),
              errno);
         return -1;
     }
     if (ret != len) {
-        LOGE("%s: write() only wrote %d of %d bytes", __FUNCTION__, ret, len);
+        ALOGE("%s: write() only wrote %d of %d bytes", __FUNCTION__, ret, len);
         return -1;
     }
     return 0;
@@ -117,7 +117,7 @@
     *err = errno = 0;
     int ret = poll(&pfd, 1, timeout_ms);
     if (ret < 0) {
-        LOGE("poll() error\n");
+        ALOGE("poll() error\n");
         *err = errno;
         return NULL;
     }
@@ -126,7 +126,7 @@
     }
 
     if (pfd.revents & (POLLHUP | POLLERR | POLLNVAL)) {
-        LOGW("RFCOMM poll() returned  success (%d), "
+        ALOGW("RFCOMM poll() returned  success (%d), "
              "but with an unexpected revents bitmask: %#x\n", ret, pfd.revents);
         errno = EIO;
         *err = errno;
@@ -143,12 +143,12 @@
 
         if (rc < 0) {
             if (errno == EBUSY) {
-                LOGI("read() error %s (%d): repeating read()...",
+                ALOGI("read() error %s (%d): repeating read()...",
                      strerror(errno), errno);
                 goto again;
             }
             *err = errno;
-            LOGE("read() error %s (%d)", strerror(errno), errno);
+            ALOGE("read() error %s (%d)", strerror(errno), errno);
             return NULL;
         }
 
@@ -180,7 +180,7 @@
 #endif
 
 static void classInitNative(JNIEnv* env, jclass clazz) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     field_mNativeData = get_field(env, clazz, "mNativeData", "I");
     field_mAddress = get_field(env, clazz, "mAddress", "Ljava/lang/String;");
@@ -191,11 +191,11 @@
 
 static void initializeNativeDataNative(JNIEnv* env, jobject object,
                                        jint socketFd) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = (native_data_t *)calloc(1, sizeof(native_data_t));
     if (NULL == nat) {
-        LOGE("%s: out of memory!", __FUNCTION__);
+        ALOGE("%s: out of memory!", __FUNCTION__);
         return;
     }
 
@@ -208,12 +208,12 @@
     nat->rfcomm_sock = socketFd;
     nat->rfcomm_connected = socketFd >= 0;
     if (nat->rfcomm_connected)
-        LOGI("%s: ALREADY CONNECTED!", __FUNCTION__);
+        ALOGI("%s: ALREADY CONNECTED!", __FUNCTION__);
 #endif
 }
 
 static void cleanupNativeDataNative(JNIEnv* env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat =
         (native_data_t *)env->GetIntField(object, field_mNativeData);
@@ -226,7 +226,7 @@
 
 static jboolean connectNative(JNIEnv *env, jobject obj)
 {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     int lm;
     struct sockaddr_rc addr;
@@ -235,7 +235,7 @@
     nat->rfcomm_sock = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
 
     if (nat->rfcomm_sock < 0) {
-        LOGE("%s: Could not create RFCOMM socket: %s\n", __FUNCTION__,
+        ALOGE("%s: Could not create RFCOMM socket: %s\n", __FUNCTION__,
              strerror(errno));
         return JNI_FALSE;
     }
@@ -248,7 +248,7 @@
 
     if (lm && setsockopt(nat->rfcomm_sock, SOL_RFCOMM, RFCOMM_LM, &lm,
                 sizeof(lm)) < 0) {
-        LOGE("%s: Can't set RFCOMM link mode", __FUNCTION__);
+        ALOGE("%s: Can't set RFCOMM link mode", __FUNCTION__);
         close(nat->rfcomm_sock);
         return JNI_FALSE;
     }
@@ -262,7 +262,7 @@
         if (connect(nat->rfcomm_sock, (struct sockaddr *)&addr,
                       sizeof(addr)) < 0) {
             if (errno == EINTR) continue;
-            LOGE("%s: connect() failed: %s\n", __FUNCTION__, strerror(errno));
+            ALOGE("%s: connect() failed: %s\n", __FUNCTION__, strerror(errno));
             close(nat->rfcomm_sock);
             nat->rfcomm_sock = -1;
             return JNI_FALSE;
@@ -278,13 +278,13 @@
 }
 
 static jint connectAsyncNative(JNIEnv *env, jobject obj) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     struct sockaddr_rc addr;
     native_data_t *nat = get_native_data(env, obj);
 
     if (nat->rfcomm_connected) {
-        LOGV("RFCOMM socket is already connected or connection is in progress.");
+        ALOGV("RFCOMM socket is already connected or connection is in progress.");
         return 0;
     }
 
@@ -293,7 +293,7 @@
 
         nat->rfcomm_sock = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
         if (nat->rfcomm_sock < 0) {
-            LOGE("%s: Could not create RFCOMM socket: %s\n", __FUNCTION__,
+            ALOGE("%s: Could not create RFCOMM socket: %s\n", __FUNCTION__,
                  strerror(errno));
             return -1;
         }
@@ -306,11 +306,11 @@
 
         if (lm && setsockopt(nat->rfcomm_sock, SOL_RFCOMM, RFCOMM_LM, &lm,
                     sizeof(lm)) < 0) {
-            LOGE("%s: Can't set RFCOMM link mode", __FUNCTION__);
+            ALOGE("%s: Can't set RFCOMM link mode", __FUNCTION__);
             close(nat->rfcomm_sock);
             return -1;
         }
-        LOGI("Created RFCOMM socket fd %d.", nat->rfcomm_sock);
+        ALOGI("Created RFCOMM socket fd %d.", nat->rfcomm_sock);
     }
 
     memset(&addr, 0, sizeof(struct sockaddr_rc));
@@ -330,20 +330,20 @@
 
             if (rc >= 0) {
                 nat->rfcomm_connected = 1;
-                LOGI("async connect successful");
+                ALOGI("async connect successful");
                 return 0;
             }
             else if (rc < 0) {
                 if (errno == EINPROGRESS || errno == EAGAIN)
                 {
-                    LOGI("async connect is in progress (%s)",
+                    ALOGI("async connect is in progress (%s)",
                          strerror(errno));
                     nat->rfcomm_connected = -1;
                     return 0;
                 }
                 else
                 {
-                    LOGE("async connect error: %s (%d)", strerror(errno), errno);
+                    ALOGE("async connect error: %s (%d)", strerror(errno), errno);
                     close(nat->rfcomm_sock);
                     nat->rfcomm_sock = -1;
                     return -errno;
@@ -357,7 +357,7 @@
 
 static jint waitForAsyncConnectNative(JNIEnv *env, jobject obj,
                                            jint timeout_ms) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     struct sockaddr_rc addr;
     native_data_t *nat = get_native_data(env, obj);
@@ -365,19 +365,19 @@
     env->SetIntField(obj, field_mTimeoutRemainingMs, timeout_ms);
 
     if (nat->rfcomm_connected > 0) {
-        LOGI("RFCOMM is already connected!");
+        ALOGI("RFCOMM is already connected!");
         return 1;
     }
 
     if (nat->rfcomm_sock >= 0 && nat->rfcomm_connected == 0) {
-        LOGI("Re-opening RFCOMM socket.");
+        ALOGI("Re-opening RFCOMM socket.");
         close(nat->rfcomm_sock);
         nat->rfcomm_sock = -1;
     }
     int ret = connectAsyncNative(env, obj);
 
     if (ret < 0) {
-        LOGI("Failed to re-open RFCOMM socket!");
+        ALOGI("Failed to re-open RFCOMM socket!");
         return ret;
     }
 
@@ -403,14 +403,14 @@
 
         if (timeout_ms > 0) {
             jint remaining = to.tv_sec*1000 + to.tv_usec/1000;
-            LOGV("Remaining time %ldms", (long)remaining);
+            ALOGV("Remaining time %ldms", (long)remaining);
             env->SetIntField(obj, field_mTimeoutRemainingMs,
                              remaining);
         }
 
         if (n <= 0) {
             if (n < 0)  {
-                LOGE("select() on RFCOMM socket: %s (%d)",
+                ALOGE("select() on RFCOMM socket: %s (%d)",
                      strerror(errno),
                      errno);
                 return -errno;
@@ -419,7 +419,7 @@
         }
         /* n must be equal to 1 and either rset or wset must have the
            file descriptor set. */
-        LOGV("select() returned %d.", n);
+        ALOGV("select() returned %d.", n);
         if (FD_ISSET(nat->rfcomm_sock, &rset) ||
             FD_ISSET(nat->rfcomm_sock, &wset))
         {
@@ -433,7 +433,7 @@
                    respond... but one can't be paranoid enough.
                 */
                 if (nr >= 0 || errno != EAGAIN) {
-                    LOGE("RFCOMM async connect() error: %s (%d), nr = %d\n",
+                    ALOGE("RFCOMM async connect() error: %s (%d), nr = %d\n",
                          strerror(errno),
                          errno,
                          nr);
@@ -451,19 +451,19 @@
             }
             /* Restore the blocking properties of the socket. */
             fcntl(nat->rfcomm_sock, F_SETFL, nat->rfcomm_sock_flags);
-            LOGI("Successful RFCOMM socket connect.");
+            ALOGI("Successful RFCOMM socket connect.");
             nat->rfcomm_connected = 1;
             return 1;
         }
     }
-    else LOGE("RFCOMM socket file descriptor %d is bad!",
+    else ALOGE("RFCOMM socket file descriptor %d is bad!",
               nat->rfcomm_sock);
 #endif
     return -1;
 }
 
 static void disconnectNative(JNIEnv *env, jobject obj) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, obj);
     if (nat->rfcomm_sock >= 0) {
@@ -494,7 +494,7 @@
             }
         }
     }
-    IF_LOGV() LOG(LOG_VERBOSE, "Bluetooth AT sent", "%s", buf);
+    IF_ALOGV() ALOG(LOG_VERBOSE, "Bluetooth AT sent", "%s", buf);
 
     free(buf);
 }
diff --git a/core/jni/android_bluetooth_common.cpp b/core/jni/android_bluetooth_common.cpp
index 5c6f5e8..5cdaa6c 100644
--- a/core/jni/android_bluetooth_common.cpp
+++ b/core/jni/android_bluetooth_common.cpp
@@ -101,7 +101,7 @@
                    const char *mtype) {
     jfieldID field = env->GetFieldID(clazz, member, mtype);
     if (field == NULL) {
-        LOGE("Can't find member %s", member);
+        ALOGE("Can't find member %s", member);
     }
     return field;
 }
@@ -158,13 +158,13 @@
     msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC, path, ifc, func);
 
     if (msg == NULL) {
-        LOGE("Could not allocate D-Bus message object!");
+        ALOGE("Could not allocate D-Bus message object!");
         goto done;
     }
 
     /* append arguments */
     if (!dbus_message_append_args_valist(msg, first_arg_type, args)) {
-        LOGE("Could not append argument to method call!");
+        ALOGE("Could not append argument to method call!");
         goto done;
     }
 
@@ -219,7 +219,7 @@
     return ret;
 }
 
-// If err is NULL, then any errors will be LOGE'd, and free'd and the reply
+// If err is NULL, then any errors will be ALOGE'd, and free'd and the reply
 // will be NULL.
 // If err is not NULL, then it is assumed that dbus_error_init was already
 // called, and error's will be returned to the caller without logging. The
@@ -248,13 +248,13 @@
     msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC, path, ifc, func);
 
     if (msg == NULL) {
-        LOGE("Could not allocate D-Bus message object!");
+        ALOGE("Could not allocate D-Bus message object!");
         goto done;
     }
 
     /* append arguments */
     if (!dbus_message_append_args_valist(msg, first_arg_type, args)) {
-        LOGE("Could not append argument to method call!");
+        ALOGE("Could not append argument to method call!");
         goto done;
     }
 
@@ -464,7 +464,7 @@
         jclass stringClass;
         jstring classNameStr;
 
-        //LOGV("%s: there are %d elements in string array!", __FUNCTION__, len);
+        //ALOGV("%s: there are %d elements in string array!", __FUNCTION__, len);
 
         stringClass = env->FindClass("java/lang/String");
         strArray = env->NewObjectArray(len, stringClass, NULL);
@@ -490,7 +490,7 @@
     if (dbus_message_get_args(reply, &err,
                               DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &list, &len,
                               DBUS_TYPE_INVALID)) {
-        //LOGV("%s: there are %d elements in byte array!", __FUNCTION__, len);
+        //ALOGV("%s: there are %d elements in byte array!", __FUNCTION__, len);
         byteArray = env->NewByteArray(len);
         if (byteArray)
             env->SetByteArrayRegion(byteArray, 0, len, list);
@@ -587,7 +587,7 @@
     dbus_message_iter_recurse(&iter, &prop_val);
     type = properties[*prop_index].type;
     if (dbus_message_iter_get_arg_type(&prop_val) != type) {
-        LOGE("Property type mismatch in get_property: %d, expected:%d, index:%d",
+        ALOGE("Property type mismatch in get_property: %d, expected:%d, index:%d",
              dbus_message_iter_get_arg_type(&prop_val), type, *prop_index);
         return -1;
     }
@@ -855,7 +855,7 @@
     property_get("debug.bt.no_encrypt", value, "");
     if (!strncmp("true", value, PROPERTY_VALUE_MAX) ||
         !strncmp("1", value, PROPERTY_VALUE_MAX)) {
-        LOGD("mandatory bluetooth encryption disabled");
+        ALOGD("mandatory bluetooth encryption disabled");
         return true;
     } else {
         return false;
diff --git a/core/jni/android_bluetooth_common.h b/core/jni/android_bluetooth_common.h
index 1f4da3a..daf4bb2 100644
--- a/core/jni/android_bluetooth_common.h
+++ b/core/jni/android_bluetooth_common.h
@@ -56,14 +56,14 @@
                    const char *member,
                    const char *mtype);
 
-// LOGE and free a D-Bus error
+// ALOGE and free a D-Bus error
 // Using #define so that __FUNCTION__ resolves usefully
 #define LOG_AND_FREE_DBUS_ERROR_WITH_MSG(err, msg) \
-    {   LOGE("%s: D-Bus error in %s: %s (%s)", __FUNCTION__, \
+    {   ALOGE("%s: D-Bus error in %s: %s (%s)", __FUNCTION__, \
         dbus_message_get_member((msg)), (err)->name, (err)->message); \
          dbus_error_free((err)); }
 #define LOG_AND_FREE_DBUS_ERROR(err) \
-    {   LOGE("%s: D-Bus error: %s (%s)", __FUNCTION__, \
+    {   ALOGE("%s: D-Bus error: %s (%s)", __FUNCTION__, \
         (err)->name, (err)->message); \
         dbus_error_free((err)); }
 
diff --git a/core/jni/android_database_CursorWindow.cpp b/core/jni/android_database_CursorWindow.cpp
index 9a87a10..f927064 100644
--- a/core/jni/android_database_CursorWindow.cpp
+++ b/core/jni/android_database_CursorWindow.cpp
@@ -71,7 +71,7 @@
     CursorWindow* window;
     status_t status = CursorWindow::create(name, cursorWindowSize, &window);
     if (status || !window) {
-        LOGE("Could not allocate CursorWindow '%s' of size %d due to error %d.",
+        ALOGE("Could not allocate CursorWindow '%s' of size %d due to error %d.",
                 name.string(), cursorWindowSize, status);
         return 0;
     }
@@ -86,7 +86,7 @@
     CursorWindow* window;
     status_t status = CursorWindow::createFromParcel(parcel, &window);
     if (status || !window) {
-        LOGE("Could not create CursorWindow from Parcel due to error %d.", status);
+        ALOGE("Could not create CursorWindow from Parcel due to error %d.", status);
         return 0;
     }
 
diff --git a/core/jni/android_database_SQLiteCompiledSql.cpp b/core/jni/android_database_SQLiteCompiledSql.cpp
index de4c5c8..857267a 100644
--- a/core/jni/android_database_SQLiteCompiledSql.cpp
+++ b/core/jni/android_database_SQLiteCompiledSql.cpp
@@ -66,7 +66,7 @@
 
     if (err == SQLITE_OK) {
         // Store the statement in the Java object for future calls
-        LOGV("Prepared statement %p on %p", statement, handle);
+        ALOGV("Prepared statement %p on %p", statement, handle);
         env->SetIntField(object, gStatementField, (int)statement);
         return statement;
     } else {
@@ -104,7 +104,7 @@
 
     clazz = env->FindClass("android/database/sqlite/SQLiteCompiledSql");
     if (clazz == NULL) {
-        LOGE("Can't find android/database/sqlite/SQLiteCompiledSql");
+        ALOGE("Can't find android/database/sqlite/SQLiteCompiledSql");
         return -1;
     }
 
@@ -112,7 +112,7 @@
     gStatementField = env->GetFieldID(clazz, "nStatement", "I");
 
     if (gHandleField == NULL || gStatementField == NULL) {
-        LOGE("Error locating fields");
+        ALOGE("Error locating fields");
         return -1;
     }
 
diff --git a/core/jni/android_database_SQLiteDatabase.cpp b/core/jni/android_database_SQLiteDatabase.cpp
index e0c900e..28c421d 100644
--- a/core/jni/android_database_SQLiteDatabase.cpp
+++ b/core/jni/android_database_SQLiteDatabase.cpp
@@ -79,7 +79,7 @@
     // skip printing this message if it is due to certain types of errors
     if (iErrCode == 0 || iErrCode == SQLITE_CONSTRAINT) return;
     // print databasename, errorcode and msg
-    LOGI("sqlite returned: error code = %d, msg = %s, db=%s\n", iErrCode, zMsg, databaseName);
+    ALOGI("sqlite returned: error code = %d, msg = %s, db=%s\n", iErrCode, zMsg, databaseName);
 }
 
 // register the logging func on sqlite. needs to be done BEFORE any sqlite3 func is called.
@@ -89,10 +89,10 @@
         return;
     }
 
-    LOGV("Registering sqlite logging func \n");
+    ALOGV("Registering sqlite logging func \n");
     int err = sqlite3_config(SQLITE_CONFIG_LOG, &sqlLogger, (void *)createStr(path, 0));
     if (err != SQLITE_OK) {
-        LOGW("sqlite returned error = %d when trying to register logging func.\n", err);
+        ALOGW("sqlite returned error = %d when trying to register logging func.\n", err);
         return;
     }
     loggingFuncSet = true;
@@ -121,7 +121,7 @@
 
     err = sqlite3_open_v2(path8, &handle, sqliteFlags, NULL);
     if (err != SQLITE_OK) {
-        LOGE("sqlite3_open_v2(\"%s\", &handle, %d, NULL) failed\n", path8, sqliteFlags);
+        ALOGE("sqlite3_open_v2(\"%s\", &handle, %d, NULL) failed\n", path8, sqliteFlags);
         throw_sqlite3_exception(env, handle);
         goto done;
     }
@@ -134,7 +134,7 @@
     // Set the default busy handler to retry for 1000ms and then return SQLITE_BUSY
     err = sqlite3_busy_timeout(handle, 1000 /* ms */);
     if (err != SQLITE_OK) {
-        LOGE("sqlite3_busy_timeout(handle, 1000) failed for \"%s\"\n", path8);
+        ALOGE("sqlite3_busy_timeout(handle, 1000) failed for \"%s\"\n", path8);
         throw_sqlite3_exception(env, handle);
         goto done;
     }
@@ -143,7 +143,7 @@
     static const char* integritySql = "pragma integrity_check(1);";
     err = sqlite3_prepare_v2(handle, integritySql, -1, &statement, NULL);
     if (err != SQLITE_OK) {
-        LOGE("sqlite_prepare_v2(handle, \"%s\") failed for \"%s\"\n", integritySql, path8);
+        ALOGE("sqlite_prepare_v2(handle, \"%s\") failed for \"%s\"\n", integritySql, path8);
         throw_sqlite3_exception(env, handle);
         goto done;
     }
@@ -151,13 +151,13 @@
     // first is OK or error message
     err = sqlite3_step(statement);
     if (err != SQLITE_ROW) {
-        LOGE("integrity check failed for \"%s\"\n", integritySql, path8);
+        ALOGE("integrity check failed for \"%s\"\n", integritySql, path8);
         throw_sqlite3_exception(env, handle);
         goto done;
     } else {
         const char *text = (const char*)sqlite3_column_text(statement, 0);
         if (strcmp(text, "ok") != 0) {
-            LOGE("integrity check failed for \"%s\": %s\n", integritySql, path8, text);
+            ALOGE("integrity check failed for \"%s\": %s\n", integritySql, path8, text);
             jniThrowException(env, "android/database/sqlite/SQLiteDatabaseCorruptException", text);
             goto done;
         }
@@ -170,7 +170,7 @@
         goto done;
     }
 
-    LOGV("Opened '%s' - %p\n", path8, handle);
+    ALOGV("Opened '%s' - %p\n", path8, handle);
     env->SetIntField(object, offset_db_handle, (int) handle);
     handle = NULL;  // The caller owns the handle now.
 
@@ -184,7 +184,7 @@
 static char *getDatabaseName(JNIEnv* env, sqlite3 * handle, jstring databaseName, short connNum) {
     char const *path = env->GetStringUTFChars(databaseName, NULL);
     if (path == NULL) {
-        LOGE("Failure in getDatabaseName(). VM ran out of memory?\n");
+        ALOGE("Failure in getDatabaseName(). VM ran out of memory?\n");
         return NULL; // VM would have thrown OutOfMemoryError
     }
     char *dbNameStr = createStr(path, 4);
@@ -197,7 +197,7 @@
 }
 
 static void sqlTrace(void *databaseName, const char *sql) {
-    LOGI("sql_statement|%s|%s\n", (char *)databaseName, sql);
+    ALOGI("sql_statement|%s|%s\n", (char *)databaseName, sql);
 }
 
 /* public native void enableSqlTracing(); */
@@ -209,7 +209,7 @@
 
 static void sqlProfile(void *databaseName, const char *sql, sqlite3_uint64 tm) {
     double d = tm/1000000.0;
-    LOGI("elapsedTime4Sql|%s|%.3f ms|%s\n", (char *)databaseName, d, sql);
+    ALOGI("elapsedTime4Sql|%s|%.3f ms|%s\n", (char *)databaseName, d, sql);
 }
 
 /* public native void enableSqlProfiling(); */
@@ -236,15 +236,15 @@
         if (traceFuncArg != NULL) {
             free(traceFuncArg);
         }
-        LOGV("Closing database: handle=%p\n", handle);
+        ALOGV("Closing database: handle=%p\n", handle);
         int result = sqlite3_close(handle);
         if (result == SQLITE_OK) {
-            LOGV("Closed %p\n", handle);
+            ALOGV("Closed %p\n", handle);
             env->SetIntField(object, offset_db_handle, 0);
         } else {
             // This can happen if sub-objects aren't closed first.  Make sure the caller knows.
             throw_sqlite3_exception(env, handle);
-            LOGE("sqlite3_close(%p) failed: %d\n", handle, result);
+            ALOGE("sqlite3_close(%p) failed: %d\n", handle, result);
         }
     }
 }
@@ -277,7 +277,7 @@
         static const char *createSql ="CREATE TABLE IF NOT EXISTS " ANDROID_TABLE " (locale TEXT)";
         err = sqlite3_exec(handle, createSql, NULL, NULL, NULL);
         if (err != SQLITE_OK) {
-            LOGE("CREATE TABLE " ANDROID_TABLE " failed\n");
+            ALOGE("CREATE TABLE " ANDROID_TABLE " failed\n");
             throw_sqlite3_exception(env, handle);
             goto done;
         }
@@ -287,7 +287,7 @@
     static const char *selectSql = "SELECT locale FROM " ANDROID_TABLE " LIMIT 1";
     err = sqlite3_get_table(handle, selectSql, &meta, &rowCount, &colCount, NULL);
     if (err != SQLITE_OK) {
-        LOGE("SELECT locale FROM " ANDROID_TABLE " failed\n");
+        ALOGE("SELECT locale FROM " ANDROID_TABLE " failed\n");
         throw_sqlite3_exception(env, handle);
         goto done;
     }
@@ -312,21 +312,21 @@
     // need to update android_metadata and indexes atomically, so use a transaction...
     err = sqlite3_exec(handle, "BEGIN TRANSACTION", NULL, NULL, NULL);
     if (err != SQLITE_OK) {
-        LOGE("BEGIN TRANSACTION failed setting locale\n");
+        ALOGE("BEGIN TRANSACTION failed setting locale\n");
         throw_sqlite3_exception(env, handle);
         goto done;
     }
 
     err = register_localized_collators(handle, locale8, UTF16_STORAGE);
     if (err != SQLITE_OK) {
-        LOGE("register_localized_collators() failed setting locale\n");
+        ALOGE("register_localized_collators() failed setting locale\n");
         throw_sqlite3_exception(env, handle);
         goto rollback;
     }
 
     err = sqlite3_exec(handle, "DELETE FROM " ANDROID_TABLE, NULL, NULL, NULL);
     if (err != SQLITE_OK) {
-        LOGE("DELETE failed setting locale\n");
+        ALOGE("DELETE failed setting locale\n");
         throw_sqlite3_exception(env, handle);
         goto rollback;
     }
@@ -334,28 +334,28 @@
     static const char *sql = "INSERT INTO " ANDROID_TABLE " (locale) VALUES(?);";
     err = sqlite3_prepare_v2(handle, sql, -1, &stmt, NULL);
     if (err != SQLITE_OK) {
-        LOGE("sqlite3_prepare_v2(\"%s\") failed\n", sql);
+        ALOGE("sqlite3_prepare_v2(\"%s\") failed\n", sql);
         throw_sqlite3_exception(env, handle);
         goto rollback;
     }
 
     err = sqlite3_bind_text(stmt, 1, locale8, -1, SQLITE_TRANSIENT);
     if (err != SQLITE_OK) {
-        LOGE("sqlite3_bind_text() failed setting locale\n");
+        ALOGE("sqlite3_bind_text() failed setting locale\n");
         throw_sqlite3_exception(env, handle);
         goto rollback;
     }
 
     err = sqlite3_step(stmt);
     if (err != SQLITE_OK && err != SQLITE_DONE) {
-        LOGE("sqlite3_step(\"%s\") failed setting locale\n", sql);
+        ALOGE("sqlite3_step(\"%s\") failed setting locale\n", sql);
         throw_sqlite3_exception(env, handle);
         goto rollback;
     }
 
     err = sqlite3_exec(handle, "REINDEX LOCALIZED", NULL, NULL, NULL);
     if (err != SQLITE_OK) {
-        LOGE("REINDEX LOCALIZED failed\n");
+        ALOGE("REINDEX LOCALIZED failed\n");
         throw_sqlite3_exception(env, handle);
         goto rollback;
     }
@@ -363,7 +363,7 @@
     // all done, yay!
     err = sqlite3_exec(handle, "COMMIT TRANSACTION", NULL, NULL, NULL);
     if (err != SQLITE_OK) {
-        LOGE("COMMIT TRANSACTION failed setting locale\n");
+        ALOGE("COMMIT TRANSACTION failed setting locale\n");
         throw_sqlite3_exception(env, handle);
         goto done;
     }
@@ -399,7 +399,7 @@
 static void custom_function_callback(sqlite3_context * context, int argc, sqlite3_value ** argv) {
     JNIEnv* env = AndroidRuntime::getJNIEnv();
     if (!env) {
-        LOGE("custom_function_callback cannot call into Java on this thread");
+        ALOGE("custom_function_callback cannot call into Java on this thread");
         return;
     }
     // get global ref to CustomFunction object from our user data
@@ -412,7 +412,7 @@
     for (int i = 0; i < argc; i++) {
         char* arg = (char *)sqlite3_value_text(argv[i]);
         if (!arg) {
-            LOGE("NULL argument in custom_function_callback.  This should not happen.");
+            ALOGE("NULL argument in custom_function_callback.  This should not happen.");
             return;
         }
         jobject obj = env->NewStringUTF(arg);
@@ -427,7 +427,7 @@
 
 done:
     if (env->ExceptionCheck()) {
-        LOGE("An exception was thrown by custom sqlite3 function.");
+        ALOGE("An exception was thrown by custom sqlite3 function.");
         LOGE_EX(env);
         env->ExceptionClear();
     }
@@ -439,7 +439,7 @@
     sqlite3 * handle = (sqlite3 *)env->GetIntField(object, offset_db_handle);
     char const *nameStr = env->GetStringUTFChars(name, NULL);
     jobject ref = env->NewGlobalRef(function);
-    LOGD_IF(DEBUG_JNI, "native_addCustomFunction %s ref: %p", nameStr, ref);
+    ALOGD_IF(DEBUG_JNI, "native_addCustomFunction %s ref: %p", nameStr, ref);
     int err = sqlite3_create_function(handle, nameStr, numArgs, SQLITE_UTF8,
             (void *)ref, custom_function_callback, NULL, NULL);
     env->ReleaseStringUTFChars(name, nameStr);
@@ -447,7 +447,7 @@
     if (err == SQLITE_OK)
         return (int)ref;
     else {
-        LOGE("sqlite3_create_function returned %d", err);
+        ALOGE("sqlite3_create_function returned %d", err);
         env->DeleteGlobalRef(ref);
         throw_sqlite3_exception(env, handle);
         return 0;
@@ -456,7 +456,7 @@
 
 static void native_releaseCustomFunction(JNIEnv* env, jobject object, jint ref)
 {
-    LOGD_IF(DEBUG_JNI, "native_releaseCustomFunction %d", ref);
+    ALOGD_IF(DEBUG_JNI, "native_releaseCustomFunction %d", ref);
     env->DeleteGlobalRef((jobject)ref);
 }
 
@@ -484,30 +484,30 @@
 
     clazz = env->FindClass("android/database/sqlite/SQLiteDatabase");
     if (clazz == NULL) {
-        LOGE("Can't find android/database/sqlite/SQLiteDatabase\n");
+        ALOGE("Can't find android/database/sqlite/SQLiteDatabase\n");
         return -1;
     }
 
     string_class = (jclass)env->NewGlobalRef(env->FindClass("java/lang/String"));
     if (string_class == NULL) {
-        LOGE("Can't find java/lang/String\n");
+        ALOGE("Can't find java/lang/String\n");
         return -1;
     }
 
     offset_db_handle = env->GetFieldID(clazz, "mNativeHandle", "I");
     if (offset_db_handle == NULL) {
-        LOGE("Can't find SQLiteDatabase.mNativeHandle\n");
+        ALOGE("Can't find SQLiteDatabase.mNativeHandle\n");
         return -1;
     }
 
     clazz = env->FindClass("android/database/sqlite/SQLiteDatabase$CustomFunction");
     if (clazz == NULL) {
-        LOGE("Can't find android/database/sqlite/SQLiteDatabase$CustomFunction\n");
+        ALOGE("Can't find android/database/sqlite/SQLiteDatabase$CustomFunction\n");
         return -1;
     }
     method_custom_function_callback = env->GetMethodID(clazz, "callback", "([Ljava/lang/String;)V");
     if (method_custom_function_callback == NULL) {
-        LOGE("Can't find method SQLiteDatabase.CustomFunction.callback\n");
+        ALOGE("Can't find method SQLiteDatabase.CustomFunction.callback\n");
         return -1;
     }
 
diff --git a/core/jni/android_database_SQLiteDebug.cpp b/core/jni/android_database_SQLiteDebug.cpp
index 873b2a1..20ff00b 100644
--- a/core/jni/android_database_SQLiteDebug.cpp
+++ b/core/jni/android_database_SQLiteDebug.cpp
@@ -201,25 +201,25 @@
 
     clazz = env->FindClass("android/database/sqlite/SQLiteDebug$PagerStats");
     if (clazz == NULL) {
-        LOGE("Can't find android/database/sqlite/SQLiteDebug$PagerStats");
+        ALOGE("Can't find android/database/sqlite/SQLiteDebug$PagerStats");
         return -1;
     }
 
     gMemoryUsedField = env->GetFieldID(clazz, "memoryUsed", "I");
     if (gMemoryUsedField == NULL) {
-        LOGE("Can't find memoryUsed");
+        ALOGE("Can't find memoryUsed");
         return -1;
     }
 
     gLargestMemAllocField = env->GetFieldID(clazz, "largestMemAlloc", "I");
     if (gLargestMemAllocField == NULL) {
-        LOGE("Can't find largestMemAlloc");
+        ALOGE("Can't find largestMemAlloc");
         return -1;
     }
 
     gPageCacheOverfloField = env->GetFieldID(clazz, "pageCacheOverflo", "I");
     if (gPageCacheOverfloField == NULL) {
-        LOGE("Can't find pageCacheOverflo");
+        ALOGE("Can't find pageCacheOverflo");
         return -1;
     }
 
diff --git a/core/jni/android_database_SQLiteProgram.cpp b/core/jni/android_database_SQLiteProgram.cpp
index c247bbd..2e34c00 100644
--- a/core/jni/android_database_SQLiteProgram.cpp
+++ b/core/jni/android_database_SQLiteProgram.cpp
@@ -176,7 +176,7 @@
 
     clazz = env->FindClass("android/database/sqlite/SQLiteProgram");
     if (clazz == NULL) {
-        LOGE("Can't find android/database/sqlite/SQLiteProgram");
+        ALOGE("Can't find android/database/sqlite/SQLiteProgram");
         return -1;
     }
 
@@ -184,7 +184,7 @@
     gStatementField = env->GetFieldID(clazz, "nStatement", "I");
 
     if (gHandleField == NULL || gStatementField == NULL) {
-        LOGE("Error locating fields");
+        ALOGE("Error locating fields");
         return -1;
     }
 
diff --git a/core/jni/android_database_SQLiteQuery.cpp b/core/jni/android_database_SQLiteQuery.cpp
index 8170f46..aa5c4c9 100644
--- a/core/jni/android_database_SQLiteQuery.cpp
+++ b/core/jni/android_database_SQLiteQuery.cpp
@@ -47,7 +47,7 @@
         // Bind the offset parameter, telling the program which row to start with
         int err = sqlite3_bind_int(statement, offsetParam, startPos);
         if (err != SQLITE_OK) {
-            LOGE("Unable to bind offset position, offsetParam = %d", offsetParam);
+            ALOGE("Unable to bind offset position, offsetParam = %d", offsetParam);
             throw_sqlite3_exception(env, database);
             return 0;
         }
@@ -63,7 +63,7 @@
     int numColumns = sqlite3_column_count(statement);
     status_t status = window->setNumColumns(numColumns);
     if (status) {
-        LOGE("Failed to change column count from %d to %d", window->getNumColumns(), numColumns);
+        ALOGE("Failed to change column count from %d to %d", window->getNumColumns(), numColumns);
         jniThrowException(env, "java/lang/IllegalStateException", "numColumns mismatch");
         return 0;
     }
@@ -165,7 +165,7 @@
                     LOG_WINDOW("%d,%d is NULL", startPos + addedRows, i);
                 } else {
                     // Unknown data
-                    LOGE("Unknown column type when filling database window");
+                    ALOGE("Unknown column type when filling database window");
                     throw_sqlite3_exception(env, "Unknown column type when filling window");
                     gotException = true;
                     break;
@@ -186,7 +186,7 @@
             // The table is locked, retry
             LOG_WINDOW("Database locked, retrying");
             if (retryCount > 50) {
-                LOGE("Bailing on database busy retry");
+                ALOGE("Bailing on database busy retry");
                 throw_sqlite3_exception(env, database, "retrycount exceeded");
                 gotException = true;
             } else {
@@ -207,7 +207,7 @@
 
     // Report the total number of rows on request.
     if (startPos > totalRows) {
-        LOGE("startPos %d > actual rows %d", startPos, totalRows);
+        ALOGE("startPos %d > actual rows %d", startPos, totalRows);
     }
     return countAllRows ? totalRows : 0;
 }
diff --git a/core/jni/android_database_SQLiteStatement.cpp b/core/jni/android_database_SQLiteStatement.cpp
index 05ffbb1..e376258 100644
--- a/core/jni/android_database_SQLiteStatement.cpp
+++ b/core/jni/android_database_SQLiteStatement.cpp
@@ -169,7 +169,7 @@
     // Create ashmem area
     int fd = ashmem_create_region(NULL, length);
     if (fd < 0) {
-        LOGE("ashmem_create_region failed: %s", strerror(errno));
+        ALOGE("ashmem_create_region failed: %s", strerror(errno));
         jniThrowIOException(env, errno);
         return NULL;
     }
@@ -179,7 +179,7 @@
         void * ashmem_ptr =
                 mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
         if (ashmem_ptr == MAP_FAILED) {
-            LOGE("mmap failed: %s", strerror(errno));
+            ALOGE("mmap failed: %s", strerror(errno));
             jniThrowIOException(env, errno);
             close(fd);
             return NULL;
@@ -190,7 +190,7 @@
 
         // munmap ashmem area
         if (munmap(ashmem_ptr, length) < 0) {
-            LOGE("munmap failed: %s", strerror(errno));
+            ALOGE("munmap failed: %s", strerror(errno));
             jniThrowIOException(env, errno);
             close(fd);
             return NULL;
@@ -199,7 +199,7 @@
 
     // Make ashmem area read-only
     if (ashmem_set_prot_region(fd, PROT_READ) < 0) {
-        LOGE("ashmem_set_prot_region failed: %s", strerror(errno));
+        ALOGE("ashmem_set_prot_region failed: %s", strerror(errno));
         jniThrowIOException(env, errno);
         close(fd);
         return NULL;
@@ -267,7 +267,7 @@
 
     clazz = env->FindClass("android/database/sqlite/SQLiteStatement");
     if (clazz == NULL) {
-        LOGE("Can't find android/database/sqlite/SQLiteStatement");
+        ALOGE("Can't find android/database/sqlite/SQLiteStatement");
         return -1;
     }
 
@@ -275,7 +275,7 @@
     gStatementField = env->GetFieldID(clazz, "nStatement", "I");
 
     if (gHandleField == NULL || gStatementField == NULL) {
-        LOGE("Error locating fields");
+        ALOGE("Error locating fields");
         return -1;
     }
 
diff --git a/core/jni/android_ddm_DdmHandleNativeHeap.cpp b/core/jni/android_ddm_DdmHandleNativeHeap.cpp
index c3b4e3c..42d408d 100644
--- a/core/jni/android_ddm_DdmHandleNativeHeap.cpp
+++ b/core/jni/android_ddm_DdmHandleNativeHeap.cpp
@@ -87,7 +87,7 @@
                 header.mapSize += amount;
             } while (header.mapSize < MAPS_FILE_SIZE);
             
-            LOGD("**** read %d bytes from '%s'", (int) header.mapSize, path);
+            ALOGD("**** read %d bytes from '%s'", (int) header.mapSize, path);
         }
     }
 
@@ -105,7 +105,7 @@
     bytes = env->GetByteArrayElements(array, NULL);
     ptr = bytes;
 
-//    LOGD("*** mapSize: %d allocSize: %d allocInfoSize: %d totalMemory: %d", 
+//    ALOGD("*** mapSize: %d allocSize: %d allocInfoSize: %d totalMemory: %d", 
 //            header.mapSize, header.allocSize, header.allocInfoSize, header.totalMemory);
 
     memcpy(ptr, &header, sizeof(header));
diff --git a/core/jni/android_debug_JNITest.cpp b/core/jni/android_debug_JNITest.cpp
index f14201e..9147284 100644
--- a/core/jni/android_debug_JNITest.cpp
+++ b/core/jni/android_debug_JNITest.cpp
@@ -39,20 +39,20 @@
     jint arrayVal;
     int result = -2;
 
-    LOGI("JNI test: in part1, intArg=%d, doubleArg=%.3f\n", intArg, doubleArg);
+    ALOGI("JNI test: in part1, intArg=%d, doubleArg=%.3f\n", intArg, doubleArg);
 
     /* find "int part2(double doubleArg, int fromArray, String stringArg)" */
     clazz = env->GetObjectClass(object);
     part2id = env->GetMethodID(clazz,
                 "part2", "(DILjava/lang/String;)I");
     if (part2id == NULL) {
-        LOGE("JNI test: unable to find part2\n");
+        ALOGE("JNI test: unable to find part2\n");
         return -1;
     }
 
     /* get the length of the array */
     arrayLen = env->GetArrayLength(arrayArg);
-    LOGI("  array size is %d\n", arrayLen);
+    ALOGI("  array size is %d\n", arrayLen);
 
     /*
      * Get the last element in the array.
@@ -60,7 +60,7 @@
      * to multiple elements.
      */
     arrayVal = (int) env->GetObjectArrayElement(arrayArg, arrayLen-1);
-    LOGI("  array val is %d\n", arrayVal);
+    ALOGI("  array val is %d\n", arrayVal);
 
     /* call this->part2 */
     result = env->CallIntMethod(object, part2id,
@@ -79,11 +79,11 @@
     const char* utfChars;
     jboolean isCopy;
 
-    LOGI("JNI test: in part3\n");
+    ALOGI("JNI test: in part3\n");
 
     utfChars = env->GetStringUTFChars(stringArg, &isCopy);
 
-    LOGI("  String is '%s', isCopy=%d\n", (const char*) utfChars, isCopy);
+    ALOGI("  String is '%s', isCopy=%d\n", (const char*) utfChars, isCopy);
 
     env->ReleaseStringUTFChars(stringArg, utfChars);
 
diff --git a/core/jni/android_emoji_EmojiFactory.cpp b/core/jni/android_emoji_EmojiFactory.cpp
index 81dae88..a658561 100644
--- a/core/jni/android_emoji_EmojiFactory.cpp
+++ b/core/jni/android_emoji_EmojiFactory.cpp
@@ -60,7 +60,7 @@
     error_str = "unknown reason";
   }
 
-  LOGE("%s: %s", error_msg, error_str);
+  ALOGE("%s: %s", error_msg, error_str);
   if (m_handle != NULL) {
     dlclose(m_handle);
     m_handle = NULL;
@@ -109,7 +109,7 @@
   jobject obj = env->NewObject(gEmojiFactory_class, gEmojiFactory_constructorMethodID,
       static_cast<jint>(reinterpret_cast<uintptr_t>(factory)), name);
   if (env->ExceptionCheck() != 0) {
-    LOGE("*** Uncaught exception returned from Java call!\n");
+    ALOGE("*** Uncaught exception returned from Java call!\n");
     env->ExceptionDescribe();
   }
   return obj;
@@ -172,14 +172,14 @@
 
   SkBitmap *bitmap = new SkBitmap;
   if (!SkImageDecoder::DecodeMemory(bytes, size, bitmap)) {
-    LOGE("SkImageDecoder::DecodeMemory() failed.");
+    ALOGE("SkImageDecoder::DecodeMemory() failed.");
     return NULL;
   }
 
   jobject obj = env->NewObject(gBitmap_class, gBitmap_constructorMethodID,
       static_cast<jint>(reinterpret_cast<uintptr_t>(bitmap)), NULL, false, NULL, -1);
   if (env->ExceptionCheck() != 0) {
-    LOGE("*** Uncaught exception returned from Java call!\n");
+    ALOGE("*** Uncaught exception returned from Java call!\n");
     env->ExceptionDescribe();
   }
   return obj;
diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp
index fe60381..8dcc14a 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -115,7 +115,7 @@
     if (context != NULL) {
         camera = context->getCamera();
     }
-    LOGV("get_native_camera: context=%p, camera=%p", context, camera.get());
+    ALOGV("get_native_camera: context=%p, camera=%p", context, camera.get());
     if (camera == 0) {
         jniThrowRuntimeException(env, "Method called after release()");
     }
@@ -142,7 +142,7 @@
 
 void JNICameraContext::release()
 {
-    LOGV("release");
+    ALOGV("release");
     Mutex::Autolock _l(mLock);
     JNIEnv *env = AndroidRuntime::getJNIEnv();
 
@@ -168,12 +168,12 @@
 
 void JNICameraContext::notify(int32_t msgType, int32_t ext1, int32_t ext2)
 {
-    LOGV("notify");
+    ALOGV("notify");
 
     // VM pointer will be NULL if object is released
     Mutex::Autolock _l(mLock);
     if (mCameraJObjectWeak == NULL) {
-        LOGW("callback on dead camera object");
+        ALOGW("callback on dead camera object");
         return;
     }
     JNIEnv *env = AndroidRuntime::getJNIEnv();
@@ -198,7 +198,7 @@
 
     // Vector access should be protected by lock in postData()
     if (!buffers->isEmpty()) {
-        LOGV("Using callback buffer from queue of length %d", buffers->size());
+        ALOGV("Using callback buffer from queue of length %d", buffers->size());
         jbyteArray globalBuffer = buffers->itemAt(0);
         buffers->removeAt(0);
 
@@ -208,7 +208,7 @@
         if (obj != NULL) {
             jsize bufferLength = env->GetArrayLength(obj);
             if ((int)bufferLength < (int)bufferSize) {
-                LOGE("Callback buffer was too small! Expected %d bytes, but got %d bytes!",
+                ALOGE("Callback buffer was too small! Expected %d bytes, but got %d bytes!",
                     bufferSize, bufferLength);
                 env->DeleteLocalRef(obj);
                 return NULL;
@@ -228,7 +228,7 @@
         ssize_t offset;
         size_t size;
         sp<IMemoryHeap> heap = dataPtr->getMemory(&offset, &size);
-        LOGV("copyAndPost: off=%ld, size=%d", offset, size);
+        ALOGV("copyAndPost: off=%ld, size=%d", offset, size);
         uint8_t *heapBase = (uint8_t*)heap->base();
 
         if (heapBase != NULL) {
@@ -240,7 +240,7 @@
                 obj = getCallbackBuffer(env, &mCallbackBuffers, size);
 
                 if (mCallbackBuffers.isEmpty()) {
-                    LOGV("Out of buffers, clearing callback!");
+                    ALOGV("Out of buffers, clearing callback!");
                     mCamera->setPreviewCallbackFlags(CAMERA_FRAME_CALLBACK_FLAG_NOOP);
                     mManualCameraCallbackSet = false;
 
@@ -249,18 +249,18 @@
                     }
                 }
             } else {
-                LOGV("Allocating callback buffer");
+                ALOGV("Allocating callback buffer");
                 obj = env->NewByteArray(size);
             }
 
             if (obj == NULL) {
-                LOGE("Couldn't allocate byte array for JPEG data");
+                ALOGE("Couldn't allocate byte array for JPEG data");
                 env->ExceptionClear();
             } else {
                 env->SetByteArrayRegion(obj, 0, size, data);
             }
         } else {
-            LOGE("image heap is NULL");
+            ALOGE("image heap is NULL");
         }
     }
 
@@ -279,7 +279,7 @@
     Mutex::Autolock _l(mLock);
     JNIEnv *env = AndroidRuntime::getJNIEnv();
     if (mCameraJObjectWeak == NULL) {
-        LOGW("callback on dead camera object");
+        ALOGW("callback on dead camera object");
         return;
     }
 
@@ -294,7 +294,7 @@
         // For backward-compatibility purpose, if there is no callback
         // buffer for raw image, the callback returns null.
         case CAMERA_MSG_RAW_IMAGE:
-            LOGV("rawCallback");
+            ALOGV("rawCallback");
             if (mRawImageCallbackBuffers.isEmpty()) {
                 env->CallStaticVoidMethod(mCameraJClass, fields.post_event,
                         mCameraJObjectWeak, dataMsgType, 0, 0, NULL);
@@ -308,7 +308,7 @@
             break;
 
         default:
-            LOGV("dataCallback(%d, %p)", dataMsgType, dataPtr.get());
+            ALOGV("dataCallback(%d, %p)", dataMsgType, dataPtr.get());
             copyAndPost(env, dataPtr, dataMsgType);
             break;
     }
@@ -331,7 +331,7 @@
     obj = (jobjectArray) env->NewObjectArray(metadata->number_of_faces,
                                              mFaceClass, NULL);
     if (obj == NULL) {
-        LOGE("Couldn't allocate face metadata array");
+        ALOGE("Couldn't allocate face metadata array");
         return;
     }
 
@@ -386,7 +386,7 @@
 void JNICameraContext::addCallbackBuffer(
         JNIEnv *env, jbyteArray cbb, int msgType)
 {
-    LOGV("addCallbackBuffer: 0x%x", msgType);
+    ALOGV("addCallbackBuffer: 0x%x", msgType);
     if (cbb != NULL) {
         Mutex::Autolock _l(mLock);
         switch (msgType) {
@@ -394,7 +394,7 @@
                 jbyteArray callbackBuffer = (jbyteArray)env->NewGlobalRef(cbb);
                 mCallbackBuffers.push(callbackBuffer);
 
-                LOGV("Adding callback buffer to queue, %d total",
+                ALOGV("Adding callback buffer to queue, %d total",
                         mCallbackBuffers.size());
 
                 // We want to make sure the camera knows we're ready for the
@@ -419,7 +419,7 @@
             }
         }
     } else {
-       LOGE("Null byte array!");
+       ALOGE("Null byte array!");
     }
 }
 
@@ -430,7 +430,7 @@
 }
 
 void JNICameraContext::clearCallbackBuffers_l(JNIEnv *env, Vector<jbyteArray> *buffers) {
-    LOGV("Clearing callback buffers, %d remained", buffers->size());
+    ALOGV("Clearing callback buffers, %d remained", buffers->size());
     while (!buffers->isEmpty()) {
         env->DeleteGlobalRef(buffers->top());
         buffers->pop();
@@ -494,8 +494,8 @@
 // finalizer is invoked later.
 static void android_hardware_Camera_release(JNIEnv *env, jobject thiz)
 {
-    // TODO: Change to LOGV
-    LOGV("release camera");
+    // TODO: Change to ALOGV
+    ALOGV("release camera");
     JNICameraContext* context = NULL;
     sp<Camera> camera;
     {
@@ -510,7 +510,7 @@
     if (context != NULL) {
         camera = context->getCamera();
         context->release();
-        LOGV("native_release: context=%p camera=%p", context, camera.get());
+        ALOGV("native_release: context=%p camera=%p", context, camera.get());
 
         // clear callbacks
         if (camera != NULL) {
@@ -525,7 +525,7 @@
 
 static void android_hardware_Camera_setPreviewDisplay(JNIEnv *env, jobject thiz, jobject jSurface)
 {
-    LOGV("setPreviewDisplay");
+    ALOGV("setPreviewDisplay");
     sp<Camera> camera = get_native_camera(env, thiz, NULL);
     if (camera == 0) return;
 
@@ -541,7 +541,7 @@
 static void android_hardware_Camera_setPreviewTexture(JNIEnv *env,
         jobject thiz, jobject jSurfaceTexture)
 {
-    LOGV("setPreviewTexture");
+    ALOGV("setPreviewTexture");
     sp<Camera> camera = get_native_camera(env, thiz, NULL);
     if (camera == 0) return;
 
@@ -558,7 +558,7 @@
 
 static void android_hardware_Camera_startPreview(JNIEnv *env, jobject thiz)
 {
-    LOGV("startPreview");
+    ALOGV("startPreview");
     sp<Camera> camera = get_native_camera(env, thiz, NULL);
     if (camera == 0) return;
 
@@ -570,7 +570,7 @@
 
 static void android_hardware_Camera_stopPreview(JNIEnv *env, jobject thiz)
 {
-    LOGV("stopPreview");
+    ALOGV("stopPreview");
     sp<Camera> c = get_native_camera(env, thiz, NULL);
     if (c == 0) return;
 
@@ -579,7 +579,7 @@
 
 static bool android_hardware_Camera_previewEnabled(JNIEnv *env, jobject thiz)
 {
-    LOGV("previewEnabled");
+    ALOGV("previewEnabled");
     sp<Camera> c = get_native_camera(env, thiz, NULL);
     if (c == 0) return false;
 
@@ -588,7 +588,7 @@
 
 static void android_hardware_Camera_setHasPreviewCallback(JNIEnv *env, jobject thiz, jboolean installed, jboolean manualBuffer)
 {
-    LOGV("setHasPreviewCallback: installed:%d, manualBuffer:%d", (int)installed, (int)manualBuffer);
+    ALOGV("setHasPreviewCallback: installed:%d, manualBuffer:%d", (int)installed, (int)manualBuffer);
     // Important: Only install preview_callback if the Java code has called
     // setPreviewCallback() with a non-null value, otherwise we'd pay to memcpy
     // each preview frame for nothing.
@@ -602,7 +602,7 @@
 }
 
 static void android_hardware_Camera_addCallbackBuffer(JNIEnv *env, jobject thiz, jbyteArray bytes, int msgType) {
-    LOGV("addCallbackBuffer: 0x%x", msgType);
+    ALOGV("addCallbackBuffer: 0x%x", msgType);
 
     JNICameraContext* context = reinterpret_cast<JNICameraContext*>(env->GetIntField(thiz, fields.context));
 
@@ -613,7 +613,7 @@
 
 static void android_hardware_Camera_autoFocus(JNIEnv *env, jobject thiz)
 {
-    LOGV("autoFocus");
+    ALOGV("autoFocus");
     JNICameraContext* context;
     sp<Camera> c = get_native_camera(env, thiz, &context);
     if (c == 0) return;
@@ -625,7 +625,7 @@
 
 static void android_hardware_Camera_cancelAutoFocus(JNIEnv *env, jobject thiz)
 {
-    LOGV("cancelAutoFocus");
+    ALOGV("cancelAutoFocus");
     JNICameraContext* context;
     sp<Camera> c = get_native_camera(env, thiz, &context);
     if (c == 0) return;
@@ -637,7 +637,7 @@
 
 static void android_hardware_Camera_takePicture(JNIEnv *env, jobject thiz, int msgType)
 {
-    LOGV("takePicture");
+    ALOGV("takePicture");
     JNICameraContext* context;
     sp<Camera> camera = get_native_camera(env, thiz, &context);
     if (camera == 0) return;
@@ -652,9 +652,9 @@
      * Java application.
      */
     if (msgType & CAMERA_MSG_RAW_IMAGE) {
-        LOGV("Enable raw image callback buffer");
+        ALOGV("Enable raw image callback buffer");
         if (!context->isRawImageCallbackBufferAvailable()) {
-            LOGV("Enable raw image notification, since no callback buffer exists");
+            ALOGV("Enable raw image notification, since no callback buffer exists");
             msgType &= ~CAMERA_MSG_RAW_IMAGE;
             msgType |= CAMERA_MSG_RAW_IMAGE_NOTIFY;
         }
@@ -668,7 +668,7 @@
 
 static void android_hardware_Camera_setParameters(JNIEnv *env, jobject thiz, jstring params)
 {
-    LOGV("setParameters");
+    ALOGV("setParameters");
     sp<Camera> camera = get_native_camera(env, thiz, NULL);
     if (camera == 0) return;
 
@@ -686,7 +686,7 @@
 
 static jstring android_hardware_Camera_getParameters(JNIEnv *env, jobject thiz)
 {
-    LOGV("getParameters");
+    ALOGV("getParameters");
     sp<Camera> camera = get_native_camera(env, thiz, NULL);
     if (camera == 0) return 0;
 
@@ -695,7 +695,7 @@
 
 static void android_hardware_Camera_reconnect(JNIEnv *env, jobject thiz)
 {
-    LOGV("reconnect");
+    ALOGV("reconnect");
     sp<Camera> camera = get_native_camera(env, thiz, NULL);
     if (camera == 0) return;
 
@@ -707,7 +707,7 @@
 
 static void android_hardware_Camera_lock(JNIEnv *env, jobject thiz)
 {
-    LOGV("lock");
+    ALOGV("lock");
     sp<Camera> camera = get_native_camera(env, thiz, NULL);
     if (camera == 0) return;
 
@@ -718,7 +718,7 @@
 
 static void android_hardware_Camera_unlock(JNIEnv *env, jobject thiz)
 {
-    LOGV("unlock");
+    ALOGV("unlock");
     sp<Camera> camera = get_native_camera(env, thiz, NULL);
     if (camera == 0) return;
 
@@ -729,7 +729,7 @@
 
 static void android_hardware_Camera_startSmoothZoom(JNIEnv *env, jobject thiz, jint value)
 {
-    LOGV("startSmoothZoom");
+    ALOGV("startSmoothZoom");
     sp<Camera> camera = get_native_camera(env, thiz, NULL);
     if (camera == 0) return;
 
@@ -745,7 +745,7 @@
 
 static void android_hardware_Camera_stopSmoothZoom(JNIEnv *env, jobject thiz)
 {
-    LOGV("stopSmoothZoom");
+    ALOGV("stopSmoothZoom");
     sp<Camera> camera = get_native_camera(env, thiz, NULL);
     if (camera == 0) return;
 
@@ -757,7 +757,7 @@
 static void android_hardware_Camera_setDisplayOrientation(JNIEnv *env, jobject thiz,
         jint value)
 {
-    LOGV("setDisplayOrientation");
+    ALOGV("setDisplayOrientation");
     sp<Camera> camera = get_native_camera(env, thiz, NULL);
     if (camera == 0) return;
 
@@ -769,7 +769,7 @@
 static void android_hardware_Camera_startFaceDetection(JNIEnv *env, jobject thiz,
         jint type)
 {
-    LOGV("startFaceDetection");
+    ALOGV("startFaceDetection");
     JNICameraContext* context;
     sp<Camera> camera = get_native_camera(env, thiz, &context);
     if (camera == 0) return;
@@ -786,7 +786,7 @@
 
 static void android_hardware_Camera_stopFaceDetection(JNIEnv *env, jobject thiz)
 {
-    LOGV("stopFaceDetection");
+    ALOGV("stopFaceDetection");
     sp<Camera> camera = get_native_camera(env, thiz, NULL);
     if (camera == 0) return;
 
@@ -885,13 +885,13 @@
         field *f = &fields[i];
         jclass clazz = env->FindClass(f->class_name);
         if (clazz == NULL) {
-            LOGE("Can't find %s", f->class_name);
+            ALOGE("Can't find %s", f->class_name);
             return -1;
         }
 
         jfieldID field = env->GetFieldID(clazz, f->field_name, f->field_type);
         if (field == NULL) {
-            LOGE("Can't find %s.%s", f->class_name, f->field_name);
+            ALOGE("Can't find %s.%s", f->class_name, f->field_name);
             return -1;
         }
 
@@ -926,21 +926,21 @@
     fields.post_event = env->GetStaticMethodID(clazz, "postEventFromNative",
                                                "(Ljava/lang/Object;IIILjava/lang/Object;)V");
     if (fields.post_event == NULL) {
-        LOGE("Can't find android/hardware/Camera.postEventFromNative");
+        ALOGE("Can't find android/hardware/Camera.postEventFromNative");
         return -1;
     }
 
     clazz = env->FindClass("android/graphics/Rect");
     fields.rect_constructor = env->GetMethodID(clazz, "<init>", "()V");
     if (fields.rect_constructor == NULL) {
-        LOGE("Can't find android/graphics/Rect.Rect()");
+        ALOGE("Can't find android/graphics/Rect.Rect()");
         return -1;
     }
 
     clazz = env->FindClass("android/hardware/Camera$Face");
     fields.face_constructor = env->GetMethodID(clazz, "<init>", "()V");
     if (fields.face_constructor == NULL) {
-        LOGE("Can't find android/hardware/Camera$Face.Face()");
+        ALOGE("Can't find android/hardware/Camera$Face.Face()");
         return -1;
     }
 
diff --git a/core/jni/android_hardware_UsbDeviceConnection.cpp b/core/jni/android_hardware_UsbDeviceConnection.cpp
index 68be9e1..923781e 100644
--- a/core/jni/android_hardware_UsbDeviceConnection.cpp
+++ b/core/jni/android_hardware_UsbDeviceConnection.cpp
@@ -53,7 +53,7 @@
     if (device) {
         env->SetIntField(thiz, field_context, (int)device);
     } else {
-        LOGE("usb_device_open failed for %s", deviceNameStr);
+        ALOGE("usb_device_open failed for %s", deviceNameStr);
         close(fd);
     }
 
@@ -64,7 +64,7 @@
 static void
 android_hardware_UsbDeviceConnection_close(JNIEnv *env, jobject thiz)
 {
-    LOGD("close\n");
+    ALOGD("close\n");
     struct usb_device* device = get_device_from_object(env, thiz);
     if (device) {
         usb_device_close(device);
@@ -77,7 +77,7 @@
 {
     struct usb_device* device = get_device_from_object(env, thiz);
     if (!device) {
-        LOGE("device is closed in native_get_fd");
+        ALOGE("device is closed in native_get_fd");
         return -1;
     }
     return usb_device_get_fd(device);
@@ -110,7 +110,7 @@
 {
     struct usb_device* device = get_device_from_object(env, thiz);
     if (!device) {
-        LOGE("device is closed in native_claim_interface");
+        ALOGE("device is closed in native_claim_interface");
         return -1;
     }
 
@@ -128,7 +128,7 @@
 {
     struct usb_device* device = get_device_from_object(env, thiz);
     if (!device) {
-        LOGE("device is closed in native_release_interface");
+        ALOGE("device is closed in native_release_interface");
         return -1;
     }
     int ret = usb_device_release_interface(device, interfaceID);
@@ -146,7 +146,7 @@
 {
     struct usb_device* device = get_device_from_object(env, thiz);
     if (!device) {
-        LOGE("device is closed in native_control_request");
+        ALOGE("device is closed in native_control_request");
         return -1;
     }
 
@@ -174,7 +174,7 @@
 {
     struct usb_device* device = get_device_from_object(env, thiz);
     if (!device) {
-        LOGE("device is closed in native_control_request");
+        ALOGE("device is closed in native_control_request");
         return -1;
     }
 
@@ -200,7 +200,7 @@
 {
     struct usb_device* device = get_device_from_object(env, thiz);
     if (!device) {
-        LOGE("device is closed in native_request_wait");
+        ALOGE("device is closed in native_request_wait");
         return NULL;
     }
 
@@ -216,7 +216,7 @@
 {
     struct usb_device* device = get_device_from_object(env, thiz);
     if (!device) {
-        LOGE("device is closed in native_request_wait");
+        ALOGE("device is closed in native_request_wait");
         return NULL;
     }
     char* serial = usb_device_get_serial(device);
@@ -249,12 +249,12 @@
 {
     jclass clazz = env->FindClass("android/hardware/usb/UsbDeviceConnection");
     if (clazz == NULL) {
-        LOGE("Can't find android/hardware/usb/UsbDeviceConnection");
+        ALOGE("Can't find android/hardware/usb/UsbDeviceConnection");
         return -1;
     }
     field_context = env->GetFieldID(clazz, "mNativeContext", "I");
     if (field_context == NULL) {
-        LOGE("Can't find UsbDeviceConnection.mNativeContext");
+        ALOGE("Can't find UsbDeviceConnection.mNativeContext");
         return -1;
     }
 
diff --git a/core/jni/android_hardware_UsbRequest.cpp b/core/jni/android_hardware_UsbRequest.cpp
index 6bd67d1..1398968 100644
--- a/core/jni/android_hardware_UsbRequest.cpp
+++ b/core/jni/android_hardware_UsbRequest.cpp
@@ -42,11 +42,11 @@
 android_hardware_UsbRequest_init(JNIEnv *env, jobject thiz, jobject java_device,
         jint ep_address, jint ep_attributes, jint ep_max_packet_size, jint ep_interval)
 {
-    LOGD("init\n");
+    ALOGD("init\n");
 
     struct usb_device* device = get_device_from_object(env, java_device);
     if (!device) {
-        LOGE("device null in native_init");
+        ALOGE("device null in native_init");
         return false;
     }
 
@@ -68,7 +68,7 @@
 static void
 android_hardware_UsbRequest_close(JNIEnv *env, jobject thiz)
 {
-    LOGD("close\n");
+    ALOGD("close\n");
     struct usb_request* request = get_request_from_object(env, thiz);
     if (request) {
         usb_request_free(request);
@@ -82,7 +82,7 @@
 {
     struct usb_request* request = get_request_from_object(env, thiz);
     if (!request) {
-        LOGE("request is closed in native_queue");
+        ALOGE("request is closed in native_queue");
         return false;
     }
 
@@ -119,7 +119,7 @@
 {
     struct usb_request* request = get_request_from_object(env, thiz);
     if (!request) {
-        LOGE("request is closed in native_dequeue");
+        ALOGE("request is closed in native_dequeue");
         return;
     }
 
@@ -138,7 +138,7 @@
 {
     struct usb_request* request = get_request_from_object(env, thiz);
     if (!request) {
-        LOGE("request is closed in native_queue");
+        ALOGE("request is closed in native_queue");
         return false;
     }
 
@@ -168,7 +168,7 @@
 {
     struct usb_request* request = get_request_from_object(env, thiz);
     if (!request) {
-        LOGE("request is closed in native_dequeue");
+        ALOGE("request is closed in native_dequeue");
         return;
     }
     // all we need to do is delete our global ref
@@ -180,7 +180,7 @@
 {
     struct usb_request* request = get_request_from_object(env, thiz);
     if (!request) {
-        LOGE("request is closed in native_cancel");
+        ALOGE("request is closed in native_cancel");
         return false;
     }
     return (usb_request_cancel(request) == 0);
@@ -202,12 +202,12 @@
 {
     jclass clazz = env->FindClass("android/hardware/usb/UsbRequest");
     if (clazz == NULL) {
-        LOGE("Can't find android/hardware/usb/UsbRequest");
+        ALOGE("Can't find android/hardware/usb/UsbRequest");
         return -1;
     }
     field_context = env->GetFieldID(clazz, "mNativeContext", "I");
     if (field_context == NULL) {
-        LOGE("Can't find UsbRequest.mNativeContext");
+        ALOGE("Can't find UsbRequest.mNativeContext");
         return -1;
     }
 
diff --git a/core/jni/android_media_AudioRecord.cpp b/core/jni/android_media_AudioRecord.cpp
index 9be3779..3052553 100644
--- a/core/jni/android_media_AudioRecord.cpp
+++ b/core/jni/android_media_AudioRecord.cpp
@@ -129,12 +129,12 @@
         jint source, jint sampleRateInHertz, jint channels,
         jint audioFormat, jint buffSizeInBytes, jintArray jSession)
 {
-    //LOGV(">> Entering android_media_AudioRecord_setup");
-    //LOGV("sampleRate=%d, audioFormat=%d, channels=%x, buffSizeInBytes=%d",
+    //ALOGV(">> Entering android_media_AudioRecord_setup");
+    //ALOGV("sampleRate=%d, audioFormat=%d, channels=%x, buffSizeInBytes=%d",
     //     sampleRateInHertz, audioFormat, channels,     buffSizeInBytes);
 
     if (!audio_is_input_channel(channels)) {
-        LOGE("Error creating AudioRecord: channel count is not 1 or 2.");
+        ALOGE("Error creating AudioRecord: channel count is not 1 or 2.");
         return AUDIORECORD_ERROR_SETUP_INVALIDCHANNELMASK;
     }
     uint32_t nbChannels = popcount(channels);
@@ -142,7 +142,7 @@
     // compare the format against the Java constants
     if ((audioFormat != javaAudioRecordFields.PCM16) 
         && (audioFormat != javaAudioRecordFields.PCM8)) {
-        LOGE("Error creating AudioRecord: unsupported audio format.");
+        ALOGE("Error creating AudioRecord: unsupported audio format.");
         return AUDIORECORD_ERROR_SETUP_INVALIDFORMAT;
     }
 
@@ -151,25 +151,25 @@
             AUDIO_FORMAT_PCM_16_BIT : AUDIO_FORMAT_PCM_8_BIT;
 
     if (buffSizeInBytes == 0) {
-         LOGE("Error creating AudioRecord: frameCount is 0.");
+         ALOGE("Error creating AudioRecord: frameCount is 0.");
         return AUDIORECORD_ERROR_SETUP_ZEROFRAMECOUNT;
     }
     int frameSize = nbChannels * bytesPerSample;
     size_t frameCount = buffSizeInBytes / frameSize;
     
     if (source >= AUDIO_SOURCE_CNT) {
-        LOGE("Error creating AudioRecord: unknown source.");
+        ALOGE("Error creating AudioRecord: unknown source.");
         return AUDIORECORD_ERROR_SETUP_INVALIDSOURCE;
     }
 
     if (jSession == NULL) {
-        LOGE("Error creating AudioRecord: invalid session ID pointer");
+        ALOGE("Error creating AudioRecord: invalid session ID pointer");
         return AUDIORECORD_ERROR;
     }
 
     jint* nSession = (jint *) env->GetPrimitiveArrayCritical(jSession, NULL);
     if (nSession == NULL) {
-        LOGE("Error creating AudioRecord: Error retrieving session id pointer");
+        ALOGE("Error creating AudioRecord: Error retrieving session id pointer");
         return AUDIORECORD_ERROR;
     }
     int sessionId = nSession[0];
@@ -182,7 +182,7 @@
     // create an uninitialized AudioRecord object
     lpRecorder = new AudioRecord();
         if(lpRecorder == NULL) {
-        LOGE("Error creating AudioRecord instance.");
+        ALOGE("Error creating AudioRecord instance.");
         return AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED;
     }
     
@@ -190,7 +190,7 @@
     // this data will be passed with every AudioRecord callback
     jclass clazz = env->GetObjectClass(thiz);
     if (clazz == NULL) {
-        LOGE("Can't find %s when setting up callback.", kClassPathName);
+        ALOGE("Can't find %s when setting up callback.", kClassPathName);
         goto native_track_failure;
     }
     lpCallbackData = new audiorecord_callback_cookie;
@@ -211,13 +211,13 @@
         sessionId);
 
     if(lpRecorder->initCheck() != NO_ERROR) {
-        LOGE("Error creating AudioRecord instance: initialization check failed.");
+        ALOGE("Error creating AudioRecord instance: initialization check failed.");
         goto native_init_failure;
     }
 
     nSession = (jint *) env->GetPrimitiveArrayCritical(jSession, NULL);
     if (nSession == NULL) {
-        LOGE("Error creating AudioRecord: Error retrieving session id pointer");
+        ALOGE("Error creating AudioRecord: Error retrieving session id pointer");
         goto native_init_failure;
     }
     // read the audio session ID back from AudioTrack in case a new session was created during set()
@@ -279,7 +279,7 @@
     }
 
     lpRecorder->stop();
-    //LOGV("Called lpRecorder->stop()");
+    //ALOGV("Called lpRecorder->stop()");
 }
 
 
@@ -300,14 +300,14 @@
 
     // delete the AudioRecord object
     if (lpRecorder) {
-        LOGV("About to delete lpRecorder: %x\n", (int)lpRecorder);
+        ALOGV("About to delete lpRecorder: %x\n", (int)lpRecorder);
         lpRecorder->stop();
         delete lpRecorder;
     }
     
     // delete the callback information
     if (lpCookie) {
-        LOGV("deleting lpCookie: %x\n", (int)lpCookie);
+        ALOGV("deleting lpCookie: %x\n", (int)lpCookie);
         env->DeleteGlobalRef(lpCookie->audioRecord_class);
         env->DeleteGlobalRef(lpCookie->audioRecord_ref);
         delete lpCookie;
@@ -332,12 +332,12 @@
     lpRecorder = 
             (AudioRecord *)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
     if (lpRecorder == NULL) {
-        LOGE("Unable to retrieve AudioRecord object, can't record");
+        ALOGE("Unable to retrieve AudioRecord object, can't record");
         return 0;
     }
 
     if (!javaAudioData) {
-        LOGE("Invalid Java array to store recorded audio, can't record");
+        ALOGE("Invalid Java array to store recorded audio, can't record");
         return 0;
     }
 
@@ -349,7 +349,7 @@
     recordBuff = (jbyte *)env->GetByteArrayElements(javaAudioData, NULL);
 
     if (recordBuff == NULL) {
-        LOGE("Error retrieving destination for recorded audio data, can't record");
+        ALOGE("Error retrieving destination for recorded audio data, can't record");
         return 0;
     }
 
@@ -378,7 +378,7 @@
 static jint android_media_AudioRecord_readInDirectBuffer(JNIEnv *env,  jobject thiz,
                                                   jobject jBuffer, jint sizeInBytes) {
     AudioRecord *lpRecorder = NULL;
-    //LOGV("Entering android_media_AudioRecord_readInBuffer");
+    //ALOGV("Entering android_media_AudioRecord_readInBuffer");
 
     // get the audio recorder from which we'll read new audio samples
     lpRecorder = 
@@ -390,13 +390,13 @@
     long capacity = env->GetDirectBufferCapacity(jBuffer);
     if(capacity == -1) {
         // buffer direct access is not supported
-        LOGE("Buffer direct access is not supported, can't record");
+        ALOGE("Buffer direct access is not supported, can't record");
         return 0;
     }
-    //LOGV("capacity = %ld", capacity);
+    //ALOGV("capacity = %ld", capacity);
     jbyte* nativeFromJavaBuf = (jbyte*) env->GetDirectBufferAddress(jBuffer);
     if(nativeFromJavaBuf==NULL) {
-        LOGE("Buffer direct access is not supported, can't record");
+        ALOGE("Buffer direct access is not supported, can't record");
         return 0;
     } 
 
@@ -485,7 +485,7 @@
 static jint android_media_AudioRecord_get_min_buff_size(JNIEnv *env,  jobject thiz,
     jint sampleRateInHertz, jint nbChannels, jint audioFormat) {
 
-    LOGV(">> android_media_AudioRecord_get_min_buff_size(%d, %d, %d)", sampleRateInHertz, nbChannels, audioFormat);
+    ALOGV(">> android_media_AudioRecord_get_min_buff_size(%d, %d, %d)", sampleRateInHertz, nbChannels, audioFormat);
 
     int frameCount = 0;
     status_t result = AudioRecord::getMinFrameCount(&frameCount,
@@ -555,7 +555,7 @@
     // Get the AudioRecord class
     jclass audioRecordClass = env->FindClass(kClassPathName);
     if (audioRecordClass == NULL) {
-        LOGE("Can't find %s", kClassPathName);
+        ALOGE("Can't find %s", kClassPathName);
         return -1;
     }
     // Get the postEvent method
@@ -563,7 +563,7 @@
             audioRecordClass,
             JAVA_POSTEVENT_CALLBACK_NAME, "(Ljava/lang/Object;IIILjava/lang/Object;)V");
     if (javaAudioRecordFields.postNativeEventInJava == NULL) {
-        LOGE("Can't find AudioRecord.%s", JAVA_POSTEVENT_CALLBACK_NAME);
+        ALOGE("Can't find AudioRecord.%s", JAVA_POSTEVENT_CALLBACK_NAME);
         return -1;
     }
 
@@ -573,7 +573,7 @@
         env->GetFieldID(audioRecordClass,
                         JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME, "I");
     if (javaAudioRecordFields.nativeRecorderInJavaObj == NULL) {
-        LOGE("Can't find AudioRecord.%s", JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME);
+        ALOGE("Can't find AudioRecord.%s", JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME);
         return -1;
     }
     //     mNativeCallbackCookie
@@ -581,7 +581,7 @@
             audioRecordClass,
             JAVA_NATIVECALLBACKINFO_FIELD_NAME, "I");
     if (javaAudioRecordFields.nativeCallbackCookie == NULL) {
-        LOGE("Can't find AudioRecord.%s", JAVA_NATIVECALLBACKINFO_FIELD_NAME);
+        ALOGE("Can't find AudioRecord.%s", JAVA_NATIVECALLBACKINFO_FIELD_NAME);
         return -1;
     }
 
@@ -589,7 +589,7 @@
     jclass audioFormatClass = NULL;
     audioFormatClass = env->FindClass(JAVA_AUDIOFORMAT_CLASS_NAME);
     if (audioFormatClass == NULL) {
-        LOGE("Can't find %s", JAVA_AUDIOFORMAT_CLASS_NAME);
+        ALOGE("Can't find %s", JAVA_AUDIOFORMAT_CLASS_NAME);
         return -1;
     }
     if ( !android_media_getIntConstantFromClass(env, audioFormatClass, 
diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp
index 2929056..859878d 100644
--- a/core/jni/android_media_AudioTrack.cpp
+++ b/core/jni/android_media_AudioTrack.cpp
@@ -170,17 +170,17 @@
         jint streamType, jint sampleRateInHertz, jint javaChannelMask,
         jint audioFormat, jint buffSizeInBytes, jint memoryMode, jintArray jSession)
 {
-    LOGV("sampleRate=%d, audioFormat(from Java)=%d, channel mask=%x, buffSize=%d",
+    ALOGV("sampleRate=%d, audioFormat(from Java)=%d, channel mask=%x, buffSize=%d",
         sampleRateInHertz, audioFormat, javaChannelMask, buffSizeInBytes);
     int afSampleRate;
     int afFrameCount;
 
     if (AudioSystem::getOutputFrameCount(&afFrameCount, streamType) != NO_ERROR) {
-        LOGE("Error creating AudioTrack: Could not get AudioSystem frame count.");
+        ALOGE("Error creating AudioTrack: Could not get AudioSystem frame count.");
         return AUDIOTRACK_ERROR_SETUP_AUDIOSYSTEM;
     }
     if (AudioSystem::getOutputSamplingRate(&afSampleRate, streamType) != NO_ERROR) {
-        LOGE("Error creating AudioTrack: Could not get AudioSystem sampling rate.");
+        ALOGE("Error creating AudioTrack: Could not get AudioSystem sampling rate.");
         return AUDIOTRACK_ERROR_SETUP_AUDIOSYSTEM;
     }
 
@@ -189,7 +189,7 @@
     uint32_t nativeChannelMask = ((uint32_t)javaChannelMask) >> 2;
 
     if (!audio_is_output_channel(nativeChannelMask)) {
-        LOGE("Error creating AudioTrack: invalid channel mask.");
+        ALOGE("Error creating AudioTrack: invalid channel mask.");
         return AUDIOTRACK_ERROR_SETUP_INVALIDCHANNELMASK;
     }
 
@@ -214,14 +214,14 @@
     } else if (streamType == javaAudioTrackFields.STREAM_DTMF) {
         atStreamType = AUDIO_STREAM_DTMF;
     } else {
-        LOGE("Error creating AudioTrack: unknown stream type.");
+        ALOGE("Error creating AudioTrack: unknown stream type.");
         return AUDIOTRACK_ERROR_SETUP_INVALIDSTREAMTYPE;
     }
 
     // check the format.
     // This function was called from Java, so we compare the format against the Java constants
     if ((audioFormat != javaAudioTrackFields.PCM16) && (audioFormat != javaAudioTrackFields.PCM8)) {
-        LOGE("Error creating AudioTrack: unsupported audio format.");
+        ALOGE("Error creating AudioTrack: unsupported audio format.");
         return AUDIOTRACK_ERROR_SETUP_INVALIDFORMAT;
     }
 
@@ -230,7 +230,7 @@
     // in android_media_AudioTrack_native_write()
     if ((audioFormat == javaAudioTrackFields.PCM8) 
         && (memoryMode == javaAudioTrackFields.MODE_STATIC)) {
-        LOGV("android_media_AudioTrack_native_setup(): requesting MODE_STATIC for 8bit \
+        ALOGV("android_media_AudioTrack_native_setup(): requesting MODE_STATIC for 8bit \
             buff size of %dbytes, switching to 16bit, buff size of %dbytes",
             buffSizeInBytes, 2*buffSizeInBytes);
         audioFormat = javaAudioTrackFields.PCM16;
@@ -250,7 +250,7 @@
     // this data will be passed with every AudioTrack callback
     jclass clazz = env->GetObjectClass(thiz);
     if (clazz == NULL) {
-        LOGE("Can't find %s when setting up callback.", kClassPathName);
+        ALOGE("Can't find %s when setting up callback.", kClassPathName);
         delete lpJniStorage;
         return AUDIOTRACK_ERROR_SETUP_NATIVEINITFAILED;
     }
@@ -261,14 +261,14 @@
     lpJniStorage->mStreamType = atStreamType;
 
     if (jSession == NULL) {
-        LOGE("Error creating AudioTrack: invalid session ID pointer");
+        ALOGE("Error creating AudioTrack: invalid session ID pointer");
         delete lpJniStorage;
         return AUDIOTRACK_ERROR;
     }
 
     jint* nSession = (jint *) env->GetPrimitiveArrayCritical(jSession, NULL);
     if (nSession == NULL) {
-        LOGE("Error creating AudioTrack: Error retrieving session id pointer");
+        ALOGE("Error creating AudioTrack: Error retrieving session id pointer");
         delete lpJniStorage;
         return AUDIOTRACK_ERROR;
     }
@@ -279,7 +279,7 @@
     // create the native AudioTrack object
     AudioTrack* lpTrack = new AudioTrack();
     if (lpTrack == NULL) {
-        LOGE("Error creating uninitialized AudioTrack");
+        ALOGE("Error creating uninitialized AudioTrack");
         goto native_track_failure;
     }
     
@@ -303,7 +303,7 @@
         // AudioTrack is using shared memory
         
         if (!lpJniStorage->allocSharedMem(buffSizeInBytes)) {
-            LOGE("Error creating AudioTrack in static mode: error creating mem heap base");
+            ALOGE("Error creating AudioTrack in static mode: error creating mem heap base");
             goto native_init_failure;
         }
         
@@ -322,13 +322,13 @@
     }
 
     if (lpTrack->initCheck() != NO_ERROR) {
-        LOGE("Error initializing AudioTrack");
+        ALOGE("Error initializing AudioTrack");
         goto native_init_failure;
     }
 
     nSession = (jint *) env->GetPrimitiveArrayCritical(jSession, NULL);
     if (nSession == NULL) {
-        LOGE("Error creating AudioTrack: Error retrieving session id pointer");
+        ALOGE("Error creating AudioTrack: Error retrieving session id pointer");
         goto native_init_failure;
     }
     // read the audio session ID back from AudioTrack in case we create a new session
@@ -341,7 +341,7 @@
     env->SetIntField(thiz, javaAudioTrackFields.nativeTrackInJavaObj, (int)lpTrack);
     
     // save the JNI resources so we can free them later
-    //LOGV("storing lpJniStorage: %x\n", (int)lpJniStorage);
+    //ALOGV("storing lpJniStorage: %x\n", (int)lpJniStorage);
     env->SetIntField(thiz, javaAudioTrackFields.jniData, (int)lpJniStorage);
 
     return AUDIOTRACK_SUCCESS;
@@ -444,13 +444,13 @@
 
 // ----------------------------------------------------------------------------
 static void android_media_AudioTrack_native_finalize(JNIEnv *env,  jobject thiz) {
-    //LOGV("android_media_AudioTrack_native_finalize jobject: %x\n", (int)thiz);
+    //ALOGV("android_media_AudioTrack_native_finalize jobject: %x\n", (int)thiz);
        
     // delete the AudioTrack object
     AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
         thiz, javaAudioTrackFields.nativeTrackInJavaObj);
     if (lpTrack) {
-        //LOGV("deleting lpTrack: %x\n", (int)lpTrack);
+        //ALOGV("deleting lpTrack: %x\n", (int)lpTrack);
         lpTrack->stop();
         delete lpTrack;
     }
@@ -462,7 +462,7 @@
         // delete global refs created in native_setup
         env->DeleteGlobalRef(pJniStorage->mCallbackData.audioTrack_class);
         env->DeleteGlobalRef(pJniStorage->mCallbackData.audioTrack_ref);
-        //LOGV("deleting pJniStorage: %x\n", (int)pJniStorage);
+        //ALOGV("deleting pJniStorage: %x\n", (int)pJniStorage);
         delete pJniStorage;
     }
 }
@@ -525,7 +525,7 @@
                                                   jint javaAudioFormat) {
     jbyte* cAudioData = NULL;
     AudioTrack *lpTrack = NULL;
-    //LOGV("android_media_AudioTrack_native_write(offset=%d, sizeInBytes=%d) called",
+    //ALOGV("android_media_AudioTrack_native_write(offset=%d, sizeInBytes=%d) called",
     //    offsetInBytes, sizeInBytes);
     
     // get the audio track to load with samples
@@ -544,11 +544,11 @@
     if (javaAudioData) {
         cAudioData = (jbyte *)env->GetByteArrayElements(javaAudioData, NULL);
         if (cAudioData == NULL) {
-            LOGE("Error retrieving source of audio data to play, can't play");
+            ALOGE("Error retrieving source of audio data to play, can't play");
             return 0; // out of memory or no data to load
         }
     } else {
-        LOGE("NULL java array of audio data to play, can't play");
+        ALOGE("NULL java array of audio data to play, can't play");
         return 0;
     }
 
@@ -556,7 +556,7 @@
 
     env->ReleaseByteArrayElements(javaAudioData, cAudioData, 0);
 
-    //LOGV("write wrote %d (tried %d) bytes in the native AudioTrack with offset %d",
+    //ALOGV("write wrote %d (tried %d) bytes in the native AudioTrack with offset %d",
     //     (int)written, (int)(sizeInBytes), (int)offsetInBytes);
     return written;
 }
@@ -785,7 +785,7 @@
     }
 
     if (AudioSystem::getOutputSamplingRate(&afSamplingRate, nativeStreamType) != NO_ERROR) {
-        LOGE("AudioSystem::getOutputSamplingRate() for stream type %d failed in AudioTrack JNI",
+        ALOGE("AudioSystem::getOutputSamplingRate() for stream type %d failed in AudioTrack JNI",
             nativeStreamType);
         return DEFAULT_OUTPUT_SAMPLE_RATE;
     } else {
@@ -913,7 +913,7 @@
         *constVal = pEnv->GetStaticIntField(theClass, javaConst);
         return true;
     } else {
-        LOGE("Can't find %s.%s", className, constName);
+        ALOGE("Can't find %s.%s", className, constName);
         return false;
     }
 }
@@ -928,7 +928,7 @@
     // Get the AudioTrack class
     jclass audioTrackClass = env->FindClass(kClassPathName);
     if (audioTrackClass == NULL) {
-        LOGE("Can't find %s", kClassPathName);
+        ALOGE("Can't find %s", kClassPathName);
         return -1;
     }
 
@@ -937,7 +937,7 @@
             audioTrackClass,
             JAVA_POSTEVENT_CALLBACK_NAME, "(Ljava/lang/Object;IIILjava/lang/Object;)V");
     if (javaAudioTrackFields.postNativeEventInJava == NULL) {
-        LOGE("Can't find AudioTrack.%s", JAVA_POSTEVENT_CALLBACK_NAME);
+        ALOGE("Can't find AudioTrack.%s", JAVA_POSTEVENT_CALLBACK_NAME);
         return -1;
     }
 
@@ -947,7 +947,7 @@
             audioTrackClass,
             JAVA_NATIVETRACKINJAVAOBJ_FIELD_NAME, "I");
     if (javaAudioTrackFields.nativeTrackInJavaObj == NULL) {
-        LOGE("Can't find AudioTrack.%s", JAVA_NATIVETRACKINJAVAOBJ_FIELD_NAME);
+        ALOGE("Can't find AudioTrack.%s", JAVA_NATIVETRACKINJAVAOBJ_FIELD_NAME);
         return -1;
     }
     //      jniData;
@@ -955,7 +955,7 @@
             audioTrackClass,
             JAVA_JNIDATA_FIELD_NAME, "I");
     if (javaAudioTrackFields.jniData == NULL) {
-        LOGE("Can't find AudioTrack.%s", JAVA_JNIDATA_FIELD_NAME);
+        ALOGE("Can't find AudioTrack.%s", JAVA_JNIDATA_FIELD_NAME);
         return -1;
     }
 
@@ -974,7 +974,7 @@
     jclass audioFormatClass = NULL;
     audioFormatClass = env->FindClass(JAVA_AUDIOFORMAT_CLASS_NAME);
     if (audioFormatClass == NULL) {
-        LOGE("Can't find %s", JAVA_AUDIOFORMAT_CLASS_NAME);
+        ALOGE("Can't find %s", JAVA_AUDIOFORMAT_CLASS_NAME);
         return -1;
     }
     if ( !android_media_getIntConstantFromClass(env, audioFormatClass, 
@@ -991,7 +991,7 @@
     jclass audioManagerClass = NULL;
     audioManagerClass = env->FindClass(JAVA_AUDIOMANAGER_CLASS_NAME);
     if (audioManagerClass == NULL) {
-       LOGE("Can't find %s", JAVA_AUDIOMANAGER_CLASS_NAME);
+       ALOGE("Can't find %s", JAVA_AUDIOMANAGER_CLASS_NAME);
        return -1;
     }
     if ( !android_media_getIntConstantFromClass(env, audioManagerClass,
diff --git a/core/jni/android_media_JetPlayer.cpp b/core/jni/android_media_JetPlayer.cpp
index e1240692..85c0a9c 100644
--- a/core/jni/android_media_JetPlayer.cpp
+++ b/core/jni/android_media_JetPlayer.cpp
@@ -66,7 +66,7 @@
             env->ExceptionClear();
         }
     } else {
-        LOGE("JET jetPlayerEventCallback(): No JNI env for JET event callback, can't post event.");
+        ALOGE("JET jetPlayerEventCallback(): No JNI env for JET event callback, can't post event.");
         return;
     }
 }
@@ -79,7 +79,7 @@
 android_media_JetPlayer_setup(JNIEnv *env, jobject thiz, jobject weak_this,
     jint maxTracks, jint trackBufferSize)
 {
-    //LOGV("android_media_JetPlayer_setup(): entering.");
+    //ALOGV("android_media_JetPlayer_setup(): entering.");
     JetPlayer* lpJet = new JetPlayer(env->NewGlobalRef(weak_this), maxTracks, trackBufferSize);
 
     EAS_RESULT result = lpJet->init();
@@ -90,7 +90,7 @@
         env->SetIntField(thiz, javaJetPlayerFields.nativePlayerInJavaObj, (int)lpJet);
         return JNI_TRUE;
     } else {
-        LOGE("android_media_JetPlayer_setup(): initialization failed with EAS error code %d", (int)result);
+        ALOGE("android_media_JetPlayer_setup(): initialization failed with EAS error code %d", (int)result);
         delete lpJet;
         env->SetIntField(weak_this, javaJetPlayerFields.nativePlayerInJavaObj, 0);
         return JNI_FALSE;
@@ -102,7 +102,7 @@
 static void
 android_media_JetPlayer_finalize(JNIEnv *env, jobject thiz)
 {
-    LOGV("android_media_JetPlayer_finalize(): entering.");
+    ALOGV("android_media_JetPlayer_finalize(): entering.");
     JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
         thiz, javaJetPlayerFields.nativePlayerInJavaObj);
     if(lpJet != NULL) {
@@ -110,7 +110,7 @@
         delete lpJet;
     }
 
-    LOGV("android_media_JetPlayer_finalize(): exiting.");
+    ALOGV("android_media_JetPlayer_finalize(): exiting.");
 }
 
 
@@ -120,7 +120,7 @@
 {
     android_media_JetPlayer_finalize(env, thiz);
     env->SetIntField(thiz, javaJetPlayerFields.nativePlayerInJavaObj, 0);
-    LOGV("android_media_JetPlayer_release() done");
+    ALOGV("android_media_JetPlayer_release() done");
 }
 
 
@@ -140,19 +140,19 @@
 
     const char *pathStr = env->GetStringUTFChars(path, NULL);
     if (pathStr == NULL) {  // Out of memory
-        LOGE("android_media_JetPlayer_openFile(): aborting, out of memory");
+        ALOGE("android_media_JetPlayer_openFile(): aborting, out of memory");
         return JNI_FALSE;
     }
 
-    LOGV("android_media_JetPlayer_openFile(): trying to open %s", pathStr );
+    ALOGV("android_media_JetPlayer_openFile(): trying to open %s", pathStr );
     EAS_RESULT result = lpJet->loadFromFile(pathStr);
     env->ReleaseStringUTFChars(path, pathStr);
 
     if(result==EAS_SUCCESS) {
-        //LOGV("android_media_JetPlayer_openFile(): file successfully opened");
+        //ALOGV("android_media_JetPlayer_openFile(): file successfully opened");
         return JNI_TRUE;
     } else {
-        LOGE("android_media_JetPlayer_openFile(): failed to open file with EAS error %d",
+        ALOGE("android_media_JetPlayer_openFile(): failed to open file with EAS error %d",
             (int)result);
         return JNI_FALSE;
     }
@@ -174,15 +174,15 @@
     // set up event callback function
     lpJet->setEventCallback(jetPlayerEventCallback);
 
-    LOGV("android_media_JetPlayer_openFileDescr(): trying to load JET file through its fd" );
+    ALOGV("android_media_JetPlayer_openFileDescr(): trying to load JET file through its fd" );
     EAS_RESULT result = lpJet->loadFromFD(jniGetFDFromFileDescriptor(env, fileDescriptor),
         (long long)offset, (long long)length); // cast params to types used by EAS_FILE
 
     if(result==EAS_SUCCESS) {
-        LOGV("android_media_JetPlayer_openFileDescr(): file successfully opened");
+        ALOGV("android_media_JetPlayer_openFileDescr(): file successfully opened");
         return JNI_TRUE;
     } else {
-        LOGE("android_media_JetPlayer_openFileDescr(): failed to open file with EAS error %d",
+        ALOGE("android_media_JetPlayer_openFileDescr(): failed to open file with EAS error %d",
             (int)result);
         return JNI_FALSE;
     }
@@ -201,10 +201,10 @@
     }
 
     if( lpJet->closeFile()==EAS_SUCCESS) {
-        //LOGV("android_media_JetPlayer_closeFile(): file successfully closed");
+        //ALOGV("android_media_JetPlayer_closeFile(): file successfully closed");
         return JNI_TRUE;
     } else {
-        LOGE("android_media_JetPlayer_closeFile(): failed to close file");
+        ALOGE("android_media_JetPlayer_closeFile(): failed to close file");
         return JNI_FALSE;
     }
 }
@@ -223,10 +223,10 @@
 
     EAS_RESULT result = lpJet->play();
     if( result==EAS_SUCCESS) {
-        //LOGV("android_media_JetPlayer_play(): play successful");
+        //ALOGV("android_media_JetPlayer_play(): play successful");
         return JNI_TRUE;
     } else {
-        LOGE("android_media_JetPlayer_play(): failed to play with EAS error code %ld",
+        ALOGE("android_media_JetPlayer_play(): failed to play with EAS error code %ld",
             result);
         return JNI_FALSE;
     }
@@ -246,14 +246,14 @@
 
     EAS_RESULT result = lpJet->pause();
     if( result==EAS_SUCCESS) {
-        //LOGV("android_media_JetPlayer_pause(): pause successful");
+        //ALOGV("android_media_JetPlayer_pause(): pause successful");
         return JNI_TRUE;
     } else {
         if(result==EAS_ERROR_QUEUE_IS_EMPTY) {
-            LOGV("android_media_JetPlayer_pause(): paused with an empty queue");
+            ALOGV("android_media_JetPlayer_pause(): paused with an empty queue");
             return JNI_TRUE;
         } else
-            LOGE("android_media_JetPlayer_pause(): failed to pause with EAS error code %ld",
+            ALOGE("android_media_JetPlayer_pause(): failed to pause with EAS error code %ld",
                 result);
         return JNI_FALSE;
     }
@@ -276,10 +276,10 @@
     EAS_RESULT result
         = lpJet->queueSegment(segmentNum, libNum, repeatCount, transpose, muteFlags, userID);
     if(result==EAS_SUCCESS) {
-        //LOGV("android_media_JetPlayer_queueSegment(): segment successfully queued");
+        //ALOGV("android_media_JetPlayer_queueSegment(): segment successfully queued");
         return JNI_TRUE;
     } else {
-        LOGE("android_media_JetPlayer_queueSegment(): failed with EAS error code %ld",
+        ALOGE("android_media_JetPlayer_queueSegment(): failed with EAS error code %ld",
             result);
         return JNI_FALSE;
     }
@@ -304,7 +304,7 @@
     jboolean *muteTracks = NULL;
     muteTracks = env->GetBooleanArrayElements(muteArray, NULL);
     if (muteTracks == NULL) {
-        LOGE("android_media_JetPlayer_queueSegment(): failed to read track mute mask.");
+        ALOGE("android_media_JetPlayer_queueSegment(): failed to read track mute mask.");
         return JNI_FALSE;
     }
 
@@ -316,16 +316,16 @@
         else
             muteMask = muteMask << 1;
     }
-    //LOGV("android_media_JetPlayer_queueSegmentMuteArray(): FINAL mute mask =0x%08lX", mask);
+    //ALOGV("android_media_JetPlayer_queueSegmentMuteArray(): FINAL mute mask =0x%08lX", mask);
 
     result = lpJet->queueSegment(segmentNum, libNum, repeatCount, transpose, muteMask, userID);
 
     env->ReleaseBooleanArrayElements(muteArray, muteTracks, 0);
     if(result==EAS_SUCCESS) {
-        //LOGV("android_media_JetPlayer_queueSegmentMuteArray(): segment successfully queued");
+        //ALOGV("android_media_JetPlayer_queueSegmentMuteArray(): segment successfully queued");
         return JNI_TRUE;
     } else {
-        LOGE("android_media_JetPlayer_queueSegmentMuteArray(): failed with EAS error code %ld",
+        ALOGE("android_media_JetPlayer_queueSegmentMuteArray(): failed with EAS error code %ld",
             result);
         return JNI_FALSE;
     }
@@ -347,10 +347,10 @@
     EAS_RESULT result;
     result = lpJet->setMuteFlags(muteFlags, bSync==JNI_TRUE ? true : false);
     if(result==EAS_SUCCESS) {
-        //LOGV("android_media_JetPlayer_setMuteFlags(): mute flags successfully updated");
+        //ALOGV("android_media_JetPlayer_setMuteFlags(): mute flags successfully updated");
         return JNI_TRUE;
     } else {
-        LOGE("android_media_JetPlayer_setMuteFlags(): failed with EAS error code %ld", result);
+        ALOGE("android_media_JetPlayer_setMuteFlags(): failed with EAS error code %ld", result);
         return JNI_FALSE;
     }
 }
@@ -373,7 +373,7 @@
     jboolean *muteTracks = NULL;
     muteTracks = env->GetBooleanArrayElements(muteArray, NULL);
     if (muteTracks == NULL) {
-        LOGE("android_media_JetPlayer_setMuteArray(): failed to read track mute mask.");
+        ALOGE("android_media_JetPlayer_setMuteArray(): failed to read track mute mask.");
         return JNI_FALSE;
     }
 
@@ -385,16 +385,16 @@
         else
             muteMask = muteMask << 1;
     }
-    //LOGV("android_media_JetPlayer_setMuteArray(): FINAL mute mask =0x%08lX", muteMask);
+    //ALOGV("android_media_JetPlayer_setMuteArray(): FINAL mute mask =0x%08lX", muteMask);
 
     result = lpJet->setMuteFlags(muteMask, bSync==JNI_TRUE ? true : false);
 
     env->ReleaseBooleanArrayElements(muteArray, muteTracks, 0);
     if(result==EAS_SUCCESS) {
-        //LOGV("android_media_JetPlayer_setMuteArray(): mute flags successfully updated");
+        //ALOGV("android_media_JetPlayer_setMuteArray(): mute flags successfully updated");
         return JNI_TRUE;
     } else {
-        LOGE("android_media_JetPlayer_setMuteArray(): \
+        ALOGE("android_media_JetPlayer_setMuteArray(): \
             failed to update mute flags with EAS error code %ld", result);
         return JNI_FALSE;
     }
@@ -417,10 +417,10 @@
     result = lpJet->setMuteFlag(trackId,
         muteFlag==JNI_TRUE ? true : false, bSync==JNI_TRUE ? true : false);
     if(result==EAS_SUCCESS) {
-        //LOGV("android_media_JetPlayer_setMuteFlag(): mute flag successfully updated for track %d", trackId);
+        //ALOGV("android_media_JetPlayer_setMuteFlag(): mute flag successfully updated for track %d", trackId);
         return JNI_TRUE;
     } else {
-        LOGE("android_media_JetPlayer_setMuteFlag(): failed to update mute flag for track %d with EAS error code %ld",
+        ALOGE("android_media_JetPlayer_setMuteFlag(): failed to update mute flag for track %d with EAS error code %ld",
                 trackId, result);
         return JNI_FALSE;
     }
@@ -441,10 +441,10 @@
     EAS_RESULT result;
     result = lpJet->triggerClip(clipId);
     if(result==EAS_SUCCESS) {
-        //LOGV("android_media_JetPlayer_triggerClip(): triggerClip successful for clip %d", clipId);
+        //ALOGV("android_media_JetPlayer_triggerClip(): triggerClip successful for clip %d", clipId);
         return JNI_TRUE;
     } else {
-        LOGE("android_media_JetPlayer_triggerClip(): triggerClip for clip %d failed with EAS error code %ld",
+        ALOGE("android_media_JetPlayer_triggerClip(): triggerClip for clip %d failed with EAS error code %ld",
                 clipId, result);
         return JNI_FALSE;
     }
@@ -464,10 +464,10 @@
 
     EAS_RESULT result = lpJet->clearQueue();
     if(result==EAS_SUCCESS) {
-        //LOGV("android_media_JetPlayer_clearQueue(): clearQueue successful");
+        //ALOGV("android_media_JetPlayer_clearQueue(): clearQueue successful");
         return JNI_TRUE;
     } else {
-        LOGE("android_media_JetPlayer_clearQueue(): clearQueue failed with EAS error code %ld",
+        ALOGE("android_media_JetPlayer_clearQueue(): clearQueue failed with EAS error code %ld",
                 result);
         return JNI_FALSE;
     }
@@ -513,7 +513,7 @@
     // Get the JetPlayer java class
     jetPlayerClass = env->FindClass(kClassPathName);
     if (jetPlayerClass == NULL) {
-        LOGE("Can't find %s", kClassPathName);
+        ALOGE("Can't find %s", kClassPathName);
         return -1;
     }
     javaJetPlayerFields.jetClass = (jclass)env->NewGlobalRef(jetPlayerClass);
@@ -523,7 +523,7 @@
             jetPlayerClass,
             JAVA_NATIVEJETPLAYERINJAVAOBJ_FIELD_NAME, "I");
     if (javaJetPlayerFields.nativePlayerInJavaObj == NULL) {
-        LOGE("Can't find AudioTrack.%s", JAVA_NATIVEJETPLAYERINJAVAOBJ_FIELD_NAME);
+        ALOGE("Can't find AudioTrack.%s", JAVA_NATIVEJETPLAYERINJAVAOBJ_FIELD_NAME);
         return -1;
     }
 
@@ -531,7 +531,7 @@
     javaJetPlayerFields.postNativeEventInJava = env->GetStaticMethodID(javaJetPlayerFields.jetClass,
             JAVA_NATIVEJETPOSTEVENT_CALLBACK_NAME, "(Ljava/lang/Object;III)V");
     if (javaJetPlayerFields.postNativeEventInJava == NULL) {
-        LOGE("Can't find Jet.%s", JAVA_NATIVEJETPOSTEVENT_CALLBACK_NAME);
+        ALOGE("Can't find Jet.%s", JAVA_NATIVEJETPOSTEVENT_CALLBACK_NAME);
         return -1;
     }
 
diff --git a/core/jni/android_media_ToneGenerator.cpp b/core/jni/android_media_ToneGenerator.cpp
index fdd586b..49be1c7 100644
--- a/core/jni/android_media_ToneGenerator.cpp
+++ b/core/jni/android_media_ToneGenerator.cpp
@@ -39,7 +39,7 @@
 static fields_t fields;
 
 static jboolean android_media_ToneGenerator_startTone(JNIEnv *env, jobject thiz, jint toneType, jint durationMs) {
-    LOGV("android_media_ToneGenerator_startTone: %x\n", (int)thiz);
+    ALOGV("android_media_ToneGenerator_startTone: %x\n", (int)thiz);
 
     ToneGenerator *lpToneGen = (ToneGenerator *)env->GetIntField(thiz,
             fields.context);
@@ -52,12 +52,12 @@
 }
 
 static void android_media_ToneGenerator_stopTone(JNIEnv *env, jobject thiz) {
-    LOGV("android_media_ToneGenerator_stopTone: %x\n", (int)thiz);
+    ALOGV("android_media_ToneGenerator_stopTone: %x\n", (int)thiz);
 
     ToneGenerator *lpToneGen = (ToneGenerator *)env->GetIntField(thiz,
             fields.context);
 
-    LOGV("ToneGenerator lpToneGen: %x\n", (unsigned int)lpToneGen);
+    ALOGV("ToneGenerator lpToneGen: %x\n", (unsigned int)lpToneGen);
     if (lpToneGen == NULL) {
         jniThrowRuntimeException(env, "Method called after release()");
         return;
@@ -68,7 +68,7 @@
 static void android_media_ToneGenerator_release(JNIEnv *env, jobject thiz) {
     ToneGenerator *lpToneGen = (ToneGenerator *)env->GetIntField(thiz,
             fields.context);
-    LOGV("android_media_ToneGenerator_release lpToneGen: %x\n", (int)lpToneGen);
+    ALOGV("android_media_ToneGenerator_release lpToneGen: %x\n", (int)lpToneGen);
 
     env->SetIntField(thiz, fields.context, 0);
 
@@ -83,17 +83,17 @@
 
     env->SetIntField(thiz, fields.context, 0);
 
-    LOGV("android_media_ToneGenerator_native_setup jobject: %x\n", (int)thiz);
+    ALOGV("android_media_ToneGenerator_native_setup jobject: %x\n", (int)thiz);
 
     if (lpToneGen == NULL) {
-        LOGE("ToneGenerator creation failed \n");
+        ALOGE("ToneGenerator creation failed \n");
         jniThrowException(env, "java/lang/OutOfMemoryError", NULL);
         return;
     }
-    LOGV("ToneGenerator lpToneGen: %x\n", (unsigned int)lpToneGen);
+    ALOGV("ToneGenerator lpToneGen: %x\n", (unsigned int)lpToneGen);
 
     if (!lpToneGen->isInited()) {
-        LOGE("ToneGenerator init failed \n");
+        ALOGE("ToneGenerator init failed \n");
         jniThrowRuntimeException(env, "Init failed");
         return;
     }
@@ -101,18 +101,18 @@
     // Stow our new C++ ToneGenerator in an opaque field in the Java object.
     env->SetIntField(thiz, fields.context, (int)lpToneGen);
 
-    LOGV("ToneGenerator fields.context: %x\n", env->GetIntField(thiz, fields.context));
+    ALOGV("ToneGenerator fields.context: %x\n", env->GetIntField(thiz, fields.context));
 }
 
 static void android_media_ToneGenerator_native_finalize(JNIEnv *env,
         jobject thiz) {
-    LOGV("android_media_ToneGenerator_native_finalize jobject: %x\n", (int)thiz);
+    ALOGV("android_media_ToneGenerator_native_finalize jobject: %x\n", (int)thiz);
 
     ToneGenerator *lpToneGen = (ToneGenerator *)env->GetIntField(thiz,
             fields.context);
 
     if (lpToneGen) {
-        LOGV("delete lpToneGen: %x\n", (int)lpToneGen);
+        ALOGV("delete lpToneGen: %x\n", (int)lpToneGen);
         delete lpToneGen;
     }
 }
@@ -133,16 +133,16 @@
 
     clazz = env->FindClass("android/media/ToneGenerator");
     if (clazz == NULL) {
-        LOGE("Can't find %s", "android/media/ToneGenerator");
+        ALOGE("Can't find %s", "android/media/ToneGenerator");
         return -1;
     }
 
     fields.context = env->GetFieldID(clazz, "mNativeContext", "I");
     if (fields.context == NULL) {
-        LOGE("Can't find ToneGenerator.mNativeContext");
+        ALOGE("Can't find ToneGenerator.mNativeContext");
         return -1;
     }
-    LOGV("register_android_media_ToneGenerator ToneGenerator fields.context: %x", (unsigned int)fields.context);
+    ALOGV("register_android_media_ToneGenerator ToneGenerator fields.context: %x", (unsigned int)fields.context);
 
     return AndroidRuntime::registerNativeMethods(env,
             "android/media/ToneGenerator", gMethods, NELEM(gMethods));
diff --git a/core/jni/android_net_LocalSocketImpl.cpp b/core/jni/android_net_LocalSocketImpl.cpp
index c8add70..1426b2c 100644
--- a/core/jni/android_net_LocalSocketImpl.cpp
+++ b/core/jni/android_net_LocalSocketImpl.cpp
@@ -957,7 +957,7 @@
         "android/net/LocalSocketImpl", gMethods, NELEM(gMethods));
 
 error:
-    LOGE("Error registering android.net.LocalSocketImpl");
+    ALOGE("Error registering android.net.LocalSocketImpl");
     return -1;
 }
 
diff --git a/core/jni/android_net_NetUtils.cpp b/core/jni/android_net_NetUtils.cpp
index d9bd50e..724d9fb 100644
--- a/core/jni/android_net_NetUtils.cpp
+++ b/core/jni/android_net_NetUtils.cpp
@@ -97,7 +97,7 @@
 
     const char *nameStr = env->GetStringUTFChars(ifname, NULL);
 
-    LOGD("android_net_utils_resetConnections in env=%p clazz=%p iface=%s mask=0x%x\n",
+    ALOGD("android_net_utils_resetConnections in env=%p clazz=%p iface=%s mask=0x%x\n",
           env, clazz, nameStr, mask);
 
     result = ::ifc_reset_connections(nameStr, mask);
diff --git a/core/jni/android_net_TrafficStats.cpp b/core/jni/android_net_TrafficStats.cpp
index 7a61432..0ab659b 100644
--- a/core/jni/android_net_TrafficStats.cpp
+++ b/core/jni/android_net_TrafficStats.cpp
@@ -47,13 +47,13 @@
     char buf[80];
     int fd = open(filename, O_RDONLY);
     if (fd < 0) {
-        if (errno != ENOENT) LOGE("Can't open %s: %s", filename, strerror(errno));
+        if (errno != ENOENT) ALOGE("Can't open %s: %s", filename, strerror(errno));
         return -1;
     }
 
     int len = read(fd, buf, sizeof(buf) - 1);
     if (len < 0) {
-        LOGE("Can't read %s: %s", filename, strerror(errno));
+        ALOGE("Can't read %s: %s", filename, strerror(errno));
         close(fd);
         return -1;
     }
@@ -101,7 +101,7 @@
     char filename[PATH_MAX] = "/sys/class/net/";
     DIR *dir = opendir(filename);
     if (dir == NULL) {
-        LOGE("Can't list %s: %s", filename, strerror(errno));
+        ALOGE("Can't list %s: %s", filename, strerror(errno));
         return -1;
     }
 
diff --git a/core/jni/android_nfc.h b/core/jni/android_nfc.h
index de0ddde..36346e3 100644
--- a/core/jni/android_nfc.h
+++ b/core/jni/android_nfc.h
@@ -28,7 +28,7 @@
 extern "C" {
 
 #if 0
-  #define TRACE(...) LOG(LOG_DEBUG, "NdefMessage", __VA_ARGS__)
+  #define TRACE(...) ALOG(LOG_DEBUG, "NdefMessage", __VA_ARGS__)
 #else
   #define TRACE(...)
 #endif
diff --git a/core/jni/android_nfc_NdefMessage.cpp b/core/jni/android_nfc_NdefMessage.cpp
index 41099cb..e6c0554 100644
--- a/core/jni/android_nfc_NdefMessage.cpp
+++ b/core/jni/android_nfc_NdefMessage.cpp
@@ -55,7 +55,7 @@
             (uint32_t)raw_msg_size, NULL, NULL, &num_of_records);
 
     if (status) {
-        LOGE("phFriNfc_NdefRecord_GetRecords(NULL) returned 0x%04x", status);
+        ALOGE("phFriNfc_NdefRecord_GetRecords(NULL) returned 0x%04x", status);
         goto end;
     }
     TRACE("phFriNfc_NdefRecord_GetRecords(NULL) returned 0x%04x, with %d records", status, num_of_records);
@@ -74,7 +74,7 @@
             (uint32_t)raw_msg_size, records, is_chunked, &num_of_records);
 
     if (status) {
-        LOGE("phFriNfc_NdefRecord_GetRecords() returned 0x%04x", status);
+        ALOGE("phFriNfc_NdefRecord_GetRecords() returned 0x%04x", status);
         goto end;
     }
     TRACE("phFriNfc_NdefRecord_GetRecords() returned 0x%04x, with %d records", status, num_of_records);
@@ -97,7 +97,7 @@
         status = phFriNfc_NdefRecord_Parse(&record, records[i]);
 
         if (status) {
-            LOGE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
+            ALOGE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
             goto end;
         }
         TRACE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
@@ -111,25 +111,25 @@
                 (uint64_t)record.PayloadLength;
         if (indicatedMsgLength >
                 (uint64_t)raw_msg_size) {
-            LOGE("phFri_NdefRecord_Parse: invalid length field");
+            ALOGE("phFri_NdefRecord_Parse: invalid length field");
             goto end;
         }
 
         type = e->NewByteArray(record.TypeLength);
         if (type == NULL) {
-            LOGD("NFC_Set Record Type Error\n");
+            ALOGD("NFC_Set Record Type Error\n");
             goto end;
         }
 
         id = e->NewByteArray(record.IdLength);
         if(id == NULL) {
-            LOGD("NFC_Set Record ID Error\n");
+            ALOGD("NFC_Set Record ID Error\n");
             goto end;
         }
 
         payload = e->NewByteArray(record.PayloadLength);
         if(payload == NULL) {
-            LOGD("NFC_Set Record Payload Error\n");
+            ALOGD("NFC_Set Record Payload Error\n");
             goto end;
         }
 
diff --git a/core/jni/android_nfc_NdefRecord.cpp b/core/jni/android_nfc_NdefRecord.cpp
index 67907b6..2d0e2b9 100644
--- a/core/jni/android_nfc_NdefRecord.cpp
+++ b/core/jni/android_nfc_NdefRecord.cpp
@@ -60,7 +60,7 @@
             &record_size);
 
     if (status) {
-        LOGE("phFriNfc_NdefRecord_Generate() returned 0x%04x", status);
+        ALOGE("phFriNfc_NdefRecord_Generate() returned 0x%04x", status);
         goto end;
     }
     TRACE("phFriNfc_NdefRecord_Generate() returned 0x%04x", status);
@@ -107,7 +107,7 @@
     TRACE("phFriNfc_NdefRecord_Parse()");
     status = phFriNfc_NdefRecord_Parse(&record, (uint8_t *)raw_record);
     if (status) {
-        LOGE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
+        ALOGE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
         goto clean_and_return;
     }
     TRACE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index 85fac5f..9586717 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -184,7 +184,7 @@
             }
         }
 
-        //LOGI("native=%d dalvik=%d sqlite=%d: %s\n", isNativeHeap, isDalvikHeap,
+        //ALOGI("native=%d dalvik=%d sqlite=%d: %s\n", isNativeHeap, isDalvikHeap,
         //    isSqliteHeap, line);
             
         while (true) {
@@ -517,22 +517,22 @@
     /* dup() the descriptor so we don't close the original with fclose() */
     int fd = dup(origFd);
     if (fd < 0) {
-        LOGW("dup(%d) failed: %s\n", origFd, strerror(errno));
+        ALOGW("dup(%d) failed: %s\n", origFd, strerror(errno));
         jniThrowRuntimeException(env, "dup() failed");
         return;
     }
 
     FILE* fp = fdopen(fd, "w");
     if (fp == NULL) {
-        LOGW("fdopen(%d) failed: %s\n", fd, strerror(errno));
+        ALOGW("fdopen(%d) failed: %s\n", fd, strerror(errno));
         close(fd);
         jniThrowRuntimeException(env, "fdopen() failed");
         return;
     }
 
-    LOGD("Native heap dump starting...\n");
+    ALOGD("Native heap dump starting...\n");
     dumpNativeHeap(fp);
-    LOGD("Native heap dump complete.\n");
+    ALOGD("Native heap dump complete.\n");
 
     fclose(fp);
 }
diff --git a/core/jni/android_os_StatFs.cpp b/core/jni/android_os_StatFs.cpp
index c658aa5..79d8fef 100644
--- a/core/jni/android_os_StatFs.cpp
+++ b/core/jni/android_os_StatFs.cpp
@@ -91,7 +91,7 @@
     // note that stat will contain the new file data corresponding to
     // pathstr
     if (statfs(pathstr, stat) != 0) {
-        LOGE("statfs %s failed, errno: %d", pathstr, errno);
+        ALOGE("statfs %s failed, errno: %d", pathstr, errno);
         delete stat;
         env->SetIntField(thiz, fields.context, 0);
         jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
@@ -146,13 +146,13 @@
 
     clazz = env->FindClass("android/os/StatFs");
     if (clazz == NULL) {
-        LOGE("Can't find android/os/StatFs");
+        ALOGE("Can't find android/os/StatFs");
         return -1;
     }
 
     fields.context = env->GetFieldID(clazz, "mNativeContext", "I");
     if (fields.context == NULL) {
-        LOGE("Can't find StatFs.mNativeContext");
+        ALOGE("Can't find StatFs.mNativeContext");
         return -1;
     }
 
diff --git a/core/jni/android_os_UEventObserver.cpp b/core/jni/android_os_UEventObserver.cpp
index 7f31b00..5639f4f 100644
--- a/core/jni/android_os_UEventObserver.cpp
+++ b/core/jni/android_os_UEventObserver.cpp
@@ -59,7 +59,7 @@
 
     clazz = env->FindClass("android/os/UEventObserver");
     if (clazz == NULL) {
-        LOGE("Can't find android/os/UEventObserver");
+        ALOGE("Can't find android/os/UEventObserver");
         return -1;
     }
 
diff --git a/core/jni/android_server_BluetoothA2dpService.cpp b/core/jni/android_server_BluetoothA2dpService.cpp
index 1851ad6..d065a9e 100644
--- a/core/jni/android_server_BluetoothA2dpService.cpp
+++ b/core/jni/android_server_BluetoothA2dpService.cpp
@@ -61,11 +61,11 @@
  * Return false if dbus is down, or another serious error (out of memory)
 */
 static bool initNative(JNIEnv* env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     nat = (native_data_t *)calloc(1, sizeof(native_data_t));
     if (NULL == nat) {
-        LOGE("%s: out of memory!", __FUNCTION__);
+        ALOGE("%s: out of memory!", __FUNCTION__);
         return false;
     }
     env->GetJavaVM( &(nat->vm) );
@@ -77,7 +77,7 @@
     dbus_threads_init_default();
     nat->conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
     if (dbus_error_is_set(&err)) {
-        LOGE("Could not get onto the system bus: %s", err.message);
+        ALOGE("Could not get onto the system bus: %s", err.message);
         dbus_error_free(&err);
         return false;
     }
@@ -88,7 +88,7 @@
 
 static void cleanupNative(JNIEnv* env, jobject object) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     if (nat) {
         dbus_connection_close(nat->conn);
         env->DeleteGlobalRef(nat->me);
@@ -101,7 +101,7 @@
 static jobjectArray getSinkPropertiesNative(JNIEnv *env, jobject object,
                                             jstring path) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     if (nat) {
         DBusMessage *msg, *reply;
         DBusError err;
@@ -117,7 +117,7 @@
             LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, reply);
             return NULL;
         } else if (!reply) {
-            LOGE("DBus reply is NULL in function %s", __FUNCTION__);
+            ALOGE("DBus reply is NULL in function %s", __FUNCTION__);
             return NULL;
         }
         DBusMessageIter iter;
@@ -132,7 +132,7 @@
 
 static jboolean connectSinkNative(JNIEnv *env, jobject object, jstring path) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     if (nat) {
         const char *c_path = env->GetStringUTFChars(path, NULL);
         int len = env->GetStringLength(path) + 1;
@@ -153,7 +153,7 @@
 static jboolean disconnectSinkNative(JNIEnv *env, jobject object,
                                      jstring path) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     if (nat) {
         const char *c_path = env->GetStringUTFChars(path, NULL);
 
@@ -171,7 +171,7 @@
 static jboolean suspendSinkNative(JNIEnv *env, jobject object,
                                      jstring path) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     if (nat) {
         const char *c_path = env->GetStringUTFChars(path, NULL);
         bool ret = dbus_func_args_async(env, nat->conn, -1, NULL, NULL, nat,
@@ -187,7 +187,7 @@
 static jboolean resumeSinkNative(JNIEnv *env, jobject object,
                                      jstring path) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     if (nat) {
         const char *c_path = env->GetStringUTFChars(path, NULL);
         bool ret = dbus_func_args_async(env, nat->conn, -1, NULL, NULL, nat,
@@ -203,7 +203,7 @@
 static jboolean avrcpVolumeUpNative(JNIEnv *env, jobject object,
                                      jstring path) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     if (nat) {
         const char *c_path = env->GetStringUTFChars(path, NULL);
         bool ret = dbus_func_args_async(env, nat->conn, -1, NULL, NULL, nat,
@@ -219,7 +219,7 @@
 static jboolean avrcpVolumeDownNative(JNIEnv *env, jobject object,
                                      jstring path) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     if (nat) {
         const char *c_path = env->GetStringUTFChars(path, NULL);
         bool ret = dbus_func_args_async(env, nat->conn, -1, NULL, NULL, nat,
@@ -237,8 +237,8 @@
     DBusError err;
 
     if (!nat) {
-        LOGV("... skipping %s\n", __FUNCTION__);
-        LOGV("... ignored\n");
+        ALOGV("... skipping %s\n", __FUNCTION__);
+        ALOGV("... ignored\n");
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
 
@@ -265,10 +265,10 @@
         result = DBUS_HANDLER_RESULT_HANDLED;
         return result;
     } else {
-        LOGV("... ignored");
+        ALOGV("... ignored");
     }
     if (env->ExceptionCheck()) {
-        LOGE("VM Exception occurred while handling %s.%s (%s) in %s,"
+        ALOGE("VM Exception occurred while handling %s.%s (%s) in %s,"
              " leaving for VM",
              dbus_message_get_interface(msg), dbus_message_get_member(msg),
              dbus_message_get_path(msg), __FUNCTION__);
@@ -278,7 +278,7 @@
 }
 
 void onConnectSinkResult(DBusMessage *msg, void *user, void *n) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     native_data_t *nat = (native_data_t *)n;
     const char *path = (const char *)user;
@@ -293,7 +293,7 @@
         LOG_AND_FREE_DBUS_ERROR(&err);
         result = JNI_FALSE;
     }
-    LOGV("... Device Path = %s, result = %d", path, result);
+    ALOGV("... Device Path = %s, result = %d", path, result);
 
     jstring jPath = env->NewStringUTF(path);
     env->CallVoidMethod(nat->me,
@@ -326,7 +326,7 @@
 int register_android_server_BluetoothA2dpService(JNIEnv *env) {
     jclass clazz = env->FindClass("android/server/BluetoothA2dpService");
     if (clazz == NULL) {
-        LOGE("Can't find android/server/BluetoothA2dpService");
+        ALOGE("Can't find android/server/BluetoothA2dpService");
         return -1;
     }
 
diff --git a/core/jni/android_server_BluetoothEventLoop.cpp b/core/jni/android_server_BluetoothEventLoop.cpp
index e8933fe..9292fc0 100644
--- a/core/jni/android_server_BluetoothEventLoop.cpp
+++ b/core/jni/android_server_BluetoothEventLoop.cpp
@@ -91,7 +91,7 @@
 
 #endif
 static void classInitNative(JNIEnv* env, jclass clazz) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
 #ifdef HAVE_BLUETOOTH
     method_onPropertyChanged = env->GetMethodID(clazz, "onPropertyChanged",
@@ -157,11 +157,11 @@
 }
 
 static void initializeNativeDataNative(JNIEnv* env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = (native_data_t *)calloc(1, sizeof(native_data_t));
     if (NULL == nat) {
-        LOGE("%s: out of memory!", __FUNCTION__);
+        ALOGE("%s: out of memory!", __FUNCTION__);
         return;
     }
     memset(nat, 0, sizeof(native_data_t));
@@ -176,7 +176,7 @@
         dbus_threads_init_default();
         nat->conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
         if (dbus_error_is_set(&err)) {
-            LOGE("%s: Could not get onto the system bus!", __FUNCTION__);
+            ALOGE("%s: Could not get onto the system bus!", __FUNCTION__);
             dbus_error_free(&err);
         }
         dbus_connection_set_exit_on_disconnect(nat->conn, FALSE);
@@ -185,7 +185,7 @@
 }
 
 static void cleanupNativeDataNative(JNIEnv* env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat =
             (native_data_t *)env->GetIntField(object, field_mNativeData);
@@ -226,7 +226,7 @@
 }
 
 static jboolean setUpEventLoop(native_data_t *nat) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     if (nat != NULL && nat->conn != NULL) {
         dbus_threads_init_default();
@@ -321,7 +321,7 @@
         msg = dbus_message_new_method_call("org.bluez", "/",
               "org.bluez.Manager", "DefaultAdapter");
         if (!msg) {
-            LOGE("%s: Can't allocate new method call for get_adapter_path!",
+            ALOGE("%s: Can't allocate new method call for get_adapter_path!",
                   __FUNCTION__);
             return NULL;
         }
@@ -346,7 +346,7 @@
         }
     }
     if (attempt == 1000) {
-        LOGE("Time out while trying to get Adapter path, is bluetoothd up ?");
+        ALOGE("Time out while trying to get Adapter path, is bluetoothd up ?");
         goto failed;
     }
 
@@ -375,7 +375,7 @@
 
     if (!dbus_connection_register_object_path(nat->conn, agent_path,
             &agent_vtable, nat)) {
-        LOGE("%s: Can't register object path %s for agent!",
+        ALOGE("%s: Can't register object path %s for agent!",
               __FUNCTION__, agent_path);
         return -1;
     }
@@ -387,7 +387,7 @@
     msg = dbus_message_new_method_call("org.bluez", nat->adapter,
           "org.bluez.Adapter", "RegisterAgent");
     if (!msg) {
-        LOGE("%s: Can't allocate new method call for agent!",
+        ALOGE("%s: Can't allocate new method call for agent!",
               __FUNCTION__);
         return -1;
     }
@@ -400,7 +400,7 @@
     dbus_message_unref(msg);
 
     if (!reply) {
-        LOGE("%s: Can't register agent!", __FUNCTION__);
+        ALOGE("%s: Can't register agent!", __FUNCTION__);
         if (dbus_error_is_set(&err)) {
             LOG_AND_FREE_DBUS_ERROR(&err);
         }
@@ -414,7 +414,7 @@
 }
 
 static void tearDownEventLoop(native_data_t *nat) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     if (nat != NULL && nat->conn != NULL) {
 
         DBusMessage *msg, *reply;
@@ -442,7 +442,7 @@
             }
             dbus_message_unref(msg);
         } else {
-             LOGE("%s: Can't create new method call!", __FUNCTION__);
+             ALOGE("%s: Can't create new method call!", __FUNCTION__);
         }
 
         dbus_connection_flush(nat->conn);
@@ -576,12 +576,12 @@
     for (int y = 0; y<nat->pollMemberCount; y++) {
         if ((nat->pollData[y].fd == newFD) &&
                 (nat->pollData[y].events == events)) {
-            LOGV("DBusWatch duplicate add");
+            ALOGV("DBusWatch duplicate add");
             return;
         }
     }
     if (nat->pollMemberCount == nat->pollDataSize) {
-        LOGV("Bluetooth EventLoop poll struct growing");
+        ALOGV("Bluetooth EventLoop poll struct growing");
         struct pollfd *temp = (struct pollfd *)malloc(
                 sizeof(struct pollfd) * (nat->pollMemberCount+1));
         if (!temp) {
@@ -629,7 +629,7 @@
             return;
         }
     }
-    LOGW("WatchRemove given with unknown watch");
+    ALOGW("WatchRemove given with unknown watch");
 }
 
 static void *eventLoopMain(void *ptr) {
@@ -717,7 +717,7 @@
     nat->running = false;
 
     if (nat->pollData) {
-        LOGW("trying to start EventLoop a second time!");
+        ALOGW("trying to start EventLoop a second time!");
         pthread_mutex_unlock( &(nat->thread_mutex) );
         return JNI_FALSE;
     }
@@ -725,14 +725,14 @@
     nat->pollData = (struct pollfd *)malloc(sizeof(struct pollfd) *
             DEFAULT_INITIAL_POLLFD_COUNT);
     if (!nat->pollData) {
-        LOGE("out of memory error starting EventLoop!");
+        ALOGE("out of memory error starting EventLoop!");
         goto done;
     }
 
     nat->watchData = (DBusWatch **)malloc(sizeof(DBusWatch *) *
             DEFAULT_INITIAL_POLLFD_COUNT);
     if (!nat->watchData) {
-        LOGE("out of memory error starting EventLoop!");
+        ALOGE("out of memory error starting EventLoop!");
         goto done;
     }
 
@@ -744,7 +744,7 @@
     nat->pollMemberCount = 1;
 
     if (socketpair(AF_LOCAL, SOCK_STREAM, 0, &(nat->controlFdR))) {
-        LOGE("Error getting BT control socket");
+        ALOGE("Error getting BT control socket");
         goto done;
     }
     nat->pollData[0].fd = nat->controlFdR;
@@ -756,7 +756,7 @@
     nat->me = env->NewGlobalRef(object);
 
     if (setUpEventLoop(nat) != JNI_TRUE) {
-        LOGE("failure setting up Event Loop!");
+        ALOGE("failure setting up Event Loop!");
         goto done;
     }
 
@@ -848,11 +848,11 @@
     nat = (native_data_t *)data;
     nat->vm->GetEnv((void**)&env, nat->envVer);
     if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL) {
-        LOGV("%s: not interested (not a signal).", __FUNCTION__);
+        ALOGV("%s: not interested (not a signal).", __FUNCTION__);
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
 
-    LOGV("%s: Received signal %s:%s from %s", __FUNCTION__,
+    ALOGV("%s: Received signal %s:%s from %s", __FUNCTION__,
         dbus_message_get_interface(msg), dbus_message_get_member(msg),
         dbus_message_get_path(msg));
 
@@ -884,7 +884,7 @@
         if (dbus_message_get_args(msg, &err,
                                   DBUS_TYPE_STRING, &c_address,
                                   DBUS_TYPE_INVALID)) {
-            LOGV("... address = %s", c_address);
+            ALOGV("... address = %s", c_address);
             env->CallVoidMethod(nat->me, method_onDeviceDisappeared,
                                 env->NewStringUTF(c_address));
         } else LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg);
@@ -896,7 +896,7 @@
         if (dbus_message_get_args(msg, &err,
                                   DBUS_TYPE_OBJECT_PATH, &c_object_path,
                                   DBUS_TYPE_INVALID)) {
-            LOGV("... address = %s", c_object_path);
+            ALOGV("... address = %s", c_object_path);
             env->CallVoidMethod(nat->me,
                                 method_onDeviceCreated,
                                 env->NewStringUTF(c_object_path));
@@ -909,7 +909,7 @@
         if (dbus_message_get_args(msg, &err,
                                  DBUS_TYPE_OBJECT_PATH, &c_object_path,
                                  DBUS_TYPE_INVALID)) {
-           LOGV("... Object Path = %s", c_object_path);
+           ALOGV("... Object Path = %s", c_object_path);
            env->CallVoidMethod(nat->me,
                                method_onDeviceRemoved,
                                env->NewStringUTF(c_object_path));
@@ -1094,10 +1094,10 @@
     native_data_t *nat = (native_data_t *)data;
     JNIEnv *env;
     if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_METHOD_CALL) {
-        LOGV("%s: not interested (not a method call).", __FUNCTION__);
+        ALOGV("%s: not interested (not a method call).", __FUNCTION__);
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
-    LOGI("%s: Received method %s:%s", __FUNCTION__,
+    ALOGI("%s: Received method %s:%s", __FUNCTION__,
          dbus_message_get_interface(msg), dbus_message_get_member(msg));
 
     if (nat == NULL) return DBUS_HANDLER_RESULT_HANDLED;
@@ -1111,7 +1111,7 @@
         // reply
         DBusMessage *reply = dbus_message_new_method_return(msg);
         if (!reply) {
-            LOGE("%s: Cannot create message reply\n", __FUNCTION__);
+            ALOGE("%s: Cannot create message reply\n", __FUNCTION__);
             goto failure;
         }
         dbus_connection_send(nat->conn, reply, NULL);
@@ -1126,12 +1126,12 @@
                                    DBUS_TYPE_OBJECT_PATH, &object_path,
                                    DBUS_TYPE_STRING, &uuid,
                                    DBUS_TYPE_INVALID)) {
-            LOGE("%s: Invalid arguments for Authorize() method", __FUNCTION__);
+            ALOGE("%s: Invalid arguments for Authorize() method", __FUNCTION__);
             goto failure;
         }
 
-        LOGV("... object_path = %s", object_path);
-        LOGV("... uuid = %s", uuid);
+        ALOGV("... object_path = %s", object_path);
+        ALOGV("... uuid = %s", uuid);
 
         dbus_message_ref(msg);  // increment refcount because we pass to java
         env->CallVoidMethod(nat->me, method_onAgentAuthorize,
@@ -1145,11 +1145,11 @@
         if (!dbus_message_get_args(msg, NULL,
                                    DBUS_TYPE_OBJECT_PATH, &object_path,
                                    DBUS_TYPE_INVALID)) {
-            LOGE("%s: Invalid arguments for OutOfBandData available() method", __FUNCTION__);
+            ALOGE("%s: Invalid arguments for OutOfBandData available() method", __FUNCTION__);
             goto failure;
         }
 
-        LOGV("... object_path = %s", object_path);
+        ALOGV("... object_path = %s", object_path);
 
         bool available =
             env->CallBooleanMethod(nat->me, method_onAgentOutOfBandDataAvailable,
@@ -1160,7 +1160,7 @@
         if (available) {
             DBusMessage *reply = dbus_message_new_method_return(msg);
             if (!reply) {
-                LOGE("%s: Cannot create message reply\n", __FUNCTION__);
+                ALOGE("%s: Cannot create message reply\n", __FUNCTION__);
                 goto failure;
             }
             dbus_connection_send(nat->conn, reply, NULL);
@@ -1169,7 +1169,7 @@
             DBusMessage *reply = dbus_message_new_error(msg,
                     "org.bluez.Error.DoesNotExist", "OutofBand data not available");
             if (!reply) {
-                LOGE("%s: Cannot create message reply\n", __FUNCTION__);
+                ALOGE("%s: Cannot create message reply\n", __FUNCTION__);
                 goto failure;
             }
             dbus_connection_send(nat->conn, reply, NULL);
@@ -1182,7 +1182,7 @@
         if (!dbus_message_get_args(msg, NULL,
                                    DBUS_TYPE_OBJECT_PATH, &object_path,
                                    DBUS_TYPE_INVALID)) {
-            LOGE("%s: Invalid arguments for RequestPinCode() method", __FUNCTION__);
+            ALOGE("%s: Invalid arguments for RequestPinCode() method", __FUNCTION__);
             goto failure;
         }
 
@@ -1197,7 +1197,7 @@
         if (!dbus_message_get_args(msg, NULL,
                                    DBUS_TYPE_OBJECT_PATH, &object_path,
                                    DBUS_TYPE_INVALID)) {
-            LOGE("%s: Invalid arguments for RequestPasskey() method", __FUNCTION__);
+            ALOGE("%s: Invalid arguments for RequestPasskey() method", __FUNCTION__);
             goto failure;
         }
 
@@ -1212,7 +1212,7 @@
         if (!dbus_message_get_args(msg, NULL,
                                    DBUS_TYPE_OBJECT_PATH, &object_path,
                                    DBUS_TYPE_INVALID)) {
-            LOGE("%s: Invalid arguments for RequestOobData() method", __FUNCTION__);
+            ALOGE("%s: Invalid arguments for RequestOobData() method", __FUNCTION__);
             goto failure;
         }
 
@@ -1229,7 +1229,7 @@
                                    DBUS_TYPE_OBJECT_PATH, &object_path,
                                    DBUS_TYPE_UINT32, &passkey,
                                    DBUS_TYPE_INVALID)) {
-            LOGE("%s: Invalid arguments for RequestPasskey() method", __FUNCTION__);
+            ALOGE("%s: Invalid arguments for RequestPasskey() method", __FUNCTION__);
             goto failure;
         }
 
@@ -1247,7 +1247,7 @@
                                    DBUS_TYPE_OBJECT_PATH, &object_path,
                                    DBUS_TYPE_UINT32, &passkey,
                                    DBUS_TYPE_INVALID)) {
-            LOGE("%s: Invalid arguments for RequestConfirmation() method", __FUNCTION__);
+            ALOGE("%s: Invalid arguments for RequestConfirmation() method", __FUNCTION__);
             goto failure;
         }
 
@@ -1263,7 +1263,7 @@
         if (!dbus_message_get_args(msg, NULL,
                                    DBUS_TYPE_OBJECT_PATH, &object_path,
                                    DBUS_TYPE_INVALID)) {
-            LOGE("%s: Invalid arguments for RequestPairingConsent() method", __FUNCTION__);
+            ALOGE("%s: Invalid arguments for RequestPairingConsent() method", __FUNCTION__);
             goto failure;
         }
 
@@ -1277,14 +1277,14 @@
         // reply
         DBusMessage *reply = dbus_message_new_method_return(msg);
         if (!reply) {
-            LOGE("%s: Cannot create message reply\n", __FUNCTION__);
+            ALOGE("%s: Cannot create message reply\n", __FUNCTION__);
             goto failure;
         }
         dbus_connection_send(nat->conn, reply, NULL);
         dbus_message_unref(reply);
         goto success;
     } else {
-        LOGV("%s:%s is ignored", dbus_message_get_interface(msg), dbus_message_get_member(msg));
+        ALOGV("%s:%s is ignored", dbus_message_get_interface(msg), dbus_message_get_member(msg));
     }
 
 failure:
@@ -1302,7 +1302,7 @@
 #ifdef HAVE_BLUETOOTH
 
 void onCreatePairedDeviceResult(DBusMessage *msg, void *user, void *n) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     native_data_t *nat = (native_data_t *)n;
     const char *address = (const char *)user;
@@ -1313,48 +1313,48 @@
 
     nat->vm->GetEnv((void**)&env, nat->envVer);
 
-    LOGV("... address = %s", address);
+    ALOGV("... address = %s", address);
 
     jint result = BOND_RESULT_SUCCESS;
     if (dbus_set_error_from_message(&err, msg)) {
         if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.AuthenticationFailed")) {
             // Pins did not match, or remote device did not respond to pin
             // request in time
-            LOGV("... error = %s (%s)\n", err.name, err.message);
+            ALOGV("... error = %s (%s)\n", err.name, err.message);
             result = BOND_RESULT_AUTH_FAILED;
         } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.AuthenticationRejected")) {
             // We rejected pairing, or the remote side rejected pairing. This
             // happens if either side presses 'cancel' at the pairing dialog.
-            LOGV("... error = %s (%s)\n", err.name, err.message);
+            ALOGV("... error = %s (%s)\n", err.name, err.message);
             result = BOND_RESULT_AUTH_REJECTED;
         } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.AuthenticationCanceled")) {
             // Not sure if this happens
-            LOGV("... error = %s (%s)\n", err.name, err.message);
+            ALOGV("... error = %s (%s)\n", err.name, err.message);
             result = BOND_RESULT_AUTH_CANCELED;
         } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.ConnectionAttemptFailed")) {
             // Other device is not responding at all
-            LOGV("... error = %s (%s)\n", err.name, err.message);
+            ALOGV("... error = %s (%s)\n", err.name, err.message);
             result = BOND_RESULT_REMOTE_DEVICE_DOWN;
         } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.AlreadyExists")) {
             // already bonded
-            LOGV("... error = %s (%s)\n", err.name, err.message);
+            ALOGV("... error = %s (%s)\n", err.name, err.message);
             result = BOND_RESULT_SUCCESS;
         } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.InProgress") &&
                    !strcmp(err.message, "Bonding in progress")) {
-            LOGV("... error = %s (%s)\n", err.name, err.message);
+            ALOGV("... error = %s (%s)\n", err.name, err.message);
             goto done;
         } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.InProgress") &&
                    !strcmp(err.message, "Discover in progress")) {
-            LOGV("... error = %s (%s)\n", err.name, err.message);
+            ALOGV("... error = %s (%s)\n", err.name, err.message);
             result = BOND_RESULT_DISCOVERY_IN_PROGRESS;
         } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.RepeatedAttempts")) {
-            LOGV("... error = %s (%s)\n", err.name, err.message);
+            ALOGV("... error = %s (%s)\n", err.name, err.message);
             result = BOND_RESULT_REPEATED_ATTEMPTS;
         } else if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.AuthenticationTimeout")) {
-            LOGV("... error = %s (%s)\n", err.name, err.message);
+            ALOGV("... error = %s (%s)\n", err.name, err.message);
             result = BOND_RESULT_AUTH_TIMEOUT;
         } else {
-            LOGE("%s: D-Bus error: %s (%s)\n", __FUNCTION__, err.name, err.message);
+            ALOGE("%s: D-Bus error: %s (%s)\n", __FUNCTION__, err.name, err.message);
             result = BOND_RESULT_ERROR;
         }
     }
@@ -1371,7 +1371,7 @@
 }
 
 void onCreateDeviceResult(DBusMessage *msg, void *user, void *n) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     native_data_t *nat = (native_data_t *)n;
     const char *address= (const char *)user;
@@ -1380,7 +1380,7 @@
     JNIEnv *env;
     nat->vm->GetEnv((void**)&env, nat->envVer);
 
-    LOGV("... Address = %s", address);
+    ALOGV("... Address = %s", address);
 
     jint result = CREATE_DEVICE_SUCCESS;
     if (dbus_set_error_from_message(&err, msg)) {
@@ -1401,7 +1401,7 @@
 }
 
 void onDiscoverServicesResult(DBusMessage *msg, void *user, void *n) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     native_data_t *nat = (native_data_t *)n;
     const char *path = (const char *)user;
@@ -1410,7 +1410,7 @@
     JNIEnv *env;
     nat->vm->GetEnv((void**)&env, nat->envVer);
 
-    LOGV("... Device Path = %s", path);
+    ALOGV("... Device Path = %s", path);
 
     bool result = JNI_TRUE;
     if (dbus_set_error_from_message(&err, msg)) {
@@ -1427,7 +1427,7 @@
 }
 
 void onGetDeviceServiceChannelResult(DBusMessage *msg, void *user, void *n) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     const char *address = (const char *) user;
     native_data_t *nat = (native_data_t *) n;
@@ -1439,13 +1439,13 @@
 
     jint channel = -2;
 
-    LOGV("... address = %s", address);
+    ALOGV("... address = %s", address);
 
     if (dbus_set_error_from_message(&err, msg) ||
         !dbus_message_get_args(msg, &err,
                                DBUS_TYPE_INT32, &channel,
                                DBUS_TYPE_INVALID)) {
-        LOGE("%s: D-Bus error: %s (%s)\n", __FUNCTION__, err.name, err.message);
+        ALOGE("%s: D-Bus error: %s (%s)\n", __FUNCTION__, err.name, err.message);
         dbus_error_free(&err);
     }
 
@@ -1460,7 +1460,7 @@
 }
 
 void onInputDeviceConnectionResult(DBusMessage *msg, void *user, void *n) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     native_data_t *nat = (native_data_t *)n;
     const char *path = (const char *)user;
@@ -1488,7 +1488,7 @@
         LOG_AND_FREE_DBUS_ERROR(&err);
     }
 
-    LOGV("... Device Path = %s, result = %d", path, result);
+    ALOGV("... Device Path = %s, result = %d", path, result);
     jstring jPath = env->NewStringUTF(path);
     env->CallVoidMethod(nat->me,
                         method_onInputDeviceConnectionResult,
@@ -1499,7 +1499,7 @@
 }
 
 void onPanDeviceConnectionResult(DBusMessage *msg, void *user, void *n) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     native_data_t *nat = (native_data_t *)n;
     const char *path = (const char *)user;
@@ -1527,7 +1527,7 @@
         LOG_AND_FREE_DBUS_ERROR(&err);
     }
 
-    LOGV("... Pan Device Path = %s, result = %d", path, result);
+    ALOGV("... Pan Device Path = %s, result = %d", path, result);
     jstring jPath = env->NewStringUTF(path);
     env->CallVoidMethod(nat->me,
                         method_onPanDeviceConnectionResult,
@@ -1538,7 +1538,7 @@
 }
 
 void onHealthDeviceConnectionResult(DBusMessage *msg, void *user, void *n) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 
     native_data_t *nat = (native_data_t *)n;
     DBusError err;
@@ -1563,7 +1563,7 @@
     }
 
     jint code = *(int *) user;
-    LOGV("... Health Device Code = %d, result = %d", code, result);
+    ALOGV("... Health Device Code = %d, result = %d", code, result);
     env->CallVoidMethod(nat->me,
                         method_onHealthDeviceConnectionResult,
                         code,
diff --git a/core/jni/android_server_BluetoothService.cpp b/core/jni/android_server_BluetoothService.cpp
index a49c918..eba378d 100644
--- a/core/jni/android_server_BluetoothService.cpp
+++ b/core/jni/android_server_BluetoothService.cpp
@@ -89,7 +89,7 @@
     native_data_t *nat =
             (native_data_t *)(env->GetIntField(object, field_mNativeData));
     if (nat == NULL || nat->conn == NULL) {
-        LOGE("Uninitialized native data\n");
+        ALOGE("Uninitialized native data\n");
         return NULL;
     }
     return nat;
@@ -97,7 +97,7 @@
 #endif
 
 static void classInitNative(JNIEnv* env, jclass clazz) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     field_mNativeData = get_field(env, clazz, "mNativeData", "I");
     field_mEventLoop = get_field(env, clazz, "mEventLoop",
@@ -109,11 +109,11 @@
  * Return false if dbus is down, or another serious error (out of memory)
 */
 static bool initializeNativeDataNative(JNIEnv* env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = (native_data_t *)calloc(1, sizeof(native_data_t));
     if (NULL == nat) {
-        LOGE("%s: out of memory!", __FUNCTION__);
+        ALOGE("%s: out of memory!", __FUNCTION__);
         return false;
     }
     nat->env = env;
@@ -124,7 +124,7 @@
     dbus_threads_init_default();
     nat->conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
     if (dbus_error_is_set(&err)) {
-        LOGE("Could not get onto the system bus: %s", err.message);
+        ALOGE("Could not get onto the system bus: %s", err.message);
         dbus_error_free(&err);
         return false;
     }
@@ -148,7 +148,7 @@
 
 // This function is called when the adapter is enabled.
 static jboolean setupNativeDataNative(JNIEnv* env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat =
         (native_data_t *)env->GetIntField(object, field_mNativeData);
@@ -162,7 +162,7 @@
 
     if (!dbus_connection_register_object_path(nat->conn, device_agent_path,
                                               &agent_vtable, event_nat)) {
-        LOGE("%s: Can't register object path %s for remote device agent!",
+        ALOGE("%s: Can't register object path %s for remote device agent!",
                                __FUNCTION__, device_agent_path);
         return JNI_FALSE;
     }
@@ -171,7 +171,7 @@
 }
 
 static jboolean tearDownNativeDataNative(JNIEnv *env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat =
                (native_data_t *)env->GetIntField(object, field_mNativeData);
@@ -185,7 +185,7 @@
 }
 
 static void cleanupNativeDataNative(JNIEnv* env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat =
         (native_data_t *)env->GetIntField(object, field_mNativeData);
@@ -197,7 +197,7 @@
 }
 
 static jstring getAdapterPathNative(JNIEnv *env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
@@ -209,7 +209,7 @@
 
 
 static jboolean startDiscoveryNative(JNIEnv *env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     DBusMessage *msg = NULL;
     DBusMessage *reply = NULL;
@@ -255,7 +255,7 @@
 }
 
 static jboolean stopDiscoveryNative(JNIEnv *env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     DBusMessage *msg = NULL;
     DBusMessage *reply = NULL;
@@ -287,7 +287,7 @@
         if(strncmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.NotAuthorized",
                    strlen(BLUEZ_DBUS_BASE_IFC ".Error.NotAuthorized")) == 0) {
             // hcid sends this if there is no active discovery to cancel
-            LOGV("%s: There was no active discovery to cancel", __FUNCTION__);
+            ALOGV("%s: There was no active discovery to cancel", __FUNCTION__);
             dbus_error_free(&err);
         } else {
             LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg);
@@ -306,7 +306,7 @@
 }
 
 static jbyteArray readAdapterOutOfBandDataNative(JNIEnv *env, jobject object) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     DBusError err;
@@ -332,7 +332,7 @@
                    env->SetByteArrayRegion(byteArray, 16, 16, randomizer);
                }
            } else {
-               LOGE("readAdapterOutOfBandDataNative: Hash len = %d, R len = %d",
+               ALOGE("readAdapterOutOfBandDataNative: Hash len = %d, R len = %d",
                                                                   hash_len, r_len);
            }
        } else {
@@ -347,7 +347,7 @@
 
 static jboolean createPairedDeviceNative(JNIEnv *env, jobject object,
                                          jstring address, jint timeout_ms) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     jobject eventLoop = env->GetObjectField(object, field_mEventLoop);
@@ -356,7 +356,7 @@
 
     if (nat && eventLoopNat) {
         const char *c_address = env->GetStringUTFChars(address, NULL);
-        LOGV("... address = %s", c_address);
+        ALOGV("... address = %s", c_address);
         char *context_address = (char *)calloc(BTADDR_SIZE, sizeof(char));
         const char *capabilities = "DisplayYesNo";
         const char *agent_path = "/android/bluetooth/remote_device_agent";
@@ -383,7 +383,7 @@
 
 static jboolean createPairedDeviceOutOfBandNative(JNIEnv *env, jobject object,
                                                 jstring address, jint timeout_ms) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     jobject eventLoop = env->GetObjectField(object, field_mEventLoop);
@@ -392,7 +392,7 @@
 
     if (nat && eventLoopNat) {
         const char *c_address = env->GetStringUTFChars(address, NULL);
-        LOGV("... address = %s", c_address);
+        ALOGV("... address = %s", c_address);
         char *context_address = (char *)calloc(BTADDR_SIZE, sizeof(char));
         const char *capabilities = "DisplayYesNo";
         const char *agent_path = "/android/bluetooth/remote_device_agent";
@@ -420,7 +420,7 @@
                                           jstring path,
                                           jstring pattern, jint attr_id) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     native_data_t *nat = get_native_data(env, object);
     jobject eventLoop = env->GetObjectField(object, field_mEventLoop);
     struct event_loop_native_data_t *eventLoopNat =
@@ -428,8 +428,8 @@
     if (nat && eventLoopNat) {
         const char *c_pattern = env->GetStringUTFChars(pattern, NULL);
         const char *c_path = env->GetStringUTFChars(path, NULL);
-        LOGV("... pattern = %s", c_pattern);
-        LOGV("... attr_id = %#X", attr_id);
+        ALOGV("... pattern = %s", c_pattern);
+        ALOGV("... attr_id = %#X", attr_id);
         DBusMessage *reply =
             dbus_func_args(env, nat->conn, c_path,
                            DBUS_DEVICE_IFACE, "GetServiceAttributeValue",
@@ -446,7 +446,7 @@
 
 static jboolean cancelDeviceCreationNative(JNIEnv *env, jobject object,
                                            jstring address) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     jboolean result = JNI_FALSE;
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
@@ -454,7 +454,7 @@
         const char *c_address = env->GetStringUTFChars(address, NULL);
         DBusError err;
         dbus_error_init(&err);
-        LOGV("... address = %s", c_address);
+        ALOGV("... address = %s", c_address);
         DBusMessage *reply =
             dbus_func_args_timeout(env, nat->conn, -1,
                                    get_adapter_path(env, object),
@@ -466,7 +466,7 @@
             if (dbus_error_is_set(&err)) {
                 LOG_AND_FREE_DBUS_ERROR(&err);
             } else
-                LOGE("DBus reply is NULL in function %s", __FUNCTION__);
+                ALOGE("DBus reply is NULL in function %s", __FUNCTION__);
             return JNI_FALSE;
         } else {
             result = JNI_TRUE;
@@ -478,7 +478,7 @@
 }
 
 static jboolean removeDeviceNative(JNIEnv *env, jobject object, jstring object_path) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
@@ -501,7 +501,7 @@
 
 static jint enableNative(JNIEnv *env, jobject object) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     return bt_enable();
 #endif
     return -1;
@@ -509,7 +509,7 @@
 
 static jint disableNative(JNIEnv *env, jobject object) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     return bt_disable();
 #endif
     return -1;
@@ -517,7 +517,7 @@
 
 static jint isEnabledNative(JNIEnv *env, jobject object) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     return bt_is_enabled();
 #endif
     return -1;
@@ -527,7 +527,7 @@
                                              jstring address, bool confirm,
                                              int nativeData) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
         DBusMessage *msg = (DBusMessage *)nativeData;
@@ -540,7 +540,7 @@
         }
 
         if (!reply) {
-            LOGE("%s: Cannot create message reply to RequestPasskeyConfirmation or"
+            ALOGE("%s: Cannot create message reply to RequestPasskeyConfirmation or"
                   "RequestPairingConsent to D-Bus\n", __FUNCTION__);
             dbus_message_unref(msg);
             return JNI_FALSE;
@@ -558,13 +558,13 @@
 static jboolean setPasskeyNative(JNIEnv *env, jobject object, jstring address,
                          int passkey, int nativeData) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
         DBusMessage *msg = (DBusMessage *)nativeData;
         DBusMessage *reply = dbus_message_new_method_return(msg);
         if (!reply) {
-            LOGE("%s: Cannot create message reply to return Passkey code to "
+            ALOGE("%s: Cannot create message reply to return Passkey code to "
                  "D-Bus\n", __FUNCTION__);
             dbus_message_unref(msg);
             return JNI_FALSE;
@@ -585,7 +585,7 @@
 static jboolean setRemoteOutOfBandDataNative(JNIEnv *env, jobject object, jstring address,
                          jbyteArray hash, jbyteArray randomizer, int nativeData) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
         DBusMessage *msg = (DBusMessage *)nativeData;
@@ -593,7 +593,7 @@
         jbyte *h_ptr = env->GetByteArrayElements(hash, NULL);
         jbyte *r_ptr = env->GetByteArrayElements(randomizer, NULL);
         if (!reply) {
-            LOGE("%s: Cannot create message reply to return remote OOB data to "
+            ALOGE("%s: Cannot create message reply to return remote OOB data to "
                  "D-Bus\n", __FUNCTION__);
             dbus_message_unref(msg);
             return JNI_FALSE;
@@ -619,7 +619,7 @@
 static jboolean setAuthorizationNative(JNIEnv *env, jobject object, jstring address,
                          jboolean val, int nativeData) {
 #ifdef HAVE_BLUETOOTH
-  LOGV("%s", __FUNCTION__);
+  ALOGV("%s", __FUNCTION__);
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
         DBusMessage *msg = (DBusMessage *)nativeData;
@@ -631,7 +631,7 @@
                     "org.bluez.Error.Rejected", "Authorization rejected");
         }
         if (!reply) {
-            LOGE("%s: Cannot create message reply D-Bus\n", __FUNCTION__);
+            ALOGE("%s: Cannot create message reply D-Bus\n", __FUNCTION__);
             dbus_message_unref(msg);
             return JNI_FALSE;
         }
@@ -648,13 +648,13 @@
 static jboolean setPinNative(JNIEnv *env, jobject object, jstring address,
                          jstring pin, int nativeData) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
         DBusMessage *msg = (DBusMessage *)nativeData;
         DBusMessage *reply = dbus_message_new_method_return(msg);
         if (!reply) {
-            LOGE("%s: Cannot create message reply to return PIN code to "
+            ALOGE("%s: Cannot create message reply to return PIN code to "
                  "D-Bus\n", __FUNCTION__);
             dbus_message_unref(msg);
             return JNI_FALSE;
@@ -678,14 +678,14 @@
 static jboolean cancelPairingUserInputNative(JNIEnv *env, jobject object,
                                             jstring address, int nativeData) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
         DBusMessage *msg = (DBusMessage *)nativeData;
         DBusMessage *reply = dbus_message_new_error(msg,
                 "org.bluez.Error.Canceled", "Pairing User Input was canceled");
         if (!reply) {
-            LOGE("%s: Cannot create message reply to return cancelUserInput to"
+            ALOGE("%s: Cannot create message reply to return cancelUserInput to"
                  "D-BUS\n", __FUNCTION__);
             dbus_message_unref(msg);
             return JNI_FALSE;
@@ -704,7 +704,7 @@
                                                     jstring path)
 {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
         DBusMessage *msg, *reply;
@@ -722,7 +722,7 @@
             if (dbus_error_is_set(&err)) {
                 LOG_AND_FREE_DBUS_ERROR(&err);
             } else
-                LOGE("DBus reply is NULL in function %s", __FUNCTION__);
+                ALOGE("DBus reply is NULL in function %s", __FUNCTION__);
             return NULL;
         }
         env->PushLocalFrame(PROPERTIES_NREFS);
@@ -741,7 +741,7 @@
 
 static jobjectArray getAdapterPropertiesNative(JNIEnv *env, jobject object) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
         DBusMessage *msg, *reply;
@@ -756,7 +756,7 @@
             if (dbus_error_is_set(&err)) {
                 LOG_AND_FREE_DBUS_ERROR(&err);
             } else
-                LOGE("DBus reply is NULL in function %s", __FUNCTION__);
+                ALOGE("DBus reply is NULL in function %s", __FUNCTION__);
             return NULL;
         }
         env->PushLocalFrame(PROPERTIES_NREFS);
@@ -776,7 +776,7 @@
 static jboolean setAdapterPropertyNative(JNIEnv *env, jobject object, jstring key,
                                          void *value, jint type) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
         DBusMessage *msg;
@@ -788,7 +788,7 @@
                                            get_adapter_path(env, object),
                                            DBUS_ADAPTER_IFACE, "SetProperty");
         if (!msg) {
-            LOGE("%s: Can't allocate new method call for GetProperties!",
+            ALOGE("%s: Can't allocate new method call for GetProperties!",
                   __FUNCTION__);
             env->ReleaseStringUTFChars(key, c_key);
             return JNI_FALSE;
@@ -843,7 +843,7 @@
 static jboolean setDevicePropertyNative(JNIEnv *env, jobject object, jstring path,
                                                jstring key, void *value, jint type) {
 #ifdef HAVE_BLUETOOTH
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
         DBusMessage *msg;
@@ -856,7 +856,7 @@
         msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC,
                                           c_path, DBUS_DEVICE_IFACE, "SetProperty");
         if (!msg) {
-            LOGE("%s: Can't allocate new method call for device SetProperty!", __FUNCTION__);
+            ALOGE("%s: Can't allocate new method call for device SetProperty!", __FUNCTION__);
             env->ReleaseStringUTFChars(key, c_key);
             env->ReleaseStringUTFChars(path, c_path);
             return JNI_FALSE;
@@ -904,7 +904,7 @@
 
 static jboolean createDeviceNative(JNIEnv *env, jobject object,
                                                 jstring address) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     jobject eventLoop = env->GetObjectField(object, field_mEventLoop);
@@ -913,7 +913,7 @@
 
     if (nat && eventLoopNat) {
         const char *c_address = env->GetStringUTFChars(address, NULL);
-        LOGV("... address = %s", c_address);
+        ALOGV("... address = %s", c_address);
         char *context_address = (char *)calloc(BTADDR_SIZE, sizeof(char));
         strlcpy(context_address, c_address, BTADDR_SIZE);  // for callback
 
@@ -935,7 +935,7 @@
 
 static jboolean discoverServicesNative(JNIEnv *env, jobject object,
                                                jstring path, jstring pattern) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     jobject eventLoop = env->GetObjectField(object, field_mEventLoop);
@@ -949,8 +949,8 @@
         char *context_path = (char *)calloc(len, sizeof(char));
         strlcpy(context_path, c_path, len);  // for callback
 
-        LOGV("... Object Path = %s", c_path);
-        LOGV("... Pattern = %s, strlen = %d", c_pattern, strlen(c_pattern));
+        ALOGV("... Object Path = %s", c_path);
+        ALOGV("... Pattern = %s, strlen = %d", c_pattern, strlen(c_pattern));
 
         bool ret = dbus_func_args_async(env, nat->conn, -1,
                                         onDiscoverServicesResult,
@@ -985,7 +985,7 @@
         if (handleArray) {
             env->SetIntArrayRegion(handleArray, 0, len, handles);
         } else {
-            LOGE("Null array in extract_handles");
+            ALOGE("Null array in extract_handles");
         }
     } else {
         LOG_AND_FREE_DBUS_ERROR(&err);
@@ -996,7 +996,7 @@
 
 static jintArray addReservedServiceRecordsNative(JNIEnv *env, jobject object,
                                                 jintArray uuids) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     DBusMessage *reply = NULL;
 
@@ -1020,7 +1020,7 @@
 
 static jboolean removeReservedServiceRecordsNative(JNIEnv *env, jobject object,
                                                    jintArray handles) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     jint *values = env->GetIntArrayElements(handles, NULL);
@@ -1043,15 +1043,15 @@
 
 static jint addRfcommServiceRecordNative(JNIEnv *env, jobject object,
         jstring name, jlong uuidMsb, jlong uuidLsb, jshort channel) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
         const char *c_name = env->GetStringUTFChars(name, NULL);
-        LOGV("... name = %s", c_name);
-        LOGV("... uuid1 = %llX", uuidMsb);
-        LOGV("... uuid2 = %llX", uuidLsb);
-        LOGV("... channel = %d", channel);
+        ALOGV("... name = %s", c_name);
+        ALOGV("... uuid1 = %llX", uuidMsb);
+        ALOGV("... uuid2 = %llX", uuidLsb);
+        ALOGV("... channel = %d", channel);
         DBusMessage *reply = dbus_func_args(env, nat->conn,
                            get_adapter_path(env, object),
                            DBUS_ADAPTER_IFACE, "AddRfcommServiceRecord",
@@ -1068,11 +1068,11 @@
 }
 
 static jboolean removeServiceRecordNative(JNIEnv *env, jobject object, jint handle) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
-        LOGV("... handle = %X", handle);
+        ALOGV("... handle = %X", handle);
         DBusMessage *reply = dbus_func_args(env, nat->conn,
                            get_adapter_path(env, object),
                            DBUS_ADAPTER_IFACE, "RemoveServiceRecord",
@@ -1086,7 +1086,7 @@
 
 static jboolean setLinkTimeoutNative(JNIEnv *env, jobject object, jstring object_path,
                                      jint num_slots) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
@@ -1105,7 +1105,7 @@
 }
 
 static jboolean connectInputDeviceNative(JNIEnv *env, jobject object, jstring path) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     jobject eventLoop = env->GetObjectField(object, field_mEventLoop);
@@ -1133,7 +1133,7 @@
 
 static jboolean disconnectInputDeviceNative(JNIEnv *env, jobject object,
                                      jstring path) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     jobject eventLoop = env->GetObjectField(object, field_mEventLoop);
@@ -1161,7 +1161,7 @@
 
 static jboolean setBluetoothTetheringNative(JNIEnv *env, jobject object, jboolean value,
                                             jstring src_role, jstring bridge) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
@@ -1169,7 +1169,7 @@
         const char *c_role = env->GetStringUTFChars(src_role, NULL);
         const char *c_bridge = env->GetStringUTFChars(bridge, NULL);
         if (value) {
-            LOGE("setBluetoothTetheringNative true");
+            ALOGE("setBluetoothTetheringNative true");
             reply = dbus_func_args(env, nat->conn,
                                   get_adapter_path(env, object),
                                   DBUS_NETWORKSERVER_IFACE,
@@ -1178,7 +1178,7 @@
                                   DBUS_TYPE_STRING, &c_bridge,
                                   DBUS_TYPE_INVALID);
         } else {
-            LOGE("setBluetoothTetheringNative false");
+            ALOGE("setBluetoothTetheringNative false");
             reply = dbus_func_args(env, nat->conn,
                                   get_adapter_path(env, object),
                                   DBUS_NETWORKSERVER_IFACE,
@@ -1196,9 +1196,9 @@
 
 static jboolean connectPanDeviceNative(JNIEnv *env, jobject object, jstring path,
                                        jstring dstRole) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
-    LOGE("connectPanDeviceNative");
+    ALOGE("connectPanDeviceNative");
     native_data_t *nat = get_native_data(env, object);
     jobject eventLoop = env->GetObjectField(object, field_mEventLoop);
     struct event_loop_native_data_t *eventLoopNat =
@@ -1228,9 +1228,9 @@
 
 static jboolean disconnectPanDeviceNative(JNIEnv *env, jobject object,
                                      jstring path) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
-    LOGE("disconnectPanDeviceNative");
+    ALOGE("disconnectPanDeviceNative");
     native_data_t *nat = get_native_data(env, object);
     jobject eventLoop = env->GetObjectField(object, field_mEventLoop);
     struct event_loop_native_data_t *eventLoopNat =
@@ -1258,9 +1258,9 @@
 static jboolean disconnectPanServerDeviceNative(JNIEnv *env, jobject object,
                                                 jstring path, jstring address,
                                                 jstring iface) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
-    LOGE("disconnectPanServerDeviceNative");
+    ALOGE("disconnectPanServerDeviceNative");
     native_data_t *nat = get_native_data(env, object);
     jobject eventLoop = env->GetObjectField(object, field_mEventLoop);
     struct event_loop_native_data_t *eventLoopNat =
@@ -1297,7 +1297,7 @@
 static jstring registerHealthApplicationNative(JNIEnv *env, jobject object,
                                            jint dataType, jstring role,
                                            jstring name, jstring channelType) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     jstring path = NULL;
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
@@ -1316,7 +1316,7 @@
                                             "CreateApplication");
 
         if (msg == NULL) {
-            LOGE("Could not allocate D-Bus message object!");
+            ALOGE("Could not allocate D-Bus message object!");
             return NULL;
         }
 
@@ -1360,7 +1360,7 @@
 static jstring registerSinkHealthApplicationNative(JNIEnv *env, jobject object,
                                            jint dataType, jstring role,
                                            jstring name) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     jstring path = NULL;
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
@@ -1379,7 +1379,7 @@
                                             "CreateApplication");
 
         if (msg == NULL) {
-            LOGE("Could not allocate D-Bus message object!");
+            ALOGE("Could not allocate D-Bus message object!");
             return NULL;
         }
 
@@ -1420,7 +1420,7 @@
 
 static jboolean unregisterHealthApplicationNative(JNIEnv *env, jobject object,
                                                     jstring path) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
     jboolean result = JNI_FALSE;
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
@@ -1452,7 +1452,7 @@
 static jboolean createChannelNative(JNIEnv *env, jobject object,
                                        jstring devicePath, jstring appPath, jstring config,
                                        jint code) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     jobject eventLoop = env->GetObjectField(object, field_mEventLoop);
@@ -1487,7 +1487,7 @@
 
 static jboolean destroyChannelNative(JNIEnv *env, jobject object, jstring devicePath,
                                      jstring channelPath, jint code) {
-    LOGE("%s", __FUNCTION__);
+    ALOGE("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     jobject eventLoop = env->GetObjectField(object, field_mEventLoop);
@@ -1517,7 +1517,7 @@
 }
 
 static jstring getMainChannelNative(JNIEnv *env, jobject object, jstring devicePath) {
-    LOGE("%s", __FUNCTION__);
+    ALOGE("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
@@ -1551,7 +1551,7 @@
 }
 
 static jstring getChannelApplicationNative(JNIEnv *env, jobject object, jstring channelPath) {
-    LOGE("%s", __FUNCTION__);
+    ALOGE("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
@@ -1599,7 +1599,7 @@
 }
 
 static jboolean releaseChannelFdNative(JNIEnv *env, jobject object, jstring channelPath) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
@@ -1620,7 +1620,7 @@
 }
 
 static jobject getChannelFdNative(JNIEnv *env, jobject object, jstring channelPath) {
-    LOGV("%s", __FUNCTION__);
+    ALOGV("%s", __FUNCTION__);
 #ifdef HAVE_BLUETOOTH
     native_data_t *nat = get_native_data(env, object);
     if (nat) {
diff --git a/core/jni/android_server_NetworkManagementSocketTagger.cpp b/core/jni/android_server_NetworkManagementSocketTagger.cpp
index c279ced..12beff7 100644
--- a/core/jni/android_server_NetworkManagementSocketTagger.cpp
+++ b/core/jni/android_server_NetworkManagementSocketTagger.cpp
@@ -36,7 +36,7 @@
   int userFd = jniGetFDFromFileDescriptor(env, fileDescriptor);
 
   if (env->ExceptionOccurred() != NULL) {
-    LOGE("Can't get FileDescriptor num");
+    ALOGE("Can't get FileDescriptor num");
     return (jint)-1;
   }
 
@@ -52,7 +52,7 @@
   int userFd = jniGetFDFromFileDescriptor(env, fileDescriptor);
 
   if (env->ExceptionOccurred() != NULL) {
-    LOGE("Can't get FileDescriptor num");
+    ALOGE("Can't get FileDescriptor num");
     return (jint)-1;
   }
 
diff --git a/core/jni/android_server_Watchdog.cpp b/core/jni/android_server_Watchdog.cpp
index 9e0ed47..6726c14 100644
--- a/core/jni/android_server_Watchdog.cpp
+++ b/core/jni/android_server_Watchdog.cpp
@@ -48,7 +48,7 @@
         write(outFd, "\n", 1);
         close(stackFd);
     } else {
-        LOGE("Unable to open stack of tid %d : %d (%s)", tid, errno, strerror(errno));
+        ALOGE("Unable to open stack of tid %d : %d (%s)", tid, errno, strerror(errno));
     }
 }
 
@@ -56,7 +56,7 @@
     char buf[128];
     DIR* taskdir;
 
-    LOGI("dumpKernelStacks");
+    ALOGI("dumpKernelStacks");
     if (!pathStr) {
         jniThrowException(env, "java/lang/IllegalArgumentException", "Null path");
         return;
@@ -67,7 +67,7 @@
     int outFd = open(path, O_WRONLY | O_APPEND | O_CREAT,
         S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
     if (outFd < 0) {
-        LOGE("Unable to open stack dump file: %d (%s)", errno, strerror(errno));
+        ALOGE("Unable to open stack dump file: %d (%s)", errno, strerror(errno));
         goto done;
     }
 
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index 4f8f1af..6ecee35 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -121,7 +121,7 @@
         return 0;
     }
 
-    LOGV("openAsset in %p (Java object %p)\n", am, clazz);
+    ALOGV("openAsset in %p (Java object %p)\n", am, clazz);
 
     ScopedUtfChars fileName8(env, fileName);
     if (fileName8.c_str() == NULL) {
@@ -186,7 +186,7 @@
         return NULL;
     }
 
-    LOGV("openAssetFd in %p (Java object %p)\n", am, clazz);
+    ALOGV("openAssetFd in %p (Java object %p)\n", am, clazz);
 
     ScopedUtfChars fileName8(env, fileName);
     if (fileName8.c_str() == NULL) {
@@ -215,7 +215,7 @@
         return 0;
     }
 
-    LOGV("openNonAssetNative in %p (Java object %p)\n", am, clazz);
+    ALOGV("openNonAssetNative in %p (Java object %p)\n", am, clazz);
 
     ScopedUtfChars fileName8(env, fileName);
     if (fileName8.c_str() == NULL) {
@@ -252,7 +252,7 @@
         return NULL;
     }
 
-    LOGV("openNonAssetFd in %p (Java object %p)\n", am, clazz);
+    ALOGV("openNonAssetFd in %p (Java object %p)\n", am, clazz);
 
     ScopedUtfChars fileName8(env, fileName);
     if (fileName8.c_str() == NULL) {
@@ -1365,7 +1365,7 @@
         return 0;
     }
 
-    LOGV("openXmlAsset in %p (Java object %p)\n", am, clazz);
+    ALOGV("openXmlAsset in %p (Java object %p)\n", am, clazz);
 
     ScopedUtfChars fileName8(env, fileName);
     if (fileName8.c_str() == NULL) {
@@ -1571,7 +1571,7 @@
 
     am->addDefaultAssets();
 
-    LOGV("Created AssetManager %p for Java object %p\n", am, clazz);
+    ALOGV("Created AssetManager %p for Java object %p\n", am, clazz);
     env->SetIntField(clazz, gAssetManagerOffsets.mObject, (jint)am);
 }
 
@@ -1579,7 +1579,7 @@
 {
     AssetManager* am = (AssetManager*)
         (env->GetIntField(clazz, gAssetManagerOffsets.mObject));
-    LOGV("Destroying AssetManager %p for Java object %p\n", am, clazz);
+    ALOGV("Destroying AssetManager %p for Java object %p\n", am, clazz);
     if (am != NULL) {
         delete am;
         env->SetIntField(clazz, gAssetManagerOffsets.mObject, 0);
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index 2bd4fa0..990a617 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -45,14 +45,14 @@
 
 #include <android_runtime/AndroidRuntime.h>
 
-//#undef LOGV
-//#define LOGV(...) fprintf(stderr, __VA_ARGS__)
+//#undef ALOGV
+//#define ALOGV(...) fprintf(stderr, __VA_ARGS__)
 
 #define DEBUG_DEATH 0
 #if DEBUG_DEATH
-#define LOGDEATH LOGD
+#define LOGDEATH ALOGD
 #else
-#define LOGDEATH LOGV
+#define LOGDEATH ALOGV
 #endif
 
 using namespace android;
@@ -169,7 +169,7 @@
         env->CallStaticVoidMethod(gBinderInternalOffsets.mClass,
                 gBinderInternalOffsets.mForceGc);
     } else {
-        LOGV("Now have %d binder ops", old);
+        ALOGV("Now have %d binder ops", old);
     }
 }
 
@@ -194,8 +194,8 @@
 
     if ((tagstr == NULL) || (msgstr == NULL)) {
         env->ExceptionClear();      /* assume exception (OOM?) was thrown */
-        LOGE("Unable to call Log.e()\n");
-        LOGE("%s", msg);
+        ALOGE("Unable to call Log.e()\n");
+        ALOGE("%s", msg);
         goto bail;
     }
 
@@ -203,7 +203,7 @@
         gLogOffsets.mClass, gLogOffsets.mLogE, tagstr, msgstr, excep);
     if (env->ExceptionCheck()) {
         /* attempting to log the failure has failed */
-        LOGW("Failed trying to log exception, msg='%s'\n", msg);
+        ALOGW("Failed trying to log exception, msg='%s'\n", msg);
         env->ExceptionClear();
     }
 
@@ -221,7 +221,7 @@
         env->Throw(excep);
         vm->DetachCurrentThread();
         sleep(60);
-        LOGE("Forcefully exiting");
+        ALOGE("Forcefully exiting");
         exit(1);
         *((int *) 1) = 1;
     }
@@ -249,7 +249,7 @@
     JavaBBinder(JNIEnv* env, jobject object)
         : mVM(jnienv_to_javavm(env)), mObject(env->NewGlobalRef(object))
     {
-        LOGV("Creating JavaBBinder %p\n", this);
+        ALOGV("Creating JavaBBinder %p\n", this);
         android_atomic_inc(&gNumLocalRefs);
         incRefsCreated(env);
     }
@@ -267,7 +267,7 @@
 protected:
     virtual ~JavaBBinder()
     {
-        LOGV("Destroying JavaBBinder %p\n", this);
+        ALOGV("Destroying JavaBBinder %p\n", this);
         android_atomic_dec(&gNumLocalRefs);
         JNIEnv* env = javavm_to_jnienv(mVM);
         env->DeleteGlobalRef(mObject);
@@ -278,7 +278,7 @@
     {
         JNIEnv* env = javavm_to_jnienv(mVM);
 
-        LOGV("onTransact() on %p calling object %p in env %p vm %p\n", this, mObject, env, mVM);
+        ALOGV("onTransact() on %p calling object %p in env %p vm %p\n", this, mObject, env, mVM);
 
         IPCThreadState* thread_state = IPCThreadState::self();
         const int strict_policy_before = thread_state->getStrictModePolicy();
@@ -349,7 +349,7 @@
         if (b == NULL) {
             b = new JavaBBinder(env, obj);
             mBinder = b;
-            LOGV("Creating JavaBinder %p (refs %p) for Object %p, weakCount=%d\n",
+            ALOGV("Creating JavaBinder %p (refs %p) for Object %p, weakCount=%d\n",
                  b.get(), b->getWeakRefs(), obj, b->getWeakRefs()->getWeakCount());
         }
 
@@ -463,11 +463,11 @@
                     (jstring) env->CallObjectMethod(objClassRef.get(), gClassOffsets.mGetName));
             ScopedUtfChars nameUtf(env, nameRef.get());
             if (nameUtf.c_str() != NULL) {
-                LOGW("BinderProxy is being destroyed but the application did not call "
+                ALOGW("BinderProxy is being destroyed but the application did not call "
                         "unlinkToDeath to unlink all of its death recipients beforehand.  "
                         "Releasing leaked death recipient: %s", nameUtf.c_str());
             } else {
-                LOGW("BinderProxy being destroyed; unable to get DR object name");
+                ALOGW("BinderProxy being destroyed; unable to get DR object name");
                 env->ExceptionClear();
             }
         }
@@ -476,7 +476,7 @@
 protected:
     virtual ~JavaDeathRecipient()
     {
-        //LOGI("Removing death ref: recipient=%p\n", mObject);
+        //ALOGI("Removing death ref: recipient=%p\n", mObject);
         android_atomic_dec(&gNumDeathRefs);
         JNIEnv* env = javavm_to_jnienv(mVM);
         if (mObject != NULL) {
@@ -579,7 +579,7 @@
     if (object != NULL) {
         jobject res = env->CallObjectMethod(object, gWeakReferenceOffsets.mGet);
         if (res != NULL) {
-            LOGV("objectForBinder %p: found existing %p!\n", val.get(), res);
+            ALOGV("objectForBinder %p: found existing %p!\n", val.get(), res);
             return res;
         }
         LOGDEATH("Proxy object %p of IBinder %p no longer in working set!!!", object, val.get());
@@ -630,7 +630,7 @@
             env->GetIntField(obj, gBinderProxyOffsets.mObject);
     }
 
-    LOGW("ibinderForJavaObject: %p is not a Binder object", obj);
+    ALOGW("ibinderForJavaObject: %p is not a Binder object", obj);
     return NULL;
 }
 
@@ -699,7 +699,7 @@
             jniThrowException(env, "java/lang/RuntimeException", "Unknown transaction code");
             break;
         case FAILED_TRANSACTION:
-            LOGE("!!! FAILED BINDER TRANSACTION !!!");
+            ALOGE("!!! FAILED BINDER TRANSACTION !!!");
             // TransactionTooLargeException is a checked exception, only throw from certain methods.
             // FIXME: Transaction too large is the most common reason for FAILED_TRANSACTION
             //        but it is not the only one.  The Binder driver can return BR_FAILED_REPLY
@@ -715,7 +715,7 @@
                     "Not allowed to write file descriptors here");
             break;
         default:
-            LOGE("Unknown binder error code. 0x%x", err);
+            ALOGE("Unknown binder error code. 0x%x", err);
             String8 msg;
             msg.appendFormat("Unknown binder error code. 0x%x", err);
             // RemoteException is a checked exception, only throw from certain methods.
@@ -780,7 +780,7 @@
         jniThrowException(env, "java/lang/OutOfMemoryError", NULL);
         return;
     }
-    LOGV("Java Binder %p: acquiring first ref on holder %p", obj, jbh);
+    ALOGV("Java Binder %p: acquiring first ref on holder %p", obj, jbh);
     jbh->incStrong((void*)android_os_Binder_init);
     env->SetIntField(obj, gBinderOffsets.mObject, (int)jbh);
 }
@@ -791,7 +791,7 @@
         env->GetIntField(obj, gBinderOffsets.mObject);
     if (jbh != NULL) {
         env->SetIntField(obj, gBinderOffsets.mObject, 0);
-        LOGV("Java Binder %p: removing ref on holder %p", obj, jbh);
+        ALOGV("Java Binder %p: removing ref on holder %p", obj, jbh);
         jbh->decStrong((void*)android_os_Binder_init);
     } else {
         // Encountering an uninitialized binder is harmless.  All it means is that
@@ -800,7 +800,7 @@
         // For example, a Binder subclass constructor might have thrown an exception before
         // it could delegate to its superclass's constructor.  Consequently init() would
         // not have been called and the holder pointer would remain NULL.
-        LOGV("Java Binder %p: ignoring uninitialized binder", obj);
+        ALOGV("Java Binder %p: ignoring uninitialized binder", obj);
     }
 }
 
@@ -889,7 +889,7 @@
 
 static void android_os_BinderInternal_handleGc(JNIEnv* env, jobject clazz)
 {
-    LOGV("Gc has executed, clearing binder ops");
+    ALOGV("Gc has executed, clearing binder ops");
     android_atomic_and(0, &gNumRefsCreated);
 }
 
@@ -976,7 +976,7 @@
     jint len = strlen(str);
     int space_needed = 1 + sizeof(len) + len;
     if (end - *pos < space_needed) {
-        LOGW("not enough space for string. remain=%d; needed=%d",
+        ALOGW("not enough space for string. remain=%d; needed=%d",
              (end - *pos), space_needed);
         return false;
     }
@@ -992,7 +992,7 @@
 static bool push_eventlog_int(char** pos, const char* end, jint val) {
     int space_needed = 1 + sizeof(val);
     if (end - *pos < space_needed) {
-        LOGW("not enough space for int.  remain=%d; needed=%d",
+        ALOGW("not enough space for int.  remain=%d; needed=%d",
              (end - *pos), space_needed);
         return false;
     }
@@ -1078,7 +1078,7 @@
         return JNI_FALSE;
     }
 
-    LOGV("Java code calling transact on %p in Java object %p with code %d\n",
+    ALOGV("Java code calling transact on %p in Java object %p with code %d\n",
             target, obj, code);
 
     // Only log the binder call duration for things on the Java-level main thread.
@@ -1117,7 +1117,7 @@
     IBinder* target = (IBinder*)
         env->GetIntField(obj, gBinderProxyOffsets.mObject);
     if (target == NULL) {
-        LOGW("Binder has been finalized when calling linkToDeath() with recip=%p)\n", recipient);
+        ALOGW("Binder has been finalized when calling linkToDeath() with recip=%p)\n", recipient);
         assert(false);
     }
 
@@ -1149,7 +1149,7 @@
     IBinder* target = (IBinder*)
         env->GetIntField(obj, gBinderProxyOffsets.mObject);
     if (target == NULL) {
-        LOGW("Binder has been finalized when calling linkToDeath() with recip=%p)\n", recipient);
+        ALOGW("Binder has been finalized when calling linkToDeath() with recip=%p)\n", recipient);
         return JNI_FALSE;
     }
 
@@ -1635,7 +1635,7 @@
     int fd = jniGetFDFromFileDescriptor(env, object);
     if (fd >= 0) {
         jniSetFileDescriptorOfFD(env, object, -1);
-        //LOGI("Closing ParcelFileDescriptor %d\n", fd);
+        //ALOGI("Closing ParcelFileDescriptor %d\n", fd);
         close(fd);
     }
 }
@@ -1658,7 +1658,7 @@
     if (own) {
         Parcel* parcel = parcelForJavaObject(env, clazz);
         if (parcel != NULL) {
-            //LOGI("Parcel.freeBuffer() called for C++ Parcel %p\n", parcel);
+            //ALOGI("Parcel.freeBuffer() called for C++ Parcel %p\n", parcel);
             parcel->freeData();
         }
     }
@@ -1669,17 +1669,17 @@
     Parcel* parcel = (Parcel*)parcelInt;
     int own = 0;
     if (!parcel) {
-        //LOGI("Initializing obj %p: creating new Parcel\n", clazz);
+        //ALOGI("Initializing obj %p: creating new Parcel\n", clazz);
         own = 1;
         parcel = new Parcel;
     } else {
-        //LOGI("Initializing obj %p: given existing Parcel %p\n", clazz, parcel);
+        //ALOGI("Initializing obj %p: given existing Parcel %p\n", clazz, parcel);
     }
     if (parcel == NULL) {
         jniThrowException(env, "java/lang/OutOfMemoryError", NULL);
         return;
     }
-    //LOGI("Initializing obj %p from C++ Parcel %p, own=%d\n", clazz, parcel, own);
+    //ALOGI("Initializing obj %p from C++ Parcel %p, own=%d\n", clazz, parcel, own);
     env->SetIntField(clazz, gParcelOffsets.mOwnObject, own);
     env->SetIntField(clazz, gParcelOffsets.mObject, (int)parcel);
 }
@@ -1690,11 +1690,11 @@
     if (own) {
         Parcel* parcel = parcelForJavaObject(env, clazz);
         env->SetIntField(clazz, gParcelOffsets.mObject, 0);
-        //LOGI("Destroying obj %p: deleting C++ Parcel %p\n", clazz, parcel);
+        //ALOGI("Destroying obj %p: deleting C++ Parcel %p\n", clazz, parcel);
         delete parcel;
     } else {
         env->SetIntField(clazz, gParcelOffsets.mObject, 0);
-        //LOGI("Destroying obj %p: leaving C++ Parcel %p\n", clazz);
+        //ALOGI("Destroying obj %p: leaving C++ Parcel %p\n", clazz);
     }
 }
 
diff --git a/core/jni/android_util_EventLog.cpp b/core/jni/android_util_EventLog.cpp
index 5d51110..a3981ce 100644
--- a/core/jni/android_util_EventLog.cpp
+++ b/core/jni/android_util_EventLog.cpp
@@ -267,7 +267,7 @@
     for (int i = 0; i < NELEM(gClasses); ++i) {
         jclass clazz = env->FindClass(gClasses[i].name);
         if (clazz == NULL) {
-            LOGE("Can't find class: %s\n", gClasses[i].name);
+            ALOGE("Can't find class: %s\n", gClasses[i].name);
             return -1;
         }
         *gClasses[i].clazz = (jclass) env->NewGlobalRef(clazz);
@@ -277,7 +277,7 @@
         *gFields[i].id = env->GetFieldID(
                 *gFields[i].c, gFields[i].name, gFields[i].ft);
         if (*gFields[i].id == NULL) {
-            LOGE("Can't find field: %s\n", gFields[i].name);
+            ALOGE("Can't find field: %s\n", gFields[i].name);
             return -1;
         }
     }
@@ -286,7 +286,7 @@
         *gMethods[i].id = env->GetMethodID(
                 *gMethods[i].c, gMethods[i].name, gMethods[i].mt);
         if (*gMethods[i].id == NULL) {
-            LOGE("Can't find method: %s\n", gMethods[i].name);
+            ALOGE("Can't find method: %s\n", gMethods[i].name);
             return -1;
         }
     }
diff --git a/core/jni/android_util_FileObserver.cpp b/core/jni/android_util_FileObserver.cpp
index 65e7130..0327d8c 100644
--- a/core/jni/android_util_FileObserver.cpp
+++ b/core/jni/android_util_FileObserver.cpp
@@ -67,7 +67,7 @@
             if (errno == EINTR)
                 continue;
 
-            LOGE("***** ERROR! android_os_fileobserver_observe() got a short event!");
+            ALOGE("***** ERROR! android_os_fileobserver_observe() got a short event!");
             return;
         }
         
@@ -148,14 +148,14 @@
 
     if (clazz == NULL)
 	{
-        LOGE("Can't find android/os/FileObserver$ObserverThread");
+        ALOGE("Can't find android/os/FileObserver$ObserverThread");
         return -1;
     }
 
     method_onEvent = env->GetMethodID(clazz, "onEvent", "(IILjava/lang/String;)V");
     if (method_onEvent == NULL)
     {
-        LOGE("Can't find FileObserver.onEvent(int, int, String)");
+        ALOGE("Can't find FileObserver.onEvent(int, int, String)");
         return -1;
     }
 
diff --git a/core/jni/android_util_Log.cpp b/core/jni/android_util_Log.cpp
index 2c7bb84..a57aad7 100644
--- a/core/jni/android_util_Log.cpp
+++ b/core/jni/android_util_Log.cpp
@@ -139,7 +139,7 @@
     jclass clazz = env->FindClass("android/util/Log");
 
     if (clazz == NULL) {
-        LOGE("Can't find android/util/Log");
+        ALOGE("Can't find android/util/Log");
         return -1;
     }
 
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index 47d343a..2c494ac 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -205,9 +205,9 @@
     }
 
     if (grp == ANDROID_TGROUP_BG_NONINTERACT) {
-        LOGD("setProcessGroup: vvv pid %d (%s)", pid, cmdline);
+        ALOGD("setProcessGroup: vvv pid %d (%s)", pid, cmdline);
     } else {
-        LOGD("setProcessGroup: ^^^ pid %d (%s)", pid, cmdline);
+        ALOGD("setProcessGroup: ^^^ pid %d (%s)", pid, cmdline);
     }
 #endif
     sprintf(proc_path, "/proc/%d/task", pid);
@@ -227,7 +227,7 @@
         t_pid = atoi(de->d_name);
 
         if (!t_pid) {
-            LOGE("Error getting pid for '%s'\n", de->d_name);
+            ALOGE("Error getting pid for '%s'\n", de->d_name);
             continue;
         }
 
@@ -251,7 +251,7 @@
     // Establishes the calling thread as illegal to put into the background.
     // Typically used only for the system process's main looper.
 #if GUARD_THREAD_PRIORITY
-    LOGV("Process.setCanSelfBackground(%d) : tid=%d", bgOk, androidGetTid());
+    ALOGV("Process.setCanSelfBackground(%d) : tid=%d", bgOk, androidGetTid());
     {
         Mutex::Autolock _l(gKeyCreateMutex);
         if (gBgKey == -1) {
@@ -274,7 +274,7 @@
         if (pid == androidGetTid()) {
             void* bgOk = pthread_getspecific(gBgKey);
             if (bgOk == ((void*)0xbaad)) {
-                LOGE("Thread marked fg-only put self in background!");
+                ALOGE("Thread marked fg-only put self in background!");
                 jniThrowException(env, "java/lang/SecurityException", "May not put this thread into background");
                 return;
             }
@@ -291,7 +291,7 @@
         }
     }
 
-    //LOGI("Setting priority of %d: %d, getpriority returns %d\n",
+    //ALOGI("Setting priority of %d: %d, getpriority returns %d\n",
     //     pid, pri, getpriority(PRIO_PROCESS, pid));
 }
 
@@ -310,7 +310,7 @@
     if (errno != 0) {
         signalExceptionForPriorityError(env, clazz, errno);
     }
-    //LOGI("Returning priority of %d: %d\n", pid, pri);
+    //ALOGI("Returning priority of %d: %d\n", pid, pri);
     return pri;
 }
 
@@ -362,7 +362,7 @@
 
 static int pid_compare(const void* v1, const void* v2)
 {
-    //LOGI("Compare %d vs %d\n", *((const jint*)v1), *((const jint*)v2));
+    //ALOGI("Compare %d vs %d\n", *((const jint*)v1), *((const jint*)v2));
     return *((const jint*)v1) - *((const jint*)v2);
 }
 
@@ -371,7 +371,7 @@
     int fd = open("/proc/meminfo", O_RDONLY);
 
     if (fd < 0) {
-        LOGW("Unable to open /proc/meminfo");
+        ALOGW("Unable to open /proc/meminfo");
         return -1;
     }
 
@@ -380,7 +380,7 @@
     close(fd);
 
     if (len < 0) {
-        LOGW("Unable to read /proc/meminfo");
+        ALOGW("Unable to read /proc/meminfo");
         return -1;
     }
     buffer[len] = 0;
@@ -420,7 +420,7 @@
 void android_os_Process_readProcLines(JNIEnv* env, jobject clazz, jstring fileStr,
                                       jobjectArray reqFields, jlongArray outFields)
 {
-    //LOGI("getMemInfo: %p %p", reqFields, outFields);
+    //ALOGI("getMemInfo: %p %p", reqFields, outFields);
 
     if (fileStr == NULL || reqFields == NULL || outFields == NULL) {
         jniThrowNullPointerException(env, NULL);
@@ -447,7 +447,7 @@
         jobject obj = env->GetObjectArrayElement(reqFields, i);
         if (obj != NULL) {
             const char* str8 = env->GetStringUTFChars((jstring)obj, NULL);
-            //LOGI("String at %d: %p = %s", i, obj, str8);
+            //ALOGI("String at %d: %p = %s", i, obj, str8);
             if (str8 == NULL) {
                 jniThrowNullPointerException(env, "Element in reqFields");
                 return;
@@ -465,7 +465,7 @@
         return;
     }
 
-    //LOGI("Clearing %d sizes", count);
+    //ALOGI("Clearing %d sizes", count);
     for (i=0; i<count; i++) {
         sizesArray[i] = 0;
     }
@@ -479,7 +479,7 @@
         close(fd);
 
         if (len < 0) {
-            LOGW("Unable to read %s", file.string());
+            ALOGW("Unable to read %s", file.string());
             len = 0;
         }
         buffer[len] = 0;
@@ -489,7 +489,7 @@
         char* p = buffer;
         while (*p && foundCount < count) {
             bool skipToEol = true;
-            //LOGI("Parsing at: %s", p);
+            //ALOGI("Parsing at: %s", p);
             for (i=0; i<count; i++) {
                 const String8& field = fields[i];
                 if (strncmp(p, field.string(), field.length()) == 0) {
@@ -504,7 +504,7 @@
                     }
                     char* end;
                     sizesArray[i] = strtoll(num, &end, 10);
-                    //LOGI("Field %s = %d", field.string(), sizesArray[i]);
+                    //ALOGI("Field %s = %d", field.string(), sizesArray[i]);
                     foundCount++;
                     break;
                 }
@@ -521,10 +521,10 @@
 
         free(buffer);
     } else {
-        LOGW("Unable to open %s", file.string());
+        ALOGW("Unable to open %s", file.string());
     }
 
-    //LOGI("Done!");
+    //ALOGI("Done!");
     env->ReleaseLongArrayElements(outFields, sizesArray, 0);
 }
 
@@ -570,7 +570,7 @@
 
         char* end;
         int pid = strtol(entry->d_name, &end, 10);
-        //LOGI("File %s pid=%d\n", entry->d_name, pid);
+        //ALOGI("File %s pid=%d\n", entry->d_name, pid);
         if (curPos >= curCount) {
             jsize newCount = (curCount == 0) ? 10 : (curCount*2);
             jintArray newArray = env->NewIntArray(newCount);
@@ -693,7 +693,7 @@
             }
         }
 
-        //LOGI("Field %d: %d-%d dest=%d mode=0x%x\n", i, start, end, di, mode);
+        //ALOGI("Field %d: %d-%d dest=%d mode=0x%x\n", i, start, end, di, mode);
 
         if ((mode&(PROC_OUT_FLOAT|PROC_OUT_LONG|PROC_OUT_STRING)) != 0) {
             char c = buffer[end];
@@ -759,7 +759,7 @@
     env->ReleaseStringUTFChars(file, file8);
 
     if (fd < 0) {
-        //LOGW("Unable to open process file: %s\n", file8);
+        //ALOGW("Unable to open process file: %s\n", file8);
         return JNI_FALSE;
     }
 
@@ -768,7 +768,7 @@
     close(fd);
 
     if (len < 0) {
-        //LOGW("Unable to open process file: %s fd=%d\n", file8, fd);
+        //ALOGW("Unable to open process file: %s fd=%d\n", file8, fd);
         return JNI_FALSE;
     }
     buffer[len] = 0;
@@ -792,7 +792,7 @@
 void android_os_Process_sendSignal(JNIEnv* env, jobject clazz, jint pid, jint sig)
 {
     if (pid > 0) {
-        LOGI("Sending signal. PID: %d SIG: %d", pid, sig);
+        ALOGI("Sending signal. PID: %d SIG: %d", pid, sig);
         kill(pid, sig);
     }
 }
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 426f4f7..03d94c9 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -66,7 +66,7 @@
 
 // Debug
 #if DEBUG_RENDERER
-    #define RENDERER_LOGD(...) LOGD(__VA_ARGS__)
+    #define RENDERER_LOGD(...) ALOGD(__VA_ARGS__)
 #else
     #define RENDERER_LOGD(...)
 #endif
@@ -492,7 +492,7 @@
 #if USE_TEXT_LAYOUT_CACHE
     value = TextLayoutCache::getInstance().getValue(paint, text, 0, count, count, flags);
     if (value == NULL) {
-        LOGE("Cannot get TextLayoutCache value");
+        ALOGE("Cannot get TextLayoutCache value");
         return ;
     }
 #else
@@ -522,7 +522,7 @@
 #if USE_TEXT_LAYOUT_CACHE
     value = TextLayoutCache::getInstance().getValue(paint, text, start, count, contextCount, flags);
     if (value == NULL) {
-        LOGE("Cannot get TextLayoutCache value");
+        ALOGE("Cannot get TextLayoutCache value");
         return ;
     }
 #else
@@ -541,7 +541,7 @@
         if (TextLayout::prepareRtlTextRun(text, start, count, contextCount, shaped)) {
             renderer->drawText((const char*) shaped, count << 1, count, x, y, paint);
         } else {
-            LOGW("drawTextRun error");
+            ALOGW("drawTextRun error");
         }
     } else {
         renderer->drawText((const char*) (text + start), count << 1, count, x, y, paint);
diff --git a/core/jni/android_view_InputChannel.cpp b/core/jni/android_view_InputChannel.cpp
index 5fcf8fa..fce432b 100644
--- a/core/jni/android_view_InputChannel.cpp
+++ b/core/jni/android_view_InputChannel.cpp
@@ -101,7 +101,7 @@
     NativeInputChannel* nativeInputChannel =
             android_view_InputChannel_getNativeInputChannel(env, inputChannelObj);
     if (nativeInputChannel == NULL) {
-        LOGW("Cannot set dispose callback because input channel object has not been initialized.");
+        ALOGW("Cannot set dispose callback because input channel object has not been initialized.");
     } else {
         nativeInputChannel->setDisposeCallback(callback, data);
     }
@@ -161,7 +161,7 @@
             android_view_InputChannel_getNativeInputChannel(env, obj);
     if (nativeInputChannel) {
         if (finalized) {
-            LOGW("Input channel object '%s' was finalized without being disposed!",
+            ALOGW("Input channel object '%s' was finalized without being disposed!",
                     nativeInputChannel->getInputChannel()->getName().string());
         }
 
@@ -202,17 +202,17 @@
             int32_t parcelAshmemFd = parcel->readFileDescriptor();
             int32_t ashmemFd = dup(parcelAshmemFd);
             if (ashmemFd < 0) {
-                LOGE("Error %d dup ashmem fd %d.", errno, parcelAshmemFd);
+                ALOGE("Error %d dup ashmem fd %d.", errno, parcelAshmemFd);
             }
             int32_t parcelReceivePipeFd = parcel->readFileDescriptor();
             int32_t receivePipeFd = dup(parcelReceivePipeFd);
             if (receivePipeFd < 0) {
-                LOGE("Error %d dup receive pipe fd %d.", errno, parcelReceivePipeFd);
+                ALOGE("Error %d dup receive pipe fd %d.", errno, parcelReceivePipeFd);
             }
             int32_t parcelSendPipeFd = parcel->readFileDescriptor();
             int32_t sendPipeFd = dup(parcelSendPipeFd);
             if (sendPipeFd < 0) {
-                LOGE("Error %d dup send pipe fd %d.", errno, parcelSendPipeFd);
+                ALOGE("Error %d dup send pipe fd %d.", errno, parcelSendPipeFd);
             }
             if (ashmemFd < 0 || receivePipeFd < 0 || sendPipeFd < 0) {
                 if (ashmemFd >= 0) ::close(ashmemFd);
diff --git a/core/jni/android_view_InputQueue.cpp b/core/jni/android_view_InputQueue.cpp
index 300c04a..8541933 100644
--- a/core/jni/android_view_InputQueue.cpp
+++ b/core/jni/android_view_InputQueue.cpp
@@ -133,12 +133,12 @@
     sp<InputChannel> inputChannel = android_view_InputChannel_getInputChannel(env,
             inputChannelObj);
     if (inputChannel == NULL) {
-        LOGW("Input channel is not initialized.");
+        ALOGW("Input channel is not initialized.");
         return BAD_VALUE;
     }
 
 #if DEBUG_REGISTRATION
-    LOGD("channel '%s' - Registered", inputChannel->getName().string());
+    ALOGD("channel '%s' - Registered", inputChannel->getName().string());
 #endif
 
     sp<Looper> looper = android_os_MessageQueue_getLooper(env, messageQueueObj);
@@ -147,7 +147,7 @@
         AutoMutex _l(mLock);
 
         if (getConnectionIndex(inputChannel) >= 0) {
-            LOGW("Attempted to register already registered input channel '%s'",
+            ALOGW("Attempted to register already registered input channel '%s'",
                     inputChannel->getName().string());
             return BAD_VALUE;
         }
@@ -156,7 +156,7 @@
         sp<Connection> connection = new Connection(connectionId, inputChannel, looper);
         status_t result = connection->inputConsumer.initialize();
         if (result) {
-            LOGW("Failed to initialize input consumer for input channel '%s', status=%d",
+            ALOGW("Failed to initialize input consumer for input channel '%s', status=%d",
                     inputChannel->getName().string(), result);
             return result;
         }
@@ -178,12 +178,12 @@
     sp<InputChannel> inputChannel = android_view_InputChannel_getInputChannel(env,
             inputChannelObj);
     if (inputChannel == NULL) {
-        LOGW("Input channel is not initialized.");
+        ALOGW("Input channel is not initialized.");
         return BAD_VALUE;
     }
 
 #if DEBUG_REGISTRATION
-    LOGD("channel '%s' - Unregistered", inputChannel->getName().string());
+    ALOGD("channel '%s' - Unregistered", inputChannel->getName().string());
 #endif
 
     { // acquire lock
@@ -191,7 +191,7 @@
 
         ssize_t connectionIndex = getConnectionIndex(inputChannel);
         if (connectionIndex < 0) {
-            LOGW("Attempted to unregister already unregistered input channel '%s'",
+            ALOGW("Attempted to unregister already unregistered input channel '%s'",
                     inputChannel->getName().string());
             return BAD_VALUE;
         }
@@ -207,7 +207,7 @@
         connection->inputHandlerObjGlobal = NULL;
 
         if (connection->messageInProgress) {
-            LOGI("Sending finished signal for input channel '%s' since it is being unregistered "
+            ALOGI("Sending finished signal for input channel '%s' since it is being unregistered "
                     "while an input message is still in progress.",
                     connection->getInputChannelName());
             connection->messageInProgress = false;
@@ -244,7 +244,7 @@
         ssize_t connectionIndex = mConnectionsByReceiveFd.indexOfKey(receiveFd);
         if (connectionIndex < 0) {
             if (! ignoreSpuriousFinish) {
-                LOGI("Ignoring finish signal on channel that is no longer registered.");
+                ALOGI("Ignoring finish signal on channel that is no longer registered.");
             }
             return DEAD_OBJECT;
         }
@@ -252,14 +252,14 @@
         sp<Connection> connection = mConnectionsByReceiveFd.valueAt(connectionIndex);
         if (connectionId != connection->id) {
             if (! ignoreSpuriousFinish) {
-                LOGI("Ignoring finish signal on channel that is no longer registered.");
+                ALOGI("Ignoring finish signal on channel that is no longer registered.");
             }
             return DEAD_OBJECT;
         }
 
         if (messageSeqNum != connection->messageSeqNum || ! connection->messageInProgress) {
             if (! ignoreSpuriousFinish) {
-                LOGW("Attempted to finish input twice on channel '%s'.  "
+                ALOGW("Attempted to finish input twice on channel '%s'.  "
                         "finished messageSeqNum=%d, current messageSeqNum=%d, messageInProgress=%d",
                         connection->getInputChannelName(),
                         messageSeqNum, connection->messageSeqNum, connection->messageInProgress);
@@ -271,13 +271,13 @@
 
         status_t status = connection->inputConsumer.sendFinishedSignal(handled);
         if (status) {
-            LOGW("Failed to send finished signal on channel '%s'.  status=%d",
+            ALOGW("Failed to send finished signal on channel '%s'.  status=%d",
                     connection->getInputChannelName(), status);
             return status;
         }
 
 #if DEBUG_DISPATCH_CYCLE
-        LOGD("channel '%s' ~ Finished event.",
+        ALOGD("channel '%s' ~ Finished event.",
                 connection->getInputChannelName());
 #endif
     } // release lock
@@ -287,7 +287,7 @@
 
 void NativeInputQueue::handleInputChannelDisposed(JNIEnv* env,
         jobject inputChannelObj, const sp<InputChannel>& inputChannel, void* data) {
-    LOGW("Input channel object '%s' was disposed without first being unregistered with "
+    ALOGW("Input channel object '%s' was disposed without first being unregistered with "
             "the input queue!", inputChannel->getName().string());
 
     NativeInputQueue* q = static_cast<NativeInputQueue*>(data);
@@ -307,40 +307,40 @@
 
         ssize_t connectionIndex = q->mConnectionsByReceiveFd.indexOfKey(receiveFd);
         if (connectionIndex < 0) {
-            LOGE("Received spurious receive callback for unknown input channel.  "
+            ALOGE("Received spurious receive callback for unknown input channel.  "
                     "fd=%d, events=0x%x", receiveFd, events);
             return 0; // remove the callback
         }
 
         connection = q->mConnectionsByReceiveFd.valueAt(connectionIndex);
         if (events & (ALOOPER_EVENT_ERROR | ALOOPER_EVENT_HANGUP)) {
-            LOGE("channel '%s' ~ Publisher closed input channel or an error occurred.  "
+            ALOGE("channel '%s' ~ Publisher closed input channel or an error occurred.  "
                     "events=0x%x", connection->getInputChannelName(), events);
             return 0; // remove the callback
         }
 
         if (! (events & ALOOPER_EVENT_INPUT)) {
-            LOGW("channel '%s' ~ Received spurious callback for unhandled poll event.  "
+            ALOGW("channel '%s' ~ Received spurious callback for unhandled poll event.  "
                     "events=0x%x", connection->getInputChannelName(), events);
             return 1;
         }
 
         status_t status = connection->inputConsumer.receiveDispatchSignal();
         if (status) {
-            LOGE("channel '%s' ~ Failed to receive dispatch signal.  status=%d",
+            ALOGE("channel '%s' ~ Failed to receive dispatch signal.  status=%d",
                     connection->getInputChannelName(), status);
             return 0; // remove the callback
         }
 
         if (connection->messageInProgress) {
-            LOGW("channel '%s' ~ Publisher sent spurious dispatch signal.",
+            ALOGW("channel '%s' ~ Publisher sent spurious dispatch signal.",
                     connection->getInputChannelName());
             return 1;
         }
 
         status = connection->inputConsumer.consume(& connection->inputEventFactory, & inputEvent);
         if (status) {
-            LOGW("channel '%s' ~ Failed to consume input event.  status=%d",
+            ALOGW("channel '%s' ~ Failed to consume input event.  status=%d",
                     connection->getInputChannelName(), status);
             connection->inputConsumer.sendFinishedSignal(false);
             return 1;
@@ -369,7 +369,7 @@
     switch (inputEventType) {
     case AINPUT_EVENT_TYPE_KEY:
 #if DEBUG_DISPATCH_CYCLE
-        LOGD("channel '%s' ~ Received key event.", connection->getInputChannelName());
+        ALOGD("channel '%s' ~ Received key event.", connection->getInputChannelName());
 #endif
         inputEventObj = android_view_KeyEvent_fromNative(env,
                 static_cast<KeyEvent*>(inputEvent));
@@ -378,7 +378,7 @@
 
     case AINPUT_EVENT_TYPE_MOTION:
 #if DEBUG_DISPATCH_CYCLE
-        LOGD("channel '%s' ~ Received motion event.", connection->getInputChannelName());
+        ALOGD("channel '%s' ~ Received motion event.", connection->getInputChannelName());
 #endif
         inputEventObj = android_view_MotionEvent_obtainAsCopy(env,
                 static_cast<MotionEvent*>(inputEvent));
@@ -391,7 +391,7 @@
     }
 
     if (! inputEventObj) {
-        LOGW("channel '%s' ~ Failed to obtain DVM event object.",
+        ALOGW("channel '%s' ~ Failed to obtain DVM event object.",
                 connection->getInputChannelName());
         env->DeleteLocalRef(inputHandlerObjLocal);
         q->finished(env, finishedToken, false, false);
@@ -399,17 +399,17 @@
     }
 
 #if DEBUG_DISPATCH_CYCLE
-    LOGD("Invoking input handler.");
+    ALOGD("Invoking input handler.");
 #endif
     env->CallStaticVoidMethod(gInputQueueClassInfo.clazz,
             dispatchMethodId, inputHandlerObjLocal, inputEventObj,
             jlong(finishedToken));
 #if DEBUG_DISPATCH_CYCLE
-    LOGD("Returned from input handler.");
+    ALOGD("Returned from input handler.");
 #endif
 
     if (env->ExceptionCheck()) {
-        LOGE("An exception occurred while invoking the input handler for an event.");
+        ALOGE("An exception occurred while invoking the input handler for an event.");
         LOGE_EX(env);
         env->ExceptionClear();
 
diff --git a/core/jni/android_view_KeyEvent.cpp b/core/jni/android_view_KeyEvent.cpp
index 4b04b8b..27469a2 100644
--- a/core/jni/android_view_KeyEvent.cpp
+++ b/core/jni/android_view_KeyEvent.cpp
@@ -63,7 +63,7 @@
             event->getSource(),
             NULL);
     if (env->ExceptionCheck()) {
-        LOGE("An exception occurred while obtaining a key event.");
+        ALOGE("An exception occurred while obtaining a key event.");
         LOGE_EX(env);
         env->ExceptionClear();
         return NULL;
@@ -93,7 +93,7 @@
 status_t android_view_KeyEvent_recycle(JNIEnv* env, jobject eventObj) {
     env->CallVoidMethod(eventObj, gKeyEventClassInfo.recycle);
     if (env->ExceptionCheck()) {
-        LOGW("An exception occurred while recycling a key event.");
+        ALOGW("An exception occurred while recycling a key event.");
         LOGW_EX(env);
         env->ExceptionClear();
         return UNKNOWN_ERROR;
diff --git a/core/jni/android_view_MotionEvent.cpp b/core/jni/android_view_MotionEvent.cpp
index fef06b2..2def1d1 100644
--- a/core/jni/android_view_MotionEvent.cpp
+++ b/core/jni/android_view_MotionEvent.cpp
@@ -80,7 +80,7 @@
     jobject eventObj = env->CallStaticObjectMethod(gMotionEventClassInfo.clazz,
             gMotionEventClassInfo.obtain);
     if (env->ExceptionCheck() || !eventObj) {
-        LOGE("An exception occurred while obtaining a motion event.");
+        ALOGE("An exception occurred while obtaining a motion event.");
         LOGE_EX(env);
         env->ExceptionClear();
         return NULL;
@@ -99,7 +99,7 @@
 status_t android_view_MotionEvent_recycle(JNIEnv* env, jobject eventObj) {
     env->CallVoidMethod(eventObj, gMotionEventClassInfo.recycle);
     if (env->ExceptionCheck()) {
-        LOGW("An exception occurred while recycling a motion event.");
+        ALOGW("An exception occurred while recycling a motion event.");
         LOGW_EX(env);
         env->ExceptionClear();
         return UNKNOWN_ERROR;
diff --git a/core/jni/android_view_PointerIcon.cpp b/core/jni/android_view_PointerIcon.cpp
index 091341a..8b6dc60 100644
--- a/core/jni/android_view_PointerIcon.cpp
+++ b/core/jni/android_view_PointerIcon.cpp
@@ -43,7 +43,7 @@
     jobject pointerIconObj = env->CallStaticObjectMethod(gPointerIconClassInfo.clazz,
             gPointerIconClassInfo.getSystemIcon, contextObj, style);
     if (env->ExceptionCheck()) {
-        LOGW("An exception occurred while getting a pointer icon with style %d.", style);
+        ALOGW("An exception occurred while getting a pointer icon with style %d.", style);
         LOGW_EX(env);
         env->ExceptionClear();
         return NULL;
@@ -62,7 +62,7 @@
     jobject loadedPointerIconObj = env->CallObjectMethod(pointerIconObj,
             gPointerIconClassInfo.load, contextObj);
     if (env->ExceptionCheck() || !loadedPointerIconObj) {
-        LOGW("An exception occurred while loading a pointer icon.");
+        ALOGW("An exception occurred while loading a pointer icon.");
         LOGW_EX(env);
         env->ExceptionClear();
         return UNKNOWN_ERROR;
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index bba4b47..18bcea1 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -572,7 +572,7 @@
 }
 
 static jobject Surface_screenshot(JNIEnv* env, jobject clazz, jint width, jint height,
-        jint minLayer, jint maxLayer, bool allLayers)
+        jint minLayer, jint maxLayer)
 {
     return doScreenshot(env, clazz, width, height, minLayer, maxLayer, false);
 }
diff --git a/core/jni/android_view_VelocityTracker.cpp b/core/jni/android_view_VelocityTracker.cpp
index 516e421..0da90d7 100644
--- a/core/jni/android_view_VelocityTracker.cpp
+++ b/core/jni/android_view_VelocityTracker.cpp
@@ -154,7 +154,7 @@
         jobject eventObj) {
     const MotionEvent* event = android_view_MotionEvent_getNativePtr(env, eventObj);
     if (!event) {
-        LOGW("nativeAddMovement failed because MotionEvent was finalized.");
+        ALOGW("nativeAddMovement failed because MotionEvent was finalized.");
         return;
     }
 
diff --git a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
index 95c9b49..b68c97a 100644
--- a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
+++ b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
@@ -101,7 +101,7 @@
 {
     if (lstat64(filePath, st) < 0) {
         // File is not found or cannot be read.
-        LOGV("Couldn't stat %s, copying: %s\n", filePath, strerror(errno));
+        ALOGV("Couldn't stat %s, copying: %s\n", filePath, strerror(errno));
         return true;
     }
 
@@ -115,13 +115,13 @@
 
     // For some reason, bionic doesn't define st_mtime as time_t
     if (time_t(st->st_mtime) != modifiedTime) {
-        LOGV("mod time doesn't match: %ld vs. %ld\n", st->st_mtime, modifiedTime);
+        ALOGV("mod time doesn't match: %ld vs. %ld\n", st->st_mtime, modifiedTime);
         return true;
     }
 
     int fd = TEMP_FAILURE_RETRY(open(filePath, O_RDONLY));
     if (fd < 0) {
-        LOGV("Couldn't open file %s: %s", filePath, strerror(errno));
+        ALOGV("Couldn't open file %s: %s", filePath, strerror(errno));
         return true;
     }
 
@@ -133,7 +133,7 @@
     }
     close(fd);
 
-    LOGV("%s: crc = %lx, zipCrc = %lx\n", filePath, crc, zipCrc);
+    ALOGV("%s: crc = %lx, zipCrc = %lx\n", filePath, crc, zipCrc);
 
     if (crc != zipCrc) {
         return true;
@@ -174,7 +174,7 @@
     time_t modTime;
 
     if (!zipFile->getEntryInfo(zipEntry, NULL, &uncompLen, NULL, NULL, &when, &crc)) {
-        LOGD("Couldn't read zip entry info\n");
+        ALOGD("Couldn't read zip entry info\n");
         return INSTALL_FAILED_INVALID_APK;
     } else {
         struct tm t;
@@ -187,7 +187,7 @@
     char localFileName[nativeLibPath.size() + fileNameLen + 2];
 
     if (strlcpy(localFileName, nativeLibPath.c_str(), sizeof(localFileName)) != nativeLibPath.size()) {
-        LOGD("Couldn't allocate local file name for library");
+        ALOGD("Couldn't allocate local file name for library");
         return INSTALL_FAILED_INTERNAL_ERROR;
     }
 
@@ -195,7 +195,7 @@
 
     if (strlcpy(localFileName + nativeLibPath.size() + 1, fileName, sizeof(localFileName)
                     - nativeLibPath.size() - 1) != fileNameLen) {
-        LOGD("Couldn't allocate local file name for library");
+        ALOGD("Couldn't allocate local file name for library");
         return INSTALL_FAILED_INTERNAL_ERROR;
     }
 
@@ -208,7 +208,7 @@
     char localTmpFileName[nativeLibPath.size() + TMP_FILE_PATTERN_LEN + 2];
     if (strlcpy(localTmpFileName, nativeLibPath.c_str(), sizeof(localTmpFileName))
             != nativeLibPath.size()) {
-        LOGD("Couldn't allocate local file name for library");
+        ALOGD("Couldn't allocate local file name for library");
         return INSTALL_FAILED_INTERNAL_ERROR;
     }
 
@@ -216,18 +216,18 @@
 
     if (strlcpy(localTmpFileName + nativeLibPath.size(), TMP_FILE_PATTERN,
                     TMP_FILE_PATTERN_LEN - nativeLibPath.size()) != TMP_FILE_PATTERN_LEN) {
-        LOGI("Couldn't allocate temporary file name for library");
+        ALOGI("Couldn't allocate temporary file name for library");
         return INSTALL_FAILED_INTERNAL_ERROR;
     }
 
     int fd = mkstemp(localTmpFileName);
     if (fd < 0) {
-        LOGI("Couldn't open temporary file name: %s: %s\n", localTmpFileName, strerror(errno));
+        ALOGI("Couldn't open temporary file name: %s: %s\n", localTmpFileName, strerror(errno));
         return INSTALL_FAILED_CONTAINER_ERROR;
     }
 
     if (!zipFile->uncompressEntry(zipEntry, fd)) {
-        LOGI("Failed uncompressing %s to %s\n", fileName, localTmpFileName);
+        ALOGI("Failed uncompressing %s to %s\n", fileName, localTmpFileName);
         close(fd);
         unlink(localTmpFileName);
         return INSTALL_FAILED_CONTAINER_ERROR;
@@ -241,7 +241,7 @@
     times[1].tv_sec = modTime;
     times[0].tv_usec = times[1].tv_usec = 0;
     if (utimes(localTmpFileName, times) < 0) {
-        LOGI("Couldn't change modification time on %s: %s\n", localTmpFileName, strerror(errno));
+        ALOGI("Couldn't change modification time on %s: %s\n", localTmpFileName, strerror(errno));
         unlink(localTmpFileName);
         return INSTALL_FAILED_CONTAINER_ERROR;
     }
@@ -249,19 +249,19 @@
     // Set the mode to 755
     static const mode_t mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP |  S_IXGRP | S_IROTH | S_IXOTH;
     if (chmod(localTmpFileName, mode) < 0) {
-        LOGI("Couldn't change permissions on %s: %s\n", localTmpFileName, strerror(errno));
+        ALOGI("Couldn't change permissions on %s: %s\n", localTmpFileName, strerror(errno));
         unlink(localTmpFileName);
         return INSTALL_FAILED_CONTAINER_ERROR;
     }
 
     // Finally, rename it to the final name.
     if (rename(localTmpFileName, localFileName) < 0) {
-        LOGI("Couldn't rename %s to %s: %s\n", localTmpFileName, localFileName, strerror(errno));
+        ALOGI("Couldn't rename %s to %s: %s\n", localTmpFileName, localFileName, strerror(errno));
         unlink(localTmpFileName);
         return INSTALL_FAILED_CONTAINER_ERROR;
     }
 
-    LOGV("Successfully moved %s to %s\n", localTmpFileName, localFileName);
+    ALOGV("Successfully moved %s to %s\n", localTmpFileName, localFileName);
 
     return INSTALL_SUCCEEDED;
 }
@@ -276,7 +276,7 @@
     ZipFileRO zipFile;
 
     if (zipFile.open(filePath.c_str()) != NO_ERROR) {
-        LOGI("Couldn't open APK %s\n", filePath.c_str());
+        ALOGI("Couldn't open APK %s\n", filePath.c_str());
         return INSTALL_FAILED_INVALID_APK;
     }
 
@@ -309,17 +309,17 @@
         }
 
         const char* lastSlash = strrchr(fileName, '/');
-        LOG_ASSERT(lastSlash != NULL, "last slash was null somehow for %s\n", fileName);
+        ALOG_ASSERT(lastSlash != NULL, "last slash was null somehow for %s\n", fileName);
 
         // Check to make sure the CPU ABI of this file is one we support.
         const char* cpuAbiOffset = fileName + APK_LIB_LEN;
         const size_t cpuAbiRegionSize = lastSlash - cpuAbiOffset;
 
-        LOGV("Comparing ABIs %s and %s versus %s\n", cpuAbi.c_str(), cpuAbi2.c_str(), cpuAbiOffset);
+        ALOGV("Comparing ABIs %s and %s versus %s\n", cpuAbi.c_str(), cpuAbi2.c_str(), cpuAbiOffset);
         if (cpuAbi.size() == cpuAbiRegionSize
                 && *(cpuAbiOffset + cpuAbi.size()) == '/'
                 && !strncmp(cpuAbiOffset, cpuAbi.c_str(), cpuAbiRegionSize)) {
-            LOGV("Using primary ABI %s\n", cpuAbi.c_str());
+            ALOGV("Using primary ABI %s\n", cpuAbi.c_str());
             hasPrimaryAbi = true;
         } else if (cpuAbi2.size() == cpuAbiRegionSize
                 && *(cpuAbiOffset + cpuAbi2.size()) == '/'
@@ -330,13 +330,13 @@
              * only use the primary ABI.
              */
             if (hasPrimaryAbi) {
-                LOGV("Already saw primary ABI, skipping secondary ABI %s\n", cpuAbi2.c_str());
+                ALOGV("Already saw primary ABI, skipping secondary ABI %s\n", cpuAbi2.c_str());
                 continue;
             } else {
-                LOGV("Using secondary ABI %s\n", cpuAbi2.c_str());
+                ALOGV("Using secondary ABI %s\n", cpuAbi2.c_str());
             }
         } else {
-            LOGV("abi didn't match anything: %s (end at %zd)\n", cpuAbiOffset, cpuAbiRegionSize);
+            ALOGV("abi didn't match anything: %s (end at %zd)\n", cpuAbiOffset, cpuAbiRegionSize);
             continue;
         }
 
@@ -349,7 +349,7 @@
             install_status_t ret = callFunc(env, callArg, &zipFile, entry, lastSlash + 1);
 
             if (ret != INSTALL_SUCCEEDED) {
-                LOGV("Failure for entry %s", lastSlash + 1);
+                ALOGV("Failure for entry %s", lastSlash + 1);
                 return ret;
             }
         }
diff --git a/drm/common/DrmMetadata.cpp b/drm/common/DrmMetadata.cpp
index 6cc5ec1..2a4b8c8 100644
--- a/drm/common/DrmMetadata.cpp
+++ b/drm/common/DrmMetadata.cpp
@@ -78,11 +78,11 @@
 DrmMetadata::KeyIterator::KeyIterator(const DrmMetadata::KeyIterator& keyIterator) :
     mDrmMetadata(keyIterator.mDrmMetadata),
     mIndex(keyIterator.mIndex) {
-    LOGV("DrmMetadata::KeyIterator::KeyIterator");
+    ALOGV("DrmMetadata::KeyIterator::KeyIterator");
 }
 
 DrmMetadata::KeyIterator& DrmMetadata::KeyIterator::operator=(const DrmMetadata::KeyIterator& keyIterator) {
-    LOGV("DrmMetadata::KeyIterator::operator=");
+    ALOGV("DrmMetadata::KeyIterator::operator=");
     mDrmMetadata = keyIterator.mDrmMetadata;
     mIndex = keyIterator.mIndex;
     return *this;
@@ -96,11 +96,11 @@
 DrmMetadata::Iterator::Iterator(const DrmMetadata::Iterator& iterator) :
     mDrmMetadata(iterator.mDrmMetadata),
     mIndex(iterator.mIndex) {
-    LOGV("DrmMetadata::Iterator::Iterator");
+    ALOGV("DrmMetadata::Iterator::Iterator");
 }
 
 DrmMetadata::Iterator& DrmMetadata::Iterator::operator=(const DrmMetadata::Iterator& iterator) {
-    LOGV("DrmMetadata::Iterator::operator=");
+    ALOGV("DrmMetadata::Iterator::operator=");
     mDrmMetadata = iterator.mDrmMetadata;
     mIndex = iterator.mIndex;
     return *this;
diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp
index 0b76a36..3ed8ade 100644
--- a/drm/common/IDrmManagerService.cpp
+++ b/drm/common/IDrmManagerService.cpp
@@ -111,7 +111,7 @@
 }
 
 int BpDrmManagerService::addUniqueId(bool isNative) {
-    LOGV("add uniqueid");
+    ALOGV("add uniqueid");
     Parcel data, reply;
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
     data.writeInt32(isNative);
@@ -120,7 +120,7 @@
 }
 
 void BpDrmManagerService::removeUniqueId(int uniqueId) {
-    LOGV("remove uniqueid");
+    ALOGV("remove uniqueid");
     Parcel data, reply;
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
     data.writeInt32(uniqueId);
@@ -143,7 +143,7 @@
 
 status_t BpDrmManagerService::setDrmServiceListener(
             int uniqueId, const sp<IDrmServiceListener>& drmServiceListener) {
-    LOGV("setDrmServiceListener");
+    ALOGV("setDrmServiceListener");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -154,7 +154,7 @@
 }
 
 status_t BpDrmManagerService::installDrmEngine(int uniqueId, const String8& drmEngineFile) {
-    LOGV("Install DRM Engine");
+    ALOGV("Install DRM Engine");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -167,7 +167,7 @@
 
 DrmConstraints* BpDrmManagerService::getConstraints(
             int uniqueId, const String8* path, const int action) {
-    LOGV("Get Constraints");
+    ALOGV("Get Constraints");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -198,7 +198,7 @@
 }
 
 DrmMetadata* BpDrmManagerService::getMetadata(int uniqueId, const String8* path) {
-    LOGV("Get Metadata");
+    ALOGV("Get Metadata");
     Parcel data, reply;
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
     data.writeInt32(uniqueId);
@@ -227,7 +227,7 @@
 }
 
 bool BpDrmManagerService::canHandle(int uniqueId, const String8& path, const String8& mimeType) {
-    LOGV("Can Handle");
+    ALOGV("Can Handle");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -242,7 +242,7 @@
 }
 
 DrmInfoStatus* BpDrmManagerService::processDrmInfo(int uniqueId, const DrmInfo* drmInfo) {
-    LOGV("Process DRM Info");
+    ALOGV("Process DRM Info");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -293,7 +293,7 @@
 }
 
 DrmInfo* BpDrmManagerService::acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInforequest) {
-    LOGV("Acquire DRM Info");
+    ALOGV("Acquire DRM Info");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -341,7 +341,7 @@
 status_t BpDrmManagerService::saveRights(
             int uniqueId, const DrmRights& drmRights,
             const String8& rightsPath, const String8& contentPath) {
-    LOGV("Save Rights");
+    ALOGV("Save Rights");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -369,7 +369,7 @@
 }
 
 String8 BpDrmManagerService::getOriginalMimeType(int uniqueId, const String8& path) {
-    LOGV("Get Original MimeType");
+    ALOGV("Get Original MimeType");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -382,7 +382,7 @@
 
 int BpDrmManagerService::getDrmObjectType(
             int uniqueId, const String8& path, const String8& mimeType) {
-    LOGV("Get Drm object type");
+    ALOGV("Get Drm object type");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -396,7 +396,7 @@
 }
 
 int BpDrmManagerService::checkRightsStatus(int uniqueId, const String8& path, int action) {
-    LOGV("checkRightsStatus");
+    ALOGV("checkRightsStatus");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -411,7 +411,7 @@
 
 status_t BpDrmManagerService::consumeRights(
             int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) {
-    LOGV("consumeRights");
+    ALOGV("consumeRights");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -428,7 +428,7 @@
 
 status_t BpDrmManagerService::setPlaybackStatus(
             int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) {
-    LOGV("setPlaybackStatus");
+    ALOGV("setPlaybackStatus");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -446,7 +446,7 @@
 bool BpDrmManagerService::validateAction(
             int uniqueId, const String8& path,
             int action, const ActionDescription& description) {
-    LOGV("validateAction");
+    ALOGV("validateAction");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -462,7 +462,7 @@
 }
 
 status_t BpDrmManagerService::removeRights(int uniqueId, const String8& path) {
-    LOGV("removeRights");
+    ALOGV("removeRights");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -474,7 +474,7 @@
 }
 
 status_t BpDrmManagerService::removeAllRights(int uniqueId) {
-    LOGV("removeAllRights");
+    ALOGV("removeAllRights");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -485,7 +485,7 @@
 }
 
 int BpDrmManagerService::openConvertSession(int uniqueId, const String8& mimeType) {
-    LOGV("openConvertSession");
+    ALOGV("openConvertSession");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -498,7 +498,7 @@
 
 DrmConvertedStatus* BpDrmManagerService::convertData(
             int uniqueId, int convertId, const DrmBuffer* inputData) {
-    LOGV("convertData");
+    ALOGV("convertData");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -532,7 +532,7 @@
 }
 
 DrmConvertedStatus* BpDrmManagerService::closeConvertSession(int uniqueId, int convertId) {
-    LOGV("closeConvertSession");
+    ALOGV("closeConvertSession");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -565,7 +565,7 @@
 
 status_t BpDrmManagerService::getAllSupportInfo(
             int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray) {
-    LOGV("Get All Support Info");
+    ALOGV("Get All Support Info");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -601,7 +601,7 @@
 
 DecryptHandle* BpDrmManagerService::openDecryptSession(
             int uniqueId, int fd, off64_t offset, off64_t length) {
-    LOGV("Entering BpDrmManagerService::openDecryptSession");
+    ALOGV("Entering BpDrmManagerService::openDecryptSession");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -621,7 +621,7 @@
 }
 
 DecryptHandle* BpDrmManagerService::openDecryptSession(int uniqueId, const char* uri) {
-    LOGV("Entering BpDrmManagerService::openDecryptSession");
+    ALOGV("Entering BpDrmManagerService::openDecryptSession");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -635,13 +635,13 @@
         handle = new DecryptHandle();
         readDecryptHandleFromParcelData(handle, reply);
     } else {
-        LOGV("no decryptHandle is generated in service side");
+        ALOGV("no decryptHandle is generated in service side");
     }
     return handle;
 }
 
 status_t BpDrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
-    LOGV("closeDecryptSession");
+    ALOGV("closeDecryptSession");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -657,7 +657,7 @@
 status_t BpDrmManagerService::initializeDecryptUnit(
             int uniqueId, DecryptHandle* decryptHandle,
             int decryptUnitId, const DrmBuffer* headerInfo) {
-    LOGV("initializeDecryptUnit");
+    ALOGV("initializeDecryptUnit");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -677,7 +677,7 @@
 status_t BpDrmManagerService::decrypt(
             int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
             const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
-    LOGV("decrypt");
+    ALOGV("decrypt");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -699,7 +699,7 @@
     remote()->transact(DECRYPT, data, &reply);
 
     const status_t status = reply.readInt32();
-    LOGV("Return value of decrypt() is %d", status);
+    ALOGV("Return value of decrypt() is %d", status);
 
     const int size = reply.readInt32();
     (*decBuffer)->length = size;
@@ -710,7 +710,7 @@
 
 status_t BpDrmManagerService::finalizeDecryptUnit(
             int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
-    LOGV("finalizeDecryptUnit");
+    ALOGV("finalizeDecryptUnit");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -727,7 +727,7 @@
 ssize_t BpDrmManagerService::pread(
             int uniqueId, DecryptHandle* decryptHandle, void* buffer,
             ssize_t numBytes, off64_t offset) {
-    LOGV("read");
+    ALOGV("read");
     Parcel data, reply;
     int result;
 
@@ -752,12 +752,12 @@
 status_t BnDrmManagerService::onTransact(
             uint32_t code, const Parcel& data,
             Parcel* reply, uint32_t flags) {
-    LOGV("Entering BnDrmManagerService::onTransact with code %d", code);
+    ALOGV("Entering BnDrmManagerService::onTransact with code %d", code);
 
     switch (code) {
     case ADD_UNIQUEID:
     {
-        LOGV("BnDrmManagerService::onTransact :ADD_UNIQUEID");
+        ALOGV("BnDrmManagerService::onTransact :ADD_UNIQUEID");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
         int uniqueId = addUniqueId(data.readInt32());
         reply->writeInt32(uniqueId);
@@ -766,7 +766,7 @@
 
     case REMOVE_UNIQUEID:
     {
-        LOGV("BnDrmManagerService::onTransact :REMOVE_UNIQUEID");
+        ALOGV("BnDrmManagerService::onTransact :REMOVE_UNIQUEID");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
         removeUniqueId(data.readInt32());
         return DRM_NO_ERROR;
@@ -774,7 +774,7 @@
 
     case ADD_CLIENT:
     {
-        LOGV("BnDrmManagerService::onTransact :ADD_CLIENT");
+        ALOGV("BnDrmManagerService::onTransact :ADD_CLIENT");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
         addClient(data.readInt32());
         return DRM_NO_ERROR;
@@ -782,7 +782,7 @@
 
     case REMOVE_CLIENT:
     {
-        LOGV("BnDrmManagerService::onTransact :REMOVE_CLIENT");
+        ALOGV("BnDrmManagerService::onTransact :REMOVE_CLIENT");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
         removeClient(data.readInt32());
         return DRM_NO_ERROR;
@@ -790,7 +790,7 @@
 
     case SET_DRM_SERVICE_LISTENER:
     {
-        LOGV("BnDrmManagerService::onTransact :SET_DRM_SERVICE_LISTENER");
+        ALOGV("BnDrmManagerService::onTransact :SET_DRM_SERVICE_LISTENER");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -805,7 +805,7 @@
 
     case INSTALL_DRM_ENGINE:
     {
-        LOGV("BnDrmManagerService::onTransact :INSTALL_DRM_ENGINE");
+        ALOGV("BnDrmManagerService::onTransact :INSTALL_DRM_ENGINE");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -818,7 +818,7 @@
 
     case GET_CONSTRAINTS_FROM_CONTENT:
     {
-        LOGV("BnDrmManagerService::onTransact :GET_CONSTRAINTS_FROM_CONTENT");
+        ALOGV("BnDrmManagerService::onTransact :GET_CONSTRAINTS_FROM_CONTENT");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -850,7 +850,7 @@
 
     case GET_METADATA_FROM_CONTENT:
     {
-        LOGV("BnDrmManagerService::onTransact :GET_METADATA_FROM_CONTENT");
+        ALOGV("BnDrmManagerService::onTransact :GET_METADATA_FROM_CONTENT");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -882,7 +882,7 @@
 
     case CAN_HANDLE:
     {
-        LOGV("BnDrmManagerService::onTransact :CAN_HANDLE");
+        ALOGV("BnDrmManagerService::onTransact :CAN_HANDLE");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -897,7 +897,7 @@
 
     case PROCESS_DRM_INFO:
     {
-        LOGV("BnDrmManagerService::onTransact :PROCESS_DRM_INFO");
+        ALOGV("BnDrmManagerService::onTransact :PROCESS_DRM_INFO");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -945,7 +945,7 @@
 
     case ACQUIRE_DRM_INFO:
     {
-        LOGV("BnDrmManagerService::onTransact :ACQUIRE_DRM_INFO");
+        ALOGV("BnDrmManagerService::onTransact :ACQUIRE_DRM_INFO");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -993,7 +993,7 @@
 
     case SAVE_RIGHTS:
     {
-        LOGV("BnDrmManagerService::onTransact :SAVE_RIGHTS");
+        ALOGV("BnDrmManagerService::onTransact :SAVE_RIGHTS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1023,7 +1023,7 @@
 
     case GET_ORIGINAL_MIMETYPE:
     {
-        LOGV("BnDrmManagerService::onTransact :GET_ORIGINAL_MIMETYPE");
+        ALOGV("BnDrmManagerService::onTransact :GET_ORIGINAL_MIMETYPE");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1036,7 +1036,7 @@
 
     case GET_DRM_OBJECT_TYPE:
     {
-        LOGV("BnDrmManagerService::onTransact :GET_DRM_OBJECT_TYPE");
+        ALOGV("BnDrmManagerService::onTransact :GET_DRM_OBJECT_TYPE");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1050,7 +1050,7 @@
 
     case CHECK_RIGHTS_STATUS:
     {
-        LOGV("BnDrmManagerService::onTransact :CHECK_RIGHTS_STATUS");
+        ALOGV("BnDrmManagerService::onTransact :CHECK_RIGHTS_STATUS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1064,7 +1064,7 @@
 
     case CONSUME_RIGHTS:
     {
-        LOGV("BnDrmManagerService::onTransact :CONSUME_RIGHTS");
+        ALOGV("BnDrmManagerService::onTransact :CONSUME_RIGHTS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1084,7 +1084,7 @@
 
     case SET_PLAYBACK_STATUS:
     {
-        LOGV("BnDrmManagerService::onTransact :SET_PLAYBACK_STATUS");
+        ALOGV("BnDrmManagerService::onTransact :SET_PLAYBACK_STATUS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1104,7 +1104,7 @@
 
     case VALIDATE_ACTION:
     {
-        LOGV("BnDrmManagerService::onTransact :VALIDATE_ACTION");
+        ALOGV("BnDrmManagerService::onTransact :VALIDATE_ACTION");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1121,7 +1121,7 @@
 
     case REMOVE_RIGHTS:
     {
-        LOGV("BnDrmManagerService::onTransact :REMOVE_RIGHTS");
+        ALOGV("BnDrmManagerService::onTransact :REMOVE_RIGHTS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         int uniqueId = data.readInt32();
@@ -1134,7 +1134,7 @@
 
     case REMOVE_ALL_RIGHTS:
     {
-        LOGV("BnDrmManagerService::onTransact :REMOVE_ALL_RIGHTS");
+        ALOGV("BnDrmManagerService::onTransact :REMOVE_ALL_RIGHTS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const status_t status = removeAllRights(data.readInt32());
@@ -1145,7 +1145,7 @@
 
     case OPEN_CONVERT_SESSION:
     {
-        LOGV("BnDrmManagerService::onTransact :OPEN_CONVERT_SESSION");
+        ALOGV("BnDrmManagerService::onTransact :OPEN_CONVERT_SESSION");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1158,7 +1158,7 @@
 
     case CONVERT_DATA:
     {
-        LOGV("BnDrmManagerService::onTransact :CONVERT_DATA");
+        ALOGV("BnDrmManagerService::onTransact :CONVERT_DATA");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1193,7 +1193,7 @@
 
     case CLOSE_CONVERT_SESSION:
     {
-        LOGV("BnDrmManagerService::onTransact :CLOSE_CONVERT_SESSION");
+        ALOGV("BnDrmManagerService::onTransact :CLOSE_CONVERT_SESSION");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1223,7 +1223,7 @@
 
     case GET_ALL_SUPPORT_INFO:
     {
-        LOGV("BnDrmManagerService::onTransact :GET_ALL_SUPPORT_INFO");
+        ALOGV("BnDrmManagerService::onTransact :GET_ALL_SUPPORT_INFO");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1257,7 +1257,7 @@
 
     case OPEN_DECRYPT_SESSION:
     {
-        LOGV("BnDrmManagerService::onTransact :OPEN_DECRYPT_SESSION");
+        ALOGV("BnDrmManagerService::onTransact :OPEN_DECRYPT_SESSION");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1278,7 +1278,7 @@
 
     case OPEN_DECRYPT_SESSION_FROM_URI:
     {
-        LOGV("BnDrmManagerService::onTransact :OPEN_DECRYPT_SESSION_FROM_URI");
+        ALOGV("BnDrmManagerService::onTransact :OPEN_DECRYPT_SESSION_FROM_URI");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1292,14 +1292,14 @@
             clearDecryptHandle(handle);
             delete handle; handle = NULL;
         } else {
-            LOGV("NULL decryptHandle is returned");
+            ALOGV("NULL decryptHandle is returned");
         }
         return DRM_NO_ERROR;
     }
 
     case CLOSE_DECRYPT_SESSION:
     {
-        LOGV("BnDrmManagerService::onTransact :CLOSE_DECRYPT_SESSION");
+        ALOGV("BnDrmManagerService::onTransact :CLOSE_DECRYPT_SESSION");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1314,7 +1314,7 @@
 
     case INITIALIZE_DECRYPT_UNIT:
     {
-        LOGV("BnDrmManagerService::onTransact :INITIALIZE_DECRYPT_UNIT");
+        ALOGV("BnDrmManagerService::onTransact :INITIALIZE_DECRYPT_UNIT");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1340,7 +1340,7 @@
 
     case DECRYPT:
     {
-        LOGV("BnDrmManagerService::onTransact :DECRYPT");
+        ALOGV("BnDrmManagerService::onTransact :DECRYPT");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1384,7 +1384,7 @@
 
     case FINALIZE_DECRYPT_UNIT:
     {
-        LOGV("BnDrmManagerService::onTransact :FINALIZE_DECRYPT_UNIT");
+        ALOGV("BnDrmManagerService::onTransact :FINALIZE_DECRYPT_UNIT");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1401,7 +1401,7 @@
 
     case PREAD:
     {
-        LOGV("BnDrmManagerService::onTransact :READ");
+        ALOGV("BnDrmManagerService::onTransact :READ");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
diff --git a/drm/common/ReadWriteUtils.cpp b/drm/common/ReadWriteUtils.cpp
index c16214e2..fd17e98 100644
--- a/drm/common/ReadWriteUtils.cpp
+++ b/drm/common/ReadWriteUtils.cpp
@@ -85,7 +85,7 @@
         int size = data.size();
         if (FAILURE != ftruncate(fd, size)) {
             if (size != write(fd, data.string(), size)) {
-                LOGE("Failed to write the data to: %s", filePath.string());
+                ALOGE("Failed to write the data to: %s", filePath.string());
             }
         }
         fclose(file);
@@ -101,7 +101,7 @@
 
         int size = data.size();
         if (size != write(fd, data.string(), size)) {
-            LOGE("Failed to write the data to: %s", filePath.string());
+            ALOGE("Failed to write the data to: %s", filePath.string());
         }
         fclose(file);
     }
diff --git a/drm/drmserver/DrmManager.cpp b/drm/drmserver/DrmManager.cpp
index b2fa053..3abf3d3 100644
--- a/drm/drmserver/DrmManager.cpp
+++ b/drm/drmserver/DrmManager.cpp
@@ -476,7 +476,7 @@
     }
     if (DRM_NO_ERROR != result) {
         delete handle; handle = NULL;
-        LOGV("DrmManager::openDecryptSession: no capable plug-in found");
+        ALOGV("DrmManager::openDecryptSession: no capable plug-in found");
     }
     return handle;
 }
diff --git a/drm/drmserver/DrmManagerService.cpp b/drm/drmserver/DrmManagerService.cpp
index 7ebcac3..df17ac5 100644
--- a/drm/drmserver/DrmManagerService.cpp
+++ b/drm/drmserver/DrmManagerService.cpp
@@ -52,7 +52,7 @@
 }
 
 void DrmManagerService::instantiate() {
-    LOGV("instantiate");
+    ALOGV("instantiate");
     defaultServiceManager()->addService(String16("drm.drmManager"), new DrmManagerService());
 
     if (0 >= trustedUids.size()) {
@@ -67,13 +67,13 @@
 
 DrmManagerService::DrmManagerService() :
         mDrmManager(NULL) {
-    LOGV("created");
+    ALOGV("created");
     mDrmManager = new DrmManager();
     mDrmManager->loadPlugIns();
 }
 
 DrmManagerService::~DrmManagerService() {
-    LOGV("Destroyed");
+    ALOGV("Destroyed");
     mDrmManager->unloadPlugIns();
     delete mDrmManager; mDrmManager = NULL;
 }
@@ -96,120 +96,120 @@
 
 status_t DrmManagerService::setDrmServiceListener(
             int uniqueId, const sp<IDrmServiceListener>& drmServiceListener) {
-    LOGV("Entering setDrmServiceListener");
+    ALOGV("Entering setDrmServiceListener");
     mDrmManager->setDrmServiceListener(uniqueId, drmServiceListener);
     return DRM_NO_ERROR;
 }
 
 status_t DrmManagerService::installDrmEngine(int uniqueId, const String8& drmEngineFile) {
-    LOGV("Entering installDrmEngine");
+    ALOGV("Entering installDrmEngine");
     return mDrmManager->installDrmEngine(uniqueId, drmEngineFile);
 }
 
 DrmConstraints* DrmManagerService::getConstraints(
             int uniqueId, const String8* path, const int action) {
-    LOGV("Entering getConstraints from content");
+    ALOGV("Entering getConstraints from content");
     return mDrmManager->getConstraints(uniqueId, path, action);
 }
 
 DrmMetadata* DrmManagerService::getMetadata(int uniqueId, const String8* path) {
-    LOGV("Entering getMetadata from content");
+    ALOGV("Entering getMetadata from content");
     return mDrmManager->getMetadata(uniqueId, path);
 }
 
 bool DrmManagerService::canHandle(int uniqueId, const String8& path, const String8& mimeType) {
-    LOGV("Entering canHandle");
+    ALOGV("Entering canHandle");
     return mDrmManager->canHandle(uniqueId, path, mimeType);
 }
 
 DrmInfoStatus* DrmManagerService::processDrmInfo(int uniqueId, const DrmInfo* drmInfo) {
-    LOGV("Entering processDrmInfo");
+    ALOGV("Entering processDrmInfo");
     return mDrmManager->processDrmInfo(uniqueId, drmInfo);
 }
 
 DrmInfo* DrmManagerService::acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest) {
-    LOGV("Entering acquireDrmInfo");
+    ALOGV("Entering acquireDrmInfo");
     return mDrmManager->acquireDrmInfo(uniqueId, drmInfoRequest);
 }
 
 status_t DrmManagerService::saveRights(
             int uniqueId, const DrmRights& drmRights,
             const String8& rightsPath, const String8& contentPath) {
-    LOGV("Entering saveRights");
+    ALOGV("Entering saveRights");
     return mDrmManager->saveRights(uniqueId, drmRights, rightsPath, contentPath);
 }
 
 String8 DrmManagerService::getOriginalMimeType(int uniqueId, const String8& path) {
-    LOGV("Entering getOriginalMimeType");
+    ALOGV("Entering getOriginalMimeType");
     return mDrmManager->getOriginalMimeType(uniqueId, path);
 }
 
 int DrmManagerService::getDrmObjectType(
            int uniqueId, const String8& path, const String8& mimeType) {
-    LOGV("Entering getDrmObjectType");
+    ALOGV("Entering getDrmObjectType");
     return mDrmManager->getDrmObjectType(uniqueId, path, mimeType);
 }
 
 int DrmManagerService::checkRightsStatus(
             int uniqueId, const String8& path, int action) {
-    LOGV("Entering checkRightsStatus");
+    ALOGV("Entering checkRightsStatus");
     return mDrmManager->checkRightsStatus(uniqueId, path, action);
 }
 
 status_t DrmManagerService::consumeRights(
             int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) {
-    LOGV("Entering consumeRights");
+    ALOGV("Entering consumeRights");
     return mDrmManager->consumeRights(uniqueId, decryptHandle, action, reserve);
 }
 
 status_t DrmManagerService::setPlaybackStatus(
             int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) {
-    LOGV("Entering setPlaybackStatus");
+    ALOGV("Entering setPlaybackStatus");
     return mDrmManager->setPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
 }
 
 bool DrmManagerService::validateAction(
             int uniqueId, const String8& path,
             int action, const ActionDescription& description) {
-    LOGV("Entering validateAction");
+    ALOGV("Entering validateAction");
     return mDrmManager->validateAction(uniqueId, path, action, description);
 }
 
 status_t DrmManagerService::removeRights(int uniqueId, const String8& path) {
-    LOGV("Entering removeRights");
+    ALOGV("Entering removeRights");
     return mDrmManager->removeRights(uniqueId, path);
 }
 
 status_t DrmManagerService::removeAllRights(int uniqueId) {
-    LOGV("Entering removeAllRights");
+    ALOGV("Entering removeAllRights");
     return mDrmManager->removeAllRights(uniqueId);
 }
 
 int DrmManagerService::openConvertSession(int uniqueId, const String8& mimeType) {
-    LOGV("Entering openConvertSession");
+    ALOGV("Entering openConvertSession");
     return mDrmManager->openConvertSession(uniqueId, mimeType);
 }
 
 DrmConvertedStatus* DrmManagerService::convertData(
             int uniqueId, int convertId, const DrmBuffer* inputData) {
-    LOGV("Entering convertData");
+    ALOGV("Entering convertData");
     return mDrmManager->convertData(uniqueId, convertId, inputData);
 }
 
 DrmConvertedStatus* DrmManagerService::closeConvertSession(int uniqueId, int convertId) {
-    LOGV("Entering closeConvertSession");
+    ALOGV("Entering closeConvertSession");
     return mDrmManager->closeConvertSession(uniqueId, convertId);
 }
 
 status_t DrmManagerService::getAllSupportInfo(
             int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray) {
-    LOGV("Entering getAllSupportInfo");
+    ALOGV("Entering getAllSupportInfo");
     return mDrmManager->getAllSupportInfo(uniqueId, length, drmSupportInfoArray);
 }
 
 DecryptHandle* DrmManagerService::openDecryptSession(
             int uniqueId, int fd, off64_t offset, off64_t length) {
-    LOGV("Entering DrmManagerService::openDecryptSession");
+    ALOGV("Entering DrmManagerService::openDecryptSession");
     if (isProtectedCallAllowed()) {
         return mDrmManager->openDecryptSession(uniqueId, fd, offset, length);
     }
@@ -219,7 +219,7 @@
 
 DecryptHandle* DrmManagerService::openDecryptSession(
             int uniqueId, const char* uri) {
-    LOGV("Entering DrmManagerService::openDecryptSession with uri");
+    ALOGV("Entering DrmManagerService::openDecryptSession with uri");
     if (isProtectedCallAllowed()) {
         return mDrmManager->openDecryptSession(uniqueId, uri);
     }
@@ -228,32 +228,32 @@
 }
 
 status_t DrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
-    LOGV("Entering closeDecryptSession");
+    ALOGV("Entering closeDecryptSession");
     return mDrmManager->closeDecryptSession(uniqueId, decryptHandle);
 }
 
 status_t DrmManagerService::initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
             int decryptUnitId, const DrmBuffer* headerInfo) {
-    LOGV("Entering initializeDecryptUnit");
+    ALOGV("Entering initializeDecryptUnit");
     return mDrmManager->initializeDecryptUnit(uniqueId,decryptHandle, decryptUnitId, headerInfo);
 }
 
 status_t DrmManagerService::decrypt(
             int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
             const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
-    LOGV("Entering decrypt");
+    ALOGV("Entering decrypt");
     return mDrmManager->decrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV);
 }
 
 status_t DrmManagerService::finalizeDecryptUnit(
             int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
-    LOGV("Entering finalizeDecryptUnit");
+    ALOGV("Entering finalizeDecryptUnit");
     return mDrmManager->finalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId);
 }
 
 ssize_t DrmManagerService::pread(int uniqueId, DecryptHandle* decryptHandle,
             void* buffer, ssize_t numBytes, off64_t offset) {
-    LOGV("Entering pread");
+    ALOGV("Entering pread");
     return mDrmManager->pread(uniqueId, decryptHandle, buffer, numBytes, offset);
 }
 
diff --git a/drm/drmserver/main_drmserver.cpp b/drm/drmserver/main_drmserver.cpp
index 6d10646..ed42818 100644
--- a/drm/drmserver/main_drmserver.cpp
+++ b/drm/drmserver/main_drmserver.cpp
@@ -32,7 +32,7 @@
 {
     sp<ProcessState> proc(ProcessState::self());
     sp<IServiceManager> sm = defaultServiceManager();
-    LOGI("ServiceManager: %p", sm.get());
+    ALOGI("ServiceManager: %p", sm.get());
     DrmManagerService::instantiate();
     ProcessState::self()->startThreadPool();
     IPCThreadState::self()->joinThreadPool();
diff --git a/drm/java/android/drm/DrmManagerClient.java b/drm/java/android/drm/DrmManagerClient.java
index 9a7194c..f9567a5 100755
--- a/drm/java/android/drm/DrmManagerClient.java
+++ b/drm/java/android/drm/DrmManagerClient.java
@@ -49,6 +49,8 @@
      */
     public static final int ERROR_UNKNOWN = -2000;
 
+    HandlerThread mInfoThread;
+    HandlerThread mEventThread;
     private static final String TAG = "DrmManagerClient";
 
     static {
@@ -105,6 +107,7 @@
 
     private int mUniqueId;
     private int mNativeContext;
+    private boolean mReleased;
     private Context mContext;
     private InfoHandler mInfoHandler;
     private EventHandler mEventHandler;
@@ -238,32 +241,73 @@
      */
     public DrmManagerClient(Context context) {
         mContext = context;
-
-        HandlerThread infoThread = new HandlerThread("DrmManagerClient.InfoHandler");
-        infoThread.start();
-        mInfoHandler = new InfoHandler(infoThread.getLooper());
-
-        HandlerThread eventThread = new HandlerThread("DrmManagerClient.EventHandler");
-        eventThread.start();
-        mEventHandler = new EventHandler(eventThread.getLooper());
+        mReleased = false;
 
         // save the unique id
-        mUniqueId = _initialize(new WeakReference<DrmManagerClient>(this));
+        mUniqueId = _initialize();
     }
 
     protected void finalize() {
-        _finalize(mUniqueId);
+        if (!mReleased) {
+            Log.w(TAG, "You should have called release()");
+            release();
+        }
     }
 
     /**
+     * Releases resources associated with the current session of DrmManagerClient.
+     *
+     * It is considered good practice to call this method when the {@link DrmManagerClient} object
+     * is no longer needed in your application. After release() is called,
+     * {@link DrmManagerClient} is no longer usable since it has lost all of its required resource.
+     */
+    public void release() {
+        if (mReleased) {
+            Log.w(TAG, "You have already called release()");
+            return;
+        }
+        mReleased = true;
+        if (mEventHandler != null) {
+            mEventThread.quit();
+            mEventThread = null;
+        }
+        if (mInfoHandler != null) {
+            mInfoThread.quit();
+            mInfoThread = null;
+        }
+        mEventHandler = null;
+        mInfoHandler = null;
+        mOnEventListener = null;
+        mOnInfoListener = null;
+        mOnErrorListener = null;
+        _release(mUniqueId);
+    }
+
+
+    private void createListeners() {
+        if (mEventHandler == null && mInfoHandler == null) {
+            mInfoThread = new HandlerThread("DrmManagerClient.InfoHandler");
+            mInfoThread.start();
+            mInfoHandler = new InfoHandler(mInfoThread.getLooper());
+
+            mEventThread = new HandlerThread("DrmManagerClient.EventHandler");
+            mEventThread.start();
+            mEventHandler = new EventHandler(mEventThread.getLooper());
+            _setListeners(mUniqueId, new WeakReference<DrmManagerClient>(this));
+        }
+    }
+
+
+    /**
      * Registers an {@link DrmManagerClient.OnInfoListener} callback, which is invoked when the 
      * DRM framework sends status or warning information during registration or rights acquisition.
      *
      * @param infoListener Interface definition for the callback.
      */
     public synchronized void setOnInfoListener(OnInfoListener infoListener) {
+        mOnInfoListener = infoListener;
         if (null != infoListener) {
-            mOnInfoListener = infoListener;
+            createListeners();
         }
     }
 
@@ -274,8 +318,9 @@
      * @param eventListener Interface definition for the callback.
      */
     public synchronized void setOnEventListener(OnEventListener eventListener) {
+        mOnEventListener = eventListener;
         if (null != eventListener) {
-            mOnEventListener = eventListener;
+            createListeners();
         }
     }
 
@@ -286,8 +331,9 @@
      * @param errorListener Interface definition for the callback.
      */
     public synchronized void setOnErrorListener(OnErrorListener errorListener) {
+        mOnErrorListener = errorListener;
         if (null != errorListener) {
-            mOnErrorListener = errorListener;
+            createListeners();
         }
     }
 
@@ -792,9 +838,11 @@
     }
 
     // private native interfaces
-    private native int _initialize(Object weak_this);
+    private native int _initialize();
 
-    private native void _finalize(int uniqueId);
+    private native void _setListeners(int uniqueId, Object weak_this);
+
+    private native void _release(int uniqueId);
 
     private native void _installDrmEngine(int uniqueId, String engineFilepath);
 
diff --git a/drm/jni/android_drm_DrmManagerClient.cpp b/drm/jni/android_drm_DrmManagerClient.cpp
index 80a8447..cf58177 100644
--- a/drm/jni/android_drm_DrmManagerClient.cpp
+++ b/drm/jni/android_drm_DrmManagerClient.cpp
@@ -77,7 +77,7 @@
             env->ReleaseStringUTFChars(valueString, bytes);
             delete [] data; data = NULL;
         } else {
-            LOGV("Failed to retrieve the data from the field %s", fieldName);
+            ALOGV("Failed to retrieve the data from the field %s", fieldName);
         }
     }
     return dataString;
@@ -169,7 +169,7 @@
     jclass clazz = env->GetObjectClass(thiz);
 
     if (clazz == NULL) {
-        LOGE("Can't find android/drm/DrmManagerClient");
+        ALOGE("Can't find android/drm/DrmManagerClient");
         jniThrowException(env, "java/lang/Exception", NULL);
         return;
     }
@@ -188,7 +188,7 @@
     jint type = event.getType();
     JNIEnv *env = AndroidRuntime::getJNIEnv();
     jstring message = env->NewStringUTF(event.getMessage().string());
-    LOGV("JNIOnInfoListener::onInfo => %d | %d | %s", uniqueId, type, event.getMessage().string());
+    ALOGV("JNIOnInfoListener::onInfo => %d | %d | %s", uniqueId, type, event.getMessage().string());
 
     env->CallStaticVoidMethod(
             mClass,
@@ -225,25 +225,32 @@
 }
 
 static jint android_drm_DrmManagerClient_initialize(
-        JNIEnv* env, jobject thiz, jobject weak_thiz) {
-    LOGV("initialize - Enter");
+        JNIEnv* env, jobject thiz) {
+    ALOGV("initialize - Enter");
 
     int uniqueId = 0;
     sp<DrmManagerClientImpl> drmManager = DrmManagerClientImpl::create(&uniqueId, false);
     drmManager->addClient(uniqueId);
 
-    // Set the listener to DrmManager
-    sp<DrmManagerClient::OnInfoListener> listener = new JNIOnInfoListener(env, thiz, weak_thiz);
-    drmManager->setOnInfoListener(uniqueId, listener);
-
     setDrmManagerClientImpl(env, thiz, drmManager);
-    LOGV("initialize - Exit");
-
+    ALOGV("initialize - Exit");
     return uniqueId;
 }
 
-static void android_drm_DrmManagerClient_finalize(JNIEnv* env, jobject thiz, jint uniqueId) {
-    LOGV("finalize - Enter");
+static void android_drm_DrmManagerClient_setListeners(
+        JNIEnv* env, jobject thiz, jint uniqueId, jobject weak_thiz) {
+    ALOGV("setListeners - Enter");
+
+    // Set the listener to DrmManager
+    sp<DrmManagerClient::OnInfoListener> listener = new JNIOnInfoListener(env, thiz, weak_thiz);
+    getDrmManagerClientImpl(env, thiz)->setOnInfoListener(uniqueId, listener);
+
+    ALOGV("setListeners - Exit");
+}
+
+static void android_drm_DrmManagerClient_release(
+        JNIEnv* env, jobject thiz, jint uniqueId) {
+    ALOGV("release - Enter");
     DrmManagerClientImpl::remove(uniqueId);
     getDrmManagerClientImpl(env, thiz)->setOnInfoListener(uniqueId, NULL);
 
@@ -252,12 +259,12 @@
         oldClient->setOnInfoListener(uniqueId, NULL);
         oldClient->removeClient(uniqueId);
     }
-    LOGV("finalize - Exit");
+    ALOGV("release - Exit");
 }
 
 static jobject android_drm_DrmManagerClient_getConstraintsFromContent(
             JNIEnv* env, jobject thiz, jint uniqueId, jstring jpath, jint usage) {
-    LOGV("GetConstraints - Enter");
+    ALOGV("GetConstraints - Enter");
 
     const String8 pathString = Utility::getStringValue(env, jpath);
     DrmConstraints* pConstraints
@@ -298,13 +305,13 @@
     }
 
     delete pConstraints; pConstraints = NULL;
-    LOGV("GetConstraints - Exit");
+    ALOGV("GetConstraints - Exit");
     return constraints;
 }
 
 static jobject android_drm_DrmManagerClient_getMetadataFromContent(
             JNIEnv* env, jobject thiz, jint uniqueId, jstring jpath) {
-    LOGV("GetMetadata - Enter");
+    ALOGV("GetMetadata - Enter");
     const String8 pathString = Utility::getStringValue(env, jpath);
     DrmMetadata* pMetadata =
             getDrmManagerClientImpl(env, thiz)->getMetadata(uniqueId, &pathString);
@@ -335,13 +342,13 @@
         }
     }
     delete pMetadata; pMetadata = NULL;
-    LOGV("GetMetadata - Exit");
+    ALOGV("GetMetadata - Exit");
     return metadata;
 }
 
 static jobjectArray android_drm_DrmManagerClient_getAllSupportInfo(
             JNIEnv* env, jobject thiz, jint uniqueId) {
-    LOGV("GetAllSupportInfo - Enter");
+    ALOGV("GetAllSupportInfo - Enter");
     DrmSupportInfo* drmSupportInfoArray = NULL;
 
     int length = 0;
@@ -382,22 +389,22 @@
     }
 
     delete [] drmSupportInfoArray; drmSupportInfoArray = NULL;
-    LOGV("GetAllSupportInfo - Exit");
+    ALOGV("GetAllSupportInfo - Exit");
     return array;
 }
 
 static void android_drm_DrmManagerClient_installDrmEngine(
             JNIEnv* env, jobject thiz, jint uniqueId, jstring engineFilePath) {
-    LOGV("installDrmEngine - Enter");
+    ALOGV("installDrmEngine - Enter");
     //getDrmManagerClient(env, thiz)
     //  ->installDrmEngine(uniqueId, Utility::getStringValue(env, engineFilePath));
-    LOGV("installDrmEngine - Exit");
+    ALOGV("installDrmEngine - Exit");
 }
 
 static jint android_drm_DrmManagerClient_saveRights(
             JNIEnv* env, jobject thiz, jint uniqueId,
             jobject drmRights, jstring rightsPath, jstring contentPath) {
-    LOGV("saveRights - Enter");
+    ALOGV("saveRights - Enter");
     int result = DRM_ERROR_UNKNOWN;
     int dataLength = 0;
     char* mData =  Utility::getByteArrayValue(env, drmRights, "mData", &dataLength);
@@ -413,24 +420,24 @@
     }
 
     delete mData; mData = NULL;
-    LOGV("saveRights - Exit");
+    ALOGV("saveRights - Exit");
     return result;
 }
 
 static jboolean android_drm_DrmManagerClient_canHandle(
             JNIEnv* env, jobject thiz, jint uniqueId, jstring path, jstring mimeType) {
-    LOGV("canHandle - Enter");
+    ALOGV("canHandle - Enter");
     jboolean result
         = getDrmManagerClientImpl(env, thiz)
             ->canHandle(uniqueId, Utility::getStringValue(env, path),
                     Utility::getStringValue(env, mimeType));
-    LOGV("canHandle - Exit");
+    ALOGV("canHandle - Exit");
     return result;
 }
 
 static jobject android_drm_DrmManagerClient_processDrmInfo(
             JNIEnv* env, jobject thiz, jint uniqueId, jobject drmInfoObject) {
-    LOGV("processDrmInfo - Enter");
+    ALOGV("processDrmInfo - Enter");
     int dataLength = 0;
     const String8 mMimeType =  Utility::getStringValue(env, drmInfoObject, "mMimeType");
     char* mData =  Utility::getByteArrayValue(env, drmInfoObject, "mData", &dataLength);
@@ -463,7 +470,7 @@
 
         String8 keyString = Utility::getStringValue(env, key);
         String8 valueString = Utility::getStringValue(env, valString);
-        LOGV("Key: %s | Value: %s", keyString.string(), valueString.string());
+        ALOGV("Key: %s | Value: %s", keyString.string(), valueString.string());
 
         drmInfo.put(keyString, valueString);
     }
@@ -506,13 +513,13 @@
     delete mData; mData = NULL;
     delete pDrmInfoStatus; pDrmInfoStatus = NULL;
 
-    LOGV("processDrmInfo - Exit");
+    ALOGV("processDrmInfo - Exit");
     return drmInfoStatus;
 }
 
 static jobject android_drm_DrmManagerClient_acquireDrmInfo(
             JNIEnv* env, jobject thiz, jint uniqueId, jobject drmInfoRequest) {
-    LOGV("acquireDrmInfo Enter");
+    ALOGV("acquireDrmInfo Enter");
     const String8 mMimeType =  Utility::getStringValue(env, drmInfoRequest, "mMimeType");
     int mInfoType = Utility::getIntValue(env, drmInfoRequest, "mInfoType");
 
@@ -536,7 +543,7 @@
 
         String8 keyString = Utility::getStringValue(env, key);
         String8 valueString = Utility::getStringValue(env, value);
-        LOGV("Key: %s | Value: %s", keyString.string(), valueString.string());
+        ALOGV("Key: %s | Value: %s", keyString.string(), valueString.string());
 
         drmInfoReq.put(keyString, valueString);
     }
@@ -576,67 +583,67 @@
 
     delete pDrmInfo; pDrmInfo = NULL;
 
-    LOGV("acquireDrmInfo Exit");
+    ALOGV("acquireDrmInfo Exit");
     return drmInfoObject;
 }
 
 static jint android_drm_DrmManagerClient_getDrmObjectType(
             JNIEnv* env, jobject thiz, jint uniqueId, jstring path, jstring mimeType) {
-    LOGV("getDrmObjectType Enter");
+    ALOGV("getDrmObjectType Enter");
     int drmObjectType
         = getDrmManagerClientImpl(env, thiz)
             ->getDrmObjectType(uniqueId, Utility::getStringValue(env, path),
                                 Utility::getStringValue(env, mimeType));
-    LOGV("getDrmObjectType Exit");
+    ALOGV("getDrmObjectType Exit");
     return drmObjectType;
 }
 
 static jstring android_drm_DrmManagerClient_getOriginalMimeType(
             JNIEnv* env, jobject thiz, jint uniqueId, jstring path) {
-    LOGV("getOriginalMimeType Enter");
+    ALOGV("getOriginalMimeType Enter");
     String8 mimeType
         = getDrmManagerClientImpl(env, thiz)
             ->getOriginalMimeType(uniqueId, Utility::getStringValue(env, path));
-    LOGV("getOriginalMimeType Exit");
+    ALOGV("getOriginalMimeType Exit");
     return env->NewStringUTF(mimeType.string());
 }
 
 static jint android_drm_DrmManagerClient_checkRightsStatus(
             JNIEnv* env, jobject thiz, jint uniqueId, jstring path, int action) {
-    LOGV("getOriginalMimeType Enter");
+    ALOGV("getOriginalMimeType Enter");
     int rightsStatus
         = getDrmManagerClientImpl(env, thiz)
             ->checkRightsStatus(uniqueId, Utility::getStringValue(env, path), action);
-    LOGV("getOriginalMimeType Exit");
+    ALOGV("getOriginalMimeType Exit");
     return rightsStatus;
 }
 
 static jint android_drm_DrmManagerClient_removeRights(
             JNIEnv* env, jobject thiz, jint uniqueId, jstring path) {
-    LOGV("removeRights");
+    ALOGV("removeRights");
     return getDrmManagerClientImpl(env, thiz)
                ->removeRights(uniqueId, Utility::getStringValue(env, path));
 }
 
 static jint android_drm_DrmManagerClient_removeAllRights(
             JNIEnv* env, jobject thiz, jint uniqueId) {
-    LOGV("removeAllRights");
+    ALOGV("removeAllRights");
     return getDrmManagerClientImpl(env, thiz)->removeAllRights(uniqueId);
 }
 
 static jint android_drm_DrmManagerClient_openConvertSession(
             JNIEnv* env, jobject thiz, jint uniqueId, jstring mimeType) {
-    LOGV("openConvertSession Enter");
+    ALOGV("openConvertSession Enter");
     int convertId
         = getDrmManagerClientImpl(env, thiz)
             ->openConvertSession(uniqueId, Utility::getStringValue(env, mimeType));
-    LOGV("openConvertSession Exit");
+    ALOGV("openConvertSession Exit");
     return convertId;
 }
 
 static jobject android_drm_DrmManagerClient_convertData(
             JNIEnv* env, jobject thiz, jint uniqueId, jint convertId, jbyteArray inputData) {
-    LOGV("convertData Enter");
+    ALOGV("convertData Enter");
 
     int dataLength = 0;
     char* mData = Utility::getByteArrayValue(env, inputData, &dataLength);
@@ -671,14 +678,14 @@
     delete mData; mData = NULL;
     delete pDrmConvertedStatus; pDrmConvertedStatus = NULL;
 
-    LOGV("convertData - Exit");
+    ALOGV("convertData - Exit");
     return drmConvertedStatus;
 }
 
 static jobject android_drm_DrmManagerClient_closeConvertSession(
             JNIEnv* env, jobject thiz, int uniqueId, jint convertId) {
 
-    LOGV("closeConvertSession Enter");
+    ALOGV("closeConvertSession Enter");
 
     DrmConvertedStatus* pDrmConvertedStatus
                 = getDrmManagerClientImpl(env, thiz)->closeConvertSession(uniqueId, convertId);
@@ -708,17 +715,20 @@
 
     delete pDrmConvertedStatus; pDrmConvertedStatus = NULL;
 
-    LOGV("closeConvertSession - Exit");
+    ALOGV("closeConvertSession - Exit");
     return drmConvertedStatus;
 }
 
 static JNINativeMethod nativeMethods[] = {
 
-    {"_initialize", "(Ljava/lang/Object;)I",
+    {"_initialize", "()I",
                                     (void*)android_drm_DrmManagerClient_initialize},
 
-    {"_finalize", "(I)V",
-                                    (void*)android_drm_DrmManagerClient_finalize},
+    {"_setListeners", "(ILjava/lang/Object;)V",
+                                    (void*)android_drm_DrmManagerClient_setListeners},
+
+    {"_release", "(I)V",
+                                    (void*)android_drm_DrmManagerClient_release},
 
     {"_getConstraints", "(ILjava/lang/String;I)Landroid/content/ContentValues;",
                                     (void*)android_drm_DrmManagerClient_getConstraintsFromContent},
diff --git a/drm/libdrmframework/DrmManagerClientImpl.cpp b/drm/libdrmframework/DrmManagerClientImpl.cpp
index 67f58ca..b222b8f 100644
--- a/drm/libdrmframework/DrmManagerClientImpl.cpp
+++ b/drm/libdrmframework/DrmManagerClientImpl.cpp
@@ -54,7 +54,7 @@
             if (binder != 0) {
                 break;
             }
-            LOGW("DrmManagerService not published, waiting...");
+            ALOGW("DrmManagerService not published, waiting...");
             struct timespec reqt;
             reqt.tv_sec  = 0;
             reqt.tv_nsec = 500000000; //0.5 sec
@@ -342,6 +342,6 @@
 void DrmManagerClientImpl::DeathNotifier::binderDied(const wp<IBinder>& who) {
     Mutex::Autolock lock(sMutex);
     DrmManagerClientImpl::sDrmManagerService.clear();
-    LOGW("DrmManager server died!");
+    ALOGW("DrmManager server died!");
 }
 
diff --git a/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp b/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp
index 57ef799..576ed15 100644
--- a/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp
+++ b/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp
@@ -24,7 +24,7 @@
 
 #ifdef DRM_OMA_FL_ENGINE_DEBUG
 #define LOG_NDEBUG 0
-#define LOG_DEBUG(...) LOGD(__VA_ARGS__)
+#define LOG_DEBUG(...) ALOGD(__VA_ARGS__)
 #else
 #define LOG_DEBUG(...)
 #endif
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
index e184545..0273a4b 100644
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
+++ b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
@@ -43,7 +43,7 @@
 
 #ifdef DRM_OMA_FL_ENGINE_DEBUG
 #define LOG_NDEBUG 0
-#define LOG_VERBOSE(...) LOGV(__VA_ARGS__)
+#define LOG_VERBOSE(...) ALOGV(__VA_ARGS__)
 #else
 #define LOG_VERBOSE(...)
 #endif
@@ -92,12 +92,12 @@
         case FwdLockConv_Status_InvalidArgument:
         case FwdLockConv_Status_UnsupportedFileFormat:
         case FwdLockConv_Status_UnsupportedContentTransferEncoding:
-            LOGE("FwdLockEngine getConvertedStatus: file conversion Error %d. "
+            ALOGE("FwdLockEngine getConvertedStatus: file conversion Error %d. "
                   "Returning STATUS_INPUTDATA_ERROR", status);
             retStatus = DrmConvertedStatus::STATUS_INPUTDATA_ERROR;
             break;
         default:
-            LOGE("FwdLockEngine getConvertedStatus: file conversion Error %d. "
+            ALOGE("FwdLockEngine getConvertedStatus: file conversion Error %d. "
                   "Returning STATUS_ERROR", status);
             retStatus = DrmConvertedStatus::STATUS_ERROR;
             break;
@@ -139,7 +139,7 @@
     if (FwdLockGlue_InitializeKeyEncryption()) {
         LOG_VERBOSE("FwdLockEngine::onInitialize -- FwdLockGlue_InitializeKeyEncryption succeeded");
     } else {
-        LOGE("FwdLockEngine::onInitialize -- FwdLockGlue_InitializeKeyEncryption failed:"
+        ALOGE("FwdLockEngine::onInitialize -- FwdLockGlue_InitializeKeyEncryption failed:"
              "errno = %d", errno);
     }
 
@@ -351,7 +351,7 @@
             convertSessionMap.addValue(convertId, newSession);
             result = DRM_NO_ERROR;
         } else {
-            LOGE("FwdLockEngine::onOpenConvertSession -- FwdLockConv_OpenSession failed.");
+            ALOGE("FwdLockEngine::onOpenConvertSession -- FwdLockConv_OpenSession failed.");
             delete newSession;
         }
     }
@@ -448,7 +448,7 @@
         (!decodeSessionMap.isCreated(decryptHandle->decryptId))) {
         fileDesc = dup(fd);
     } else {
-        LOGE("FwdLockEngine::onOpenDecryptSession parameter error");
+        ALOGE("FwdLockEngine::onOpenDecryptSession parameter error");
         return result;
     }
 
@@ -550,13 +550,13 @@
                                                 DecryptHandle* decryptHandle,
                                                 int decryptUnitId,
                                                 const DrmBuffer* headerInfo) {
-    LOGE("FwdLockEngine::onInitializeDecryptUnit is not supported for this DRM scheme");
+    ALOGE("FwdLockEngine::onInitializeDecryptUnit is not supported for this DRM scheme");
     return DRM_ERROR_UNKNOWN;
 }
 
 status_t FwdLockEngine::onDecrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
             const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
-    LOGE("FwdLockEngine::onDecrypt is not supported for this DRM scheme");
+    ALOGE("FwdLockEngine::onDecrypt is not supported for this DRM scheme");
     return DRM_ERROR_UNKNOWN;
 }
 
@@ -565,14 +565,14 @@
                                   int decryptUnitId,
                                   const DrmBuffer* encBuffer,
                                   DrmBuffer** decBuffer) {
-    LOGE("FwdLockEngine::onDecrypt is not supported for this DRM scheme");
+    ALOGE("FwdLockEngine::onDecrypt is not supported for this DRM scheme");
     return DRM_ERROR_UNKNOWN;
 }
 
 status_t FwdLockEngine::onFinalizeDecryptUnit(int uniqueId,
                                               DecryptHandle* decryptHandle,
                                               int decryptUnitId) {
-    LOGE("FwdLockEngine::onFinalizeDecryptUnit is not supported for this DRM scheme");
+    ALOGE("FwdLockEngine::onFinalizeDecryptUnit is not supported for this DRM scheme");
     return DRM_ERROR_UNKNOWN;
 }
 
@@ -650,11 +650,11 @@
         if (((off_t)-1) != decoderSession->offset) {
             bytesRead = onRead(uniqueId, decryptHandle, buffer, numBytes);
             if (bytesRead < 0) {
-                LOGE("FwdLockEngine::onPread error reading");
+                ALOGE("FwdLockEngine::onPread error reading");
             }
         }
     } else {
-        LOGE("FwdLockEngine::onPread decryptId not found");
+        ALOGE("FwdLockEngine::onPread decryptId not found");
     }
 
     return bytesRead;
diff --git a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
index 976978f..0ffc0a7 100644
--- a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
+++ b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
@@ -58,7 +58,7 @@
 
 DrmConstraints* DrmPassthruPlugIn::onGetConstraints(
         int uniqueId, const String8* path, int action) {
-    LOGD("DrmPassthruPlugIn::onGetConstraints From Path: %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onGetConstraints From Path: %d", uniqueId);
     DrmConstraints* drmConstraints = new DrmConstraints();
 
     String8 value("dummy_available_time");
@@ -73,7 +73,7 @@
 }
 
 DrmInfoStatus* DrmPassthruPlugIn::onProcessDrmInfo(int uniqueId, const DrmInfo* drmInfo) {
-    LOGD("DrmPassthruPlugIn::onProcessDrmInfo - Enter : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onProcessDrmInfo - Enter : %d", uniqueId);
     DrmInfoStatus* drmInfoStatus = NULL;
     if (NULL != drmInfo) {
         switch (drmInfo->getInfoType()) {
@@ -102,28 +102,28 @@
         }
         }
     }
-    LOGD("DrmPassthruPlugIn::onProcessDrmInfo - Exit");
+    ALOGD("DrmPassthruPlugIn::onProcessDrmInfo - Exit");
     return drmInfoStatus;
 }
 
 status_t DrmPassthruPlugIn::onSetOnInfoListener(
             int uniqueId, const IDrmEngine::OnInfoListener* infoListener) {
-    LOGD("DrmPassthruPlugIn::onSetOnInfoListener : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onSetOnInfoListener : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
 status_t DrmPassthruPlugIn::onInitialize(int uniqueId) {
-    LOGD("DrmPassthruPlugIn::onInitialize : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onInitialize : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
 status_t DrmPassthruPlugIn::onTerminate(int uniqueId) {
-    LOGD("DrmPassthruPlugIn::onTerminate : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onTerminate : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
 DrmSupportInfo* DrmPassthruPlugIn::onGetSupportInfo(int uniqueId) {
-    LOGD("DrmPassthruPlugIn::onGetSupportInfo : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onGetSupportInfo : %d", uniqueId);
     DrmSupportInfo* drmSupportInfo = new DrmSupportInfo();
     // Add mimetype's
     drmSupportInfo->addMimeType(String8("application/vnd.passthru.drm"));
@@ -136,12 +136,12 @@
 
 status_t DrmPassthruPlugIn::onSaveRights(int uniqueId, const DrmRights& drmRights,
             const String8& rightsPath, const String8& contentPath) {
-    LOGD("DrmPassthruPlugIn::onSaveRights : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onSaveRights : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
 DrmInfo* DrmPassthruPlugIn::onAcquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest) {
-    LOGD("DrmPassthruPlugIn::onAcquireDrmInfo : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onAcquireDrmInfo : %d", uniqueId);
     DrmInfo* drmInfo = NULL;
 
     if (NULL != drmInfoRequest) {
@@ -157,65 +157,65 @@
 }
 
 bool DrmPassthruPlugIn::onCanHandle(int uniqueId, const String8& path) {
-    LOGD("DrmPassthruPlugIn::canHandle: %s ", path.string());
+    ALOGD("DrmPassthruPlugIn::canHandle: %s ", path.string());
     String8 extension = path.getPathExtension();
     extension.toLower();
     return (String8(".passthru") == extension);
 }
 
 String8 DrmPassthruPlugIn::onGetOriginalMimeType(int uniqueId, const String8& path) {
-    LOGD("DrmPassthruPlugIn::onGetOriginalMimeType() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onGetOriginalMimeType() : %d", uniqueId);
     return String8("video/passthru");
 }
 
 int DrmPassthruPlugIn::onGetDrmObjectType(
             int uniqueId, const String8& path, const String8& mimeType) {
-    LOGD("DrmPassthruPlugIn::onGetDrmObjectType() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onGetDrmObjectType() : %d", uniqueId);
     return DrmObjectType::UNKNOWN;
 }
 
 int DrmPassthruPlugIn::onCheckRightsStatus(int uniqueId, const String8& path, int action) {
-    LOGD("DrmPassthruPlugIn::onCheckRightsStatus() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onCheckRightsStatus() : %d", uniqueId);
     int rightsStatus = RightsStatus::RIGHTS_VALID;
     return rightsStatus;
 }
 
 status_t DrmPassthruPlugIn::onConsumeRights(int uniqueId, DecryptHandle* decryptHandle,
             int action, bool reserve) {
-    LOGD("DrmPassthruPlugIn::onConsumeRights() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onConsumeRights() : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
 status_t DrmPassthruPlugIn::onSetPlaybackStatus(int uniqueId, DecryptHandle* decryptHandle,
             int playbackStatus, int64_t position) {
-    LOGD("DrmPassthruPlugIn::onSetPlaybackStatus() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onSetPlaybackStatus() : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
 bool DrmPassthruPlugIn::onValidateAction(int uniqueId, const String8& path,
             int action, const ActionDescription& description) {
-    LOGD("DrmPassthruPlugIn::onValidateAction() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onValidateAction() : %d", uniqueId);
     return true;
 }
 
 status_t DrmPassthruPlugIn::onRemoveRights(int uniqueId, const String8& path) {
-    LOGD("DrmPassthruPlugIn::onRemoveRights() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onRemoveRights() : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
 status_t DrmPassthruPlugIn::onRemoveAllRights(int uniqueId) {
-    LOGD("DrmPassthruPlugIn::onRemoveAllRights() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onRemoveAllRights() : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
 status_t DrmPassthruPlugIn::onOpenConvertSession(int uniqueId, int convertId) {
-    LOGD("DrmPassthruPlugIn::onOpenConvertSession() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onOpenConvertSession() : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
 DrmConvertedStatus* DrmPassthruPlugIn::onConvertData(
             int uniqueId, int convertId, const DrmBuffer* inputData) {
-    LOGD("DrmPassthruPlugIn::onConvertData() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onConvertData() : %d", uniqueId);
     DrmBuffer* convertedData = NULL;
 
     if (NULL != inputData && 0 < inputData->length) {
@@ -229,13 +229,13 @@
 }
 
 DrmConvertedStatus* DrmPassthruPlugIn::onCloseConvertSession(int uniqueId, int convertId) {
-    LOGD("DrmPassthruPlugIn::onCloseConvertSession() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onCloseConvertSession() : %d", uniqueId);
     return new DrmConvertedStatus(DrmConvertedStatus::STATUS_OK, NULL, 0 /*offset*/);
 }
 
 status_t DrmPassthruPlugIn::onOpenDecryptSession(
             int uniqueId, DecryptHandle* decryptHandle, int fd, off64_t offset, off64_t length) {
-    LOGD("DrmPassthruPlugIn::onOpenDecryptSession() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onOpenDecryptSession() : %d", uniqueId);
 
 #ifdef ENABLE_PASSTHRU_DECRYPTION
     decryptHandle->mimeType = String8("video/passthru");
@@ -254,7 +254,7 @@
 }
 
 status_t DrmPassthruPlugIn::onCloseDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
-    LOGD("DrmPassthruPlugIn::onCloseDecryptSession() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onCloseDecryptSession() : %d", uniqueId);
     if (NULL != decryptHandle) {
         if (NULL != decryptHandle->decryptInfo) {
             delete decryptHandle->decryptInfo; decryptHandle->decryptInfo = NULL;
@@ -266,13 +266,13 @@
 
 status_t DrmPassthruPlugIn::onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
             int decryptUnitId, const DrmBuffer* headerInfo) {
-    LOGD("DrmPassthruPlugIn::onInitializeDecryptUnit() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onInitializeDecryptUnit() : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
 status_t DrmPassthruPlugIn::onDecrypt(int uniqueId, DecryptHandle* decryptHandle,
             int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
-    LOGD("DrmPassthruPlugIn::onDecrypt() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onDecrypt() : %d", uniqueId);
     /**
      * As a workaround implementation passthru would copy the given
      * encrypted buffer as it is to decrypted buffer. Note, decBuffer
@@ -287,13 +287,13 @@
 
 status_t DrmPassthruPlugIn::onFinalizeDecryptUnit(
             int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
-    LOGD("DrmPassthruPlugIn::onFinalizeDecryptUnit() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onFinalizeDecryptUnit() : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
 ssize_t DrmPassthruPlugIn::onPread(int uniqueId, DecryptHandle* decryptHandle,
             void* buffer, ssize_t numBytes, off64_t offset) {
-    LOGD("DrmPassthruPlugIn::onPread() : %d", uniqueId);
+    ALOGD("DrmPassthruPlugIn::onPread() : %d", uniqueId);
     return 0;
 }
 
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index af03ee2..bc1db4d 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -47,7 +47,7 @@
 #include <gui/SurfaceTextureClient.h>
 #include <android_runtime/android_graphics_SurfaceTexture.h>
 
-//#define LOG_API LOGE
+//#define LOG_API ALOGE
 #define LOG_API(...)
 
 using namespace android;
@@ -262,7 +262,7 @@
                                  &receiveLen, sizeof(receiveLen),
                                  &subID, sizeof(subID));
     if (!id && receiveLen) {
-        LOGV("message receive buffer too small.  %i", receiveLen);
+        ALOGV("message receive buffer too small.  %i", receiveLen);
     }
     return _env->NewStringUTF(buf);
 }
@@ -280,7 +280,7 @@
                                  &receiveLen, sizeof(receiveLen),
                                  &subID, sizeof(subID));
     if (!id && receiveLen) {
-        LOGV("message receive buffer too small.  %i", receiveLen);
+        ALOGV("message receive buffer too small.  %i", receiveLen);
     }
     _env->ReleaseIntArrayElements(data, ptr, 0);
     return id;
@@ -709,7 +709,7 @@
 static int
 nFileA3DCreateFromAssetStream(JNIEnv *_env, jobject _this, RsContext con, jint native_asset)
 {
-    LOGV("______nFileA3D %u", (uint32_t) native_asset);
+    ALOGV("______nFileA3D %u", (uint32_t) native_asset);
 
     Asset* asset = reinterpret_cast<Asset*>(native_asset);
 
@@ -755,7 +755,7 @@
 static void
 nFileA3DGetIndexEntries(JNIEnv *_env, jobject _this, RsContext con, jint fileA3D, jint numEntries, jintArray _ids, jobjectArray _entries)
 {
-    LOGV("______nFileA3D %u", (uint32_t) fileA3D);
+    ALOGV("______nFileA3D %u", (uint32_t) fileA3D);
     RsFileIndexEntry *fileEntries = (RsFileIndexEntry*)malloc((uint32_t)numEntries * sizeof(RsFileIndexEntry));
 
     rsaFileA3DGetIndexEntries(con, fileEntries, (uint32_t)numEntries, (RsFile)fileA3D);
@@ -771,7 +771,7 @@
 static int
 nFileA3DGetEntryByIndex(JNIEnv *_env, jobject _this, RsContext con, jint fileA3D, jint index)
 {
-    LOGV("______nFileA3D %u", (uint32_t) fileA3D);
+    ALOGV("______nFileA3D %u", (uint32_t) fileA3D);
     jint id = (jint)rsaFileA3DGetEntryByIndex(con, (uint32_t)index, (RsFile)fileA3D);
     return id;
 }
@@ -1333,13 +1333,13 @@
     jint result = -1;
 
     if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
-        LOGE("ERROR: GetEnv failed\n");
+        ALOGE("ERROR: GetEnv failed\n");
         goto bail;
     }
     assert(env != NULL);
 
     if (registerFuncs(env) < 0) {
-        LOGE("ERROR: MediaPlayer native registration failed\n");
+        ALOGE("ERROR: MediaPlayer native registration failed\n");
         goto bail;
     }
 
diff --git a/include/androidfw/Asset.h b/include/androidfw/Asset.h
new file mode 100644
index 0000000..3c57b1c
--- /dev/null
+++ b/include/androidfw/Asset.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <utils/Asset.h>
diff --git a/include/androidfw/AssetManager.h b/include/androidfw/AssetManager.h
new file mode 100644
index 0000000..8cc3531
--- /dev/null
+++ b/include/androidfw/AssetManager.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <utils/AssetManager.h>
diff --git a/include/androidfw/KeycodeLabels.h b/include/androidfw/KeycodeLabels.h
new file mode 100644
index 0000000..615a627
--- /dev/null
+++ b/include/androidfw/KeycodeLabels.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <ui/KeycodeLabels.h>
diff --git a/include/androidfw/ResourceTypes.h b/include/androidfw/ResourceTypes.h
new file mode 100644
index 0000000..70cdc88
--- /dev/null
+++ b/include/androidfw/ResourceTypes.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <utils/ResourceTypes.h>
diff --git a/include/binder/CursorWindow.h b/include/binder/CursorWindow.h
index f0284de..8a2979a 100644
--- a/include/binder/CursorWindow.h
+++ b/include/binder/CursorWindow.h
@@ -31,8 +31,8 @@
 
 #else
 
-#define IF_LOG_WINDOW() IF_LOG(LOG_DEBUG, "CursorWindow")
-#define LOG_WINDOW(...) LOG(LOG_DEBUG, "CursorWindow", __VA_ARGS__)
+#define IF_LOG_WINDOW() IF_ALOG(LOG_DEBUG, "CursorWindow")
+#define LOG_WINDOW(...) ALOG(LOG_DEBUG, "CursorWindow", __VA_ARGS__)
 
 #endif
 
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
new file mode 100644
index 0000000..c1862b7
--- /dev/null
+++ b/include/gui/Surface.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <surfaceflinger/Surface.h>
diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h
new file mode 100644
index 0000000..6cc6390
--- /dev/null
+++ b/include/gui/SurfaceComposerClient.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <surfaceflinger/SurfaceComposerClient.h>
diff --git a/include/utils/KeyedVector.h b/include/utils/KeyedVector.h
index 6bcdea4..65165a2 100644
--- a/include/utils/KeyedVector.h
+++ b/include/utils/KeyedVector.h
@@ -122,7 +122,7 @@
 
 template<typename KEY, typename VALUE> inline
 const VALUE& KeyedVector<KEY,VALUE>::valueFor(const KEY& key) const {
-    ssize_t i = indexOfKey(key);
+    ssize_t i = this->indexOfKey(key);
     assert(i>=0);
     return mVector.itemAt(i).value;
 }
@@ -139,7 +139,7 @@
 
 template<typename KEY, typename VALUE> inline
 VALUE& KeyedVector<KEY,VALUE>::editValueFor(const KEY& key) {
-    ssize_t i = indexOfKey(key);
+    ssize_t i = this->indexOfKey(key);
     assert(i>=0);
     return mVector.editItemAt(i).value;
 }
@@ -190,7 +190,7 @@
 
 template<typename KEY, typename VALUE> inline
 const VALUE& DefaultKeyedVector<KEY,VALUE>::valueFor(const KEY& key) const {
-    ssize_t i = indexOfKey(key);
+    ssize_t i = this->indexOfKey(key);
     return i >= 0 ? KeyedVector<KEY,VALUE>::valueAt(i) : mDefault;
 }
 
diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h
index 612ff93..71e5324 100644
--- a/include/utils/ResourceTypes.h
+++ b/include/utils/ResourceTypes.h
@@ -1277,7 +1277,7 @@
                     myDelta += requested->screenHeightDp - screenHeightDp;
                     otherDelta += requested->screenHeightDp - o.screenHeightDp;
                 }
-                //LOGI("Comparing this %dx%d to other %dx%d in %dx%d: myDelta=%d otherDelta=%d",
+                //ALOGI("Comparing this %dx%d to other %dx%d in %dx%d: myDelta=%d otherDelta=%d",
                 //    screenWidthDp, screenHeightDp, o.screenWidthDp, o.screenHeightDp,
                 //    requested->screenWidthDp, requested->screenHeightDp, myDelta, otherDelta);
                 return (myDelta <= otherDelta);
@@ -1506,11 +1506,11 @@
         }
         if (screenSizeDp != 0) {
             if (screenWidthDp != 0 && screenWidthDp > settings.screenWidthDp) {
-                //LOGI("Filtering out width %d in requested %d", screenWidthDp, settings.screenWidthDp);
+                //ALOGI("Filtering out width %d in requested %d", screenWidthDp, settings.screenWidthDp);
                 return false;
             }
             if (screenHeightDp != 0 && screenHeightDp > settings.screenHeightDp) {
-                //LOGI("Filtering out height %d in requested %d", screenHeightDp, settings.screenHeightDp);
+                //ALOGI("Filtering out height %d in requested %d", screenHeightDp, settings.screenHeightDp);
                 return false;
             }
         }
@@ -1530,9 +1530,9 @@
                 // For compatibility, we count a request for KEYSHIDDEN_NO as also
                 // matching the more recent KEYSHIDDEN_SOFT.  Basically
                 // KEYSHIDDEN_NO means there is some kind of keyboard available.
-                //LOGI("Matching keysHidden: have=%d, config=%d\n", keysHidden, setKeysHidden);
+                //ALOGI("Matching keysHidden: have=%d, config=%d\n", keysHidden, setKeysHidden);
                 if (keysHidden != KEYSHIDDEN_NO || setKeysHidden != KEYSHIDDEN_SOFT) {
-                    //LOGI("No match!");
+                    //ALOGI("No match!");
                     return false;
                 }
             }
diff --git a/libs/androidfw/Android.mk b/libs/androidfw/Android.mk
new file mode 100644
index 0000000..a0e1dad
--- /dev/null
+++ b/libs/androidfw/Android.mk
@@ -0,0 +1,21 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES:= Dummy.cpp
+LOCAL_MODULE:= libandroidfw
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_SHARED_LIBRARY)
diff --git a/libs/androidfw/Dummy.cpp b/libs/androidfw/Dummy.cpp
new file mode 100644
index 0000000..f4f0f54
--- /dev/null
+++ b/libs/androidfw/Dummy.cpp
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+void Dummy() {
+}
diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp
index 9945f91..e20d8a3 100644
--- a/libs/binder/Binder.cpp
+++ b/libs/binder/Binder.cpp
@@ -89,7 +89,7 @@
     // This is a local static rather than a global static,
     // to avoid static initializer ordering issues.
     static String16 sEmptyDescriptor;
-    LOGW("reached BBinder::getInterfaceDescriptor (this=%p)", this);
+    ALOGW("reached BBinder::getInterfaceDescriptor (this=%p)", this);
     return sEmptyDescriptor;
 }
 
diff --git a/libs/binder/BpBinder.cpp b/libs/binder/BpBinder.cpp
index 5de87ec..47a62db 100644
--- a/libs/binder/BpBinder.cpp
+++ b/libs/binder/BpBinder.cpp
@@ -24,8 +24,8 @@
 
 #include <stdio.h>
 
-//#undef LOGV
-//#define LOGV(...) fprintf(stderr, __VA_ARGS__)
+//#undef ALOGV
+//#define ALOGV(...) fprintf(stderr, __VA_ARGS__)
 
 namespace android {
 
@@ -50,7 +50,7 @@
     e.func = func;
 
     if (mObjects.indexOfKey(objectID) >= 0) {
-        LOGE("Trying to attach object ID %p to binder ObjectManager %p with object %p, but object ID already in use",
+        ALOGE("Trying to attach object ID %p to binder ObjectManager %p with object %p, but object ID already in use",
                 objectID, this,  object);
         return;
     }
@@ -73,7 +73,7 @@
 void BpBinder::ObjectManager::kill()
 {
     const size_t N = mObjects.size();
-    LOGV("Killing %d objects in manager %p", N, this);
+    ALOGV("Killing %d objects in manager %p", N, this);
     for (size_t i=0; i<N; i++) {
         const entry_t& e = mObjects.valueAt(i);
         if (e.func != NULL) {
@@ -92,7 +92,7 @@
     , mObitsSent(0)
     , mObituaries(NULL)
 {
-    LOGV("Creating BpBinder %p handle %d\n", this, mHandle);
+    ALOGV("Creating BpBinder %p handle %d\n", this, mHandle);
 
     extendObjectLifetime(OBJECT_LIFETIME_WEAK);
     IPCThreadState::self()->incWeakHandle(handle);
@@ -190,7 +190,7 @@
                 if (!mObituaries) {
                     return NO_MEMORY;
                 }
-                LOGV("Requesting death notification: %p handle %d\n", this, mHandle);
+                ALOGV("Requesting death notification: %p handle %d\n", this, mHandle);
                 getWeakRefs()->incWeak(this);
                 IPCThreadState* self = IPCThreadState::self();
                 self->requestDeathNotification(mHandle, this);
@@ -226,7 +226,7 @@
             }
             mObituaries->removeAt(i);
             if (mObituaries->size() == 0) {
-                LOGV("Clearing death notification: %p handle %d\n", this, mHandle);
+                ALOGV("Clearing death notification: %p handle %d\n", this, mHandle);
                 IPCThreadState* self = IPCThreadState::self();
                 self->clearDeathNotification(mHandle, this);
                 self->flushCommands();
@@ -242,7 +242,7 @@
 
 void BpBinder::sendObituary()
 {
-    LOGV("Sending obituary for proxy %p handle %d, mObitsSent=%s\n",
+    ALOGV("Sending obituary for proxy %p handle %d, mObitsSent=%s\n",
         this, mHandle, mObitsSent ? "true" : "false");
 
     mAlive = 0;
@@ -251,7 +251,7 @@
     mLock.lock();
     Vector<Obituary>* obits = mObituaries;
     if(obits != NULL) {
-        LOGV("Clearing sent death notification: %p handle %d\n", this, mHandle);
+        ALOGV("Clearing sent death notification: %p handle %d\n", this, mHandle);
         IPCThreadState* self = IPCThreadState::self();
         self->clearDeathNotification(mHandle, this);
         self->flushCommands();
@@ -260,7 +260,7 @@
     mObitsSent = 1;
     mLock.unlock();
 
-    LOGV("Reporting death of proxy %p for %d recipients\n",
+    ALOGV("Reporting death of proxy %p for %d recipients\n",
         this, obits ? obits->size() : 0);
 
     if (obits != NULL) {
@@ -276,7 +276,7 @@
 void BpBinder::reportOneDeath(const Obituary& obit)
 {
     sp<DeathRecipient> recipient = obit.recipient.promote();
-    LOGV("Reporting death to recipient: %p\n", recipient.get());
+    ALOGV("Reporting death to recipient: %p\n", recipient.get());
     if (recipient == NULL) return;
 
     recipient->binderDied(this);
@@ -288,7 +288,7 @@
     object_cleanup_func func)
 {
     AutoMutex _l(mLock);
-    LOGV("Attaching object %p to binder %p (manager=%p)", object, this, &mObjects);
+    ALOGV("Attaching object %p to binder %p (manager=%p)", object, this, &mObjects);
     mObjects.attach(objectID, object, cleanupCookie, func);
 }
 
@@ -311,7 +311,7 @@
 
 BpBinder::~BpBinder()
 {
-    LOGV("Destroying BpBinder %p handle %d\n", this, mHandle);
+    ALOGV("Destroying BpBinder %p handle %d\n", this, mHandle);
 
     IPCThreadState* ipc = IPCThreadState::self();
 
@@ -338,15 +338,15 @@
 
 void BpBinder::onFirstRef()
 {
-    LOGV("onFirstRef BpBinder %p handle %d\n", this, mHandle);
+    ALOGV("onFirstRef BpBinder %p handle %d\n", this, mHandle);
     IPCThreadState* ipc = IPCThreadState::self();
     if (ipc) ipc->incStrongHandle(mHandle);
 }
 
 void BpBinder::onLastStrongRef(const void* id)
 {
-    LOGV("onLastStrongRef BpBinder %p handle %d\n", this, mHandle);
-    IF_LOGV() {
+    ALOGV("onLastStrongRef BpBinder %p handle %d\n", this, mHandle);
+    IF_ALOGV() {
         printRefs();
     }
     IPCThreadState* ipc = IPCThreadState::self();
@@ -355,7 +355,7 @@
 
 bool BpBinder::onIncStrongAttempted(uint32_t flags, const void* id)
 {
-    LOGV("onIncStrongAttempted BpBinder %p handle %d\n", this, mHandle);
+    ALOGV("onIncStrongAttempted BpBinder %p handle %d\n", this, mHandle);
     IPCThreadState* ipc = IPCThreadState::self();
     return ipc ? ipc->attemptIncStrongHandle(mHandle) == NO_ERROR : false;
 }
diff --git a/libs/binder/CursorWindow.cpp b/libs/binder/CursorWindow.cpp
index 0733378..a6e5f71 100644
--- a/libs/binder/CursorWindow.cpp
+++ b/libs/binder/CursorWindow.cpp
@@ -150,7 +150,7 @@
 
     uint32_t cur = mHeader->numColumns;
     if ((cur > 0 || mHeader->numRows > 0) && cur != numColumns) {
-        LOGE("Trying to go from %d columns to %d", cur, numColumns);
+        ALOGE("Trying to go from %d columns to %d", cur, numColumns);
         return INVALID_OPERATION;
     }
     mHeader->numColumns = numColumns;
@@ -209,7 +209,7 @@
     uint32_t offset = mHeader->freeOffset + padding;
     uint32_t nextFreeOffset = offset + size;
     if (nextFreeOffset > mSize) {
-        LOGW("Window is full: requested allocation %d bytes, "
+        ALOGW("Window is full: requested allocation %d bytes, "
                 "free space %d bytes, window size %d bytes",
                 size, freeSpace(), mSize);
         return 0;
@@ -255,14 +255,14 @@
 
 CursorWindow::FieldSlot* CursorWindow::getFieldSlot(uint32_t row, uint32_t column) {
     if (row >= mHeader->numRows || column >= mHeader->numColumns) {
-        LOGE("Failed to read row %d, column %d from a CursorWindow which "
+        ALOGE("Failed to read row %d, column %d from a CursorWindow which "
                 "has %d rows, %d columns.",
                 row, column, mHeader->numRows, mHeader->numColumns);
         return NULL;
     }
     RowSlot* rowSlot = getRowSlot(row);
     if (!rowSlot) {
-        LOGE("Failed to find rowSlot for row %d.", row);
+        ALOGE("Failed to find rowSlot for row %d.", row);
         return NULL;
     }
     FieldSlot* fieldDir = static_cast<FieldSlot*>(offsetToPtr(rowSlot->offset));
diff --git a/libs/binder/IMemory.cpp b/libs/binder/IMemory.cpp
index 1ace8f8..cd2451a 100644
--- a/libs/binder/IMemory.cpp
+++ b/libs/binder/IMemory.cpp
@@ -244,7 +244,7 @@
                 sp<IBinder> binder = const_cast<BpMemoryHeap*>(this)->asBinder();
 
                 if (VERBOSE) {
-                    LOGD("UNMAPPING binder=%p, heap=%p, size=%d, fd=%d",
+                    ALOGD("UNMAPPING binder=%p, heap=%p, size=%d, fd=%d",
                             binder.get(), this, mSize, mHeapId);
                     CallStack stack;
                     stack.update();
@@ -298,11 +298,11 @@
         uint32_t flags = reply.readInt32();
         uint32_t offset = reply.readInt32();
 
-        LOGE_IF(err, "binder=%p transaction failed fd=%d, size=%ld, err=%d (%s)",
+        ALOGE_IF(err, "binder=%p transaction failed fd=%d, size=%ld, err=%d (%s)",
                 asBinder().get(), parcel_fd, size, err, strerror(-err));
 
         int fd = dup( parcel_fd );
-        LOGE_IF(fd==-1, "cannot dup fd=%d, size=%ld, err=%d (%s)",
+        ALOGE_IF(fd==-1, "cannot dup fd=%d, size=%ld, err=%d (%s)",
                 parcel_fd, size, err, strerror(errno));
 
         int access = PROT_READ;
@@ -315,7 +315,7 @@
             mRealHeap = true;
             mBase = mmap(0, size, access, MAP_SHARED, fd, offset);
             if (mBase == MAP_FAILED) {
-                LOGE("cannot map BpMemoryHeap (binder=%p), size=%ld, fd=%d (%s)",
+                ALOGE("cannot map BpMemoryHeap (binder=%p), size=%ld, fd=%d (%s)",
                         asBinder().get(), size, fd, strerror(errno));
                 close(fd);
             } else {
@@ -393,7 +393,7 @@
 
 void HeapCache::binderDied(const wp<IBinder>& binder)
 {
-    //LOGD("binderDied binder=%p", binder.unsafe_get());
+    //ALOGD("binderDied binder=%p", binder.unsafe_get());
     free_heap(binder);
 }
 
@@ -403,7 +403,7 @@
     ssize_t i = mHeapCache.indexOfKey(binder);
     if (i>=0) {
         heap_info_t& info = mHeapCache.editValueAt(i);
-        LOGD_IF(VERBOSE,
+        ALOGD_IF(VERBOSE,
                 "found binder=%p, heap=%p, size=%d, fd=%d, count=%d",
                 binder.get(), info.heap.get(),
                 static_cast<BpMemoryHeap*>(info.heap.get())->mSize,
@@ -415,7 +415,7 @@
         heap_info_t info;
         info.heap = interface_cast<IMemoryHeap>(binder);
         info.count = 1;
-        //LOGD("adding binder=%p, heap=%p, count=%d",
+        //ALOGD("adding binder=%p, heap=%p, count=%d",
         //      binder.get(), info.heap.get(), info.count);
         mHeapCache.add(binder, info);
         return info.heap;
@@ -436,7 +436,7 @@
             heap_info_t& info(mHeapCache.editValueAt(i));
             int32_t c = android_atomic_dec(&info.count);
             if (c == 1) {
-                LOGD_IF(VERBOSE,
+                ALOGD_IF(VERBOSE,
                         "removing binder=%p, heap=%p, size=%d, fd=%d, count=%d",
                         binder.unsafe_get(), info.heap.get(),
                         static_cast<BpMemoryHeap*>(info.heap.get())->mSize,
@@ -446,7 +446,7 @@
                 mHeapCache.removeItemsAt(i);
             }
         } else {
-            LOGE("free_heap binder=%p not found!!!", binder.unsafe_get());
+            ALOGE("free_heap binder=%p not found!!!", binder.unsafe_get());
         }
     }
 }
@@ -468,7 +468,7 @@
     for (int i=0 ; i<c ; i++) {
         const heap_info_t& info = mHeapCache.valueAt(i);
         BpMemoryHeap const* h(static_cast<BpMemoryHeap const *>(info.heap.get()));
-        LOGD("hey=%p, heap=%p, count=%d, (fd=%d, base=%p, size=%d)",
+        ALOGD("hey=%p, heap=%p, count=%d, (fd=%d, base=%p, size=%d)",
                 mHeapCache.keyAt(i).unsafe_get(),
                 info.heap.get(), info.count,
                 h->mHeapId, h->mBase, h->mSize);
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index 5d34787..629b899 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -56,12 +56,12 @@
 
 #else
 
-#define IF_LOG_TRANSACTIONS() IF_LOG(LOG_VERBOSE, "transact")
-#define IF_LOG_COMMANDS() IF_LOG(LOG_VERBOSE, "ipc")
-#define LOG_REMOTEREFS(...) LOG(LOG_DEBUG, "remoterefs", __VA_ARGS__)
-#define IF_LOG_REMOTEREFS() IF_LOG(LOG_DEBUG, "remoterefs")
-#define LOG_THREADPOOL(...) LOG(LOG_DEBUG, "threadpool", __VA_ARGS__)
-#define LOG_ONEWAY(...) LOG(LOG_DEBUG, "ipc", __VA_ARGS__)
+#define IF_LOG_TRANSACTIONS() IF_ALOG(LOG_VERBOSE, "transact")
+#define IF_LOG_COMMANDS() IF_ALOG(LOG_VERBOSE, "ipc")
+#define LOG_REMOTEREFS(...) ALOG(LOG_DEBUG, "remoterefs", __VA_ARGS__)
+#define IF_LOG_REMOTEREFS() IF_ALOG(LOG_DEBUG, "remoterefs")
+#define LOG_THREADPOOL(...) ALOG(LOG_DEBUG, "threadpool", __VA_ARGS__)
+#define LOG_ONEWAY(...) ALOG(LOG_DEBUG, "ipc", __VA_ARGS__)
 
 #endif
 
@@ -493,7 +493,7 @@
 
 void IPCThreadState::stopProcess(bool immediate)
 {
-    //LOGI("**** STOPPING PROCESS");
+    //ALOGI("**** STOPPING PROCESS");
     flushCommands();
     int fd = mProcess->mDriverFD;
     mProcess->mDriverFD = -1;
@@ -530,9 +530,9 @@
     if ((flags & TF_ONE_WAY) == 0) {
         #if 0
         if (code == 4) { // relayout
-            LOGI(">>>>>> CALLING transaction 4");
+            ALOGI(">>>>>> CALLING transaction 4");
         } else {
-            LOGI(">>>>>> CALLING transaction %d", code);
+            ALOGI(">>>>>> CALLING transaction %d", code);
         }
         #endif
         if (reply) {
@@ -543,9 +543,9 @@
         }
         #if 0
         if (code == 4) { // relayout
-            LOGI("<<<<<< RETURNING transaction 4");
+            ALOGI("<<<<<< RETURNING transaction 4");
         } else {
-            LOGI("<<<<<< RETURNING transaction %d", code);
+            ALOGI("<<<<<< RETURNING transaction %d", code);
         }
         #endif
         
@@ -692,7 +692,7 @@
         
         case BR_ACQUIRE_RESULT:
             {
-                LOG_ASSERT(acquireResult != NULL, "Unexpected brACQUIRE_RESULT");
+                ALOG_ASSERT(acquireResult != NULL, "Unexpected brACQUIRE_RESULT");
                 const int32_t result = mIn.readInt32();
                 if (!acquireResult) continue;
                 *acquireResult = result ? NO_ERROR : INVALID_OPERATION;
@@ -703,7 +703,7 @@
             {
                 binder_transaction_data tr;
                 err = mIn.read(&tr, sizeof(tr));
-                LOG_ASSERT(err == NO_ERROR, "Not enough command data for brREPLY");
+                ALOG_ASSERT(err == NO_ERROR, "Not enough command data for brREPLY");
                 if (err != NO_ERROR) goto finish;
 
                 if (reply) {
@@ -752,7 +752,7 @@
 
 status_t IPCThreadState::talkWithDriver(bool doReceive)
 {
-    LOG_ASSERT(mProcess->mDriverFD >= 0, "Binder driver is not opened");
+    ALOG_ASSERT(mProcess->mDriverFD >= 0, "Binder driver is not opened");
     
     binder_write_read bwr;
     
@@ -905,7 +905,7 @@
     case BR_ACQUIRE:
         refs = (RefBase::weakref_type*)mIn.readInt32();
         obj = (BBinder*)mIn.readInt32();
-        LOG_ASSERT(refs->refBase() == obj,
+        ALOG_ASSERT(refs->refBase() == obj,
                    "BR_ACQUIRE: object %p does not match cookie %p (expected %p)",
                    refs, obj, refs->refBase());
         obj->incStrong(mProcess.get());
@@ -921,7 +921,7 @@
     case BR_RELEASE:
         refs = (RefBase::weakref_type*)mIn.readInt32();
         obj = (BBinder*)mIn.readInt32();
-        LOG_ASSERT(refs->refBase() == obj,
+        ALOG_ASSERT(refs->refBase() == obj,
                    "BR_RELEASE: object %p does not match cookie %p (expected %p)",
                    refs, obj, refs->refBase());
         IF_LOG_REMOTEREFS() {
@@ -946,7 +946,7 @@
         // NOTE: This assertion is not valid, because the object may no
         // longer exist (thus the (BBinder*)cast above resulting in a different
         // memory address).
-        //LOG_ASSERT(refs->refBase() == obj,
+        //ALOG_ASSERT(refs->refBase() == obj,
         //           "BR_DECREFS: object %p does not match cookie %p (expected %p)",
         //           refs, obj, refs->refBase());
         mPendingWeakDerefs.push(refs);
@@ -958,7 +958,7 @@
          
         {
             const bool success = refs->attemptIncStrong(mProcess.get());
-            LOG_ASSERT(success && refs->refBase() == obj,
+            ALOG_ASSERT(success && refs->refBase() == obj,
                        "BR_ATTEMPT_ACQUIRE: object %p does not match cookie %p (expected %p)",
                        refs, obj, refs->refBase());
             
@@ -971,7 +971,7 @@
         {
             binder_transaction_data tr;
             result = mIn.read(&tr, sizeof(tr));
-            LOG_ASSERT(result == NO_ERROR,
+            ALOG_ASSERT(result == NO_ERROR,
                 "Not enough command data for brTRANSACTION");
             if (result != NO_ERROR) break;
             
@@ -1009,7 +1009,7 @@
                 }
             }
 
-            //LOGI(">>>> TRANSACT from pid %d uid %d\n", mCallingPid, mCallingUid);
+            //ALOGI(">>>> TRANSACT from pid %d uid %d\n", mCallingPid, mCallingUid);
             
             Parcel reply;
             IF_LOG_TRANSACTIONS() {
@@ -1033,7 +1033,7 @@
                 if (error < NO_ERROR) reply.setError(error);
             }
             
-            //LOGI("<<<< TRANSACT from pid %d restore pid %d uid %d\n",
+            //ALOGI("<<<< TRANSACT from pid %d restore pid %d uid %d\n",
             //     mCallingPid, origPid, origUid);
             
             if ((tr.flags & TF_ONE_WAY) == 0) {
@@ -1110,11 +1110,11 @@
                                 const size_t* objects, size_t objectsSize,
                                 void* cookie)
 {
-    //LOGI("Freeing parcel %p", &parcel);
+    //ALOGI("Freeing parcel %p", &parcel);
     IF_LOG_COMMANDS() {
         alog << "Writing BC_FREE_BUFFER for " << data << endl;
     }
-    LOG_ASSERT(data != NULL, "Called with NULL data");
+    ALOG_ASSERT(data != NULL, "Called with NULL data");
     if (parcel != NULL) parcel->closeFileDescriptors();
     IPCThreadState* state = self();
     state->mOut.writeInt32(BC_FREE_BUFFER);
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp
index 1fa4c35..33b305d 100644
--- a/libs/binder/IServiceManager.cpp
+++ b/libs/binder/IServiceManager.cpp
@@ -78,7 +78,7 @@
             bool res = pc->checkPermission(permission, pid, uid);
             if (res) {
                 if (startTime != 0) {
-                    LOGI("Check passed after %d seconds for %s from uid=%d pid=%d",
+                    ALOGI("Check passed after %d seconds for %s from uid=%d pid=%d",
                             (int)((uptimeMillis()-startTime)/1000),
                             String8(permission).string(), uid, pid);
                 }
@@ -87,7 +87,7 @@
             
             // Is this a permission failure, or did the controller go away?
             if (pc->asBinder()->isBinderAlive()) {
-                LOGW("Permission failure: %s from uid=%d pid=%d",
+                ALOGW("Permission failure: %s from uid=%d pid=%d",
                         String8(permission).string(), uid, pid);
                 return false;
             }
@@ -106,7 +106,7 @@
             // Wait for the permission controller to come back...
             if (startTime == 0) {
                 startTime = uptimeMillis();
-                LOGI("Waiting to check permission %s from uid=%d pid=%d",
+                ALOGI("Waiting to check permission %s from uid=%d pid=%d",
                         String8(permission).string(), uid, pid);
             }
             sleep(1);
@@ -136,7 +136,7 @@
         for (n = 0; n < 5; n++){
             sp<IBinder> svc = checkService(name);
             if (svc != NULL) return svc;
-            LOGI("Waiting for service %s...\n", String8(name).string());
+            ALOGI("Waiting for service %s...\n", String8(name).string());
             sleep(1);
         }
         return NULL;
diff --git a/libs/binder/MemoryDealer.cpp b/libs/binder/MemoryDealer.cpp
index 18669f7..ff5e6bd 100644
--- a/libs/binder/MemoryDealer.cpp
+++ b/libs/binder/MemoryDealer.cpp
@@ -211,7 +211,7 @@
 #ifdef MADV_REMOVE
             if (size) {
                 int err = madvise(start_ptr, size, MADV_REMOVE);
-                LOGW_IF(err, "madvise(%p, %u, MADV_REMOVE) returned %s",
+                ALOGW_IF(err, "madvise(%p, %u, MADV_REMOVE) returned %s",
                         start_ptr, size, err<0 ? strerror(errno) : "Ok");
             }
 #endif
@@ -344,7 +344,7 @@
                 mList.insertBefore(free_chunk, split);
             }
 
-            LOGE_IF((flags&PAGE_ALIGNED) && 
+            ALOGE_IF((flags&PAGE_ALIGNED) && 
                     ((free_chunk->start*kMemoryAlign)&(pagesize-1)),
                     "PAGE_ALIGNED requested, but page is not aligned!!!");
 
@@ -411,7 +411,7 @@
 {
     String8 result;
     dump_l(result, what);
-    LOGD("%s", result.string());
+    ALOGD("%s", result.string());
 }
 
 void SimpleBestFitAllocator::dump(String8& result,
diff --git a/libs/binder/MemoryHeapBase.cpp b/libs/binder/MemoryHeapBase.cpp
index bf4a73f..d1cbf1c 100644
--- a/libs/binder/MemoryHeapBase.cpp
+++ b/libs/binder/MemoryHeapBase.cpp
@@ -53,7 +53,7 @@
     const size_t pagesize = getpagesize();
     size = ((size + pagesize-1) & ~(pagesize-1));
     int fd = ashmem_create_region(name == NULL ? "MemoryHeapBase" : name, size);
-    LOGE_IF(fd<0, "error creating ashmem region: %s", strerror(errno));
+    ALOGE_IF(fd<0, "error creating ashmem region: %s", strerror(errno));
     if (fd >= 0) {
         if (mapfd(fd, size) == NO_ERROR) {
             if (flags & READ_ONLY) {
@@ -72,7 +72,7 @@
         open_flags |= O_SYNC;
 
     int fd = open(device, open_flags);
-    LOGE_IF(fd<0, "error opening %s: %s", device, strerror(errno));
+    ALOGE_IF(fd<0, "error opening %s: %s", device, strerror(errno));
     if (fd >= 0) {
         const size_t pagesize = getpagesize();
         size = ((size + pagesize-1) & ~(pagesize-1));
@@ -127,12 +127,12 @@
         void* base = (uint8_t*)mmap(0, size,
                 PROT_READ|PROT_WRITE, MAP_SHARED, fd, offset);
         if (base == MAP_FAILED) {
-            LOGE("mmap(fd=%d, size=%u) failed (%s)",
+            ALOGE("mmap(fd=%d, size=%u) failed (%s)",
                     fd, uint32_t(size), strerror(errno));
             close(fd);
             return -errno;
         }
-        //LOGD("mmap(fd=%d, base=%p, size=%lu)", fd, base, size);
+        //ALOGD("mmap(fd=%d, base=%p, size=%lu)", fd, base, size);
         mBase = base;
         mNeedUnmap = true;
     } else  {
@@ -155,7 +155,7 @@
     int fd = android_atomic_or(-1, &mFD);
     if (fd >= 0) {
         if (mNeedUnmap) {
-            //LOGD("munmap(fd=%d, base=%p, size=%lu)", fd, mBase, mSize);
+            //ALOGD("munmap(fd=%d, base=%p, size=%lu)", fd, mBase, mSize);
             munmap(mBase, mSize);
         }
         mBase = 0;
diff --git a/libs/binder/MemoryHeapPmem.cpp b/libs/binder/MemoryHeapPmem.cpp
index 03322ea..66bcf4d 100644
--- a/libs/binder/MemoryHeapPmem.cpp
+++ b/libs/binder/MemoryHeapPmem.cpp
@@ -79,7 +79,7 @@
         int our_fd = heap->heapID();
         struct pmem_region sub = { offset, size };
         int err = ioctl(our_fd, PMEM_MAP, &sub);
-        LOGE_IF(err<0, "PMEM_MAP failed (%s), "
+        ALOGE_IF(err<0, "PMEM_MAP failed (%s), "
                 "mFD=%d, sub.offset=%lu, sub.size=%lu",
                 strerror(errno), our_fd, sub.offset, sub.len);
 }
@@ -115,7 +115,7 @@
         sub.offset = mOffset;
         sub.len = mSize;
         int err = ioctl(our_fd, PMEM_UNMAP, &sub);
-        LOGE_IF(err<0, "PMEM_UNMAP failed (%s), "
+        ALOGE_IF(err<0, "PMEM_UNMAP failed (%s), "
                 "mFD=%d, sub.offset=%lu, sub.size=%lu",
                 strerror(errno), our_fd, sub.offset, sub.len);
         mSize = 0;
@@ -133,11 +133,11 @@
 #ifdef HAVE_ANDROID_OS
     if (device) {
         int fd = open(device, O_RDWR | (flags & NO_CACHING ? O_SYNC : 0));
-        LOGE_IF(fd<0, "couldn't open %s (%s)", device, strerror(errno));
+        ALOGE_IF(fd<0, "couldn't open %s (%s)", device, strerror(errno));
         if (fd >= 0) {
             int err = ioctl(fd, PMEM_CONNECT, pmemHeap->heapID());
             if (err < 0) {
-                LOGE("PMEM_CONNECT failed (%s), mFD=%d, sub-fd=%d",
+                ALOGE("PMEM_CONNECT failed (%s), mFD=%d, sub-fd=%d",
                         strerror(errno), fd, pmemHeap->heapID());
                 close(fd);
             } else {
@@ -194,7 +194,7 @@
     int our_fd = getHeapID();
     struct pmem_region sub = { 0, size };
     int err = ioctl(our_fd, PMEM_MAP, &sub);
-    LOGE_IF(err<0, "PMEM_MAP failed (%s), "
+    ALOGE_IF(err<0, "PMEM_MAP failed (%s), "
             "mFD=%d, sub.offset=%lu, sub.size=%lu",
             strerror(errno), our_fd, sub.offset, sub.len);
     return -errno;
@@ -212,7 +212,7 @@
     int our_fd = getHeapID();
     struct pmem_region sub = { 0, size };
     int err = ioctl(our_fd, PMEM_UNMAP, &sub);
-    LOGE_IF(err<0, "PMEM_UNMAP failed (%s), "
+    ALOGE_IF(err<0, "PMEM_UNMAP failed (%s), "
             "mFD=%d, sub.offset=%lu, sub.size=%lu",
             strerror(errno), our_fd, sub.offset, sub.len);
     return -errno;
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 6b4c1a6..3400e97 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -44,7 +44,7 @@
 #endif
 
 #define LOG_REFS(...)
-//#define LOG_REFS(...) LOG(LOG_DEBUG, "Parcel", __VA_ARGS__)
+//#define LOG_REFS(...) ALOG(LOG_DEBUG, "Parcel", __VA_ARGS__)
 
 // ---------------------------------------------------------------------------
 
@@ -103,7 +103,7 @@
         }
     }
 
-    LOGD("Invalid object type 0x%08lx", obj.type);
+    ALOGD("Invalid object type 0x%08lx", obj.type);
 }
 
 void release_object(const sp<ProcessState>& proc,
@@ -139,7 +139,7 @@
         }
     }
 
-    LOGE("Invalid object type 0x%08lx", obj.type);
+    ALOGE("Invalid object type 0x%08lx", obj.type);
 }
 
 inline static status_t finish_flatten_binder(
@@ -159,7 +159,7 @@
         if (!local) {
             BpBinder *proxy = binder->remoteBinder();
             if (proxy == NULL) {
-                LOGE("null proxy");
+                ALOGE("null proxy");
             }
             const int32_t handle = proxy ? proxy->handle() : 0;
             obj.type = BINDER_TYPE_HANDLE;
@@ -192,7 +192,7 @@
             if (!local) {
                 BpBinder *proxy = real->remoteBinder();
                 if (proxy == NULL) {
-                    LOGE("null proxy");
+                    ALOGE("null proxy");
                 }
                 const int32_t handle = proxy ? proxy->handle() : 0;
                 obj.type = BINDER_TYPE_WEAK_HANDLE;
@@ -213,7 +213,7 @@
         // The OpenBinder implementation uses a dynamic_cast<> here,
         // but we can't do that with the different reference counting
         // implementation we are using.
-        LOGE("Unable to unflatten Binder weak reference!");
+        ALOGE("Unable to unflatten Binder weak reference!");
         obj.type = BINDER_TYPE_BINDER;
         obj.binder = NULL;
         obj.cookie = NULL;
@@ -330,7 +330,7 @@
     err = continueWrite(size);
     if (err == NO_ERROR) {
         mDataSize = size;
-        LOGV("setDataSize Setting data size of %p to %d\n", this, mDataSize);
+        ALOGV("setDataSize Setting data size of %p to %d\n", this, mDataSize);
     }
     return err;
 }
@@ -504,7 +504,7 @@
     if (str == interface) {
         return true;
     } else {
-        LOGW("**** enforceInterface() expected '%s' but read '%s'\n",
+        ALOGW("**** enforceInterface() expected '%s' but read '%s'\n",
                 String8(interface).string(), String8(str).string());
         return false;
     }
@@ -534,10 +534,10 @@
 {
     //printf("Finish write of %d\n", len);
     mDataPos += len;
-    LOGV("finishWrite Setting data pos of %p to %d\n", this, mDataPos);
+    ALOGV("finishWrite Setting data pos of %p to %d\n", this, mDataPos);
     if (mDataPos > mDataSize) {
         mDataSize = mDataPos;
-        LOGV("finishWrite Setting data size of %p to %d\n", this, mDataSize);
+        ALOGV("finishWrite Setting data size of %p to %d\n", this, mDataSize);
     }
     //printf("New pos=%d, size=%d\n", mDataPos, mDataSize);
     return NO_ERROR;
@@ -703,7 +703,7 @@
         err = writeDupFileDescriptor(handle->data[i]);
 
     if (err != NO_ERROR) {
-        LOGD("write native handle, write dup fd failed");
+        ALOGD("write native handle, write dup fd failed");
         return err;
     }
     err = write(handle->data + handle->numFds, sizeof(int)*handle->numInts);
@@ -730,7 +730,7 @@
     status_t status;
 
     if (!mAllowFds || len <= IN_PLACE_BLOB_LIMIT) {
-        LOGV("writeBlob: write in place");
+        ALOGV("writeBlob: write in place");
         status = writeInt32(0);
         if (status) return status;
 
@@ -741,7 +741,7 @@
         return NO_ERROR;
     }
 
-    LOGV("writeBlob: write to ashmem");
+    ALOGV("writeBlob: write to ashmem");
     int fd = ashmem_create_region("Parcel Blob", len);
     if (fd < 0) return NO_MEMORY;
 
@@ -865,7 +865,7 @@
     if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) {
         memcpy(outData, mData+mDataPos, len);
         mDataPos += PAD_SIZE(len);
-        LOGV("read Setting data pos of %p to %d\n", this, mDataPos);
+        ALOGV("read Setting data pos of %p to %d\n", this, mDataPos);
         return NO_ERROR;
     }
     return NOT_ENOUGH_DATA;
@@ -876,7 +876,7 @@
     if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) {
         const void* data = mData+mDataPos;
         mDataPos += PAD_SIZE(len);
-        LOGV("readInplace Setting data pos of %p to %d\n", this, mDataPos);
+        ALOGV("readInplace Setting data pos of %p to %d\n", this, mDataPos);
         return data;
     }
     return NULL;
@@ -987,7 +987,7 @@
         if (eos) {
             const size_t len = eos - str;
             mDataPos += PAD_SIZE(len+1);
-            LOGV("readCString Setting data pos of %p to %d\n", this, mDataPos);
+            ALOGV("readCString Setting data pos of %p to %d\n", this, mDataPos);
             return str;
         }
     }
@@ -1010,7 +1010,7 @@
     size_t len;
     const char16_t* str = readString16Inplace(&len);
     if (str) return String16(str, len);
-    LOGE("Reading a NULL string not supported here.");
+    ALOGE("Reading a NULL string not supported here.");
     return String16();
 }
 
@@ -1088,7 +1088,7 @@
     if (flat) {
         switch (flat->type) {
             case BINDER_TYPE_FD:
-                //LOGI("Returning file descriptor %ld from parcel %p\n", flat->handle, this);
+                //ALOGI("Returning file descriptor %ld from parcel %p\n", flat->handle, this);
                 return flat->handle;
         }        
     }
@@ -1102,7 +1102,7 @@
     if (status) return status;
 
     if (!useAshmem) {
-        LOGV("readBlob: read in place");
+        ALOGV("readBlob: read in place");
         const void* ptr = readInplace(len);
         if (!ptr) return BAD_VALUE;
 
@@ -1110,7 +1110,7 @@
         return NO_ERROR;
     }
 
-    LOGV("readBlob: read from ashmem");
+    ALOGV("readBlob: read from ashmem");
     int fd = readFileDescriptor();
     if (fd == int(BAD_TYPE)) return BAD_VALUE;
 
@@ -1164,7 +1164,7 @@
             // When transferring a NULL object, we don't write it into
             // the object list, so we don't want to check for it when
             // reading.
-            LOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
+            ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
             return obj;
         }
         
@@ -1174,7 +1174,7 @@
         size_t opos = mNextObjectHint;
         
         if (N > 0) {
-            LOGV("Parcel %p looking for obj at %d, hint=%d\n",
+            ALOGV("Parcel %p looking for obj at %d, hint=%d\n",
                  this, DPOS, opos);
             
             // Start at the current hint position, looking for an object at
@@ -1188,10 +1188,10 @@
             }
             if (OBJS[opos] == DPOS) {
                 // Found it!
-                LOGV("Parcel found obj %d at index %d with forward search",
+                ALOGV("Parcel found obj %d at index %d with forward search",
                      this, DPOS, opos);
                 mNextObjectHint = opos+1;
-                LOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
+                ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
                 return obj;
             }
         
@@ -1201,14 +1201,14 @@
             }
             if (OBJS[opos] == DPOS) {
                 // Found it!
-                LOGV("Parcel found obj %d at index %d with backward search",
+                ALOGV("Parcel found obj %d at index %d with backward search",
                      this, DPOS, opos);
                 mNextObjectHint = opos+1;
-                LOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
+                ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
                 return obj;
             }
         }
-        LOGW("Attempt to read object from Parcel %p at offset %d that is not in the object list",
+        ALOGW("Attempt to read object from Parcel %p at offset %d that is not in the object list",
              this, DPOS);
     }
     return NULL;
@@ -1218,14 +1218,14 @@
 {
     size_t i = mObjectsSize;
     if (i > 0) {
-        //LOGI("Closing file descriptors for %d objects...", mObjectsSize);
+        //ALOGI("Closing file descriptors for %d objects...", mObjectsSize);
     }
     while (i > 0) {
         i--;
         const flat_binder_object* flat
             = reinterpret_cast<flat_binder_object*>(mData+mObjects[i]);
         if (flat->type == BINDER_TYPE_FD) {
-            //LOGI("Closing fd: %ld\n", flat->handle);
+            //ALOGI("Closing fd: %ld\n", flat->handle);
             close(flat->handle);
         }
     }
@@ -1258,9 +1258,9 @@
     mError = NO_ERROR;
     mData = const_cast<uint8_t*>(data);
     mDataSize = mDataCapacity = dataSize;
-    //LOGI("setDataReference Setting data size of %p to %lu (pid=%d)\n", this, mDataSize, getpid());
+    //ALOGI("setDataReference Setting data size of %p to %lu (pid=%d)\n", this, mDataSize, getpid());
     mDataPos = 0;
-    LOGV("setDataReference Setting data pos of %p to %d\n", this, mDataPos);
+    ALOGV("setDataReference Setting data pos of %p to %d\n", this, mDataPos);
     mObjects = const_cast<size_t*>(objects);
     mObjectsSize = mObjectsCapacity = objectsCount;
     mNextObjectHint = 0;
@@ -1332,7 +1332,7 @@
 void Parcel::freeDataNoInit()
 {
     if (mOwner) {
-        //LOGI("Freeing data ref of %p (pid=%d)\n", this, getpid());
+        //ALOGI("Freeing data ref of %p (pid=%d)\n", this, getpid());
         mOwner(this, mData, mDataSize, mObjects, mObjectsSize, mOwnerCookie);
     } else {
         releaseObjects();
@@ -1370,8 +1370,8 @@
     }
     
     mDataSize = mDataPos = 0;
-    LOGV("restartWrite Setting data size of %p to %d\n", this, mDataSize);
-    LOGV("restartWrite Setting data pos of %p to %d\n", this, mDataPos);
+    ALOGV("restartWrite Setting data size of %p to %d\n", this, mDataSize);
+    ALOGV("restartWrite Setting data pos of %p to %d\n", this, mDataPos);
         
     free(mObjects);
     mObjects = NULL;
@@ -1438,14 +1438,14 @@
         if (objects && mObjects) {
             memcpy(objects, mObjects, objectsSize*sizeof(size_t));
         }
-        //LOGI("Freeing data ref of %p (pid=%d)\n", this, getpid());
+        //ALOGI("Freeing data ref of %p (pid=%d)\n", this, getpid());
         mOwner(this, mData, mDataSize, mObjects, mObjectsSize, mOwnerCookie);
         mOwner = NULL;
 
         mData = data;
         mObjects = objects;
         mDataSize = (mDataSize < desired) ? mDataSize : desired;
-        LOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
+        ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
         mDataCapacity = desired;
         mObjectsSize = mObjectsCapacity = objectsSize;
         mNextObjectHint = 0;
@@ -1485,11 +1485,11 @@
         } else {
             if (mDataSize > desired) {
                 mDataSize = desired;
-                LOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
+                ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
             }
             if (mDataPos > desired) {
                 mDataPos = desired;
-                LOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos);
+                ALOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos);
             }
         }
         
@@ -1503,13 +1503,13 @@
         
         if(!(mDataCapacity == 0 && mObjects == NULL
              && mObjectsCapacity == 0)) {
-            LOGE("continueWrite: %d/%p/%d/%d", mDataCapacity, mObjects, mObjectsCapacity, desired);
+            ALOGE("continueWrite: %d/%p/%d/%d", mDataCapacity, mObjects, mObjectsCapacity, desired);
         }
         
         mData = data;
         mDataSize = mDataPos = 0;
-        LOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
-        LOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos);
+        ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
+        ALOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos);
         mDataCapacity = desired;
     }
 
@@ -1523,8 +1523,8 @@
     mDataSize = 0;
     mDataCapacity = 0;
     mDataPos = 0;
-    LOGV("initState Setting data size of %p to %d\n", this, mDataSize);
-    LOGV("initState Setting data pos of %p to %d\n", this, mDataPos);
+    ALOGV("initState Setting data size of %p to %d\n", this, mDataSize);
+    ALOGV("initState Setting data pos of %p to %d\n", this, mDataPos);
     mObjects = NULL;
     mObjectsSize = 0;
     mObjectsCapacity = 0;
diff --git a/libs/binder/PermissionCache.cpp b/libs/binder/PermissionCache.cpp
index 7278187..a503be8 100644
--- a/libs/binder/PermissionCache.cpp
+++ b/libs/binder/PermissionCache.cpp
@@ -101,7 +101,7 @@
         nsecs_t t = -systemTime();
         granted = android::checkPermission(permission, pid, uid);
         t += systemTime();
-        LOGD("checking %s for uid=%d => %s (%d us)",
+        ALOGD("checking %s for uid=%d => %s (%d us)",
                 String8(permission).string(), uid,
                 granted?"granted":"denied", (int)ns2us(t));
         pc.cache(permission, uid, granted);
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index f5288c8..f96fe50 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -109,7 +109,7 @@
 
     // Don't attempt to retrieve contexts if we manage them
     if (mManagesContexts) {
-        LOGE("getContextObject(%s) failed, but we manage the contexts!\n",
+        ALOGE("getContextObject(%s) failed, but we manage the contexts!\n",
             String8(name).string());
         return NULL;
     }
@@ -160,7 +160,7 @@
         } else if (result == -1) {
             mBinderContextCheckFunc = NULL;
             mBinderContextUserData = NULL;
-            LOGE("Binder ioctl to become context manager failed: %s\n", strerror(errno));
+            ALOGE("Binder ioctl to become context manager failed: %s\n", strerror(errno));
         }
     }
     return mManagesContexts;
@@ -288,7 +288,7 @@
         int32_t s = android_atomic_add(1, &mThreadPoolSeq);
         char buf[32];
         sprintf(buf, "Binder Thread #%d", s);
-        LOGV("Spawning new pooled thread, name=%s\n", buf);
+        ALOGV("Spawning new pooled thread, name=%s\n", buf);
         sp<Thread> t = new PoolThread(isMain);
         t->run(buf);
     }
@@ -302,22 +302,22 @@
         int vers;
         status_t result = ioctl(fd, BINDER_VERSION, &vers);
         if (result == -1) {
-            LOGE("Binder ioctl to obtain version failed: %s", strerror(errno));
+            ALOGE("Binder ioctl to obtain version failed: %s", strerror(errno));
             close(fd);
             fd = -1;
         }
         if (result != 0 || vers != BINDER_CURRENT_PROTOCOL_VERSION) {
-            LOGE("Binder driver protocol does not match user space protocol!");
+            ALOGE("Binder driver protocol does not match user space protocol!");
             close(fd);
             fd = -1;
         }
         size_t maxThreads = 15;
         result = ioctl(fd, BINDER_SET_MAX_THREADS, &maxThreads);
         if (result == -1) {
-            LOGE("Binder ioctl to set max threads failed: %s", strerror(errno));
+            ALOGE("Binder ioctl to set max threads failed: %s", strerror(errno));
         }
     } else {
-        LOGW("Opening '/dev/binder' failed: %s\n", strerror(errno));
+        ALOGW("Opening '/dev/binder' failed: %s\n", strerror(errno));
     }
     return fd;
 }
@@ -340,7 +340,7 @@
         mVMStart = mmap(0, BINDER_VM_SIZE, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, mDriverFD, 0);
         if (mVMStart == MAP_FAILED) {
             // *sigh*
-            LOGE("Using /dev/binder failed: unable to mmap transaction memory.\n");
+            ALOGE("Using /dev/binder failed: unable to mmap transaction memory.\n");
             close(mDriverFD);
             mDriverFD = -1;
         }
diff --git a/libs/camera/Camera.cpp b/libs/camera/Camera.cpp
index 7ac3cc1..ee458f1 100644
--- a/libs/camera/Camera.cpp
+++ b/libs/camera/Camera.cpp
@@ -47,7 +47,7 @@
             binder = sm->getService(String16("media.camera"));
             if (binder != 0)
                 break;
-            LOGW("CameraService not published, waiting...");
+            ALOGW("CameraService not published, waiting...");
             usleep(500000); // 0.5 s
         } while(true);
         if (mDeathNotifier == NULL) {
@@ -56,7 +56,7 @@
         binder->linkToDeath(mDeathNotifier);
         mCameraService = interface_cast<ICameraService>(binder);
     }
-    LOGE_IF(mCameraService==0, "no CameraService!?");
+    ALOGE_IF(mCameraService==0, "no CameraService!?");
     return mCameraService;
 }
 
@@ -70,9 +70,9 @@
 // construct a camera client from an existing camera remote
 sp<Camera> Camera::create(const sp<ICamera>& camera)
 {
-     LOGV("create");
+     ALOGV("create");
      if (camera == 0) {
-         LOGE("camera remote is a NULL pointer");
+         ALOGE("camera remote is a NULL pointer");
          return 0;
      }
 
@@ -117,7 +117,7 @@
 
 sp<Camera> Camera::connect(int cameraId)
 {
-    LOGV("connect");
+    ALOGV("connect");
     sp<Camera> c = new Camera();
     const sp<ICameraService>& cs = getCameraService();
     if (cs != 0) {
@@ -134,7 +134,7 @@
 
 void Camera::disconnect()
 {
-    LOGV("disconnect");
+    ALOGV("disconnect");
     if (mCamera != 0) {
         mCamera->disconnect();
         mCamera->asBinder()->unlinkToDeath(this);
@@ -144,7 +144,7 @@
 
 status_t Camera::reconnect()
 {
-    LOGV("reconnect");
+    ALOGV("reconnect");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->connect(this);
@@ -172,13 +172,13 @@
 // pass the buffered Surface to the camera service
 status_t Camera::setPreviewDisplay(const sp<Surface>& surface)
 {
-    LOGV("setPreviewDisplay(%p)", surface.get());
+    ALOGV("setPreviewDisplay(%p)", surface.get());
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     if (surface != 0) {
         return c->setPreviewDisplay(surface);
     } else {
-        LOGD("app passed NULL surface");
+        ALOGD("app passed NULL surface");
         return c->setPreviewDisplay(0);
     }
 }
@@ -186,13 +186,13 @@
 // pass the buffered ISurfaceTexture to the camera service
 status_t Camera::setPreviewTexture(const sp<ISurfaceTexture>& surfaceTexture)
 {
-    LOGV("setPreviewTexture(%p)", surfaceTexture.get());
+    ALOGV("setPreviewTexture(%p)", surfaceTexture.get());
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     if (surfaceTexture != 0) {
         return c->setPreviewTexture(surfaceTexture);
     } else {
-        LOGD("app passed NULL surface");
+        ALOGD("app passed NULL surface");
         return c->setPreviewTexture(0);
     }
 }
@@ -200,7 +200,7 @@
 // start preview mode
 status_t Camera::startPreview()
 {
-    LOGV("startPreview");
+    ALOGV("startPreview");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->startPreview();
@@ -208,7 +208,7 @@
 
 status_t Camera::storeMetaDataInBuffers(bool enabled)
 {
-    LOGV("storeMetaDataInBuffers: %s",
+    ALOGV("storeMetaDataInBuffers: %s",
             enabled? "true": "false");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
@@ -218,7 +218,7 @@
 // start recording mode, must call setPreviewDisplay first
 status_t Camera::startRecording()
 {
-    LOGV("startRecording");
+    ALOGV("startRecording");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->startRecording();
@@ -227,7 +227,7 @@
 // stop preview mode
 void Camera::stopPreview()
 {
-    LOGV("stopPreview");
+    ALOGV("stopPreview");
     sp <ICamera> c = mCamera;
     if (c == 0) return;
     c->stopPreview();
@@ -236,7 +236,7 @@
 // stop recording mode
 void Camera::stopRecording()
 {
-    LOGV("stopRecording");
+    ALOGV("stopRecording");
     {
         Mutex::Autolock _l(mLock);
         mRecordingProxyListener.clear();
@@ -249,7 +249,7 @@
 // release a recording frame
 void Camera::releaseRecordingFrame(const sp<IMemory>& mem)
 {
-    LOGV("releaseRecordingFrame");
+    ALOGV("releaseRecordingFrame");
     sp <ICamera> c = mCamera;
     if (c == 0) return;
     c->releaseRecordingFrame(mem);
@@ -258,7 +258,7 @@
 // get preview state
 bool Camera::previewEnabled()
 {
-    LOGV("previewEnabled");
+    ALOGV("previewEnabled");
     sp <ICamera> c = mCamera;
     if (c == 0) return false;
     return c->previewEnabled();
@@ -267,7 +267,7 @@
 // get recording state
 bool Camera::recordingEnabled()
 {
-    LOGV("recordingEnabled");
+    ALOGV("recordingEnabled");
     sp <ICamera> c = mCamera;
     if (c == 0) return false;
     return c->recordingEnabled();
@@ -275,7 +275,7 @@
 
 status_t Camera::autoFocus()
 {
-    LOGV("autoFocus");
+    ALOGV("autoFocus");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->autoFocus();
@@ -283,7 +283,7 @@
 
 status_t Camera::cancelAutoFocus()
 {
-    LOGV("cancelAutoFocus");
+    ALOGV("cancelAutoFocus");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->cancelAutoFocus();
@@ -292,7 +292,7 @@
 // take a picture
 status_t Camera::takePicture(int msgType)
 {
-    LOGV("takePicture: 0x%x", msgType);
+    ALOGV("takePicture: 0x%x", msgType);
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->takePicture(msgType);
@@ -301,7 +301,7 @@
 // set preview/capture parameters - key/value pairs
 status_t Camera::setParameters(const String8& params)
 {
-    LOGV("setParameters");
+    ALOGV("setParameters");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->setParameters(params);
@@ -310,7 +310,7 @@
 // get preview/capture parameters - key/value pairs
 String8 Camera::getParameters() const
 {
-    LOGV("getParameters");
+    ALOGV("getParameters");
     String8 params;
     sp <ICamera> c = mCamera;
     if (c != 0) params = mCamera->getParameters();
@@ -320,7 +320,7 @@
 // send command to camera driver
 status_t Camera::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2)
 {
-    LOGV("sendCommand");
+    ALOGV("sendCommand");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->sendCommand(cmd, arg1, arg2);
@@ -340,7 +340,7 @@
 
 void Camera::setPreviewCallbackFlags(int flag)
 {
-    LOGV("setPreviewCallbackFlags");
+    ALOGV("setPreviewCallbackFlags");
     sp <ICamera> c = mCamera;
     if (c == 0) return;
     mCamera->setPreviewCallbackFlag(flag);
@@ -397,31 +397,31 @@
     if (listener != NULL) {
         listener->postDataTimestamp(timestamp, msgType, dataPtr);
     } else {
-        LOGW("No listener was set. Drop a recording frame.");
+        ALOGW("No listener was set. Drop a recording frame.");
         releaseRecordingFrame(dataPtr);
     }
 }
 
 void Camera::binderDied(const wp<IBinder>& who) {
-    LOGW("ICamera died");
+    ALOGW("ICamera died");
     notifyCallback(CAMERA_MSG_ERROR, CAMERA_ERROR_SERVER_DIED, 0);
 }
 
 void Camera::DeathNotifier::binderDied(const wp<IBinder>& who) {
-    LOGV("binderDied");
+    ALOGV("binderDied");
     Mutex::Autolock _l(Camera::mLock);
     Camera::mCameraService.clear();
-    LOGW("Camera server died!");
+    ALOGW("Camera server died!");
 }
 
 sp<ICameraRecordingProxy> Camera::getRecordingProxy() {
-    LOGV("getProxy");
+    ALOGV("getProxy");
     return new RecordingProxy(this);
 }
 
 status_t Camera::RecordingProxy::startRecording(const sp<ICameraRecordingProxyListener>& listener)
 {
-    LOGV("RecordingProxy::startRecording");
+    ALOGV("RecordingProxy::startRecording");
     mCamera->setRecordingProxyListener(listener);
     mCamera->reconnect();
     return mCamera->startRecording();
@@ -429,13 +429,13 @@
 
 void Camera::RecordingProxy::stopRecording()
 {
-    LOGV("RecordingProxy::stopRecording");
+    ALOGV("RecordingProxy::stopRecording");
     mCamera->stopRecording();
 }
 
 void Camera::RecordingProxy::releaseRecordingFrame(const sp<IMemory>& mem)
 {
-    LOGV("RecordingProxy::releaseRecordingFrame");
+    ALOGV("RecordingProxy::releaseRecordingFrame");
     mCamera->releaseRecordingFrame(mem);
 }
 
diff --git a/libs/camera/CameraParameters.cpp b/libs/camera/CameraParameters.cpp
index c6087b4..059a8a5 100644
--- a/libs/camera/CameraParameters.cpp
+++ b/libs/camera/CameraParameters.cpp
@@ -231,12 +231,12 @@
 {
     // XXX i think i can do this with strspn()
     if (strchr(key, '=') || strchr(key, ';')) {
-        //XXX LOGE("Key \"%s\"contains invalid character (= or ;)", key);
+        //XXX ALOGE("Key \"%s\"contains invalid character (= or ;)", key);
         return;
     }
 
     if (strchr(value, '=') || strchr(key, ';')) {
-        //XXX LOGE("Value \"%s\"contains invalid character (= or ;)", value);
+        //XXX ALOGE("Value \"%s\"contains invalid character (= or ;)", value);
         return;
     }
 
@@ -294,7 +294,7 @@
     int w = (int)strtol(str, &end, 10);
     // If a delimeter does not immediately follow, give up.
     if (*end != delim) {
-        LOGE("Cannot find delimeter (%c) in str=%s", delim, str);
+        ALOGE("Cannot find delimeter (%c) in str=%s", delim, str);
         return -1;
     }
 
@@ -324,7 +324,7 @@
         int success = parse_pair(sizeStartPtr, &width, &height, 'x',
                                  &sizeStartPtr);
         if (success == -1 || (*sizeStartPtr != ',' && *sizeStartPtr != '\0')) {
-            LOGE("Picture sizes string \"%s\" contains invalid character.", sizesStr);
+            ALOGE("Picture sizes string \"%s\" contains invalid character.", sizesStr);
             return;
         }
         sizes.push(Size(width, height));
@@ -449,12 +449,12 @@
 
 void CameraParameters::dump() const
 {
-    LOGD("dump: mMap.size = %d", mMap.size());
+    ALOGD("dump: mMap.size = %d", mMap.size());
     for (size_t i = 0; i < mMap.size(); i++) {
         String8 k, v;
         k = mMap.keyAt(i);
         v = mMap.valueAt(i);
-        LOGD("%s: %s\n", k.string(), v.string());
+        ALOGD("%s: %s\n", k.string(), v.string());
     }
 }
 
diff --git a/libs/camera/ICamera.cpp b/libs/camera/ICamera.cpp
index 5f6e5ef..70f5dbc 100644
--- a/libs/camera/ICamera.cpp
+++ b/libs/camera/ICamera.cpp
@@ -60,7 +60,7 @@
     // disconnect from camera service
     void disconnect()
     {
-        LOGV("disconnect");
+        ALOGV("disconnect");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(DISCONNECT, data, &reply);
@@ -69,7 +69,7 @@
     // pass the buffered Surface to the camera service
     status_t setPreviewDisplay(const sp<Surface>& surface)
     {
-        LOGV("setPreviewDisplay");
+        ALOGV("setPreviewDisplay");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         Surface::writeToParcel(surface, &data);
@@ -80,7 +80,7 @@
     // pass the buffered SurfaceTexture to the camera service
     status_t setPreviewTexture(const sp<ISurfaceTexture>& surfaceTexture)
     {
-        LOGV("setPreviewTexture");
+        ALOGV("setPreviewTexture");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         sp<IBinder> b(surfaceTexture->asBinder());
@@ -93,7 +93,7 @@
     // preview are handled. See Camera.h for details.
     void setPreviewCallbackFlag(int flag)
     {
-        LOGV("setPreviewCallbackFlag(%d)", flag);
+        ALOGV("setPreviewCallbackFlag(%d)", flag);
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         data.writeInt32(flag);
@@ -103,7 +103,7 @@
     // start preview mode, must call setPreviewDisplay first
     status_t startPreview()
     {
-        LOGV("startPreview");
+        ALOGV("startPreview");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(START_PREVIEW, data, &reply);
@@ -113,7 +113,7 @@
     // start recording mode, must call setPreviewDisplay first
     status_t startRecording()
     {
-        LOGV("startRecording");
+        ALOGV("startRecording");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(START_RECORDING, data, &reply);
@@ -123,7 +123,7 @@
     // stop preview mode
     void stopPreview()
     {
-        LOGV("stopPreview");
+        ALOGV("stopPreview");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(STOP_PREVIEW, data, &reply);
@@ -132,7 +132,7 @@
     // stop recording mode
     void stopRecording()
     {
-        LOGV("stopRecording");
+        ALOGV("stopRecording");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(STOP_RECORDING, data, &reply);
@@ -140,7 +140,7 @@
 
     void releaseRecordingFrame(const sp<IMemory>& mem)
     {
-        LOGV("releaseRecordingFrame");
+        ALOGV("releaseRecordingFrame");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         data.writeStrongBinder(mem->asBinder());
@@ -149,7 +149,7 @@
 
     status_t storeMetaDataInBuffers(bool enabled)
     {
-        LOGV("storeMetaDataInBuffers: %s", enabled? "true": "false");
+        ALOGV("storeMetaDataInBuffers: %s", enabled? "true": "false");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         data.writeInt32(enabled);
@@ -160,7 +160,7 @@
     // check preview state
     bool previewEnabled()
     {
-        LOGV("previewEnabled");
+        ALOGV("previewEnabled");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(PREVIEW_ENABLED, data, &reply);
@@ -170,7 +170,7 @@
     // check recording state
     bool recordingEnabled()
     {
-        LOGV("recordingEnabled");
+        ALOGV("recordingEnabled");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(RECORDING_ENABLED, data, &reply);
@@ -180,7 +180,7 @@
     // auto focus
     status_t autoFocus()
     {
-        LOGV("autoFocus");
+        ALOGV("autoFocus");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(AUTO_FOCUS, data, &reply);
@@ -191,7 +191,7 @@
     // cancel focus
     status_t cancelAutoFocus()
     {
-        LOGV("cancelAutoFocus");
+        ALOGV("cancelAutoFocus");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(CANCEL_AUTO_FOCUS, data, &reply);
@@ -202,7 +202,7 @@
     // take a picture - returns an IMemory (ref-counted mmap)
     status_t takePicture(int msgType)
     {
-        LOGV("takePicture: 0x%x", msgType);
+        ALOGV("takePicture: 0x%x", msgType);
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         data.writeInt32(msgType);
@@ -214,7 +214,7 @@
     // set preview/capture parameters - key/value pairs
     status_t setParameters(const String8& params)
     {
-        LOGV("setParameters");
+        ALOGV("setParameters");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         data.writeString8(params);
@@ -225,7 +225,7 @@
     // get preview/capture parameters - key/value pairs
     String8 getParameters() const
     {
-        LOGV("getParameters");
+        ALOGV("getParameters");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(GET_PARAMETERS, data, &reply);
@@ -233,7 +233,7 @@
     }
     virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2)
     {
-        LOGV("sendCommand");
+        ALOGV("sendCommand");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         data.writeInt32(cmd);
@@ -275,116 +275,116 @@
 {
     switch(code) {
         case DISCONNECT: {
-            LOGV("DISCONNECT");
+            ALOGV("DISCONNECT");
             CHECK_INTERFACE(ICamera, data, reply);
             disconnect();
             return NO_ERROR;
         } break;
         case SET_PREVIEW_DISPLAY: {
-            LOGV("SET_PREVIEW_DISPLAY");
+            ALOGV("SET_PREVIEW_DISPLAY");
             CHECK_INTERFACE(ICamera, data, reply);
             sp<Surface> surface = Surface::readFromParcel(data);
             reply->writeInt32(setPreviewDisplay(surface));
             return NO_ERROR;
         } break;
         case SET_PREVIEW_TEXTURE: {
-            LOGV("SET_PREVIEW_TEXTURE");
+            ALOGV("SET_PREVIEW_TEXTURE");
             CHECK_INTERFACE(ICamera, data, reply);
             sp<ISurfaceTexture> st = interface_cast<ISurfaceTexture>(data.readStrongBinder());
             reply->writeInt32(setPreviewTexture(st));
             return NO_ERROR;
         } break;
         case SET_PREVIEW_CALLBACK_FLAG: {
-            LOGV("SET_PREVIEW_CALLBACK_TYPE");
+            ALOGV("SET_PREVIEW_CALLBACK_TYPE");
             CHECK_INTERFACE(ICamera, data, reply);
             int callback_flag = data.readInt32();
             setPreviewCallbackFlag(callback_flag);
             return NO_ERROR;
         } break;
         case START_PREVIEW: {
-            LOGV("START_PREVIEW");
+            ALOGV("START_PREVIEW");
             CHECK_INTERFACE(ICamera, data, reply);
             reply->writeInt32(startPreview());
             return NO_ERROR;
         } break;
         case START_RECORDING: {
-            LOGV("START_RECORDING");
+            ALOGV("START_RECORDING");
             CHECK_INTERFACE(ICamera, data, reply);
             reply->writeInt32(startRecording());
             return NO_ERROR;
         } break;
         case STOP_PREVIEW: {
-            LOGV("STOP_PREVIEW");
+            ALOGV("STOP_PREVIEW");
             CHECK_INTERFACE(ICamera, data, reply);
             stopPreview();
             return NO_ERROR;
         } break;
         case STOP_RECORDING: {
-            LOGV("STOP_RECORDING");
+            ALOGV("STOP_RECORDING");
             CHECK_INTERFACE(ICamera, data, reply);
             stopRecording();
             return NO_ERROR;
         } break;
         case RELEASE_RECORDING_FRAME: {
-            LOGV("RELEASE_RECORDING_FRAME");
+            ALOGV("RELEASE_RECORDING_FRAME");
             CHECK_INTERFACE(ICamera, data, reply);
             sp<IMemory> mem = interface_cast<IMemory>(data.readStrongBinder());
             releaseRecordingFrame(mem);
             return NO_ERROR;
         } break;
         case STORE_META_DATA_IN_BUFFERS: {
-            LOGV("STORE_META_DATA_IN_BUFFERS");
+            ALOGV("STORE_META_DATA_IN_BUFFERS");
             CHECK_INTERFACE(ICamera, data, reply);
             bool enabled = data.readInt32();
             reply->writeInt32(storeMetaDataInBuffers(enabled));
             return NO_ERROR;
         } break;
         case PREVIEW_ENABLED: {
-            LOGV("PREVIEW_ENABLED");
+            ALOGV("PREVIEW_ENABLED");
             CHECK_INTERFACE(ICamera, data, reply);
             reply->writeInt32(previewEnabled());
             return NO_ERROR;
         } break;
         case RECORDING_ENABLED: {
-            LOGV("RECORDING_ENABLED");
+            ALOGV("RECORDING_ENABLED");
             CHECK_INTERFACE(ICamera, data, reply);
             reply->writeInt32(recordingEnabled());
             return NO_ERROR;
         } break;
         case AUTO_FOCUS: {
-            LOGV("AUTO_FOCUS");
+            ALOGV("AUTO_FOCUS");
             CHECK_INTERFACE(ICamera, data, reply);
             reply->writeInt32(autoFocus());
             return NO_ERROR;
         } break;
         case CANCEL_AUTO_FOCUS: {
-            LOGV("CANCEL_AUTO_FOCUS");
+            ALOGV("CANCEL_AUTO_FOCUS");
             CHECK_INTERFACE(ICamera, data, reply);
             reply->writeInt32(cancelAutoFocus());
             return NO_ERROR;
         } break;
         case TAKE_PICTURE: {
-            LOGV("TAKE_PICTURE");
+            ALOGV("TAKE_PICTURE");
             CHECK_INTERFACE(ICamera, data, reply);
             int msgType = data.readInt32();
             reply->writeInt32(takePicture(msgType));
             return NO_ERROR;
         } break;
         case SET_PARAMETERS: {
-            LOGV("SET_PARAMETERS");
+            ALOGV("SET_PARAMETERS");
             CHECK_INTERFACE(ICamera, data, reply);
             String8 params(data.readString8());
             reply->writeInt32(setParameters(params));
             return NO_ERROR;
          } break;
         case GET_PARAMETERS: {
-            LOGV("GET_PARAMETERS");
+            ALOGV("GET_PARAMETERS");
             CHECK_INTERFACE(ICamera, data, reply);
              reply->writeString8(getParameters());
             return NO_ERROR;
          } break;
         case SEND_COMMAND: {
-            LOGV("SEND_COMMAND");
+            ALOGV("SEND_COMMAND");
             CHECK_INTERFACE(ICamera, data, reply);
             int command = data.readInt32();
             int arg1 = data.readInt32();
diff --git a/libs/camera/ICameraClient.cpp b/libs/camera/ICameraClient.cpp
index 183429a..205c8ba 100644
--- a/libs/camera/ICameraClient.cpp
+++ b/libs/camera/ICameraClient.cpp
@@ -41,7 +41,7 @@
     // generic callback from camera service to app
     void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2)
     {
-        LOGV("notifyCallback");
+        ALOGV("notifyCallback");
         Parcel data, reply;
         data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
         data.writeInt32(msgType);
@@ -54,7 +54,7 @@
     void dataCallback(int32_t msgType, const sp<IMemory>& imageData,
                       camera_frame_metadata_t *metadata)
     {
-        LOGV("dataCallback");
+        ALOGV("dataCallback");
         Parcel data, reply;
         data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
         data.writeInt32(msgType);
@@ -69,7 +69,7 @@
     // generic data callback from camera service to app with image data
     void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& imageData)
     {
-        LOGV("dataCallback");
+        ALOGV("dataCallback");
         Parcel data, reply;
         data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
         data.writeInt64(timestamp);
@@ -88,7 +88,7 @@
 {
     switch(code) {
         case NOTIFY_CALLBACK: {
-            LOGV("NOTIFY_CALLBACK");
+            ALOGV("NOTIFY_CALLBACK");
             CHECK_INTERFACE(ICameraClient, data, reply);
             int32_t msgType = data.readInt32();
             int32_t ext1 = data.readInt32();
@@ -97,7 +97,7 @@
             return NO_ERROR;
         } break;
         case DATA_CALLBACK: {
-            LOGV("DATA_CALLBACK");
+            ALOGV("DATA_CALLBACK");
             CHECK_INTERFACE(ICameraClient, data, reply);
             int32_t msgType = data.readInt32();
             sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder());
@@ -113,7 +113,7 @@
             return NO_ERROR;
         } break;
         case DATA_CALLBACK_TIMESTAMP: {
-            LOGV("DATA_CALLBACK_TIMESTAMP");
+            ALOGV("DATA_CALLBACK_TIMESTAMP");
             CHECK_INTERFACE(ICameraClient, data, reply);
             nsecs_t timestamp = data.readInt64();
             int32_t msgType = data.readInt32();
diff --git a/libs/camera/ICameraRecordingProxy.cpp b/libs/camera/ICameraRecordingProxy.cpp
index 64b6a5c..7223b6d 100644
--- a/libs/camera/ICameraRecordingProxy.cpp
+++ b/libs/camera/ICameraRecordingProxy.cpp
@@ -42,7 +42,7 @@
 
     status_t startRecording(const sp<ICameraRecordingProxyListener>& listener)
     {
-        LOGV("startRecording");
+        ALOGV("startRecording");
         Parcel data, reply;
         data.writeInterfaceToken(ICameraRecordingProxy::getInterfaceDescriptor());
         data.writeStrongBinder(listener->asBinder());
@@ -52,7 +52,7 @@
 
     void stopRecording()
     {
-        LOGV("stopRecording");
+        ALOGV("stopRecording");
         Parcel data, reply;
         data.writeInterfaceToken(ICameraRecordingProxy::getInterfaceDescriptor());
         remote()->transact(STOP_RECORDING, data, &reply);
@@ -60,7 +60,7 @@
 
     void releaseRecordingFrame(const sp<IMemory>& mem)
     {
-        LOGV("releaseRecordingFrame");
+        ALOGV("releaseRecordingFrame");
         Parcel data, reply;
         data.writeInterfaceToken(ICameraRecordingProxy::getInterfaceDescriptor());
         data.writeStrongBinder(mem->asBinder());
@@ -77,7 +77,7 @@
 {
     switch(code) {
         case START_RECORDING: {
-            LOGV("START_RECORDING");
+            ALOGV("START_RECORDING");
             CHECK_INTERFACE(ICameraRecordingProxy, data, reply);
             sp<ICameraRecordingProxyListener> listener =
                 interface_cast<ICameraRecordingProxyListener>(data.readStrongBinder());
@@ -85,13 +85,13 @@
             return NO_ERROR;
         } break;
         case STOP_RECORDING: {
-            LOGV("STOP_RECORDING");
+            ALOGV("STOP_RECORDING");
             CHECK_INTERFACE(ICameraRecordingProxy, data, reply);
             stopRecording();
             return NO_ERROR;
         } break;
         case RELEASE_RECORDING_FRAME: {
-            LOGV("RELEASE_RECORDING_FRAME");
+            ALOGV("RELEASE_RECORDING_FRAME");
             CHECK_INTERFACE(ICameraRecordingProxy, data, reply);
             sp<IMemory> mem = interface_cast<IMemory>(data.readStrongBinder());
             releaseRecordingFrame(mem);
diff --git a/libs/camera/ICameraRecordingProxyListener.cpp b/libs/camera/ICameraRecordingProxyListener.cpp
index f8cece5..cb17f19 100644
--- a/libs/camera/ICameraRecordingProxyListener.cpp
+++ b/libs/camera/ICameraRecordingProxyListener.cpp
@@ -37,7 +37,7 @@
 
     void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& imageData)
     {
-        LOGV("dataCallback");
+        ALOGV("dataCallback");
         Parcel data, reply;
         data.writeInterfaceToken(ICameraRecordingProxyListener::getInterfaceDescriptor());
         data.writeInt64(timestamp);
@@ -56,7 +56,7 @@
 {
     switch(code) {
         case DATA_CALLBACK_TIMESTAMP: {
-            LOGV("DATA_CALLBACK_TIMESTAMP");
+            ALOGV("DATA_CALLBACK_TIMESTAMP");
             CHECK_INTERFACE(ICameraRecordingProxyListener, data, reply);
             nsecs_t timestamp = data.readInt64();
             int32_t msgType = data.readInt32();
diff --git a/libs/cpustats/ThreadCpuUsage.cpp b/libs/cpustats/ThreadCpuUsage.cpp
index 4bfbdf3..ffee039 100644
--- a/libs/cpustats/ThreadCpuUsage.cpp
+++ b/libs/cpustats/ThreadCpuUsage.cpp
@@ -31,7 +31,7 @@
         if (isEnabled) {
             rc = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &mPreviousTs);
             if (rc) {
-                LOGE("clock_gettime(CLOCK_THREAD_CPUTIME_ID) errno=%d", errno);
+                ALOGE("clock_gettime(CLOCK_THREAD_CPUTIME_ID) errno=%d", errno);
                 isEnabled = false;
             } else {
                 mWasEverEnabled = true;
@@ -39,7 +39,7 @@
                 if (!mMonotonicKnown) {
                     rc = clock_gettime(CLOCK_MONOTONIC, &mMonotonicTs);
                     if (rc) {
-                        LOGE("clock_gettime(CLOCK_MONOTONIC) errno=%d", errno);
+                        ALOGE("clock_gettime(CLOCK_MONOTONIC) errno=%d", errno);
                     } else {
                         mMonotonicKnown = true;
                     }
@@ -50,7 +50,7 @@
             struct timespec ts;
             rc = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
             if (rc) {
-                LOGE("clock_gettime(CLOCK_THREAD_CPUTIME_ID) errno=%d", errno);
+                ALOGE("clock_gettime(CLOCK_THREAD_CPUTIME_ID) errno=%d", errno);
             } else {
                 long long delta = (ts.tv_sec - mPreviousTs.tv_sec) * 1000000000LL +
                         (ts.tv_nsec - mPreviousTs.tv_nsec);
@@ -86,7 +86,7 @@
             int rc;
             rc = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
             if (rc) {
-                LOGE("clock_gettime(CLOCK_THREAD_CPUTIME_ID) errno=%d", errno);
+                ALOGE("clock_gettime(CLOCK_THREAD_CPUTIME_ID) errno=%d", errno);
             } else {
                 long long delta = (ts.tv_sec - mPreviousTs.tv_sec) * 1000000000LL +
                         (ts.tv_nsec - mPreviousTs.tv_nsec);
@@ -99,7 +99,7 @@
         mStatistics.sample((double) mAccumulator);
         mAccumulator = 0;
     } else {
-        LOGW("Can't add sample because measurements have never been enabled");
+        ALOGW("Can't add sample because measurements have never been enabled");
     }
 }
 
@@ -111,7 +111,7 @@
         int rc;
         rc = clock_gettime(CLOCK_MONOTONIC, &ts);
         if (rc) {
-            LOGE("clock_gettime(CLOCK_MONOTONIC) errno=%d", errno);
+            ALOGE("clock_gettime(CLOCK_MONOTONIC) errno=%d", errno);
             elapsed = 0;
         } else {
             // mMonotonicTs is updated only at first enable and resetStatistics
@@ -119,7 +119,7 @@
                     (ts.tv_nsec - mMonotonicTs.tv_nsec);
         }
     } else {
-        LOGW("Can't compute elapsed time because measurements have never been enabled");
+        ALOGW("Can't compute elapsed time because measurements have never been enabled");
         elapsed = 0;
     }
     return elapsed;
@@ -132,7 +132,7 @@
         int rc;
         rc = clock_gettime(CLOCK_MONOTONIC, &mMonotonicTs);
         if (rc) {
-            LOGE("clock_gettime(CLOCK_MONOTONIC) errno=%d", errno);
+            ALOGE("clock_gettime(CLOCK_MONOTONIC) errno=%d", errno);
             mMonotonicKnown = false;
         }
     }
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 86bc62a..b1b9adb 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -148,27 +148,27 @@
         err = data.writeInterfaceToken(
                 ISurfaceComposer::getInterfaceDescriptor());
         if (err != NO_ERROR) {
-            LOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing "
+            ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing "
                     "interface descriptor: %s (%d)", strerror(-err), -err);
             return false;
         }
         err = data.writeStrongBinder(surfaceTexture->asBinder());
         if (err != NO_ERROR) {
-            LOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing "
+            ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing "
                     "strong binder to parcel: %s (%d)", strerror(-err), -err);
             return false;
         }
         err = remote()->transact(BnSurfaceComposer::AUTHENTICATE_SURFACE, data,
                 &reply);
         if (err != NO_ERROR) {
-            LOGE("ISurfaceComposer::authenticateSurfaceTexture: error "
+            ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error "
                     "performing transaction: %s (%d)", strerror(-err), -err);
             return false;
         }
         int32_t result = 0;
         err = reply.readInt32(&result);
         if (err != NO_ERROR) {
-            LOGE("ISurfaceComposer::authenticateSurfaceTexture: error "
+            ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error "
                     "retrieving result: %s (%d)", strerror(-err), -err);
             return false;
         }
diff --git a/libs/gui/SensorEventQueue.cpp b/libs/gui/SensorEventQueue.cpp
index f935524..ac362fc 100644
--- a/libs/gui/SensorEventQueue.cpp
+++ b/libs/gui/SensorEventQueue.cpp
@@ -70,12 +70,12 @@
 ssize_t SensorEventQueue::read(ASensorEvent* events, size_t numEvents)
 {
     ssize_t size = mSensorChannel->read(events, numEvents*sizeof(events[0]));
-    LOGE_IF(size<0 && size!=-EAGAIN,
+    ALOGE_IF(size<0 && size!=-EAGAIN,
             "SensorChannel::read error (%s)", strerror(-size));
     if (size >= 0) {
         if (size % sizeof(events[0])) {
             // partial read!!! should never happen.
-            LOGE("SensorEventQueue partial read (event-size=%u, read=%d)",
+            ALOGE("SensorEventQueue partial read (event-size=%u, read=%d)",
                     sizeof(events[0]), int(size));
             return -EINVAL;
         }
@@ -104,7 +104,7 @@
     do {
         result = looper->pollOnce(-1);
         if (result == ALOOPER_EVENT_ERROR) {
-            LOGE("SensorChannel::waitForEvent error (errno=%d)", errno);
+            ALOGE("SensorChannel::waitForEvent error (errno=%d)", errno);
             result = -EPIPE; // unknown error, so we make up one
             break;
         }
diff --git a/libs/gui/SensorManager.cpp b/libs/gui/SensorManager.cpp
index dafcdea..b80da56 100644
--- a/libs/gui/SensorManager.cpp
+++ b/libs/gui/SensorManager.cpp
@@ -78,7 +78,7 @@
         class DeathObserver : public IBinder::DeathRecipient {
             SensorManager& mSensorManger;
             virtual void binderDied(const wp<IBinder>& who) {
-                LOGW("sensorservice died [%p]", who.unsafe_get());
+                ALOGW("sensorservice died [%p]", who.unsafe_get());
                 mSensorManger.sensorManagerDied();
             }
         public:
@@ -137,7 +137,7 @@
                 mSensorServer->createSensorEventConnection();
         if (connection == NULL) {
             // SensorService just died.
-            LOGE("createEventQueue: connection is NULL. SensorService died.");
+            ALOGE("createEventQueue: connection is NULL. SensorService died.");
             continue;
         }
         queue = new SensorEventQueue(connection);
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index ff45fa3..337950c 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -167,7 +167,7 @@
 status_t SurfaceControl::validate() const
 {
     if (mToken<0 || mClient==0) {
-        LOGE("invalid token (%d, identity=%u) or client (%p)", 
+        ALOGE("invalid token (%d, identity=%u) or client (%p)", 
                 mToken, mIdentity, mClient.get());
         return NO_INIT;
     }
@@ -254,7 +254,7 @@
     } else if (surface != 0 &&
             (surface->mSurface != NULL ||
              surface->getISurfaceTexture() != NULL)) {
-        LOGE("Parceling invalid surface with non-NULL ISurface/ISurfaceTexture as NULL: "
+        ALOGE("Parceling invalid surface with non-NULL ISurface/ISurfaceTexture as NULL: "
              "mSurface = %p, surfaceTexture = %p, mIdentity = %d, ",
              surface->mSurface.get(), surface->getISurfaceTexture().get(),
              surface->mIdentity);
@@ -304,7 +304,7 @@
 void Surface::init(const sp<ISurfaceTexture>& surfaceTexture)
 {
     if (mSurface != NULL || surfaceTexture != NULL) {
-        LOGE_IF(surfaceTexture==0, "got a NULL ISurfaceTexture from ISurface");
+        ALOGE_IF(surfaceTexture==0, "got a NULL ISurfaceTexture from ISurface");
         if (surfaceTexture != NULL) {
             setISurfaceTexture(surfaceTexture);
             setUsage(GraphicBuffer::USAGE_HW_RENDER);
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index 4772189..c80d93d 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -60,11 +60,11 @@
 #endif
 
 // Macros for including the SurfaceTexture name in log messages
-#define ST_LOGV(x, ...) LOGV("[%s] "x, mName.string(), ##__VA_ARGS__)
-#define ST_LOGD(x, ...) LOGD("[%s] "x, mName.string(), ##__VA_ARGS__)
-#define ST_LOGI(x, ...) LOGI("[%s] "x, mName.string(), ##__VA_ARGS__)
-#define ST_LOGW(x, ...) LOGW("[%s] "x, mName.string(), ##__VA_ARGS__)
-#define ST_LOGE(x, ...) LOGE("[%s] "x, mName.string(), ##__VA_ARGS__)
+#define ST_LOGV(x, ...) ALOGV("[%s] "x, mName.string(), ##__VA_ARGS__)
+#define ST_LOGD(x, ...) ALOGD("[%s] "x, mName.string(), ##__VA_ARGS__)
+#define ST_LOGI(x, ...) ALOGI("[%s] "x, mName.string(), ##__VA_ARGS__)
+#define ST_LOGW(x, ...) ALOGW("[%s] "x, mName.string(), ##__VA_ARGS__)
+#define ST_LOGE(x, ...) ALOGE("[%s] "x, mName.string(), ##__VA_ARGS__)
 
 namespace android {
 
@@ -350,7 +350,7 @@
                 }
 
                 // if buffer is FREE it CANNOT be current
-                LOGW_IF((state == BufferSlot::FREE) && (mCurrentTexture==i),
+                ALOGW_IF((state == BufferSlot::FREE) && (mCurrentTexture==i),
                         "dequeueBuffer: buffer %d is both FREE and current!",
                         i);
 
@@ -491,9 +491,9 @@
         // synchronizing access to it.  It's too late at this point to abort the
         // dequeue operation.
         if (result == EGL_FALSE) {
-            LOGE("dequeueBuffer: error waiting for fence: %#x", eglGetError());
+            ALOGE("dequeueBuffer: error waiting for fence: %#x", eglGetError());
         } else if (result == EGL_TIMEOUT_EXPIRED_KHR) {
-            LOGE("dequeueBuffer: timeout waiting for fence");
+            ALOGE("dequeueBuffer: timeout waiting for fence");
         }
         eglDestroySyncKHR(dpy, fence);
     }
@@ -802,7 +802,7 @@
                 EGLSyncKHR fence = eglCreateSyncKHR(dpy, EGL_SYNC_FENCE_KHR,
                         NULL);
                 if (fence == EGL_NO_SYNC_KHR) {
-                    LOGE("updateTexImage: error creating fence: %#x",
+                    ALOGE("updateTexImage: error creating fence: %#x",
                             eglGetError());
                     return -EINVAL;
                 }
@@ -990,7 +990,7 @@
 }
 
 void SurfaceTexture::freeAllBuffersLocked() {
-    LOGW_IF(!mQueue.isEmpty(),
+    ALOGW_IF(!mQueue.isEmpty(),
             "freeAllBuffersLocked called but mQueue is not empty");
     mCurrentTexture = INVALID_BUFFER_SLOT;
     for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
@@ -999,7 +999,7 @@
 }
 
 void SurfaceTexture::freeAllBuffersExceptHeadLocked() {
-    LOGW_IF(!mQueue.isEmpty(),
+    ALOGW_IF(!mQueue.isEmpty(),
             "freeAllBuffersExceptCurrentLocked called but mQueue is not empty");
     int head = -1;
     if (!mQueue.empty()) {
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp
index 48070d6..5f01ae9 100644
--- a/libs/gui/SurfaceTextureClient.cpp
+++ b/libs/gui/SurfaceTextureClient.cpp
@@ -136,13 +136,13 @@
 }
 
 int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer) {
-    LOGV("SurfaceTextureClient::dequeueBuffer");
+    ALOGV("SurfaceTextureClient::dequeueBuffer");
     Mutex::Autolock lock(mMutex);
     int buf = -1;
     status_t result = mSurfaceTexture->dequeueBuffer(&buf, mReqWidth, mReqHeight,
             mReqFormat, mReqUsage);
     if (result < 0) {
-        LOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer(%d, %d, %d, %d)"
+        ALOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer(%d, %d, %d, %d)"
              "failed: %d", mReqWidth, mReqHeight, mReqFormat, mReqUsage,
              result);
         return result;
@@ -155,7 +155,7 @@
     if ((result & ISurfaceTexture::BUFFER_NEEDS_REALLOCATION) || gbuf == 0) {
         result = mSurfaceTexture->requestBuffer(buf, &gbuf);
         if (result != NO_ERROR) {
-            LOGE("dequeueBuffer: ISurfaceTexture::requestBuffer failed: %d",
+            ALOGE("dequeueBuffer: ISurfaceTexture::requestBuffer failed: %d",
                     result);
             return result;
         }
@@ -165,7 +165,7 @@
 }
 
 int SurfaceTextureClient::cancelBuffer(android_native_buffer_t* buffer) {
-    LOGV("SurfaceTextureClient::cancelBuffer");
+    ALOGV("SurfaceTextureClient::cancelBuffer");
     Mutex::Autolock lock(mMutex);
     int i = getSlotFromBufferLocked(buffer);
     if (i < 0) {
@@ -183,13 +183,13 @@
         // a buffer.
         if (mSlots[i] == NULL) {
             if (!dumpedState) {
-                LOGD("getSlotFromBufferLocked: encountered NULL buffer in slot %d "
+                ALOGD("getSlotFromBufferLocked: encountered NULL buffer in slot %d "
                         "looking for buffer %p", i, buffer->handle);
                 for (int j = 0; j < NUM_BUFFER_SLOTS; j++) {
                     if (mSlots[j] == NULL) {
-                        LOGD("getSlotFromBufferLocked:   %02d: NULL", j);
+                        ALOGD("getSlotFromBufferLocked:   %02d: NULL", j);
                     } else {
-                        LOGD("getSlotFromBufferLocked:   %02d: %p", j, mSlots[j]->handle);
+                        ALOGD("getSlotFromBufferLocked:   %02d: %p", j, mSlots[j]->handle);
                     }
                 }
                 dumpedState = true;
@@ -200,23 +200,23 @@
             return i;
         }
     }
-    LOGE("getSlotFromBufferLocked: unknown buffer: %p", buffer->handle);
+    ALOGE("getSlotFromBufferLocked: unknown buffer: %p", buffer->handle);
     return BAD_VALUE;
 }
 
 int SurfaceTextureClient::lockBuffer(android_native_buffer_t* buffer) {
-    LOGV("SurfaceTextureClient::lockBuffer");
+    ALOGV("SurfaceTextureClient::lockBuffer");
     Mutex::Autolock lock(mMutex);
     return OK;
 }
 
 int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) {
-    LOGV("SurfaceTextureClient::queueBuffer");
+    ALOGV("SurfaceTextureClient::queueBuffer");
     Mutex::Autolock lock(mMutex);
     int64_t timestamp;
     if (mTimestamp == NATIVE_WINDOW_TIMESTAMP_AUTO) {
         timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
-        LOGV("SurfaceTextureClient::queueBuffer making up timestamp: %.2f ms",
+        ALOGV("SurfaceTextureClient::queueBuffer making up timestamp: %.2f ms",
              timestamp / 1000000.f);
     } else {
         timestamp = mTimestamp;
@@ -228,13 +228,13 @@
     status_t err = mSurfaceTexture->queueBuffer(i, timestamp,
             &mDefaultWidth, &mDefaultHeight, &mTransformHint);
     if (err != OK)  {
-        LOGE("queueBuffer: error queuing buffer to SurfaceTexture, %d", err);
+        ALOGE("queueBuffer: error queuing buffer to SurfaceTexture, %d", err);
     }
     return err;
 }
 
 int SurfaceTextureClient::query(int what, int* value) const {
-    LOGV("SurfaceTextureClient::query");
+    ALOGV("SurfaceTextureClient::query");
     { // scope for the lock
         Mutex::Autolock lock(mMutex);
         switch (what) {
@@ -402,7 +402,7 @@
 
 
 int SurfaceTextureClient::connect(int api) {
-    LOGV("SurfaceTextureClient::connect");
+    ALOGV("SurfaceTextureClient::connect");
     Mutex::Autolock lock(mMutex);
     int err = mSurfaceTexture->connect(api,
             &mDefaultWidth, &mDefaultHeight, &mTransformHint);
@@ -413,7 +413,7 @@
 }
 
 int SurfaceTextureClient::disconnect(int api) {
-    LOGV("SurfaceTextureClient::disconnect");
+    ALOGV("SurfaceTextureClient::disconnect");
     Mutex::Autolock lock(mMutex);
     freeAllBuffers();
     int err = mSurfaceTexture->disconnect(api);
@@ -431,7 +431,7 @@
 
 int SurfaceTextureClient::setUsage(uint32_t reqUsage)
 {
-    LOGV("SurfaceTextureClient::setUsage");
+    ALOGV("SurfaceTextureClient::setUsage");
     Mutex::Autolock lock(mMutex);
     mReqUsage = reqUsage;
     return OK;
@@ -439,7 +439,7 @@
 
 int SurfaceTextureClient::setCrop(Rect const* rect)
 {
-    LOGV("SurfaceTextureClient::setCrop");
+    ALOGV("SurfaceTextureClient::setCrop");
     Mutex::Autolock lock(mMutex);
 
     Rect realRect;
@@ -450,18 +450,18 @@
     }
 
     status_t err = mSurfaceTexture->setCrop(*rect);
-    LOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err));
+    ALOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err));
 
     return err;
 }
 
 int SurfaceTextureClient::setBufferCount(int bufferCount)
 {
-    LOGV("SurfaceTextureClient::setBufferCount");
+    ALOGV("SurfaceTextureClient::setBufferCount");
     Mutex::Autolock lock(mMutex);
 
     status_t err = mSurfaceTexture->setBufferCount(bufferCount);
-    LOGE_IF(err, "ISurfaceTexture::setBufferCount(%d) returned %s",
+    ALOGE_IF(err, "ISurfaceTexture::setBufferCount(%d) returned %s",
             bufferCount, strerror(-err));
 
     if (err == NO_ERROR) {
@@ -473,7 +473,7 @@
 
 int SurfaceTextureClient::setBuffersDimensions(int w, int h)
 {
-    LOGV("SurfaceTextureClient::setBuffersDimensions");
+    ALOGV("SurfaceTextureClient::setBuffersDimensions");
     Mutex::Autolock lock(mMutex);
 
     if (w<0 || h<0)
@@ -486,14 +486,14 @@
     mReqHeight = h;
 
     status_t err = mSurfaceTexture->setCrop(Rect(0, 0));
-    LOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err));
+    ALOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err));
 
     return err;
 }
 
 int SurfaceTextureClient::setBuffersFormat(int format)
 {
-    LOGV("SurfaceTextureClient::setBuffersFormat");
+    ALOGV("SurfaceTextureClient::setBuffersFormat");
     Mutex::Autolock lock(mMutex);
 
     if (format<0)
@@ -506,11 +506,11 @@
 
 int SurfaceTextureClient::setScalingMode(int mode)
 {
-    LOGV("SurfaceTextureClient::setScalingMode(%d)", mode);
+    ALOGV("SurfaceTextureClient::setScalingMode(%d)", mode);
     Mutex::Autolock lock(mMutex);
     // mode is validated on the server
     status_t err = mSurfaceTexture->setScalingMode(mode);
-    LOGE_IF(err, "ISurfaceTexture::setScalingMode(%d) returned %s",
+    ALOGE_IF(err, "ISurfaceTexture::setScalingMode(%d) returned %s",
             mode, strerror(-err));
 
     return err;
@@ -518,7 +518,7 @@
 
 int SurfaceTextureClient::setBuffersTransform(int transform)
 {
-    LOGV("SurfaceTextureClient::setBuffersTransform");
+    ALOGV("SurfaceTextureClient::setBuffersTransform");
     Mutex::Autolock lock(mMutex);
     status_t err = mSurfaceTexture->setTransform(transform);
     return err;
@@ -526,7 +526,7 @@
 
 int SurfaceTextureClient::setBuffersTimestamp(int64_t timestamp)
 {
-    LOGV("SurfaceTextureClient::setBuffersTimestamp");
+    ALOGV("SurfaceTextureClient::setBuffersTimestamp");
     Mutex::Autolock lock(mMutex);
     mTimestamp = timestamp;
     return NO_ERROR;
@@ -551,11 +551,11 @@
     status_t err;
     uint8_t const * src_bits = NULL;
     err = src->lock(GRALLOC_USAGE_SW_READ_OFTEN, reg.bounds(), (void**)&src_bits);
-    LOGE_IF(err, "error locking src buffer %s", strerror(-err));
+    ALOGE_IF(err, "error locking src buffer %s", strerror(-err));
 
     uint8_t* dst_bits = NULL;
     err = dst->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, reg.bounds(), (void**)&dst_bits);
-    LOGE_IF(err, "error locking dst buffer %s", strerror(-err));
+    ALOGE_IF(err, "error locking dst buffer %s", strerror(-err));
 
     Region::const_iterator head(reg.begin());
     Region::const_iterator tail(reg.end());
@@ -598,7 +598,7 @@
         ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds)
 {
     if (mLockedBuffer != 0) {
-        LOGE("Surface::lock failed, already locked");
+        ALOGE("Surface::lock failed, already locked");
         return INVALID_OPERATION;
     }
 
@@ -613,11 +613,11 @@
 
     ANativeWindowBuffer* out;
     status_t err = dequeueBuffer(&out);
-    LOGE_IF(err, "dequeueBuffer failed (%s)", strerror(-err));
+    ALOGE_IF(err, "dequeueBuffer failed (%s)", strerror(-err));
     if (err == NO_ERROR) {
         sp<GraphicBuffer> backBuffer(GraphicBuffer::getSelf(out));
         err = lockBuffer(backBuffer.get());
-        LOGE_IF(err, "lockBuffer (handle=%p) failed (%s)",
+        ALOGE_IF(err, "lockBuffer (handle=%p) failed (%s)",
                 backBuffer->handle, strerror(-err));
         if (err == NO_ERROR) {
             const Rect bounds(backBuffer->width, backBuffer->height);
@@ -661,7 +661,7 @@
                     GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
                     newDirtyRegion.bounds(), &vaddr);
 
-            LOGW_IF(res, "failed locking buffer (handle = %p)",
+            ALOGW_IF(res, "failed locking buffer (handle = %p)",
                     backBuffer->handle);
 
             mLockedBuffer = backBuffer;
@@ -678,15 +678,15 @@
 status_t SurfaceTextureClient::unlockAndPost()
 {
     if (mLockedBuffer == 0) {
-        LOGE("Surface::unlockAndPost failed, no locked buffer");
+        ALOGE("Surface::unlockAndPost failed, no locked buffer");
         return INVALID_OPERATION;
     }
 
     status_t err = mLockedBuffer->unlock();
-    LOGE_IF(err, "failed unlocking buffer (%p)", mLockedBuffer->handle);
+    ALOGE_IF(err, "failed unlocking buffer (%p)", mLockedBuffer->handle);
 
     err = queueBuffer(mLockedBuffer.get());
-    LOGE_IF(err, "queueBuffer (handle=%p) failed (%s)",
+    ALOGE_IF(err, "queueBuffer (handle=%p) failed (%s)",
             mLockedBuffer->handle, strerror(-err));
 
     mPostedBuffer = mLockedBuffer;
diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp
index c313904..b18e7b0 100644
--- a/libs/gui/tests/SurfaceTexture_test.cpp
+++ b/libs/gui/tests/SurfaceTexture_test.cpp
@@ -1399,12 +1399,12 @@
         // test.
         void waitForFrame() {
             Mutex::Autolock lock(mMutex);
-            LOGV("+waitForFrame");
+            ALOGV("+waitForFrame");
             while (!mFrameAvailable) {
                 mFrameAvailableCondition.wait(mMutex);
             }
             mFrameAvailable = false;
-            LOGV("-waitForFrame");
+            ALOGV("-waitForFrame");
         }
 
         // Allow the producer to return from its swapBuffers call and continue
@@ -1412,23 +1412,23 @@
         // thread once for every frame expected by the test.
         void finishFrame() {
             Mutex::Autolock lock(mMutex);
-            LOGV("+finishFrame");
+            ALOGV("+finishFrame");
             mFrameFinished = true;
             mFrameFinishCondition.signal();
-            LOGV("-finishFrame");
+            ALOGV("-finishFrame");
         }
 
         // This should be called by SurfaceTexture on the producer thread.
         virtual void onFrameAvailable() {
             Mutex::Autolock lock(mMutex);
-            LOGV("+onFrameAvailable");
+            ALOGV("+onFrameAvailable");
             mFrameAvailable = true;
             mFrameAvailableCondition.signal();
             while (!mFrameFinished) {
                 mFrameFinishCondition.wait(mMutex);
             }
             mFrameFinished = false;
-            LOGV("-onFrameAvailable");
+            ALOGV("-onFrameAvailable");
         }
 
     protected:
@@ -1514,9 +1514,9 @@
             for (int i = 0; i < NUM_ITERATIONS; i++) {
                 glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
                 glClear(GL_COLOR_BUFFER_BIT);
-                LOGV("+swapBuffers");
+                ALOGV("+swapBuffers");
                 swapBuffers();
-                LOGV("-swapBuffers");
+                ALOGV("-swapBuffers");
             }
         }
     };
@@ -1525,9 +1525,9 @@
 
     for (int i = 0; i < NUM_ITERATIONS; i++) {
         mFC->waitForFrame();
-        LOGV("+updateTexImage");
+        ALOGV("+updateTexImage");
         mST->updateTexImage();
-        LOGV("-updateTexImage");
+        ALOGV("-updateTexImage");
         mFC->finishFrame();
 
         // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported!
@@ -1543,9 +1543,9 @@
             for (int i = 0; i < NUM_ITERATIONS; i++) {
                 glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
                 glClear(GL_COLOR_BUFFER_BIT);
-                LOGV("+swapBuffers");
+                ALOGV("+swapBuffers");
                 swapBuffers();
-                LOGV("-swapBuffers");
+                ALOGV("-swapBuffers");
             }
         }
     };
@@ -1555,9 +1555,9 @@
     for (int i = 0; i < NUM_ITERATIONS; i++) {
         mFC->waitForFrame();
         mFC->finishFrame();
-        LOGV("+updateTexImage");
+        ALOGV("+updateTexImage");
         mST->updateTexImage();
-        LOGV("-updateTexImage");
+        ALOGV("-updateTexImage");
 
         // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported!
     }
@@ -1573,9 +1573,9 @@
             for (int i = 0; i < NUM_ITERATIONS; i++) {
                 glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
                 glClear(GL_COLOR_BUFFER_BIT);
-                LOGV("+swapBuffers");
+                ALOGV("+swapBuffers");
                 swapBuffers();
-                LOGV("-swapBuffers");
+                ALOGV("-swapBuffers");
             }
         }
     };
@@ -1624,9 +1624,9 @@
     for (int i = 0; i < NUM_ITERATIONS-3; i++) {
         mFC->waitForFrame();
         mFC->finishFrame();
-        LOGV("+updateTexImage");
+        ALOGV("+updateTexImage");
         mST->updateTexImage();
-        LOGV("-updateTexImage");
+        ALOGV("-updateTexImage");
     }
 }
 
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index f293cba..b6b35ea 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -37,7 +37,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #if DEBUG_CACHE_FLUSH
-    #define FLUSH_LOGD(...) LOGD(__VA_ARGS__)
+    #define FLUSH_LOGD(...) ALOGD(__VA_ARGS__)
 #else
     #define FLUSH_LOGD(...)
 #endif
@@ -50,7 +50,7 @@
     GLint maxTextureUnits;
     glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
     if (maxTextureUnits < REQUIRED_TEXTURE_UNITS_COUNT) {
-        LOGW("At least %d texture units are required!", REQUIRED_TEXTURE_UNITS_COUNT);
+        ALOGW("At least %d texture units are required!", REQUIRED_TEXTURE_UNITS_COUNT);
     }
 
     glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
@@ -58,7 +58,7 @@
     init();
 
     mDebugLevel = readDebugLevel();
-    LOGD("Enabling debug mode %d", mDebugLevel);
+    ALOGD("Enabling debug mode %d", mDebugLevel);
 
 #if RENDER_LAYERS_AS_REGIONS
     INIT_LOGD("Layers will be composited as regions");
@@ -108,7 +108,7 @@
 void Caches::dumpMemoryUsage() {
     String8 stringLog;
     dumpMemoryUsage(stringLog);
-    LOGD("%s", stringLog.string());
+    ALOGD("%s", stringLog.string());
 }
 
 void Caches::dumpMemoryUsage(String8 &log) {
diff --git a/libs/hwui/Debug.h b/libs/hwui/Debug.h
index 7cbb39d..0ad0c2a 100644
--- a/libs/hwui/Debug.h
+++ b/libs/hwui/Debug.h
@@ -66,7 +66,7 @@
 #define DEBUG_DISPLAY_LIST 0
 
 #if DEBUG_INIT
-    #define INIT_LOGD(...) LOGD(__VA_ARGS__)
+    #define INIT_LOGD(...) ALOGD(__VA_ARGS__)
 #else
     #define INIT_LOGD(...)
 #endif
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 3372d1c..751da44 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -214,7 +214,7 @@
         indent[i] = ' ';
     }
     indent[count] = '\0';
-    LOGD("%sStart display list (%p)", (char*) indent + 2, this);
+    ALOGD("%sStart display list (%p)", (char*) indent + 2, this);
 
     int saveCount = renderer.getSaveCount() - 1;
 
@@ -226,21 +226,21 @@
         switch (op) {
             case DrawGLFunction: {
                 Functor *functor = (Functor *) getInt();
-                LOGD("%s%s %p", (char*) indent, OP_NAMES[op], functor);
+                ALOGD("%s%s %p", (char*) indent, OP_NAMES[op], functor);
             }
             break;
             case Save: {
                 int rendererNum = getInt();
-                LOGD("%s%s %d", (char*) indent, OP_NAMES[op], rendererNum);
+                ALOGD("%s%s %d", (char*) indent, OP_NAMES[op], rendererNum);
             }
             break;
             case Restore: {
-                LOGD("%s%s", (char*) indent, OP_NAMES[op]);
+                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
             }
             break;
             case RestoreToCount: {
                 int restoreCount = saveCount + getInt();
-                LOGD("%s%s %d", (char*) indent, OP_NAMES[op], restoreCount);
+                ALOGD("%s%s %d", (char*) indent, OP_NAMES[op], restoreCount);
             }
             break;
             case SaveLayer: {
@@ -250,7 +250,7 @@
                 float f4 = getFloat();
                 SkPaint* paint = getPaint();
                 int flags = getInt();
-                LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p, 0x%x", (char*) indent,
+                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p, 0x%x", (char*) indent,
                     OP_NAMES[op], f1, f2, f3, f4, paint, flags);
             }
             break;
@@ -261,41 +261,41 @@
                 float f4 = getFloat();
                 int alpha = getInt();
                 int flags = getInt();
-                LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", (char*) indent,
+                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", (char*) indent,
                     OP_NAMES[op], f1, f2, f3, f4, alpha, flags);
             }
             break;
             case Translate: {
                 float f1 = getFloat();
                 float f2 = getFloat();
-                LOGD("%s%s %.2f, %.2f", (char*) indent, OP_NAMES[op], f1, f2);
+                ALOGD("%s%s %.2f, %.2f", (char*) indent, OP_NAMES[op], f1, f2);
             }
             break;
             case Rotate: {
                 float rotation = getFloat();
-                LOGD("%s%s %.2f", (char*) indent, OP_NAMES[op], rotation);
+                ALOGD("%s%s %.2f", (char*) indent, OP_NAMES[op], rotation);
             }
             break;
             case Scale: {
                 float sx = getFloat();
                 float sy = getFloat();
-                LOGD("%s%s %.2f, %.2f", (char*) indent, OP_NAMES[op], sx, sy);
+                ALOGD("%s%s %.2f, %.2f", (char*) indent, OP_NAMES[op], sx, sy);
             }
             break;
             case Skew: {
                 float sx = getFloat();
                 float sy = getFloat();
-                LOGD("%s%s %.2f, %.2f", (char*) indent, OP_NAMES[op], sx, sy);
+                ALOGD("%s%s %.2f, %.2f", (char*) indent, OP_NAMES[op], sx, sy);
             }
             break;
             case SetMatrix: {
                 SkMatrix* matrix = getMatrix();
-                LOGD("%s%s %p", (char*) indent, OP_NAMES[op], matrix);
+                ALOGD("%s%s %p", (char*) indent, OP_NAMES[op], matrix);
             }
             break;
             case ConcatMatrix: {
                 SkMatrix* matrix = getMatrix();
-                LOGD("%s%s %p", (char*) indent, OP_NAMES[op], matrix);
+                ALOGD("%s%s %p", (char*) indent, OP_NAMES[op], matrix);
             }
             break;
             case ClipRect: {
@@ -304,7 +304,7 @@
                 float f3 = getFloat();
                 float f4 = getFloat();
                 int regionOp = getInt();
-                LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d", (char*) indent, OP_NAMES[op],
+                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d", (char*) indent, OP_NAMES[op],
                     f1, f2, f3, f4, regionOp);
             }
             break;
@@ -312,7 +312,7 @@
                 DisplayList* displayList = getDisplayList();
                 uint32_t width = getUInt();
                 uint32_t height = getUInt();
-                LOGD("%s%s %p, %dx%d, %d", (char*) indent, OP_NAMES[op],
+                ALOGD("%s%s %p, %dx%d, %d", (char*) indent, OP_NAMES[op],
                     displayList, width, height, level + 1);
                 renderer.outputDisplayList(displayList, level + 1);
             }
@@ -322,7 +322,7 @@
                 float x = getFloat();
                 float y = getFloat();
                 SkPaint* paint = getPaint();
-                LOGD("%s%s %p, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
+                ALOGD("%s%s %p, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
                     layer, x, y, paint);
             }
             break;
@@ -331,7 +331,7 @@
                 float x = getFloat();
                 float y = getFloat();
                 SkPaint* paint = getPaint();
-                LOGD("%s%s %p, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
+                ALOGD("%s%s %p, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
                     bitmap, x, y, paint);
             }
             break;
@@ -339,7 +339,7 @@
                 SkBitmap* bitmap = getBitmap();
                 SkMatrix* matrix = getMatrix();
                 SkPaint* paint = getPaint();
-                LOGD("%s%s %p, %p, %p", (char*) indent, OP_NAMES[op],
+                ALOGD("%s%s %p, %p, %p", (char*) indent, OP_NAMES[op],
                     bitmap, matrix, paint);
             }
             break;
@@ -354,7 +354,7 @@
                 float f7 = getFloat();
                 float f8 = getFloat();
                 SkPaint* paint = getPaint();
-                LOGD("%s%s %p, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %p",
+                ALOGD("%s%s %p, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %p",
                     (char*) indent, OP_NAMES[op], bitmap, f1, f2, f3, f4, f5, f6, f7, f8, paint);
             }
             break;
@@ -368,7 +368,7 @@
                 bool hasColors = getInt();
                 int* colors = hasColors ? getInts(colorsCount) : NULL;
                 SkPaint* paint = getPaint();
-                LOGD("%s%s", (char*) indent, OP_NAMES[op]);
+                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
             }
             break;
             case DrawPatch: {
@@ -387,14 +387,14 @@
                 float right = getFloat();
                 float bottom = getFloat();
                 SkPaint* paint = getPaint();
-                LOGD("%s%s %.2f, %.2f, %.2f, %.2f", (char*) indent, OP_NAMES[op],
+                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f", (char*) indent, OP_NAMES[op],
                         left, top, right, bottom);
             }
             break;
             case DrawColor: {
                 int color = getInt();
                 int xferMode = getInt();
-                LOGD("%s%s 0x%x %d", (char*) indent, OP_NAMES[op], color, xferMode);
+                ALOGD("%s%s 0x%x %d", (char*) indent, OP_NAMES[op], color, xferMode);
             }
             break;
             case DrawRect: {
@@ -403,7 +403,7 @@
                 float f3 = getFloat();
                 float f4 = getFloat();
                 SkPaint* paint = getPaint();
-                LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
+                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
                     f1, f2, f3, f4, paint);
             }
             break;
@@ -415,7 +415,7 @@
                 float f5 = getFloat();
                 float f6 = getFloat();
                 SkPaint* paint = getPaint();
-                LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %p",
+                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %p",
                     (char*) indent, OP_NAMES[op], f1, f2, f3, f4, f5, f6, paint);
             }
             break;
@@ -424,7 +424,7 @@
                 float f2 = getFloat();
                 float f3 = getFloat();
                 SkPaint* paint = getPaint();
-                LOGD("%s%s %.2f, %.2f, %.2f, %p",
+                ALOGD("%s%s %.2f, %.2f, %.2f, %p",
                     (char*) indent, OP_NAMES[op], f1, f2, f3, paint);
             }
             break;
@@ -434,7 +434,7 @@
                 float f3 = getFloat();
                 float f4 = getFloat();
                 SkPaint* paint = getPaint();
-                LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p",
+                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p",
                     (char*) indent, OP_NAMES[op], f1, f2, f3, f4, paint);
             }
             break;
@@ -447,28 +447,28 @@
                 float f6 = getFloat();
                 int i1 = getInt();
                 SkPaint* paint = getPaint();
-                LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %d, %p",
+                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %d, %p",
                     (char*) indent, OP_NAMES[op], f1, f2, f3, f4, f5, f6, i1, paint);
             }
             break;
             case DrawPath: {
                 SkPath* path = getPath();
                 SkPaint* paint = getPaint();
-                LOGD("%s%s %p, %p", (char*) indent, OP_NAMES[op], path, paint);
+                ALOGD("%s%s %p, %p", (char*) indent, OP_NAMES[op], path, paint);
             }
             break;
             case DrawLines: {
                 int count = 0;
                 float* points = getFloats(count);
                 SkPaint* paint = getPaint();
-                LOGD("%s%s", (char*) indent, OP_NAMES[op]);
+                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
             }
             break;
             case DrawPoints: {
                 int count = 0;
                 float* points = getFloats(count);
                 SkPaint* paint = getPaint();
-                LOGD("%s%s", (char*) indent, OP_NAMES[op]);
+                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
             }
             break;
             case DrawText: {
@@ -477,30 +477,30 @@
                 float x = getFloat();
                 float y = getFloat();
                 SkPaint* paint = getPaint();
-                LOGD("%s%s %s, %d, %d, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
+                ALOGD("%s%s %s, %d, %d, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
                     text.text(), text.length(), count, x, y, paint);
             }
             break;
             case ResetShader: {
-                LOGD("%s%s", (char*) indent, OP_NAMES[op]);
+                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
             }
             break;
             case SetupShader: {
                 SkiaShader* shader = getShader();
-                LOGD("%s%s %p", (char*) indent, OP_NAMES[op], shader);
+                ALOGD("%s%s %p", (char*) indent, OP_NAMES[op], shader);
             }
             break;
             case ResetColorFilter: {
-                LOGD("%s%s", (char*) indent, OP_NAMES[op]);
+                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
             }
             break;
             case SetupColorFilter: {
                 SkiaColorFilter *colorFilter = getColorFilter();
-                LOGD("%s%s %p", (char*) indent, OP_NAMES[op], colorFilter);
+                ALOGD("%s%s %p", (char*) indent, OP_NAMES[op], colorFilter);
             }
             break;
             case ResetShadow: {
-                LOGD("%s%s", (char*) indent, OP_NAMES[op]);
+                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
             }
             break;
             case SetupShadow: {
@@ -508,18 +508,18 @@
                 float dx = getFloat();
                 float dy = getFloat();
                 int color = getInt();
-                LOGD("%s%s %.2f, %.2f, %.2f, 0x%x", (char*) indent, OP_NAMES[op],
+                ALOGD("%s%s %.2f, %.2f, %.2f, 0x%x", (char*) indent, OP_NAMES[op],
                     radius, dx, dy, color);
             }
             break;
             default:
-                LOGD("Display List error: op not handled: %s%s",
+                ALOGD("Display List error: op not handled: %s%s",
                     (char*) indent, OP_NAMES[op]);
                 break;
         }
     }
 
-    LOGD("%sDone", (char*) indent + 2);
+    ALOGD("%sDone", (char*) indent + 2);
 }
 
 /**
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index ab475bf..f4ae573 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -43,7 +43,7 @@
 
 // Debug
 #if DEBUG_DISPLAY_LIST
-    #define DISPLAY_LIST_LOGD(...) LOGD(__VA_ARGS__)
+    #define DISPLAY_LIST_LOGD(...) ALOGD(__VA_ARGS__)
 #else
     #define DISPLAY_LIST_LOGD(...)
 #endif
diff --git a/libs/hwui/Extensions.h b/libs/hwui/Extensions.h
index 38d1130..68e33cd 100644
--- a/libs/hwui/Extensions.h
+++ b/libs/hwui/Extensions.h
@@ -34,7 +34,7 @@
 
 // Debug
 #if DEBUG_EXTENSIONS
-    #define EXT_LOGD(...) LOGD(__VA_ARGS__)
+    #define EXT_LOGD(...) ALOGD(__VA_ARGS__)
 #else
     #define EXT_LOGD(...)
 #endif
@@ -87,7 +87,7 @@
     }
 
     void dump() {
-        LOGD("Supported extensions:\n%s", mExtensions);
+        ALOGD("Supported extensions:\n%s", mExtensions);
     }
 
 private:
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index 158f785..42e672b 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -126,7 +126,7 @@
     for (cacheX = glyph->mStartX, bX = nPenX; cacheX < endX; cacheX++, bX++) {
         for (cacheY = glyph->mStartY, bY = nPenY; cacheY < endY; cacheY++, bY++) {
             if (bX < 0 || bY < 0 || bX >= (int32_t) bitmapW || bY >= (int32_t) bitmapH) {
-                LOGE("Skipping invalid index");
+                ALOGE("Skipping invalid index");
                 continue;
             }
             uint8_t tempCol = cacheBuffer[cacheY * cacheWidth + cacheX];
@@ -168,7 +168,7 @@
 void Font::measure(SkPaint* paint, const char* text, uint32_t start, uint32_t len,
         int numGlyphs, Rect *bounds) {
     if (bounds == NULL) {
-        LOGE("No return rectangle provided to measure text");
+        ALOGE("No return rectangle provided to measure text");
         return;
     }
     bounds->set(1e6, -1e6, -1e6, 1e6);
@@ -401,7 +401,7 @@
             initTextTexture(true);
         }
         if (glyph.fHeight + 2 > mCacheLines[mCacheLines.size() - 1]->mMaxHeight) {
-            LOGE("Font size to large to fit in cache. width, height = %i, %i",
+            ALOGE("Font size to large to fit in cache. width, height = %i, %i",
                     (int) glyph.fWidth, (int) glyph.fHeight);
             return false;
         }
@@ -433,7 +433,7 @@
 
         // if we still don't fit, something is wrong and we shouldn't draw
         if (!bitmapFit) {
-            LOGE("Bitmap doesn't fit in cache. width, height = %i, %i",
+            ALOGE("Bitmap doesn't fit in cache. width, height = %i, %i",
                     (int) glyph.fWidth, (int) glyph.fHeight);
             return false;
         }
@@ -758,12 +758,12 @@
     checkInit();
 
     if (!mCurrentFont) {
-        LOGE("No font set");
+        ALOGE("No font set");
         return false;
     }
 
     if (mPositionAttrSlot < 0 || mTexcoordAttrSlot < 0) {
-        LOGE("Font renderer unable to draw, attribute slots undefined");
+        ALOGE("Font renderer unable to draw, attribute slots undefined");
         return false;
     }
 
diff --git a/libs/hwui/GradientCache.cpp b/libs/hwui/GradientCache.cpp
index aacf22a..27c2677 100644
--- a/libs/hwui/GradientCache.cpp
+++ b/libs/hwui/GradientCache.cpp
@@ -154,7 +154,7 @@
 void GradientCache::generateTexture(SkBitmap* bitmap, Texture* texture) {
     SkAutoLockPixels autoLock(*bitmap);
     if (!bitmap->readyToDraw()) {
-        LOGE("Cannot generate texture from shader");
+        ALOGE("Cannot generate texture from shader");
         return;
     }
 
diff --git a/libs/hwui/GradientCache.h b/libs/hwui/GradientCache.h
index 7339853..7e2c69a 100644
--- a/libs/hwui/GradientCache.h
+++ b/libs/hwui/GradientCache.h
@@ -19,6 +19,7 @@
 
 #include <SkShader.h>
 
+#include <utils/threads.h>
 #include <utils/Vector.h>
 
 #include "Texture.h"
diff --git a/libs/hwui/LayerCache.h b/libs/hwui/LayerCache.h
index c14c9ca..fd698e2 100644
--- a/libs/hwui/LayerCache.h
+++ b/libs/hwui/LayerCache.h
@@ -31,7 +31,7 @@
 
 // Debug
 #if DEBUG_LAYERS
-    #define LAYER_LOGD(...) LOGD(__VA_ARGS__)
+    #define LAYER_LOGD(...) ALOGD(__VA_ARGS__)
 #else
     #define LAYER_LOGD(...)
 #endif
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index e38b479..60c9d60 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -184,14 +184,14 @@
 
     GLuint fbo = Caches::getInstance().fboCache.get();
     if (!fbo) {
-        LOGW("Could not obtain an FBO");
+        ALOGW("Could not obtain an FBO");
         return NULL;
     }
 
     glActiveTexture(GL_TEXTURE0);
     Layer* layer = Caches::getInstance().layerCache.get(width, height);
     if (!layer) {
-        LOGW("Could not obtain a layer");
+        ALOGW("Could not obtain a layer");
         return NULL;
     }
 
@@ -216,7 +216,7 @@
         layer->allocateTexture(GL_RGBA, GL_UNSIGNED_BYTE);
 
         if (glGetError() != GL_NO_ERROR) {
-            LOGD("Could not allocate texture for layer (fbo=%d %dx%d)",
+            ALOGD("Could not allocate texture for layer (fbo=%d %dx%d)",
                     fbo, width, height);
 
             glBindFramebuffer(GL_FRAMEBUFFER, previousFbo);
@@ -338,7 +338,7 @@
 
         GLuint fbo = caches.fboCache.get();
         if (!fbo) {
-            LOGW("Could not obtain an FBO");
+            ALOGW("Could not obtain an FBO");
             return false;
         }
 
@@ -439,7 +439,7 @@
 error:
 #if DEBUG_OPENGL
         if (error != GL_NO_ERROR) {
-            LOGD("GL error while copying layer into bitmap = 0x%x", error);
+            ALOGD("GL error while copying layer into bitmap = 0x%x", error);
         }
 #endif
 
diff --git a/libs/hwui/LayerRenderer.h b/libs/hwui/LayerRenderer.h
index 6104301..fe28e31 100644
--- a/libs/hwui/LayerRenderer.h
+++ b/libs/hwui/LayerRenderer.h
@@ -33,7 +33,7 @@
 
 // Debug
 #if DEBUG_LAYER_RENDERER
-    #define LAYER_RENDERER_LOGD(...) LOGD(__VA_ARGS__)
+    #define LAYER_RENDERER_LOGD(...) ALOGD(__VA_ARGS__)
 #else
     #define LAYER_RENDERER_LOGD(...)
 #endif
diff --git a/libs/hwui/Matrix.cpp b/libs/hwui/Matrix.cpp
index 769c99c..a8f937d 100644
--- a/libs/hwui/Matrix.cpp
+++ b/libs/hwui/Matrix.cpp
@@ -374,12 +374,12 @@
 }
 
 void Matrix4::dump() const {
-    LOGD("Matrix4[simple=%d", mSimpleMatrix);
-    LOGD("  %f %f %f %f", data[kScaleX], data[kSkewX], data[8], data[kTranslateX]);
-    LOGD("  %f %f %f %f", data[kSkewY], data[kScaleY], data[9], data[kTranslateY]);
-    LOGD("  %f %f %f %f", data[2], data[6], data[kScaleZ], data[kTranslateZ]);
-    LOGD("  %f %f %f %f", data[kPerspective0], data[kPerspective1], data[11], data[kPerspective2]);
-    LOGD("]");
+    ALOGD("Matrix4[simple=%d", mSimpleMatrix);
+    ALOGD("  %f %f %f %f", data[kScaleX], data[kSkewX], data[8], data[kTranslateX]);
+    ALOGD("  %f %f %f %f", data[kSkewY], data[kScaleY], data[9], data[kTranslateY]);
+    ALOGD("  %f %f %f %f", data[2], data[6], data[kScaleZ], data[kTranslateZ]);
+    ALOGD("  %f %f %f %f", data[kPerspective0], data[kPerspective1], data[11], data[kPerspective2]);
+    ALOGD("]");
 }
 
 }; // namespace uirenderer
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 4d22646..5089c5c 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -173,10 +173,10 @@
 #if DEBUG_OPENGL
     GLenum status = GL_NO_ERROR;
     while ((status = glGetError()) != GL_NO_ERROR) {
-        LOGD("GL error from OpenGLRenderer: 0x%x", status);
+        ALOGD("GL error from OpenGLRenderer: 0x%x", status);
         switch (status) {
             case GL_OUT_OF_MEMORY:
-                LOGE("  OpenGLRenderer is out of memory!");
+                ALOGE("  OpenGLRenderer is out of memory!");
                 break;
         }
     }
@@ -539,7 +539,7 @@
 #if DEBUG_LAYERS_AS_REGIONS
     GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
     if (status != GL_FRAMEBUFFER_COMPLETE) {
-        LOGE("Framebuffer incomplete (GL error code 0x%x)", status);
+        ALOGE("Framebuffer incomplete (GL error code 0x%x)", status);
 
         glBindFramebuffer(GL_FRAMEBUFFER, previousFbo);
         layer->deleteTexture();
@@ -571,7 +571,7 @@
  */
 void OpenGLRenderer::composeLayer(sp<Snapshot> current, sp<Snapshot> previous) {
     if (!current->layer) {
-        LOGE("Attempting to compose a layer that does not exist");
+        ALOGE("Attempting to compose a layer that does not exist");
         return;
     }
 
diff --git a/libs/hwui/PatchCache.h b/libs/hwui/PatchCache.h
index 91b603f..505798a 100644
--- a/libs/hwui/PatchCache.h
+++ b/libs/hwui/PatchCache.h
@@ -32,7 +32,7 @@
 
 // Debug
 #if DEBUG_PATCHES
-    #define PATCH_LOGD(...) LOGD(__VA_ARGS__)
+    #define PATCH_LOGD(...) ALOGD(__VA_ARGS__)
 #else
     #define PATCH_LOGD(...)
 #endif
diff --git a/libs/hwui/Program.cpp b/libs/hwui/Program.cpp
index 972dd87..043a092 100644
--- a/libs/hwui/Program.cpp
+++ b/libs/hwui/Program.cpp
@@ -42,13 +42,13 @@
             GLint status;
             glGetProgramiv(id, GL_LINK_STATUS, &status);
             if (status != GL_TRUE) {
-                LOGE("Error while linking shaders:");
+                ALOGE("Error while linking shaders:");
                 GLint infoLen = 0;
                 glGetProgramiv(id, GL_INFO_LOG_LENGTH, &infoLen);
                 if (infoLen > 1) {
                     GLchar log[infoLen];
                     glGetProgramInfoLog(id, infoLen, 0, &log[0]);
-                    LOGE("%s", log);
+                    ALOGE("%s", log);
                 }
                 glDeleteShader(vertexShader);
                 glDeleteShader(fragmentShader);
@@ -115,7 +115,7 @@
         // use a fixed size instead
         GLchar log[512];
         glGetShaderInfoLog(shader, sizeof(log), 0, &log[0]);
-        LOGE("Error while compiling shader: %s", log);
+        ALOGE("Error while compiling shader: %s", log);
         glDeleteShader(shader);
         return 0;
     }
diff --git a/libs/hwui/ProgramCache.h b/libs/hwui/ProgramCache.h
index 5c7197b..0ff2148 100644
--- a/libs/hwui/ProgramCache.h
+++ b/libs/hwui/ProgramCache.h
@@ -37,7 +37,7 @@
 
 // Debug
 #if DEBUG_PROGRAMS
-    #define PROGRAM_LOGD(...) LOGD(__VA_ARGS__)
+    #define PROGRAM_LOGD(...) ALOGD(__VA_ARGS__)
 #else
     #define PROGRAM_LOGD(...)
 #endif
diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h
index edc90e1..5baada3 100644
--- a/libs/hwui/Rect.h
+++ b/libs/hwui/Rect.h
@@ -169,7 +169,7 @@
     }
 
     void dump() const {
-        LOGD("Rect[l=%f t=%f r=%f b=%f]", left, top, right, bottom);
+        ALOGD("Rect[l=%f t=%f r=%f b=%f]", left, top, right, bottom);
     }
 
 }; // class Rect
diff --git a/libs/hwui/ResourceCache.cpp b/libs/hwui/ResourceCache.cpp
index ee73983..9ffad88 100644
--- a/libs/hwui/ResourceCache.cpp
+++ b/libs/hwui/ResourceCache.cpp
@@ -26,12 +26,12 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 void ResourceCache::logCache() {
-    LOGD("ResourceCache: cacheReport:");
+    ALOGD("ResourceCache: cacheReport:");
     for (size_t i = 0; i < mCache->size(); ++i) {
         ResourceReference* ref = mCache->valueAt(i);
-        LOGD("  ResourceCache: mCache(%d): resource, ref = 0x%p, 0x%p",
+        ALOGD("  ResourceCache: mCache(%d): resource, ref = 0x%p, 0x%p",
                 i, mCache->keyAt(i), mCache->valueAt(i));
-        LOGD("  ResourceCache: mCache(%d): refCount, recycled, destroyed, type = %d, %d, %d, %d",
+        ALOGD("  ResourceCache: mCache(%d): refCount, recycled, destroyed, type = %d, %d, %d, %d",
                 i, ref->refCount, ref->recycled, ref->destroyed, ref->resourceType);
     }
 }
diff --git a/libs/hwui/ShapeCache.h b/libs/hwui/ShapeCache.h
index 0660b69..c07a6c9 100644
--- a/libs/hwui/ShapeCache.h
+++ b/libs/hwui/ShapeCache.h
@@ -40,7 +40,7 @@
 
 // Debug
 #if DEBUG_SHAPES
-    #define SHAPE_LOGD(...) LOGD(__VA_ARGS__)
+    #define SHAPE_LOGD(...) ALOGD(__VA_ARGS__)
 #else
     #define SHAPE_LOGD(...)
 #endif
@@ -481,7 +481,7 @@
         SHAPE_LOGD("ShapeCache::callback: delete %s: name, size, mSize = %d, %d, %d",
                 mName, texture->id, size, mSize);
         if (mDebugEnabled) {
-            LOGD("Shape %s deleted, size = %d", mName, size);
+            ALOGD("Shape %s deleted, size = %d", mName, size);
         }
 
         glDeleteTextures(1, &texture->id);
@@ -503,7 +503,7 @@
     const uint32_t height = uint32_t(pathHeight + offset * 2.0 + 0.5);
 
     if (width > mMaxTextureSize || height > mMaxTextureSize) {
-        LOGW("Shape %s too large to be rendered into a texture", mName);
+        ALOGW("Shape %s too large to be rendered into a texture", mName);
         return NULL;
     }
 
@@ -551,7 +551,7 @@
         SHAPE_LOGD("ShapeCache::get: create %s: name, size, mSize = %d, %d, %d",
                 mName, texture->id, size, mSize);
         if (mDebugEnabled) {
-            LOGD("Shape %s created, size = %d", mName, size);
+            ALOGD("Shape %s created, size = %d", mName, size);
         }
         mCache.put(entry, texture);
     } else {
@@ -570,7 +570,7 @@
 void ShapeCache<Entry>::generateTexture(SkBitmap& bitmap, Texture* texture) {
     SkAutoLockPixels alp(bitmap);
     if (!bitmap.readyToDraw()) {
-        LOGE("Cannot generate texture from bitmap");
+        ALOGE("Cannot generate texture from bitmap");
         return;
     }
 
diff --git a/libs/hwui/TextDropShadowCache.cpp b/libs/hwui/TextDropShadowCache.cpp
index a3ee63b..ee8d828 100644
--- a/libs/hwui/TextDropShadowCache.cpp
+++ b/libs/hwui/TextDropShadowCache.cpp
@@ -85,7 +85,7 @@
         mSize -= texture->bitmapSize;
 
         if (mDebugEnabled) {
-            LOGD("Shadow texture deleted, size = %d", texture->bitmapSize);
+            ALOGD("Shadow texture deleted, size = %d", texture->bitmapSize);
         }
 
         glDeleteTextures(1, &texture->id);
@@ -142,7 +142,7 @@
 
         if (size < mMaxSize) {
             if (mDebugEnabled) {
-                LOGD("Shadow texture created, size = %d", texture->bitmapSize);
+                ALOGD("Shadow texture created, size = %d", texture->bitmapSize);
             }
 
             entry.copyTextLocally();
diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp
index 018ce3e..7a88f2a 100644
--- a/libs/hwui/TextureCache.cpp
+++ b/libs/hwui/TextureCache.cpp
@@ -109,7 +109,7 @@
         TEXTURE_LOGD("TextureCache::callback: name, removed size, mSize = %d, %d, %d",
                 texture->id, texture->bitmapSize, mSize);
         if (mDebugEnabled) {
-            LOGD("Texture deleted, size = %d", texture->bitmapSize);
+            ALOGD("Texture deleted, size = %d", texture->bitmapSize);
         }
         glDeleteTextures(1, &texture->id);
         delete texture;
@@ -125,7 +125,7 @@
 
     if (!texture) {
         if (bitmap->width() > mMaxTextureSize || bitmap->height() > mMaxTextureSize) {
-            LOGW("Bitmap too large to be uploaded into a texture");
+            ALOGW("Bitmap too large to be uploaded into a texture");
             return NULL;
         }
 
@@ -146,7 +146,7 @@
             TEXTURE_LOGD("TextureCache::get: create texture(%p): name, size, mSize = %d, %d, %d",
                      bitmap, texture->id, size, mSize);
             if (mDebugEnabled) {
-                LOGD("Texture created, size = %d", size);
+                ALOGD("Texture created, size = %d", size);
             }
             mCache.put(bitmap, texture);
         } else {
@@ -201,7 +201,7 @@
     SkAutoLockPixels alp(*bitmap);
 
     if (!bitmap->readyToDraw()) {
-        LOGE("Cannot generate texture from bitmap");
+        ALOGE("Cannot generate texture from bitmap");
         return;
     }
 
@@ -244,7 +244,7 @@
         texture->blend = !bitmap->isOpaque();
         break;
     default:
-        LOGW("Unsupported bitmap config: %d", bitmap->getConfig());
+        ALOGW("Unsupported bitmap config: %d", bitmap->getConfig());
         break;
     }
 
diff --git a/libs/hwui/TextureCache.h b/libs/hwui/TextureCache.h
index ce924b4..3506f71 100644
--- a/libs/hwui/TextureCache.h
+++ b/libs/hwui/TextureCache.h
@@ -19,6 +19,7 @@
 
 #include <SkBitmap.h>
 
+#include <utils/threads.h>
 #include <utils/Vector.h>
 
 #include "Debug.h"
@@ -34,7 +35,7 @@
 
 // Debug
 #if DEBUG_TEXTURES
-    #define TEXTURE_LOGD(...) LOGD(__VA_ARGS__)
+    #define TEXTURE_LOGD(...) ALOGD(__VA_ARGS__)
 #else
     #define TEXTURE_LOGD(...)
 #endif
diff --git a/libs/hwui/Vector.h b/libs/hwui/Vector.h
index 46dded5..497924e 100644
--- a/libs/hwui/Vector.h
+++ b/libs/hwui/Vector.h
@@ -103,7 +103,7 @@
     }
 
     void dump() {
-        LOGD("Vector2[%.2f, %.2f]", x, y);
+        ALOGD("Vector2[%.2f, %.2f]", x, y);
     }
 }; // class Vector2
 
diff --git a/libs/rs/driver/rsdAllocation.cpp b/libs/rs/driver/rsdAllocation.cpp
index 2ebfe0a..1f70e66 100644
--- a/libs/rs/driver/rsdAllocation.cpp
+++ b/libs/rs/driver/rsdAllocation.cpp
@@ -172,7 +172,7 @@
 
         if (!drv->renderTargetID) {
             // This should generally not happen
-            LOGE("allocateRenderTarget failed to gen mRenderTargetID");
+            ALOGE("allocateRenderTarget failed to gen mRenderTargetID");
             rsc->dumpDebug();
             return;
         }
@@ -195,7 +195,7 @@
         RSD_CALL_GL(glGenBuffers, 1, &drv->bufferID);
     }
     if (!drv->bufferID) {
-        LOGE("Upload to buffer object failed");
+        ALOGE("Upload to buffer object failed");
         drv->uploadDeferred = true;
         return;
     }
@@ -256,7 +256,7 @@
 
     if (drv->bufferID) {
         // Causes a SW crash....
-        //LOGV(" mBufferID %i", mBufferID);
+        //ALOGV(" mBufferID %i", mBufferID);
         //glDeleteBuffers(1, &mBufferID);
         //mBufferID = 0;
     }
@@ -460,7 +460,7 @@
         uint8_t *srcPtr = getOffsetPtr(srcAlloc, srcXoff, srcYoff + i, srcLod, srcFace);
         memcpy(dstPtr, srcPtr, w * elementSize);
 
-        //LOGE("COPIED dstXoff(%u), dstYoff(%u), dstLod(%u), dstFace(%u), w(%u), h(%u), srcXoff(%u), srcYoff(%u), srcLod(%u), srcFace(%u)",
+        //ALOGE("COPIED dstXoff(%u), dstYoff(%u), dstLod(%u), dstFace(%u), w(%u), h(%u), srcXoff(%u), srcYoff(%u), srcLod(%u), srcFace(%u)",
         //     dstXoff, dstYoff, dstLod, dstFace, w, h, srcXoff, srcYoff, srcLod, srcFace);
     }
 }
diff --git a/libs/rs/driver/rsdBcc.cpp b/libs/rs/driver/rsdBcc.cpp
index 4ecf8e8..a36bae9 100644
--- a/libs/rs/driver/rsdBcc.cpp
+++ b/libs/rs/driver/rsdBcc.cpp
@@ -69,7 +69,7 @@
                      uint8_t const *bitcode,
                      size_t bitcodeSize,
                      uint32_t flags) {
-    //LOGE("rsdScriptCreate %p %p %p %p %i %i %p", rsc, resName, cacheDir, bitcode, bitcodeSize, flags, lookupFunc);
+    //ALOGE("rsdScriptCreate %p %p %p %p %i %i %p", rsc, resName, cacheDir, bitcode, bitcodeSize, flags, lookupFunc);
 
     pthread_mutex_lock(&rsdgInitMutex);
     char *cachePath = NULL;
@@ -93,14 +93,14 @@
     drv->ME = new bcinfo::MetadataExtractor((const char*)drv->mScriptText,
                                             drv->mScriptTextLength);
     if (!drv->ME->extract()) {
-      LOGE("bcinfo: failed to read script metadata");
+      ALOGE("bcinfo: failed to read script metadata");
       goto error;
     }
 
-    //LOGE("mBccScript %p", script->mBccScript);
+    //ALOGE("mBccScript %p", script->mBccScript);
 
     if (bccRegisterSymbolCallback(drv->mBccScript, &rsdLookupRuntimeStub, script) != 0) {
-        LOGE("bcc: FAILS to register symbol callback");
+        ALOGE("bcc: FAILS to register symbol callback");
         goto error;
     }
 
@@ -108,17 +108,17 @@
                   resName,
                   (char const *)drv->mScriptText,
                   drv->mScriptTextLength, 0) != 0) {
-        LOGE("bcc: FAILS to read bitcode");
+        ALOGE("bcc: FAILS to read bitcode");
         goto error;
     }
 
     if (bccLinkFile(drv->mBccScript, "/system/lib/libclcore.bc", 0) != 0) {
-        LOGE("bcc: FAILS to link bitcode");
+        ALOGE("bcc: FAILS to link bitcode");
         goto error;
     }
 
     if (bccPrepareExecutable(drv->mBccScript, cacheDir, resName, 0) != 0) {
-        LOGE("bcc: FAILS to prepare executable");
+        ALOGE("bcc: FAILS to prepare executable");
         goto error;
     }
 
@@ -236,8 +236,8 @@
             return;
         }
 
-        //LOGE("usr idx %i, x %i,%i  y %i,%i", idx, mtls->xStart, mtls->xEnd, yStart, yEnd);
-        //LOGE("usr ptr in %p,  out %p", mtls->ptrIn, mtls->ptrOut);
+        //ALOGE("usr idx %i, x %i,%i  y %i,%i", idx, mtls->xStart, mtls->xEnd, yStart, yEnd);
+        //ALOGE("usr ptr in %p,  out %p", mtls->ptrIn, mtls->ptrOut);
         for (p.y = yStart; p.y < yEnd; p.y++) {
             uint32_t offset = mtls->dimX * p.y;
             p.out = mtls->ptrOut + (mtls->eStrideOut * offset);
@@ -267,8 +267,8 @@
             return;
         }
 
-        //LOGE("usr slice %i idx %i, x %i,%i", slice, idx, xStart, xEnd);
-        //LOGE("usr ptr in %p,  out %p", mtls->ptrIn, mtls->ptrOut);
+        //ALOGE("usr slice %i idx %i, x %i,%i", slice, idx, xStart, xEnd);
+        //ALOGE("usr ptr in %p,  out %p", mtls->ptrIn, mtls->ptrOut);
 
         p.out = mtls->ptrOut + (mtls->eStrideOut * xStart);
         p.in = mtls->ptrIn + (mtls->eStrideIn * xStart);
@@ -374,7 +374,7 @@
             rsdLaunchThreads(mrsc, wc_x, &mtls);
         }
 
-        //LOGE("launch 1");
+        //ALOGE("launch 1");
     } else {
         RsForEachStubParamStruct p;
         memset(&p, 0, sizeof(p));
@@ -382,7 +382,7 @@
         p.usr_len = mtls.usrLen;
         uint32_t sig = mtls.sig;
 
-        //LOGE("launch 3");
+        //ALOGE("launch 3");
         outer_foreach_t fn = dc->mForEachLaunch[sig];
         for (p.ar[0] = mtls.arrayStart; p.ar[0] < mtls.arrayEnd; p.ar[0]++) {
             for (p.z = mtls.zStart; p.z < mtls.zEnd; p.z++) {
@@ -434,7 +434,7 @@
                             const void *params,
                             size_t paramLength) {
     DrvScript *drv = (DrvScript *)script->mHal.drv;
-    //LOGE("invoke %p %p %i %p %i", dc, script, slot, params, paramLength);
+    //ALOGE("invoke %p %p %i %p %i", dc, script, slot, params, paramLength);
 
     Script * oldTLS = setTLS(script);
     ((void (*)(const void *, uint32_t))
@@ -446,11 +446,11 @@
                            uint32_t slot, void *data, size_t dataLength) {
     DrvScript *drv = (DrvScript *)script->mHal.drv;
     //rsAssert(!script->mFieldIsObject[slot]);
-    //LOGE("setGlobalVar %p %p %i %p %i", dc, script, slot, data, dataLength);
+    //ALOGE("setGlobalVar %p %p %i %p %i", dc, script, slot, data, dataLength);
 
     int32_t *destPtr = ((int32_t **)drv->mFieldAddress)[slot];
     if (!destPtr) {
-        //LOGV("Calling setVar on slot = %i which is null", slot);
+        //ALOGV("Calling setVar on slot = %i which is null", slot);
         return;
     }
 
@@ -460,11 +460,11 @@
 void rsdScriptSetGlobalBind(const Context *dc, const Script *script, uint32_t slot, void *data) {
     DrvScript *drv = (DrvScript *)script->mHal.drv;
     //rsAssert(!script->mFieldIsObject[slot]);
-    //LOGE("setGlobalBind %p %p %i %p", dc, script, slot, data);
+    //ALOGE("setGlobalBind %p %p %i %p", dc, script, slot, data);
 
     int32_t *destPtr = ((int32_t **)drv->mFieldAddress)[slot];
     if (!destPtr) {
-        //LOGV("Calling setVar on slot = %i which is null", slot);
+        //ALOGV("Calling setVar on slot = %i which is null", slot);
         return;
     }
 
@@ -474,11 +474,11 @@
 void rsdScriptSetGlobalObj(const Context *dc, const Script *script, uint32_t slot, ObjectBase *data) {
     DrvScript *drv = (DrvScript *)script->mHal.drv;
     //rsAssert(script->mFieldIsObject[slot]);
-    //LOGE("setGlobalObj %p %p %i %p", dc, script, slot, data);
+    //ALOGE("setGlobalObj %p %p %i %p", dc, script, slot, data);
 
     int32_t *destPtr = ((int32_t **)drv->mFieldAddress)[slot];
     if (!destPtr) {
-        //LOGV("Calling setVar on slot = %i which is null", slot);
+        //ALOGV("Calling setVar on slot = %i which is null", slot);
         return;
     }
 
diff --git a/libs/rs/driver/rsdCore.cpp b/libs/rs/driver/rsdCore.cpp
index 247f4dc..b514e21 100644
--- a/libs/rs/driver/rsdCore.cpp
+++ b/libs/rs/driver/rsdCore.cpp
@@ -139,14 +139,14 @@
 
     uint32_t idx = (uint32_t)android_atomic_inc(&dc->mWorkers.mLaunchCount);
 
-    //LOGV("RS helperThread starting %p idx=%i", rsc, idx);
+    //ALOGV("RS helperThread starting %p idx=%i", rsc, idx);
 
     dc->mWorkers.mLaunchSignals[idx].init();
     dc->mWorkers.mNativeThreadId[idx] = gettid();
 
     int status = pthread_setspecific(rsdgThreadTLSKey, &dc->mTlsStruct);
     if (status) {
-        LOGE("pthread_setspecific %i", status);
+        ALOGE("pthread_setspecific %i", status);
     }
 
 #if 0
@@ -156,7 +156,7 @@
     cpuset.bits[idx / 64] |= 1ULL << (idx % 64);
     int ret = syscall(241, rsc->mWorkers.mNativeThreadId[idx],
               sizeof(cpuset), &cpuset);
-    LOGE("SETAFFINITY ret = %i %s", ret, EGLUtils::strerror(ret));
+    ALOGE("SETAFFINITY ret = %i %s", ret, EGLUtils::strerror(ret));
 #endif
 
     while (!dc->mExit) {
@@ -168,7 +168,7 @@
         dc->mWorkers.mCompleteSignal.set();
     }
 
-    //LOGV("RS helperThread exited %p idx=%i", rsc, idx);
+    //ALOGV("RS helperThread exited %p idx=%i", rsc, idx);
     return NULL;
 }
 
@@ -191,7 +191,7 @@
 
     RsdHal *dc = (RsdHal *)calloc(1, sizeof(RsdHal));
     if (!dc) {
-        LOGE("Calloc for driver hal failed.");
+        ALOGE("Calloc for driver hal failed.");
         return false;
     }
     rsc->mHal.drv = dc;
@@ -200,7 +200,7 @@
     if (!rsdgThreadTLSKeyCount) {
         int status = pthread_key_create(&rsdgThreadTLSKey, NULL);
         if (status) {
-            LOGE("Failed to init thread tls key.");
+            ALOGE("Failed to init thread tls key.");
             pthread_mutex_unlock(&rsdgInitMutex);
             return false;
         }
@@ -214,12 +214,12 @@
     dc->mTlsStruct.mScript = NULL;
     int status = pthread_setspecific(rsdgThreadTLSKey, &dc->mTlsStruct);
     if (status) {
-        LOGE("pthread_setspecific %i", status);
+        ALOGE("pthread_setspecific %i", status);
     }
 
 
     int cpu = sysconf(_SC_NPROCESSORS_ONLN);
-    LOGV("%p Launching thread(s), CPUs %i", rsc, cpu);
+    ALOGV("%p Launching thread(s), CPUs %i", rsc, cpu);
     if (cpu < 2) cpu = 0;
 
     dc->mWorkers.mCount = (uint32_t)cpu;
@@ -236,7 +236,7 @@
     pthread_attr_t threadAttr;
     status = pthread_attr_init(&threadAttr);
     if (status) {
-        LOGE("Failed to init thread attribute.");
+        ALOGE("Failed to init thread attribute.");
         return false;
     }
 
@@ -244,7 +244,7 @@
         status = pthread_create(&dc->mWorkers.mThreadId[ct], &threadAttr, HelperThreadProc, rsc);
         if (status) {
             dc->mWorkers.mCount = ct;
-            LOGE("Created fewer than expected number of RS threads.");
+            ALOGE("Created fewer than expected number of RS threads.");
             break;
         }
     }
diff --git a/libs/rs/driver/rsdGL.cpp b/libs/rs/driver/rsdGL.cpp
index 98d9486..b53a68cf 100644
--- a/libs/rs/driver/rsdGL.cpp
+++ b/libs/rs/driver/rsdGL.cpp
@@ -101,27 +101,27 @@
         EGLint value = -1;
         EGLBoolean returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute, &value);
         if (returnVal) {
-            LOGV(" %s: %d (0x%x)", names[j].name, value, value);
+            ALOGV(" %s: %d (0x%x)", names[j].name, value, value);
         }
     }
 }
 
 static void DumpDebug(RsdHal *dc) {
-    LOGE(" EGL ver %i %i", dc->gl.egl.majorVersion, dc->gl.egl.minorVersion);
-    LOGE(" EGL context %p  surface %p,  Display=%p", dc->gl.egl.context, dc->gl.egl.surface,
+    ALOGE(" EGL ver %i %i", dc->gl.egl.majorVersion, dc->gl.egl.minorVersion);
+    ALOGE(" EGL context %p  surface %p,  Display=%p", dc->gl.egl.context, dc->gl.egl.surface,
          dc->gl.egl.display);
-    LOGE(" GL vendor: %s", dc->gl.gl.vendor);
-    LOGE(" GL renderer: %s", dc->gl.gl.renderer);
-    LOGE(" GL Version: %s", dc->gl.gl.version);
-    LOGE(" GL Extensions: %s", dc->gl.gl.extensions);
-    LOGE(" GL int Versions %i %i", dc->gl.gl.majorVersion, dc->gl.gl.minorVersion);
+    ALOGE(" GL vendor: %s", dc->gl.gl.vendor);
+    ALOGE(" GL renderer: %s", dc->gl.gl.renderer);
+    ALOGE(" GL Version: %s", dc->gl.gl.version);
+    ALOGE(" GL Extensions: %s", dc->gl.gl.extensions);
+    ALOGE(" GL int Versions %i %i", dc->gl.gl.majorVersion, dc->gl.gl.minorVersion);
 
-    LOGV("MAX Textures %i, %i  %i", dc->gl.gl.maxVertexTextureUnits,
+    ALOGV("MAX Textures %i, %i  %i", dc->gl.gl.maxVertexTextureUnits,
          dc->gl.gl.maxFragmentTextureImageUnits, dc->gl.gl.maxTextureImageUnits);
-    LOGV("MAX Attribs %i", dc->gl.gl.maxVertexAttribs);
-    LOGV("MAX Uniforms %i, %i", dc->gl.gl.maxVertexUniformVectors,
+    ALOGV("MAX Attribs %i", dc->gl.gl.maxVertexAttribs);
+    ALOGV("MAX Uniforms %i, %i", dc->gl.gl.maxVertexUniformVectors,
          dc->gl.gl.maxFragmentUniformVectors);
-    LOGV("MAX Varyings %i", dc->gl.gl.maxVaryingVectors);
+    ALOGV("MAX Varyings %i", dc->gl.gl.maxVaryingVectors);
 }
 
 void rsdGLShutdown(const Context *rsc) {
@@ -199,7 +199,7 @@
     configAttribsPtr[0] = EGL_NONE;
     rsAssert(configAttribsPtr < (configAttribs + (sizeof(configAttribs) / sizeof(EGLint))));
 
-    LOGV("%p initEGL start", rsc);
+    ALOGV("%p initEGL start", rsc);
     rsc->setWatchdogGL("eglGetDisplay", __LINE__, __FILE__);
     dc->gl.egl.display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
     checkEglError("eglGetDisplay");
@@ -223,7 +223,7 @@
                 configAttribs, configs, numConfigs, &n);
         if (!ret || !n) {
             checkEglError("eglChooseConfig", ret);
-            LOGE("%p, couldn't find an EGLConfig matching the screen format\n", rsc);
+            ALOGE("%p, couldn't find an EGLConfig matching the screen format\n", rsc);
         }
 
         // The first config is guaranteed to over-satisfy the constraints
@@ -268,7 +268,7 @@
                                           EGL_NO_CONTEXT, context_attribs2);
     checkEglError("eglCreateContext");
     if (dc->gl.egl.context == EGL_NO_CONTEXT) {
-        LOGE("%p, eglCreateContext returned EGL_NO_CONTEXT", rsc);
+        ALOGE("%p, eglCreateContext returned EGL_NO_CONTEXT", rsc);
         rsc->setWatchdogGL(NULL, 0, NULL);
         return false;
     }
@@ -281,7 +281,7 @@
                                                         pbuffer_attribs);
     checkEglError("eglCreatePbufferSurface");
     if (dc->gl.egl.surfaceDefault == EGL_NO_SURFACE) {
-        LOGE("eglCreatePbufferSurface returned EGL_NO_SURFACE");
+        ALOGE("eglCreatePbufferSurface returned EGL_NO_SURFACE");
         rsdGLShutdown(rsc);
         rsc->setWatchdogGL(NULL, 0, NULL);
         return false;
@@ -291,7 +291,7 @@
     ret = eglMakeCurrent(dc->gl.egl.display, dc->gl.egl.surfaceDefault,
                          dc->gl.egl.surfaceDefault, dc->gl.egl.context);
     if (ret == EGL_FALSE) {
-        LOGE("eglMakeCurrent returned EGL_FALSE");
+        ALOGE("eglMakeCurrent returned EGL_FALSE");
         checkEglError("eglMakeCurrent", ret);
         rsdGLShutdown(rsc);
         rsc->setWatchdogGL(NULL, 0, NULL);
@@ -303,11 +303,11 @@
     dc->gl.gl.renderer = glGetString(GL_RENDERER);
     dc->gl.gl.extensions = glGetString(GL_EXTENSIONS);
 
-    //LOGV("EGL Version %i %i", mEGL.mMajorVersion, mEGL.mMinorVersion);
-    //LOGV("GL Version %s", mGL.mVersion);
-    //LOGV("GL Vendor %s", mGL.mVendor);
-    //LOGV("GL Renderer %s", mGL.mRenderer);
-    //LOGV("GL Extensions %s", mGL.mExtensions);
+    //ALOGV("EGL Version %i %i", mEGL.mMajorVersion, mEGL.mMinorVersion);
+    //ALOGV("GL Version %s", mGL.mVersion);
+    //ALOGV("GL Vendor %s", mGL.mVendor);
+    //ALOGV("GL Renderer %s", mGL.mRenderer);
+    //ALOGV("GL Extensions %s", mGL.mExtensions);
 
     const char *verptr = NULL;
     if (strlen((const char *)dc->gl.gl.version) > 9) {
@@ -320,7 +320,7 @@
     }
 
     if (!verptr) {
-        LOGE("Error, OpenGL ES Lite not supported");
+        ALOGE("Error, OpenGL ES Lite not supported");
         rsdGLShutdown(rsc);
         rsc->setWatchdogGL(NULL, 0, NULL);
         return false;
@@ -360,7 +360,7 @@
     dc->gl.vertexArrayState->init(dc->gl.gl.maxVertexAttribs);
     dc->gl.currentFrameBuffer = NULL;
 
-    LOGV("%p initGLThread end", rsc);
+    ALOGV("%p initGLThread end", rsc);
     rsc->setWatchdogGL(NULL, 0, NULL);
     return true;
 }
@@ -402,7 +402,7 @@
                                                     dc->gl.wndSurface, NULL);
         checkEglError("eglCreateWindowSurface");
         if (dc->gl.egl.surface == EGL_NO_SURFACE) {
-            LOGE("eglCreateWindowSurface returned EGL_NO_SURFACE");
+            ALOGE("eglCreateWindowSurface returned EGL_NO_SURFACE");
         }
 
         rsc->setWatchdogGL("eglMakeCurrent", __LINE__, __FILE__);
@@ -439,7 +439,7 @@
             }
         }
 
-        LOGE("%p, %s", rsc, buf);
+        ALOGE("%p, %s", rsc, buf);
     }
 
 }
diff --git a/libs/rs/driver/rsdMeshObj.cpp b/libs/rs/driver/rsdMeshObj.cpp
index 24a7183..99d79dc 100644
--- a/libs/rs/driver/rsdMeshObj.cpp
+++ b/libs/rs/driver/rsdMeshObj.cpp
@@ -133,7 +133,7 @@
 void RsdMeshObj::renderPrimitiveRange(const Context *rsc, uint32_t primIndex,
                                       uint32_t start, uint32_t len) const {
     if (len < 1 || primIndex >= mRSMesh->mHal.state.primitivesCount || mAttribCount == 0) {
-        LOGE("Invalid mesh or parameters");
+        ALOGE("Invalid mesh or parameters");
         return;
     }
 
diff --git a/libs/rs/driver/rsdProgram.cpp b/libs/rs/driver/rsdProgram.cpp
index 7556e50..54484df 100644
--- a/libs/rs/driver/rsdProgram.cpp
+++ b/libs/rs/driver/rsdProgram.cpp
@@ -68,7 +68,7 @@
     if(pv->mHal.drv) {
         drv = (RsdShader*)pv->mHal.drv;
         if (rsc->props.mLogShaders) {
-            LOGV("Destroying vertex shader with ID %u", drv->getShaderID());
+            ALOGV("Destroying vertex shader with ID %u", drv->getShaderID());
         }
         if (drv->getShaderID()) {
             dc->gl.shaderCache->cleanupVertex(drv->getShaderID());
@@ -99,7 +99,7 @@
     if(pf->mHal.drv) {
         drv = (RsdShader*)pf->mHal.drv;
         if (rsc->props.mLogShaders) {
-            LOGV("Destroying fragment shader with ID %u", drv->getShaderID());
+            ALOGV("Destroying fragment shader with ID %u", drv->getShaderID());
         }
         if (drv->getShaderID()) {
             dc->gl.shaderCache->cleanupFragment(drv->getShaderID());
diff --git a/libs/rs/driver/rsdProgramStore.cpp b/libs/rs/driver/rsdProgramStore.cpp
index af44b02..fca9ba9 100644
--- a/libs/rs/driver/rsdProgramStore.cpp
+++ b/libs/rs/driver/rsdProgramStore.cpp
@@ -70,7 +70,7 @@
         drv->depthFunc = GL_NOTEQUAL;
         break;
     default:
-        LOGE("Unknown depth function.");
+        ALOGE("Unknown depth function.");
         goto error;
     }
 
@@ -111,7 +111,7 @@
         drv->blendSrc = GL_SRC_ALPHA_SATURATE;
         break;
     default:
-        LOGE("Unknown blend src mode.");
+        ALOGE("Unknown blend src mode.");
         goto error;
     }
 
@@ -141,7 +141,7 @@
         drv->blendDst = GL_ONE_MINUS_DST_ALPHA;
         break;
     default:
-        LOGE("Unknown blend dst mode.");
+        ALOGE("Unknown blend dst mode.");
         goto error;
     }
 
diff --git a/libs/rs/driver/rsdRuntimeMath.cpp b/libs/rs/driver/rsdRuntimeMath.cpp
index d29da7e..4c300b7 100644
--- a/libs/rs/driver/rsdRuntimeMath.cpp
+++ b/libs/rs/driver/rsdRuntimeMath.cpp
@@ -120,7 +120,7 @@
 }
 
 static float SC_mix_f32(float start, float stop, float amount) {
-    //LOGE("lerpf %f  %f  %f", start, stop, amount);
+    //ALOGE("lerpf %f  %f  %f", start, stop, amount);
     return start + (stop - start) * amount;
 }
 
diff --git a/libs/rs/driver/rsdRuntimeStubs.cpp b/libs/rs/driver/rsdRuntimeStubs.cpp
index 90c8928..14c2970 100644
--- a/libs/rs/driver/rsdRuntimeStubs.cpp
+++ b/libs/rs/driver/rsdRuntimeStubs.cpp
@@ -439,51 +439,51 @@
 }
 
 static void SC_debugF(const char *s, float f) {
-    LOGD("%s %f, 0x%08x", s, f, *((int *) (&f)));
+    ALOGD("%s %f, 0x%08x", s, f, *((int *) (&f)));
 }
 static void SC_debugFv2(const char *s, float f1, float f2) {
-    LOGD("%s {%f, %f}", s, f1, f2);
+    ALOGD("%s {%f, %f}", s, f1, f2);
 }
 static void SC_debugFv3(const char *s, float f1, float f2, float f3) {
-    LOGD("%s {%f, %f, %f}", s, f1, f2, f3);
+    ALOGD("%s {%f, %f, %f}", s, f1, f2, f3);
 }
 static void SC_debugFv4(const char *s, float f1, float f2, float f3, float f4) {
-    LOGD("%s {%f, %f, %f, %f}", s, f1, f2, f3, f4);
+    ALOGD("%s {%f, %f, %f, %f}", s, f1, f2, f3, f4);
 }
 static void SC_debugD(const char *s, double d) {
-    LOGD("%s %f, 0x%08llx", s, d, *((long long *) (&d)));
+    ALOGD("%s %f, 0x%08llx", s, d, *((long long *) (&d)));
 }
 static void SC_debugFM4v4(const char *s, const float *f) {
-    LOGD("%s {%f, %f, %f, %f", s, f[0], f[4], f[8], f[12]);
-    LOGD("%s  %f, %f, %f, %f", s, f[1], f[5], f[9], f[13]);
-    LOGD("%s  %f, %f, %f, %f", s, f[2], f[6], f[10], f[14]);
-    LOGD("%s  %f, %f, %f, %f}", s, f[3], f[7], f[11], f[15]);
+    ALOGD("%s {%f, %f, %f, %f", s, f[0], f[4], f[8], f[12]);
+    ALOGD("%s  %f, %f, %f, %f", s, f[1], f[5], f[9], f[13]);
+    ALOGD("%s  %f, %f, %f, %f", s, f[2], f[6], f[10], f[14]);
+    ALOGD("%s  %f, %f, %f, %f}", s, f[3], f[7], f[11], f[15]);
 }
 static void SC_debugFM3v3(const char *s, const float *f) {
-    LOGD("%s {%f, %f, %f", s, f[0], f[3], f[6]);
-    LOGD("%s  %f, %f, %f", s, f[1], f[4], f[7]);
-    LOGD("%s  %f, %f, %f}",s, f[2], f[5], f[8]);
+    ALOGD("%s {%f, %f, %f", s, f[0], f[3], f[6]);
+    ALOGD("%s  %f, %f, %f", s, f[1], f[4], f[7]);
+    ALOGD("%s  %f, %f, %f}",s, f[2], f[5], f[8]);
 }
 static void SC_debugFM2v2(const char *s, const float *f) {
-    LOGD("%s {%f, %f", s, f[0], f[2]);
-    LOGD("%s  %f, %f}",s, f[1], f[3]);
+    ALOGD("%s {%f, %f", s, f[0], f[2]);
+    ALOGD("%s  %f, %f}",s, f[1], f[3]);
 }
 
 static void SC_debugI32(const char *s, int32_t i) {
-    LOGD("%s %i  0x%x", s, i, i);
+    ALOGD("%s %i  0x%x", s, i, i);
 }
 static void SC_debugU32(const char *s, uint32_t i) {
-    LOGD("%s %u  0x%x", s, i, i);
+    ALOGD("%s %u  0x%x", s, i, i);
 }
 static void SC_debugLL64(const char *s, long long ll) {
-    LOGD("%s %lld  0x%llx", s, ll, ll);
+    ALOGD("%s %lld  0x%llx", s, ll, ll);
 }
 static void SC_debugULL64(const char *s, unsigned long long ll) {
-    LOGD("%s %llu  0x%llx", s, ll, ll);
+    ALOGD("%s %llu  0x%llx", s, ll, ll);
 }
 
 static void SC_debugP(const char *s, const void *p) {
-    LOGD("%s %p", s, p);
+    ALOGD("%s %p", s, p);
 }
 
 
@@ -686,7 +686,7 @@
         s->mHal.info.isThreadable &= sym->threadable;
         return sym->mPtr;
     }
-    LOGE("ScriptC sym lookup failed for %s", name);
+    ALOGE("ScriptC sym lookup failed for %s", name);
     return NULL;
 }
 
diff --git a/libs/rs/driver/rsdShader.cpp b/libs/rs/driver/rsdShader.cpp
index bdb60c2..a10deb4 100644
--- a/libs/rs/driver/rsdShader.cpp
+++ b/libs/rs/driver/rsdShader.cpp
@@ -172,8 +172,8 @@
     rsAssert(mShaderID);
 
     if (rsc->props.mLogShaders) {
-        LOGV("Loading shader type %x, ID %i", mType, mShaderID);
-        LOGV("%s", mShader.string());
+        ALOGV("Loading shader type %x, ID %i", mType, mShaderID);
+        ALOGV("%s", mShader.string());
     }
 
     if (mShaderID) {
@@ -190,7 +190,7 @@
                 char* buf = (char*) malloc(infoLen);
                 if (buf) {
                     RSD_CALL_GL(glGetShaderInfoLog, mShaderID, infoLen, NULL, buf);
-                    LOGE("Could not compile shader \n%s\n", buf);
+                    ALOGE("Could not compile shader \n%s\n", buf);
                     free(buf);
                 }
                 RSD_CALL_GL(glDeleteShader, mShaderID);
@@ -202,7 +202,7 @@
     }
 
     if (rsc->props.mLogShaders) {
-        LOGV("--Shader load result %x ", glGetError());
+        ALOGV("--Shader load result %x ", glGetError());
     }
     mIsValid = true;
     return true;
@@ -252,44 +252,44 @@
     uint32_t elementSize = field->getSizeBytes() / sizeof(float);
     for (uint32_t i = 0; i < arraySize; i ++) {
         if (arraySize > 1) {
-            LOGV("Array Element [%u]", i);
+            ALOGV("Array Element [%u]", i);
         }
         if (dataType == RS_TYPE_MATRIX_4X4) {
-            LOGV("Matrix4x4");
-            LOGV("{%f, %f, %f, %f",  fd[0], fd[4], fd[8], fd[12]);
-            LOGV(" %f, %f, %f, %f",  fd[1], fd[5], fd[9], fd[13]);
-            LOGV(" %f, %f, %f, %f",  fd[2], fd[6], fd[10], fd[14]);
-            LOGV(" %f, %f, %f, %f}", fd[3], fd[7], fd[11], fd[15]);
+            ALOGV("Matrix4x4");
+            ALOGV("{%f, %f, %f, %f",  fd[0], fd[4], fd[8], fd[12]);
+            ALOGV(" %f, %f, %f, %f",  fd[1], fd[5], fd[9], fd[13]);
+            ALOGV(" %f, %f, %f, %f",  fd[2], fd[6], fd[10], fd[14]);
+            ALOGV(" %f, %f, %f, %f}", fd[3], fd[7], fd[11], fd[15]);
         } else if (dataType == RS_TYPE_MATRIX_3X3) {
-            LOGV("Matrix3x3");
-            LOGV("{%f, %f, %f",  fd[0], fd[3], fd[6]);
-            LOGV(" %f, %f, %f",  fd[1], fd[4], fd[7]);
-            LOGV(" %f, %f, %f}", fd[2], fd[5], fd[8]);
+            ALOGV("Matrix3x3");
+            ALOGV("{%f, %f, %f",  fd[0], fd[3], fd[6]);
+            ALOGV(" %f, %f, %f",  fd[1], fd[4], fd[7]);
+            ALOGV(" %f, %f, %f}", fd[2], fd[5], fd[8]);
         } else if (dataType == RS_TYPE_MATRIX_2X2) {
-            LOGV("Matrix2x2");
-            LOGV("{%f, %f",  fd[0], fd[2]);
-            LOGV(" %f, %f}", fd[1], fd[3]);
+            ALOGV("Matrix2x2");
+            ALOGV("{%f, %f",  fd[0], fd[2]);
+            ALOGV(" %f, %f}", fd[1], fd[3]);
         } else {
             switch (field->getComponent().getVectorSize()) {
             case 1:
-                LOGV("Uniform 1 = %f", fd[0]);
+                ALOGV("Uniform 1 = %f", fd[0]);
                 break;
             case 2:
-                LOGV("Uniform 2 = %f %f", fd[0], fd[1]);
+                ALOGV("Uniform 2 = %f %f", fd[0], fd[1]);
                 break;
             case 3:
-                LOGV("Uniform 3 = %f %f %f", fd[0], fd[1], fd[2]);
+                ALOGV("Uniform 3 = %f %f %f", fd[0], fd[1], fd[2]);
                 break;
             case 4:
-                LOGV("Uniform 4 = %f %f %f %f", fd[0], fd[1], fd[2], fd[3]);
+                ALOGV("Uniform 4 = %f %f %f %f", fd[0], fd[1], fd[2], fd[3]);
                 break;
             default:
                 rsAssert(0);
             }
         }
-        LOGE("Element size %u data=%p", elementSize, fd);
+        ALOGE("Element size %u data=%p", elementSize, fd);
         fd += elementSize;
-        LOGE("New data=%p", fd);
+        ALOGE("New data=%p", fd);
     }
 }
 
@@ -404,7 +404,7 @@
     uint32_t numTexturesToBind = mRSProgram->mHal.state.texturesCount;
     uint32_t numTexturesAvailable = dc->gl.gl.maxFragmentTextureImageUnits;
     if (numTexturesToBind >= numTexturesAvailable) {
-        LOGE("Attempting to bind %u textures on shader id %u, but only %u are available",
+        ALOGE("Attempting to bind %u textures on shader id %u, but only %u are available",
              mRSProgram->mHal.state.texturesCount, (uint32_t)this, numTexturesAvailable);
         rsc->setError(RS_ERROR_BAD_SHADER, "Cannot bind more textuers than available");
         numTexturesToBind = numTexturesAvailable;
@@ -422,7 +422,7 @@
 
         DrvAllocation *drvTex = (DrvAllocation *)mRSProgram->mHal.state.textures[ct]->mHal.drv;
         if (drvTex->glTarget != GL_TEXTURE_2D && drvTex->glTarget != GL_TEXTURE_CUBE_MAP) {
-            LOGE("Attempting to bind unknown texture to shader id %u, texture unit %u", (uint)this, ct);
+            ALOGE("Attempting to bind unknown texture to shader id %u, texture unit %u", (uint)this, ct);
             rsc->setError(RS_ERROR_BAD_SHADER, "Non-texture allocation bound to a shader");
         }
         RSD_CALL_GL(glBindTexture, drvTex->glTarget, drvTex->textureID);
@@ -450,7 +450,7 @@
     for (uint32_t ct=0; ct < mRSProgram->mHal.state.constantsCount; ct++) {
         Allocation *alloc = mRSProgram->mHal.state.constants[ct];
         if (!alloc) {
-            LOGE("Attempting to set constants on shader id %u, but alloc at slot %u is not set",
+            ALOGE("Attempting to set constants on shader id %u, but alloc at slot %u is not set",
                  (uint32_t)this, ct);
             rsc->setError(RS_ERROR_BAD_SHADER, "No constant allocation bound");
             continue;
@@ -479,7 +479,7 @@
                 arraySize = sc->fragUniformSize(uidx);
             }
             if (rsc->props.mLogShadersUniforms) {
-                LOGV("Uniform  slot=%i, offset=%i, constant=%i, field=%i, uidx=%i, name=%s",
+                ALOGV("Uniform  slot=%i, offset=%i, constant=%i, field=%i, uidx=%i, name=%s",
                      slot, offset, ct, field, uidx, fieldName);
             }
             uidx ++;
diff --git a/libs/rs/driver/rsdShaderCache.cpp b/libs/rs/driver/rsdShaderCache.cpp
index d11490c..f6236e7 100644
--- a/libs/rs/driver/rsdShaderCache.cpp
+++ b/libs/rs/driver/rsdShaderCache.cpp
@@ -54,7 +54,7 @@
         }
 
         if (rsc->props.mLogShaders) {
-             LOGV("%s U, %s = %d, arraySize = %d\n", logTag,
+             ALOGV("%s U, %s = %d, arraySize = %d\n", logTag,
                   prog->getUniformName(ct).string(), data[ct].slot, data[ct].arraySize);
         }
     }
@@ -119,23 +119,23 @@
     if (!vtx->getShaderID() || !frag->getShaderID()) {
         return false;
     }
-    //LOGV("rsdShaderCache lookup  vtx %i, frag %i", vtx->getShaderID(), frag->getShaderID());
+    //ALOGV("rsdShaderCache lookup  vtx %i, frag %i", vtx->getShaderID(), frag->getShaderID());
     uint32_t entryCount = mEntries.size();
     for (uint32_t ct = 0; ct < entryCount; ct ++) {
         if ((mEntries[ct]->vtx == vtx->getShaderID()) &&
             (mEntries[ct]->frag == frag->getShaderID())) {
 
-            //LOGV("SC using program %i", mEntries[ct]->program);
+            //ALOGV("SC using program %i", mEntries[ct]->program);
             glUseProgram(mEntries[ct]->program);
             mCurrent = mEntries[ct];
-            //LOGV("RsdShaderCache hit, using %i", ct);
+            //ALOGV("RsdShaderCache hit, using %i", ct);
             rsdGLCheckError(rsc, "RsdShaderCache::link (hit)");
             return true;
         }
     }
 
-    //LOGV("RsdShaderCache miss");
-    //LOGE("e0 %x", glGetError());
+    //ALOGV("RsdShaderCache miss");
+    //ALOGE("e0 %x", glGetError());
     ProgramEntry *e = new ProgramEntry(vtx->getAttribCount(),
                                        vtx->getUniformCount(),
                                        frag->getUniformCount());
@@ -147,7 +147,7 @@
     if (e->program) {
         GLuint pgm = e->program;
         glAttachShader(pgm, vtx->getShaderID());
-        //LOGE("e1 %x", glGetError());
+        //ALOGE("e1 %x", glGetError());
         glAttachShader(pgm, frag->getShaderID());
 
         glBindAttribLocation(pgm, 0, "ATTRIB_position");
@@ -155,9 +155,9 @@
         glBindAttribLocation(pgm, 2, "ATTRIB_normal");
         glBindAttribLocation(pgm, 3, "ATTRIB_texture0");
 
-        //LOGE("e2 %x", glGetError());
+        //ALOGE("e2 %x", glGetError());
         glLinkProgram(pgm);
-        //LOGE("e3 %x", glGetError());
+        //ALOGE("e3 %x", glGetError());
         GLint linkStatus = GL_FALSE;
         glGetProgramiv(pgm, GL_LINK_STATUS, &linkStatus);
         if (linkStatus != GL_TRUE) {
@@ -167,7 +167,7 @@
                 char* buf = (char*) malloc(bufLength);
                 if (buf) {
                     glGetProgramInfoLog(pgm, bufLength, NULL, buf);
-                    LOGE("Could not link program:\n%s\n", buf);
+                    ALOGE("Could not link program:\n%s\n", buf);
                     free(buf);
                 }
             }
@@ -180,7 +180,7 @@
             e->vtxAttrs[ct].slot = glGetAttribLocation(pgm, vtx->getAttribName(ct));
             e->vtxAttrs[ct].name = vtx->getAttribName(ct).string();
             if (rsc->props.mLogShaders) {
-                LOGV("vtx A %i, %s = %d\n", ct, vtx->getAttribName(ct).string(), e->vtxAttrs[ct].slot);
+                ALOGV("vtx A %i, %s = %d\n", ct, vtx->getAttribName(ct).string(), e->vtxAttrs[ct].slot);
             }
         }
 
@@ -205,7 +205,7 @@
                     glGetActiveUniform(pgm, ct, maxNameLength, &uniformList[ct]->writtenLength,
                                        &uniformList[ct]->arraySize, &uniformList[ct]->type,
                                        uniformList[ct]->name);
-                    //LOGE("GL UNI idx=%u, arraySize=%u, name=%s", ct,
+                    //ALOGE("GL UNI idx=%u, arraySize=%u, name=%s", ct,
                     //     uniformList[ct]->arraySize, uniformList[ct]->name);
                 }
             }
@@ -229,7 +229,7 @@
         }
     }
 
-    //LOGV("SC made program %i", e->program);
+    //ALOGV("SC made program %i", e->program);
     glUseProgram(e->program);
     rsdGLCheckError(rsc, "RsdShaderCache::link (miss)");
 
diff --git a/libs/rs/driver/rsdVertexArray.cpp b/libs/rs/driver/rsdVertexArray.cpp
index 62ec107..1836e67 100644
--- a/libs/rs/driver/rsdVertexArray.cpp
+++ b/libs/rs/driver/rsdVertexArray.cpp
@@ -65,9 +65,9 @@
 
 void RsdVertexArray::logAttrib(uint32_t idx, uint32_t slot) const {
     if (idx == 0) {
-        LOGV("Starting vertex attribute binding");
+        ALOGV("Starting vertex attribute binding");
     }
-    LOGV("va %i: slot=%i name=%s buf=%i ptr=%p size=%i  type=0x%x  stride=0x%x  norm=%i  offset=0x%x",
+    ALOGV("va %i: slot=%i name=%s buf=%i ptr=%p size=%i  type=0x%x  stride=0x%x  norm=%i  offset=0x%x",
          idx, slot,
          mAttribs[idx].name.string(),
          mAttribs[idx].buffer,
diff --git a/libs/rs/rsAdapter.cpp b/libs/rs/rsAdapter.cpp
index 6e8ca70..177fb60 100644
--- a/libs/rs/rsAdapter.cpp
+++ b/libs/rs/rsAdapter.cpp
@@ -140,7 +140,7 @@
     rsAssert(mAllocation->getPtr());
     rsAssert(mAllocation->getType());
     if (mFace != 0 && !mAllocation->getType()->getDimFaces()) {
-        LOGE("Adapter wants cubemap face, but allocation has none");
+        ALOGE("Adapter wants cubemap face, but allocation has none");
         return NULL;
     }
 
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index e732630..7b92b39 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -75,7 +75,7 @@
     const uint32_t eSize = mHal.state.type->getElementSizeBytes();
 
     if ((count * eSize) != sizeBytes) {
-        LOGE("Allocation::subData called with mismatched size expected %i, got %i",
+        ALOGE("Allocation::subData called with mismatched size expected %i, got %i",
              (count * eSize), sizeBytes);
         mHal.state.type->dumpLOGV("type info");
         return;
@@ -90,10 +90,10 @@
     const uint32_t eSize = mHal.state.elementSizeBytes;
     const uint32_t lineSize = eSize * w;
 
-    //LOGE("data2d %p,  %i %i %i %i %i %i %p %i", this, xoff, yoff, lod, face, w, h, data, sizeBytes);
+    //ALOGE("data2d %p,  %i %i %i %i %i %i %p %i", this, xoff, yoff, lod, face, w, h, data, sizeBytes);
 
     if ((lineSize * h) != sizeBytes) {
-        LOGE("Allocation size mismatch, expected %i, got %i", (lineSize * h), sizeBytes);
+        ALOGE("Allocation size mismatch, expected %i, got %i", (lineSize * h), sizeBytes);
         rsAssert(!"Allocation::subData called with mismatched size");
         return;
     }
@@ -112,20 +112,20 @@
     uint32_t eSize = mHal.state.elementSizeBytes;
 
     if (cIdx >= mHal.state.type->getElement()->getFieldCount()) {
-        LOGE("Error Allocation::subElementData component %i out of range.", cIdx);
+        ALOGE("Error Allocation::subElementData component %i out of range.", cIdx);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData component out of range.");
         return;
     }
 
     if (x >= mHal.state.dimensionX) {
-        LOGE("Error Allocation::subElementData X offset %i out of range.", x);
+        ALOGE("Error Allocation::subElementData X offset %i out of range.", x);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
         return;
     }
 
     const Element * e = mHal.state.type->getElement()->getField(cIdx);
     if (sizeBytes != e->getSizeBytes()) {
-        LOGE("Error Allocation::subElementData data size %i does not match field size %zu.", sizeBytes, e->getSizeBytes());
+        ALOGE("Error Allocation::subElementData data size %i does not match field size %zu.", sizeBytes, e->getSizeBytes());
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData bad size.");
         return;
     }
@@ -139,19 +139,19 @@
     uint32_t eSize = mHal.state.elementSizeBytes;
 
     if (x >= mHal.state.dimensionX) {
-        LOGE("Error Allocation::subElementData X offset %i out of range.", x);
+        ALOGE("Error Allocation::subElementData X offset %i out of range.", x);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
         return;
     }
 
     if (y >= mHal.state.dimensionY) {
-        LOGE("Error Allocation::subElementData X offset %i out of range.", x);
+        ALOGE("Error Allocation::subElementData X offset %i out of range.", x);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
         return;
     }
 
     if (cIdx >= mHal.state.type->getElement()->getFieldCount()) {
-        LOGE("Error Allocation::subElementData component %i out of range.", cIdx);
+        ALOGE("Error Allocation::subElementData component %i out of range.", cIdx);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData component out of range.");
         return;
     }
@@ -159,7 +159,7 @@
     const Element * e = mHal.state.type->getElement()->getField(cIdx);
 
     if (sizeBytes != e->getSizeBytes()) {
-        LOGE("Error Allocation::subElementData data size %i does not match field size %zu.", sizeBytes, e->getSizeBytes());
+        ALOGE("Error Allocation::subElementData data size %i does not match field size %zu.", sizeBytes, e->getSizeBytes());
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData bad size.");
         return;
     }
@@ -191,7 +191,7 @@
         mHal.state.type->dumpLOGV(s.string());
     }
 
-    LOGV("%s allocation ptr=%p  mUsageFlags=0x04%x, mMipmapControl=0x%04x",
+    ALOGV("%s allocation ptr=%p  mUsageFlags=0x04%x, mMipmapControl=0x%04x",
          prefix, getPtr(), mHal.state.usageFlags, mHal.state.mipmapControl);
 }
 
@@ -217,7 +217,7 @@
     // First make sure we are reading the correct object
     RsA3DClassID classID = (RsA3DClassID)stream->loadU32();
     if (classID != RS_A3D_CLASS_ID_ALLOCATION) {
-        LOGE("allocation loading skipped due to invalid class id\n");
+        ALOGE("allocation loading skipped due to invalid class id\n");
         return NULL;
     }
 
@@ -233,7 +233,7 @@
     // Number of bytes we wrote out for this allocation
     uint32_t dataSize = stream->loadU32();
     if (dataSize != type->getSizeBytes()) {
-        LOGE("failed to read allocation because numbytes written is not the same loaded type wants\n");
+        ALOGE("failed to read allocation because numbytes written is not the same loaded type wants\n");
         ObjectBase::checkDelete(type);
         return NULL;
     }
@@ -319,7 +319,7 @@
 }
 
 void Allocation::resize2D(Context *rsc, uint32_t dimX, uint32_t dimY) {
-    LOGE("not implemented");
+    ALOGE("not implemented");
 }
 
 /////////////////
@@ -497,7 +497,7 @@
     RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, vtype, mips, usages);
     Allocation *texAlloc = static_cast<Allocation *>(vTexAlloc);
     if (texAlloc == NULL) {
-        LOGE("Memory allocation failure");
+        ALOGE("Memory allocation failure");
         return NULL;
     }
 
@@ -521,7 +521,7 @@
     RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, vtype, mips, usages);
     Allocation *texAlloc = static_cast<Allocation *>(vTexAlloc);
     if (texAlloc == NULL) {
-        LOGE("Memory allocation failure");
+        ALOGE("Memory allocation failure");
         return NULL;
     }
 
diff --git a/libs/rs/rsAnimation.cpp b/libs/rs/rsAnimation.cpp
index 48b4f02..a4093d9 100644
--- a/libs/rs/rsAnimation.cpp
+++ b/libs/rs/rsAnimation.cpp
@@ -126,7 +126,7 @@
                                 RsAnimationInterpolation interp,
                                 RsAnimationEdge pre,
                                 RsAnimationEdge post) {
-    //LOGE("rsi_ElementCreate %i %i %i %i", dt, dk, norm, vecSize);
+    //ALOGE("rsi_ElementCreate %i %i %i %i", dt, dk, norm, vecSize);
     Animation *a = NULL;//Animation::create(rsc, inValues, outValues, valueCount, interp, pre, post);
     if (a != NULL) {
         a->incUserRef();
diff --git a/libs/rs/rsComponent.cpp b/libs/rs/rsComponent.cpp
index ce06306..7d9cf0b 100644
--- a/libs/rs/rsComponent.cpp
+++ b/libs/rs/rsComponent.cpp
@@ -228,10 +228,10 @@
 
 void Component::dumpLOGV(const char *prefix) const {
     if (mType >= RS_TYPE_ELEMENT) {
-        LOGV("%s   Component: %s, %s, vectorSize=%i, bits=%i",
+        ALOGV("%s   Component: %s, %s, vectorSize=%i, bits=%i",
              prefix, gTypeObjStrings[mType - RS_TYPE_ELEMENT], gKindStrings[mKind], mVectorSize, mBits);
     } else {
-        LOGV("%s   Component: %s, %s, vectorSize=%i, bits=%i",
+        ALOGV("%s   Component: %s, %s, vectorSize=%i, bits=%i",
              prefix, gTypeBasicStrings[mType], gKindStrings[mKind], mVectorSize, mBits);
     }
 }
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 5291a1f..54fe529 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -40,7 +40,7 @@
 
     if (!mHal.funcs.initGraphics(this)) {
         pthread_mutex_unlock(&gInitMutex);
-        LOGE("%p initGraphics failed", this);
+        ALOGE("%p initGraphics failed", this);
         return false;
     }
 
@@ -152,7 +152,7 @@
 
 
     if (props.mLogTimes) {
-        LOGV("RS: Frame (%i),   Script %2.1f%% (%i),  Swap %2.1f%% (%i),  Idle %2.1f%% (%lli),  Internal %2.1f%% (%lli), Avg fps: %u",
+        ALOGV("RS: Frame (%i),   Script %2.1f%% (%i),  Swap %2.1f%% (%i),  Idle %2.1f%% (%lli),  Internal %2.1f%% (%lli), Avg fps: %u",
              mTimeMSLastFrame,
              100.0 * mTimers[RS_TIMER_SCRIPT] / total, mTimeMSLastScript,
              100.0 * mTimers[RS_TIMER_CLEAR_SWAP] / total, mTimeMSLastSwap,
@@ -219,7 +219,7 @@
 
     if (!rsdHalInit(rsc, 0, 0)) {
         rsc->setError(RS_ERROR_FATAL_DRIVER, "Failed initializing GL");
-        LOGE("Hal init failed");
+        ALOGE("Hal init failed");
         return NULL;
     }
     rsc->mHal.funcs.setPriority(rsc, rsc->mThreadPriority);
@@ -284,7 +284,7 @@
         }
     }
 
-    LOGV("%p RS Thread exiting", rsc);
+    ALOGV("%p RS Thread exiting", rsc);
 
     if (rsc->mIsGraphicsContext) {
         pthread_mutex_lock(&gInitMutex);
@@ -292,12 +292,12 @@
         pthread_mutex_unlock(&gInitMutex);
     }
 
-    LOGV("%p RS Thread exited", rsc);
+    ALOGV("%p RS Thread exited", rsc);
     return NULL;
 }
 
 void Context::destroyWorkerThreadResources() {
-    //LOGV("destroyWorkerThreadResources 1");
+    //ALOGV("destroyWorkerThreadResources 1");
     ObjectBase::zeroAllUserRef(this);
     if (mIsGraphicsContext) {
          mRaster.clear();
@@ -315,17 +315,17 @@
          mFBOCache.deinit(this);
     }
     ObjectBase::freeAllChildren(this);
-    //LOGV("destroyWorkerThreadResources 2");
+    //ALOGV("destroyWorkerThreadResources 2");
     mExit = true;
 }
 
 void Context::printWatchdogInfo(void *ctx) {
     Context *rsc = (Context *)ctx;
     if (rsc->watchdog.command && rsc->watchdog.file) {
-        LOGE("RS watchdog timeout: %i  %s  line %i %s", rsc->watchdog.inRoot,
+        ALOGE("RS watchdog timeout: %i  %s  line %i %s", rsc->watchdog.inRoot,
              rsc->watchdog.command, rsc->watchdog.line, rsc->watchdog.file);
     } else {
-        LOGE("RS watchdog timeout: %i", rsc->watchdog.inRoot);
+        ALOGE("RS watchdog timeout: %i", rsc->watchdog.inRoot);
     }
 }
 
@@ -403,7 +403,7 @@
 
     status = pthread_attr_init(&threadAttr);
     if (status) {
-        LOGE("Failed to init thread attribute.");
+        ALOGE("Failed to init thread attribute.");
         return false;
     }
 
@@ -414,7 +414,7 @@
 
     status = pthread_create(&mThreadId, &threadAttr, threadProc, this);
     if (status) {
-        LOGE("Failed to start rs context thread.");
+        ALOGE("Failed to start rs context thread.");
         return false;
     }
     while (!mRunning && (mError == RS_ERROR_NONE)) {
@@ -422,7 +422,7 @@
     }
 
     if (mError != RS_ERROR_NONE) {
-        LOGE("Errors during thread init");
+        ALOGE("Errors during thread init");
         return false;
     }
 
@@ -431,7 +431,7 @@
 }
 
 Context::~Context() {
-    LOGV("%p Context::~Context", this);
+    ALOGV("%p Context::~Context", this);
 
     if (!mIsContextLite) {
         mIO.coreFlush();
@@ -455,7 +455,7 @@
         }
         pthread_mutex_unlock(&gInitMutex);
     }
-    LOGV("%p Context::~Context done", this);
+    ALOGV("%p Context::~Context done", this);
 }
 
 void Context::setSurface(uint32_t w, uint32_t h, RsNativeWindow sur) {
@@ -578,12 +578,12 @@
 
 
 void Context::dumpDebug() const {
-    LOGE("RS Context debug %p", this);
-    LOGE("RS Context debug");
+    ALOGE("RS Context debug %p", this);
+    ALOGE("RS Context debug");
 
-    LOGE(" RS width %i, height %i", mWidth, mHeight);
-    LOGE(" RS running %i, exit %i, paused %i", mRunning, mExit, mPaused);
-    LOGE(" RS pThreadID %li, nativeThreadID %i", (long int)mThreadId, mNativeThreadId);
+    ALOGE(" RS width %i, height %i", mWidth, mHeight);
+    ALOGE(" RS running %i, exit %i, paused %i", mRunning, mExit, mPaused);
+    ALOGE(" RS pThreadID %li, nativeThreadID %i", (long int)mThreadId, mNativeThreadId);
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////
@@ -604,7 +604,7 @@
     Sampler *s = static_cast<Sampler *>(vs);
 
     if (slot > RS_MAX_SAMPLER_SLOT) {
-        LOGE("Invalid sampler slot");
+        ALOGE("Invalid sampler slot");
         return;
     }
 
@@ -672,10 +672,10 @@
 }
 
 void rsi_ContextDestroy(Context *rsc) {
-    LOGV("%p rsContextDestroy", rsc);
+    ALOGV("%p rsContextDestroy", rsc);
     rsContextDestroyWorker(rsc);
     delete rsc;
-    LOGV("%p rsContextDestroy done", rsc);
+    ALOGV("%p rsContextDestroy done", rsc);
 }
 
 
@@ -706,7 +706,7 @@
 
 RsContext rsContextCreate(RsDevice vdev, uint32_t version,
                           uint32_t sdkVersion) {
-    LOGV("rsContextCreate dev=%p", vdev);
+    ALOGV("rsContextCreate dev=%p", vdev);
     Device * dev = static_cast<Device *>(vdev);
     Context *rsc = Context::createContext(dev, NULL);
     if (rsc) {
@@ -718,14 +718,14 @@
 RsContext rsContextCreateGL(RsDevice vdev, uint32_t version,
                             uint32_t sdkVersion, RsSurfaceConfig sc,
                             uint32_t dpi) {
-    LOGV("rsContextCreateGL dev=%p", vdev);
+    ALOGV("rsContextCreateGL dev=%p", vdev);
     Device * dev = static_cast<Device *>(vdev);
     Context *rsc = Context::createContext(dev, &sc);
     if (rsc) {
         rsc->setTargetSdkVersion(sdkVersion);
         rsc->setDPI(dpi);
     }
-    LOGV("%p rsContextCreateGL ret", rsc);
+    ALOGV("%p rsContextCreateGL ret", rsc);
     return rsc;
 }
 
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 199cc5a..35221e0 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -50,13 +50,13 @@
 #define CHECK_OBJ(o) { \
     GET_TLS(); \
     if (!ObjectBase::isValid(rsc, (const ObjectBase *)o)) {  \
-        LOGE("Bad object %p at %s, %i", o, __FILE__, __LINE__);  \
+        ALOGE("Bad object %p at %s, %i", o, __FILE__, __LINE__);  \
     } \
 }
 #define CHECK_OBJ_OR_NULL(o) { \
     GET_TLS(); \
     if (o && !ObjectBase::isValid(rsc, (const ObjectBase *)o)) {  \
-        LOGE("Bad object %p at %s, %i", o, __FILE__, __LINE__);  \
+        ALOGE("Bad object %p at %s, %i", o, __FILE__, __LINE__);  \
     } \
 }
 #else
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp
index 71e1b91..b65f380 100644
--- a/libs/rs/rsElement.cpp
+++ b/libs/rs/rsElement.cpp
@@ -62,11 +62,11 @@
 
 void Element::dumpLOGV(const char *prefix) const {
     ObjectBase::dumpLOGV(prefix);
-    LOGV("%s Element: fieldCount: %zu,  size bytes: %zu", prefix, mFieldCount, getSizeBytes());
+    ALOGV("%s Element: fieldCount: %zu,  size bytes: %zu", prefix, mFieldCount, getSizeBytes());
     mComponent.dumpLOGV(prefix);
     for (uint32_t ct = 0; ct < mFieldCount; ct++) {
-        LOGV("%s Element field index: %u ------------------", prefix, ct);
-        LOGV("%s name: %s, offsetBits: %u, arraySize: %u",
+        ALOGV("%s Element field index: %u ------------------", prefix, ct);
+        ALOGV("%s name: %s, offsetBits: %u, arraySize: %u",
              prefix, mFields[ct].name.string(), mFields[ct].offsetBits, mFields[ct].arraySize);
         mFields[ct].e->dumpLOGV(prefix);
     }
@@ -94,7 +94,7 @@
     // First make sure we are reading the correct object
     RsA3DClassID classID = (RsA3DClassID)stream->loadU32();
     if (classID != RS_A3D_CLASS_ID_ELEMENT) {
-        LOGE("element loading skipped due to invalid class id\n");
+        ALOGE("element loading skipped due to invalid class id\n");
         return NULL;
     }
 
diff --git a/libs/rs/rsFBOCache.cpp b/libs/rs/rsFBOCache.cpp
index f4a8bc6..d50f3e0 100644
--- a/libs/rs/rsFBOCache.cpp
+++ b/libs/rs/rsFBOCache.cpp
@@ -46,12 +46,12 @@
 
 void FBOCache::bindColorTarget(Context *rsc, Allocation *a, uint32_t slot) {
     if (slot >= mHal.state.colorTargetsCount) {
-        LOGE("Invalid render target index");
+        ALOGE("Invalid render target index");
         return;
     }
     if (a != NULL) {
         if (!a->getIsTexture()) {
-            LOGE("Invalid Color Target");
+            ALOGE("Invalid Color Target");
             return;
         }
     }
@@ -63,7 +63,7 @@
 void FBOCache::bindDepthTarget(Context *rsc, Allocation *a) {
     if (a != NULL) {
         if (!a->getIsRenderTarget()) {
-            LOGE("Invalid Depth Target");
+            ALOGE("Invalid Depth Target");
             return;
         }
     }
diff --git a/libs/rs/rsFifoSocket.cpp b/libs/rs/rsFifoSocket.cpp
index 8b8008d..163a44b 100644
--- a/libs/rs/rsFifoSocket.cpp
+++ b/libs/rs/rsFifoSocket.cpp
@@ -48,31 +48,31 @@
     if (bytes == 0) {
         return;
     }
-    //LOGE("writeAsync %p %i", data, bytes);
+    //ALOGE("writeAsync %p %i", data, bytes);
     size_t ret = ::send(sv[0], data, bytes, 0);
-    //LOGE("writeAsync ret %i", ret);
+    //ALOGE("writeAsync ret %i", ret);
     rsAssert(ret == bytes);
 }
 
 void FifoSocket::writeWaitReturn(void *retData, size_t retBytes) {
-    //LOGE("writeWaitReturn %p %i", retData, retBytes);
+    //ALOGE("writeWaitReturn %p %i", retData, retBytes);
     size_t ret = ::recv(sv[0], retData, retBytes, 0);
-    //LOGE("writeWaitReturn %i", ret);
+    //ALOGE("writeWaitReturn %i", ret);
     rsAssert(ret == retBytes);
 }
 
 size_t FifoSocket::read(void *data, size_t bytes) {
-    //LOGE("read %p %i", data, bytes);
+    //ALOGE("read %p %i", data, bytes);
     size_t ret = ::recv(sv[1], data, bytes, 0);
     rsAssert(ret == bytes);
-    //LOGE("read ret %i", ret);
+    //ALOGE("read ret %i", ret);
     return ret;
 }
 
 void FifoSocket::readReturn(const void *data, size_t bytes) {
-    LOGE("readReturn %p %Zu", data, bytes);
+    ALOGE("readReturn %p %Zu", data, bytes);
     size_t ret = ::send(sv[1], data, bytes, 0);
-    LOGE("readReturn %Zu", ret);
+    ALOGE("readReturn %Zu", ret);
     rsAssert(ret == bytes);
 }
 
diff --git a/libs/rs/rsFileA3D.cpp b/libs/rs/rsFileA3D.cpp
index df5dc12..ac658c8 100644
--- a/libs/rs/rsFileA3D.cpp
+++ b/libs/rs/rsFileA3D.cpp
@@ -68,7 +68,7 @@
     for (uint32_t i = 0; i < numIndexEntries; i ++) {
         A3DIndexEntry *entry = new A3DIndexEntry();
         headerStream->loadString(&entry->mObjectName);
-        //LOGV("Header data, entry name = %s", entry->mObjectName.string());
+        //ALOGV("Header data, entry name = %s", entry->mObjectName.string());
         entry->mType = (RsA3DClassID)headerStream->loadU32();
         if (mUse64BitOffsets){
             entry->mOffset = headerStream->loadOffset();
@@ -145,7 +145,7 @@
     char magicString[12];
     size_t len;
 
-    LOGV("file open 1");
+    ALOGV("file open 1");
     len = fread(magicString, 1, 12, f);
     if ((len != 12) ||
         memcmp(magicString, "Android3D_ff", 12)) {
@@ -181,7 +181,7 @@
         return false;
     }
 
-    LOGV("file open size = %lli", mDataSize);
+    ALOGV("file open size = %lli", mDataSize);
 
     // We should know enough to read the file in at this point.
     mAlloc = malloc(mDataSize);
@@ -196,7 +196,7 @@
 
     mReadStream = new IStream(mData, mUse64BitOffsets);
 
-    LOGV("Header is read an stream initialized");
+    ALOGV("Header is read an stream initialized");
     return true;
 }
 
@@ -278,17 +278,17 @@
 
 bool FileA3D::writeFile(const char *filename) {
     if (!mWriteStream) {
-        LOGE("No objects to write\n");
+        ALOGE("No objects to write\n");
         return false;
     }
     if (mWriteStream->getPos() == 0) {
-        LOGE("No objects to write\n");
+        ALOGE("No objects to write\n");
         return false;
     }
 
     FILE *writeHandle = fopen(filename, "wb");
     if (!writeHandle) {
-        LOGE("Couldn't open the file for writing\n");
+        ALOGE("Couldn't open the file for writing\n");
         return false;
     }
 
@@ -335,7 +335,7 @@
     int status = fclose(writeHandle);
 
     if (status != 0) {
-        LOGE("Couldn't close file\n");
+        ALOGE("Couldn't close file\n");
         return false;
     }
 
@@ -364,12 +364,12 @@
 RsObjectBase rsaFileA3DGetEntryByIndex(RsContext con, uint32_t index, RsFile file) {
     FileA3D *fa3d = static_cast<FileA3D *>(file);
     if (!fa3d) {
-        LOGE("Can't load entry. No valid file");
+        ALOGE("Can't load entry. No valid file");
         return NULL;
     }
 
     ObjectBase *obj = fa3d->initializeFromEntry(index);
-    //LOGV("Returning object with name %s", obj->getName());
+    //ALOGV("Returning object with name %s", obj->getName());
 
     return obj;
 }
@@ -389,13 +389,13 @@
     FileA3D *fa3d = static_cast<FileA3D *>(file);
 
     if (!fa3d) {
-        LOGE("Can't load index entries. No valid file");
+        ALOGE("Can't load index entries. No valid file");
         return;
     }
 
     uint32_t numFileEntries = fa3d->getNumIndexEntries();
     if (numFileEntries != numEntries || numEntries == 0 || fileEntries == NULL) {
-        LOGE("Can't load index entries. Invalid number requested");
+        ALOGE("Can't load index entries. Invalid number requested");
         return;
     }
 
@@ -408,7 +408,7 @@
 
 RsFile rsaFileA3DCreateFromMemory(RsContext con, const void *data, uint32_t len) {
     if (data == NULL) {
-        LOGE("File load failed. Asset stream is NULL");
+        ALOGE("File load failed. Asset stream is NULL");
         return NULL;
     }
 
@@ -432,7 +432,7 @@
 
 RsFile rsaFileA3DCreateFromFile(RsContext con, const char *path) {
     if (path == NULL) {
-        LOGE("File load failed. Path is NULL");
+        ALOGE("File load failed. Path is NULL");
         return NULL;
     }
 
@@ -446,7 +446,7 @@
         fa3d->load(f);
         fclose(f);
     } else {
-        LOGE("Could not open file %s", path);
+        ALOGE("Could not open file %s", path);
     }
 
     return fa3d;
diff --git a/libs/rs/rsFont.cpp b/libs/rs/rsFont.cpp
index 7efed9d..e09f81c 100644
--- a/libs/rs/rsFont.cpp
+++ b/libs/rs/rsFont.cpp
@@ -39,7 +39,7 @@
 bool Font::init(const char *name, float fontSize, uint32_t dpi, const void *data, uint32_t dataLen) {
 #ifndef ANDROID_RS_SERIALIZE
     if (mInitialized) {
-        LOGE("Reinitialization of fonts not supported");
+        ALOGE("Reinitialization of fonts not supported");
         return false;
     }
 
@@ -51,7 +51,7 @@
     }
 
     if (error) {
-        LOGE("Unable to initialize font %s", name);
+        ALOGE("Unable to initialize font %s", name);
         return false;
     }
 
@@ -61,7 +61,7 @@
 
     error = FT_Set_Char_Size(mFace, (FT_F26Dot6)(fontSize * 64.0f), 0, dpi, 0);
     if (error) {
-        LOGE("Unable to set font size on %s", name);
+        ALOGE("Unable to set font size on %s", name);
         return false;
     }
 
@@ -124,7 +124,7 @@
     for (cacheX = glyph->mBitmapMinX, bX = nPenX; cacheX < endX; cacheX++, bX++) {
         for (cacheY = glyph->mBitmapMinY, bY = nPenY; cacheY < endY; cacheY++, bY++) {
             if (bX < 0 || bY < 0 || bX >= (int32_t) bitmapW || bY >= (int32_t) bitmapH) {
-                LOGE("Skipping invalid index");
+                ALOGE("Skipping invalid index");
                 continue;
             }
             uint8_t tempCol = cacheBuffer[cacheY * cacheWidth + cacheX];
@@ -165,7 +165,7 @@
 
     if (mode == Font::MEASURE) {
         if (bounds == NULL) {
-            LOGE("No return rectangle provided to measure text");
+            ALOGE("No return rectangle provided to measure text");
             return;
         }
         // Reset min and max of the bounding box to something large
@@ -237,7 +237,7 @@
 #ifndef ANDROID_RS_SERIALIZE
     FT_Error error = FT_Load_Glyph( mFace, glyph->mGlyphIndex, FT_LOAD_RENDER );
     if (error) {
-        LOGE("Couldn't load glyph.");
+        ALOGE("Couldn't load glyph.");
         return;
     }
 
@@ -378,7 +378,7 @@
     if (!mLibrary) {
         FT_Error error = FT_Init_FreeType(&mLibrary);
         if (error) {
-            LOGE("Unable to initialize freetype");
+            ALOGE("Unable to initialize freetype");
             return NULL;
         }
     }
@@ -409,7 +409,7 @@
 bool FontState::cacheBitmap(FT_Bitmap *bitmap, uint32_t *retOriginX, uint32_t *retOriginY) {
     // If the glyph is too tall, don't cache it
     if ((uint32_t)bitmap->rows > mCacheLines[mCacheLines.size()-1]->mMaxHeight) {
-        LOGE("Font size to large to fit in cache. width, height = %i, %i", (int)bitmap->width, (int)bitmap->rows);
+        ALOGE("Font size to large to fit in cache. width, height = %i, %i", (int)bitmap->width, (int)bitmap->rows);
         return false;
     }
 
@@ -439,7 +439,7 @@
 
         // if we still don't fit, something is wrong and we shouldn't draw
         if (!bitmapFit) {
-            LOGE("Bitmap doesn't fit in cache. width, height = %i, %i", (int)bitmap->width, (int)bitmap->rows);
+            ALOGE("Bitmap doesn't fit in cache. width, height = %i, %i", (int)bitmap->width, (int)bitmap->rows);
             return false;
         }
     }
@@ -471,7 +471,7 @@
 
     // Some debug code
     /*for (uint32_t i = 0; i < mCacheLines.size(); i ++) {
-        LOGE("Cache Line: H: %u Empty Space: %f",
+        ALOGE("Cache Line: H: %u Empty Space: %f",
              mCacheLines[i]->mMaxHeight,
               (1.0f - (float)mCacheLines[i]->mCurrentCol/(float)mCacheLines[i]->mMaxWidth)*100.0f);
 
@@ -663,9 +663,9 @@
     }
 
     /*LOGE("V0 x: %f y: %f z: %f", x1, y1, z1);
-    LOGE("V1 x: %f y: %f z: %f", x2, y2, z2);
-    LOGE("V2 x: %f y: %f z: %f", x3, y3, z3);
-    LOGE("V3 x: %f y: %f z: %f", x4, y4, z4);*/
+    ALOGE("V1 x: %f y: %f z: %f", x2, y2, z2);
+    ALOGE("V2 x: %f y: %f z: %f", x3, y3, z3);
+    ALOGE("V3 x: %f y: %f z: %f", x4, y4, z4);*/
 
     (*currentPos++) = x1;
     (*currentPos++) = y1;
@@ -742,7 +742,7 @@
         currentFont = mDefault.get();
     }
     if (!currentFont) {
-        LOGE("Unable to initialize any fonts");
+        ALOGE("Unable to initialize any fonts");
         return;
     }
 
diff --git a/libs/rs/rsLocklessFifo.cpp b/libs/rs/rsLocklessFifo.cpp
index 8879805..0466d8b 100644
--- a/libs/rs/rsLocklessFifo.cpp
+++ b/libs/rs/rsLocklessFifo.cpp
@@ -45,12 +45,12 @@
     // Add room for a buffer reset command
     mBuffer = static_cast<uint8_t *>(malloc(sizeInBytes + 4));
     if (!mBuffer) {
-        LOGE("LocklessFifo allocation failure");
+        ALOGE("LocklessFifo allocation failure");
         return false;
     }
 
     if (!mSignalToControl.init() || !mSignalToWorker.init()) {
-        LOGE("Signal setup failed");
+        ALOGE("Signal setup failed");
         free(mBuffer);
         return false;
     }
@@ -231,7 +231,7 @@
 }
 
 void LocklessCommandFifo::dumpState(const char *s) const {
-    LOGV("%s %p  put %p, get %p,  buf %p,  end %p", s, this, mPut, mGet, mBuffer, mEnd);
+    ALOGV("%s %p  put %p, get %p,  buf %p,  end %p", s, this, mPut, mGet, mBuffer, mEnd);
 }
 
 void LocklessCommandFifo::printDebugData() const {
@@ -244,7 +244,7 @@
 
 
     for (int ct=0; ct < 16; ct++) {
-        LOGV("fifo %p = 0x%08x  0x%08x  0x%08x  0x%08x", pptr, pptr[0], pptr[1], pptr[2], pptr[3]);
+        ALOGV("fifo %p = 0x%08x  0x%08x  0x%08x  0x%08x", pptr, pptr[0], pptr[1], pptr[2], pptr[3]);
         pptr += 4;
     }
 
diff --git a/libs/rs/rsMatrix4x4.cpp b/libs/rs/rsMatrix4x4.cpp
index f34af47..c6f96d8 100644
--- a/libs/rs/rsMatrix4x4.cpp
+++ b/libs/rs/rsMatrix4x4.cpp
@@ -307,8 +307,8 @@
 }
 
 void Matrix4x4::logv(const char *s) const {
-    LOGV("%s {%f, %f, %f, %f",  s, m[0], m[4], m[8], m[12]);
-    LOGV("%s  %f, %f, %f, %f",  s, m[1], m[5], m[9], m[13]);
-    LOGV("%s  %f, %f, %f, %f",  s, m[2], m[6], m[10], m[14]);
-    LOGV("%s  %f, %f, %f, %f}", s, m[3], m[7], m[11], m[15]);
+    ALOGV("%s {%f, %f, %f, %f",  s, m[0], m[4], m[8], m[12]);
+    ALOGV("%s  %f, %f, %f, %f",  s, m[1], m[5], m[9], m[13]);
+    ALOGV("%s  %f, %f, %f, %f",  s, m[2], m[6], m[10], m[14]);
+    ALOGV("%s  %f, %f, %f, %f}", s, m[3], m[7], m[11], m[15]);
 }
diff --git a/libs/rs/rsMesh.cpp b/libs/rs/rsMesh.cpp
index bf9284f..67c7299 100644
--- a/libs/rs/rsMesh.cpp
+++ b/libs/rs/rsMesh.cpp
@@ -107,7 +107,7 @@
     // First make sure we are reading the correct object
     RsA3DClassID classID = (RsA3DClassID)stream->loadU32();
     if (classID != RS_A3D_CLASS_ID_MESH) {
-        LOGE("mesh loading skipped due to invalid class id");
+        ALOGE("mesh loading skipped due to invalid class id");
         return NULL;
     }
 
@@ -178,7 +178,7 @@
 
 void Mesh::renderPrimitive(Context *rsc, uint32_t primIndex) const {
     if (primIndex >= mHal.state.primitivesCount) {
-        LOGE("Invalid primitive index");
+        ALOGE("Invalid primitive index");
         return;
     }
 
@@ -192,7 +192,7 @@
 
 void Mesh::renderPrimitiveRange(Context *rsc, uint32_t primIndex, uint32_t start, uint32_t len) const {
     if (len < 1 || primIndex >= mHal.state.primitivesCount) {
-        LOGE("Invalid mesh or parameters");
+        ALOGE("Invalid mesh or parameters");
         return;
     }
 
@@ -241,7 +241,7 @@
     mBBoxMin[0] = mBBoxMin[1] = mBBoxMin[2] = 1e6;
     mBBoxMax[0] = mBBoxMax[1] = mBBoxMax[2] = -1e6;
     if (!posPtr) {
-        LOGE("Unable to compute bounding box");
+        ALOGE("Unable to compute bounding box");
         mBBoxMin[0] = mBBoxMin[1] = mBBoxMin[2] = 0.0f;
         mBBoxMax[0] = mBBoxMax[1] = mBBoxMax[2] = 0.0f;
         return;
diff --git a/libs/rs/rsMutex.cpp b/libs/rs/rsMutex.cpp
index 2105288..6512372 100644
--- a/libs/rs/rsMutex.cpp
+++ b/libs/rs/rsMutex.cpp
@@ -30,7 +30,7 @@
 bool Mutex::init() {
     int status = pthread_mutex_init(&mMutex, NULL);
     if (status) {
-        LOGE("Mutex::Mutex init failure");
+        ALOGE("Mutex::Mutex init failure");
         return false;
     }
     return true;
@@ -40,7 +40,7 @@
     int status;
     status = pthread_mutex_lock(&mMutex);
     if (status) {
-        LOGE("Mutex: error %i locking.", status);
+        ALOGE("Mutex: error %i locking.", status);
         return false;
     }
     return true;
@@ -50,7 +50,7 @@
     int status;
     status = pthread_mutex_unlock(&mMutex);
     if (status) {
-        LOGE("Mutex error %i unlocking.", status);
+        ALOGE("Mutex error %i unlocking.", status);
         return false;
     }
     return true;
diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp
index f5ced26..6a64582 100644
--- a/libs/rs/rsObjectBase.cpp
+++ b/libs/rs/rsObjectBase.cpp
@@ -35,11 +35,11 @@
 
     rsAssert(rsc);
     add();
-    //LOGV("ObjectBase %p con", this);
+    //ALOGV("ObjectBase %p con", this);
 }
 
 ObjectBase::~ObjectBase() {
-    //LOGV("~ObjectBase %p  ref %i,%i", this, mUserRefCount, mSysRefCount);
+    //ALOGV("~ObjectBase %p  ref %i,%i", this, mUserRefCount, mSysRefCount);
 #if RS_OBJECT_DEBUG
     mStack.dump();
 #endif
@@ -60,22 +60,22 @@
 
 void ObjectBase::dumpLOGV(const char *op) const {
     if (mName.size()) {
-        LOGV("%s RSobj %p, name %s, refs %i,%i  links %p,%p,%p",
+        ALOGV("%s RSobj %p, name %s, refs %i,%i  links %p,%p,%p",
              op, this, mName.string(), mUserRefCount, mSysRefCount, mNext, mPrev, mRSC);
     } else {
-        LOGV("%s RSobj %p, no-name, refs %i,%i  links %p,%p,%p",
+        ALOGV("%s RSobj %p, no-name, refs %i,%i  links %p,%p,%p",
              op, this, mUserRefCount, mSysRefCount, mNext, mPrev, mRSC);
     }
 }
 
 void ObjectBase::incUserRef() const {
     android_atomic_inc(&mUserRefCount);
-    //LOGV("ObjectBase %p incU ref %i, %i", this, mUserRefCount, mSysRefCount);
+    //ALOGV("ObjectBase %p incU ref %i, %i", this, mUserRefCount, mSysRefCount);
 }
 
 void ObjectBase::incSysRef() const {
     android_atomic_inc(&mSysRefCount);
-    //LOGV("ObjectBase %p incS ref %i, %i", this, mUserRefCount, mSysRefCount);
+    //ALOGV("ObjectBase %p incS ref %i, %i", this, mUserRefCount, mSysRefCount);
 }
 
 void ObjectBase::preDestroy() const {
@@ -111,7 +111,7 @@
 bool ObjectBase::decUserRef() const {
     rsAssert(mUserRefCount > 0);
 #if RS_OBJECT_DEBUG
-    LOGV("ObjectBase %p decU ref %i, %i", this, mUserRefCount, mSysRefCount);
+    ALOGV("ObjectBase %p decU ref %i, %i", this, mUserRefCount, mSysRefCount);
     if (mUserRefCount <= 0) {
         mStack.dump();
     }
@@ -126,7 +126,7 @@
 }
 
 bool ObjectBase::zeroUserRef() const {
-    //LOGV("ObjectBase %p zeroU ref %i, %i", this, mUserRefCount, mSysRefCount);
+    //ALOGV("ObjectBase %p zeroU ref %i, %i", this, mUserRefCount, mSysRefCount);
     android_atomic_acquire_store(0, &mUserRefCount);
     if (android_atomic_acquire_load(&mSysRefCount) <= 0) {
         return checkDelete(this);
@@ -135,7 +135,7 @@
 }
 
 bool ObjectBase::decSysRef() const {
-    //LOGV("ObjectBase %p decS ref %i, %i", this, mUserRefCount, mSysRefCount);
+    //ALOGV("ObjectBase %p decS ref %i, %i", this, mUserRefCount, mSysRefCount);
     rsAssert(mSysRefCount > 0);
     if ((android_atomic_dec(&mSysRefCount) <= 1) &&
         (android_atomic_acquire_load(&mUserRefCount) <= 0)) {
@@ -165,7 +165,7 @@
 
     rsAssert(!mNext);
     rsAssert(!mPrev);
-    //LOGV("calling add  rsc %p", mRSC);
+    //ALOGV("calling add  rsc %p", mRSC);
     mNext = mRSC->mObjHead;
     if (mRSC->mObjHead) {
         mRSC->mObjHead->mPrev = this;
@@ -176,7 +176,7 @@
 }
 
 void ObjectBase::remove() const {
-    //LOGV("calling remove  rsc %p", mRSC);
+    //ALOGV("calling remove  rsc %p", mRSC);
     if (!mRSC) {
         rsAssert(!mPrev);
         rsAssert(!mNext);
@@ -198,32 +198,32 @@
 
 void ObjectBase::zeroAllUserRef(Context *rsc) {
     if (rsc->props.mLogObjects) {
-        LOGV("Forcing release of all outstanding user refs.");
+        ALOGV("Forcing release of all outstanding user refs.");
     }
 
     // This operation can be slow, only to be called during context cleanup.
     const ObjectBase * o = rsc->mObjHead;
     while (o) {
-        //LOGE("o %p", o);
+        //ALOGE("o %p", o);
         if (o->zeroUserRef()) {
             // deleted the object and possibly others, restart from head.
             o = rsc->mObjHead;
-            //LOGE("o head %p", o);
+            //ALOGE("o head %p", o);
         } else {
             o = o->mNext;
-            //LOGE("o next %p", o);
+            //ALOGE("o next %p", o);
         }
     }
 
     if (rsc->props.mLogObjects) {
-        LOGV("Objects remaining.");
+        ALOGV("Objects remaining.");
         dumpAll(rsc);
     }
 }
 
 void ObjectBase::freeAllChildren(Context *rsc) {
     if (rsc->props.mLogObjects) {
-        LOGV("Forcing release of all child objects.");
+        ALOGV("Forcing release of all child objects.");
     }
 
     // This operation can be slow, only to be called during context cleanup.
@@ -238,7 +238,7 @@
     }
 
     if (rsc->props.mLogObjects) {
-        LOGV("Objects remaining.");
+        ALOGV("Objects remaining.");
         dumpAll(rsc);
     }
 }
@@ -246,10 +246,10 @@
 void ObjectBase::dumpAll(Context *rsc) {
     asyncLock();
 
-    LOGV("Dumping all objects");
+    ALOGV("Dumping all objects");
     const ObjectBase * o = rsc->mObjHead;
     while (o) {
-        LOGV(" Object %p", o);
+        ALOGV(" Object %p", o);
         o->dumpLOGV("  ");
         o = o->mNext;
     }
diff --git a/libs/rs/rsProgram.cpp b/libs/rs/rsProgram.cpp
index a9fd877..8061515 100644
--- a/libs/rs/rsProgram.cpp
+++ b/libs/rs/rsProgram.cpp
@@ -139,13 +139,13 @@
 void Program::bindAllocation(Context *rsc, Allocation *alloc, uint32_t slot) {
     if (alloc != NULL) {
         if (slot >= mHal.state.constantsCount) {
-            LOGE("Attempt to bind alloc at slot %u, on shader id %u, but const count is %u",
+            ALOGE("Attempt to bind alloc at slot %u, on shader id %u, but const count is %u",
                  slot, (uint32_t)this, mHal.state.constantsCount);
             rsc->setError(RS_ERROR_BAD_SHADER, "Cannot bind allocation");
             return;
         }
         if (alloc->getType() != mConstantTypes[slot].get()) {
-            LOGE("Attempt to bind alloc at slot %u, on shader id %u, but types mismatch",
+            ALOGE("Attempt to bind alloc at slot %u, on shader id %u, but types mismatch",
                  slot, (uint32_t)this);
             rsc->setError(RS_ERROR_BAD_SHADER, "Cannot bind allocation");
             return;
@@ -167,13 +167,13 @@
 
 void Program::bindTexture(Context *rsc, uint32_t slot, Allocation *a) {
     if (slot >= mHal.state.texturesCount) {
-        LOGE("Attempt to bind texture to slot %u but tex count is %u", slot, mHal.state.texturesCount);
+        ALOGE("Attempt to bind texture to slot %u but tex count is %u", slot, mHal.state.texturesCount);
         rsc->setError(RS_ERROR_BAD_SHADER, "Cannot bind texture");
         return;
     }
 
     if (a && a->getType()->getDimFaces() && mHal.state.textureTargets[slot] != RS_TEXTURE_CUBE) {
-        LOGE("Attempt to bind cubemap to slot %u but 2d texture needed", slot);
+        ALOGE("Attempt to bind cubemap to slot %u but 2d texture needed", slot);
         rsc->setError(RS_ERROR_BAD_SHADER, "Cannot bind cubemap to 2d texture slot");
         return;
     }
@@ -186,7 +186,7 @@
 
 void Program::bindSampler(Context *rsc, uint32_t slot, Sampler *s) {
     if (slot >= mHal.state.texturesCount) {
-        LOGE("Attempt to bind sampler to slot %u but tex count is %u", slot, mHal.state.texturesCount);
+        ALOGE("Attempt to bind sampler to slot %u but tex count is %u", slot, mHal.state.texturesCount);
         rsc->setError(RS_ERROR_BAD_SHADER, "Cannot bind sampler");
         return;
     }
diff --git a/libs/rs/rsProgramFragment.cpp b/libs/rs/rsProgramFragment.cpp
index 81eedc4..4e73ca6 100644
--- a/libs/rs/rsProgramFragment.cpp
+++ b/libs/rs/rsProgramFragment.cpp
@@ -38,12 +38,12 @@
 
 void ProgramFragment::setConstantColor(Context *rsc, float r, float g, float b, float a) {
     if (isUserProgram()) {
-        LOGE("Attempting to set fixed function emulation color on user program");
+        ALOGE("Attempting to set fixed function emulation color on user program");
         rsc->setError(RS_ERROR_BAD_SHADER, "Cannot  set fixed function emulation color on user program");
         return;
     }
     if (mHal.state.constants[0] == NULL) {
-        LOGE("Unable to set fixed function emulation color because allocation is missing");
+        ALOGE("Unable to set fixed function emulation color because allocation is missing");
         rsc->setError(RS_ERROR_BAD_SHADER, "Unable to set fixed function emulation color because allocation is missing");
         return;
     }
@@ -63,7 +63,7 @@
 
     for (uint32_t ct=0; ct < mHal.state.texturesCount; ct++) {
         if (!mHal.state.textures[ct]) {
-            LOGE("No texture bound for shader id %u, texture unit %u", (uint)this, ct);
+            ALOGE("No texture bound for shader id %u, texture unit %u", (uint)this, ct);
             rsc->setError(RS_ERROR_BAD_SHADER, "No texture bound");
             continue;
         }
@@ -131,7 +131,7 @@
                              size_t paramLength) {
     ProgramFragment *pf = new ProgramFragment(rsc, shaderText, shaderLength, params, paramLength);
     pf->incUserRef();
-    //LOGE("rsi_ProgramFragmentCreate %p", pf);
+    //ALOGE("rsi_ProgramFragmentCreate %p", pf);
     return pf;
 }
 
diff --git a/libs/rs/rsScript.cpp b/libs/rs/rsScript.cpp
index 93513fe..fad9c08 100644
--- a/libs/rs/rsScript.cpp
+++ b/libs/rs/rsScript.cpp
@@ -39,9 +39,9 @@
 }
 
 void Script::setSlot(uint32_t slot, Allocation *a) {
-    //LOGE("setSlot %i %p", slot, a);
+    //ALOGE("setSlot %i %p", slot, a);
     if (slot >= mHal.info.exportedVariableCount) {
-        LOGE("Script::setSlot unable to set allocation, invalid slot index");
+        ALOGE("Script::setSlot unable to set allocation, invalid slot index");
         return;
     }
 
@@ -54,21 +54,21 @@
 }
 
 void Script::setVar(uint32_t slot, const void *val, size_t len) {
-    //LOGE("setVar %i %p %i", slot, val, len);
+    //ALOGE("setVar %i %p %i", slot, val, len);
     if (slot >= mHal.info.exportedVariableCount) {
-        LOGE("Script::setVar unable to set allocation, invalid slot index");
+        ALOGE("Script::setVar unable to set allocation, invalid slot index");
         return;
     }
     mRSC->mHal.funcs.script.setGlobalVar(mRSC, this, slot, (void *)val, len);
 }
 
 void Script::setVarObj(uint32_t slot, ObjectBase *val) {
-    //LOGE("setVarObj %i %p", slot, val);
+    //ALOGE("setVarObj %i %p", slot, val);
     if (slot >= mHal.info.exportedVariableCount) {
-        LOGE("Script::setVarObj unable to set allocation, invalid slot index");
+        ALOGE("Script::setVarObj unable to set allocation, invalid slot index");
         return;
     }
-    //LOGE("setvarobj  %i %p", slot, val);
+    //ALOGE("setvarobj  %i %p", slot, val);
     mRSC->mHal.funcs.script.setGlobalObj(mRSC, this, slot, val);
 }
 
@@ -85,7 +85,7 @@
     Script *s = static_cast<Script *>(vs);
     Allocation *a = static_cast<Allocation *>(va);
     s->setSlot(slot, a);
-    //LOGE("rsi_ScriptBindAllocation %i  %p  %p", slot, a, a->getPtr());
+    //ALOGE("rsi_ScriptBindAllocation %i  %p  %p", slot, a, a->getPtr());
 }
 
 void rsi_ScriptSetTimeZone(Context * rsc, RsScript vs, const char * timeZone, size_t length) {
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index cd7b3a7..5079b63 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -70,7 +70,7 @@
 }
 
 const Allocation *ScriptC::ptrToAllocation(const void *ptr) const {
-    //LOGE("ptr to alloc %p", ptr);
+    //ALOGE("ptr to alloc %p", ptr);
     if (!ptr) {
         return NULL;
     }
@@ -81,7 +81,7 @@
             return mSlots[ct].get();
         }
     }
-    LOGE("ScriptC::ptrToAllocation, failed to find %p", ptr);
+    ALOGE("ScriptC::ptrToAllocation, failed to find %p", ptr);
     return NULL;
 }
 
@@ -112,13 +112,13 @@
     uint32_t ret = 0;
 
     if (rsc->props.mLogScripts) {
-        LOGV("%p ScriptC::run invoking root,  ptr %p", rsc, mHal.info.root);
+        ALOGV("%p ScriptC::run invoking root,  ptr %p", rsc, mHal.info.root);
     }
 
     ret = rsc->mHal.funcs.script.invokeRoot(rsc, this);
 
     if (rsc->props.mLogScripts) {
-        LOGV("%p ScriptC::run invoking complete, ret=%i", rsc, ret);
+        ALOGV("%p ScriptC::run invoking complete, ret=%i", rsc, ret);
     }
 
     return ret;
@@ -147,7 +147,7 @@
     setupScript(rsc);
 
     if (rsc->props.mLogScripts) {
-        LOGV("%p ScriptC::Invoke invoking slot %i,  ptr %p", rsc, slot, this);
+        ALOGV("%p ScriptC::Invoke invoking slot %i,  ptr %p", rsc, slot, this);
     }
     rsc->mHal.funcs.script.invokeFunction(rsc, this, slot, data, len);
 }
@@ -179,7 +179,7 @@
         s->mHal.info.isThreadable &= sym->threadable;
         return sym->mPtr;
     }
-    LOGE("ScriptC sym lookup failed for %s", name);
+    ALOGE("ScriptC sym lookup failed for %s", name);
     return NULL;
 }
 */
@@ -195,12 +195,12 @@
                           const uint8_t *bitcode,
                           size_t bitcodeLen) {
 
-    //LOGE("runCompiler %p %p %p %p %p %i", rsc, this, resName, cacheDir, bitcode, bitcodeLen);
+    //ALOGE("runCompiler %p %p %p %p %p %i", rsc, this, resName, cacheDir, bitcode, bitcodeLen);
 #ifndef ANDROID_RS_SERIALIZE
     uint32_t sdkVersion = 0;
     bcinfo::BitcodeWrapper bcWrapper((const char *)bitcode, bitcodeLen);
     if (!bcWrapper.unwrap()) {
-        LOGE("Bitcode is not in proper container format (raw or wrapper)");
+        ALOGE("Bitcode is not in proper container format (raw or wrapper)");
         return false;
     }
 
@@ -221,7 +221,7 @@
     BT = new bcinfo::BitcodeTranslator((const char *)bitcode, bitcodeLen,
                                        sdkVersion);
     if (!BT->translate()) {
-        LOGE("Failed to translate bitcode from version: %u", sdkVersion);
+        ALOGE("Failed to translate bitcode from version: %u", sdkVersion);
         delete BT;
         BT = NULL;
         return false;
@@ -242,12 +242,12 @@
     for (size_t i=0; i < mHal.info.exportedPragmaCount; ++i) {
         const char * key = mHal.info.exportedPragmaKeyList[i];
         const char * value = mHal.info.exportedPragmaValueList[i];
-        //LOGE("pragma %s %s", keys[i], values[i]);
+        //ALOGE("pragma %s %s", keys[i], values[i]);
         if (!strcmp(key, "version")) {
             if (!strcmp(value, "1")) {
                 continue;
             }
-            LOGE("Invalid version pragma value: %s\n", value);
+            ALOGE("Invalid version pragma value: %s\n", value);
             return false;
         }
 
@@ -259,7 +259,7 @@
                 mEnviroment.mVertex.clear();
                 continue;
             }
-            LOGE("Unrecognized value %s passed to stateVertex", value);
+            ALOGE("Unrecognized value %s passed to stateVertex", value);
             return false;
         }
 
@@ -271,7 +271,7 @@
                 mEnviroment.mRaster.clear();
                 continue;
             }
-            LOGE("Unrecognized value %s passed to stateRaster", value);
+            ALOGE("Unrecognized value %s passed to stateRaster", value);
             return false;
         }
 
@@ -283,7 +283,7 @@
                 mEnviroment.mFragment.clear();
                 continue;
             }
-            LOGE("Unrecognized value %s passed to stateFragment", value);
+            ALOGE("Unrecognized value %s passed to stateFragment", value);
             return false;
         }
 
@@ -295,7 +295,7 @@
                 mEnviroment.mFragmentStore.clear();
                 continue;
             }
-            LOGE("Unrecognized value %s passed to stateStore", value);
+            ALOGE("Unrecognized value %s passed to stateStore", value);
             return false;
         }
     }
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp
index ec15bc0..183e207 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -115,7 +115,7 @@
 //////////////////////////////////////////////////////////////////////////////
 
 void rsrSetObject(const Context *rsc, const Script *sc, ObjectBase **dst, ObjectBase * src) {
-    //LOGE("rsiSetObject  %p,%p  %p", vdst, *vdst, vsrc);
+    //ALOGE("rsiSetObject  %p,%p  %p", vdst, *vdst, vsrc);
     if (src) {
         CHECK_OBJ(src);
         src->incSysRef();
@@ -128,7 +128,7 @@
 }
 
 void rsrClearObject(const Context *rsc, const Script *sc, ObjectBase **dst) {
-    //LOGE("rsiClearObject  %p,%p", vdst, *vdst);
+    //ALOGE("rsiClearObject  %p,%p", vdst, *vdst);
     if (dst[0]) {
         CHECK_OBJ(dst[0]);
         dst[0]->decSysRef();
@@ -142,12 +142,12 @@
 
 
 uint32_t rsrToClient(Context *rsc, Script *sc, int cmdID, void *data, int len) {
-    //LOGE("SC_toClient %i %i %i", cmdID, len);
+    //ALOGE("SC_toClient %i %i %i", cmdID, len);
     return rsc->sendMessageToClient(data, RS_MESSAGE_TO_CLIENT_USER, cmdID, len, false);
 }
 
 uint32_t rsrToClientBlocking(Context *rsc, Script *sc, int cmdID, void *data, int len) {
-    //LOGE("SC_toClientBlocking %i %i", cmdID, len);
+    //ALOGE("SC_toClientBlocking %i %i", cmdID, len);
     return rsc->sendMessageToClient(data, RS_MESSAGE_TO_CLIENT_USER, cmdID, len, true);
 }
 
diff --git a/libs/rs/rsScriptC_LibGL.cpp b/libs/rs/rsScriptC_LibGL.cpp
index 7862f3c..a7ba7d2 100644
--- a/libs/rs/rsScriptC_LibGL.cpp
+++ b/libs/rs/rsScriptC_LibGL.cpp
@@ -142,11 +142,11 @@
         return;
     }
 
-    //LOGE("Quad");
-    //LOGE("%4.2f, %4.2f, %4.2f", x1, y1, z1);
-    //LOGE("%4.2f, %4.2f, %4.2f", x2, y2, z2);
-    //LOGE("%4.2f, %4.2f, %4.2f", x3, y3, z3);
-    //LOGE("%4.2f, %4.2f, %4.2f", x4, y4, z4);
+    //ALOGE("Quad");
+    //ALOGE("%4.2f, %4.2f, %4.2f", x1, y1, z1);
+    //ALOGE("%4.2f, %4.2f, %4.2f", x2, y2, z2);
+    //ALOGE("%4.2f, %4.2f, %4.2f", x3, y3, z3);
+    //ALOGE("%4.2f, %4.2f, %4.2f", x4, y4, z4);
 
     float vtx[] = {x1,y1,z1, x2,y2,z2, x3,y3,z3, x4,y4,z4};
     const float tex[] = {u1,v1, u2,v2, u3,v3, u4,v4};
@@ -191,7 +191,7 @@
 }
 
 void rsrDrawRect(Context *rsc, Script *sc, float x1, float y1, float x2, float y2, float z) {
-    //LOGE("SC_drawRect %f,%f  %f,%f  %f", x1, y1, x2, y2, z);
+    //ALOGE("SC_drawRect %f,%f  %f,%f  %f", x1, y1, x2, y2, z);
     rsrDrawQuad(rsc, sc, x1, y2, z, x2, y2, z, x2, y1, z, x1, y1, z);
 }
 
diff --git a/libs/rs/rsSignal.cpp b/libs/rs/rsSignal.cpp
index 413ac2b..3f6a13c 100644
--- a/libs/rs/rsSignal.cpp
+++ b/libs/rs/rsSignal.cpp
@@ -32,13 +32,13 @@
 bool Signal::init() {
     int status = pthread_mutex_init(&mMutex, NULL);
     if (status) {
-        LOGE("LocklessFifo mutex init failure");
+        ALOGE("LocklessFifo mutex init failure");
         return false;
     }
 
     status = pthread_cond_init(&mCondition, NULL);
     if (status) {
-        LOGE("LocklessFifo condition init failure");
+        ALOGE("LocklessFifo condition init failure");
         pthread_mutex_destroy(&mMutex);
         return false;
     }
@@ -51,7 +51,7 @@
 
     status = pthread_mutex_lock(&mMutex);
     if (status) {
-        LOGE("LocklessCommandFifo: error %i locking for set condition.", status);
+        ALOGE("LocklessCommandFifo: error %i locking for set condition.", status);
         return;
     }
 
@@ -59,12 +59,12 @@
 
     status = pthread_cond_signal(&mCondition);
     if (status) {
-        LOGE("LocklessCommandFifo: error %i on set condition.", status);
+        ALOGE("LocklessCommandFifo: error %i on set condition.", status);
     }
 
     status = pthread_mutex_unlock(&mMutex);
     if (status) {
-        LOGE("LocklessCommandFifo: error %i unlocking for set condition.", status);
+        ALOGE("LocklessCommandFifo: error %i unlocking for set condition.", status);
     }
 }
 
@@ -74,7 +74,7 @@
 
     status = pthread_mutex_lock(&mMutex);
     if (status) {
-        LOGE("LocklessCommandFifo: error %i locking for condition.", status);
+        ALOGE("LocklessCommandFifo: error %i locking for condition.", status);
         return false;
     }
 
@@ -96,13 +96,13 @@
         ret = true;
     } else {
         if (status != ETIMEDOUT) {
-            LOGE("LocklessCommandFifo: error %i waiting for condition.", status);
+            ALOGE("LocklessCommandFifo: error %i waiting for condition.", status);
         }
     }
 
     status = pthread_mutex_unlock(&mMutex);
     if (status) {
-        LOGE("LocklessCommandFifo: error %i unlocking for condition.", status);
+        ALOGE("LocklessCommandFifo: error %i unlocking for condition.", status);
     }
 
     return ret;
diff --git a/libs/rs/rsThreadIO.cpp b/libs/rs/rsThreadIO.cpp
index b1a579a..8ba1a0e 100644
--- a/libs/rs/rsThreadIO.cpp
+++ b/libs/rs/rsThreadIO.cpp
@@ -40,22 +40,22 @@
 }
 
 void ThreadIO::shutdown() {
-    //LOGE("shutdown 1");
+    //ALOGE("shutdown 1");
     mToCore.shutdown();
-    //LOGE("shutdown 2");
+    //ALOGE("shutdown 2");
 }
 
 void ThreadIO::coreFlush() {
-    //LOGE("coreFlush 1");
+    //ALOGE("coreFlush 1");
     if (mUsingSocket) {
     } else {
         mToCore.flush();
     }
-    //LOGE("coreFlush 2");
+    //ALOGE("coreFlush 2");
 }
 
 void * ThreadIO::coreHeader(uint32_t cmdID, size_t dataLen) {
-    //LOGE("coreHeader %i %i", cmdID, dataLen);
+    //ALOGE("coreHeader %i %i", cmdID, dataLen);
     if (mUsingSocket) {
         CoreCmdHeader hdr;
         hdr.bytes = dataLen;
@@ -67,40 +67,40 @@
         mCoreDataPtr = (uint8_t *)mToCore.reserve(dataLen);
         mCoreDataBasePtr = mCoreDataPtr;
     }
-    //LOGE("coreHeader ret %p", mCoreDataPtr);
+    //ALOGE("coreHeader ret %p", mCoreDataPtr);
     return mCoreDataPtr;
 }
 
 void ThreadIO::coreData(const void *data, size_t dataLen) {
-    //LOGE("coreData %p %i", data, dataLen);
+    //ALOGE("coreData %p %i", data, dataLen);
     mToCoreSocket.writeAsync(data, dataLen);
-    //LOGE("coreData ret %p", mCoreDataPtr);
+    //ALOGE("coreData ret %p", mCoreDataPtr);
 }
 
 void ThreadIO::coreCommit() {
-    //LOGE("coreCommit %p %p %i", mCoreDataPtr, mCoreDataBasePtr, mCoreCommandSize);
+    //ALOGE("coreCommit %p %p %i", mCoreDataPtr, mCoreDataBasePtr, mCoreCommandSize);
     if (mUsingSocket) {
     } else {
         rsAssert((size_t)(mCoreDataPtr - mCoreDataBasePtr) <= mCoreCommandSize);
         mToCore.commit(mCoreCommandID, mCoreCommandSize);
     }
-    //LOGE("coreCommit ret");
+    //ALOGE("coreCommit ret");
 }
 
 void ThreadIO::coreCommitSync() {
-    //LOGE("coreCommitSync %p %p %i", mCoreDataPtr, mCoreDataBasePtr, mCoreCommandSize);
+    //ALOGE("coreCommitSync %p %p %i", mCoreDataPtr, mCoreDataBasePtr, mCoreCommandSize);
     if (mUsingSocket) {
     } else {
         rsAssert((size_t)(mCoreDataPtr - mCoreDataBasePtr) <= mCoreCommandSize);
         mToCore.commitSync(mCoreCommandID, mCoreCommandSize);
     }
-    //LOGE("coreCommitSync ret");
+    //ALOGE("coreCommitSync ret");
 }
 
 void ThreadIO::clientShutdown() {
-    //LOGE("coreShutdown 1");
+    //ALOGE("coreShutdown 1");
     mToClient.shutdown();
-    //LOGE("coreShutdown 2");
+    //ALOGE("coreShutdown 2");
 }
 
 void ThreadIO::coreSetReturn(const void *data, size_t dataLen) {
@@ -145,11 +145,11 @@
             con->timerSet(Context::RS_TIMER_INTERNAL);
         }
         waitForCommand = false;
-        //LOGV("playCoreCommands 3 %i %i", cmdID, cmdSize);
+        //ALOGV("playCoreCommands 3 %i %i", cmdID, cmdSize);
 
         if (cmdID >= (sizeof(gPlaybackFuncs) / sizeof(void *))) {
             rsAssert(cmdID < (sizeof(gPlaybackFuncs) / sizeof(void *)));
-            LOGE("playCoreCommands error con %p, cmd %i", con, cmdID);
+            ALOGE("playCoreCommands error con %p, cmd %i", con, cmdID);
             mToCore.printDebugData();
         }
         gPlaybackFuncs[cmdID](con, data, cmdSize << 2);
@@ -193,8 +193,8 @@
         uint32_t bytesData = 0;
         uint32_t commandID = 0;
         const uint32_t *d = (const uint32_t *)mToClient.get(&commandID, &bytesData);
-        //LOGE("getMessageToClient 3    %i  %i", commandID, bytesData);
-        //LOGE("getMessageToClient  %i %i", commandID, *subID);
+        //ALOGE("getMessageToClient 3    %i  %i", commandID, bytesData);
+        //ALOGE("getMessageToClient  %i %i", commandID, *subID);
         if (bufferLen >= receiveLen[0]) {
             memcpy(data, d+1, receiveLen[0]);
             mToClient.next();
@@ -224,14 +224,14 @@
             }
         }
 
-        //LOGE("sendMessageToClient 2");
+        //ALOGE("sendMessageToClient 2");
         uint32_t *p = (uint32_t *)mToClient.reserve(dataLen + sizeof(usrID));
         p[0] = usrID;
         if (dataLen > 0) {
             memcpy(p+1, data, dataLen);
         }
         mToClient.commit(cmdID, dataLen + sizeof(usrID));
-        //LOGE("sendMessageToClient 3");
+        //ALOGE("sendMessageToClient 3");
         return true;
     }
     return false;
diff --git a/libs/rs/rsType.cpp b/libs/rs/rsType.cpp
index 9a6a31b..7966470 100644
--- a/libs/rs/rsType.cpp
+++ b/libs/rs/rsType.cpp
@@ -141,7 +141,7 @@
 void Type::dumpLOGV(const char *prefix) const {
     char buf[1024];
     ObjectBase::dumpLOGV(prefix);
-    LOGV("%s   Type: x=%zu y=%zu z=%zu mip=%i face=%i", prefix, mDimX, mDimY, mDimZ, mDimLOD, mFaces);
+    ALOGV("%s   Type: x=%zu y=%zu z=%zu mip=%i face=%i", prefix, mDimX, mDimY, mDimZ, mDimLOD, mFaces);
     snprintf(buf, sizeof(buf), "%s element: ", prefix);
     mElement->dumpLOGV(buf);
 }
@@ -167,7 +167,7 @@
     // First make sure we are reading the correct object
     RsA3DClassID classID = (RsA3DClassID)stream->loadU32();
     if (classID != RS_A3D_CLASS_ID_TYPE) {
-        LOGE("type loading skipped due to invalid class id\n");
+        ALOGE("type loading skipped due to invalid class id\n");
         return NULL;
     }
 
diff --git a/libs/rs/rsUtils.h b/libs/rs/rsUtils.h
index 3a6c85a..db6f592 100644
--- a/libs/rs/rsUtils.h
+++ b/libs/rs/rsUtils.h
@@ -40,7 +40,7 @@
 namespace renderscript {
 
 #if 1
-#define rsAssert(v) do {if(!(v)) LOGE("rsAssert failed: %s, in %s at %i", #v, __FILE__, __LINE__);} while (0)
+#define rsAssert(v) do {if(!(v)) ALOGE("rsAssert failed: %s, in %s at %i", #v, __FILE__, __LINE__);} while (0)
 #else
 #define rsAssert(v) while (0)
 #endif
diff --git a/libs/rs/rsg_generator.c b/libs/rs/rsg_generator.c
index b3f6c55..6b84e56 100644
--- a/libs/rs/rsg_generator.c
+++ b/libs/rs/rsg_generator.c
@@ -235,7 +235,7 @@
                 }
             }
 
-            //fprintf(f, "    LOGE(\"add command %s\\n\");\n", api->name);
+            //fprintf(f, "    ALOGE(\"add command %s\\n\");\n", api->name);
             if (hasInlineDataPointers(api)) {
                 fprintf(f, "    RS_CMD_%s *cmd = NULL;\n", api->name);
                 fprintf(f, "    if (dataSize < 1024) {;\n");
@@ -441,7 +441,7 @@
 
         fprintf(f, "void rsp_%s(Context *con, const void *vp, size_t cmdSizeBytes) {\n", api->name);
 
-        //fprintf(f, "    LOGE(\"play command %s\\n\");\n", api->name);
+        //fprintf(f, "    ALOGE(\"play command %s\\n\");\n", api->name);
         fprintf(f, "    const RS_CMD_%s *cmd = static_cast<const RS_CMD_%s *>(vp);\n", api->name, api->name);
 
         fprintf(f, "    ");
@@ -469,7 +469,7 @@
 
         fprintf(f, "void rspr_%s(Context *con, Fifo *f, uint8_t *scratch, size_t scratchSize) {\n", api->name);
 
-        //fprintf(f, "    LOGE(\"play command %s\\n\");\n", api->name);
+        //fprintf(f, "    ALOGE(\"play command %s\\n\");\n", api->name);
         fprintf(f, "    RS_CMD_%s cmd;\n", api->name);
         fprintf(f, "    f->read(&cmd, sizeof(cmd));\n");
 
diff --git a/libs/storage/IMountService.cpp b/libs/storage/IMountService.cpp
index 8ddbeae..4ec8b25 100644
--- a/libs/storage/IMountService.cpp
+++ b/libs/storage/IMountService.cpp
@@ -66,12 +66,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeStrongBinder(listener->asBinder());
         if (remote()->transact(TRANSACTION_registerListener, data, &reply) != NO_ERROR) {
-            LOGD("registerListener could not contact remote\n");
+            ALOGD("registerListener could not contact remote\n");
             return;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("registerListener caught exception %d\n", err);
+            ALOGD("registerListener caught exception %d\n", err);
             return;
         }
     }
@@ -82,12 +82,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeStrongBinder(listener->asBinder());
         if (remote()->transact(TRANSACTION_unregisterListener, data, &reply) != NO_ERROR) {
-            LOGD("unregisterListener could not contact remote\n");
+            ALOGD("unregisterListener could not contact remote\n");
             return;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("unregisterListener caught exception %d\n", err);
+            ALOGD("unregisterListener caught exception %d\n", err);
             return;
         }
     }
@@ -97,12 +97,12 @@
         Parcel data, reply;
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         if (remote()->transact(TRANSACTION_isUsbMassStorageConnected, data, &reply) != NO_ERROR) {
-            LOGD("isUsbMassStorageConnected could not contact remote\n");
+            ALOGD("isUsbMassStorageConnected could not contact remote\n");
             return false;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("isUsbMassStorageConnected caught exception %d\n", err);
+            ALOGD("isUsbMassStorageConnected caught exception %d\n", err);
             return false;
         }
         return reply.readInt32() != 0;
@@ -114,12 +114,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeInt32(enable != 0);
         if (remote()->transact(TRANSACTION_setUsbMassStorageEnabled, data, &reply) != NO_ERROR) {
-            LOGD("setUsbMassStorageEnabled could not contact remote\n");
+            ALOGD("setUsbMassStorageEnabled could not contact remote\n");
             return;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("setUsbMassStorageEnabled caught exception %d\n", err);
+            ALOGD("setUsbMassStorageEnabled caught exception %d\n", err);
             return;
         }
     }
@@ -129,12 +129,12 @@
         Parcel data, reply;
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         if (remote()->transact(TRANSACTION_isUsbMassStorageEnabled, data, &reply) != NO_ERROR) {
-            LOGD("isUsbMassStorageEnabled could not contact remote\n");
+            ALOGD("isUsbMassStorageEnabled could not contact remote\n");
             return false;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("isUsbMassStorageEnabled caught exception %d\n", err);
+            ALOGD("isUsbMassStorageEnabled caught exception %d\n", err);
             return false;
         }
         return reply.readInt32() != 0;
@@ -146,12 +146,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeString16(mountPoint);
         if (remote()->transact(TRANSACTION_mountVolume, data, &reply) != NO_ERROR) {
-            LOGD("mountVolume could not contact remote\n");
+            ALOGD("mountVolume could not contact remote\n");
             return -1;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("mountVolume caught exception %d\n", err);
+            ALOGD("mountVolume caught exception %d\n", err);
             return err;
         }
         return reply.readInt32();
@@ -165,12 +165,12 @@
         data.writeInt32(force ? 1 : 0);
         data.writeInt32(removeEncryption ? 1 : 0);
         if (remote()->transact(TRANSACTION_unmountVolume, data, &reply) != NO_ERROR) {
-            LOGD("unmountVolume could not contact remote\n");
+            ALOGD("unmountVolume could not contact remote\n");
             return -1;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("unmountVolume caught exception %d\n", err);
+            ALOGD("unmountVolume caught exception %d\n", err);
             return err;
         }
         return reply.readInt32();
@@ -182,12 +182,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeString16(mountPoint);
         if (remote()->transact(TRANSACTION_formatVolume, data, &reply) != NO_ERROR) {
-            LOGD("formatVolume could not contact remote\n");
+            ALOGD("formatVolume could not contact remote\n");
             return -1;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("formatVolume caught exception %d\n", err);
+            ALOGD("formatVolume caught exception %d\n", err);
             return err;
         }
         return reply.readInt32();
@@ -199,12 +199,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeString16(mountPoint);
         if (remote()->transact(TRANSACTION_getStorageUsers, data, &reply) != NO_ERROR) {
-            LOGD("getStorageUsers could not contact remote\n");
+            ALOGD("getStorageUsers could not contact remote\n");
             return -1;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("getStorageUsers caught exception %d\n", err);
+            ALOGD("getStorageUsers caught exception %d\n", err);
             return err;
         }
         const int32_t numUsers = reply.readInt32();
@@ -221,12 +221,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeString16(mountPoint);
         if (remote()->transact(TRANSACTION_getVolumeState, data, &reply) != NO_ERROR) {
-            LOGD("getVolumeState could not contact remote\n");
+            ALOGD("getVolumeState could not contact remote\n");
             return -1;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("getVolumeState caught exception %d\n", err);
+            ALOGD("getVolumeState caught exception %d\n", err);
             return err;
         }
         return reply.readInt32();
@@ -243,12 +243,12 @@
         data.writeString16(key);
         data.writeInt32(ownerUid);
         if (remote()->transact(TRANSACTION_createSecureContainer, data, &reply) != NO_ERROR) {
-            LOGD("createSecureContainer could not contact remote\n");
+            ALOGD("createSecureContainer could not contact remote\n");
             return -1;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("createSecureContainer caught exception %d\n", err);
+            ALOGD("createSecureContainer caught exception %d\n", err);
             return err;
         }
         return reply.readInt32();
@@ -260,12 +260,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeString16(id);
         if (remote()->transact(TRANSACTION_finalizeSecureContainer, data, &reply) != NO_ERROR) {
-            LOGD("finalizeSecureContainer couldn't call remote\n");
+            ALOGD("finalizeSecureContainer couldn't call remote\n");
             return -1;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("finalizeSecureContainer caught exception %d\n", err);
+            ALOGD("finalizeSecureContainer caught exception %d\n", err);
             return err;
         }
         return reply.readInt32();
@@ -277,12 +277,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeString16(id);
         if (remote()->transact(TRANSACTION_destroySecureContainer, data, &reply) != NO_ERROR) {
-            LOGD("destroySecureContainer couldn't call remote");
+            ALOGD("destroySecureContainer couldn't call remote");
             return -1;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("destroySecureContainer caught exception %d\n", err);
+            ALOGD("destroySecureContainer caught exception %d\n", err);
             return err;
         }
         return reply.readInt32();
@@ -296,12 +296,12 @@
         data.writeString16(key);
         data.writeInt32(ownerUid);
         if (remote()->transact(TRANSACTION_mountSecureContainer, data, &reply) != NO_ERROR) {
-            LOGD("mountSecureContainer couldn't call remote");
+            ALOGD("mountSecureContainer couldn't call remote");
             return -1;
         }
         int32_t err = reply.readExceptionCode(); // What to do...
         if (err < 0) {
-            LOGD("mountSecureContainer caught exception %d\n", err);
+            ALOGD("mountSecureContainer caught exception %d\n", err);
             return err;
         }
         return reply.readInt32();
@@ -314,12 +314,12 @@
         data.writeString16(id);
         data.writeInt32(force ? 1 : 0);
         if (remote()->transact(TRANSACTION_getSecureContainerPath, data, &reply) != NO_ERROR) {
-            LOGD("unmountSecureContainer couldn't call remote");
+            ALOGD("unmountSecureContainer couldn't call remote");
             return -1;
         }
         int32_t err = reply.readExceptionCode(); // What to do...
         if (err < 0) {
-            LOGD("unmountSecureContainer caught exception %d\n", err);
+            ALOGD("unmountSecureContainer caught exception %d\n", err);
             return err;
         }
         return reply.readInt32();
@@ -331,12 +331,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeString16(id);
         if (remote()->transact(TRANSACTION_isSecureContainerMounted, data, &reply) != NO_ERROR) {
-            LOGD("isSecureContainerMounted couldn't call remote");
+            ALOGD("isSecureContainerMounted couldn't call remote");
             return false;
         }
         int32_t err = reply.readExceptionCode(); // What to do...
         if (err < 0) {
-            LOGD("isSecureContainerMounted caught exception %d\n", err);
+            ALOGD("isSecureContainerMounted caught exception %d\n", err);
             return false;
         }
         return reply.readInt32() != 0;
@@ -349,12 +349,12 @@
         data.writeString16(oldId);
         data.writeString16(newId);
         if (remote()->transact(TRANSACTION_renameSecureContainer, data, &reply) != NO_ERROR) {
-            LOGD("renameSecureContainer couldn't call remote");
+            ALOGD("renameSecureContainer couldn't call remote");
             return -1;
         }
         int32_t err = reply.readExceptionCode(); // What to do...
         if (err < 0) {
-            LOGD("renameSecureContainer caught exception %d\n", err);
+            ALOGD("renameSecureContainer caught exception %d\n", err);
             return err;
         }
         return reply.readInt32();
@@ -366,12 +366,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeString16(id);
         if (remote()->transact(TRANSACTION_getSecureContainerPath, data, &reply) != NO_ERROR) {
-            LOGD("getSecureContainerPath couldn't call remote");
+            ALOGD("getSecureContainerPath couldn't call remote");
             return false;
         }
         int32_t err = reply.readExceptionCode(); // What to do...
         if (err < 0) {
-            LOGD("getSecureContainerPath caught exception %d\n", err);
+            ALOGD("getSecureContainerPath caught exception %d\n", err);
             return false;
         }
         path = reply.readString16();
@@ -384,12 +384,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeString16(id);
         if (remote()->transact(TRANSACTION_getSecureContainerList, data, &reply) != NO_ERROR) {
-            LOGD("getSecureContainerList couldn't call remote");
+            ALOGD("getSecureContainerList couldn't call remote");
             return -1;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("getSecureContainerList caught exception %d\n", err);
+            ALOGD("getSecureContainerList caught exception %d\n", err);
             return err;
         }
         const int32_t numStrings = reply.readInt32();
@@ -406,12 +406,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeStrongBinder(observer->asBinder());
         if (remote()->transact(TRANSACTION_shutdown, data, &reply) != NO_ERROR) {
-            LOGD("shutdown could not contact remote\n");
+            ALOGD("shutdown could not contact remote\n");
             return;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("shutdown caught exception %d\n", err);
+            ALOGD("shutdown caught exception %d\n", err);
             return;
         }
         reply.readExceptionCode();
@@ -422,12 +422,12 @@
         Parcel data, reply;
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         if (remote()->transact(TRANSACTION_finishMediaUpdate, data, &reply) != NO_ERROR) {
-            LOGD("finishMediaUpdate could not contact remote\n");
+            ALOGD("finishMediaUpdate could not contact remote\n");
             return;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("finishMediaUpdate caught exception %d\n", err);
+            ALOGD("finishMediaUpdate caught exception %d\n", err);
             return;
         }
         reply.readExceptionCode();
@@ -443,12 +443,12 @@
         data.writeStrongBinder(token->asBinder());
         data.writeInt32(nonce);
         if (remote()->transact(TRANSACTION_mountObb, data, &reply) != NO_ERROR) {
-            LOGD("mountObb could not contact remote\n");
+            ALOGD("mountObb could not contact remote\n");
             return;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("mountObb caught exception %d\n", err);
+            ALOGD("mountObb caught exception %d\n", err);
             return;
         }
     }
@@ -463,12 +463,12 @@
         data.writeStrongBinder(token->asBinder());
         data.writeInt32(nonce);
         if (remote()->transact(TRANSACTION_unmountObb, data, &reply) != NO_ERROR) {
-            LOGD("unmountObb could not contact remote\n");
+            ALOGD("unmountObb could not contact remote\n");
             return;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("unmountObb caught exception %d\n", err);
+            ALOGD("unmountObb caught exception %d\n", err);
             return;
         }
     }
@@ -479,12 +479,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeString16(filename);
         if (remote()->transact(TRANSACTION_isObbMounted, data, &reply) != NO_ERROR) {
-            LOGD("isObbMounted could not contact remote\n");
+            ALOGD("isObbMounted could not contact remote\n");
             return false;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("isObbMounted caught exception %d\n", err);
+            ALOGD("isObbMounted caught exception %d\n", err);
             return false;
         }
         return reply.readInt32() != 0;
@@ -496,12 +496,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeString16(filename);
         if (remote()->transact(TRANSACTION_getMountedObbPath, data, &reply) != NO_ERROR) {
-            LOGD("getMountedObbPath could not contact remote\n");
+            ALOGD("getMountedObbPath could not contact remote\n");
             return false;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("getMountedObbPath caught exception %d\n", err);
+            ALOGD("getMountedObbPath caught exception %d\n", err);
             return false;
         }
         path = reply.readString16();
@@ -514,12 +514,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeString16(password);
         if (remote()->transact(TRANSACTION_decryptStorage, data, &reply) != NO_ERROR) {
-            LOGD("decryptStorage could not contact remote\n");
+            ALOGD("decryptStorage could not contact remote\n");
             return -1;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("decryptStorage caught exception %d\n", err);
+            ALOGD("decryptStorage caught exception %d\n", err);
             return err;
         }
         return reply.readInt32();
@@ -531,12 +531,12 @@
         data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
         data.writeString16(password);
         if (remote()->transact(TRANSACTION_encryptStorage, data, &reply) != NO_ERROR) {
-            LOGD("encryptStorage could not contact remote\n");
+            ALOGD("encryptStorage could not contact remote\n");
             return -1;
         }
         int32_t err = reply.readExceptionCode();
         if (err < 0) {
-            LOGD("encryptStorage caught exception %d\n", err);
+            ALOGD("encryptStorage caught exception %d\n", err);
             return err;
         }
         return reply.readInt32();
diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp
index 8949730..f5ed981 100644
--- a/libs/ui/FramebufferNativeWindow.cpp
+++ b/libs/ui/FramebufferNativeWindow.cpp
@@ -85,10 +85,10 @@
         int err;
         int i;
         err = framebuffer_open(module, &fbDev);
-        LOGE_IF(err, "couldn't open framebuffer HAL (%s)", strerror(-err));
+        ALOGE_IF(err, "couldn't open framebuffer HAL (%s)", strerror(-err));
         
         err = gralloc_open(module, &grDev);
-        LOGE_IF(err, "couldn't open gralloc HAL (%s)", strerror(-err));
+        ALOGE_IF(err, "couldn't open gralloc HAL (%s)", strerror(-err));
 
         // bail out if we can't initialize the modules
         if (!fbDev || !grDev)
@@ -113,7 +113,7 @@
                         fbDev->width, fbDev->height, fbDev->format,
                         GRALLOC_USAGE_HW_FB, &buffers[i]->handle, &buffers[i]->stride);
 
-                LOGE_IF(err, "fb buffer %d allocation failed w=%d, h=%d, err=%s",
+                ALOGE_IF(err, "fb buffer %d allocation failed w=%d, h=%d, err=%s",
                         i, fbDev->width, fbDev->height, strerror(-err));
 
                 if (err)
@@ -133,7 +133,7 @@
         const_cast<int&>(ANativeWindow::maxSwapInterval) = 
             fbDev->maxSwapInterval;
     } else {
-        LOGE("Couldn't get gralloc module");
+        ALOGE("Couldn't get gralloc module");
     }
 
     ANativeWindow::setSwapInterval = setSwapInterval;
diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp
index 54a3ffa..f549a37 100644
--- a/libs/ui/GraphicBuffer.cpp
+++ b/libs/ui/GraphicBuffer.cpp
@@ -167,7 +167,7 @@
 {
     if (rect.left < 0 || rect.right  > this->width || 
         rect.top  < 0 || rect.bottom > this->height) {
-        LOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)",
+        ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)",
                 rect.left, rect.top, rect.right, rect.bottom, 
                 this->width, this->height);
         return BAD_VALUE;
diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp
index e75415b..d344737 100644
--- a/libs/ui/GraphicBufferAllocator.cpp
+++ b/libs/ui/GraphicBufferAllocator.cpp
@@ -38,7 +38,7 @@
 {
     hw_module_t const* module;
     int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
-    LOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID);
+    ALOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID);
     if (err == 0) {
         gralloc_open(module, &mAllocDev);
     }
@@ -85,7 +85,7 @@
 {
     String8 s;
     GraphicBufferAllocator::getInstance().dump(s);
-    LOGD("%s", s.string());
+    ALOGD("%s", s.string());
 }
 
 status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat format,
@@ -101,7 +101,7 @@
     
     err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride);
 
-    LOGW_IF(err, "alloc(%u, %u, %d, %08x, ...) failed %d (%s)",
+    ALOGW_IF(err, "alloc(%u, %u, %d, %08x, ...) failed %d (%s)",
             w, h, format, usage, err, strerror(-err));
     
     if (err == NO_ERROR) {
@@ -132,7 +132,7 @@
 
     err = mAllocDev->free(mAllocDev, handle);
 
-    LOGW_IF(err, "free(...) failed %d (%s)", err, strerror(-err));
+    ALOGW_IF(err, "free(...) failed %d (%s)", err, strerror(-err));
     if (err == NO_ERROR) {
         Mutex::Autolock _l(sLock);
         KeyedVector<buffer_handle_t, alloc_rec_t>& list(sAllocList);
diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp
index 07c0674..b173c85 100644
--- a/libs/ui/GraphicBufferMapper.cpp
+++ b/libs/ui/GraphicBufferMapper.cpp
@@ -38,7 +38,7 @@
 {
     hw_module_t const* module;
     int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
-    LOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID);
+    ALOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID);
     if (err == 0) {
         mAllocMod = (gralloc_module_t const *)module;
     }
@@ -50,7 +50,7 @@
 
     err = mAllocMod->registerBuffer(mAllocMod, handle);
 
-    LOGW_IF(err, "registerBuffer(%p) failed %d (%s)",
+    ALOGW_IF(err, "registerBuffer(%p) failed %d (%s)",
             handle, err, strerror(-err));
     return err;
 }
@@ -61,7 +61,7 @@
 
     err = mAllocMod->unregisterBuffer(mAllocMod, handle);
 
-    LOGW_IF(err, "unregisterBuffer(%p) failed %d (%s)",
+    ALOGW_IF(err, "unregisterBuffer(%p) failed %d (%s)",
             handle, err, strerror(-err));
     return err;
 }
@@ -75,7 +75,7 @@
             bounds.left, bounds.top, bounds.width(), bounds.height(),
             vaddr);
 
-    LOGW_IF(err, "lock(...) failed %d (%s)", err, strerror(-err));
+    ALOGW_IF(err, "lock(...) failed %d (%s)", err, strerror(-err));
     return err;
 }
 
@@ -85,7 +85,7 @@
 
     err = mAllocMod->unlock(mAllocMod, handle);
 
-    LOGW_IF(err, "unlock(...) failed %d (%s)", err, strerror(-err));
+    ALOGW_IF(err, "unlock(...) failed %d (%s)", err, strerror(-err));
     return err;
 }
 
diff --git a/libs/ui/Input.cpp b/libs/ui/Input.cpp
index 3de75ba..263c8d9 100644
--- a/libs/ui/Input.cpp
+++ b/libs/ui/Input.cpp
@@ -106,11 +106,11 @@
     path.append("/usr/");
     appendInputDeviceConfigurationFileRelativePath(path, name, type);
 #if DEBUG_PROBE
-    LOGD("Probing for system provided input device configuration file: path='%s'", path.string());
+    ALOGD("Probing for system provided input device configuration file: path='%s'", path.string());
 #endif
     if (!access(path.string(), R_OK)) {
 #if DEBUG_PROBE
-        LOGD("Found");
+        ALOGD("Found");
 #endif
         return path;
     }
@@ -121,18 +121,18 @@
     path.append("/system/devices/");
     appendInputDeviceConfigurationFileRelativePath(path, name, type);
 #if DEBUG_PROBE
-    LOGD("Probing for system user input device configuration file: path='%s'", path.string());
+    ALOGD("Probing for system user input device configuration file: path='%s'", path.string());
 #endif
     if (!access(path.string(), R_OK)) {
 #if DEBUG_PROBE
-        LOGD("Found");
+        ALOGD("Found");
 #endif
         return path;
     }
 
     // Not found.
 #if DEBUG_PROBE
-    LOGD("Probe failed to find input device configuration file: name='%s', type=%d",
+    ALOGD("Probe failed to find input device configuration file: name='%s', type=%d",
             name.string(), type);
 #endif
     return String8();
@@ -345,7 +345,7 @@
 #endif
 
 void PointerCoords::tooManyAxes(int axis) {
-    LOGW("Could not set value for axis %d because the PointerCoords structure is full and "
+    ALOGW("Could not set value for axis %d because the PointerCoords structure is full and "
             "cannot contain more than %d axis values.", axis, int(MAX_AXES));
 }
 
@@ -782,7 +782,7 @@
     }
 
 #if DEBUG_VELOCITY
-    LOGD("VelocityTracker: addMovement eventTime=%lld, idBits=0x%08x, activePointerId=%d",
+    ALOGD("VelocityTracker: addMovement eventTime=%lld, idBits=0x%08x, activePointerId=%d",
             eventTime, idBits.value, mActivePointerId);
     for (BitSet32 iterBits(idBits); !iterBits.isEmpty(); ) {
         uint32_t id = iterBits.firstMarkedBit();
@@ -790,7 +790,7 @@
         iterBits.clearBit(id);
         Estimator estimator;
         getEstimator(id, DEFAULT_DEGREE, DEFAULT_HORIZON, &estimator);
-        LOGD("  %d: position (%0.3f, %0.3f), "
+        ALOGD("  %d: position (%0.3f, %0.3f), "
                 "estimator (degree=%d, xCoeff=%s, yCoeff=%s, confidence=%f)",
                 id, positions[index].x, positions[index].y,
                 int(estimator.degree),
@@ -903,7 +903,7 @@
 static bool solveLeastSquares(const float* x, const float* y, uint32_t m, uint32_t n,
         float* outB, float* outDet) {
 #if DEBUG_LEAST_SQUARES
-    LOGD("solveLeastSquares: m=%d, n=%d, x=%s, y=%s", int(m), int(n),
+    ALOGD("solveLeastSquares: m=%d, n=%d, x=%s, y=%s", int(m), int(n),
             vectorToString(x, m).string(), vectorToString(y, m).string());
 #endif
 
@@ -916,7 +916,7 @@
         }
     }
 #if DEBUG_LEAST_SQUARES
-    LOGD("  - a=%s", matrixToString(&a[0][0], m, n, false /*rowMajor*/).string());
+    ALOGD("  - a=%s", matrixToString(&a[0][0], m, n, false /*rowMajor*/).string());
 #endif
 
     // Apply the Gram-Schmidt process to A to obtain its QR decomposition.
@@ -937,7 +937,7 @@
         if (norm < 0.000001f) {
             // vectors are linearly dependent or zero so no solution
 #if DEBUG_LEAST_SQUARES
-            LOGD("  - no solution, norm=%f", norm);
+            ALOGD("  - no solution, norm=%f", norm);
 #endif
             return false;
         }
@@ -951,8 +951,8 @@
         }
     }
 #if DEBUG_LEAST_SQUARES
-    LOGD("  - q=%s", matrixToString(&q[0][0], m, n, false /*rowMajor*/).string());
-    LOGD("  - r=%s", matrixToString(&r[0][0], n, n, true /*rowMajor*/).string());
+    ALOGD("  - q=%s", matrixToString(&q[0][0], m, n, false /*rowMajor*/).string());
+    ALOGD("  - r=%s", matrixToString(&r[0][0], n, n, true /*rowMajor*/).string());
 
     // calculate QR, if we factored A correctly then QR should equal A
     float qr[n][m];
@@ -964,7 +964,7 @@
             }
         }
     }
-    LOGD("  - qr=%s", matrixToString(&qr[0][0], m, n, false /*rowMajor*/).string());
+    ALOGD("  - qr=%s", matrixToString(&qr[0][0], m, n, false /*rowMajor*/).string());
 #endif
 
     // Solve R B = Qt Y to find B.  This is easy because R is upper triangular.
@@ -977,7 +977,7 @@
         outB[i] /= r[i][i];
     }
 #if DEBUG_LEAST_SQUARES
-    LOGD("  - b=%s", vectorToString(outB, n).string());
+    ALOGD("  - b=%s", vectorToString(outB, n).string());
 #endif
 
     // Calculate the coefficient of determination as 1 - (SSerr / SStot) where
@@ -1004,9 +1004,9 @@
     }
     *outDet = sstot > 0.000001f ? 1.0f - (sserr / sstot) : 1;
 #if DEBUG_LEAST_SQUARES
-    LOGD("  - sserr=%f", sserr);
-    LOGD("  - sstot=%f", sstot);
-    LOGD("  - det=%f", *outDet);
+    ALOGD("  - sserr=%f", sserr);
+    ALOGD("  - sstot=%f", sstot);
+    ALOGD("  - det=%f", *outDet);
 #endif
     return true;
 }
@@ -1073,7 +1073,7 @@
             outEstimator->degree = degree;
             outEstimator->confidence = xdet * ydet;
 #if DEBUG_LEAST_SQUARES
-            LOGD("estimate: degree=%d, xCoeff=%s, yCoeff=%s, confidence=%f",
+            ALOGD("estimate: degree=%d, xCoeff=%s, yCoeff=%s, confidence=%f",
                     int(outEstimator->degree),
                     vectorToString(outEstimator->xCoeff, n).string(),
                     vectorToString(outEstimator->yCoeff, n).string(),
@@ -1116,7 +1116,7 @@
     if ((deltaX && *deltaX) || (deltaY && *deltaY)) {
         if (eventTime >= mLastMovementTime + STOP_TIME) {
 #if DEBUG_ACCELERATION
-            LOGD("VelocityControl: stopped, last movement was %0.3fms ago",
+            ALOGD("VelocityControl: stopped, last movement was %0.3fms ago",
                     (eventTime - mLastMovementTime) * 0.000001f);
 #endif
             reset();
@@ -1147,7 +1147,7 @@
             }
 
 #if DEBUG_ACCELERATION
-            LOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): "
+            ALOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): "
                     "vx=%0.3f, vy=%0.3f, speed=%0.3f, accel=%0.3f",
                     mParameters.scale, mParameters.lowThreshold, mParameters.highThreshold,
                     mParameters.acceleration,
@@ -1155,7 +1155,7 @@
 #endif
         } else {
 #if DEBUG_ACCELERATION
-            LOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): unknown velocity",
+            ALOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): unknown velocity",
                     mParameters.scale, mParameters.lowThreshold, mParameters.highThreshold,
                     mParameters.acceleration);
 #endif
diff --git a/libs/ui/InputTransport.cpp b/libs/ui/InputTransport.cpp
index 1e602e9..09cbb31 100644
--- a/libs/ui/InputTransport.cpp
+++ b/libs/ui/InputTransport.cpp
@@ -55,7 +55,7 @@
         int32_t sendPipeFd) :
         mName(name), mAshmemFd(ashmemFd), mReceivePipeFd(receivePipeFd), mSendPipeFd(sendPipeFd) {
 #if DEBUG_CHANNEL_LIFECYCLE
-    LOGD("Input channel constructed: name='%s', ashmemFd=%d, receivePipeFd=%d, sendPipeFd=%d",
+    ALOGD("Input channel constructed: name='%s', ashmemFd=%d, receivePipeFd=%d, sendPipeFd=%d",
             mName.string(), ashmemFd, receivePipeFd, sendPipeFd);
 #endif
 
@@ -70,7 +70,7 @@
 
 InputChannel::~InputChannel() {
 #if DEBUG_CHANNEL_LIFECYCLE
-    LOGD("Input channel destroyed: name='%s', ashmemFd=%d, receivePipeFd=%d, sendPipeFd=%d",
+    ALOGD("Input channel destroyed: name='%s', ashmemFd=%d, receivePipeFd=%d, sendPipeFd=%d",
             mName.string(), mAshmemFd, mReceivePipeFd, mSendPipeFd);
 #endif
 
@@ -88,12 +88,12 @@
     int serverAshmemFd = ashmem_create_region(ashmemName.string(), DEFAULT_MESSAGE_BUFFER_SIZE);
     if (serverAshmemFd < 0) {
         result = -errno;
-        LOGE("channel '%s' ~ Could not create shared memory region. errno=%d",
+        ALOGE("channel '%s' ~ Could not create shared memory region. errno=%d",
                 name.string(), errno);
     } else {
         result = ashmem_set_prot_region(serverAshmemFd, PROT_READ | PROT_WRITE);
         if (result < 0) {
-            LOGE("channel '%s' ~ Error %d trying to set protection of ashmem fd %d.",
+            ALOGE("channel '%s' ~ Error %d trying to set protection of ashmem fd %d.",
                     name.string(), result, serverAshmemFd);
         } else {
             // Dup the file descriptor because the server and client input channel objects that
@@ -102,19 +102,19 @@
             clientAshmemFd = dup(serverAshmemFd);
             if (clientAshmemFd < 0) {
                 result = -errno;
-                LOGE("channel '%s' ~ Could not dup() shared memory region fd. errno=%d",
+                ALOGE("channel '%s' ~ Could not dup() shared memory region fd. errno=%d",
                         name.string(), errno);
             } else {
                 int forward[2];
                 if (pipe(forward)) {
                     result = -errno;
-                    LOGE("channel '%s' ~ Could not create forward pipe.  errno=%d",
+                    ALOGE("channel '%s' ~ Could not create forward pipe.  errno=%d",
                             name.string(), errno);
                 } else {
                     int reverse[2];
                     if (pipe(reverse)) {
                         result = -errno;
-                        LOGE("channel '%s' ~ Could not create reverse pipe.  errno=%d",
+                        ALOGE("channel '%s' ~ Could not create reverse pipe.  errno=%d",
                                 name.string(), errno);
                     } else {
                         String8 serverChannelName = name;
@@ -150,13 +150,13 @@
 
     if (nWrite == 1) {
 #if DEBUG_CHANNEL_SIGNALS
-        LOGD("channel '%s' ~ sent signal '%c'", mName.string(), signal);
+        ALOGD("channel '%s' ~ sent signal '%c'", mName.string(), signal);
 #endif
         return OK;
     }
 
 #if DEBUG_CHANNEL_SIGNALS
-    LOGD("channel '%s' ~ error sending signal '%c', errno=%d", mName.string(), signal, errno);
+    ALOGD("channel '%s' ~ error sending signal '%c', errno=%d", mName.string(), signal, errno);
 #endif
     return -errno;
 }
@@ -169,27 +169,27 @@
 
     if (nRead == 1) {
 #if DEBUG_CHANNEL_SIGNALS
-        LOGD("channel '%s' ~ received signal '%c'", mName.string(), *outSignal);
+        ALOGD("channel '%s' ~ received signal '%c'", mName.string(), *outSignal);
 #endif
         return OK;
     }
 
     if (nRead == 0) { // check for EOF
 #if DEBUG_CHANNEL_SIGNALS
-        LOGD("channel '%s' ~ receive signal failed because peer was closed", mName.string());
+        ALOGD("channel '%s' ~ receive signal failed because peer was closed", mName.string());
 #endif
         return DEAD_OBJECT;
     }
 
     if (errno == EAGAIN) {
 #if DEBUG_CHANNEL_SIGNALS
-        LOGD("channel '%s' ~ receive signal failed because no signal available", mName.string());
+        ALOGD("channel '%s' ~ receive signal failed because no signal available", mName.string());
 #endif
         return WOULD_BLOCK;
     }
 
 #if DEBUG_CHANNEL_SIGNALS
-    LOGD("channel '%s' ~ receive signal failed, errno=%d", mName.string(), errno);
+    ALOGD("channel '%s' ~ receive signal failed, errno=%d", mName.string(), errno);
 #endif
     return -errno;
 }
@@ -213,14 +213,14 @@
 
 status_t InputPublisher::initialize() {
 #if DEBUG_TRANSPORT_ACTIONS
-    LOGD("channel '%s' publisher ~ initialize",
+    ALOGD("channel '%s' publisher ~ initialize",
             mChannel->getName().string());
 #endif
 
     int ashmemFd = mChannel->getAshmemFd();
     int result = ashmem_get_size_region(ashmemFd);
     if (result < 0) {
-        LOGE("channel '%s' publisher ~ Error %d getting size of ashmem fd %d.",
+        ALOGE("channel '%s' publisher ~ Error %d getting size of ashmem fd %d.",
                 mChannel->getName().string(), result, ashmemFd);
         return UNKNOWN_ERROR;
     }
@@ -229,7 +229,7 @@
     mSharedMessage = static_cast<InputMessage*>(mmap(NULL, mAshmemSize,
             PROT_READ | PROT_WRITE, MAP_SHARED, ashmemFd, 0));
     if (! mSharedMessage) {
-        LOGE("channel '%s' publisher ~ mmap failed on ashmem fd %d.",
+        ALOGE("channel '%s' publisher ~ mmap failed on ashmem fd %d.",
                 mChannel->getName().string(), ashmemFd);
         return NO_MEMORY;
     }
@@ -242,7 +242,7 @@
 
 status_t InputPublisher::reset() {
 #if DEBUG_TRANSPORT_ACTIONS
-    LOGD("channel '%s' publisher ~ reset",
+    ALOGD("channel '%s' publisher ~ reset",
         mChannel->getName().string());
 #endif
 
@@ -253,7 +253,7 @@
             if (mSharedMessage->consumed) {
                 result = sem_post(& mSharedMessage->semaphore);
                 if (result < 0) {
-                    LOGE("channel '%s' publisher ~ Error %d in sem_post.",
+                    ALOGE("channel '%s' publisher ~ Error %d in sem_post.",
                             mChannel->getName().string(), errno);
                     return UNKNOWN_ERROR;
                 }
@@ -261,7 +261,7 @@
 
             result = sem_destroy(& mSharedMessage->semaphore);
             if (result < 0) {
-                LOGE("channel '%s' publisher ~ Error %d in sem_destroy.",
+                ALOGE("channel '%s' publisher ~ Error %d in sem_destroy.",
                         mChannel->getName().string(), errno);
                 return UNKNOWN_ERROR;
             }
@@ -273,7 +273,7 @@
         int ashmemFd = mChannel->getAshmemFd();
         result = ashmem_unpin_region(ashmemFd, 0, 0);
         if (result < 0) {
-            LOGE("channel '%s' publisher ~ Error %d unpinning ashmem fd %d.",
+            ALOGE("channel '%s' publisher ~ Error %d unpinning ashmem fd %d.",
                     mChannel->getName().string(), result, ashmemFd);
             return UNKNOWN_ERROR;
         }
@@ -291,7 +291,7 @@
         int32_t deviceId,
         int32_t source) {
     if (mPinned) {
-        LOGE("channel '%s' publisher ~ Attempted to publish a new event but publisher has "
+        ALOGE("channel '%s' publisher ~ Attempted to publish a new event but publisher has "
                 "not yet been reset.", mChannel->getName().string());
         return INVALID_OPERATION;
     }
@@ -302,7 +302,7 @@
     int ashmemFd = mChannel->getAshmemFd();
     int result = ashmem_pin_region(ashmemFd, 0, 0);
     if (result < 0) {
-        LOGE("channel '%s' publisher ~ Error %d pinning ashmem fd %d.",
+        ALOGE("channel '%s' publisher ~ Error %d pinning ashmem fd %d.",
                 mChannel->getName().string(), result, ashmemFd);
         return UNKNOWN_ERROR;
     }
@@ -311,7 +311,7 @@
 
     result = sem_init(& mSharedMessage->semaphore, 1, 1);
     if (result < 0) {
-        LOGE("channel '%s' publisher ~ Error %d in sem_init.",
+        ALOGE("channel '%s' publisher ~ Error %d in sem_init.",
                 mChannel->getName().string(), errno);
         return UNKNOWN_ERROR;
     }
@@ -337,7 +337,7 @@
         nsecs_t downTime,
         nsecs_t eventTime) {
 #if DEBUG_TRANSPORT_ACTIONS
-    LOGD("channel '%s' publisher ~ publishKeyEvent: deviceId=%d, source=0x%x, "
+    ALOGD("channel '%s' publisher ~ publishKeyEvent: deviceId=%d, source=0x%x, "
             "action=0x%x, flags=0x%x, keyCode=%d, scanCode=%d, metaState=0x%x, repeatCount=%d,"
             "downTime=%lld, eventTime=%lld",
             mChannel->getName().string(),
@@ -379,7 +379,7 @@
         const PointerProperties* pointerProperties,
         const PointerCoords* pointerCoords) {
 #if DEBUG_TRANSPORT_ACTIONS
-    LOGD("channel '%s' publisher ~ publishMotionEvent: deviceId=%d, source=0x%x, "
+    ALOGD("channel '%s' publisher ~ publishMotionEvent: deviceId=%d, source=0x%x, "
             "action=0x%x, flags=0x%x, edgeFlags=0x%x, metaState=0x%x, buttonState=0x%x, "
             "xOffset=%f, yOffset=%f, "
             "xPrecision=%f, yPrecision=%f, downTime=%lld, eventTime=%lld, "
@@ -390,7 +390,7 @@
 #endif
 
     if (pointerCount > MAX_POINTERS || pointerCount < 1) {
-        LOGE("channel '%s' publisher ~ Invalid number of pointers provided: %d.",
+        ALOGE("channel '%s' publisher ~ Invalid number of pointers provided: %d.",
                 mChannel->getName().string(), pointerCount);
         return BAD_VALUE;
     }
@@ -439,12 +439,12 @@
         nsecs_t eventTime,
         const PointerCoords* pointerCoords) {
 #if DEBUG_TRANSPORT_ACTIONS
-    LOGD("channel '%s' publisher ~ appendMotionSample: eventTime=%lld",
+    ALOGD("channel '%s' publisher ~ appendMotionSample: eventTime=%lld",
             mChannel->getName().string(), eventTime);
 #endif
 
     if (! mPinned || ! mMotionEventSampleDataTail) {
-        LOGE("channel '%s' publisher ~ Cannot append motion sample because there is no current "
+        ALOGE("channel '%s' publisher ~ Cannot append motion sample because there is no current "
                 "AMOTION_EVENT_ACTION_MOVE or AMOTION_EVENT_ACTION_HOVER_MOVE event.",
                 mChannel->getName().string());
         return INVALID_OPERATION;
@@ -457,7 +457,7 @@
 
     if (newBytesUsed > mAshmemSize) {
 #if DEBUG_TRANSPORT_ACTIONS
-        LOGD("channel '%s' publisher ~ Cannot append motion sample because the shared memory "
+        ALOGD("channel '%s' publisher ~ Cannot append motion sample because the shared memory "
                 "buffer is full.  Buffer size: %d bytes, pointers: %d, samples: %d",
                 mChannel->getName().string(),
                 mAshmemSize, mMotionEventPointerCount, mSharedMessage->motion.sampleCount);
@@ -473,12 +473,12 @@
                 // Only possible source of contention is the consumer having consumed (or being in the
                 // process of consuming) the message and left the semaphore count at 0.
 #if DEBUG_TRANSPORT_ACTIONS
-                LOGD("channel '%s' publisher ~ Cannot append motion sample because the message has "
+                ALOGD("channel '%s' publisher ~ Cannot append motion sample because the message has "
                         "already been consumed.", mChannel->getName().string());
 #endif
                 return FAILED_TRANSACTION;
             } else {
-                LOGE("channel '%s' publisher ~ Error %d in sem_trywait.",
+                ALOGE("channel '%s' publisher ~ Error %d in sem_trywait.",
                         mChannel->getName().string(), errno);
                 return UNKNOWN_ERROR;
             }
@@ -496,7 +496,7 @@
     if (mWasDispatched) {
         result = sem_post(& mSharedMessage->semaphore);
         if (result < 0) {
-            LOGE("channel '%s' publisher ~ Error %d in sem_post.",
+            ALOGE("channel '%s' publisher ~ Error %d in sem_post.",
                     mChannel->getName().string(), errno);
             return UNKNOWN_ERROR;
         }
@@ -506,7 +506,7 @@
 
 status_t InputPublisher::sendDispatchSignal() {
 #if DEBUG_TRANSPORT_ACTIONS
-    LOGD("channel '%s' publisher ~ sendDispatchSignal",
+    ALOGD("channel '%s' publisher ~ sendDispatchSignal",
             mChannel->getName().string());
 #endif
 
@@ -516,7 +516,7 @@
 
 status_t InputPublisher::receiveFinishedSignal(bool* outHandled) {
 #if DEBUG_TRANSPORT_ACTIONS
-    LOGD("channel '%s' publisher ~ receiveFinishedSignal",
+    ALOGD("channel '%s' publisher ~ receiveFinishedSignal",
             mChannel->getName().string());
 #endif
 
@@ -531,7 +531,7 @@
     } else if (signal == INPUT_SIGNAL_FINISHED_UNHANDLED) {
         *outHandled = false;
     } else {
-        LOGE("channel '%s' publisher ~ Received unexpected signal '%c' from consumer",
+        ALOGE("channel '%s' publisher ~ Received unexpected signal '%c' from consumer",
                 mChannel->getName().string(), signal);
         return UNKNOWN_ERROR;
     }
@@ -552,14 +552,14 @@
 
 status_t InputConsumer::initialize() {
 #if DEBUG_TRANSPORT_ACTIONS
-    LOGD("channel '%s' consumer ~ initialize",
+    ALOGD("channel '%s' consumer ~ initialize",
             mChannel->getName().string());
 #endif
 
     int ashmemFd = mChannel->getAshmemFd();
     int result = ashmem_get_size_region(ashmemFd);
     if (result < 0) {
-        LOGE("channel '%s' consumer ~ Error %d getting size of ashmem fd %d.",
+        ALOGE("channel '%s' consumer ~ Error %d getting size of ashmem fd %d.",
                 mChannel->getName().string(), result, ashmemFd);
         return UNKNOWN_ERROR;
     }
@@ -569,7 +569,7 @@
     mSharedMessage = static_cast<InputMessage*>(mmap(NULL, mAshmemSize,
             PROT_READ | PROT_WRITE, MAP_SHARED, ashmemFd, 0));
     if (! mSharedMessage) {
-        LOGE("channel '%s' consumer ~ mmap failed on ashmem fd %d.",
+        ALOGE("channel '%s' consumer ~ mmap failed on ashmem fd %d.",
                 mChannel->getName().string(), ashmemFd);
         return NO_MEMORY;
     }
@@ -579,7 +579,7 @@
 
 status_t InputConsumer::consume(InputEventFactoryInterface* factory, InputEvent** outEvent) {
 #if DEBUG_TRANSPORT_ACTIONS
-    LOGD("channel '%s' consumer ~ consume",
+    ALOGD("channel '%s' consumer ~ consume",
             mChannel->getName().string());
 #endif
 
@@ -589,19 +589,19 @@
     int result = ashmem_pin_region(ashmemFd, 0, 0);
     if (result != ASHMEM_NOT_PURGED) {
         if (result == ASHMEM_WAS_PURGED) {
-            LOGE("channel '%s' consumer ~ Error %d pinning ashmem fd %d because it was purged "
+            ALOGE("channel '%s' consumer ~ Error %d pinning ashmem fd %d because it was purged "
                     "which probably indicates that the publisher and consumer are out of sync.",
                     mChannel->getName().string(), result, ashmemFd);
             return INVALID_OPERATION;
         }
 
-        LOGE("channel '%s' consumer ~ Error %d pinning ashmem fd %d.",
+        ALOGE("channel '%s' consumer ~ Error %d pinning ashmem fd %d.",
                 mChannel->getName().string(), result, ashmemFd);
         return UNKNOWN_ERROR;
     }
 
     if (mSharedMessage->consumed) {
-        LOGE("channel '%s' consumer ~ The current message has already been consumed.",
+        ALOGE("channel '%s' consumer ~ The current message has already been consumed.",
                 mChannel->getName().string());
         return INVALID_OPERATION;
     }
@@ -611,7 +611,7 @@
     // consumed).  Eventually the publisher will reinitialize the semaphore for the next message.
     result = sem_wait(& mSharedMessage->semaphore);
     if (result < 0) {
-        LOGE("channel '%s' consumer ~ Error %d in sem_wait.",
+        ALOGE("channel '%s' consumer ~ Error %d in sem_wait.",
                 mChannel->getName().string(), errno);
         return UNKNOWN_ERROR;
     }
@@ -640,7 +640,7 @@
     }
 
     default:
-        LOGE("channel '%s' consumer ~ Received message of unknown type %d",
+        ALOGE("channel '%s' consumer ~ Received message of unknown type %d",
                 mChannel->getName().string(), mSharedMessage->type);
         return UNKNOWN_ERROR;
     }
@@ -650,7 +650,7 @@
 
 status_t InputConsumer::sendFinishedSignal(bool handled) {
 #if DEBUG_TRANSPORT_ACTIONS
-    LOGD("channel '%s' consumer ~ sendFinishedSignal: handled=%d",
+    ALOGD("channel '%s' consumer ~ sendFinishedSignal: handled=%d",
             mChannel->getName().string(), handled);
 #endif
 
@@ -661,7 +661,7 @@
 
 status_t InputConsumer::receiveDispatchSignal() {
 #if DEBUG_TRANSPORT_ACTIONS
-    LOGD("channel '%s' consumer ~ receiveDispatchSignal",
+    ALOGD("channel '%s' consumer ~ receiveDispatchSignal",
             mChannel->getName().string());
 #endif
 
@@ -671,7 +671,7 @@
         return result;
     }
     if (signal != INPUT_SIGNAL_DISPATCH) {
-        LOGE("channel '%s' consumer ~ Received unexpected signal '%c' from publisher",
+        ALOGE("channel '%s' consumer ~ Received unexpected signal '%c' from publisher",
                 mChannel->getName().string(), signal);
         return UNKNOWN_ERROR;
     }
diff --git a/libs/ui/KeyCharacterMap.cpp b/libs/ui/KeyCharacterMap.cpp
index 77f18de..485234c 100644
--- a/libs/ui/KeyCharacterMap.cpp
+++ b/libs/ui/KeyCharacterMap.cpp
@@ -95,11 +95,11 @@
     Tokenizer* tokenizer;
     status_t status = Tokenizer::open(filename, &tokenizer);
     if (status) {
-        LOGE("Error %d opening key character map file %s.", status, filename.string());
+        ALOGE("Error %d opening key character map file %s.", status, filename.string());
     } else {
         KeyCharacterMap* map = new KeyCharacterMap();
         if (!map) {
-            LOGE("Error allocating key character map.");
+            ALOGE("Error allocating key character map.");
             status = NO_MEMORY;
         } else {
 #if DEBUG_PARSER_PERFORMANCE
@@ -109,7 +109,7 @@
             status = parser.parse();
 #if DEBUG_PARSER_PERFORMANCE
             nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime;
-            LOGD("Parsed key character map file '%s' %d lines in %0.3fms.",
+            ALOGD("Parsed key character map file '%s' %d lines in %0.3fms.",
                     tokenizer->getFilename().string(), tokenizer->getLineNumber(),
                     elapsedTime / 1000000.0);
 #endif
@@ -135,7 +135,7 @@
         result = key->label;
     }
 #if DEBUG_MAPPING
-    LOGD("getDisplayLabel: keyCode=%d ~ Result %d.", keyCode, result);
+    ALOGD("getDisplayLabel: keyCode=%d ~ Result %d.", keyCode, result);
 #endif
     return result;
 }
@@ -147,7 +147,7 @@
         result = key->number;
     }
 #if DEBUG_MAPPING
-    LOGD("getNumber: keyCode=%d ~ Result %d.", keyCode, result);
+    ALOGD("getNumber: keyCode=%d ~ Result %d.", keyCode, result);
 #endif
     return result;
 }
@@ -160,7 +160,7 @@
         result = behavior->character;
     }
 #if DEBUG_MAPPING
-    LOGD("getCharacter: keyCode=%d, metaState=0x%08x ~ Result %d.", keyCode, metaState, result);
+    ALOGD("getCharacter: keyCode=%d, metaState=0x%08x ~ Result %d.", keyCode, metaState, result);
 #endif
     return result;
 }
@@ -181,7 +181,7 @@
         }
     }
 #if DEBUG_MAPPING
-    LOGD("getFallbackKeyCode: keyCode=%d, metaState=0x%08x ~ Result %s, "
+    ALOGD("getFallbackKeyCode: keyCode=%d, metaState=0x%08x ~ Result %s, "
             "fallback keyCode=%d, fallback metaState=0x%08x.",
             keyCode, metaState, result ? "true" : "false",
             outFallbackAction->keyCode, outFallbackAction->metaState);
@@ -213,7 +213,7 @@
     ExactMatch: ;
     }
 #if DEBUG_MAPPING
-    LOGD("getMatch: keyCode=%d, chars=[%s], metaState=0x%08x ~ Result %d.",
+    ALOGD("getMatch: keyCode=%d, chars=[%s], metaState=0x%08x ~ Result %d.",
             keyCode, toString(chars, numChars).string(), metaState, result);
 #endif
     return result;
@@ -228,7 +228,7 @@
         char16_t ch = chars[i];
         if (!findKey(ch, &keyCode, &metaState)) {
 #if DEBUG_MAPPING
-            LOGD("getEvents: deviceId=%d, chars=[%s] ~ Failed to find mapping for character %d.",
+            ALOGD("getEvents: deviceId=%d, chars=[%s] ~ Failed to find mapping for character %d.",
                     deviceId, toString(chars, numChars).string(), ch);
 #endif
             return false;
@@ -241,10 +241,10 @@
         addMetaKeys(outEvents, deviceId, metaState, false, now, &currentMetaState);
     }
 #if DEBUG_MAPPING
-    LOGD("getEvents: deviceId=%d, chars=[%s] ~ Generated %d events.",
+    ALOGD("getEvents: deviceId=%d, chars=[%s] ~ Generated %d events.",
             deviceId, toString(chars, numChars).string(), int32_t(outEvents.size()));
     for (size_t i = 0; i < outEvents.size(); i++) {
-        LOGD("  Key: keyCode=%d, metaState=0x%08x, %s.",
+        ALOGD("  Key: keyCode=%d, metaState=0x%08x, %s.",
                 outEvents[i].getKeyCode(), outEvents[i].getMetaState(),
                 outEvents[i].getAction() == AKEY_EVENT_ACTION_DOWN ? "down" : "up");
     }
@@ -455,7 +455,7 @@
 status_t KeyCharacterMap::Parser::parse() {
     while (!mTokenizer->isEof()) {
 #if DEBUG_PARSER
-        LOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(),
+        ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(),
                 mTokenizer->peekRemainderOfLine().string());
 #endif
 
@@ -474,7 +474,7 @@
                     status_t status = parseKey();
                     if (status) return status;
                 } else {
-                    LOGE("%s: Expected keyword, got '%s'.", mTokenizer->getLocation().string(),
+                    ALOGE("%s: Expected keyword, got '%s'.", mTokenizer->getLocation().string(),
                             keywordToken.string());
                     return BAD_VALUE;
                 }
@@ -490,7 +490,7 @@
 
             mTokenizer->skipDelimiters(WHITESPACE);
             if (!mTokenizer->isEol()) {
-                LOGE("%s: Expected end of line, got '%s'.",
+                ALOGE("%s: Expected end of line, got '%s'.",
                         mTokenizer->getLocation().string(),
                         mTokenizer->peekRemainderOfLine().string());
                 return BAD_VALUE;
@@ -501,13 +501,13 @@
     }
 
     if (mState != STATE_TOP) {
-        LOGE("%s: Unterminated key description at end of file.",
+        ALOGE("%s: Unterminated key description at end of file.",
                 mTokenizer->getLocation().string());
         return BAD_VALUE;
     }
 
     if (mMap->mType == KEYBOARD_TYPE_UNKNOWN) {
-        LOGE("%s: Missing required keyboard 'type' declaration.",
+        ALOGE("%s: Missing required keyboard 'type' declaration.",
                 mTokenizer->getLocation().string());
         return BAD_VALUE;
     }
@@ -517,7 +517,7 @@
 
 status_t KeyCharacterMap::Parser::parseType() {
     if (mMap->mType != KEYBOARD_TYPE_UNKNOWN) {
-        LOGE("%s: Duplicate keyboard 'type' declaration.",
+        ALOGE("%s: Duplicate keyboard 'type' declaration.",
                 mTokenizer->getLocation().string());
         return BAD_VALUE;
     }
@@ -535,13 +535,13 @@
     } else if (typeToken == "SPECIAL_FUNCTION") {
         type = KEYBOARD_TYPE_SPECIAL_FUNCTION;
     } else {
-        LOGE("%s: Expected keyboard type label, got '%s'.", mTokenizer->getLocation().string(),
+        ALOGE("%s: Expected keyboard type label, got '%s'.", mTokenizer->getLocation().string(),
                 typeToken.string());
         return BAD_VALUE;
     }
 
 #if DEBUG_PARSER
-    LOGD("Parsed type: type=%d.", type);
+    ALOGD("Parsed type: type=%d.", type);
 #endif
     mMap->mType = type;
     return NO_ERROR;
@@ -551,12 +551,12 @@
     String8 keyCodeToken = mTokenizer->nextToken(WHITESPACE);
     int32_t keyCode = getKeyCodeByLabel(keyCodeToken.string());
     if (!keyCode) {
-        LOGE("%s: Expected key code label, got '%s'.", mTokenizer->getLocation().string(),
+        ALOGE("%s: Expected key code label, got '%s'.", mTokenizer->getLocation().string(),
                 keyCodeToken.string());
         return BAD_VALUE;
     }
     if (mMap->mKeys.indexOfKey(keyCode) >= 0) {
-        LOGE("%s: Duplicate entry for key code '%s'.", mTokenizer->getLocation().string(),
+        ALOGE("%s: Duplicate entry for key code '%s'.", mTokenizer->getLocation().string(),
                 keyCodeToken.string());
         return BAD_VALUE;
     }
@@ -564,13 +564,13 @@
     mTokenizer->skipDelimiters(WHITESPACE);
     String8 openBraceToken = mTokenizer->nextToken(WHITESPACE);
     if (openBraceToken != "{") {
-        LOGE("%s: Expected '{' after key code label, got '%s'.",
+        ALOGE("%s: Expected '{' after key code label, got '%s'.",
                 mTokenizer->getLocation().string(), openBraceToken.string());
         return BAD_VALUE;
     }
 
 #if DEBUG_PARSER
-    LOGD("Parsed beginning of key: keyCode=%d.", keyCode);
+    ALOGD("Parsed beginning of key: keyCode=%d.", keyCode);
 #endif
     mKeyCode = keyCode;
     mMap->mKeys.add(keyCode, new Key());
@@ -597,7 +597,7 @@
             int32_t metaState;
             status_t status = parseModifier(token, &metaState);
             if (status) {
-                LOGE("%s: Expected a property name or modifier, got '%s'.",
+                ALOGE("%s: Expected a property name or modifier, got '%s'.",
                         mTokenizer->getLocation().string(), token.string());
                 return status;
             }
@@ -616,7 +616,7 @@
             }
         }
 
-        LOGE("%s: Expected ',' or ':' after property name.",
+        ALOGE("%s: Expected ',' or ':' after property name.",
                 mTokenizer->getLocation().string());
         return BAD_VALUE;
     }
@@ -634,12 +634,12 @@
             char16_t character;
             status_t status = parseCharacterLiteral(&character);
             if (status || !character) {
-                LOGE("%s: Invalid character literal for key.",
+                ALOGE("%s: Invalid character literal for key.",
                         mTokenizer->getLocation().string());
                 return BAD_VALUE;
             }
             if (haveCharacter) {
-                LOGE("%s: Cannot combine multiple character literals or 'none'.",
+                ALOGE("%s: Cannot combine multiple character literals or 'none'.",
                         mTokenizer->getLocation().string());
                 return BAD_VALUE;
             }
@@ -649,7 +649,7 @@
             token = mTokenizer->nextToken(WHITESPACE);
             if (token == "none") {
                 if (haveCharacter) {
-                    LOGE("%s: Cannot combine multiple character literals or 'none'.",
+                    ALOGE("%s: Cannot combine multiple character literals or 'none'.",
                             mTokenizer->getLocation().string());
                     return BAD_VALUE;
                 }
@@ -659,20 +659,20 @@
                 token = mTokenizer->nextToken(WHITESPACE);
                 int32_t keyCode = getKeyCodeByLabel(token.string());
                 if (!keyCode) {
-                    LOGE("%s: Invalid key code label for fallback behavior, got '%s'.",
+                    ALOGE("%s: Invalid key code label for fallback behavior, got '%s'.",
                             mTokenizer->getLocation().string(),
                             token.string());
                     return BAD_VALUE;
                 }
                 if (haveFallback) {
-                    LOGE("%s: Cannot combine multiple fallback key codes.",
+                    ALOGE("%s: Cannot combine multiple fallback key codes.",
                             mTokenizer->getLocation().string());
                     return BAD_VALUE;
                 }
                 behavior.fallbackKeyCode = keyCode;
                 haveFallback = true;
             } else {
-                LOGE("%s: Expected a key behavior after ':'.",
+                ALOGE("%s: Expected a key behavior after ':'.",
                         mTokenizer->getLocation().string());
                 return BAD_VALUE;
             }
@@ -688,30 +688,30 @@
         switch (property.property) {
         case PROPERTY_LABEL:
             if (key->label) {
-                LOGE("%s: Duplicate label for key.",
+                ALOGE("%s: Duplicate label for key.",
                         mTokenizer->getLocation().string());
                 return BAD_VALUE;
             }
             key->label = behavior.character;
 #if DEBUG_PARSER
-            LOGD("Parsed key label: keyCode=%d, label=%d.", mKeyCode, key->label);
+            ALOGD("Parsed key label: keyCode=%d, label=%d.", mKeyCode, key->label);
 #endif
             break;
         case PROPERTY_NUMBER:
             if (key->number) {
-                LOGE("%s: Duplicate number for key.",
+                ALOGE("%s: Duplicate number for key.",
                         mTokenizer->getLocation().string());
                 return BAD_VALUE;
             }
             key->number = behavior.character;
 #if DEBUG_PARSER
-            LOGD("Parsed key number: keyCode=%d, number=%d.", mKeyCode, key->number);
+            ALOGD("Parsed key number: keyCode=%d, number=%d.", mKeyCode, key->number);
 #endif
             break;
         case PROPERTY_META: {
             for (Behavior* b = key->firstBehavior; b; b = b->next) {
                 if (b->metaState == property.metaState) {
-                    LOGE("%s: Duplicate key behavior for modifier.",
+                    ALOGE("%s: Duplicate key behavior for modifier.",
                             mTokenizer->getLocation().string());
                     return BAD_VALUE;
                 }
@@ -721,7 +721,7 @@
             newBehavior->next = key->firstBehavior;
             key->firstBehavior = newBehavior;
 #if DEBUG_PARSER
-            LOGD("Parsed key meta: keyCode=%d, meta=0x%x, char=%d, fallback=%d.", mKeyCode,
+            ALOGD("Parsed key meta: keyCode=%d, meta=0x%x, char=%d, fallback=%d.", mKeyCode,
                     newBehavior->metaState, newBehavior->character, newBehavior->fallbackKeyCode);
 #endif
             break;
@@ -757,7 +757,7 @@
                 return BAD_VALUE;
             }
             if (combinedMeta & metaState) {
-                LOGE("%s: Duplicate modifier combination '%s'.",
+                ALOGE("%s: Duplicate modifier combination '%s'.",
                         mTokenizer->getLocation().string(), token.string());
                 return BAD_VALUE;
             }
@@ -831,7 +831,7 @@
     }
 
 Error:
-    LOGE("%s: Malformed character literal.", mTokenizer->getLocation().string());
+    ALOGE("%s: Malformed character literal.", mTokenizer->getLocation().string());
     return BAD_VALUE;
 }
 
diff --git a/libs/ui/KeyLayoutMap.cpp b/libs/ui/KeyLayoutMap.cpp
index 8626a03..44a9420 100644
--- a/libs/ui/KeyLayoutMap.cpp
+++ b/libs/ui/KeyLayoutMap.cpp
@@ -53,11 +53,11 @@
     Tokenizer* tokenizer;
     status_t status = Tokenizer::open(filename, &tokenizer);
     if (status) {
-        LOGE("Error %d opening key layout map file %s.", status, filename.string());
+        ALOGE("Error %d opening key layout map file %s.", status, filename.string());
     } else {
         KeyLayoutMap* map = new KeyLayoutMap();
         if (!map) {
-            LOGE("Error allocating key layout map.");
+            ALOGE("Error allocating key layout map.");
             status = NO_MEMORY;
         } else {
 #if DEBUG_PARSER_PERFORMANCE
@@ -67,7 +67,7 @@
             status = parser.parse();
 #if DEBUG_PARSER_PERFORMANCE
             nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime;
-            LOGD("Parsed key layout map file '%s' %d lines in %0.3fms.",
+            ALOGD("Parsed key layout map file '%s' %d lines in %0.3fms.",
                     tokenizer->getFilename().string(), tokenizer->getLineNumber(),
                     elapsedTime / 1000000.0);
 #endif
@@ -86,7 +86,7 @@
     ssize_t index = mKeys.indexOfKey(scanCode);
     if (index < 0) {
 #if DEBUG_MAPPING
-        LOGD("mapKey: scanCode=%d ~ Failed.", scanCode);
+        ALOGD("mapKey: scanCode=%d ~ Failed.", scanCode);
 #endif
         *keyCode = AKEYCODE_UNKNOWN;
         *flags = 0;
@@ -98,7 +98,7 @@
     *flags = k.flags;
 
 #if DEBUG_MAPPING
-    LOGD("mapKey: scanCode=%d ~ Result keyCode=%d, flags=0x%08x.", scanCode, *keyCode, *flags);
+    ALOGD("mapKey: scanCode=%d ~ Result keyCode=%d, flags=0x%08x.", scanCode, *keyCode, *flags);
 #endif
     return NO_ERROR;
 }
@@ -117,7 +117,7 @@
     ssize_t index = mAxes.indexOfKey(scanCode);
     if (index < 0) {
 #if DEBUG_MAPPING
-        LOGD("mapAxis: scanCode=%d ~ Failed.", scanCode);
+        ALOGD("mapAxis: scanCode=%d ~ Failed.", scanCode);
 #endif
         return NAME_NOT_FOUND;
     }
@@ -125,7 +125,7 @@
     *outAxisInfo = mAxes.valueAt(index);
 
 #if DEBUG_MAPPING
-    LOGD("mapAxis: scanCode=%d ~ Result mode=%d, axis=%d, highAxis=%d, "
+    ALOGD("mapAxis: scanCode=%d ~ Result mode=%d, axis=%d, highAxis=%d, "
             "splitValue=%d, flatOverride=%d.",
             scanCode,
             outAxisInfo->mode, outAxisInfo->axis, outAxisInfo->highAxis,
@@ -147,7 +147,7 @@
 status_t KeyLayoutMap::Parser::parse() {
     while (!mTokenizer->isEof()) {
 #if DEBUG_PARSER
-        LOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(),
+        ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(),
                 mTokenizer->peekRemainderOfLine().string());
 #endif
 
@@ -164,14 +164,14 @@
                 status_t status = parseAxis();
                 if (status) return status;
             } else {
-                LOGE("%s: Expected keyword, got '%s'.", mTokenizer->getLocation().string(),
+                ALOGE("%s: Expected keyword, got '%s'.", mTokenizer->getLocation().string(),
                         keywordToken.string());
                 return BAD_VALUE;
             }
 
             mTokenizer->skipDelimiters(WHITESPACE);
             if (!mTokenizer->isEol()) {
-                LOGE("%s: Expected end of line, got '%s'.",
+                ALOGE("%s: Expected end of line, got '%s'.",
                         mTokenizer->getLocation().string(),
                         mTokenizer->peekRemainderOfLine().string());
                 return BAD_VALUE;
@@ -188,12 +188,12 @@
     char* end;
     int32_t scanCode = int32_t(strtol(scanCodeToken.string(), &end, 0));
     if (*end) {
-        LOGE("%s: Expected key scan code number, got '%s'.", mTokenizer->getLocation().string(),
+        ALOGE("%s: Expected key scan code number, got '%s'.", mTokenizer->getLocation().string(),
                 scanCodeToken.string());
         return BAD_VALUE;
     }
     if (mMap->mKeys.indexOfKey(scanCode) >= 0) {
-        LOGE("%s: Duplicate entry for key scan code '%s'.", mTokenizer->getLocation().string(),
+        ALOGE("%s: Duplicate entry for key scan code '%s'.", mTokenizer->getLocation().string(),
                 scanCodeToken.string());
         return BAD_VALUE;
     }
@@ -202,7 +202,7 @@
     String8 keyCodeToken = mTokenizer->nextToken(WHITESPACE);
     int32_t keyCode = getKeyCodeByLabel(keyCodeToken.string());
     if (!keyCode) {
-        LOGE("%s: Expected key code label, got '%s'.", mTokenizer->getLocation().string(),
+        ALOGE("%s: Expected key code label, got '%s'.", mTokenizer->getLocation().string(),
                 keyCodeToken.string());
         return BAD_VALUE;
     }
@@ -215,12 +215,12 @@
         String8 flagToken = mTokenizer->nextToken(WHITESPACE);
         uint32_t flag = getKeyFlagByLabel(flagToken.string());
         if (!flag) {
-            LOGE("%s: Expected key flag label, got '%s'.", mTokenizer->getLocation().string(),
+            ALOGE("%s: Expected key flag label, got '%s'.", mTokenizer->getLocation().string(),
                     flagToken.string());
             return BAD_VALUE;
         }
         if (flags & flag) {
-            LOGE("%s: Duplicate key flag '%s'.", mTokenizer->getLocation().string(),
+            ALOGE("%s: Duplicate key flag '%s'.", mTokenizer->getLocation().string(),
                     flagToken.string());
             return BAD_VALUE;
         }
@@ -228,7 +228,7 @@
     }
 
 #if DEBUG_PARSER
-    LOGD("Parsed key: scanCode=%d, keyCode=%d, flags=0x%08x.", scanCode, keyCode, flags);
+    ALOGD("Parsed key: scanCode=%d, keyCode=%d, flags=0x%08x.", scanCode, keyCode, flags);
 #endif
     Key key;
     key.keyCode = keyCode;
@@ -242,12 +242,12 @@
     char* end;
     int32_t scanCode = int32_t(strtol(scanCodeToken.string(), &end, 0));
     if (*end) {
-        LOGE("%s: Expected axis scan code number, got '%s'.", mTokenizer->getLocation().string(),
+        ALOGE("%s: Expected axis scan code number, got '%s'.", mTokenizer->getLocation().string(),
                 scanCodeToken.string());
         return BAD_VALUE;
     }
     if (mMap->mAxes.indexOfKey(scanCode) >= 0) {
-        LOGE("%s: Duplicate entry for axis scan code '%s'.", mTokenizer->getLocation().string(),
+        ALOGE("%s: Duplicate entry for axis scan code '%s'.", mTokenizer->getLocation().string(),
                 scanCodeToken.string());
         return BAD_VALUE;
     }
@@ -263,7 +263,7 @@
         String8 axisToken = mTokenizer->nextToken(WHITESPACE);
         axisInfo.axis = getAxisByLabel(axisToken.string());
         if (axisInfo.axis < 0) {
-            LOGE("%s: Expected inverted axis label, got '%s'.",
+            ALOGE("%s: Expected inverted axis label, got '%s'.",
                     mTokenizer->getLocation().string(), axisToken.string());
             return BAD_VALUE;
         }
@@ -274,7 +274,7 @@
         String8 splitToken = mTokenizer->nextToken(WHITESPACE);
         axisInfo.splitValue = int32_t(strtol(splitToken.string(), &end, 0));
         if (*end) {
-            LOGE("%s: Expected split value, got '%s'.",
+            ALOGE("%s: Expected split value, got '%s'.",
                     mTokenizer->getLocation().string(), splitToken.string());
             return BAD_VALUE;
         }
@@ -283,7 +283,7 @@
         String8 lowAxisToken = mTokenizer->nextToken(WHITESPACE);
         axisInfo.axis = getAxisByLabel(lowAxisToken.string());
         if (axisInfo.axis < 0) {
-            LOGE("%s: Expected low axis label, got '%s'.",
+            ALOGE("%s: Expected low axis label, got '%s'.",
                     mTokenizer->getLocation().string(), lowAxisToken.string());
             return BAD_VALUE;
         }
@@ -292,14 +292,14 @@
         String8 highAxisToken = mTokenizer->nextToken(WHITESPACE);
         axisInfo.highAxis = getAxisByLabel(highAxisToken.string());
         if (axisInfo.highAxis < 0) {
-            LOGE("%s: Expected high axis label, got '%s'.",
+            ALOGE("%s: Expected high axis label, got '%s'.",
                     mTokenizer->getLocation().string(), highAxisToken.string());
             return BAD_VALUE;
         }
     } else {
         axisInfo.axis = getAxisByLabel(token.string());
         if (axisInfo.axis < 0) {
-            LOGE("%s: Expected axis label, 'split' or 'invert', got '%s'.",
+            ALOGE("%s: Expected axis label, 'split' or 'invert', got '%s'.",
                     mTokenizer->getLocation().string(), token.string());
             return BAD_VALUE;
         }
@@ -316,19 +316,19 @@
             String8 flatToken = mTokenizer->nextToken(WHITESPACE);
             axisInfo.flatOverride = int32_t(strtol(flatToken.string(), &end, 0));
             if (*end) {
-                LOGE("%s: Expected flat value, got '%s'.",
+                ALOGE("%s: Expected flat value, got '%s'.",
                         mTokenizer->getLocation().string(), flatToken.string());
                 return BAD_VALUE;
             }
         } else {
-            LOGE("%s: Expected keyword 'flat', got '%s'.",
+            ALOGE("%s: Expected keyword 'flat', got '%s'.",
                     mTokenizer->getLocation().string(), keywordToken.string());
             return BAD_VALUE;
         }
     }
 
 #if DEBUG_PARSER
-    LOGD("Parsed axis: scanCode=%d, mode=%d, axis=%d, highAxis=%d, "
+    ALOGD("Parsed axis: scanCode=%d, mode=%d, axis=%d, highAxis=%d, "
             "splitValue=%d, flatOverride=%d.",
             scanCode,
             axisInfo.mode, axisInfo.axis, axisInfo.highAxis,
diff --git a/libs/ui/Keyboard.cpp b/libs/ui/Keyboard.cpp
index 10bb39c..e4611f7 100644
--- a/libs/ui/Keyboard.cpp
+++ b/libs/ui/Keyboard.cpp
@@ -50,7 +50,7 @@
                 keyLayoutName)) {
             status_t status = loadKeyLayout(deviceIdenfifier, keyLayoutName);
             if (status == NAME_NOT_FOUND) {
-                LOGE("Configuration for keyboard device '%s' requested keyboard layout '%s' but "
+                ALOGE("Configuration for keyboard device '%s' requested keyboard layout '%s' but "
                         "it was not found.",
                         deviceIdenfifier.name.string(), keyLayoutName.string());
             }
@@ -61,7 +61,7 @@
                 keyCharacterMapName)) {
             status_t status = loadKeyCharacterMap(deviceIdenfifier, keyCharacterMapName);
             if (status == NAME_NOT_FOUND) {
-                LOGE("Configuration for keyboard device '%s' requested keyboard character "
+                ALOGE("Configuration for keyboard device '%s' requested keyboard character "
                         "map '%s' but it was not found.",
                         deviceIdenfifier.name.string(), keyLayoutName.string());
             }
@@ -90,7 +90,7 @@
     }
 
     // Give up!
-    LOGE("Could not determine key map for device '%s' and no default key maps were found!",
+    ALOGE("Could not determine key map for device '%s' and no default key maps were found!",
             deviceIdenfifier.name.string());
     return NAME_NOT_FOUND;
 }
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp
index 5656088..8cd047a 100644
--- a/libs/ui/Region.cpp
+++ b/libs/ui/Region.cpp
@@ -69,7 +69,7 @@
 Region::Region(const void* buffer)
 {
     status_t err = read(buffer);
-    LOGE_IF(err<0, "error %s reading Region from buffer", strerror(err));
+    ALOGE_IF(err<0, "error %s reading Region from buffer", strerror(err));
 }
 
 Region::~Region()
@@ -272,7 +272,7 @@
     }
     
     virtual void operator()(const Rect& rect) {
-        //LOGD(">>> %3d, %3d, %3d, %3d", 
+        //ALOGD(">>> %3d, %3d, %3d, %3d",
         //        rect.left, rect.top, rect.right, rect.bottom);
         if (span.size()) {
             if (cur->top != rect.top) {
@@ -338,15 +338,15 @@
         b.bottom = b.bottom > cur->bottom ? b.bottom : cur->bottom;
         if (cur->top == prev->top) {
             if (cur->bottom != prev->bottom) {
-                LOGE("%s: invalid span %p", name, cur);
+                ALOGE("%s: invalid span %p", name, cur);
                 result = false;
             } else if (cur->left < prev->right) {
-                LOGE("%s: spans overlap horizontally prev=%p, cur=%p",
+                ALOGE("%s: spans overlap horizontally prev=%p, cur=%p",
                         name, prev, cur);
                 result = false;
             }
         } else if (cur->top < prev->bottom) {
-            LOGE("%s: spans overlap vertically prev=%p, cur=%p",
+            ALOGE("%s: spans overlap vertically prev=%p, cur=%p",
                     name, prev, cur);
             result = false;
         }
@@ -355,7 +355,7 @@
     }
     if (b != reg.getBounds()) {
         result = false;
-        LOGE("%s: invalid bounds [%d,%d,%d,%d] vs. [%d,%d,%d,%d]", name,
+        ALOGE("%s: invalid bounds [%d,%d,%d,%d] vs. [%d,%d,%d,%d]", name,
                 b.left, b.top, b.right, b.bottom,
                 reg.getBounds().left, reg.getBounds().top, 
                 reg.getBounds().right, reg.getBounds().bottom);
@@ -457,14 +457,14 @@
     }
     
     if(!same) {
-        LOGD("---\nregion boolean %s failed", name);
+        ALOGD("---\nregion boolean %s failed", name);
         lhs.dump("lhs");
         rhs.dump("rhs");
         dst.dump("dst");
-        LOGD("should be");
+        ALOGD("should be");
         SkRegion::Iterator it(sk_dst);
         while (!it.done()) {
-            LOGD("    [%3d, %3d, %3d, %3d]",
+            ALOGD("    [%3d, %3d, %3d, %3d]",
                 it.rect().fLeft,
                 it.rect().fTop,
                 it.rect().fRight,
@@ -480,7 +480,7 @@
         const Rect& rhs, int dx, int dy)
 {
     if (!rhs.isValid()) {
-        LOGE("Region::boolean_operation(op=%d) invalid Rect={%d,%d,%d,%d}",
+        ALOGE("Region::boolean_operation(op=%d) invalid Rect={%d,%d,%d,%d}",
                 op, rhs.left, rhs.top, rhs.right, rhs.bottom);
         return;
     }
@@ -647,9 +647,9 @@
     (void)flags;
     const_iterator head = begin();
     const_iterator const tail = end();
-    LOGD("  Region %s (this=%p, count=%d)\n", what, this, tail-head);
+    ALOGD("  Region %s (this=%p, count=%d)\n", what, this, tail-head);
     while (head != tail) {
-        LOGD("    [%3d, %3d, %3d, %3d]\n",
+        ALOGD("    [%3d, %3d, %3d, %3d]\n",
                 head->left, head->top, head->right, head->bottom);
         head++;
     }
diff --git a/libs/ui/VirtualKeyMap.cpp b/libs/ui/VirtualKeyMap.cpp
index e756cdd..62d5b59 100644
--- a/libs/ui/VirtualKeyMap.cpp
+++ b/libs/ui/VirtualKeyMap.cpp
@@ -51,11 +51,11 @@
     Tokenizer* tokenizer;
     status_t status = Tokenizer::open(filename, &tokenizer);
     if (status) {
-        LOGE("Error %d opening virtual key map file %s.", status, filename.string());
+        ALOGE("Error %d opening virtual key map file %s.", status, filename.string());
     } else {
         VirtualKeyMap* map = new VirtualKeyMap();
         if (!map) {
-            LOGE("Error allocating virtual key map.");
+            ALOGE("Error allocating virtual key map.");
             status = NO_MEMORY;
         } else {
 #if DEBUG_PARSER_PERFORMANCE
@@ -65,7 +65,7 @@
             status = parser.parse();
 #if DEBUG_PARSER_PERFORMANCE
             nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime;
-            LOGD("Parsed key character map file '%s' %d lines in %0.3fms.",
+            ALOGD("Parsed key character map file '%s' %d lines in %0.3fms.",
                     tokenizer->getFilename().string(), tokenizer->getLineNumber(),
                     elapsedTime / 1000000.0);
 #endif
@@ -93,7 +93,7 @@
 status_t VirtualKeyMap::Parser::parse() {
     while (!mTokenizer->isEof()) {
 #if DEBUG_PARSER
-        LOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(),
+        ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(),
                 mTokenizer->peekRemainderOfLine().string());
 #endif
 
@@ -104,7 +104,7 @@
             do {
                 String8 token = mTokenizer->nextToken(WHITESPACE_OR_FIELD_DELIMITER);
                 if (token != "0x01") {
-                    LOGE("%s: Unknown virtual key type, expected 0x01.",
+                    ALOGE("%s: Unknown virtual key type, expected 0x01.",
                           mTokenizer->getLocation().string());
                     return BAD_VALUE;
                 }
@@ -116,13 +116,13 @@
                         && parseNextIntField(&defn.width)
                         && parseNextIntField(&defn.height);
                 if (!success) {
-                    LOGE("%s: Expected 5 colon-delimited integers in virtual key definition.",
+                    ALOGE("%s: Expected 5 colon-delimited integers in virtual key definition.",
                           mTokenizer->getLocation().string());
                     return BAD_VALUE;
                 }
 
 #if DEBUG_PARSER
-                LOGD("Parsed virtual key: scanCode=%d, centerX=%d, centerY=%d, "
+                ALOGD("Parsed virtual key: scanCode=%d, centerX=%d, centerY=%d, "
                         "width=%d, height=%d",
                         defn.scanCode, defn.centerX, defn.centerY, defn.width, defn.height);
 #endif
@@ -130,7 +130,7 @@
             } while (consumeFieldDelimiterAndSkipWhitespace());
 
             if (!mTokenizer->isEol()) {
-                LOGE("%s: Expected end of line, got '%s'.",
+                ALOGE("%s: Expected end of line, got '%s'.",
                         mTokenizer->getLocation().string(),
                         mTokenizer->peekRemainderOfLine().string());
                 return BAD_VALUE;
@@ -162,7 +162,7 @@
     char* end;
     *outValue = strtol(token.string(), &end, 0);
     if (token.isEmpty() || *end != '\0') {
-        LOGE("Expected an integer, got '%s'.", token.string());
+        ALOGE("Expected an integer, got '%s'.", token.string());
         return false;
     }
     return true;
diff --git a/libs/ui/tests/region/region.cpp b/libs/ui/tests/region/region.cpp
index ef15de9..6347294 100644
--- a/libs/ui/tests/region/region.cpp
+++ b/libs/ui/tests/region/region.cpp
@@ -58,7 +58,7 @@
     //reg2.dump("reg2");
     //reg3.dump("reg3");
 
-    LOGD("---");
+    ALOGD("---");
     reg2 = reg0 | reg0.translate(100, 0);
     reg0.dump("reg0");
     reg1.dump("reg1");
diff --git a/libs/utils/Asset.cpp b/libs/utils/Asset.cpp
index a18294b..50e701a 100644
--- a/libs/utils/Asset.cpp
+++ b/libs/utils/Asset.cpp
@@ -89,7 +89,7 @@
   	    gTail->mNext = this;
   	    gTail = this;
   	}
-    //LOGI("Creating Asset %p #%d\n", this, gCount);
+    //ALOGI("Creating Asset %p #%d\n", this, gCount);
 }
 
 Asset::~Asset(void)
@@ -109,7 +109,7 @@
         mPrev->mNext = mNext;
     }
     mNext = mPrev = NULL;
-    //LOGI("Destroying Asset in %p #%d\n", this, gCount);
+    //ALOGI("Destroying Asset in %p #%d\n", this, gCount);
 }
 
 /*
@@ -210,7 +210,7 @@
     offset = ftell(fp);
     fclose(fp);
     if (!scanResult) {
-        LOGD("File '%s' is not in gzip format\n", fileName);
+        ALOGD("File '%s' is not in gzip format\n", fileName);
         ::close(fd);
         return NULL;
     }
@@ -327,14 +327,14 @@
         newOffset = maxPosn + offset;
         break;
     default:
-        LOGW("unexpected whence %d\n", whence);
+        ALOGW("unexpected whence %d\n", whence);
         // this was happening due to an off64_t size mismatch
         assert(false);
         return (off64_t) -1;
     }
 
     if (newOffset < 0 || newOffset > maxPosn) {
-        LOGW("seek out of range: want %ld, end=%ld\n",
+        ALOGW("seek out of range: want %ld, end=%ld\n",
             (long) newOffset, (long) maxPosn);
         return (off64_t) -1;
     }
@@ -384,12 +384,12 @@
     fileLength = lseek64(fd, 0, SEEK_END);
     if (fileLength == (off64_t) -1) {
         // probably a bad file descriptor
-        LOGD("failed lseek (errno=%d)\n", errno);
+        ALOGD("failed lseek (errno=%d)\n", errno);
         return UNKNOWN_ERROR;
     }
 
     if ((off64_t) (offset + length) > fileLength) {
-        LOGD("start (%ld) + len (%ld) > end (%ld)\n",
+        ALOGD("start (%ld) + len (%ld) > end (%ld)\n",
             (long) offset, (long) length, (long) fileLength);
         return BAD_INDEX;
     }
@@ -473,7 +473,7 @@
         /* read from the file */
         //printf("file read\n");
         if (ftell(mFp) != mStart + mOffset) {
-            LOGE("Hosed: %ld != %ld+%ld\n",
+            ALOGE("Hosed: %ld != %ld+%ld\n",
                 ftell(mFp), (long) mStart, (long) mOffset);
             assert(false);
         }
@@ -581,23 +581,23 @@
 
         buf = new unsigned char[allocLen];
         if (buf == NULL) {
-            LOGE("alloc of %ld bytes failed\n", (long) allocLen);
+            ALOGE("alloc of %ld bytes failed\n", (long) allocLen);
             return NULL;
         }
 
-        LOGV("Asset %p allocating buffer size %d (smaller than threshold)", this, (int)allocLen);
+        ALOGV("Asset %p allocating buffer size %d (smaller than threshold)", this, (int)allocLen);
         if (mLength > 0) {
             long oldPosn = ftell(mFp);
             fseek(mFp, mStart, SEEK_SET);
             if (fread(buf, 1, mLength, mFp) != (size_t) mLength) {
-                LOGE("failed reading %ld bytes\n", (long) mLength);
+                ALOGE("failed reading %ld bytes\n", (long) mLength);
                 delete[] buf;
                 return NULL;
             }
             fseek(mFp, oldPosn, SEEK_SET);
         }
 
-        LOGV(" getBuffer: loaded into buffer\n");
+        ALOGV(" getBuffer: loaded into buffer\n");
 
         mBuf = buf;
         return mBuf;
@@ -610,7 +610,7 @@
             return NULL;
         }
 
-        LOGV(" getBuffer: mapped\n");
+        ALOGV(" getBuffer: mapped\n");
 
         mMap = map;
         if (!wordAligned) {
@@ -648,17 +648,17 @@
     if ((((size_t)data)&0x3) == 0) {
         // We can return this directly if it is aligned on a word
         // boundary.
-        LOGV("Returning aligned FileAsset %p (%s).", this,
+        ALOGV("Returning aligned FileAsset %p (%s).", this,
                 getAssetSource());
         return data;
     }
     // If not aligned on a word boundary, then we need to copy it into
     // our own buffer.
-    LOGV("Copying FileAsset %p (%s) to buffer size %d to make it aligned.", this,
+    ALOGV("Copying FileAsset %p (%s) to buffer size %d to make it aligned.", this,
             getAssetSource(), (int)mLength);
     unsigned char* buf = new unsigned char[mLength];
     if (buf == NULL) {
-        LOGE("alloc of %ld bytes failed\n", (long) mLength);
+        ALOGE("alloc of %ld bytes failed\n", (long) mLength);
         return NULL;
     }
     memcpy(buf, data, mLength);
@@ -855,7 +855,7 @@
      */
     buf = new unsigned char[mUncompressedLen];
     if (buf == NULL) {
-        LOGW("alloc %ld bytes failed\n", (long) mUncompressedLen);
+        ALOGW("alloc %ld bytes failed\n", (long) mUncompressedLen);
         goto bail;
     }
 
diff --git a/libs/utils/AssetManager.cpp b/libs/utils/AssetManager.cpp
index 22034c5..47a2b99 100644
--- a/libs/utils/AssetManager.cpp
+++ b/libs/utils/AssetManager.cpp
@@ -117,14 +117,14 @@
       mCacheMode(cacheMode), mCacheValid(false)
 {
     int count = android_atomic_inc(&gCount)+1;
-    //LOGI("Creating AssetManager %p #%d\n", this, count);
+    //ALOGI("Creating AssetManager %p #%d\n", this, count);
     memset(mConfig, 0, sizeof(ResTable_config));
 }
 
 AssetManager::~AssetManager(void)
 {
     int count = android_atomic_dec(&gCount);
-    //LOGI("Destroying AssetManager in %p #%d\n", this, count);
+    //ALOGI("Destroying AssetManager in %p #%d\n", this, count);
 
     delete mConfig;
     delete mResources;
@@ -151,7 +151,7 @@
         ap.path = path;
         ap.type = ::getFileType(path.string());
         if (ap.type != kFileTypeDirectory && ap.type != kFileTypeRegular) {
-            LOGW("Asset path %s is neither a directory nor file (type=%d).",
+            ALOGW("Asset path %s is neither a directory nor file (type=%d).",
                  path.string(), (int)ap.type);
             return false;
         }
@@ -167,7 +167,7 @@
         }
     }
 
-    LOGV("In %p Asset %s path: %s", this,
+    ALOGV("In %p Asset %s path: %s", this,
          ap.type == kFileTypeDirectory ? "dir" : "zip", ap.path.string());
 
     mAssetPaths.add(ap);
@@ -200,7 +200,7 @@
             if (addOverlay) {
                 mAssetPaths.add(oap);
             } else {
-                LOGW("failed to add overlay package %s\n", overlayPath.string());
+                ALOGW("failed to add overlay package %s\n", overlayPath.string());
             }
         }
     }
@@ -216,17 +216,17 @@
         if (errno == ENOENT) {
             return true; // non-existing idmap is always stale
         } else {
-            LOGW("failed to stat file %s: %s\n", idmapPath.string(), strerror(errno));
+            ALOGW("failed to stat file %s: %s\n", idmapPath.string(), strerror(errno));
             return false;
         }
     }
     if (st.st_size < ResTable::IDMAP_HEADER_SIZE_BYTES) {
-        LOGW("file %s has unexpectedly small size=%zd\n", idmapPath.string(), (size_t)st.st_size);
+        ALOGW("file %s has unexpectedly small size=%zd\n", idmapPath.string(), (size_t)st.st_size);
         return false;
     }
     int fd = TEMP_FAILURE_RETRY(::open(idmapPath.string(), O_RDONLY));
     if (fd == -1) {
-        LOGW("failed to open file %s: %s\n", idmapPath.string(), strerror(errno));
+        ALOGW("failed to open file %s: %s\n", idmapPath.string(), strerror(errno));
         return false;
     }
     char buf[ResTable::IDMAP_HEADER_SIZE_BYTES];
@@ -283,7 +283,7 @@
 bool AssetManager::createIdmapFileLocked(const String8& originalPath, const String8& overlayPath,
                                          const String8& idmapPath)
 {
-    LOGD("%s: originalPath=%s overlayPath=%s idmapPath=%s\n",
+    ALOGD("%s: originalPath=%s overlayPath=%s idmapPath=%s\n",
          __FUNCTION__, originalPath.string(), overlayPath.string(), idmapPath.string());
     ResTable tables[2];
     const String8* paths[2] = { &originalPath, &overlayPath };
@@ -300,24 +300,24 @@
         ap.path = *paths[i];
         Asset* ass = openNonAssetInPathLocked("resources.arsc", Asset::ACCESS_BUFFER, ap);
         if (ass == NULL) {
-            LOGW("failed to find resources.arsc in %s\n", ap.path.string());
+            ALOGW("failed to find resources.arsc in %s\n", ap.path.string());
             goto error;
         }
         tables[i].add(ass, (void*)1, false);
     }
 
     if (!getZipEntryCrcLocked(originalPath, "resources.arsc", &originalCrc)) {
-        LOGW("failed to retrieve crc for resources.arsc in %s\n", originalPath.string());
+        ALOGW("failed to retrieve crc for resources.arsc in %s\n", originalPath.string());
         goto error;
     }
     if (!getZipEntryCrcLocked(overlayPath, "resources.arsc", &overlayCrc)) {
-        LOGW("failed to retrieve crc for resources.arsc in %s\n", overlayPath.string());
+        ALOGW("failed to retrieve crc for resources.arsc in %s\n", overlayPath.string());
         goto error;
     }
 
     if (tables[0].createIdmap(tables[1], originalCrc, overlayCrc,
                               (void**)&data, &size) != NO_ERROR) {
-        LOGW("failed to generate idmap data for file %s\n", idmapPath.string());
+        ALOGW("failed to generate idmap data for file %s\n", idmapPath.string());
         goto error;
     }
 
@@ -326,13 +326,13 @@
     // installd).
     fd = TEMP_FAILURE_RETRY(::open(idmapPath.string(), O_WRONLY | O_CREAT | O_TRUNC, 0644));
     if (fd == -1) {
-        LOGW("failed to write idmap file %s (open: %s)\n", idmapPath.string(), strerror(errno));
+        ALOGW("failed to write idmap file %s (open: %s)\n", idmapPath.string(), strerror(errno));
         goto error_free;
     }
     for (;;) {
         ssize_t written = TEMP_FAILURE_RETRY(write(fd, data + offset, size));
         if (written < 0) {
-            LOGW("failed to write idmap file %s (write: %s)\n", idmapPath.string(),
+            ALOGW("failed to write idmap file %s (write: %s)\n", idmapPath.string(),
                  strerror(errno));
             goto error_close;
         }
@@ -498,7 +498,7 @@
     size_t i = mAssetPaths.size();
     while (i > 0) {
         i--;
-        LOGV("Looking for asset '%s' in '%s'\n",
+        ALOGV("Looking for asset '%s' in '%s'\n",
                 assetName.string(), mAssetPaths.itemAt(i).path.string());
         Asset* pAsset = openNonAssetInPathLocked(assetName.string(), mode, mAssetPaths.itemAt(i));
         if (pAsset != NULL) {
@@ -532,7 +532,7 @@
     size_t i = mAssetPaths.size();
     while (i > 0) {
         i--;
-        LOGV("Looking for non-asset '%s' in '%s'\n", fileName, mAssetPaths.itemAt(i).path.string());
+        ALOGV("Looking for non-asset '%s' in '%s'\n", fileName, mAssetPaths.itemAt(i).path.string());
         Asset* pAsset = openNonAssetInPathLocked(
             fileName, mode, mAssetPaths.itemAt(i));
         if (pAsset != NULL) {
@@ -556,7 +556,7 @@
         loadFileNameCacheLocked();
 
     if (which < mAssetPaths.size()) {
-        LOGV("Looking for non-asset '%s' in '%s'\n", fileName,
+        ALOGV("Looking for non-asset '%s' in '%s'\n", fileName,
                 mAssetPaths.itemAt(which).path.string());
         Asset* pAsset = openNonAssetInPathLocked(
             fileName, mode, mAssetPaths.itemAt(which));
@@ -621,7 +621,7 @@
         bool shared = true;
         const asset_path& ap = mAssetPaths.itemAt(i);
         Asset* idmap = openIdmapLocked(ap);
-        LOGV("Looking for resource asset in '%s'\n", ap.path.string());
+        ALOGV("Looking for resource asset in '%s'\n", ap.path.string());
         if (ap.type != kFileTypeDirectory) {
             if (i == 0) {
                 // The first item is typically the framework resources,
@@ -633,7 +633,7 @@
                 ass = const_cast<AssetManager*>(this)->
                     mZipSet.getZipResourceTableAsset(ap.path);
                 if (ass == NULL) {
-                    LOGV("loading resource table %s\n", ap.path.string());
+                    ALOGV("loading resource table %s\n", ap.path.string());
                     ass = const_cast<AssetManager*>(this)->
                         openNonAssetInPathLocked("resources.arsc",
                                                  Asset::ACCESS_BUFFER,
@@ -648,7 +648,7 @@
                     // If this is the first resource table in the asset
                     // manager, then we are going to cache it so that we
                     // can quickly copy it out for others.
-                    LOGV("Creating shared resources for %s", ap.path.string());
+                    ALOGV("Creating shared resources for %s", ap.path.string());
                     sharedRes = new ResTable();
                     sharedRes->add(ass, (void*)(i+1), false, idmap);
                     sharedRes = const_cast<AssetManager*>(this)->
@@ -656,7 +656,7 @@
                 }
             }
         } else {
-            LOGV("loading resource table %s\n", ap.path.string());
+            ALOGV("loading resource table %s\n", ap.path.string());
             Asset* ass = const_cast<AssetManager*>(this)->
                 openNonAssetInPathLocked("resources.arsc",
                                          Asset::ACCESS_BUFFER,
@@ -668,12 +668,12 @@
                 mResources = rt = new ResTable();
                 updateResourceParamsLocked();
             }
-            LOGV("Installing resource asset %p in to table %p\n", ass, mResources);
+            ALOGV("Installing resource asset %p in to table %p\n", ass, mResources);
             if (sharedRes != NULL) {
-                LOGV("Copying existing resources for %s", ap.path.string());
+                ALOGV("Copying existing resources for %s", ap.path.string());
                 rt->add(sharedRes);
             } else {
-                LOGV("Parsing resources for %s", ap.path.string());
+                ALOGV("Parsing resources for %s", ap.path.string());
                 rt->add(ass, (void*)(i+1), !shared, idmap);
             }
 
@@ -686,7 +686,7 @@
         }
     }
 
-    if (required && !rt) LOGW("Unable to find resources file resources.arsc");
+    if (required && !rt) ALOGW("Unable to find resources file resources.arsc");
     if (!rt) {
         mResources = rt = new ResTable();
     }
@@ -725,9 +725,9 @@
         ass = const_cast<AssetManager*>(this)->
             openAssetFromFileLocked(ap.idmap, Asset::ACCESS_BUFFER);
         if (ass) {
-            LOGV("loading idmap %s\n", ap.idmap.string());
+            ALOGV("loading idmap %s\n", ap.idmap.string());
         } else {
-            LOGW("failed to load idmap %s\n", ap.idmap.string());
+            ALOGW("failed to load idmap %s\n", ap.idmap.string());
         }
     }
     return ass;
@@ -923,7 +923,7 @@
              */
             if (found) {
                 if (pAsset == NULL)
-                    LOGD("Expected file not found: '%s'\n", path.string());
+                    ALOGD("Expected file not found: '%s'\n", path.string());
                 return pAsset;
             }
         }
@@ -1019,7 +1019,7 @@
  */
 ZipFileRO* AssetManager::getZipFileLocked(const asset_path& ap)
 {
-    LOGV("getZipFileLocked() in %p\n", this);
+    ALOGV("getZipFileLocked() in %p\n", this);
 
     return mZipSet.getZip(ap.path);
 }
@@ -1074,29 +1074,29 @@
     if (!pZipFile->getEntryInfo(entry, &method, &uncompressedLen, NULL, NULL,
             NULL, NULL))
     {
-        LOGW("getEntryInfo failed\n");
+        ALOGW("getEntryInfo failed\n");
         return NULL;
     }
 
     FileMap* dataMap = pZipFile->createEntryFileMap(entry);
     if (dataMap == NULL) {
-        LOGW("create map from entry failed\n");
+        ALOGW("create map from entry failed\n");
         return NULL;
     }
 
     if (method == ZipFileRO::kCompressStored) {
         pAsset = Asset::createFromUncompressedMap(dataMap, mode);
-        LOGV("Opened uncompressed entry %s in zip %s mode %d: %p", entryName.string(),
+        ALOGV("Opened uncompressed entry %s in zip %s mode %d: %p", entryName.string(),
                 dataMap->getFileName(), mode, pAsset);
     } else {
         pAsset = Asset::createFromCompressedMap(dataMap, method,
             uncompressedLen, mode);
-        LOGV("Opened compressed entry %s in zip %s mode %d: %p", entryName.string(),
+        ALOGV("Opened compressed entry %s in zip %s mode %d: %p", entryName.string(),
                 dataMap->getFileName(), mode, pAsset);
     }
     if (pAsset == NULL) {
         /* unexpected */
-        LOGW("create from segment failed\n");
+        ALOGW("create from segment failed\n");
     }
 
     return pAsset;
@@ -1146,10 +1146,10 @@
         i--;
         const asset_path& ap = mAssetPaths.itemAt(i);
         if (ap.type == kFileTypeRegular) {
-            LOGV("Adding directory %s from zip %s", dirName, ap.path.string());
+            ALOGV("Adding directory %s from zip %s", dirName, ap.path.string());
             scanAndMergeZipLocked(pMergedInfo, ap, kAssetsRoot, dirName);
         } else {
-            LOGV("Adding directory %s from dir %s", dirName, ap.path.string());
+            ALOGV("Adding directory %s from dir %s", dirName, ap.path.string());
             scanAndMergeDirLocked(pMergedInfo, ap, kAssetsRoot, dirName);
         }
     }
@@ -1200,10 +1200,10 @@
     if (which < mAssetPaths.size()) {
         const asset_path& ap = mAssetPaths.itemAt(which);
         if (ap.type == kFileTypeRegular) {
-            LOGV("Adding directory %s from zip %s", dirName, ap.path.string());
+            ALOGV("Adding directory %s from zip %s", dirName, ap.path.string());
             scanAndMergeZipLocked(pMergedInfo, ap, NULL, dirName);
         } else {
-            LOGV("Adding directory %s from dir %s", dirName, ap.path.string());
+            ALOGV("Adding directory %s from dir %s", dirName, ap.path.string());
             scanAndMergeDirLocked(pMergedInfo, ap, NULL, dirName);
         }
     }
@@ -1325,7 +1325,7 @@
 
             matchIdx = AssetDir::FileInfo::findEntry(pMergedInfo, match);
             if (matchIdx > 0) {
-                LOGV("Excluding '%s' [%s]\n",
+                ALOGV("Excluding '%s' [%s]\n",
                     pMergedInfo->itemAt(matchIdx).getFileName().string(),
                     pMergedInfo->itemAt(matchIdx).getSourceName().string());
                 pMergedInfo->removeAt(matchIdx);
@@ -1333,7 +1333,7 @@
                 //printf("+++ no match on '%s'\n", (const char*) match);
             }
 
-            LOGD("HEY: size=%d removing %d\n", (int)pContents->size(), i);
+            ALOGD("HEY: size=%d removing %d\n", (int)pContents->size(), i);
             pContents->removeAt(i);
             i--;        // adjust "for" loop
             count--;    //  and loop limit
@@ -1365,7 +1365,7 @@
     struct dirent* entry;
     FileType fileType;
 
-    LOGV("Scanning dir '%s'\n", path.string());
+    ALOGV("Scanning dir '%s'\n", path.string());
 
     dir = opendir(path.string());
     if (dir == NULL)
@@ -1427,7 +1427,7 @@
 
     pZip = mZipSet.getZip(ap.path);
     if (pZip == NULL) {
-        LOGW("Failure opening zip %s\n", ap.path.string());
+        ALOGW("Failure opening zip %s\n", ap.path.string());
         return false;
     }
 
@@ -1461,7 +1461,7 @@
         entry = pZip->findEntryByIndex(i);
         if (pZip->getEntryFileName(entry, nameBuf, sizeof(nameBuf)) != 0) {
             // TODO: fix this if we expect to have long names
-            LOGE("ARGH: name too long?\n");
+            ALOGE("ARGH: name too long?\n");
             continue;
         }
         //printf("Comparing %s in %s?\n", nameBuf, dirName.string());
@@ -1652,7 +1652,7 @@
 
 #ifdef DO_TIMINGS
     timer.stop();
-    LOGD("Cache scan took %.3fms\n",
+    ALOGD("Cache scan took %.3fms\n",
         timer.durationUsecs() / 1000.0);
 #endif
 
@@ -1780,11 +1780,11 @@
     : mPath(path), mZipFile(NULL), mModWhen(modWhen),
       mResourceTableAsset(NULL), mResourceTable(NULL)
 {
-    //LOGI("Creating SharedZip %p %s\n", this, (const char*)mPath);
+    //ALOGI("Creating SharedZip %p %s\n", this, (const char*)mPath);
     mZipFile = new ZipFileRO;
-    LOGV("+++ opening zip '%s'\n", mPath.string());
+    ALOGV("+++ opening zip '%s'\n", mPath.string());
     if (mZipFile->open(mPath.string()) != NO_ERROR) {
-        LOGD("failed to open Zip archive '%s'\n", mPath.string());
+        ALOGD("failed to open Zip archive '%s'\n", mPath.string());
         delete mZipFile;
         mZipFile = NULL;
     }
@@ -1811,7 +1811,7 @@
 
 Asset* AssetManager::SharedZip::getResourceTableAsset()
 {
-    LOGV("Getting from SharedZip %p resource asset %p\n", this, mResourceTableAsset);
+    ALOGV("Getting from SharedZip %p resource asset %p\n", this, mResourceTableAsset);
     return mResourceTableAsset;
 }
 
@@ -1833,7 +1833,7 @@
 
 ResTable* AssetManager::SharedZip::getResourceTable()
 {
-    LOGV("Getting from SharedZip %p resource table %p\n", this, mResourceTable);
+    ALOGV("Getting from SharedZip %p resource table %p\n", this, mResourceTable);
     return mResourceTable;
 }
 
@@ -1858,7 +1858,7 @@
 
 AssetManager::SharedZip::~SharedZip()
 {
-    //LOGI("Destroying SharedZip %p %s\n", this, (const char*)mPath);
+    //ALOGI("Destroying SharedZip %p %s\n", this, (const char*)mPath);
     if (mResourceTable != NULL) {
         delete mResourceTable;
     }
@@ -1867,7 +1867,7 @@
     }
     if (mZipFile != NULL) {
         delete mZipFile;
-        LOGV("Closed '%s'\n", mPath.string());
+        ALOGV("Closed '%s'\n", mPath.string());
     }
 }
 
diff --git a/libs/utils/BackupData.cpp b/libs/utils/BackupData.cpp
index 87912639..f956306 100644
--- a/libs/utils/BackupData.cpp
+++ b/libs/utils/BackupData.cpp
@@ -78,7 +78,7 @@
     paddingSize = padding_extra(n);
     if (paddingSize > 0) {
         uint32_t padding = 0xbcbcbcbc;
-        if (DEBUG) LOGI("writing %d padding bytes for %d", paddingSize, n);
+        if (DEBUG) ALOGI("writing %d padding bytes for %d", paddingSize, n);
         amt = write(m_fd, &padding, paddingSize);
         if (amt != paddingSize) {
             m_status = errno;
@@ -112,8 +112,8 @@
         k = key;
     }
     if (DEBUG) {
-        LOGD("Writing header: prefix='%s' key='%s' dataSize=%d", m_keyPrefix.string(), key.string(),
-                dataSize);
+        ALOGD("Writing header: prefix='%s' key='%s' dataSize=%d", m_keyPrefix.string(),
+                key.string(), dataSize);
     }
 
     entity_header_v1 header;
@@ -125,7 +125,7 @@
     header.keyLen = tolel(keyLen);
     header.dataSize = tolel(dataSize);
 
-    if (DEBUG) LOGI("writing entity header, %d bytes", sizeof(entity_header_v1));
+    if (DEBUG) ALOGI("writing entity header, %d bytes", sizeof(entity_header_v1));
     amt = write(m_fd, &header, sizeof(entity_header_v1));
     if (amt != sizeof(entity_header_v1)) {
         m_status = errno;
@@ -133,7 +133,7 @@
     }
     m_pos += amt;
 
-    if (DEBUG) LOGI("writing entity header key, %d bytes", keyLen+1);
+    if (DEBUG) ALOGI("writing entity header key, %d bytes", keyLen+1);
     amt = write(m_fd, k.string(), keyLen+1);
     if (amt != keyLen+1) {
         m_status = errno;
@@ -151,11 +151,11 @@
 status_t
 BackupDataWriter::WriteEntityData(const void* data, size_t size)
 {
-    if (DEBUG) LOGD("Writing data: size=%lu", (unsigned long) size);
+    if (DEBUG) ALOGD("Writing data: size=%lu", (unsigned long) size);
 
     if (m_status != NO_ERROR) {
         if (DEBUG) {
-            LOGD("Not writing data - stream in error state %d (%s)", m_status, strerror(m_status));
+            ALOGD("Not writing data - stream in error state %d (%s)", m_status, strerror(m_status));
         }
         return m_status;
     }
@@ -166,7 +166,7 @@
     ssize_t amt = write(m_fd, data, size);
     if (amt != (ssize_t)size) {
         m_status = errno;
-        if (DEBUG) LOGD("write returned error %d (%s)", m_status, strerror(m_status));
+        if (DEBUG) ALOGD("write returned error %d (%s)", m_status, strerror(m_status));
         return m_status;
     }
     m_pos += amt;
@@ -208,7 +208,7 @@
                 m_done = true; \
             } else { \
                 m_status = errno; \
-                LOGD("CHECK_SIZE(a=%ld e=%ld) failed at line %d m_status='%s'", \
+                ALOGD("CHECK_SIZE(a=%ld e=%ld) failed at line %d m_status='%s'", \
                     long(actual), long(expected), __LINE__, strerror(m_status)); \
             } \
             return m_status; \
@@ -218,7 +218,7 @@
     do { \
         status_t err = skip_padding(); \
         if (err != NO_ERROR) { \
-            LOGD("SKIP_PADDING FAILED at line %d", __LINE__); \
+            ALOGD("SKIP_PADDING FAILED at line %d", __LINE__); \
             m_status = err; \
             return err; \
         } \
@@ -261,7 +261,7 @@
         {
             m_header.entity.keyLen = fromlel(m_header.entity.keyLen);
             if (m_header.entity.keyLen <= 0) {
-                LOGD("Entity header at %d has keyLen<=0: 0x%08x\n", (int)m_pos,
+                ALOGD("Entity header at %d has keyLen<=0: 0x%08x\n", (int)m_pos,
                         (int)m_header.entity.keyLen);
                 m_status = EINVAL;
             }
@@ -285,7 +285,7 @@
             break;
         }
         default:
-            LOGD("Chunk header at %d has invalid type: 0x%08x",
+            ALOGD("Chunk header at %d has invalid type: 0x%08x",
                     (int)(m_pos - sizeof(m_header)), (int)m_header.type);
             m_status = EINVAL;
     }
@@ -339,7 +339,7 @@
         return -1;
     }
     int remaining = m_dataEndPos - m_pos;
-    //LOGD("ReadEntityData size=%d m_pos=0x%x m_dataEndPos=0x%x remaining=%d\n",
+    //ALOGD("ReadEntityData size=%d m_pos=0x%x m_dataEndPos=0x%x remaining=%d\n",
     //        size, m_pos, m_dataEndPos, remaining);
     if (remaining <= 0) {
         return 0;
@@ -347,7 +347,7 @@
     if (((int)size) > remaining) {
         size = remaining;
     }
-    //LOGD("   reading %d bytes", size);
+    //ALOGD("   reading %d bytes", size);
     int amt = read(m_fd, data, size);
     if (amt < 0) {
         m_status = errno;
diff --git a/libs/utils/BackupHelpers.cpp b/libs/utils/BackupHelpers.cpp
index 7ef30f9..f77a891 100644
--- a/libs/utils/BackupHelpers.cpp
+++ b/libs/utils/BackupHelpers.cpp
@@ -74,7 +74,7 @@
 #if TEST_BACKUP_HELPERS
 #define LOGP(f, x...) printf(f "\n", x)
 #else
-#define LOGP(x...) LOGD(x)
+#define LOGP(x...) ALOGD(x)
 #endif
 #endif
 
@@ -100,7 +100,7 @@
     bytesRead += amt;
 
     if (header.magic0 != MAGIC0 || header.magic1 != MAGIC1) {
-        LOGW("read_snapshot_file header.magic0=0x%08x magic1=0x%08x", header.magic0, header.magic1);
+        ALOGW("read_snapshot_file header.magic0=0x%08x magic1=0x%08x", header.magic0, header.magic1);
         return 1;
     }
 
@@ -110,7 +110,7 @@
 
         amt = read(fd, &file, sizeof(FileState));
         if (amt != sizeof(FileState)) {
-            LOGW("read_snapshot_file FileState truncated/error with read at %d bytes\n", bytesRead);
+            ALOGW("read_snapshot_file FileState truncated/error with read at %d bytes\n", bytesRead);
             return 1;
         }
         bytesRead += amt;
@@ -129,13 +129,13 @@
             free(filename);
         }
         if (amt != nameBufSize) {
-            LOGW("read_snapshot_file filename truncated/error with read at %d bytes\n", bytesRead);
+            ALOGW("read_snapshot_file filename truncated/error with read at %d bytes\n", bytesRead);
             return 1;
         }
     }
 
     if (header.totalSize != bytesRead) {
-        LOGW("read_snapshot_file length mismatch: header.totalSize=%d bytesRead=%d\n",
+        ALOGW("read_snapshot_file length mismatch: header.totalSize=%d bytesRead=%d\n",
                 header.totalSize, bytesRead);
         return 1;
     }
@@ -166,7 +166,7 @@
 
     amt = write(fd, &header, sizeof(header));
     if (amt != sizeof(header)) {
-        LOGW("write_snapshot_file error writing header %s", strerror(errno));
+        ALOGW("write_snapshot_file error writing header %s", strerror(errno));
         return errno;
     }
 
@@ -178,14 +178,14 @@
 
             amt = write(fd, &r.s, sizeof(FileState));
             if (amt != sizeof(FileState)) {
-                LOGW("write_snapshot_file error writing header %s", strerror(errno));
+                ALOGW("write_snapshot_file error writing header %s", strerror(errno));
                 return 1;
             }
 
             // filename is not NULL terminated, but it is padded
             amt = write(fd, name.string(), nameLen);
             if (amt != nameLen) {
-                LOGW("write_snapshot_file error writing filename %s", strerror(errno));
+                ALOGW("write_snapshot_file error writing filename %s", strerror(errno));
                 return 1;
             }
             int paddingLen = ROUND_UP[nameLen % 4];
@@ -193,7 +193,7 @@
                 int padding = 0xabababab;
                 amt = write(fd, &padding, paddingLen);
                 if (amt != paddingLen) {
-                    LOGW("write_snapshot_file error writing %d bytes of filename padding %s",
+                    ALOGW("write_snapshot_file error writing %d bytes of filename padding %s",
                             paddingLen, strerror(errno));
                     return 1;
                 }
@@ -232,7 +232,7 @@
     lseek(fd, 0, SEEK_SET);
 
     if (sizeof(metadata) != 16) {
-        LOGE("ERROR: metadata block is the wrong size!");
+        ALOGE("ERROR: metadata block is the wrong size!");
     }
 
     bytesLeft = fileSize + sizeof(metadata);
@@ -280,7 +280,7 @@
                 }
             }
         }
-        LOGE("write_update_file size mismatch for %s. expected=%d actual=%d."
+        ALOGE("write_update_file size mismatch for %s. expected=%d actual=%d."
                 " You aren't doing proper locking!", realFilename, fileSize, fileSize-bytesLeft);
     }
 
@@ -525,7 +525,7 @@
     struct stat64 s;
     if (lstat64(filepath.string(), &s) != 0) {
         err = errno;
-        LOGE("Error %d (%s) from lstat64(%s)", err, strerror(err), filepath.string());
+        ALOGE("Error %d (%s) from lstat64(%s)", err, strerror(err), filepath.string());
         return err;
     }
 
@@ -540,7 +540,7 @@
     int fd = open(filepath.string(), O_RDONLY);
     if (fd < 0) {
         err = errno;
-        LOGE("Error %d (%s) from open(%s)", err, strerror(err), filepath.string());
+        ALOGE("Error %d (%s) from open(%s)", err, strerror(err), filepath.string());
         return err;
     }
 
@@ -551,7 +551,7 @@
     char* paxData = buf + 1024;
 
     if (buf == NULL) {
-        LOGE("Out of mem allocating transfer buffer");
+        ALOGE("Out of mem allocating transfer buffer");
         err = ENOMEM;
         goto cleanup;
     }
@@ -591,7 +591,7 @@
     } else if (S_ISREG(s.st_mode)) {
         type = '0';     // tar magic: '0' == normal file
     } else {
-        LOGW("Error: unknown file mode 0%o [%s]", s.st_mode, filepath.string());
+        ALOGW("Error: unknown file mode 0%o [%s]", s.st_mode, filepath.string());
         goto cleanup;
     }
     buf[156] = type;
@@ -628,7 +628,7 @@
 
     // [ 329 : 8 ] and [ 337 : 8 ] devmajor/devminor, not used
 
-    LOGI("   Name: %s", fullname.string());
+    ALOGI("   Name: %s", fullname.string());
 
     // If we're using a pax extended header, build & write that here; lengths are
     // already preflighted
@@ -688,11 +688,11 @@
             ssize_t nRead = read(fd, buf, toRead);
             if (nRead < 0) {
                 err = errno;
-                LOGE("Unable to read file [%s], err=%d (%s)", filepath.string(),
+                ALOGE("Unable to read file [%s], err=%d (%s)", filepath.string(),
                         err, strerror(err));
                 break;
             } else if (nRead == 0) {
-                LOGE("EOF but expect %lld more bytes in [%s]", (long long) toWrite,
+                ALOGE("EOF but expect %lld more bytes in [%s]", (long long) toWrite,
                         filepath.string());
                 err = EIO;
                 break;
@@ -759,7 +759,7 @@
     file_metadata_v1 metadata;
     amt = in->ReadEntityData(&metadata, sizeof(metadata));
     if (amt != sizeof(metadata)) {
-        LOGW("Could not read metadata for %s -- %ld / %s", filename.string(),
+        ALOGW("Could not read metadata for %s -- %ld / %s", filename.string(),
                 (long)amt, strerror(errno));
         return EIO;
     }
@@ -768,7 +768,7 @@
     if (metadata.version > CURRENT_METADATA_VERSION) {
         if (!m_loggedUnknownMetadata) {
             m_loggedUnknownMetadata = true;
-            LOGW("Restoring file with unsupported metadata version %d (currently %d)",
+            ALOGW("Restoring file with unsupported metadata version %d (currently %d)",
                     metadata.version, CURRENT_METADATA_VERSION);
         }
     }
@@ -778,7 +778,7 @@
     crc = crc32(0L, Z_NULL, 0);
     fd = open(filename.string(), O_CREAT|O_RDWR|O_TRUNC, mode);
     if (fd == -1) {
-        LOGW("Could not open file %s -- %s", filename.string(), strerror(errno));
+        ALOGW("Could not open file %s -- %s", filename.string(), strerror(errno));
         return errno;
     }
     
@@ -786,7 +786,7 @@
         err = write(fd, buf, amt);
         if (err != amt) {
             close(fd);
-            LOGW("Error '%s' writing '%s'", strerror(errno), filename.string());
+            ALOGW("Error '%s' writing '%s'", strerror(errno), filename.string());
             return errno;
         }
         crc = crc32(crc, (Bytef*)buf, amt);
@@ -797,7 +797,7 @@
     // Record for the snapshot
     err = stat(filename.string(), &st);
     if (err != 0) {
-        LOGW("Error stating file that we just created %s", filename.string());
+        ALOGW("Error stating file that we just created %s", filename.string());
         return errno;
     }
 
diff --git a/libs/utils/BlobCache.cpp b/libs/utils/BlobCache.cpp
index d38aae9..e52cf2f 100644
--- a/libs/utils/BlobCache.cpp
+++ b/libs/utils/BlobCache.cpp
@@ -48,32 +48,32 @@
     mRandState[1] = (now >> 16) & 0xFFFF;
     mRandState[2] = (now >> 32) & 0xFFFF;
 #endif
-    LOGV("initializing random seed using %lld", now);
+    ALOGV("initializing random seed using %lld", now);
 }
 
 void BlobCache::set(const void* key, size_t keySize, const void* value,
         size_t valueSize) {
     if (mMaxKeySize < keySize) {
-        LOGV("set: not caching because the key is too large: %d (limit: %d)",
+        ALOGV("set: not caching because the key is too large: %d (limit: %d)",
                 keySize, mMaxKeySize);
         return;
     }
     if (mMaxValueSize < valueSize) {
-        LOGV("set: not caching because the value is too large: %d (limit: %d)",
+        ALOGV("set: not caching because the value is too large: %d (limit: %d)",
                 valueSize, mMaxValueSize);
         return;
     }
     if (mMaxTotalSize < keySize + valueSize) {
-        LOGV("set: not caching because the combined key/value size is too "
+        ALOGV("set: not caching because the combined key/value size is too "
                 "large: %d (limit: %d)", keySize + valueSize, mMaxTotalSize);
         return;
     }
     if (keySize == 0) {
-        LOGW("set: not caching because keySize is 0");
+        ALOGW("set: not caching because keySize is 0");
         return;
     }
     if (valueSize <= 0) {
-        LOGW("set: not caching because valueSize is 0");
+        ALOGW("set: not caching because valueSize is 0");
         return;
     }
 
@@ -93,7 +93,7 @@
                     clean();
                     continue;
                 } else {
-                    LOGV("set: not caching new key/value pair because the "
+                    ALOGV("set: not caching new key/value pair because the "
                             "total cache size limit would be exceeded: %d "
                             "(limit: %d)",
                             keySize + valueSize, mMaxTotalSize);
@@ -102,7 +102,7 @@
             }
             mCacheEntries.add(CacheEntry(keyBlob, valueBlob));
             mTotalSize = newTotalSize;
-            LOGV("set: created new cache entry with %d byte key and %d byte value",
+            ALOGV("set: created new cache entry with %d byte key and %d byte value",
                     keySize, valueSize);
         } else {
             // Update the existing cache entry.
@@ -115,7 +115,7 @@
                     clean();
                     continue;
                 } else {
-                    LOGV("set: not caching new value because the total cache "
+                    ALOGV("set: not caching new value because the total cache "
                             "size limit would be exceeded: %d (limit: %d)",
                             keySize + valueSize, mMaxTotalSize);
                     break;
@@ -123,7 +123,7 @@
             }
             mCacheEntries.editItemAt(index).setValue(valueBlob);
             mTotalSize = newTotalSize;
-            LOGV("set: updated existing cache entry with %d byte key and %d byte "
+            ALOGV("set: updated existing cache entry with %d byte key and %d byte "
                     "value", keySize, valueSize);
         }
         break;
@@ -133,7 +133,7 @@
 size_t BlobCache::get(const void* key, size_t keySize, void* value,
         size_t valueSize) {
     if (mMaxKeySize < keySize) {
-        LOGV("get: not searching because the key is too large: %d (limit %d)",
+        ALOGV("get: not searching because the key is too large: %d (limit %d)",
                 keySize, mMaxKeySize);
         return 0;
     }
@@ -141,7 +141,7 @@
     CacheEntry dummyEntry(dummyKey, NULL);
     ssize_t index = mCacheEntries.indexOf(dummyEntry);
     if (index < 0) {
-        LOGV("get: no cache entry found for key of size %d", keySize);
+        ALOGV("get: no cache entry found for key of size %d", keySize);
         return 0;
     }
 
@@ -150,10 +150,10 @@
     sp<Blob> valueBlob(mCacheEntries[index].getValue());
     size_t valueBlobSize = valueBlob->getSize();
     if (valueBlobSize <= valueSize) {
-        LOGV("get: copying %d bytes to caller's buffer", valueBlobSize);
+        ALOGV("get: copying %d bytes to caller's buffer", valueBlobSize);
         memcpy(value, valueBlob->getData(), valueBlobSize);
     } else {
-        LOGV("get: caller's buffer is too small for value: %d (needs %d)",
+        ALOGV("get: caller's buffer is too small for value: %d (needs %d)",
                 valueSize, valueBlobSize);
     }
     return valueBlobSize;
@@ -183,13 +183,13 @@
 status_t BlobCache::flatten(void* buffer, size_t size, int fds[], size_t count)
         const {
     if (count != 0) {
-        LOGE("flatten: nonzero fd count: %d", count);
+        ALOGE("flatten: nonzero fd count: %d", count);
         return BAD_VALUE;
     }
 
     // Write the cache header
     if (size < sizeof(Header)) {
-        LOGE("flatten: not enough room for cache header");
+        ALOGE("flatten: not enough room for cache header");
         return BAD_VALUE;
     }
     Header* header = reinterpret_cast<Header*>(buffer);
@@ -210,7 +210,7 @@
 
         size_t entrySize = sizeof(EntryHeader) + keySize + valueSize;
         if (byteOffset + entrySize > size) {
-            LOGE("flatten: not enough room for cache entries");
+            ALOGE("flatten: not enough room for cache entries");
             return BAD_VALUE;
         }
 
@@ -234,18 +234,18 @@
     mCacheEntries.clear();
 
     if (count != 0) {
-        LOGE("unflatten: nonzero fd count: %d", count);
+        ALOGE("unflatten: nonzero fd count: %d", count);
         return BAD_VALUE;
     }
 
     // Read the cache header
     if (size < sizeof(Header)) {
-        LOGE("unflatten: not enough room for cache header");
+        ALOGE("unflatten: not enough room for cache header");
         return BAD_VALUE;
     }
     const Header* header = reinterpret_cast<const Header*>(buffer);
     if (header->mMagicNumber != blobCacheMagic) {
-        LOGE("unflatten: bad magic number: %d", header->mMagicNumber);
+        ALOGE("unflatten: bad magic number: %d", header->mMagicNumber);
         return BAD_VALUE;
     }
     if (header->mBlobCacheVersion != blobCacheVersion ||
@@ -261,7 +261,7 @@
     for (size_t i = 0; i < numEntries; i++) {
         if (byteOffset + sizeof(EntryHeader) > size) {
             mCacheEntries.clear();
-            LOGE("unflatten: not enough room for cache entry headers");
+            ALOGE("unflatten: not enough room for cache entry headers");
             return BAD_VALUE;
         }
 
@@ -273,7 +273,7 @@
 
         if (byteOffset + entrySize > size) {
             mCacheEntries.clear();
-            LOGE("unflatten: not enough room for cache entry headers");
+            ALOGE("unflatten: not enough room for cache entry headers");
             return BAD_VALUE;
         }
 
diff --git a/libs/utils/CallStack.cpp b/libs/utils/CallStack.cpp
index 55b6024..bd7e239 100644
--- a/libs/utils/CallStack.cpp
+++ b/libs/utils/CallStack.cpp
@@ -328,7 +328,7 @@
      * get very deep. So we request function names of each frame individually.
      */
     for (int i=0; i<int(mCount); i++) {
-        LOGD("%s", toStringSingleLevel(prefix, i).string());
+        ALOGD("%s", toStringSingleLevel(prefix, i).string());
     }
 }
 
diff --git a/libs/utils/FileMap.cpp b/libs/utils/FileMap.cpp
index c220a90..9ce370e 100644
--- a/libs/utils/FileMap.cpp
+++ b/libs/utils/FileMap.cpp
@@ -64,12 +64,12 @@
     }
 #ifdef HAVE_POSIX_FILEMAP    
     if (mBasePtr && munmap(mBasePtr, mBaseLength) != 0) {
-        LOGD("munmap(%p, %d) failed\n", mBasePtr, (int) mBaseLength);
+        ALOGD("munmap(%p, %d) failed\n", mBasePtr, (int) mBaseLength);
     }
 #endif
 #ifdef HAVE_WIN32_FILEMAP
     if (mBasePtr && UnmapViewOfFile(mBasePtr) == 0) {
-        LOGD("UnmapViewOfFile(%p) failed, error = %ld\n", mBasePtr, 
+        ALOGD("UnmapViewOfFile(%p) failed, error = %ld\n", mBasePtr,
               GetLastError() );
     }
     if (mFileMapping != INVALID_HANDLE_VALUE) {
@@ -108,7 +108,7 @@
     mFileHandle  = (HANDLE) _get_osfhandle(fd);
     mFileMapping = CreateFileMapping( mFileHandle, NULL, protect, 0, 0, NULL);
     if (mFileMapping == NULL) {
-        LOGE("CreateFileMapping(%p, %lx) failed with error %ld\n",
+        ALOGE("CreateFileMapping(%p, %lx) failed with error %ld\n",
               mFileHandle, protect, GetLastError() );
         return false;
     }
@@ -123,7 +123,7 @@
                               (DWORD)(adjOffset),
                               adjLength );
     if (mBasePtr == NULL) {
-        LOGE("MapViewOfFile(%ld, %ld) failed with error %ld\n",
+        ALOGE("MapViewOfFile(%ld, %ld) failed with error %ld\n",
               adjOffset, adjLength, GetLastError() );
         CloseHandle(mFileMapping);
         mFileMapping = INVALID_HANDLE_VALUE;
@@ -147,7 +147,7 @@
 #if NOT_USING_KLIBC
         mPageSize = sysconf(_SC_PAGESIZE);
         if (mPageSize == -1) {
-            LOGE("could not get _SC_PAGESIZE\n");
+            ALOGE("could not get _SC_PAGESIZE\n");
             return false;
         }
 #else
@@ -175,7 +175,7 @@
     		goto try_again;
     	}
     
-        LOGE("mmap(%ld,%ld) failed: %s\n",
+        ALOGE("mmap(%ld,%ld) failed: %s\n",
             (long) adjOffset, (long) adjLength, strerror(errno));
         return false;
     }
@@ -190,7 +190,7 @@
 
     assert(mBasePtr != NULL);
 
-    LOGV("MAP: base %p/%d data %p/%d\n",
+    ALOGV("MAP: base %p/%d data %p/%d\n",
         mBasePtr, (int) mBaseLength, mDataPtr, (int) mDataLength);
 
     return true;
@@ -217,7 +217,7 @@
 
     cc = madvise(mBasePtr, mBaseLength, sysAdvice);
     if (cc != 0)
-        LOGW("madvise(%d) failed: %s\n", sysAdvice, strerror(errno));
+        ALOGW("madvise(%d) failed: %s\n", sysAdvice, strerror(errno));
     return cc;
 #else
 	return -1;
diff --git a/libs/utils/Looper.cpp b/libs/utils/Looper.cpp
index b54fb9d..d1aa664 100644
--- a/libs/utils/Looper.cpp
+++ b/libs/utils/Looper.cpp
@@ -163,7 +163,7 @@
         Looper::setForThread(looper);
     }
     if (looper->getAllowNonCallbacks() != allowNonCallbacks) {
-        LOGW("Looper already prepared for this thread with a different value for the "
+        ALOGW("Looper already prepared for this thread with a different value for the "
                 "ALOOPER_PREPARE_ALLOW_NON_CALLBACKS option.");
     }
     return looper;
@@ -185,7 +185,7 @@
                 int events = response.events;
                 void* data = response.request.data;
 #if DEBUG_POLL_AND_WAKE
-                LOGD("%p ~ pollOnce - returning signalled identifier %d: "
+                ALOGD("%p ~ pollOnce - returning signalled identifier %d: "
                         "fd=%d, events=0x%x, data=%p",
                         this, ident, fd, events, data);
 #endif
@@ -198,7 +198,7 @@
 
         if (result != 0) {
 #if DEBUG_POLL_AND_WAKE
-            LOGD("%p ~ pollOnce - returning result %d", this, result);
+            ALOGD("%p ~ pollOnce - returning result %d", this, result);
 #endif
             if (outFd != NULL) *outFd = 0;
             if (outEvents != NULL) *outEvents = NULL;
@@ -212,7 +212,7 @@
 
 int Looper::pollInner(int timeoutMillis) {
 #if DEBUG_POLL_AND_WAKE
-    LOGD("%p ~ pollOnce - waiting: timeoutMillis=%d", this, timeoutMillis);
+    ALOGD("%p ~ pollOnce - waiting: timeoutMillis=%d", this, timeoutMillis);
 #endif
 
     // Adjust the timeout based on when the next message is due.
@@ -224,7 +224,7 @@
             timeoutMillis = messageTimeoutMillis;
         }
 #if DEBUG_POLL_AND_WAKE
-        LOGD("%p ~ pollOnce - next message in %lldns, adjusted timeout: timeoutMillis=%d",
+        ALOGD("%p ~ pollOnce - next message in %lldns, adjusted timeout: timeoutMillis=%d",
                 this, mNextMessageUptime - now, timeoutMillis);
 #endif
     }
@@ -262,7 +262,7 @@
         if (errno == EINTR) {
             goto Done;
         }
-        LOGW("Poll failed with an unexpected error, errno=%d", errno);
+        ALOGW("Poll failed with an unexpected error, errno=%d", errno);
         result = ALOOPER_POLL_ERROR;
         goto Done;
     }
@@ -270,7 +270,7 @@
     // Check for poll timeout.
     if (eventCount == 0) {
 #if DEBUG_POLL_AND_WAKE
-        LOGD("%p ~ pollOnce - timeout", this);
+        ALOGD("%p ~ pollOnce - timeout", this);
 #endif
         result = ALOOPER_POLL_TIMEOUT;
         goto Done;
@@ -278,7 +278,7 @@
 
     // Handle all events.
 #if DEBUG_POLL_AND_WAKE
-    LOGD("%p ~ pollOnce - handling events from %d fds", this, eventCount);
+    ALOGD("%p ~ pollOnce - handling events from %d fds", this, eventCount);
 #endif
 
 #ifdef LOOPER_USES_EPOLL
@@ -289,7 +289,7 @@
             if (epollEvents & EPOLLIN) {
                 awoken();
             } else {
-                LOGW("Ignoring unexpected epoll events 0x%x on wake read pipe.", epollEvents);
+                ALOGW("Ignoring unexpected epoll events 0x%x on wake read pipe.", epollEvents);
             }
         } else {
             ssize_t requestIndex = mRequests.indexOfKey(fd);
@@ -301,7 +301,7 @@
                 if (epollEvents & EPOLLHUP) events |= ALOOPER_EVENT_HANGUP;
                 pushResponse(events, mRequests.valueAt(requestIndex));
             } else {
-                LOGW("Ignoring unexpected epoll events 0x%x on fd %d that is "
+                ALOGW("Ignoring unexpected epoll events 0x%x on fd %d that is "
                         "no longer registered.", epollEvents, fd);
             }
         }
@@ -317,7 +317,7 @@
                 if (pollEvents & POLLIN) {
                     awoken();
                 } else {
-                    LOGW("Ignoring unexpected poll events 0x%x on wake read pipe.", pollEvents);
+                    ALOGW("Ignoring unexpected poll events 0x%x on wake read pipe.", pollEvents);
                 }
             } else {
                 int events = 0;
@@ -353,7 +353,7 @@
                 - milliseconds_to_nanoseconds(timeoutMillis);
     }
     if (mSampledPolls == SAMPLED_POLLS_TO_AGGREGATE) {
-        LOGD("%p ~ poll latency statistics: %0.3fms zero timeout, %0.3fms non-zero timeout", this,
+        ALOGD("%p ~ poll latency statistics: %0.3fms zero timeout, %0.3fms non-zero timeout", this,
                 0.000001f * float(mSampledZeroPollLatencySum) / mSampledZeroPollCount,
                 0.000001f * float(mSampledTimeoutPollLatencySum) / mSampledTimeoutPollCount);
         mSampledPolls = 0;
@@ -382,7 +382,7 @@
                 mLock.unlock();
 
 #if DEBUG_POLL_AND_WAKE || DEBUG_CALLBACKS
-                LOGD("%p ~ pollOnce - sending message: handler=%p, what=%d",
+                ALOGD("%p ~ pollOnce - sending message: handler=%p, what=%d",
                         this, handler.get(), message.what);
 #endif
                 handler->handleMessage(message);
@@ -410,7 +410,7 @@
             int events = response.events;
             void* data = response.request.data;
 #if DEBUG_POLL_AND_WAKE || DEBUG_CALLBACKS
-            LOGD("%p ~ pollOnce - invoking fd event callback %p: fd=%d, events=0x%x, data=%p",
+            ALOGD("%p ~ pollOnce - invoking fd event callback %p: fd=%d, events=0x%x, data=%p",
                     this, callback, fd, events, data);
 #endif
             int callbackResult = callback(fd, events, data);
@@ -451,7 +451,7 @@
 
 void Looper::wake() {
 #if DEBUG_POLL_AND_WAKE
-    LOGD("%p ~ wake", this);
+    ALOGD("%p ~ wake", this);
 #endif
 
 #ifdef LOOPER_STATISTICS
@@ -468,19 +468,19 @@
 
     if (nWrite != 1) {
         if (errno != EAGAIN) {
-            LOGW("Could not write wake signal, errno=%d", errno);
+            ALOGW("Could not write wake signal, errno=%d", errno);
         }
     }
 }
 
 void Looper::awoken() {
 #if DEBUG_POLL_AND_WAKE
-    LOGD("%p ~ awoken", this);
+    ALOGD("%p ~ awoken", this);
 #endif
 
 #ifdef LOOPER_STATISTICS
     if (mPendingWakeCount == 0) {
-        LOGD("%p ~ awoken: spurious!", this);
+        ALOGD("%p ~ awoken: spurious!", this);
     } else {
         mSampledWakeCycles += 1;
         mSampledWakeCountSum += mPendingWakeCount;
@@ -488,7 +488,7 @@
         mPendingWakeCount = 0;
         mPendingWakeTime = -1;
         if (mSampledWakeCycles == SAMPLED_WAKE_CYCLES_TO_AGGREGATE) {
-            LOGD("%p ~ wake statistics: %0.3fms wake latency, %0.3f wakes per cycle", this,
+            ALOGD("%p ~ wake statistics: %0.3fms wake latency, %0.3f wakes per cycle", this,
                     0.000001f * float(mSampledWakeLatencySum) / mSampledWakeCycles,
                     float(mSampledWakeCountSum) / mSampledWakeCycles);
             mSampledWakeCycles = 0;
@@ -514,18 +514,18 @@
 
 int Looper::addFd(int fd, int ident, int events, ALooper_callbackFunc callback, void* data) {
 #if DEBUG_CALLBACKS
-    LOGD("%p ~ addFd - fd=%d, ident=%d, events=0x%x, callback=%p, data=%p", this, fd, ident,
+    ALOGD("%p ~ addFd - fd=%d, ident=%d, events=0x%x, callback=%p, data=%p", this, fd, ident,
             events, callback, data);
 #endif
 
     if (! callback) {
         if (! mAllowNonCallbacks) {
-            LOGE("Invalid attempt to set NULL callback but not allowed for this looper.");
+            ALOGE("Invalid attempt to set NULL callback but not allowed for this looper.");
             return -1;
         }
 
         if (ident < 0) {
-            LOGE("Invalid attempt to set NULL callback with ident <= 0.");
+            ALOGE("Invalid attempt to set NULL callback with ident <= 0.");
             return -1;
         }
     }
@@ -553,14 +553,14 @@
         if (requestIndex < 0) {
             int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, fd, & eventItem);
             if (epollResult < 0) {
-                LOGE("Error adding epoll events for fd %d, errno=%d", fd, errno);
+                ALOGE("Error adding epoll events for fd %d, errno=%d", fd, errno);
                 return -1;
             }
             mRequests.add(fd, request);
         } else {
             int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_MOD, fd, & eventItem);
             if (epollResult < 0) {
-                LOGE("Error modifying epoll events for fd %d, errno=%d", fd, errno);
+                ALOGE("Error modifying epoll events for fd %d, errno=%d", fd, errno);
                 return -1;
             }
             mRequests.replaceValueAt(requestIndex, request);
@@ -598,7 +598,7 @@
 
 int Looper::removeFd(int fd) {
 #if DEBUG_CALLBACKS
-    LOGD("%p ~ removeFd - fd=%d", this, fd);
+    ALOGD("%p ~ removeFd - fd=%d", this, fd);
 #endif
 
 #ifdef LOOPER_USES_EPOLL
@@ -611,7 +611,7 @@
 
         int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_DEL, fd, NULL);
         if (epollResult < 0) {
-            LOGE("Error removing epoll events for fd %d, errno=%d", fd, errno);
+            ALOGE("Error removing epoll events for fd %d, errno=%d", fd, errno);
             return -1;
         }
 
@@ -675,7 +675,7 @@
 void Looper::sendMessageAtTime(nsecs_t uptime, const sp<MessageHandler>& handler,
         const Message& message) {
 #if DEBUG_CALLBACKS
-    LOGD("%p ~ sendMessageAtTime - uptime=%lld, handler=%p, what=%d",
+    ALOGD("%p ~ sendMessageAtTime - uptime=%lld, handler=%p, what=%d",
             this, uptime, handler.get(), message.what);
 #endif
 
@@ -708,7 +708,7 @@
 
 void Looper::removeMessages(const sp<MessageHandler>& handler) {
 #if DEBUG_CALLBACKS
-    LOGD("%p ~ removeMessages - handler=%p", this, handler.get());
+    ALOGD("%p ~ removeMessages - handler=%p", this, handler.get());
 #endif
 
     { // acquire lock
@@ -725,7 +725,7 @@
 
 void Looper::removeMessages(const sp<MessageHandler>& handler, int what) {
 #if DEBUG_CALLBACKS
-    LOGD("%p ~ removeMessages - handler=%p, what=%d", this, handler.get(), what);
+    ALOGD("%p ~ removeMessages - handler=%p, what=%d", this, handler.get(), what);
 #endif
 
     { // acquire lock
diff --git a/libs/utils/ObbFile.cpp b/libs/utils/ObbFile.cpp
index 2907b56..ddf5991 100644
--- a/libs/utils/ObbFile.cpp
+++ b/libs/utils/ObbFile.cpp
@@ -90,14 +90,14 @@
 
     fd = ::open(filename, O_RDONLY);
     if (fd < 0) {
-        LOGW("couldn't open file %s: %s", filename, strerror(errno));
+        ALOGW("couldn't open file %s: %s", filename, strerror(errno));
         goto out;
     }
     success = readFrom(fd);
     close(fd);
 
     if (!success) {
-        LOGW("failed to read from %s (fd=%d)\n", filename, fd);
+        ALOGW("failed to read from %s (fd=%d)\n", filename, fd);
     }
 
 out:
@@ -107,7 +107,7 @@
 bool ObbFile::readFrom(int fd)
 {
     if (fd < 0) {
-        LOGW("attempt to read from invalid fd\n");
+        ALOGW("attempt to read from invalid fd\n");
         return false;
     }
 
@@ -120,9 +120,9 @@
 
     if (fileLength < kFooterMinSize) {
         if (fileLength < 0) {
-            LOGW("error seeking in ObbFile: %s\n", strerror(errno));
+            ALOGW("error seeking in ObbFile: %s\n", strerror(errno));
         } else {
-            LOGW("file is only %lld (less than %d minimum)\n", fileLength, kFooterMinSize);
+            ALOGW("file is only %lld (less than %d minimum)\n", fileLength, kFooterMinSize);
         }
         return false;
     }
@@ -136,13 +136,13 @@
         char *footer = new char[kFooterTagSize];
         actual = TEMP_FAILURE_RETRY(read(fd, footer, kFooterTagSize));
         if (actual != kFooterTagSize) {
-            LOGW("couldn't read footer signature: %s\n", strerror(errno));
+            ALOGW("couldn't read footer signature: %s\n", strerror(errno));
             return false;
         }
 
         unsigned int fileSig = get4LE((unsigned char*)footer + sizeof(int32_t));
         if (fileSig != kSignature) {
-            LOGW("footer didn't match magic string (expected 0x%08x; got 0x%08x)\n",
+            ALOGW("footer didn't match magic string (expected 0x%08x; got 0x%08x)\n",
                     kSignature, fileSig);
             return false;
         }
@@ -150,13 +150,13 @@
         footerSize = get4LE((unsigned char*)footer);
         if (footerSize > (size_t)fileLength - kFooterTagSize
                 || footerSize > kMaxBufSize) {
-            LOGW("claimed footer size is too large (0x%08zx; file size is 0x%08llx)\n",
+            ALOGW("claimed footer size is too large (0x%08zx; file size is 0x%08llx)\n",
                     footerSize, fileLength);
             return false;
         }
 
         if (footerSize < (kFooterMinSize - kFooterTagSize)) {
-            LOGW("claimed footer size is too small (0x%zx; minimum size is 0x%x)\n",
+            ALOGW("claimed footer size is too small (0x%zx; minimum size is 0x%x)\n",
                     footerSize, kFooterMinSize - kFooterTagSize);
             return false;
         }
@@ -164,7 +164,7 @@
 
     off64_t fileOffset = fileLength - footerSize - kFooterTagSize;
     if (lseek64(fd, fileOffset, SEEK_SET) != fileOffset) {
-        LOGW("seek %lld failed: %s\n", fileOffset, strerror(errno));
+        ALOGW("seek %lld failed: %s\n", fileOffset, strerror(errno));
         return false;
     }
 
@@ -172,27 +172,27 @@
 
     char* scanBuf = (char*)malloc(footerSize);
     if (scanBuf == NULL) {
-        LOGW("couldn't allocate scanBuf: %s\n", strerror(errno));
+        ALOGW("couldn't allocate scanBuf: %s\n", strerror(errno));
         return false;
     }
 
     actual = TEMP_FAILURE_RETRY(read(fd, scanBuf, footerSize));
     // readAmount is guaranteed to be less than kMaxBufSize
     if (actual != (ssize_t)footerSize) {
-        LOGI("couldn't read ObbFile footer: %s\n", strerror(errno));
+        ALOGI("couldn't read ObbFile footer: %s\n", strerror(errno));
         free(scanBuf);
         return false;
     }
 
 #ifdef DEBUG
     for (int i = 0; i < footerSize; ++i) {
-        LOGI("char: 0x%02x\n", scanBuf[i]);
+        ALOGI("char: 0x%02x\n", scanBuf[i]);
     }
 #endif
 
     uint32_t sigVersion = get4LE((unsigned char*)scanBuf);
     if (sigVersion != kSigVersion) {
-        LOGW("Unsupported ObbFile version %d\n", sigVersion);
+        ALOGW("Unsupported ObbFile version %d\n", sigVersion);
         free(scanBuf);
         return false;
     }
@@ -205,7 +205,7 @@
     size_t packageNameLen = get4LE((unsigned char*)scanBuf + kPackageNameLenOffset);
     if (packageNameLen == 0
             || packageNameLen > (footerSize - kPackageNameOffset)) {
-        LOGW("bad ObbFile package name length (0x%04zx; 0x%04zx possible)\n",
+        ALOGW("bad ObbFile package name length (0x%04zx; 0x%04zx possible)\n",
                 packageNameLen, footerSize - kPackageNameOffset);
         free(scanBuf);
         return false;
@@ -217,7 +217,7 @@
     free(scanBuf);
 
 #ifdef DEBUG
-    LOGI("Obb scan succeeded: packageName=%s, version=%d\n", mPackageName.string(), mVersion);
+    ALOGI("Obb scan succeeded: packageName=%s, version=%d\n", mPackageName.string(), mVersion);
 #endif
 
     return true;
@@ -237,7 +237,7 @@
 
 out:
     if (!success) {
-        LOGW("failed to write to %s: %s\n", filename, strerror(errno));
+        ALOGW("failed to write to %s: %s\n", filename, strerror(errno));
     }
     return success;
 }
@@ -251,7 +251,7 @@
     lseek64(fd, 0, SEEK_END);
 
     if (mPackageName.size() == 0 || mVersion == -1) {
-        LOGW("tried to write uninitialized ObbFile data\n");
+        ALOGW("tried to write uninitialized ObbFile data\n");
         return false;
     }
 
@@ -260,48 +260,48 @@
 
     put4LE(intBuf, kSigVersion);
     if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) {
-        LOGW("couldn't write signature version: %s\n", strerror(errno));
+        ALOGW("couldn't write signature version: %s\n", strerror(errno));
         return false;
     }
 
     put4LE(intBuf, mVersion);
     if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) {
-        LOGW("couldn't write package version\n");
+        ALOGW("couldn't write package version\n");
         return false;
     }
 
     put4LE(intBuf, mFlags);
     if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) {
-        LOGW("couldn't write package version\n");
+        ALOGW("couldn't write package version\n");
         return false;
     }
 
     if (write(fd, mSalt, sizeof(mSalt)) != (ssize_t)sizeof(mSalt)) {
-        LOGW("couldn't write salt: %s\n", strerror(errno));
+        ALOGW("couldn't write salt: %s\n", strerror(errno));
         return false;
     }
 
     size_t packageNameLen = mPackageName.size();
     put4LE(intBuf, packageNameLen);
     if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) {
-        LOGW("couldn't write package name length: %s\n", strerror(errno));
+        ALOGW("couldn't write package name length: %s\n", strerror(errno));
         return false;
     }
 
     if (write(fd, mPackageName.string(), packageNameLen) != (ssize_t)packageNameLen) {
-        LOGW("couldn't write package name: %s\n", strerror(errno));
+        ALOGW("couldn't write package name: %s\n", strerror(errno));
         return false;
     }
 
     put4LE(intBuf, kPackageNameOffset + packageNameLen);
     if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) {
-        LOGW("couldn't write footer size: %s\n", strerror(errno));
+        ALOGW("couldn't write footer size: %s\n", strerror(errno));
         return false;
     }
 
     put4LE(intBuf, kSignature);
     if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) {
-        LOGW("couldn't write footer magic signature: %s\n", strerror(errno));
+        ALOGW("couldn't write footer magic signature: %s\n", strerror(errno));
         return false;
     }
 
@@ -322,7 +322,7 @@
 
 out:
     if (!success) {
-        LOGW("failed to remove signature from %s: %s\n", filename, strerror(errno));
+        ALOGW("failed to remove signature from %s: %s\n", filename, strerror(errno));
     }
     return success;
 }
diff --git a/libs/utils/PropertyMap.cpp b/libs/utils/PropertyMap.cpp
index d472d45..5520702 100644
--- a/libs/utils/PropertyMap.cpp
+++ b/libs/utils/PropertyMap.cpp
@@ -84,7 +84,7 @@
     char* end;
     int value = strtol(stringValue.string(), & end, 10);
     if (*end != '\0') {
-        LOGW("Property key '%s' has invalid value '%s'.  Expected an integer.",
+        ALOGW("Property key '%s' has invalid value '%s'.  Expected an integer.",
                 key.string(), stringValue.string());
         return false;
     }
@@ -101,7 +101,7 @@
     char* end;
     float value = strtof(stringValue.string(), & end);
     if (*end != '\0') {
-        LOGW("Property key '%s' has invalid value '%s'.  Expected a float.",
+        ALOGW("Property key '%s' has invalid value '%s'.  Expected a float.",
                 key.string(), stringValue.string());
         return false;
     }
@@ -121,11 +121,11 @@
     Tokenizer* tokenizer;
     status_t status = Tokenizer::open(filename, &tokenizer);
     if (status) {
-        LOGE("Error %d opening property file %s.", status, filename.string());
+        ALOGE("Error %d opening property file %s.", status, filename.string());
     } else {
         PropertyMap* map = new PropertyMap();
         if (!map) {
-            LOGE("Error allocating property map.");
+            ALOGE("Error allocating property map.");
             status = NO_MEMORY;
         } else {
 #if DEBUG_PARSER_PERFORMANCE
@@ -135,7 +135,7 @@
             status = parser.parse();
 #if DEBUG_PARSER_PERFORMANCE
             nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime;
-            LOGD("Parsed property file '%s' %d lines in %0.3fms.",
+            ALOGD("Parsed property file '%s' %d lines in %0.3fms.",
                     tokenizer->getFilename().string(), tokenizer->getLineNumber(),
                     elapsedTime / 1000000.0);
 #endif
@@ -163,7 +163,7 @@
 status_t PropertyMap::Parser::parse() {
     while (!mTokenizer->isEof()) {
 #if DEBUG_PARSER
-        LOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(),
+        ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(),
                 mTokenizer->peekRemainderOfLine().string());
 #endif
 
@@ -172,14 +172,14 @@
         if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') {
             String8 keyToken = mTokenizer->nextToken(WHITESPACE_OR_PROPERTY_DELIMITER);
             if (keyToken.isEmpty()) {
-                LOGE("%s: Expected non-empty property key.", mTokenizer->getLocation().string());
+                ALOGE("%s: Expected non-empty property key.", mTokenizer->getLocation().string());
                 return BAD_VALUE;
             }
 
             mTokenizer->skipDelimiters(WHITESPACE);
 
             if (mTokenizer->nextChar() != '=') {
-                LOGE("%s: Expected '=' between property key and value.",
+                ALOGE("%s: Expected '=' between property key and value.",
                         mTokenizer->getLocation().string());
                 return BAD_VALUE;
             }
@@ -188,21 +188,21 @@
 
             String8 valueToken = mTokenizer->nextToken(WHITESPACE);
             if (valueToken.find("\\", 0) >= 0 || valueToken.find("\"", 0) >= 0) {
-                LOGE("%s: Found reserved character '\\' or '\"' in property value.",
+                ALOGE("%s: Found reserved character '\\' or '\"' in property value.",
                         mTokenizer->getLocation().string());
                 return BAD_VALUE;
             }
 
             mTokenizer->skipDelimiters(WHITESPACE);
             if (!mTokenizer->isEol()) {
-                LOGE("%s: Expected end of line, got '%s'.",
+                ALOGE("%s: Expected end of line, got '%s'.",
                         mTokenizer->getLocation().string(),
                         mTokenizer->peekRemainderOfLine().string());
                 return BAD_VALUE;
             }
 
             if (mMap->hasProperty(keyToken)) {
-                LOGE("%s: Duplicate property value for key '%s'.",
+                ALOGE("%s: Duplicate property value for key '%s'.",
                         mTokenizer->getLocation().string(), keyToken.string());
                 return BAD_VALUE;
             }
diff --git a/libs/utils/RefBase.cpp b/libs/utils/RefBase.cpp
index 37d061c..e80a795 100644
--- a/libs/utils/RefBase.cpp
+++ b/libs/utils/RefBase.cpp
@@ -98,12 +98,12 @@
 #if DEBUG_REFS_FATAL_SANITY_CHECKS
             LOG_ALWAYS_FATAL("Strong references remain!");
 #else
-            LOGE("Strong references remain:");
+            ALOGE("Strong references remain:");
 #endif
             ref_entry* refs = mStrongRefs;
             while (refs) {
                 char inc = refs->ref >= 0 ? '+' : '-';
-                LOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref);
+                ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref);
 #if DEBUG_REFS_CALLSTACK_ENABLED
                 refs->stack.dump();
 #endif
@@ -116,12 +116,12 @@
 #if DEBUG_REFS_FATAL_SANITY_CHECKS
             LOG_ALWAYS_FATAL("Weak references remain:");
 #else
-            LOGE("Weak references remain!");
+            ALOGE("Weak references remain!");
 #endif
             ref_entry* refs = mWeakRefs;
             while (refs) {
                 char inc = refs->ref >= 0 ? '+' : '-';
-                LOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref);
+                ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref);
 #if DEBUG_REFS_CALLSTACK_ENABLED
                 refs->stack.dump();
 #endif
@@ -129,7 +129,7 @@
             }
         }
         if (dumpStack) {
-            LOGE("above errors at:");
+            ALOGE("above errors at:");
             CallStack stack;
             stack.update();
             stack.dump();
@@ -137,13 +137,13 @@
     }
 
     void addStrongRef(const void* id) {
-        //LOGD_IF(mTrackEnabled,
+        //ALOGD_IF(mTrackEnabled,
         //        "addStrongRef: RefBase=%p, id=%p", mBase, id);
         addRef(&mStrongRefs, id, mStrong);
     }
 
     void removeStrongRef(const void* id) {
-        //LOGD_IF(mTrackEnabled,
+        //ALOGD_IF(mTrackEnabled,
         //        "removeStrongRef: RefBase=%p, id=%p", mBase, id);
         if (!mRetain) {
             removeRef(&mStrongRefs, id);
@@ -153,7 +153,7 @@
     }
 
     void renameStrongRefId(const void* old_id, const void* new_id) {
-        //LOGD_IF(mTrackEnabled,
+        //ALOGD_IF(mTrackEnabled,
         //        "renameStrongRefId: RefBase=%p, oid=%p, nid=%p",
         //        mBase, old_id, new_id);
         renameRefsId(mStrongRefs, old_id, new_id);
@@ -203,9 +203,9 @@
             if (rc >= 0) {
                 write(rc, text.string(), text.length());
                 close(rc);
-                LOGD("STACK TRACE for %p saved in %s", this, name);
+                ALOGD("STACK TRACE for %p saved in %s", this, name);
             }
-            else LOGE("FAILED TO PRINT STACK TRACE for %p in %s: %s", this,
+            else ALOGE("FAILED TO PRINT STACK TRACE for %p in %s: %s", this,
                       name, strerror(errno));
         }
     }
@@ -263,14 +263,14 @@
                     id, mBase, this);
 #endif
 
-            LOGE("RefBase: removing id %p on RefBase %p"
+            ALOGE("RefBase: removing id %p on RefBase %p"
                     "(weakref_type %p) that doesn't exist!",
                     id, mBase, this);
 
             ref = head;
             while (ref) {
                 char inc = ref->ref >= 0 ? '+' : '-';
-                LOGD("\t%c ID %p (ref %d):", inc, ref->id, ref->ref);
+                ALOGD("\t%c ID %p (ref %d):", inc, ref->id, ref->ref);
                 ref = ref->next;
             }
 
@@ -332,9 +332,9 @@
     
     refs->addStrongRef(id);
     const int32_t c = android_atomic_inc(&refs->mStrong);
-    LOG_ASSERT(c > 0, "incStrong() called on %p after last strong ref", refs);
+    ALOG_ASSERT(c > 0, "incStrong() called on %p after last strong ref", refs);
 #if PRINT_REFS
-    LOGD("incStrong of %p from %p: cnt=%d\n", this, id, c);
+    ALOGD("incStrong of %p from %p: cnt=%d\n", this, id, c);
 #endif
     if (c != INITIAL_STRONG_VALUE)  {
         return;
@@ -350,9 +350,9 @@
     refs->removeStrongRef(id);
     const int32_t c = android_atomic_dec(&refs->mStrong);
 #if PRINT_REFS
-    LOGD("decStrong of %p from %p: cnt=%d\n", this, id, c);
+    ALOGD("decStrong of %p from %p: cnt=%d\n", this, id, c);
 #endif
-    LOG_ASSERT(c >= 1, "decStrong() called on %p too many times", refs);
+    ALOG_ASSERT(c >= 1, "decStrong() called on %p too many times", refs);
     if (c == 1) {
         refs->mBase->onLastStrongRef(id);
         if ((refs->mFlags&OBJECT_LIFETIME_MASK) == OBJECT_LIFETIME_STRONG) {
@@ -369,10 +369,10 @@
     
     refs->addStrongRef(id);
     const int32_t c = android_atomic_inc(&refs->mStrong);
-    LOG_ASSERT(c >= 0, "forceIncStrong called on %p after ref count underflow",
+    ALOG_ASSERT(c >= 0, "forceIncStrong called on %p after ref count underflow",
                refs);
 #if PRINT_REFS
-    LOGD("forceIncStrong of %p from %p: cnt=%d\n", this, id, c);
+    ALOGD("forceIncStrong of %p from %p: cnt=%d\n", this, id, c);
 #endif
 
     switch (c) {
@@ -399,7 +399,7 @@
     weakref_impl* const impl = static_cast<weakref_impl*>(this);
     impl->addWeakRef(id);
     const int32_t c = android_atomic_inc(&impl->mWeak);
-    LOG_ASSERT(c >= 0, "incWeak called on %p after last weak ref", this);
+    ALOG_ASSERT(c >= 0, "incWeak called on %p after last weak ref", this);
 }
 
 
@@ -408,7 +408,7 @@
     weakref_impl* const impl = static_cast<weakref_impl*>(this);
     impl->removeWeakRef(id);
     const int32_t c = android_atomic_dec(&impl->mWeak);
-    LOG_ASSERT(c >= 1, "decWeak called on %p too many times", this);
+    ALOG_ASSERT(c >= 1, "decWeak called on %p too many times", this);
     if (c != 1) return;
 
     if ((impl->mFlags&OBJECT_LIFETIME_WEAK) == OBJECT_LIFETIME_STRONG) {
@@ -421,7 +421,7 @@
             // destroy the object now.
             delete impl->mBase;
         } else {
-            // LOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase);
+            // ALOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase);
             delete impl;
         }
     } else {
@@ -442,7 +442,7 @@
     weakref_impl* const impl = static_cast<weakref_impl*>(this);
     
     int32_t curCount = impl->mStrong;
-    LOG_ASSERT(curCount >= 0, "attemptIncStrong called on %p after underflow",
+    ALOG_ASSERT(curCount >= 0, "attemptIncStrong called on %p after underflow",
                this);
     while (curCount > 0 && curCount != INITIAL_STRONG_VALUE) {
         if (android_atomic_cmpxchg(curCount, curCount+1, &impl->mStrong) == 0) {
@@ -487,7 +487,7 @@
     impl->addStrongRef(id);
 
 #if PRINT_REFS
-    LOGD("attemptIncStrong of %p from %p: cnt=%d\n", this, id, curCount);
+    ALOGD("attemptIncStrong of %p from %p: cnt=%d\n", this, id, curCount);
 #endif
 
     if (curCount == INITIAL_STRONG_VALUE) {
@@ -503,7 +503,7 @@
     weakref_impl* const impl = static_cast<weakref_impl*>(this);
 
     int32_t curCount = impl->mWeak;
-    LOG_ASSERT(curCount >= 0, "attemptIncWeak called on %p after underflow",
+    ALOG_ASSERT(curCount >= 0, "attemptIncWeak called on %p after underflow",
                this);
     while (curCount > 0) {
         if (android_atomic_cmpxchg(curCount, curCount+1, &impl->mWeak) == 0) {
diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp
index 6cf01c8..15b83bb 100644
--- a/libs/utils/ResourceTypes.cpp
+++ b/libs/utils/ResourceTypes.cpp
@@ -69,7 +69,7 @@
 
 static void printToLogFunc(void* cookie, const char* txt)
 {
-    LOGV("%s", txt);
+    ALOGV("%s", txt);
 }
 
 // Standard C isspace() is only required to look at the low byte of its input, so
@@ -107,20 +107,20 @@
                 if ((ssize_t)size <= (dataEnd-((const uint8_t*)chunk))) {
                     return NO_ERROR;
                 }
-                LOGW("%s data size %p extends beyond resource end %p.",
+                ALOGW("%s data size %p extends beyond resource end %p.",
                      name, (void*)size,
                      (void*)(dataEnd-((const uint8_t*)chunk)));
                 return BAD_TYPE;
             }
-            LOGW("%s size 0x%x or headerSize 0x%x is not on an integer boundary.",
+            ALOGW("%s size 0x%x or headerSize 0x%x is not on an integer boundary.",
                  name, (int)size, (int)headerSize);
             return BAD_TYPE;
         }
-        LOGW("%s size %p is smaller than header size %p.",
+        ALOGW("%s size %p is smaller than header size %p.",
              name, (void*)size, (void*)(int)headerSize);
         return BAD_TYPE;
     }
-    LOGW("%s header size %p is too small.",
+    ALOGW("%s header size %p is too small.",
          name, (void*)(int)headerSize);
     return BAD_TYPE;
 }
@@ -221,11 +221,11 @@
 static bool assertIdmapHeader(const uint32_t* map, size_t sizeBytes)
 {
     if (sizeBytes < ResTable::IDMAP_HEADER_SIZE_BYTES) {
-        LOGW("idmap assertion failed: size=%d bytes\n", sizeBytes);
+        ALOGW("idmap assertion failed: size=%d bytes\n", sizeBytes);
         return false;
     }
     if (*map != htodl(IDMAP_MAGIC)) { // htodl: map data expected to be in correct endianess
-        LOGW("idmap assertion failed: invalid magic found (is 0x%08x, expected 0x%08x)\n",
+        ALOGW("idmap assertion failed: invalid magic found (is 0x%08x, expected 0x%08x)\n",
              *map, htodl(IDMAP_MAGIC));
         return false;
     }
@@ -246,11 +246,11 @@
     const uint32_t typeCount = *map;
 
     if (type > typeCount) {
-        LOGW("Resource ID map: type=%d exceeds number of types=%d\n", type, typeCount);
+        ALOGW("Resource ID map: type=%d exceeds number of types=%d\n", type, typeCount);
         return UNKNOWN_ERROR;
     }
     if (typeCount > size) {
-        LOGW("Resource ID map: number of types=%d exceeds size of map=%d\n", typeCount, size);
+        ALOGW("Resource ID map: number of types=%d exceeds size of map=%d\n", typeCount, size);
         return UNKNOWN_ERROR;
     }
     const uint32_t typeOffset = map[type];
@@ -259,7 +259,7 @@
         return NO_ERROR;
     }
     if (typeOffset + 1 > size) {
-        LOGW("Resource ID map: type offset=%d exceeds reasonable value, size of map=%d\n",
+        ALOGW("Resource ID map: type offset=%d exceeds reasonable value, size of map=%d\n",
              typeOffset, size);
         return UNKNOWN_ERROR;
     }
@@ -271,7 +271,7 @@
     }
     const uint32_t index = typeOffset + 2 + entry - entryOffset;
     if (index > size) {
-        LOGW("Resource ID map: entry index=%d exceeds size of map=%d\n", index, size);
+        ALOGW("Resource ID map: entry index=%d exceeds size of map=%d\n", index, size);
         *outValue = 0;
         return NO_ERROR;
     }
@@ -296,7 +296,7 @@
 Res_png_9patch* Res_png_9patch::deserialize(const void* inData)
 {
     if (sizeof(void*) != sizeof(int32_t)) {
-        LOGE("Cannot deserialize on non 32-bit system\n");
+        ALOGE("Cannot deserialize on non 32-bit system\n");
         return NULL;
     }
     deserializeInternal(inData, (Res_png_9patch*) inData);
@@ -358,7 +358,7 @@
 
     if (mHeader->header.headerSize > mHeader->header.size
             || mHeader->header.size > size) {
-        LOGW("Bad string block: header size %d or total size %d is larger than data size %d\n",
+        ALOGW("Bad string block: header size %d or total size %d is larger than data size %d\n",
                 (int)mHeader->header.headerSize, (int)mHeader->header.size, (int)size);
         return (mError=BAD_TYPE);
     }
@@ -370,7 +370,7 @@
         if ((mHeader->stringCount*sizeof(uint32_t) < mHeader->stringCount)  // uint32 overflow?
             || (mHeader->header.headerSize+(mHeader->stringCount*sizeof(uint32_t)))
                 > size) {
-            LOGW("Bad string block: entry of %d items extends past data size %d\n",
+            ALOGW("Bad string block: entry of %d items extends past data size %d\n",
                     (int)(mHeader->header.headerSize+(mHeader->stringCount*sizeof(uint32_t))),
                     (int)size);
             return (mError=BAD_TYPE);
@@ -388,7 +388,7 @@
         mStrings = (const void*)
             (((const uint8_t*)data)+mHeader->stringsStart);
         if (mHeader->stringsStart >= (mHeader->header.size-sizeof(uint16_t))) {
-            LOGW("Bad string block: string pool starts at %d, after total size %d\n",
+            ALOGW("Bad string block: string pool starts at %d, after total size %d\n",
                     (int)mHeader->stringsStart, (int)mHeader->header.size);
             return (mError=BAD_TYPE);
         }
@@ -398,13 +398,13 @@
         } else {
             // check invariant: styles starts before end of data
             if (mHeader->stylesStart >= (mHeader->header.size-sizeof(uint16_t))) {
-                LOGW("Bad style block: style block starts at %d past data size of %d\n",
+                ALOGW("Bad style block: style block starts at %d past data size of %d\n",
                     (int)mHeader->stylesStart, (int)mHeader->header.size);
                 return (mError=BAD_TYPE);
             }
             // check invariant: styles follow the strings
             if (mHeader->stylesStart <= mHeader->stringsStart) {
-                LOGW("Bad style block: style block starts at %d, before strings at %d\n",
+                ALOGW("Bad style block: style block starts at %d, before strings at %d\n",
                     (int)mHeader->stylesStart, (int)mHeader->stringsStart);
                 return (mError=BAD_TYPE);
             }
@@ -414,7 +414,7 @@
 
         // check invariant: stringCount > 0 requires a string pool to exist
         if (mStringPoolSize == 0) {
-            LOGW("Bad string block: stringCount is %d but pool size is 0\n", (int)mHeader->stringCount);
+            ALOGW("Bad string block: stringCount is %d but pool size is 0\n", (int)mHeader->stringCount);
             return (mError=BAD_TYPE);
         }
 
@@ -437,7 +437,7 @@
                 ((uint8_t*)mStrings)[mStringPoolSize-1] != 0) ||
                 (!mHeader->flags&ResStringPool_header::UTF8_FLAG &&
                 ((char16_t*)mStrings)[mStringPoolSize-1] != 0)) {
-            LOGW("Bad string block: last string is not 0-terminated\n");
+            ALOGW("Bad string block: last string is not 0-terminated\n");
             return (mError=BAD_TYPE);
         }
     } else {
@@ -449,12 +449,12 @@
         mEntryStyles = mEntries + mHeader->stringCount;
         // invariant: integer overflow in calculating mEntryStyles
         if (mEntryStyles < mEntries) {
-            LOGW("Bad string block: integer overflow finding styles\n");
+            ALOGW("Bad string block: integer overflow finding styles\n");
             return (mError=BAD_TYPE);
         }
 
         if (((const uint8_t*)mEntryStyles-(const uint8_t*)mHeader) > (int)size) {
-            LOGW("Bad string block: entry of %d styles extends past data size %d\n",
+            ALOGW("Bad string block: entry of %d styles extends past data size %d\n",
                     (int)((const uint8_t*)mEntryStyles-(const uint8_t*)mHeader),
                     (int)size);
             return (mError=BAD_TYPE);
@@ -462,7 +462,7 @@
         mStyles = (const uint32_t*)
             (((const uint8_t*)data)+mHeader->stylesStart);
         if (mHeader->stylesStart >= mHeader->header.size) {
-            LOGW("Bad string block: style pool starts %d, after total size %d\n",
+            ALOGW("Bad string block: style pool starts %d, after total size %d\n",
                     (int)mHeader->stylesStart, (int)mHeader->header.size);
             return (mError=BAD_TYPE);
         }
@@ -487,7 +487,7 @@
         };
         if (memcmp(&mStyles[mStylePoolSize-(sizeof(endSpan)/sizeof(uint32_t))],
                    &endSpan, sizeof(endSpan)) != 0) {
-            LOGW("Bad string block: last style is not 0xFFFFFFFF-terminated\n");
+            ALOGW("Bad string block: last style is not 0xFFFFFFFF-terminated\n");
             return (mError=BAD_TYPE);
         }
     } else {
@@ -581,7 +581,7 @@
                 if ((uint32_t)(str+*u16len-strings) < mStringPoolSize) {
                     return str;
                 } else {
-                    LOGW("Bad string block: string #%d extends to %d, past end at %d\n",
+                    ALOGW("Bad string block: string #%d extends to %d, past end at %d\n",
                             (int)idx, (int)(str+*u16len-strings), (int)mStringPoolSize);
                 }
             } else {
@@ -601,7 +601,7 @@
 
                     ssize_t actualLen = utf8_to_utf16_length(u8str, u8len);
                     if (actualLen < 0 || (size_t)actualLen != *u16len) {
-                        LOGW("Bad string block: string #%lld decoded length is not correct "
+                        ALOGW("Bad string block: string #%lld decoded length is not correct "
                                 "%lld vs %llu\n",
                                 (long long)idx, (long long)actualLen, (long long)*u16len);
                         return NULL;
@@ -609,7 +609,7 @@
 
                     char16_t *u16str = (char16_t *)calloc(*u16len+1, sizeof(char16_t));
                     if (!u16str) {
-                        LOGW("No memory when trying to allocate decode cache for string #%d\n",
+                        ALOGW("No memory when trying to allocate decode cache for string #%d\n",
                                 (int)idx);
                         return NULL;
                     }
@@ -618,13 +618,13 @@
                     mCache[idx] = u16str;
                     return u16str;
                 } else {
-                    LOGW("Bad string block: string #%lld extends to %lld, past end at %lld\n",
+                    ALOGW("Bad string block: string #%lld extends to %lld, past end at %lld\n",
                             (long long)idx, (long long)(u8str+u8len-strings),
                             (long long)mStringPoolSize);
                 }
             }
         } else {
-            LOGW("Bad string block: string #%d entry is at %d, past end at %d\n",
+            ALOGW("Bad string block: string #%d entry is at %d, past end at %d\n",
                     (int)idx, (int)(off*sizeof(uint16_t)),
                     (int)(mStringPoolSize*sizeof(uint16_t)));
         }
@@ -646,12 +646,12 @@
                 if ((uint32_t)(str+encLen-strings) < mStringPoolSize) {
                     return (const char*)str;
                 } else {
-                    LOGW("Bad string block: string #%d extends to %d, past end at %d\n",
+                    ALOGW("Bad string block: string #%d extends to %d, past end at %d\n",
                             (int)idx, (int)(str+encLen-strings), (int)mStringPoolSize);
                 }
             }
         } else {
-            LOGW("Bad string block: string #%d entry is at %d, past end at %d\n",
+            ALOGW("Bad string block: string #%d entry is at %d, past end at %d\n",
                     (int)idx, (int)(off*sizeof(uint16_t)),
                     (int)(mStringPoolSize*sizeof(uint16_t)));
         }
@@ -671,7 +671,7 @@
         if (off < mStylePoolSize) {
             return (const ResStringPool_span*)(mStyles+off);
         } else {
-            LOGW("Bad string block: style #%d entry is at %d, past end at %d\n",
+            ALOGW("Bad string block: style #%d entry is at %d, past end at %d\n",
                     (int)idx, (int)(off*sizeof(uint32_t)),
                     (int)(mStylePoolSize*sizeof(uint32_t)));
         }
@@ -1087,7 +1087,7 @@
     do {
         const ResXMLTree_node* next = (const ResXMLTree_node*)
             (((const uint8_t*)mCurNode) + dtohl(mCurNode->header.size));
-        //LOGW("Next node: prev=%p, next=%p\n", mCurNode, next);
+        //ALOGW("Next node: prev=%p, next=%p\n", mCurNode, next);
         
         if (((const uint8_t*)next) >= mTree.mDataEnd) {
             mCurNode = NULL;
@@ -1120,14 +1120,14 @@
                 minExtSize = sizeof(ResXMLTree_cdataExt);
                 break;
             default:
-                LOGW("Unknown XML block: header type %d in node at %d\n",
+                ALOGW("Unknown XML block: header type %d in node at %d\n",
                      (int)dtohs(next->header.type),
                      (int)(((const uint8_t*)next)-((const uint8_t*)mTree.mHeader)));
                 continue;
         }
         
         if ((totalSize-headerSize) < minExtSize) {
-            LOGW("Bad XML block: header type 0x%x in node at 0x%x has size %d, need %d\n",
+            ALOGW("Bad XML block: header type 0x%x in node at 0x%x has size %d, need %d\n",
                  (int)dtohs(next->header.type),
                  (int)(((const uint8_t*)next)-((const uint8_t*)mTree.mHeader)),
                  (int)(totalSize-headerSize), (int)minExtSize);
@@ -1164,7 +1164,7 @@
     : ResXMLParser(*this)
     , mError(NO_INIT), mOwnedData(NULL)
 {
-    //LOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1);
+    //ALOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1);
     restart();
 }
 
@@ -1172,13 +1172,13 @@
     : ResXMLParser(*this)
     , mError(NO_INIT), mOwnedData(NULL)
 {
-    //LOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1);
+    //ALOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1);
     setTo(data, size, copyData);
 }
 
 ResXMLTree::~ResXMLTree()
 {
-    //LOGI("Destroying ResXMLTree in %p #%d\n", this, android_atomic_dec(&gCount)-1);
+    //ALOGI("Destroying ResXMLTree in %p #%d\n", this, android_atomic_dec(&gCount)-1);
     uninit();
 }
 
@@ -1199,7 +1199,7 @@
     mHeader = (const ResXMLTree_header*)data;
     mSize = dtohl(mHeader->header.size);
     if (dtohs(mHeader->header.headerSize) > mSize || mSize > size) {
-        LOGW("Bad XML block: header size %d or total size %d is larger than data size %d\n",
+        ALOGW("Bad XML block: header size %d or total size %d is larger than data size %d\n",
              (int)dtohs(mHeader->header.headerSize),
              (int)dtohl(mHeader->header.size), (int)size);
         mError = BAD_TYPE;
@@ -1259,7 +1259,7 @@
     }
 
     if (mRootNode == NULL) {
-        LOGW("Bad XML block: no root element node found\n");
+        ALOGW("Bad XML block: no root element node found\n");
         mError = BAD_TYPE;
         goto done;
     }
@@ -1313,12 +1313,12 @@
             if ((dtohs(attrExt->attributeStart)+attrSize) <= (size-headerSize)) {
                 return NO_ERROR;
             }
-            LOGW("Bad XML block: node attributes use 0x%x bytes, only have 0x%x bytes\n",
+            ALOGW("Bad XML block: node attributes use 0x%x bytes, only have 0x%x bytes\n",
                     (unsigned int)(dtohs(attrExt->attributeStart)+attrSize),
                     (unsigned int)(size-headerSize));
         }
         else {
-            LOGW("Bad XML start block: node header size 0x%x, size 0x%x\n",
+            ALOGW("Bad XML start block: node header size 0x%x, size 0x%x\n",
                 (unsigned int)headerSize, (unsigned int)size);
         }
         return BAD_TYPE;
@@ -1342,21 +1342,21 @@
                         <= (size-headerSize)) {
                     return NO_ERROR;
                 }
-                LOGW("Bad XML block: node attributes use 0x%x bytes, only have 0x%x bytes\n",
+                ALOGW("Bad XML block: node attributes use 0x%x bytes, only have 0x%x bytes\n",
                         ((int)dtohs(node->attributeSize))*dtohs(node->attributeCount),
                         (int)(size-headerSize));
                 return BAD_TYPE;
             }
-            LOGW("Bad XML block: node at 0x%x extends beyond data end 0x%x\n",
+            ALOGW("Bad XML block: node at 0x%x extends beyond data end 0x%x\n",
                     (int)(((const uint8_t*)node)-((const uint8_t*)mHeader)), (int)mSize);
             return BAD_TYPE;
         }
-        LOGW("Bad XML block: node at 0x%x header size 0x%x smaller than total size 0x%x\n",
+        ALOGW("Bad XML block: node at 0x%x header size 0x%x smaller than total size 0x%x\n",
                 (int)(((const uint8_t*)node)-((const uint8_t*)mHeader)),
                 (int)headerSize, (int)size);
         return BAD_TYPE;
     }
-    LOGW("Bad XML block: node at 0x%x header size 0x%x too small\n",
+    ALOGW("Bad XML block: node at 0x%x header size 0x%x too small\n",
             (int)(((const uint8_t*)node)-((const uint8_t*)mHeader)),
             (int)headerSize);
     return BAD_TYPE;
@@ -1574,7 +1574,7 @@
         if (curPackage != p) {
             const ssize_t pidx = mTable.getResourcePackageIndex(attrRes);
             if (pidx < 0) {
-                LOGE("Style contains key with bad package: 0x%08x\n", attrRes);
+                ALOGE("Style contains key with bad package: 0x%08x\n", attrRes);
                 bag++;
                 continue;
             }
@@ -1594,7 +1594,7 @@
         }
         if (curType != t) {
             if (t >= curPI->numTypes) {
-                LOGE("Style contains key with bad type: 0x%08x\n", attrRes);
+                ALOGE("Style contains key with bad type: 0x%08x\n", attrRes);
                 bag++;
                 continue;
             }
@@ -1612,7 +1612,7 @@
             numEntries = curPI->types[t].numEntries;
         }
         if (e >= numEntries) {
-            LOGE("Style contains key with bad entry: 0x%08x\n", attrRes);
+            ALOGE("Style contains key with bad entry: 0x%08x\n", attrRes);
             bag++;
             continue;
         }
@@ -1631,7 +1631,7 @@
 
     mTable.unlock();
 
-    //LOGI("Applying style 0x%08x (force=%d)  theme %p...\n", resID, force, this);
+    //ALOGI("Applying style 0x%08x (force=%d)  theme %p...\n", resID, force, this);
     //dumpToLog();
     
     return NO_ERROR;
@@ -1639,7 +1639,7 @@
 
 status_t ResTable::Theme::setTo(const Theme& other)
 {
-    //LOGI("Setting theme %p from theme %p...\n", this, &other);
+    //ALOGI("Setting theme %p from theme %p...\n", this, &other);
     //dumpToLog();
     //other.dumpToLog();
     
@@ -1670,7 +1670,7 @@
         }
     }
 
-    //LOGI("Final theme:");
+    //ALOGI("Final theme:");
     //dumpToLog();
     
     return NO_ERROR;
@@ -1712,7 +1712,7 @@
                                 resID = te.value.data;
                                 continue;
                             }
-                            LOGW("Too many attribute references, stopped at: 0x%08x\n", resID);
+                            ALOGW("Too many attribute references, stopped at: 0x%08x\n", resID);
                             return BAD_INDEX;
                         } else if (type != Res_value::TYPE_NULL) {
                             *outValue = te.value;
@@ -1752,21 +1752,21 @@
 
 void ResTable::Theme::dumpToLog() const
 {
-    LOGI("Theme %p:\n", this);
+    ALOGI("Theme %p:\n", this);
     for (size_t i=0; i<Res_MAXPACKAGE; i++) {
         package_info* pi = mPackages[i];
         if (pi == NULL) continue;
         
-        LOGI("  Package #0x%02x:\n", (int)(i+1));
+        ALOGI("  Package #0x%02x:\n", (int)(i+1));
         for (size_t j=0; j<pi->numTypes; j++) {
             type_info& ti = pi->types[j];
             if (ti.numEntries == 0) continue;
             
-            LOGI("    Type #0x%02x:\n", (int)(j+1));
+            ALOGI("    Type #0x%02x:\n", (int)(j+1));
             for (size_t k=0; k<ti.numEntries; k++) {
                 theme_entry& te = ti.entries[k];
                 if (te.value.dataType == Res_value::TYPE_NULL) continue;
-                LOGI("      0x%08x: t=0x%x, d=0x%08x (block=%d)\n",
+                ALOGI("      0x%08x: t=0x%x, d=0x%08x (block=%d)\n",
                      (int)Res_MAKEID(i, j, k),
                      te.value.dataType, (int)te.value.data, (int)te.stringBlock);
             }
@@ -1779,7 +1779,7 @@
 {
     memset(&mParams, 0, sizeof(mParams));
     memset(mPackageMap, 0, sizeof(mPackageMap));
-    //LOGI("Creating ResTable %p\n", this);
+    //ALOGI("Creating ResTable %p\n", this);
 }
 
 ResTable::ResTable(const void* data, size_t size, void* cookie, bool copyData)
@@ -1789,12 +1789,12 @@
     memset(mPackageMap, 0, sizeof(mPackageMap));
     add(data, size, cookie, copyData);
     LOG_FATAL_IF(mError != NO_ERROR, "Error parsing resource table");
-    //LOGI("Creating ResTable %p\n", this);
+    //ALOGI("Creating ResTable %p\n", this);
 }
 
 ResTable::~ResTable()
 {
-    //LOGI("Destroying ResTable in %p\n", this);
+    //ALOGI("Destroying ResTable in %p\n", this);
     uninit();
 }
 
@@ -1813,7 +1813,7 @@
 {
     const void* data = asset->getBuffer(true);
     if (data == NULL) {
-        LOGW("Unable to get buffer of resource asset file");
+        ALOGW("Unable to get buffer of resource asset file");
         return UNKNOWN_ERROR;
     }
     size_t size = (size_t)asset->getLength();
@@ -1867,7 +1867,7 @@
     const bool notDeviceEndian = htods(0xf0) != 0xf0;
 
     LOAD_TABLE_NOISY(
-        LOGV("Adding resources to ResTable: data=%p, size=0x%x, cookie=%p, asset=%p, copy=%d "
+        ALOGV("Adding resources to ResTable: data=%p, size=0x%x, cookie=%p, asset=%p, copy=%d "
              "idmap=%p\n", data, size, cookie, asset, copyData, idmap));
     
     if (copyData || notDeviceEndian) {
@@ -1881,20 +1881,20 @@
 
     header->header = (const ResTable_header*)data;
     header->size = dtohl(header->header->header.size);
-    //LOGI("Got size 0x%x, again size 0x%x, raw size 0x%x\n", header->size,
+    //ALOGI("Got size 0x%x, again size 0x%x, raw size 0x%x\n", header->size,
     //     dtohl(header->header->header.size), header->header->header.size);
     LOAD_TABLE_NOISY(LOGV("Loading ResTable @%p:\n", header->header));
     LOAD_TABLE_NOISY(printHexData(2, header->header, header->size < 256 ? header->size : 256,
                                   16, 16, 0, false, printToLogFunc));
     if (dtohs(header->header->header.headerSize) > header->size
             || header->size > size) {
-        LOGW("Bad resource table: header size 0x%x or total size 0x%x is larger than data size 0x%x\n",
+        ALOGW("Bad resource table: header size 0x%x or total size 0x%x is larger than data size 0x%x\n",
              (int)dtohs(header->header->header.headerSize),
              (int)header->size, (int)size);
         return (mError=BAD_TYPE);
     }
     if (((dtohs(header->header->header.headerSize)|header->size)&0x3) != 0) {
-        LOGW("Bad resource table: header size 0x%x or total size 0x%x is not on an integer boundary\n",
+        ALOGW("Bad resource table: header size 0x%x or total size 0x%x is not on an integer boundary\n",
              (int)dtohs(header->header->header.headerSize),
              (int)header->size);
         return (mError=BAD_TYPE);
@@ -1927,11 +1927,11 @@
                     return (mError=err);
                 }
             } else {
-                LOGW("Multiple string chunks found in resource table.");
+                ALOGW("Multiple string chunks found in resource table.");
             }
         } else if (ctype == RES_TABLE_PACKAGE_TYPE) {
             if (curPackage >= dtohl(header->header->packageCount)) {
-                LOGW("More package chunks were found than the %d declared in the header.",
+                ALOGW("More package chunks were found than the %d declared in the header.",
                      dtohl(header->header->packageCount));
                 return (mError=BAD_TYPE);
             }
@@ -1949,7 +1949,7 @@
             }
             curPackage++;
         } else {
-            LOGW("Unknown chunk type %p in table at %p.\n",
+            ALOGW("Unknown chunk type %p in table at %p.\n",
                  (void*)(int)(ctype),
                  (void*)(((const uint8_t*)chunk) - ((const uint8_t*)header->header)));
         }
@@ -1958,13 +1958,13 @@
     }
 
     if (curPackage < dtohl(header->header->packageCount)) {
-        LOGW("Fewer package chunks (%d) were found than the %d declared in the header.",
+        ALOGW("Fewer package chunks (%d) were found than the %d declared in the header.",
              (int)curPackage, dtohl(header->header->packageCount));
         return (mError=BAD_TYPE);
     }
     mError = header->values.getError();
     if (mError != NO_ERROR) {
-        LOGW("No string values found in resource table!");
+        ALOGW("No string values found in resource table!");
     }
 
     TABLE_NOISY(LOGV("Returning from add with mError=%d\n", mError));
@@ -2011,20 +2011,20 @@
 
     if (p < 0) {
         if (Res_GETPACKAGE(resID)+1 == 0) {
-            LOGW("No package identifier when getting name for resource number 0x%08x", resID);
+            ALOGW("No package identifier when getting name for resource number 0x%08x", resID);
         } else {
-            LOGW("No known package when getting name for resource number 0x%08x", resID);
+            ALOGW("No known package when getting name for resource number 0x%08x", resID);
         }
         return false;
     }
     if (t < 0) {
-        LOGW("No type identifier when getting name for resource number 0x%08x", resID);
+        ALOGW("No type identifier when getting name for resource number 0x%08x", resID);
         return false;
     }
 
     const PackageGroup* const grp = mPackageGroups[p];
     if (grp == NULL) {
-        LOGW("Bad identifier when getting name for resource number 0x%08x", resID);
+        ALOGW("Bad identifier when getting name for resource number 0x%08x", resID);
         return false;
     }
     if (grp->packages.size() > 0) {
@@ -2067,14 +2067,14 @@
 
     if (p < 0) {
         if (Res_GETPACKAGE(resID)+1 == 0) {
-            LOGW("No package identifier when getting value for resource number 0x%08x", resID);
+            ALOGW("No package identifier when getting value for resource number 0x%08x", resID);
         } else {
-            LOGW("No known package when getting value for resource number 0x%08x", resID);
+            ALOGW("No known package when getting value for resource number 0x%08x", resID);
         }
         return BAD_INDEX;
     }
     if (t < 0) {
-        LOGW("No type identifier when getting value for resource number 0x%08x", resID);
+        ALOGW("No type identifier when getting value for resource number 0x%08x", resID);
         return BAD_INDEX;
     }
 
@@ -2089,7 +2089,7 @@
     // recently added.
     const PackageGroup* const grp = mPackageGroups[p];
     if (grp == NULL) {
-        LOGW("Bad identifier when getting value for resource number 0x%08x", resID);
+        ALOGW("Bad identifier when getting value for resource number 0x%08x", resID);
         return BAD_INDEX;
     }
 
@@ -2099,7 +2099,7 @@
     if (density > 0) {
         overrideConfig = (ResTable_config*) malloc(sizeof(ResTable_config));
         if (overrideConfig == NULL) {
-            LOGE("Couldn't malloc ResTable_config for overrides: %s", strerror(errno));
+            ALOGE("Couldn't malloc ResTable_config for overrides: %s", strerror(errno));
             return BAD_INDEX;
         }
         memcpy(overrideConfig, &mParams, sizeof(ResTable_config));
@@ -2122,7 +2122,7 @@
                                           resID, &overlayResID);
             if (retval == NO_ERROR && overlayResID != 0x0) {
                 // for this loop iteration, this is the type and entry we really want
-                LOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID);
+                ALOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID);
                 T = Res_GETTYPE(overlayResID);
                 E = Res_GETENTRY(overlayResID);
             } else {
@@ -2141,7 +2141,7 @@
             // overlay package did not specify a default.
             // Non-overlay packages are still required to provide a default.
             if (offset < 0 && ip == 0) {
-                LOGW("Failure getting entry for 0x%08x (t=%d e=%d) in package %zd (error %d)\n",
+                ALOGW("Failure getting entry for 0x%08x (t=%d e=%d) in package %zd (error %d)\n",
                         resID, T, E, ip, (int)offset);
                 rc = offset;
                 goto out;
@@ -2151,7 +2151,7 @@
 
         if ((dtohs(entry->flags)&entry->FLAG_COMPLEX) != 0) {
             if (!mayBeBag) {
-                LOGW("Requesting resource %p failed because it is complex\n",
+                ALOGW("Requesting resource %p failed because it is complex\n",
                      (void*)resID);
             }
             continue;
@@ -2161,7 +2161,7 @@
               << HexDump(type, dtohl(type->header.size)) << endl);
 
         if ((size_t)offset > (dtohl(type->header.size)-sizeof(Res_value))) {
-            LOGW("ResTable_item at %d is beyond type chunk data %d",
+            ALOGW("ResTable_item at %d is beyond type chunk data %d",
                  (int)offset, dtohl(type->header.size));
             rc = BAD_TYPE;
             goto out;
@@ -2307,23 +2307,23 @@
     const int e = Res_GETENTRY(resID);
 
     if (p < 0) {
-        LOGW("Invalid package identifier when getting bag for resource number 0x%08x", resID);
+        ALOGW("Invalid package identifier when getting bag for resource number 0x%08x", resID);
         return BAD_INDEX;
     }
     if (t < 0) {
-        LOGW("No type identifier when getting bag for resource number 0x%08x", resID);
+        ALOGW("No type identifier when getting bag for resource number 0x%08x", resID);
         return BAD_INDEX;
     }
 
     //printf("Get bag: id=0x%08x, p=%d, t=%d\n", resID, p, t);
     PackageGroup* const grp = mPackageGroups[p];
     if (grp == NULL) {
-        LOGW("Bad identifier when getting bag for resource number 0x%08x", resID);
+        ALOGW("Bad identifier when getting bag for resource number 0x%08x", resID);
         return false;
     }
 
     if (t >= (int)grp->typeCount) {
-        LOGW("Type identifier 0x%x is larger than type count 0x%x",
+        ALOGW("Type identifier 0x%x is larger than type count 0x%x",
              t+1, (int)grp->typeCount);
         return BAD_INDEX;
     }
@@ -2334,7 +2334,7 @@
 
     const size_t NENTRY = typeConfigs->entryCount;
     if (e >= (int)NENTRY) {
-        LOGW("Entry identifier 0x%x is larger than entry count 0x%x",
+        ALOGW("Entry identifier 0x%x is larger than entry count 0x%x",
              e, (int)typeConfigs->entryCount);
         return BAD_INDEX;
     }
@@ -2350,10 +2350,10 @@
                         *outTypeSpecFlags = set->typeSpecFlags;
                     }
                     *outBag = (bag_entry*)(set+1);
-                    //LOGI("Found existing bag for: %p\n", (void*)resID);
+                    //ALOGI("Found existing bag for: %p\n", (void*)resID);
                     return set->numAttrs;
                 }
-                LOGW("Attempt to retrieve bag 0x%08x which is invalid or in a cycle.",
+                ALOGW("Attempt to retrieve bag 0x%08x which is invalid or in a cycle.",
                      resID);
                 return BAD_INDEX;
             }
@@ -2401,7 +2401,7 @@
                                           resID, &overlayResID);
             if (retval == NO_ERROR && overlayResID != 0x0) {
                 // for this loop iteration, this is the type and entry we really want
-                LOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID);
+                ALOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID);
                 T = Res_GETTYPE(overlayResID);
                 E = Res_GETENTRY(overlayResID);
             } else {
@@ -2413,9 +2413,9 @@
         const ResTable_type* type;
         const ResTable_entry* entry;
         const Type* typeClass;
-        LOGV("Getting entry pkg=%p, t=%d, e=%d\n", package, T, E);
+        ALOGV("Getting entry pkg=%p, t=%d, e=%d\n", package, T, E);
         ssize_t offset = getEntry(package, T, E, &mParams, &type, &entry, &typeClass);
-        LOGV("Resulting offset=%d\n", offset);
+        ALOGV("Resulting offset=%d\n", offset);
         if (offset <= 0) {
             // No {entry, appropriate config} pair found in package. If this
             // package is an overlay package (ip != 0), this simply means the
@@ -2429,7 +2429,7 @@
         }
 
         if ((dtohs(entry->flags)&entry->FLAG_COMPLEX) == 0) {
-            LOGW("Skipping entry %p in package table %d because it is not complex!\n",
+            ALOGW("Skipping entry %p in package table %d because it is not complex!\n",
                  (void*)resID, (int)ip);
             continue;
         }
@@ -2505,7 +2505,7 @@
             TABLE_NOISY(printf("Now at %p\n", (void*)curOff));
 
             if ((size_t)curOff > (dtohl(type->header.size)-sizeof(ResTable_map))) {
-                LOGW("ResTable_map at %d is beyond type chunk data %d",
+                ALOGW("ResTable_map at %d is beyond type chunk data %d",
                      (int)curOff, dtohl(type->header.size));
                 return BAD_TYPE;
             }
@@ -2676,7 +2676,7 @@
                 && name[6] == '_') {
                 int index = atoi(String8(name + 7, nameLen - 7).string());
                 if (Res_CHECKID(index)) {
-                    LOGW("Array resource index: %d is too large.",
+                    ALOGW("Array resource index: %d is too large.",
                          index);
                     return 0;
                 }
@@ -2792,12 +2792,12 @@
                 offset += typeOffset;
                 
                 if (offset > (dtohl(ty->header.size)-sizeof(ResTable_entry))) {
-                    LOGW("ResTable_entry at %d is beyond type chunk data %d",
+                    ALOGW("ResTable_entry at %d is beyond type chunk data %d",
                          offset, dtohl(ty->header.size));
                     return 0;
                 }
                 if ((offset&0x3) != 0) {
-                    LOGW("ResTable_entry at %d (pkg=%d type=%d ent=%d) is not on an integer boundary when looking for %s:%s/%s",
+                    ALOGW("ResTable_entry at %d (pkg=%d type=%d ent=%d) is not on an integer boundary when looking for %s:%s/%s",
                          (int)offset, (int)group->id, (int)ti+1, (int)i,
                          String8(package, packageLen).string(),
                          String8(type, typeLen).string(),
@@ -2808,7 +2808,7 @@
                 const ResTable_entry* const entry = (const ResTable_entry*)
                     (((const uint8_t*)ty) + offset);
                 if (dtohs(entry->size) < sizeof(*entry)) {
-                    LOGW("ResTable_entry size %d is too small", dtohs(entry->size));
+                    ALOGW("ResTable_entry size %d is too small", dtohs(entry->size));
                     return BAD_TYPE;
                 }
 
@@ -3898,9 +3898,9 @@
 void ResTable::getLocales(Vector<String8>* locales) const
 {
     Vector<ResTable_config> configs;
-    LOGV("calling getConfigurations");
+    ALOGV("calling getConfigurations");
     getConfigurations(&configs);
-    LOGV("called getConfigurations size=%d", (int)configs.size());
+    ALOGV("called getConfigurations size=%d", (int)configs.size());
     const size_t I = configs.size();
     for (size_t i=0; i<I; i++) {
         char locale[6];
@@ -3924,18 +3924,18 @@
     const ResTable_type** outType, const ResTable_entry** outEntry,
     const Type** outTypeClass) const
 {
-    LOGV("Getting entry from package %p\n", package);
+    ALOGV("Getting entry from package %p\n", package);
     const ResTable_package* const pkg = package->package;
 
     const Type* allTypes = package->getType(typeIndex);
-    LOGV("allTypes=%p\n", allTypes);
+    ALOGV("allTypes=%p\n", allTypes);
     if (allTypes == NULL) {
-        LOGV("Skipping entry type index 0x%02x because type is NULL!\n", typeIndex);
+        ALOGV("Skipping entry type index 0x%02x because type is NULL!\n", typeIndex);
         return 0;
     }
 
     if ((size_t)entryIndex >= allTypes->entryCount) {
-        LOGW("getEntry failing because entryIndex %d is beyond type entryCount %d",
+        ALOGW("getEntry failing because entryIndex %d is beyond type entryCount %d",
             entryIndex, (int)allTypes->entryCount);
         return BAD_TYPE;
     }
@@ -4039,12 +4039,12 @@
           << ", offset=" << (void*)offset << endl);
 
     if (offset > (dtohl(type->header.size)-sizeof(ResTable_entry))) {
-        LOGW("ResTable_entry at 0x%x is beyond type chunk data 0x%x",
+        ALOGW("ResTable_entry at 0x%x is beyond type chunk data 0x%x",
              offset, dtohl(type->header.size));
         return BAD_TYPE;
     }
     if ((offset&0x3) != 0) {
-        LOGW("ResTable_entry at 0x%x is not on an integer boundary",
+        ALOGW("ResTable_entry at 0x%x is not on an integer boundary",
              offset);
         return BAD_TYPE;
     }
@@ -4052,7 +4052,7 @@
     const ResTable_entry* const entry = (const ResTable_entry*)
         (((const uint8_t*)type) + offset);
     if (dtohs(entry->size) < sizeof(*entry)) {
-        LOGW("ResTable_entry size 0x%x is too small", dtohs(entry->size));
+        ALOGW("ResTable_entry size 0x%x is too small", dtohs(entry->size));
         return BAD_TYPE;
     }
 
@@ -4077,22 +4077,22 @@
     const size_t pkgSize = dtohl(pkg->header.size);
 
     if (dtohl(pkg->typeStrings) >= pkgSize) {
-        LOGW("ResTable_package type strings at %p are past chunk size %p.",
+        ALOGW("ResTable_package type strings at %p are past chunk size %p.",
              (void*)dtohl(pkg->typeStrings), (void*)pkgSize);
         return (mError=BAD_TYPE);
     }
     if ((dtohl(pkg->typeStrings)&0x3) != 0) {
-        LOGW("ResTable_package type strings at %p is not on an integer boundary.",
+        ALOGW("ResTable_package type strings at %p is not on an integer boundary.",
              (void*)dtohl(pkg->typeStrings));
         return (mError=BAD_TYPE);
     }
     if (dtohl(pkg->keyStrings) >= pkgSize) {
-        LOGW("ResTable_package key strings at %p are past chunk size %p.",
+        ALOGW("ResTable_package key strings at %p are past chunk size %p.",
              (void*)dtohl(pkg->keyStrings), (void*)pkgSize);
         return (mError=BAD_TYPE);
     }
     if ((dtohl(pkg->keyStrings)&0x3) != 0) {
-        LOGW("ResTable_package key strings at %p is not on an integer boundary.",
+        ALOGW("ResTable_package key strings at %p is not on an integer boundary.",
              (void*)dtohl(pkg->keyStrings));
         return (mError=BAD_TYPE);
     }
@@ -4195,7 +4195,7 @@
             if ((dtohl(typeSpec->entryCount) > (INT32_MAX/sizeof(uint32_t))
                     || dtohs(typeSpec->header.headerSize)+(sizeof(uint32_t)*dtohl(typeSpec->entryCount))
                     > typeSpecSize)) {
-                LOGW("ResTable_typeSpec entry index to %p extends beyond chunk end %p.",
+                ALOGW("ResTable_typeSpec entry index to %p extends beyond chunk end %p.",
                      (void*)(dtohs(typeSpec->header.headerSize)
                              +(sizeof(uint32_t)*dtohl(typeSpec->entryCount))),
                      (void*)typeSpecSize);
@@ -4203,7 +4203,7 @@
             }
             
             if (typeSpec->id == 0) {
-                LOGW("ResTable_type has an id of 0.");
+                ALOGW("ResTable_type has an id of 0.");
                 return (mError=BAD_TYPE);
             }
             
@@ -4215,7 +4215,7 @@
                 t = new Type(header, package, dtohl(typeSpec->entryCount));
                 package->types.editItemAt(typeSpec->id-1) = t;
             } else if (dtohl(typeSpec->entryCount) != t->entryCount) {
-                LOGW("ResTable_typeSpec entry count inconsistent: given %d, previously %d",
+                ALOGW("ResTable_typeSpec entry count inconsistent: given %d, previously %d",
                     (int)dtohl(typeSpec->entryCount), (int)t->entryCount);
                 return (mError=BAD_TYPE);
             }
@@ -4240,7 +4240,7 @@
                                     (void*)typeSize));
             if (dtohs(type->header.headerSize)+(sizeof(uint32_t)*dtohl(type->entryCount))
                 > typeSize) {
-                LOGW("ResTable_type entry index to %p extends beyond chunk end %p.",
+                ALOGW("ResTable_type entry index to %p extends beyond chunk end %p.",
                      (void*)(dtohs(type->header.headerSize)
                              +(sizeof(uint32_t)*dtohl(type->entryCount))),
                      (void*)typeSize);
@@ -4248,12 +4248,12 @@
             }
             if (dtohl(type->entryCount) != 0
                 && dtohl(type->entriesStart) > (typeSize-sizeof(ResTable_entry))) {
-                LOGW("ResTable_type entriesStart at %p extends beyond chunk end %p.",
+                ALOGW("ResTable_type entriesStart at %p extends beyond chunk end %p.",
                      (void*)dtohl(type->entriesStart), (void*)typeSize);
                 return (mError=BAD_TYPE);
             }
             if (type->id == 0) {
-                LOGW("ResTable_type has an id of 0.");
+                ALOGW("ResTable_type has an id of 0.");
                 return (mError=BAD_TYPE);
             }
             
@@ -4265,7 +4265,7 @@
                 t = new Type(header, package, dtohl(type->entryCount));
                 package->types.editItemAt(type->id-1) = t;
             } else if (dtohl(type->entryCount) != t->entryCount) {
-                LOGW("ResTable_type entry count inconsistent: given %d, previously %d",
+                ALOGW("ResTable_type entry count inconsistent: given %d, previously %d",
                     (int)dtohl(type->entryCount), (int)t->entryCount);
                 return (mError=BAD_TYPE);
             }
@@ -4273,7 +4273,7 @@
             TABLE_GETENTRY(
                 ResTable_config thisConfig;
                 thisConfig.copyFromDtoH(type->config);
-                LOGI("Adding config to type %d: imsi:%d/%d lang:%c%c cnt:%c%c "
+                ALOGI("Adding config to type %d: imsi:%d/%d lang:%c%c cnt:%c%c "
                      "orien:%d touch:%d density:%d key:%d inp:%d nav:%d w:%d h:%d "
                      "swdp:%d wdp:%d hdp:%d\n",
                       type->id,
@@ -4346,7 +4346,7 @@
                 | (0x0000ffff & (entryIndex));
             resource_name resName;
             if (!this->getResourceName(resID, &resName)) {
-                LOGW("idmap: resource 0x%08x has spec but lacks values, skipping\n", resID);
+                ALOGW("idmap: resource 0x%08x has spec but lacks values, skipping\n", resID);
                 continue;
             }
 
@@ -4368,7 +4368,7 @@
             }
 #if 0
             if (overlayResID != 0) {
-                LOGD("%s/%s 0x%08x -> 0x%08x\n",
+                ALOGD("%s/%s 0x%08x -> 0x%08x\n",
                      String8(String16(resName.type)).string(),
                      String8(String16(resName.name)).string(),
                      resID, overlayResID);
diff --git a/libs/utils/Static.cpp b/libs/utils/Static.cpp
index ceca435..bfcb2da 100644
--- a/libs/utils/Static.cpp
+++ b/libs/utils/Static.cpp
@@ -57,8 +57,8 @@
     virtual status_t writeLines(const struct iovec& vec, size_t N)
     {
         //android_writevLog(&vec, N);       <-- this is now a no-op
-        if (N != 1) LOGI("WARNING: writeLines N=%d\n", N);
-        LOGI("%.*s", vec.iov_len, (const char*) vec.iov_base);
+        if (N != 1) ALOGI("WARNING: writeLines N=%d\n", N);
+        ALOGI("%.*s", vec.iov_len, (const char*) vec.iov_base);
         return NO_ERROR;
     }
 };
diff --git a/libs/utils/StopWatch.cpp b/libs/utils/StopWatch.cpp
index b5dda2f..595aec3 100644
--- a/libs/utils/StopWatch.cpp
+++ b/libs/utils/StopWatch.cpp
@@ -39,11 +39,11 @@
 {
     nsecs_t elapsed = elapsedTime();
     const int n = mNumLaps;
-    LOGD("StopWatch %s (us): %lld ", mName, ns2us(elapsed));
+    ALOGD("StopWatch %s (us): %lld ", mName, ns2us(elapsed));
     for (int i=0 ; i<n ; i++) {
         const nsecs_t soFar = mLaps[i].soFar;
         const nsecs_t thisLap = mLaps[i].thisLap;
-        LOGD(" [%d: %lld, %lld]", i, ns2us(soFar), ns2us(thisLap));
+        ALOGD(" [%d: %lld, %lld]", i, ns2us(soFar), ns2us(thisLap));
     }
 }
 
diff --git a/libs/utils/StreamingZipInflater.cpp b/libs/utils/StreamingZipInflater.cpp
index 00498bd..8512170a 100644
--- a/libs/utils/StreamingZipInflater.cpp
+++ b/libs/utils/StreamingZipInflater.cpp
@@ -77,7 +77,7 @@
 }
 
 void StreamingZipInflater::initInflateState() {
-    LOGV("Initializing inflate state");
+    ALOGV("Initializing inflate state");
 
     memset(&mInflateState, 0, sizeof(mInflateState));
     mInflateState.zalloc = Z_NULL;
@@ -138,7 +138,7 @@
             if (mInflateState.avail_in == 0) {
                 int err = readNextChunk();
                 if (err < 0) {
-                    LOGE("Unable to access asset data: %d", err);
+                    ALOGE("Unable to access asset data: %d", err);
                     if (!mStreamNeedsInit) {
                         ::inflateEnd(&mInflateState);
                         initInflateState();
@@ -152,20 +152,20 @@
             mInflateState.avail_out = mOutBufSize;
 
             /*
-            LOGV("Inflating to outbuf: avail_in=%u avail_out=%u next_in=%p next_out=%p",
+            ALOGV("Inflating to outbuf: avail_in=%u avail_out=%u next_in=%p next_out=%p",
                     mInflateState.avail_in, mInflateState.avail_out,
                     mInflateState.next_in, mInflateState.next_out);
             */
             int result = Z_OK;
             if (mStreamNeedsInit) {
-                LOGV("Initializing zlib to inflate");
+                ALOGV("Initializing zlib to inflate");
                 result = inflateInit2(&mInflateState, -MAX_WBITS);
                 mStreamNeedsInit = false;
             }
             if (result == Z_OK) result = ::inflate(&mInflateState, Z_SYNC_FLUSH);
             if (result < 0) {
                 // Whoops, inflation failed
-                LOGE("Error inflating asset: %d", result);
+                ALOGE("Error inflating asset: %d", result);
                 ::inflateEnd(&mInflateState);
                 initInflateState();
                 return -1;
@@ -192,10 +192,10 @@
         size_t toRead = min_of(mInBufSize, mInTotalSize - mInNextChunkOffset);
         if (toRead > 0) {
             ssize_t didRead = ::read(mFd, mInBuf, toRead);
-            //LOGV("Reading input chunk, size %08x didread %08x", toRead, didRead);
+            //ALOGV("Reading input chunk, size %08x didread %08x", toRead, didRead);
             if (didRead < 0) {
                 // TODO: error
-                LOGE("Error reading asset data");
+                ALOGE("Error reading asset data");
                 return didRead;
             } else {
                 mInNextChunkOffset += didRead;
diff --git a/libs/utils/String16.cpp b/libs/utils/String16.cpp
index 4ce1664..94e072f 100644
--- a/libs/utils/String16.cpp
+++ b/libs/utils/String16.cpp
@@ -112,7 +112,7 @@
 {
     size_t len = strlen16(o);
     SharedBuffer* buf = SharedBuffer::alloc((len+1)*sizeof(char16_t));
-    LOG_ASSERT(buf, "Unable to allocate shared buffer");
+    ALOG_ASSERT(buf, "Unable to allocate shared buffer");
     if (buf) {
         char16_t* str = (char16_t*)buf->data();
         strcpy16(str, o);
@@ -126,7 +126,7 @@
 String16::String16(const char16_t* o, size_t len)
 {
     SharedBuffer* buf = SharedBuffer::alloc((len+1)*sizeof(char16_t));
-    LOG_ASSERT(buf, "Unable to allocate shared buffer");
+    ALOG_ASSERT(buf, "Unable to allocate shared buffer");
     if (buf) {
         char16_t* str = (char16_t*)buf->data();
         memcpy(str, o, len*sizeof(char16_t));
diff --git a/libs/utils/String8.cpp b/libs/utils/String8.cpp
index 0bc5aff..562f026 100644
--- a/libs/utils/String8.cpp
+++ b/libs/utils/String8.cpp
@@ -80,7 +80,7 @@
 {
     if (len > 0) {
         SharedBuffer* buf = SharedBuffer::alloc(len+1);
-        LOG_ASSERT(buf, "Unable to allocate shared buffer");
+        ALOG_ASSERT(buf, "Unable to allocate shared buffer");
         if (buf) {
             char* str = (char*)buf->data();
             memcpy(str, in, len);
@@ -103,7 +103,7 @@
     }
 
     SharedBuffer* buf = SharedBuffer::alloc(bytes+1);
-    LOG_ASSERT(buf, "Unable to allocate shared buffer");
+    ALOG_ASSERT(buf, "Unable to allocate shared buffer");
     if (!buf) {
         return getEmptyString();
     }
@@ -125,7 +125,7 @@
     }
 
     SharedBuffer* buf = SharedBuffer::alloc(bytes+1);
-    LOG_ASSERT(buf, "Unable to allocate shared buffer");
+    ALOG_ASSERT(buf, "Unable to allocate shared buffer");
     if (!buf) {
         return getEmptyString();
     }
diff --git a/libs/utils/SystemClock.cpp b/libs/utils/SystemClock.cpp
index 062e6d7..8b8ac10 100644
--- a/libs/utils/SystemClock.cpp
+++ b/libs/utils/SystemClock.cpp
@@ -64,25 +64,25 @@
     tv.tv_sec = (time_t) (millis / 1000LL);
     tv.tv_usec = (suseconds_t) ((millis % 1000LL) * 1000LL);
 
-    LOGD("Setting time of day to sec=%d\n", (int) tv.tv_sec);
+    ALOGD("Setting time of day to sec=%d\n", (int) tv.tv_sec);
 
 #ifdef HAVE_ANDROID_OS
     fd = open("/dev/alarm", O_RDWR);
     if(fd < 0) {
-        LOGW("Unable to open alarm driver: %s\n", strerror(errno));
+        ALOGW("Unable to open alarm driver: %s\n", strerror(errno));
         return -1;
     }
     ts.tv_sec = tv.tv_sec;
     ts.tv_nsec = tv.tv_usec * 1000;
     res = ioctl(fd, ANDROID_ALARM_SET_RTC, &ts);
     if(res < 0) {
-        LOGW("Unable to set rtc to %ld: %s\n", tv.tv_sec, strerror(errno));
+        ALOGW("Unable to set rtc to %ld: %s\n", tv.tv_sec, strerror(errno));
         ret = -1;
     }
     close(fd);
 #else
     if (settimeofday(&tv, NULL) != 0) {
-        LOGW("Unable to set clock to %d.%d: %s\n",
+        ALOGW("Unable to set clock to %d.%d: %s\n",
             (int) tv.tv_sec, (int) tv.tv_usec, strerror(errno));
         ret = -1;
     }
diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp
index 5dbcb75..e343c62 100644
--- a/libs/utils/Threads.cpp
+++ b/libs/utils/Threads.cpp
@@ -163,7 +163,7 @@
                     (android_pthread_entry)entryFunction, userData);
     pthread_attr_destroy(&attr);
     if (result != 0) {
-        LOGE("androidCreateRawThreadEtc failed (entry=%p, res=%d, errno=%d)\n"
+        ALOGE("androidCreateRawThreadEtc failed (entry=%p, res=%d, errno=%d)\n"
              "(android threadPriority=%d)",
             entryFunction, result, errno, threadPriority);
         return 0;
@@ -205,7 +205,7 @@
 
     delete pDetails;
 
-    LOG(LOG_VERBOSE, "thread", "thread exiting\n");
+    ALOG(LOG_VERBOSE, "thread", "thread exiting\n");
     return (unsigned int) result;
 }
 
@@ -232,7 +232,7 @@
     if (hThread == NULL)
 #endif
     {
-        LOG(LOG_WARN, "thread", "WARNING: thread create failed\n");
+        ALOG(LOG_WARN, "thread", "WARNING: thread create failed\n");
         return false;
     }
 
@@ -470,7 +470,7 @@
 void Mutex::unlock()
 {
     if (!ReleaseMutex((HANDLE) mState))
-        LOG(LOG_WARN, "thread", "WARNING: bad result from unlocking mutex\n");
+        ALOG(LOG_WARN, "thread", "WARNING: bad result from unlocking mutex\n");
 }
 
 status_t Mutex::tryLock()
@@ -479,7 +479,7 @@
 
     dwWaitResult = WaitForSingleObject((HANDLE) mState, 0);
     if (dwWaitResult != WAIT_OBJECT_0 && dwWaitResult != WAIT_TIMEOUT)
-        LOG(LOG_WARN, "thread", "WARNING: bad result from try-locking mutex\n");
+        ALOG(LOG_WARN, "thread", "WARNING: bad result from try-locking mutex\n");
     return (dwWaitResult == WAIT_OBJECT_0) ? 0 : -1;
 }
 
@@ -870,7 +870,7 @@
 {
     Mutex::Autolock _l(mLock);
     if (mThread == getThreadId()) {
-        LOGW(
+        ALOGW(
         "Thread (this=%p): don't call waitForExit() from this "
         "Thread object's thread. It's a guaranteed deadlock!",
         this);
@@ -894,7 +894,7 @@
 {
     Mutex::Autolock _l(mLock);
     if (mThread == getThreadId()) {
-        LOGW(
+        ALOGW(
         "Thread (this=%p): don't call join() from this "
         "Thread object's thread. It's a guaranteed deadlock!",
         this);
diff --git a/libs/utils/Timers.cpp b/libs/utils/Timers.cpp
index 64a29f5..64b4701 100644
--- a/libs/utils/Timers.cpp
+++ b/libs/utils/Timers.cpp
@@ -113,7 +113,7 @@
 /*static*/ void DurationTimer::addToTimeval(struct timeval* ptv, long usec)
 {
     if (usec < 0) {
-        LOG(LOG_WARN, "", "Negative values not supported in addToTimeval\n");
+        ALOG(LOG_WARN, "", "Negative values not supported in addToTimeval\n");
         return;
     }
 
diff --git a/libs/utils/Tokenizer.cpp b/libs/utils/Tokenizer.cpp
index b3445b7..efda2bf 100644
--- a/libs/utils/Tokenizer.cpp
+++ b/libs/utils/Tokenizer.cpp
@@ -55,12 +55,12 @@
     int fd = ::open(filename.string(), O_RDONLY);
     if (fd < 0) {
         result = -errno;
-        LOGE("Error opening file '%s', %s.", filename.string(), strerror(errno));
+        ALOGE("Error opening file '%s', %s.", filename.string(), strerror(errno));
     } else {
         struct stat stat;
         if (fstat(fd, &stat)) {
             result = -errno;
-            LOGE("Error getting size of file '%s', %s.", filename.string(), strerror(errno));
+            ALOGE("Error getting size of file '%s', %s.", filename.string(), strerror(errno));
         } else {
             size_t length = size_t(stat.st_size);
 
@@ -80,7 +80,7 @@
                 ssize_t nrd = read(fd, buffer, length);
                 if (nrd < 0) {
                     result = -errno;
-                    LOGE("Error reading file '%s', %s.", filename.string(), strerror(errno));
+                    ALOGE("Error reading file '%s', %s.", filename.string(), strerror(errno));
                     delete[] buffer;
                     buffer = NULL;
                 } else {
@@ -118,7 +118,7 @@
 
 String8 Tokenizer::nextToken(const char* delimiters) {
 #if DEBUG_TOKENIZER
-    LOGD("nextToken");
+    ALOGD("nextToken");
 #endif
     const char* end = getEnd();
     const char* tokenStart = mCurrent;
@@ -134,7 +134,7 @@
 
 void Tokenizer::nextLine() {
 #if DEBUG_TOKENIZER
-    LOGD("nextLine");
+    ALOGD("nextLine");
 #endif
     const char* end = getEnd();
     while (mCurrent != end) {
@@ -148,7 +148,7 @@
 
 void Tokenizer::skipDelimiters(const char* delimiters) {
 #if DEBUG_TOKENIZER
-    LOGD("skipDelimiters");
+    ALOGD("skipDelimiters");
 #endif
     const char* end = getEnd();
     while (mCurrent != end) {
diff --git a/libs/utils/VectorImpl.cpp b/libs/utils/VectorImpl.cpp
index bfb37a6..220ae3e 100644
--- a/libs/utils/VectorImpl.cpp
+++ b/libs/utils/VectorImpl.cpp
@@ -56,7 +56,7 @@
 
 VectorImpl::~VectorImpl()
 {
-    LOG_ASSERT(!mCount,
+    ALOG_ASSERT(!mCount,
         "[%p] "
         "subclasses of VectorImpl must call finish_vector()"
         " in their destructor. Leaking %d bytes.",
@@ -66,7 +66,7 @@
 
 VectorImpl& VectorImpl::operator = (const VectorImpl& rhs)
 {
-    LOG_ASSERT(mItemSize == rhs.mItemSize,
+    ALOG_ASSERT(mItemSize == rhs.mItemSize,
         "Vector<> have different types (this=%p, rhs=%p)", this, &rhs);
     if (this != &rhs) {
         release_storage();
@@ -248,7 +248,7 @@
 
 ssize_t VectorImpl::replaceAt(const void* prototype, size_t index)
 {
-    LOG_ASSERT(index<size(),
+    ALOG_ASSERT(index<size(),
         "[%p] replace: index=%d, size=%d", this, (int)index, (int)size());
 
     void* item = editItemLocation(index);
@@ -267,7 +267,7 @@
 
 ssize_t VectorImpl::removeItemsAt(size_t index, size_t count)
 {
-    LOG_ASSERT((index+count)<=size(),
+    ALOG_ASSERT((index+count)<=size(),
         "[%p] remove: index=%d, count=%d, size=%d",
                this, (int)index, (int)count, (int)size());
 
@@ -291,7 +291,7 @@
 
 void* VectorImpl::editItemLocation(size_t index)
 {
-    LOG_ASSERT(index<capacity(),
+    ALOG_ASSERT(index<capacity(),
         "[%p] editItemLocation: index=%d, capacity=%d, count=%d",
         this, (int)index, (int)capacity(), (int)mCount);
             
@@ -303,7 +303,7 @@
 
 const void* VectorImpl::itemLocation(size_t index) const
 {
-    LOG_ASSERT(index<capacity(),
+    ALOG_ASSERT(index<capacity(),
         "[%p] itemLocation: index=%d, capacity=%d, count=%d",
         this, (int)index, (int)capacity(), (int)mCount);
 
@@ -346,17 +346,17 @@
 
 void* VectorImpl::_grow(size_t where, size_t amount)
 {
-//    LOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
+//    ALOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
 //        this, (int)where, (int)amount, (int)mCount, (int)capacity());
 
-    LOG_ASSERT(where <= mCount,
+    ALOG_ASSERT(where <= mCount,
             "[%p] _grow: where=%d, amount=%d, count=%d",
             this, (int)where, (int)amount, (int)mCount); // caller already checked
 
     const size_t new_size = mCount + amount;
     if (capacity() < new_size) {
         const size_t new_capacity = max(kMinVectorCapacity, ((new_size*3)+1)/2);
-//        LOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity);
+//        ALOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity);
         if ((mStorage) &&
             (mCount==where) &&
             (mFlags & HAS_TRIVIAL_COPY) &&
@@ -399,17 +399,17 @@
     if (!mStorage)
         return;
 
-//    LOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
+//    ALOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
 //        this, (int)where, (int)amount, (int)mCount, (int)capacity());
 
-    LOG_ASSERT(where + amount <= mCount,
+    ALOG_ASSERT(where + amount <= mCount,
             "[%p] _shrink: where=%d, amount=%d, count=%d",
             this, (int)where, (int)amount, (int)mCount); // caller already checked
 
     const size_t new_size = mCount - amount;
     if (new_size*3 < capacity()) {
         const size_t new_capacity = max(kMinVectorCapacity, new_size*2);
-//        LOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity);
+//        ALOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity);
         if ((where == new_size) &&
             (mFlags & HAS_TRIVIAL_COPY) &&
             (mFlags & HAS_TRIVIAL_DTOR))
diff --git a/libs/utils/ZipFileRO.cpp b/libs/utils/ZipFileRO.cpp
index b18c383..1498aac 100644
--- a/libs/utils/ZipFileRO.cpp
+++ b/libs/utils/ZipFileRO.cpp
@@ -120,7 +120,7 @@
 {
     long ent = ((long) entry) - kZipEntryAdj;
     if (ent < 0 || ent >= mHashTableSize || mHashTable[ent].name == NULL) {
-        LOGW("Invalid ZipEntryRO %p (%ld)\n", entry, ent);
+        ALOGW("Invalid ZipEntryRO %p (%ld)\n", entry, ent);
         return -1;
     }
     return ent;
@@ -142,7 +142,7 @@
      */
     fd = ::open(zipFileName, O_RDONLY | O_BINARY);
     if (fd < 0) {
-        LOGW("Unable to open zip '%s': %s\n", zipFileName, strerror(errno));
+        ALOGW("Unable to open zip '%s': %s\n", zipFileName, strerror(errno));
         return NAME_NOT_FOUND;
     }
 
@@ -194,7 +194,7 @@
 
     unsigned char* scanBuf = (unsigned char*) malloc(readAmount);
     if (scanBuf == NULL) {
-        LOGW("couldn't allocate scanBuf: %s", strerror(errno));
+        ALOGW("couldn't allocate scanBuf: %s", strerror(errno));
         free(scanBuf);
         return false;
     }
@@ -203,14 +203,14 @@
      * Make sure this is a Zip archive.
      */
     if (lseek64(mFd, 0, SEEK_SET) != 0) {
-        LOGW("seek to start failed: %s", strerror(errno));
+        ALOGW("seek to start failed: %s", strerror(errno));
         free(scanBuf);
         return false;
     }
 
     ssize_t actual = TEMP_FAILURE_RETRY(read(mFd, scanBuf, sizeof(int32_t)));
     if (actual != (ssize_t) sizeof(int32_t)) {
-        LOGI("couldn't read first signature from zip archive: %s", strerror(errno));
+        ALOGI("couldn't read first signature from zip archive: %s", strerror(errno));
         free(scanBuf);
         return false;
     }
@@ -218,11 +218,11 @@
     {
         unsigned int header = get4LE(scanBuf);
         if (header == kEOCDSignature) {
-            LOGI("Found Zip archive, but it looks empty\n");
+            ALOGI("Found Zip archive, but it looks empty\n");
             free(scanBuf);
             return false;
         } else if (header != kLFHSignature) {
-            LOGV("Not a Zip archive (found 0x%08x)\n", header);
+            ALOGV("Not a Zip archive (found 0x%08x)\n", header);
             free(scanBuf);
             return false;
         }
@@ -243,13 +243,13 @@
     off64_t searchStart = mFileLength - readAmount;
 
     if (lseek64(mFd, searchStart, SEEK_SET) != searchStart) {
-        LOGW("seek %ld failed: %s\n",  (long) searchStart, strerror(errno));
+        ALOGW("seek %ld failed: %s\n",  (long) searchStart, strerror(errno));
         free(scanBuf);
         return false;
     }
     actual = TEMP_FAILURE_RETRY(read(mFd, scanBuf, readAmount));
     if (actual != (ssize_t) readAmount) {
-        LOGW("Zip: read " ZD ", expected " ZD ". Failed: %s\n",
+        ALOGW("Zip: read " ZD ", expected " ZD ". Failed: %s\n",
             (ZD_TYPE) actual, (ZD_TYPE) readAmount, strerror(errno));
         free(scanBuf);
         return false;
@@ -264,12 +264,12 @@
     int i;
     for (i = readAmount - kEOCDLen; i >= 0; i--) {
         if (scanBuf[i] == 0x50 && get4LE(&scanBuf[i]) == kEOCDSignature) {
-            LOGV("+++ Found EOCD at buf+%d\n", i);
+            ALOGV("+++ Found EOCD at buf+%d\n", i);
             break;
         }
     }
     if (i < 0) {
-        LOGD("Zip: EOCD not found, %s is not zip\n", mFileName);
+        ALOGD("Zip: EOCD not found, %s is not zip\n", mFileName);
         free(scanBuf);
         return false;
     }
@@ -290,26 +290,26 @@
 
     // Verify that they look reasonable.
     if ((long long) dirOffset + (long long) dirSize > (long long) eocdOffset) {
-        LOGW("bad offsets (dir %ld, size %u, eocd %ld)\n",
+        ALOGW("bad offsets (dir %ld, size %u, eocd %ld)\n",
             (long) dirOffset, dirSize, (long) eocdOffset);
         return false;
     }
     if (numEntries == 0) {
-        LOGW("empty archive?\n");
+        ALOGW("empty archive?\n");
         return false;
     }
 
-    LOGV("+++ numEntries=%d dirSize=%d dirOffset=%d\n",
+    ALOGV("+++ numEntries=%d dirSize=%d dirOffset=%d\n",
         numEntries, dirSize, dirOffset);
 
     mDirectoryMap = new FileMap();
     if (mDirectoryMap == NULL) {
-        LOGW("Unable to create directory map: %s", strerror(errno));
+        ALOGW("Unable to create directory map: %s", strerror(errno));
         return false;
     }
 
     if (!mDirectoryMap->create(mFileName, mFd, dirOffset, dirSize, true)) {
-        LOGW("Unable to map '%s' (" ZD " to " ZD "): %s\n", mFileName,
+        ALOGW("Unable to map '%s' (" ZD " to " ZD "): %s\n", mFileName,
                 (ZD_TYPE) dirOffset, (ZD_TYPE) (dirOffset + dirSize), strerror(errno));
         return false;
     }
@@ -341,17 +341,17 @@
     const unsigned char* ptr = cdPtr;
     for (int i = 0; i < numEntries; i++) {
         if (get4LE(ptr) != kCDESignature) {
-            LOGW("Missed a central dir sig (at %d)\n", i);
+            ALOGW("Missed a central dir sig (at %d)\n", i);
             goto bail;
         }
         if (ptr + kCDELen > cdPtr + cdLength) {
-            LOGW("Ran off the end (at %d)\n", i);
+            ALOGW("Ran off the end (at %d)\n", i);
             goto bail;
         }
 
         long localHdrOffset = (long) get4LE(ptr + kCDELocalOffset);
         if (localHdrOffset >= mDirectoryOffset) {
-            LOGW("bad LFH offset %ld at entry %d\n", localHdrOffset, i);
+            ALOGW("bad LFH offset %ld at entry %d\n", localHdrOffset, i);
             goto bail;
         }
 
@@ -367,12 +367,12 @@
 
         ptr += kCDELen + fileNameLen + extraLen + commentLen;
         if ((size_t)(ptr - cdPtr) > cdLength) {
-            LOGW("bad CD advance (%d vs " ZD ") at entry %d\n",
+            ALOGW("bad CD advance (%d vs " ZD ") at entry %d\n",
                 (int) (ptr - cdPtr), (ZD_TYPE) cdLength, i);
             goto bail;
         }
     }
-    LOGV("+++ zip good scan %d entries\n", numEntries);
+    ALOGV("+++ zip good scan %d entries\n", numEntries);
     result = true;
 
 bail:
@@ -452,7 +452,7 @@
 ZipEntryRO ZipFileRO::findEntryByIndex(int idx) const
 {
     if (idx < 0 || idx >= mNumEntries) {
-        LOGW("Invalid index %d\n", idx);
+        ALOGW("Invalid index %d\n", idx);
         return NULL;
     }
 
@@ -527,7 +527,7 @@
     if (pOffset != NULL) {
         long localHdrOffset = get4LE(ptr + kCDELocalOffset);
         if (localHdrOffset + kLFHLen >= cdOffset) {
-            LOGE("ERROR: bad local hdr offset in zip\n");
+            ALOGE("ERROR: bad local hdr offset in zip\n");
             return false;
         }
 
@@ -544,12 +544,12 @@
                 TEMP_FAILURE_RETRY(pread64(mFd, lfhBuf, sizeof(lfhBuf), localHdrOffset));
 
         if (actual != sizeof(lfhBuf)) {
-            LOGW("failed reading lfh from offset %ld\n", localHdrOffset);
+            ALOGW("failed reading lfh from offset %ld\n", localHdrOffset);
             return false;
         }
 
         if (get4LE(lfhBuf) != kLFHSignature) {
-            LOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; "
+            ALOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; "
                     "got: data=0x%08lx\n",
                     localHdrOffset, kLFHSignature, get4LE(lfhBuf));
             return false;
@@ -567,20 +567,20 @@
             AutoMutex _l(mFdLock);
 
             if (lseek64(mFd, localHdrOffset, SEEK_SET) != localHdrOffset) {
-                LOGW("failed seeking to lfh at offset %ld\n", localHdrOffset);
+                ALOGW("failed seeking to lfh at offset %ld\n", localHdrOffset);
                 return false;
             }
 
             ssize_t actual =
                     TEMP_FAILURE_RETRY(read(mFd, lfhBuf, sizeof(lfhBuf)));
             if (actual != sizeof(lfhBuf)) {
-                LOGW("failed reading lfh from offset %ld\n", localHdrOffset);
+                ALOGW("failed reading lfh from offset %ld\n", localHdrOffset);
                 return false;
             }
 
             if (get4LE(lfhBuf) != kLFHSignature) {
                 off64_t actualOffset = lseek64(mFd, 0, SEEK_CUR);
-                LOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; "
+                ALOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; "
                         "got: offset=" ZD " data=0x%08lx\n",
                         localHdrOffset, kLFHSignature, (ZD_TYPE) actualOffset, get4LE(lfhBuf));
                 return false;
@@ -591,13 +591,13 @@
         off64_t dataOffset = localHdrOffset + kLFHLen
             + get2LE(lfhBuf + kLFHNameLen) + get2LE(lfhBuf + kLFHExtraLen);
         if (dataOffset >= cdOffset) {
-            LOGW("bad data offset %ld in zip\n", (long) dataOffset);
+            ALOGW("bad data offset %ld in zip\n", (long) dataOffset);
             return false;
         }
 
         /* check lengths */
         if ((off64_t)(dataOffset + compLen) > cdOffset) {
-            LOGW("bad compressed length in zip (%ld + " ZD " > %ld)\n",
+            ALOGW("bad compressed length in zip (%ld + " ZD " > %ld)\n",
                 (long) dataOffset, (ZD_TYPE) compLen, (long) cdOffset);
             return false;
         }
@@ -605,7 +605,7 @@
         if (method == kCompressStored &&
             (off64_t)(dataOffset + uncompLen) > cdOffset)
         {
-            LOGE("ERROR: bad uncompressed length in zip (%ld + " ZD " > %ld)\n",
+            ALOGE("ERROR: bad uncompressed length in zip (%ld + " ZD " > %ld)\n",
                 (long) dataOffset, (ZD_TYPE) uncompLen, (long) cdOffset);
             return false;
         }
@@ -754,14 +754,14 @@
     if (method == kCompressStored) {
         ssize_t actual = write(fd, ptr, uncompLen);
         if (actual < 0) {
-            LOGE("Write failed: %s\n", strerror(errno));
+            ALOGE("Write failed: %s\n", strerror(errno));
             goto unmap;
         } else if ((size_t) actual != uncompLen) {
-            LOGE("Partial write during uncompress (" ZD " of " ZD ")\n",
+            ALOGE("Partial write during uncompress (" ZD " of " ZD ")\n",
                 (ZD_TYPE) actual, (ZD_TYPE) uncompLen);
             goto unmap;
         } else {
-            LOGI("+++ successful write\n");
+            ALOGI("+++ successful write\n");
         }
     } else {
         if (!inflateBuffer(fd, ptr, uncompLen, compLen))
@@ -806,10 +806,10 @@
     zerr = inflateInit2(&zstream, -MAX_WBITS);
     if (zerr != Z_OK) {
         if (zerr == Z_VERSION_ERROR) {
-            LOGE("Installed zlib is not compatible with linked version (%s)\n",
+            ALOGE("Installed zlib is not compatible with linked version (%s)\n",
                 ZLIB_VERSION);
         } else {
-            LOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr);
+            ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr);
         }
         goto bail;
     }
@@ -819,7 +819,7 @@
      */
     zerr = inflate(&zstream, Z_FINISH);
     if (zerr != Z_STREAM_END) {
-        LOGW("Zip inflate failed, zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n",
+        ALOGW("Zip inflate failed, zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n",
             zerr, zstream.next_in, zstream.avail_in,
             zstream.next_out, zstream.avail_out);
         goto z_bail;
@@ -827,7 +827,7 @@
 
     /* paranoia */
     if (zstream.total_out != uncompLen) {
-        LOGW("Size mismatch on inflated file (%ld vs " ZD ")\n",
+        ALOGW("Size mismatch on inflated file (%ld vs " ZD ")\n",
             zstream.total_out, (ZD_TYPE) uncompLen);
         goto z_bail;
     }
@@ -873,10 +873,10 @@
     zerr = inflateInit2(&zstream, -MAX_WBITS);
     if (zerr != Z_OK) {
         if (zerr == Z_VERSION_ERROR) {
-            LOGE("Installed zlib is not compatible with linked version (%s)\n",
+            ALOGE("Installed zlib is not compatible with linked version (%s)\n",
                 ZLIB_VERSION);
         } else {
-            LOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr);
+            ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr);
         }
         goto bail;
     }
@@ -890,7 +890,7 @@
          */
         zerr = inflate(&zstream, Z_NO_FLUSH);
         if (zerr != Z_OK && zerr != Z_STREAM_END) {
-            LOGW("zlib inflate: zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n",
+            ALOGW("zlib inflate: zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n",
                 zerr, zstream.next_in, zstream.avail_in,
                 zstream.next_out, zstream.avail_out);
             goto z_bail;
@@ -903,7 +903,7 @@
             long writeSize = zstream.next_out - writeBuf;
             int cc = write(fd, writeBuf, writeSize);
             if (cc != (int) writeSize) {
-                LOGW("write failed in inflate (%d vs %ld)\n", cc, writeSize);
+                ALOGW("write failed in inflate (%d vs %ld)\n", cc, writeSize);
                 goto z_bail;
             }
 
@@ -916,7 +916,7 @@
 
     /* paranoia */
     if (zstream.total_out != uncompLen) {
-        LOGW("Size mismatch on inflated file (%ld vs " ZD ")\n",
+        ALOGW("Size mismatch on inflated file (%ld vs " ZD ")\n",
             zstream.total_out, (ZD_TYPE) uncompLen);
         goto z_bail;
     }
diff --git a/libs/utils/ZipUtils.cpp b/libs/utils/ZipUtils.cpp
index 9138878..2dbdc1d 100644
--- a/libs/utils/ZipUtils.cpp
+++ b/libs/utils/ZipUtils.cpp
@@ -77,10 +77,10 @@
     zerr = inflateInit2(&zstream, -MAX_WBITS);
     if (zerr != Z_OK) {
         if (zerr == Z_VERSION_ERROR) {
-            LOGE("Installed zlib is not compatible with linked version (%s)\n",
+            ALOGE("Installed zlib is not compatible with linked version (%s)\n",
                 ZLIB_VERSION);
         } else {
-            LOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr);
+            ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr);
         }
         goto bail;
     }
@@ -95,12 +95,12 @@
         if (zstream.avail_in == 0) {
             getSize = (compRemaining > kReadBufSize) ?
                         kReadBufSize : compRemaining;
-            LOGV("+++ reading %ld bytes (%ld left)\n",
+            ALOGV("+++ reading %ld bytes (%ld left)\n",
                 getSize, compRemaining);
 
             int cc = read(fd, readBuf, getSize);
             if (cc != (int) getSize) {
-                LOGD("inflate read failed (%d vs %ld)\n",
+                ALOGD("inflate read failed (%d vs %ld)\n",
                     cc, getSize);
                 goto z_bail;
             }
@@ -114,7 +114,7 @@
         /* uncompress the data */
         zerr = inflate(&zstream, Z_NO_FLUSH);
         if (zerr != Z_OK && zerr != Z_STREAM_END) {
-            LOGD("zlib inflate call failed (zerr=%d)\n", zerr);
+            ALOGD("zlib inflate call failed (zerr=%d)\n", zerr);
             goto z_bail;
         }
 
@@ -124,7 +124,7 @@
     assert(zerr == Z_STREAM_END);       /* other errors should've been caught */
 
     if ((long) zstream.total_out != uncompressedLen) {
-        LOGW("Size mismatch on inflated file (%ld vs %ld)\n",
+        ALOGW("Size mismatch on inflated file (%ld vs %ld)\n",
             zstream.total_out, uncompressedLen);
         goto z_bail;
     }
@@ -189,10 +189,10 @@
     zerr = inflateInit2(&zstream, -MAX_WBITS);
     if (zerr != Z_OK) {
         if (zerr == Z_VERSION_ERROR) {
-            LOGE("Installed zlib is not compatible with linked version (%s)\n",
+            ALOGE("Installed zlib is not compatible with linked version (%s)\n",
                 ZLIB_VERSION);
         } else {
-            LOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr);
+            ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr);
         }
         goto bail;
     }
@@ -207,12 +207,12 @@
         if (zstream.avail_in == 0) {
             getSize = (compRemaining > kReadBufSize) ?
                         kReadBufSize : compRemaining;
-            LOGV("+++ reading %ld bytes (%ld left)\n",
+            ALOGV("+++ reading %ld bytes (%ld left)\n",
                 getSize, compRemaining);
 
             int cc = fread(readBuf, 1, getSize, fp);
             if (cc != (int) getSize) {
-                LOGD("inflate read failed (%d vs %ld)\n",
+                ALOGD("inflate read failed (%d vs %ld)\n",
                     cc, getSize);
                 goto z_bail;
             }
@@ -226,7 +226,7 @@
         /* uncompress the data */
         zerr = inflate(&zstream, Z_NO_FLUSH);
         if (zerr != Z_OK && zerr != Z_STREAM_END) {
-            LOGD("zlib inflate call failed (zerr=%d)\n", zerr);
+            ALOGD("zlib inflate call failed (zerr=%d)\n", zerr);
             goto z_bail;
         }
 
@@ -236,7 +236,7 @@
     assert(zerr == Z_STREAM_END);       /* other errors should've been caught */
 
     if ((long) zstream.total_out != uncompressedLen) {
-        LOGW("Size mismatch on inflated file (%ld vs %ld)\n",
+        ALOGW("Size mismatch on inflated file (%ld vs %ld)\n",
             zstream.total_out, uncompressedLen);
         goto z_bail;
     }
diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp
index 73aea2a..0dc3b65 100644
--- a/media/jni/android_media_MediaMetadataRetriever.cpp
+++ b/media/jni/android_media_MediaMetadataRetriever.cpp
@@ -83,7 +83,7 @@
         JNIEnv *env, jobject thiz, jstring path,
         jobjectArray keys, jobjectArray values) {
 
-    LOGV("setDataSource");
+    ALOGV("setDataSource");
     MediaMetadataRetriever* retriever = getRetriever(env, thiz);
     if (retriever == 0) {
         jniThrowException(
@@ -140,7 +140,7 @@
 
 static void android_media_MediaMetadataRetriever_setDataSourceFD(JNIEnv *env, jobject thiz, jobject fileDescriptor, jlong offset, jlong length)
 {
-    LOGV("setDataSource");
+    ALOGV("setDataSource");
     MediaMetadataRetriever* retriever = getRetriever(env, thiz);
     if (retriever == 0) {
         jniThrowException(env, "java/lang/IllegalStateException", "No retriever available");
@@ -153,13 +153,13 @@
     int fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
     if (offset < 0 || length < 0 || fd < 0) {
         if (offset < 0) {
-            LOGE("negative offset (%lld)", offset);
+            ALOGE("negative offset (%lld)", offset);
         }
         if (length < 0) {
-            LOGE("negative length (%lld)", length);
+            ALOGE("negative length (%lld)", length);
         }
         if (fd < 0) {
-            LOGE("invalid file descriptor");
+            ALOGE("invalid file descriptor");
         }
         jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
         return;
@@ -224,7 +224,7 @@
 
 static jobject android_media_MediaMetadataRetriever_getFrameAtTime(JNIEnv *env, jobject thiz, jlong timeUs, jint option)
 {
-    LOGV("getFrameAtTime: %lld us option: %d", timeUs, option);
+    ALOGV("getFrameAtTime: %lld us option: %d", timeUs, option);
     MediaMetadataRetriever* retriever = getRetriever(env, thiz);
     if (retriever == 0) {
         jniThrowException(env, "java/lang/IllegalStateException", "No retriever available");
@@ -238,11 +238,11 @@
         videoFrame = static_cast<VideoFrame *>(frameMemory->pointer());
     }
     if (videoFrame == NULL) {
-        LOGE("getFrameAtTime: videoFrame is a NULL pointer");
+        ALOGE("getFrameAtTime: videoFrame is a NULL pointer");
         return NULL;
     }
 
-    LOGV("Dimension = %dx%d and bytes = %d",
+    ALOGV("Dimension = %dx%d and bytes = %d",
             videoFrame->mDisplayWidth,
             videoFrame->mDisplayHeight,
             videoFrame->mSize);
@@ -289,7 +289,7 @@
             displayWidth = videoFrame->mDisplayHeight;
             displayHeight = videoFrame->mDisplayWidth;
         }
-        LOGV("Bitmap dimension is scaled from %dx%d to %dx%d",
+        ALOGV("Bitmap dimension is scaled from %dx%d to %dx%d",
                 width, height, displayWidth, displayHeight);
         jobject scaledBitmap = env->CallStaticObjectMethod(fields.bitmapClazz,
                                     fields.createScaledBitmapMethod,
@@ -306,7 +306,7 @@
 static jbyteArray android_media_MediaMetadataRetriever_getEmbeddedPicture(
         JNIEnv *env, jobject thiz, jint pictureType)
 {
-    LOGV("getEmbeddedPicture: %d", pictureType);
+    ALOGV("getEmbeddedPicture: %d", pictureType);
     MediaMetadataRetriever* retriever = getRetriever(env, thiz);
     if (retriever == 0) {
         jniThrowException(env, "java/lang/IllegalStateException", "No retriever available");
@@ -322,7 +322,7 @@
         mediaAlbumArt = static_cast<MediaAlbumArt *>(albumArtMemory->pointer());
     }
     if (mediaAlbumArt == NULL) {
-        LOGE("getEmbeddedPicture: Call to getEmbeddedPicture failed.");
+        ALOGE("getEmbeddedPicture: Call to getEmbeddedPicture failed.");
         return NULL;
     }
 
@@ -330,7 +330,7 @@
     char* data = (char*) mediaAlbumArt + sizeof(MediaAlbumArt);
     jbyteArray array = env->NewByteArray(len);
     if (!array) {  // OutOfMemoryError exception has already been thrown.
-        LOGE("getEmbeddedPicture: OutOfMemoryError is thrown.");
+        ALOGE("getEmbeddedPicture: OutOfMemoryError is thrown.");
     } else {
         jbyte* bytes = env->GetByteArrayElements(array, NULL);
         if (bytes != NULL) {
@@ -345,7 +345,7 @@
 
 static jobject android_media_MediaMetadataRetriever_extractMetadata(JNIEnv *env, jobject thiz, jint keyCode)
 {
-    LOGV("extractMetadata");
+    ALOGV("extractMetadata");
     MediaMetadataRetriever* retriever = getRetriever(env, thiz);
     if (retriever == 0) {
         jniThrowException(env, "java/lang/IllegalStateException", "No retriever available");
@@ -353,16 +353,16 @@
     }
     const char* value = retriever->extractMetadata(keyCode);
     if (!value) {
-        LOGV("extractMetadata: Metadata is not found");
+        ALOGV("extractMetadata: Metadata is not found");
         return NULL;
     }
-    LOGV("extractMetadata: value (%s) for keyCode(%d)", value, keyCode);
+    ALOGV("extractMetadata: value (%s) for keyCode(%d)", value, keyCode);
     return env->NewStringUTF(value);
 }
 
 static void android_media_MediaMetadataRetriever_release(JNIEnv *env, jobject thiz)
 {
-    LOGV("release");
+    ALOGV("release");
     Mutex::Autolock lock(sLock);
     MediaMetadataRetriever* retriever = getRetriever(env, thiz);
     delete retriever;
@@ -371,7 +371,7 @@
 
 static void android_media_MediaMetadataRetriever_native_finalize(JNIEnv *env, jobject thiz)
 {
-    LOGV("native_finalize");
+    ALOGV("native_finalize");
     // No lock is needed, since android_media_MediaMetadataRetriever_release() is protected
     android_media_MediaMetadataRetriever_release(env, thiz);
 }
@@ -436,7 +436,7 @@
 
 static void android_media_MediaMetadataRetriever_native_setup(JNIEnv *env, jobject thiz)
 {
-    LOGV("native_setup");
+    ALOGV("native_setup");
     MediaMetadataRetriever* retriever = new MediaMetadataRetriever();
     if (retriever == 0) {
         jniThrowException(env, "java/lang/RuntimeException", "Out of memory");
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 63cbf5e..39fd9a9 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -80,7 +80,7 @@
     // that posts events to the application thread.
     jclass clazz = env->GetObjectClass(thiz);
     if (clazz == NULL) {
-        LOGE("Can't find android/media/MediaPlayer");
+        ALOGE("Can't find android/media/MediaPlayer");
         jniThrowException(env, "java/lang/Exception", NULL);
         return;
     }
@@ -191,7 +191,7 @@
     if (tmp == NULL) {  // Out of memory
         return;
     }
-    LOGV("setDataSource: path %s", tmp);
+    ALOGV("setDataSource: path %s", tmp);
 
     String8 pathStr(tmp);
     env->ReleaseStringUTFChars(path, tmp);
@@ -234,7 +234,7 @@
         return;
     }
     int fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
-    LOGV("setDataSourceFD: fd %d", fd);
+    ALOGV("setDataSourceFD: fd %d", fd);
     process_media_player_call( env, thiz, mp->setDataSource(fd, offset, length), "java/io/IOException", "setDataSourceFD failed." );
 }
 
@@ -336,7 +336,7 @@
 static void
 android_media_MediaPlayer_start(JNIEnv *env, jobject thiz)
 {
-    LOGV("start");
+    ALOGV("start");
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -348,7 +348,7 @@
 static void
 android_media_MediaPlayer_stop(JNIEnv *env, jobject thiz)
 {
-    LOGV("stop");
+    ALOGV("stop");
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -360,7 +360,7 @@
 static void
 android_media_MediaPlayer_pause(JNIEnv *env, jobject thiz)
 {
-    LOGV("pause");
+    ALOGV("pause");
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -379,7 +379,7 @@
     }
     const jboolean is_playing = mp->isPlaying();
 
-    LOGV("isPlaying: %d", is_playing);
+    ALOGV("isPlaying: %d", is_playing);
     return is_playing;
 }
 
@@ -391,7 +391,7 @@
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
         return;
     }
-    LOGV("seekTo: %d(msec)", msec);
+    ALOGV("seekTo: %d(msec)", msec);
     process_media_player_call( env, thiz, mp->seekTo(msec), NULL, NULL );
 }
 
@@ -405,10 +405,10 @@
     }
     int w;
     if (0 != mp->getVideoWidth(&w)) {
-        LOGE("getVideoWidth failed");
+        ALOGE("getVideoWidth failed");
         w = 0;
     }
-    LOGV("getVideoWidth: %d", w);
+    ALOGV("getVideoWidth: %d", w);
     return w;
 }
 
@@ -422,10 +422,10 @@
     }
     int h;
     if (0 != mp->getVideoHeight(&h)) {
-        LOGE("getVideoHeight failed");
+        ALOGE("getVideoHeight failed");
         h = 0;
     }
-    LOGV("getVideoHeight: %d", h);
+    ALOGV("getVideoHeight: %d", h);
     return h;
 }
 
@@ -440,7 +440,7 @@
     }
     int msec;
     process_media_player_call( env, thiz, mp->getCurrentPosition(&msec), NULL, NULL );
-    LOGV("getCurrentPosition: %d (msec)", msec);
+    ALOGV("getCurrentPosition: %d (msec)", msec);
     return msec;
 }
 
@@ -454,14 +454,14 @@
     }
     int msec;
     process_media_player_call( env, thiz, mp->getDuration(&msec), NULL, NULL );
-    LOGV("getDuration: %d (msec)", msec);
+    ALOGV("getDuration: %d (msec)", msec);
     return msec;
 }
 
 static void
 android_media_MediaPlayer_reset(JNIEnv *env, jobject thiz)
 {
-    LOGV("reset");
+    ALOGV("reset");
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -473,7 +473,7 @@
 static void
 android_media_MediaPlayer_setAudioStreamType(JNIEnv *env, jobject thiz, int streamtype)
 {
-    LOGV("setAudioStreamType: %d", streamtype);
+    ALOGV("setAudioStreamType: %d", streamtype);
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -485,7 +485,7 @@
 static void
 android_media_MediaPlayer_setLooping(JNIEnv *env, jobject thiz, jboolean looping)
 {
-    LOGV("setLooping: %d", looping);
+    ALOGV("setLooping: %d", looping);
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -497,7 +497,7 @@
 static jboolean
 android_media_MediaPlayer_isLooping(JNIEnv *env, jobject thiz)
 {
-    LOGV("isLooping");
+    ALOGV("isLooping");
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -509,7 +509,7 @@
 static void
 android_media_MediaPlayer_setVolume(JNIEnv *env, jobject thiz, float leftVolume, float rightVolume)
 {
-    LOGV("setVolume: left %f  right %f", leftVolume, rightVolume);
+    ALOGV("setVolume: left %f  right %f", leftVolume, rightVolume);
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -625,7 +625,7 @@
 static void
 android_media_MediaPlayer_native_setup(JNIEnv *env, jobject thiz, jobject weak_this)
 {
-    LOGV("native_setup");
+    ALOGV("native_setup");
     sp<MediaPlayer> mp = new MediaPlayer();
     if (mp == NULL) {
         jniThrowException(env, "java/lang/RuntimeException", "Out of memory");
@@ -643,7 +643,7 @@
 static void
 android_media_MediaPlayer_release(JNIEnv *env, jobject thiz)
 {
-    LOGV("release");
+    ALOGV("release");
     decVideoSurfaceRef(env, thiz);
     sp<MediaPlayer> mp = setMediaPlayer(env, thiz, 0);
     if (mp != NULL) {
@@ -656,16 +656,16 @@
 static void
 android_media_MediaPlayer_native_finalize(JNIEnv *env, jobject thiz)
 {
-    LOGV("native_finalize");
+    ALOGV("native_finalize");
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp != NULL) {
-        LOGW("MediaPlayer finalized without being released");
+        ALOGW("MediaPlayer finalized without being released");
     }
     android_media_MediaPlayer_release(env, thiz);
 }
 
 static void android_media_MediaPlayer_set_audio_session_id(JNIEnv *env,  jobject thiz, jint sessionId) {
-    LOGV("set_session_id(): %d", sessionId);
+    ALOGV("set_session_id(): %d", sessionId);
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -675,7 +675,7 @@
 }
 
 static jint android_media_MediaPlayer_get_audio_session_id(JNIEnv *env,  jobject thiz) {
-    LOGV("get_session_id()");
+    ALOGV("get_session_id()");
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -688,7 +688,7 @@
 static void
 android_media_MediaPlayer_setAuxEffectSendLevel(JNIEnv *env, jobject thiz, jfloat level)
 {
-    LOGV("setAuxEffectSendLevel: level %f", level);
+    ALOGV("setAuxEffectSendLevel: level %f", level);
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -698,7 +698,7 @@
 }
 
 static void android_media_MediaPlayer_attachAuxEffect(JNIEnv *env,  jobject thiz, jint effectId) {
-    LOGV("attachAuxEffect(): %d", effectId);
+    ALOGV("attachAuxEffect(): %d", effectId);
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -725,7 +725,7 @@
 static jboolean
 android_media_MediaPlayer_setParameter(JNIEnv *env, jobject thiz, jint key, jobject java_request)
 {
-    LOGV("setParameter: key %d", key);
+    ALOGV("setParameter: key %d", key);
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -744,7 +744,7 @@
 static void
 android_media_MediaPlayer_getParameter(JNIEnv *env, jobject thiz, jint key, jobject java_reply)
 {
-    LOGV("getParameter: key %d", key);
+    ALOGV("getParameter: key %d", key);
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
     if (mp == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -826,58 +826,58 @@
     jint result = -1;
 
     if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
-        LOGE("ERROR: GetEnv failed\n");
+        ALOGE("ERROR: GetEnv failed\n");
         goto bail;
     }
     assert(env != NULL);
 
     if (register_android_media_MediaPlayer(env) < 0) {
-        LOGE("ERROR: MediaPlayer native registration failed\n");
+        ALOGE("ERROR: MediaPlayer native registration failed\n");
         goto bail;
     }
 
     if (register_android_media_MediaRecorder(env) < 0) {
-        LOGE("ERROR: MediaRecorder native registration failed\n");
+        ALOGE("ERROR: MediaRecorder native registration failed\n");
         goto bail;
     }
 
     if (register_android_media_MediaScanner(env) < 0) {
-        LOGE("ERROR: MediaScanner native registration failed\n");
+        ALOGE("ERROR: MediaScanner native registration failed\n");
         goto bail;
     }
 
     if (register_android_media_MediaMetadataRetriever(env) < 0) {
-        LOGE("ERROR: MediaMetadataRetriever native registration failed\n");
+        ALOGE("ERROR: MediaMetadataRetriever native registration failed\n");
         goto bail;
     }
 
     if (register_android_media_AmrInputStream(env) < 0) {
-        LOGE("ERROR: AmrInputStream native registration failed\n");
+        ALOGE("ERROR: AmrInputStream native registration failed\n");
         goto bail;
     }
 
     if (register_android_media_ResampleInputStream(env) < 0) {
-        LOGE("ERROR: ResampleInputStream native registration failed\n");
+        ALOGE("ERROR: ResampleInputStream native registration failed\n");
         goto bail;
     }
 
     if (register_android_media_MediaProfiles(env) < 0) {
-        LOGE("ERROR: MediaProfiles native registration failed");
+        ALOGE("ERROR: MediaProfiles native registration failed");
         goto bail;
     }
 
     if (register_android_mtp_MtpDatabase(env) < 0) {
-        LOGE("ERROR: MtpDatabase native registration failed");
+        ALOGE("ERROR: MtpDatabase native registration failed");
         goto bail;
     }
 
     if (register_android_mtp_MtpDevice(env) < 0) {
-        LOGE("ERROR: MtpDevice native registration failed");
+        ALOGE("ERROR: MtpDevice native registration failed");
         goto bail;
     }
 
     if (register_android_mtp_MtpServer(env) < 0) {
-        LOGE("ERROR: MtpServer native registration failed");
+        ALOGE("ERROR: MtpServer native registration failed");
         goto bail;
     }
 
diff --git a/media/jni/android_media_MediaProfiles.cpp b/media/jni/android_media_MediaProfiles.cpp
index 7ed0050..3fbb8ba 100644
--- a/media/jni/android_media_MediaProfiles.cpp
+++ b/media/jni/android_media_MediaProfiles.cpp
@@ -36,7 +36,7 @@
 static void
 android_media_MediaProfiles_native_init(JNIEnv *env)
 {
-    LOGV("native_init");
+    ALOGV("native_init");
     Mutex::Autolock lock(sLock);
 
     if (sProfiles == NULL) {
@@ -47,14 +47,14 @@
 static jint
 android_media_MediaProfiles_native_get_num_file_formats(JNIEnv *env, jobject thiz)
 {
-    LOGV("native_get_num_file_formats");
+    ALOGV("native_get_num_file_formats");
     return sProfiles->getOutputFileFormats().size();
 }
 
 static jint
 android_media_MediaProfiles_native_get_file_format(JNIEnv *env, jobject thiz, jint index)
 {
-    LOGV("native_get_file_format: %d", index);
+    ALOGV("native_get_file_format: %d", index);
     Vector<output_format> formats = sProfiles->getOutputFileFormats();
     int nSize = formats.size();
     if (index < 0 || index >= nSize) {
@@ -67,14 +67,14 @@
 static jint
 android_media_MediaProfiles_native_get_num_video_encoders(JNIEnv *env, jobject thiz)
 {
-    LOGV("native_get_num_video_encoders");
+    ALOGV("native_get_num_video_encoders");
     return sProfiles->getVideoEncoders().size();
 }
 
 static jobject
 android_media_MediaProfiles_native_get_video_encoder_cap(JNIEnv *env, jobject thiz, jint index)
 {
-    LOGV("native_get_video_encoder_cap: %d", index);
+    ALOGV("native_get_video_encoder_cap: %d", index);
     Vector<video_encoder> encoders = sProfiles->getVideoEncoders();
     int nSize = encoders.size();
     if (index < 0 || index >= nSize) {
@@ -118,14 +118,14 @@
 static jint
 android_media_MediaProfiles_native_get_num_audio_encoders(JNIEnv *env, jobject thiz)
 {
-    LOGV("native_get_num_audio_encoders");
+    ALOGV("native_get_num_audio_encoders");
     return sProfiles->getAudioEncoders().size();
 }
 
 static jobject
 android_media_MediaProfiles_native_get_audio_encoder_cap(JNIEnv *env, jobject thiz, jint index)
 {
-    LOGV("native_get_audio_encoder_cap: %d", index);
+    ALOGV("native_get_audio_encoder_cap: %d", index);
     Vector<audio_encoder> encoders = sProfiles->getAudioEncoders();
     int nSize = encoders.size();
     if (index < 0 || index >= nSize) {
@@ -172,7 +172,7 @@
 static jobject
 android_media_MediaProfiles_native_get_camcorder_profile(JNIEnv *env, jobject thiz, jint id, jint quality)
 {
-    LOGV("native_get_camcorder_profile: %d %d", id, quality);
+    ALOGV("native_get_camcorder_profile: %d %d", id, quality);
     if (!isCamcorderQualityKnown(quality)) {
         jniThrowException(env, "java/lang/RuntimeException", "Unknown camcorder profile quality");
         return NULL;
@@ -221,7 +221,7 @@
 static jboolean
 android_media_MediaProfiles_native_has_camcorder_profile(JNIEnv *env, jobject thiz, jint id, jint quality)
 {
-    LOGV("native_has_camcorder_profile: %d %d", id, quality);
+    ALOGV("native_has_camcorder_profile: %d %d", id, quality);
     if (!isCamcorderQualityKnown(quality)) {
         return false;
     }
@@ -233,14 +233,14 @@
 static jint
 android_media_MediaProfiles_native_get_num_video_decoders(JNIEnv *env, jobject thiz)
 {
-    LOGV("native_get_num_video_decoders");
+    ALOGV("native_get_num_video_decoders");
     return sProfiles->getVideoDecoders().size();
 }
 
 static jint
 android_media_MediaProfiles_native_get_video_decoder_type(JNIEnv *env, jobject thiz, jint index)
 {
-    LOGV("native_get_video_decoder_type: %d", index);
+    ALOGV("native_get_video_decoder_type: %d", index);
     Vector<video_decoder> decoders = sProfiles->getVideoDecoders();
     int nSize = decoders.size();
     if (index < 0 || index >= nSize) {
@@ -254,14 +254,14 @@
 static jint
 android_media_MediaProfiles_native_get_num_audio_decoders(JNIEnv *env, jobject thiz)
 {
-    LOGV("native_get_num_audio_decoders");
+    ALOGV("native_get_num_audio_decoders");
     return sProfiles->getAudioDecoders().size();
 }
 
 static jint
 android_media_MediaProfiles_native_get_audio_decoder_type(JNIEnv *env, jobject thiz, jint index)
 {
-    LOGV("native_get_audio_decoder_type: %d", index);
+    ALOGV("native_get_audio_decoder_type: %d", index);
     Vector<audio_decoder> decoders = sProfiles->getAudioDecoders();
     int nSize = decoders.size();
     if (index < 0 || index >= nSize) {
@@ -275,14 +275,14 @@
 static jint
 android_media_MediaProfiles_native_get_num_image_encoding_quality_levels(JNIEnv *env, jobject thiz, jint cameraId)
 {
-    LOGV("native_get_num_image_encoding_quality_levels");
+    ALOGV("native_get_num_image_encoding_quality_levels");
     return sProfiles->getImageEncodingQualityLevels(cameraId).size();
 }
 
 static jint
 android_media_MediaProfiles_native_get_image_encoding_quality_level(JNIEnv *env, jobject thiz, jint cameraId, jint index)
 {
-    LOGV("native_get_image_encoding_quality_level");
+    ALOGV("native_get_image_encoding_quality_level");
     Vector<int> levels = sProfiles->getImageEncodingQualityLevels(cameraId);
     if (index < 0 || index >= levels.size()) {
         jniThrowException(env, "java/lang/IllegalArgumentException", "out of array boundary");
@@ -293,7 +293,7 @@
 static jobject
 android_media_MediaProfiles_native_get_videoeditor_profile(JNIEnv *env, jobject thiz)
 {
-    LOGV("native_get_videoeditor_profile");
+    ALOGV("native_get_videoeditor_profile");
 
     int maxInputFrameWidth =
             sProfiles->getVideoEditorCapParamByName("videoeditor.input.width.max");
@@ -312,7 +312,7 @@
             "Error retrieving videoeditor profile params");
         return NULL;
     }
-    LOGV("native_get_videoeditor_profile \
+    ALOGV("native_get_videoeditor_profile \
         inWidth:%d inHeight:%d,outWidth:%d, outHeight:%d",\
         maxInputFrameWidth,maxInputFrameHeight,\
         maxOutputFrameWidth,maxOutputFrameHeight);
@@ -332,7 +332,7 @@
 android_media_MediaProfiles_native_get_videoeditor_export_profile(
     JNIEnv *env, jobject thiz, jint codec)
 {
-    LOGV("android_media_MediaProfiles_native_get_export_profile index ");
+    ALOGV("android_media_MediaProfiles_native_get_export_profile index ");
     int profile =0;
     profile = sProfiles->getVideoEditorExportParamByName("videoeditor.export.profile", codec);
     // Check the values retrieved
@@ -348,7 +348,7 @@
 android_media_MediaProfiles_native_get_videoeditor_export_level(
     JNIEnv *env, jobject thiz, jint codec)
 {
-    LOGV("android_media_MediaProfiles_native_get_export_level");
+    ALOGV("android_media_MediaProfiles_native_get_export_level");
     int level =0;
     level = sProfiles->getVideoEditorExportParamByName("videoeditor.export.level", codec);
     // Check the values retrieved
diff --git a/media/jni/android_media_MediaRecorder.cpp b/media/jni/android_media_MediaRecorder.cpp
index e1d3219..acc65f1 100644
--- a/media/jni/android_media_MediaRecorder.cpp
+++ b/media/jni/android_media_MediaRecorder.cpp
@@ -77,7 +77,7 @@
     // that posts events to the application thread.
     jclass clazz = env->GetObjectClass(thiz);
     if (clazz == NULL) {
-        LOGE("Can't find android/media/MediaRecorder");
+        ALOGE("Can't find android/media/MediaRecorder");
         jniThrowException(env, "java/lang/Exception", NULL);
         return;
     }
@@ -98,7 +98,7 @@
 
 void JNIMediaRecorderListener::notify(int msg, int ext1, int ext2)
 {
-    LOGV("JNIMediaRecorderListener::notify");
+    ALOGV("JNIMediaRecorderListener::notify");
 
     JNIEnv *env = AndroidRuntime::getJNIEnv();
     env->CallStaticVoidMethod(mClass, fields.post_event, mObject, msg, ext1, ext2, 0);
@@ -108,7 +108,7 @@
 
 static sp<Surface> get_surface(JNIEnv* env, jobject clazz)
 {
-    LOGV("get_surface");
+    ALOGV("get_surface");
     Surface* const p = (Surface*)env->GetIntField(clazz, fields.surface_native);
     return sp<Surface>(p);
 }
@@ -116,7 +116,7 @@
 // Returns true if it throws an exception.
 static bool process_media_recorder_call(JNIEnv *env, status_t opStatus, const char* exception, const char* message)
 {
-    LOGV("process_media_recorder_call");
+    ALOGV("process_media_recorder_call");
     if (opStatus == (status_t)INVALID_OPERATION) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
         return true;
@@ -165,7 +165,7 @@
 static void
 android_media_MediaRecorder_setVideoSource(JNIEnv *env, jobject thiz, jint vs)
 {
-    LOGV("setVideoSource(%d)", vs);
+    ALOGV("setVideoSource(%d)", vs);
     if (vs < VIDEO_SOURCE_DEFAULT || vs >= VIDEO_SOURCE_LIST_END) {
         jniThrowException(env, "java/lang/IllegalArgumentException", "Invalid video source");
         return;
@@ -177,7 +177,7 @@
 static void
 android_media_MediaRecorder_setAudioSource(JNIEnv *env, jobject thiz, jint as)
 {
-    LOGV("setAudioSource(%d)", as);
+    ALOGV("setAudioSource(%d)", as);
     if (as < AUDIO_SOURCE_DEFAULT || as >= AUDIO_SOURCE_CNT) {
         jniThrowException(env, "java/lang/IllegalArgumentException", "Invalid audio source");
         return;
@@ -190,7 +190,7 @@
 static void
 android_media_MediaRecorder_setOutputFormat(JNIEnv *env, jobject thiz, jint of)
 {
-    LOGV("setOutputFormat(%d)", of);
+    ALOGV("setOutputFormat(%d)", of);
     if (of < OUTPUT_FORMAT_DEFAULT || of >= OUTPUT_FORMAT_LIST_END) {
         jniThrowException(env, "java/lang/IllegalArgumentException", "Invalid output format");
         return;
@@ -202,7 +202,7 @@
 static void
 android_media_MediaRecorder_setVideoEncoder(JNIEnv *env, jobject thiz, jint ve)
 {
-    LOGV("setVideoEncoder(%d)", ve);
+    ALOGV("setVideoEncoder(%d)", ve);
     if (ve < VIDEO_ENCODER_DEFAULT || ve >= VIDEO_ENCODER_LIST_END) {
         jniThrowException(env, "java/lang/IllegalArgumentException", "Invalid video encoder");
         return;
@@ -214,7 +214,7 @@
 static void
 android_media_MediaRecorder_setAudioEncoder(JNIEnv *env, jobject thiz, jint ae)
 {
-    LOGV("setAudioEncoder(%d)", ae);
+    ALOGV("setAudioEncoder(%d)", ae);
     if (ae < AUDIO_ENCODER_DEFAULT || ae >= AUDIO_ENCODER_LIST_END) {
         jniThrowException(env, "java/lang/IllegalArgumentException", "Invalid audio encoder");
         return;
@@ -226,10 +226,10 @@
 static void
 android_media_MediaRecorder_setParameter(JNIEnv *env, jobject thiz, jstring params)
 {
-    LOGV("setParameter()");
+    ALOGV("setParameter()");
     if (params == NULL)
     {
-        LOGE("Invalid or empty params string.  This parameter will be ignored.");
+        ALOGE("Invalid or empty params string.  This parameter will be ignored.");
         return;
     }
 
@@ -238,7 +238,7 @@
     const char* params8 = env->GetStringUTFChars(params, NULL);
     if (params8 == NULL)
     {
-        LOGE("Failed to covert jstring to String8.  This parameter will be ignored.");
+        ALOGE("Failed to covert jstring to String8.  This parameter will be ignored.");
         return;
     }
 
@@ -249,7 +249,7 @@
 static void
 android_media_MediaRecorder_setOutputFileFD(JNIEnv *env, jobject thiz, jobject fileDescriptor, jlong offset, jlong length)
 {
-    LOGV("setOutputFile");
+    ALOGV("setOutputFile");
     if (fileDescriptor == NULL) {
         jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
         return;
@@ -263,7 +263,7 @@
 static void
 android_media_MediaRecorder_setVideoSize(JNIEnv *env, jobject thiz, jint width, jint height)
 {
-    LOGV("setVideoSize(%d, %d)", width, height);
+    ALOGV("setVideoSize(%d, %d)", width, height);
     sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
 
     if (width <= 0 || height <= 0) {
@@ -276,7 +276,7 @@
 static void
 android_media_MediaRecorder_setVideoFrameRate(JNIEnv *env, jobject thiz, jint rate)
 {
-    LOGV("setVideoFrameRate(%d)", rate);
+    ALOGV("setVideoFrameRate(%d)", rate);
     if (rate <= 0) {
         jniThrowException(env, "java/lang/IllegalArgumentException", "invalid frame rate");
         return;
@@ -288,7 +288,7 @@
 static void
 android_media_MediaRecorder_setMaxDuration(JNIEnv *env, jobject thiz, jint max_duration_ms)
 {
-    LOGV("setMaxDuration(%d)", max_duration_ms);
+    ALOGV("setMaxDuration(%d)", max_duration_ms);
     sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
 
     char params[64];
@@ -301,7 +301,7 @@
 android_media_MediaRecorder_setMaxFileSize(
         JNIEnv *env, jobject thiz, jlong max_filesize_bytes)
 {
-    LOGV("setMaxFileSize(%lld)", max_filesize_bytes);
+    ALOGV("setMaxFileSize(%lld)", max_filesize_bytes);
     sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
 
     char params[64];
@@ -313,7 +313,7 @@
 static void
 android_media_MediaRecorder_prepare(JNIEnv *env, jobject thiz)
 {
-    LOGV("prepare");
+    ALOGV("prepare");
     sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
 
     jobject surface = env->GetObjectField(thiz, fields.surface);
@@ -323,12 +323,12 @@
         // The application may misbehave and
         // the preview surface becomes unavailable
         if (native_surface.get() == 0) {
-            LOGE("Application lost the surface");
+            ALOGE("Application lost the surface");
             jniThrowException(env, "java/io/IOException", "invalid preview surface");
             return;
         }
 
-        LOGI("prepare: surface=%p (identity=%d)", native_surface.get(), native_surface->getIdentity());
+        ALOGI("prepare: surface=%p (identity=%d)", native_surface.get(), native_surface->getIdentity());
         if (process_media_recorder_call(env, mr->setPreviewSurface(native_surface), "java/lang/RuntimeException", "setPreviewSurface failed.")) {
             return;
         }
@@ -339,7 +339,7 @@
 static int
 android_media_MediaRecorder_native_getMaxAmplitude(JNIEnv *env, jobject thiz)
 {
-    LOGV("getMaxAmplitude");
+    ALOGV("getMaxAmplitude");
     sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
     int result = 0;
     process_media_recorder_call(env, mr->getMaxAmplitude(&result), "java/lang/RuntimeException", "getMaxAmplitude failed.");
@@ -349,7 +349,7 @@
 static void
 android_media_MediaRecorder_start(JNIEnv *env, jobject thiz)
 {
-    LOGV("start");
+    ALOGV("start");
     sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
     process_media_recorder_call(env, mr->start(), "java/lang/RuntimeException", "start failed.");
 }
@@ -357,7 +357,7 @@
 static void
 android_media_MediaRecorder_stop(JNIEnv *env, jobject thiz)
 {
-    LOGV("stop");
+    ALOGV("stop");
     sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
     process_media_recorder_call(env, mr->stop(), "java/lang/RuntimeException", "stop failed.");
 }
@@ -365,7 +365,7 @@
 static void
 android_media_MediaRecorder_native_reset(JNIEnv *env, jobject thiz)
 {
-    LOGV("native_reset");
+    ALOGV("native_reset");
     sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
     process_media_recorder_call(env, mr->reset(), "java/lang/RuntimeException", "native_reset failed.");
 }
@@ -373,7 +373,7 @@
 static void
 android_media_MediaRecorder_release(JNIEnv *env, jobject thiz)
 {
-    LOGV("release");
+    ALOGV("release");
     sp<MediaRecorder> mr = setMediaRecorder(env, thiz, 0);
     if (mr != NULL) {
         mr->setListener(NULL);
@@ -425,7 +425,7 @@
 static void
 android_media_MediaRecorder_native_setup(JNIEnv *env, jobject thiz, jobject weak_this)
 {
-    LOGV("setup");
+    ALOGV("setup");
     sp<MediaRecorder> mr = new MediaRecorder();
     if (mr == NULL) {
         jniThrowException(env, "java/lang/RuntimeException", "Out of memory");
@@ -446,7 +446,7 @@
 static void
 android_media_MediaRecorder_native_finalize(JNIEnv *env, jobject thiz)
 {
-    LOGV("finalize");
+    ALOGV("finalize");
     android_media_MediaRecorder_release(env, thiz);
 }
 
diff --git a/media/jni/android_media_MediaScanner.cpp b/media/jni/android_media_MediaScanner.cpp
index 09152f5..5d27966 100644
--- a/media/jni/android_media_MediaScanner.cpp
+++ b/media/jni/android_media_MediaScanner.cpp
@@ -48,7 +48,7 @@
 
 static status_t checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {
     if (env->ExceptionCheck()) {
-        LOGE("An exception was thrown by callback '%s'.", methodName);
+        ALOGE("An exception was thrown by callback '%s'.", methodName);
         LOGE_EX(env);
         env->ExceptionClear();
         return UNKNOWN_ERROR;
@@ -113,12 +113,12 @@
             mHandleStringTagMethodID(0),
             mSetMimeTypeMethodID(0)
     {
-        LOGV("MyMediaScannerClient constructor");
+        ALOGV("MyMediaScannerClient constructor");
         jclass mediaScannerClientInterface =
                 env->FindClass(kClassMediaScannerClient);
 
         if (mediaScannerClientInterface == NULL) {
-            LOGE("Class %s not found", kClassMediaScannerClient);
+            ALOGE("Class %s not found", kClassMediaScannerClient);
         } else {
             mScanFileMethodID = env->GetMethodID(
                                     mediaScannerClientInterface,
@@ -139,14 +139,14 @@
 
     virtual ~MyMediaScannerClient()
     {
-        LOGV("MyMediaScannerClient destructor");
+        ALOGV("MyMediaScannerClient destructor");
         mEnv->DeleteGlobalRef(mClient);
     }
 
     virtual status_t scanFile(const char* path, long long lastModified,
             long long fileSize, bool isDirectory, bool noMedia)
     {
-        LOGV("scanFile: path(%s), time(%lld), size(%lld) and isDir(%d)",
+        ALOGV("scanFile: path(%s), time(%lld), size(%lld) and isDir(%d)",
             path, lastModified, fileSize, isDirectory);
 
         jstring pathStr;
@@ -164,7 +164,7 @@
 
     virtual status_t handleStringTag(const char* name, const char* value)
     {
-        LOGV("handleStringTag: name(%s) and value(%s)", name, value);
+        ALOGV("handleStringTag: name(%s) and value(%s)", name, value);
         jstring nameStr, valueStr;
         if ((nameStr = mEnv->NewStringUTF(name)) == NULL) {
             mEnv->ExceptionClear();
@@ -201,7 +201,7 @@
 
     virtual status_t setMimeType(const char* mimeType)
     {
-        LOGV("setMimeType: %s", mimeType);
+        ALOGV("setMimeType: %s", mimeType);
         jstring mimeTypeStr;
         if ((mimeTypeStr = mEnv->NewStringUTF(mimeType)) == NULL) {
             mEnv->ExceptionClear();
@@ -237,7 +237,7 @@
 android_media_MediaScanner_processDirectory(
         JNIEnv *env, jobject thiz, jstring path, jobject client)
 {
-    LOGV("processDirectory");
+    ALOGV("processDirectory");
     MediaScanner *mp = getNativeScanner_l(env, thiz);
     if (mp == NULL) {
         jniThrowException(env, kRunTimeException, "No scanner available");
@@ -257,7 +257,7 @@
     MyMediaScannerClient myClient(env, client);
     MediaScanResult result = mp->processDirectory(pathStr, myClient);
     if (result == MEDIA_SCAN_RESULT_ERROR) {
-        LOGE("An error occurred while scanning directory '%s'.", pathStr);
+        ALOGE("An error occurred while scanning directory '%s'.", pathStr);
     }
     env->ReleaseStringUTFChars(path, pathStr);
 }
@@ -267,7 +267,7 @@
         JNIEnv *env, jobject thiz, jstring path,
         jstring mimeType, jobject client)
 {
-    LOGV("processFile");
+    ALOGV("processFile");
 
     // Lock already hold by processDirectory
     MediaScanner *mp = getNativeScanner_l(env, thiz);
@@ -297,7 +297,7 @@
     MyMediaScannerClient myClient(env, client);
     MediaScanResult result = mp->processFile(pathStr, mimeTypeStr, myClient);
     if (result == MEDIA_SCAN_RESULT_ERROR) {
-        LOGE("An error occurred while scanning file '%s'.", pathStr);
+        ALOGE("An error occurred while scanning file '%s'.", pathStr);
     }
     env->ReleaseStringUTFChars(path, pathStr);
     if (mimeType) {
@@ -309,7 +309,7 @@
 android_media_MediaScanner_setLocale(
         JNIEnv *env, jobject thiz, jstring locale)
 {
-    LOGV("setLocale");
+    ALOGV("setLocale");
     MediaScanner *mp = getNativeScanner_l(env, thiz);
     if (mp == NULL) {
         jniThrowException(env, kRunTimeException, "No scanner available");
@@ -333,7 +333,7 @@
 android_media_MediaScanner_extractAlbumArt(
         JNIEnv *env, jobject thiz, jobject fileDescriptor)
 {
-    LOGV("extractAlbumArt");
+    ALOGV("extractAlbumArt");
     MediaScanner *mp = getNativeScanner_l(env, thiz);
     if (mp == NULL) {
         jniThrowException(env, kRunTimeException, "No scanner available");
@@ -374,7 +374,7 @@
 static void
 android_media_MediaScanner_native_init(JNIEnv *env)
 {
-    LOGV("native_init");
+    ALOGV("native_init");
     jclass clazz = env->FindClass(kClassMediaScanner);
     if (clazz == NULL) {
         return;
@@ -389,7 +389,7 @@
 static void
 android_media_MediaScanner_native_setup(JNIEnv *env, jobject thiz)
 {
-    LOGV("native_setup");
+    ALOGV("native_setup");
     MediaScanner *mp = new StagefrightMediaScanner;
 
     if (mp == NULL) {
@@ -403,7 +403,7 @@
 static void
 android_media_MediaScanner_native_finalize(JNIEnv *env, jobject thiz)
 {
-    LOGV("native_finalize");
+    ALOGV("native_finalize");
     MediaScanner *mp = getNativeScanner_l(env, thiz);
     if (mp == 0) {
         return;
diff --git a/media/jni/android_media_Utils.cpp b/media/jni/android_media_Utils.cpp
index 27e46a4..47963b1 100644
--- a/media/jni/android_media_Utils.cpp
+++ b/media/jni/android_media_Utils.cpp
@@ -39,7 +39,7 @@
     }
 
     if (failed) {
-        LOGE("keys and values arrays have different length");
+        ALOGE("keys and values arrays have different length");
         jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
         return false;
     }
diff --git a/media/jni/android_mtp_MtpDatabase.cpp b/media/jni/android_mtp_MtpDatabase.cpp
index 4dbcb90..99e543b 100644
--- a/media/jni/android_mtp_MtpDatabase.cpp
+++ b/media/jni/android_mtp_MtpDatabase.cpp
@@ -174,7 +174,7 @@
 
 static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {
     if (env->ExceptionCheck()) {
-        LOGE("An exception was thrown by callback '%s'.", methodName);
+        ALOGE("An exception was thrown by callback '%s'.", methodName);
         LOGE_EX(env);
         env->ExceptionClear();
     }
@@ -439,7 +439,7 @@
                 break;
              }
             default:
-                LOGE("unsupported type in getObjectPropertyValue\n");
+                ALOGE("unsupported type in getObjectPropertyValue\n");
                 result = MTP_RESPONSE_INVALID_OBJECT_PROP_FORMAT;
         }
 out:
@@ -508,7 +508,7 @@
             break;
          }
         default:
-            LOGE("unsupported type in getObjectPropertyValue\n");
+            ALOGE("unsupported type in getObjectPropertyValue\n");
             return MTP_RESPONSE_INVALID_OBJECT_PROP_FORMAT;
     }
 
@@ -579,7 +579,7 @@
             break;
          }
         default:
-            LOGE("unsupported type in getDevicePropertyValue\n");
+            ALOGE("unsupported type in getDevicePropertyValue\n");
             return MTP_RESPONSE_INVALID_DEVICE_PROP_FORMAT;
     }
 
@@ -631,7 +631,7 @@
             break;
          }
         default:
-            LOGE("unsupported type in setDevicePropertyValue\n");
+            ALOGE("unsupported type in setDevicePropertyValue\n");
             return MTP_RESPONSE_INVALID_OBJECT_PROP_FORMAT;
     }
 
@@ -724,7 +724,7 @@
                     break;
                 }
                 default:
-                    LOGE("bad or unsupported data type in MyMtpDatabase::getObjectPropertyList");
+                    ALOGE("bad or unsupported data type in MyMtpDatabase::getObjectPropertyList");
                     break;
             }
         }
@@ -957,7 +957,7 @@
     int count = references->size();
     jintArray array = env->NewIntArray(count);
     if (!array) {
-        LOGE("out of memory in setObjectReferences");
+        ALOGE("out of memory in setObjectReferences");
         return false;
     }
     jint* handles = env->GetIntArrayElements(array, 0);
@@ -1044,7 +1044,7 @@
                     result->setDefaultValue(str);
                 env->ReleaseCharArrayElements(mStringBuffer, str, 0);
             } else {
-                LOGE("unable to read device property, response: %04X", ret);
+                ALOGE("unable to read device property, response: %04X", ret);
             }
             break;
     }
@@ -1113,151 +1113,151 @@
 
     clazz = env->FindClass("android/mtp/MtpDatabase");
     if (clazz == NULL) {
-        LOGE("Can't find android/mtp/MtpDatabase");
+        ALOGE("Can't find android/mtp/MtpDatabase");
         return -1;
     }
     method_beginSendObject = env->GetMethodID(clazz, "beginSendObject", "(Ljava/lang/String;IIIJJ)I");
     if (method_beginSendObject == NULL) {
-        LOGE("Can't find beginSendObject");
+        ALOGE("Can't find beginSendObject");
         return -1;
     }
     method_endSendObject = env->GetMethodID(clazz, "endSendObject", "(Ljava/lang/String;IIZ)V");
     if (method_endSendObject == NULL) {
-        LOGE("Can't find endSendObject");
+        ALOGE("Can't find endSendObject");
         return -1;
     }
     method_getObjectList = env->GetMethodID(clazz, "getObjectList", "(III)[I");
     if (method_getObjectList == NULL) {
-        LOGE("Can't find getObjectList");
+        ALOGE("Can't find getObjectList");
         return -1;
     }
     method_getNumObjects = env->GetMethodID(clazz, "getNumObjects", "(III)I");
     if (method_getNumObjects == NULL) {
-        LOGE("Can't find getNumObjects");
+        ALOGE("Can't find getNumObjects");
         return -1;
     }
     method_getSupportedPlaybackFormats = env->GetMethodID(clazz, "getSupportedPlaybackFormats", "()[I");
     if (method_getSupportedPlaybackFormats == NULL) {
-        LOGE("Can't find getSupportedPlaybackFormats");
+        ALOGE("Can't find getSupportedPlaybackFormats");
         return -1;
     }
     method_getSupportedCaptureFormats = env->GetMethodID(clazz, "getSupportedCaptureFormats", "()[I");
     if (method_getSupportedCaptureFormats == NULL) {
-        LOGE("Can't find getSupportedCaptureFormats");
+        ALOGE("Can't find getSupportedCaptureFormats");
         return -1;
     }
     method_getSupportedObjectProperties = env->GetMethodID(clazz, "getSupportedObjectProperties", "(I)[I");
     if (method_getSupportedObjectProperties == NULL) {
-        LOGE("Can't find getSupportedObjectProperties");
+        ALOGE("Can't find getSupportedObjectProperties");
         return -1;
     }
     method_getSupportedDeviceProperties = env->GetMethodID(clazz, "getSupportedDeviceProperties", "()[I");
     if (method_getSupportedDeviceProperties == NULL) {
-        LOGE("Can't find getSupportedDeviceProperties");
+        ALOGE("Can't find getSupportedDeviceProperties");
         return -1;
     }
     method_setObjectProperty = env->GetMethodID(clazz, "setObjectProperty", "(IIJLjava/lang/String;)I");
     if (method_setObjectProperty == NULL) {
-        LOGE("Can't find setObjectProperty");
+        ALOGE("Can't find setObjectProperty");
         return -1;
     }
     method_getDeviceProperty = env->GetMethodID(clazz, "getDeviceProperty", "(I[J[C)I");
     if (method_getDeviceProperty == NULL) {
-        LOGE("Can't find getDeviceProperty");
+        ALOGE("Can't find getDeviceProperty");
         return -1;
     }
     method_setDeviceProperty = env->GetMethodID(clazz, "setDeviceProperty", "(IJLjava/lang/String;)I");
     if (method_setDeviceProperty == NULL) {
-        LOGE("Can't find setDeviceProperty");
+        ALOGE("Can't find setDeviceProperty");
         return -1;
     }
     method_getObjectPropertyList = env->GetMethodID(clazz, "getObjectPropertyList",
             "(JIJII)Landroid/mtp/MtpPropertyList;");
     if (method_getObjectPropertyList == NULL) {
-        LOGE("Can't find getObjectPropertyList");
+        ALOGE("Can't find getObjectPropertyList");
         return -1;
     }
     method_getObjectInfo = env->GetMethodID(clazz, "getObjectInfo", "(I[I[C[J)Z");
     if (method_getObjectInfo == NULL) {
-        LOGE("Can't find getObjectInfo");
+        ALOGE("Can't find getObjectInfo");
         return -1;
     }
     method_getObjectFilePath = env->GetMethodID(clazz, "getObjectFilePath", "(I[C[J)I");
     if (method_getObjectFilePath == NULL) {
-        LOGE("Can't find getObjectFilePath");
+        ALOGE("Can't find getObjectFilePath");
         return -1;
     }
     method_deleteFile = env->GetMethodID(clazz, "deleteFile", "(I)I");
     if (method_deleteFile == NULL) {
-        LOGE("Can't find deleteFile");
+        ALOGE("Can't find deleteFile");
         return -1;
     }
     method_getObjectReferences = env->GetMethodID(clazz, "getObjectReferences", "(I)[I");
     if (method_getObjectReferences == NULL) {
-        LOGE("Can't find getObjectReferences");
+        ALOGE("Can't find getObjectReferences");
         return -1;
     }
     method_setObjectReferences = env->GetMethodID(clazz, "setObjectReferences", "(I[I)I");
     if (method_setObjectReferences == NULL) {
-        LOGE("Can't find setObjectReferences");
+        ALOGE("Can't find setObjectReferences");
         return -1;
     }
     method_sessionStarted = env->GetMethodID(clazz, "sessionStarted", "()V");
     if (method_sessionStarted == NULL) {
-        LOGE("Can't find sessionStarted");
+        ALOGE("Can't find sessionStarted");
         return -1;
     }
     method_sessionEnded = env->GetMethodID(clazz, "sessionEnded", "()V");
     if (method_sessionEnded == NULL) {
-        LOGE("Can't find sessionEnded");
+        ALOGE("Can't find sessionEnded");
         return -1;
     }
 
     field_context = env->GetFieldID(clazz, "mNativeContext", "I");
     if (field_context == NULL) {
-        LOGE("Can't find MtpDatabase.mNativeContext");
+        ALOGE("Can't find MtpDatabase.mNativeContext");
         return -1;
     }
 
     // now set up fields for MtpPropertyList class
     clazz = env->FindClass("android/mtp/MtpPropertyList");
     if (clazz == NULL) {
-        LOGE("Can't find android/mtp/MtpPropertyList");
+        ALOGE("Can't find android/mtp/MtpPropertyList");
         return -1;
     }
     field_mCount = env->GetFieldID(clazz, "mCount", "I");
     if (field_mCount == NULL) {
-        LOGE("Can't find MtpPropertyList.mCount");
+        ALOGE("Can't find MtpPropertyList.mCount");
         return -1;
     }
     field_mResult = env->GetFieldID(clazz, "mResult", "I");
     if (field_mResult == NULL) {
-        LOGE("Can't find MtpPropertyList.mResult");
+        ALOGE("Can't find MtpPropertyList.mResult");
         return -1;
     }
     field_mObjectHandles = env->GetFieldID(clazz, "mObjectHandles", "[I");
     if (field_mObjectHandles == NULL) {
-        LOGE("Can't find MtpPropertyList.mObjectHandles");
+        ALOGE("Can't find MtpPropertyList.mObjectHandles");
         return -1;
     }
     field_mPropertyCodes = env->GetFieldID(clazz, "mPropertyCodes", "[I");
     if (field_mPropertyCodes == NULL) {
-        LOGE("Can't find MtpPropertyList.mPropertyCodes");
+        ALOGE("Can't find MtpPropertyList.mPropertyCodes");
         return -1;
     }
     field_mDataTypes = env->GetFieldID(clazz, "mDataTypes", "[I");
     if (field_mDataTypes == NULL) {
-        LOGE("Can't find MtpPropertyList.mDataTypes");
+        ALOGE("Can't find MtpPropertyList.mDataTypes");
         return -1;
     }
     field_mLongValues = env->GetFieldID(clazz, "mLongValues", "[J");
     if (field_mLongValues == NULL) {
-        LOGE("Can't find MtpPropertyList.mLongValues");
+        ALOGE("Can't find MtpPropertyList.mLongValues");
         return -1;
     }
     field_mStringValues = env->GetFieldID(clazz, "mStringValues", "[Ljava/lang/String;");
     if (field_mStringValues == NULL) {
-        LOGE("Can't find MtpPropertyList.mStringValues");
+        ALOGE("Can't find MtpPropertyList.mStringValues");
         return -1;
     }
 
diff --git a/media/jni/android_mtp_MtpDevice.cpp b/media/jni/android_mtp_MtpDevice.cpp
index 6b73f6c..113784e 100644
--- a/media/jni/android_mtp_MtpDevice.cpp
+++ b/media/jni/android_mtp_MtpDevice.cpp
@@ -92,7 +92,7 @@
 
 static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {
     if (env->ExceptionCheck()) {
-        LOGE("An exception was thrown by callback '%s'.", methodName);
+        ALOGE("An exception was thrown by callback '%s'.", methodName);
         LOGE_EX(env);
         env->ExceptionClear();
     }
@@ -132,17 +132,17 @@
 {
     MtpDevice* device = get_device_from_object(env, thiz);
     if (!device) {
-        LOGD("android_mtp_MtpDevice_get_device_info device is null");
+        ALOGD("android_mtp_MtpDevice_get_device_info device is null");
         return NULL;
     }
     MtpDeviceInfo* deviceInfo = device->getDeviceInfo();
     if (!deviceInfo) {
-        LOGD("android_mtp_MtpDevice_get_device_info deviceInfo is null");
+        ALOGD("android_mtp_MtpDevice_get_device_info deviceInfo is null");
         return NULL;
     }
     jobject info = env->NewObject(clazz_deviceInfo, constructor_deviceInfo);
     if (info == NULL) {
-        LOGE("Could not create a MtpDeviceInfo object");
+        ALOGE("Could not create a MtpDeviceInfo object");
         delete deviceInfo;
         return NULL;
     }
@@ -195,7 +195,7 @@
 
     jobject info = env->NewObject(clazz_storageInfo, constructor_storageInfo);
     if (info == NULL) {
-        LOGE("Could not create a MtpStorageInfo object");
+        ALOGE("Could not create a MtpStorageInfo object");
         delete storageInfo;
         return NULL;
     }
@@ -248,7 +248,7 @@
         return NULL;
     jobject info = env->NewObject(clazz_objectInfo, constructor_objectInfo);
     if (info == NULL) {
-        LOGE("Could not create a MtpObjectInfo object");
+        ALOGE("Could not create a MtpObjectInfo object");
         delete objectInfo;
         return NULL;
     }
@@ -429,197 +429,197 @@
 {
     jclass clazz;
 
-    LOGD("register_android_mtp_MtpDevice\n");
+    ALOGD("register_android_mtp_MtpDevice\n");
 
     clazz = env->FindClass("android/mtp/MtpDeviceInfo");
     if (clazz == NULL) {
-        LOGE("Can't find android/mtp/MtpDeviceInfo");
+        ALOGE("Can't find android/mtp/MtpDeviceInfo");
         return -1;
     }
     constructor_deviceInfo = env->GetMethodID(clazz, "<init>", "()V");
     if (constructor_deviceInfo == NULL) {
-        LOGE("Can't find android/mtp/MtpDeviceInfo constructor");
+        ALOGE("Can't find android/mtp/MtpDeviceInfo constructor");
         return -1;
     }
     field_deviceInfo_manufacturer = env->GetFieldID(clazz, "mManufacturer", "Ljava/lang/String;");
     if (field_deviceInfo_manufacturer == NULL) {
-        LOGE("Can't find MtpDeviceInfo.mManufacturer");
+        ALOGE("Can't find MtpDeviceInfo.mManufacturer");
         return -1;
     }
     field_deviceInfo_model = env->GetFieldID(clazz, "mModel", "Ljava/lang/String;");
     if (field_deviceInfo_model == NULL) {
-        LOGE("Can't find MtpDeviceInfo.mModel");
+        ALOGE("Can't find MtpDeviceInfo.mModel");
         return -1;
     }
     field_deviceInfo_version = env->GetFieldID(clazz, "mVersion", "Ljava/lang/String;");
     if (field_deviceInfo_version == NULL) {
-        LOGE("Can't find MtpDeviceInfo.mVersion");
+        ALOGE("Can't find MtpDeviceInfo.mVersion");
         return -1;
     }
     field_deviceInfo_serialNumber = env->GetFieldID(clazz, "mSerialNumber", "Ljava/lang/String;");
     if (field_deviceInfo_serialNumber == NULL) {
-        LOGE("Can't find MtpDeviceInfo.mSerialNumber");
+        ALOGE("Can't find MtpDeviceInfo.mSerialNumber");
         return -1;
     }
     clazz_deviceInfo = (jclass)env->NewGlobalRef(clazz);
 
     clazz = env->FindClass("android/mtp/MtpStorageInfo");
     if (clazz == NULL) {
-        LOGE("Can't find android/mtp/MtpStorageInfo");
+        ALOGE("Can't find android/mtp/MtpStorageInfo");
         return -1;
     }
     constructor_storageInfo = env->GetMethodID(clazz, "<init>", "()V");
     if (constructor_storageInfo == NULL) {
-        LOGE("Can't find android/mtp/MtpStorageInfo constructor");
+        ALOGE("Can't find android/mtp/MtpStorageInfo constructor");
         return -1;
     }
     field_storageInfo_storageId = env->GetFieldID(clazz, "mStorageId", "I");
     if (field_storageInfo_storageId == NULL) {
-        LOGE("Can't find MtpStorageInfo.mStorageId");
+        ALOGE("Can't find MtpStorageInfo.mStorageId");
         return -1;
     }
     field_storageInfo_maxCapacity = env->GetFieldID(clazz, "mMaxCapacity", "J");
     if (field_storageInfo_maxCapacity == NULL) {
-        LOGE("Can't find MtpStorageInfo.mMaxCapacity");
+        ALOGE("Can't find MtpStorageInfo.mMaxCapacity");
         return -1;
     }
     field_storageInfo_freeSpace = env->GetFieldID(clazz, "mFreeSpace", "J");
     if (field_storageInfo_freeSpace == NULL) {
-        LOGE("Can't find MtpStorageInfo.mFreeSpace");
+        ALOGE("Can't find MtpStorageInfo.mFreeSpace");
         return -1;
     }
     field_storageInfo_description = env->GetFieldID(clazz, "mDescription", "Ljava/lang/String;");
     if (field_storageInfo_description == NULL) {
-        LOGE("Can't find MtpStorageInfo.mDescription");
+        ALOGE("Can't find MtpStorageInfo.mDescription");
         return -1;
     }
     field_storageInfo_volumeIdentifier = env->GetFieldID(clazz, "mVolumeIdentifier", "Ljava/lang/String;");
     if (field_storageInfo_volumeIdentifier == NULL) {
-        LOGE("Can't find MtpStorageInfo.mVolumeIdentifier");
+        ALOGE("Can't find MtpStorageInfo.mVolumeIdentifier");
         return -1;
     }
     clazz_storageInfo = (jclass)env->NewGlobalRef(clazz);
 
     clazz = env->FindClass("android/mtp/MtpObjectInfo");
     if (clazz == NULL) {
-        LOGE("Can't find android/mtp/MtpObjectInfo");
+        ALOGE("Can't find android/mtp/MtpObjectInfo");
         return -1;
     }
     constructor_objectInfo = env->GetMethodID(clazz, "<init>", "()V");
     if (constructor_objectInfo == NULL) {
-        LOGE("Can't find android/mtp/MtpObjectInfo constructor");
+        ALOGE("Can't find android/mtp/MtpObjectInfo constructor");
         return -1;
     }
     field_objectInfo_handle = env->GetFieldID(clazz, "mHandle", "I");
     if (field_objectInfo_handle == NULL) {
-        LOGE("Can't find MtpObjectInfo.mHandle");
+        ALOGE("Can't find MtpObjectInfo.mHandle");
         return -1;
     }
     field_objectInfo_storageId = env->GetFieldID(clazz, "mStorageId", "I");
     if (field_objectInfo_storageId == NULL) {
-        LOGE("Can't find MtpObjectInfo.mStorageId");
+        ALOGE("Can't find MtpObjectInfo.mStorageId");
         return -1;
     }
     field_objectInfo_format = env->GetFieldID(clazz, "mFormat", "I");
     if (field_objectInfo_format == NULL) {
-        LOGE("Can't find MtpObjectInfo.mFormat");
+        ALOGE("Can't find MtpObjectInfo.mFormat");
         return -1;
     }
     field_objectInfo_protectionStatus = env->GetFieldID(clazz, "mProtectionStatus", "I");
     if (field_objectInfo_protectionStatus == NULL) {
-        LOGE("Can't find MtpObjectInfo.mProtectionStatus");
+        ALOGE("Can't find MtpObjectInfo.mProtectionStatus");
         return -1;
     }
     field_objectInfo_compressedSize = env->GetFieldID(clazz, "mCompressedSize", "I");
     if (field_objectInfo_compressedSize == NULL) {
-        LOGE("Can't find MtpObjectInfo.mCompressedSize");
+        ALOGE("Can't find MtpObjectInfo.mCompressedSize");
         return -1;
     }
     field_objectInfo_thumbFormat = env->GetFieldID(clazz, "mThumbFormat", "I");
     if (field_objectInfo_thumbFormat == NULL) {
-        LOGE("Can't find MtpObjectInfo.mThumbFormat");
+        ALOGE("Can't find MtpObjectInfo.mThumbFormat");
         return -1;
     }
     field_objectInfo_thumbCompressedSize = env->GetFieldID(clazz, "mThumbCompressedSize", "I");
     if (field_objectInfo_thumbCompressedSize == NULL) {
-        LOGE("Can't find MtpObjectInfo.mThumbCompressedSize");
+        ALOGE("Can't find MtpObjectInfo.mThumbCompressedSize");
         return -1;
     }
     field_objectInfo_thumbPixWidth = env->GetFieldID(clazz, "mThumbPixWidth", "I");
     if (field_objectInfo_thumbPixWidth == NULL) {
-        LOGE("Can't find MtpObjectInfo.mThumbPixWidth");
+        ALOGE("Can't find MtpObjectInfo.mThumbPixWidth");
         return -1;
     }
     field_objectInfo_thumbPixHeight = env->GetFieldID(clazz, "mThumbPixHeight", "I");
     if (field_objectInfo_thumbPixHeight == NULL) {
-        LOGE("Can't find MtpObjectInfo.mThumbPixHeight");
+        ALOGE("Can't find MtpObjectInfo.mThumbPixHeight");
         return -1;
     }
     field_objectInfo_imagePixWidth = env->GetFieldID(clazz, "mImagePixWidth", "I");
     if (field_objectInfo_imagePixWidth == NULL) {
-        LOGE("Can't find MtpObjectInfo.mImagePixWidth");
+        ALOGE("Can't find MtpObjectInfo.mImagePixWidth");
         return -1;
     }
     field_objectInfo_imagePixHeight = env->GetFieldID(clazz, "mImagePixHeight", "I");
     if (field_objectInfo_imagePixHeight == NULL) {
-        LOGE("Can't find MtpObjectInfo.mImagePixHeight");
+        ALOGE("Can't find MtpObjectInfo.mImagePixHeight");
         return -1;
     }
     field_objectInfo_imagePixDepth = env->GetFieldID(clazz, "mImagePixDepth", "I");
     if (field_objectInfo_imagePixDepth == NULL) {
-        LOGE("Can't find MtpObjectInfo.mImagePixDepth");
+        ALOGE("Can't find MtpObjectInfo.mImagePixDepth");
         return -1;
     }
     field_objectInfo_parent = env->GetFieldID(clazz, "mParent", "I");
     if (field_objectInfo_parent == NULL) {
-        LOGE("Can't find MtpObjectInfo.mParent");
+        ALOGE("Can't find MtpObjectInfo.mParent");
         return -1;
     }
     field_objectInfo_associationType = env->GetFieldID(clazz, "mAssociationType", "I");
     if (field_objectInfo_associationType == NULL) {
-        LOGE("Can't find MtpObjectInfo.mAssociationType");
+        ALOGE("Can't find MtpObjectInfo.mAssociationType");
         return -1;
     }
     field_objectInfo_associationDesc = env->GetFieldID(clazz, "mAssociationDesc", "I");
     if (field_objectInfo_associationDesc == NULL) {
-        LOGE("Can't find MtpObjectInfo.mAssociationDesc");
+        ALOGE("Can't find MtpObjectInfo.mAssociationDesc");
         return -1;
     }
     field_objectInfo_sequenceNumber = env->GetFieldID(clazz, "mSequenceNumber", "I");
     if (field_objectInfo_sequenceNumber == NULL) {
-        LOGE("Can't find MtpObjectInfo.mSequenceNumber");
+        ALOGE("Can't find MtpObjectInfo.mSequenceNumber");
         return -1;
     }
     field_objectInfo_name = env->GetFieldID(clazz, "mName", "Ljava/lang/String;");
     if (field_objectInfo_name == NULL) {
-        LOGE("Can't find MtpObjectInfo.mName");
+        ALOGE("Can't find MtpObjectInfo.mName");
         return -1;
     }
     field_objectInfo_dateCreated = env->GetFieldID(clazz, "mDateCreated", "J");
     if (field_objectInfo_dateCreated == NULL) {
-        LOGE("Can't find MtpObjectInfo.mDateCreated");
+        ALOGE("Can't find MtpObjectInfo.mDateCreated");
         return -1;
     }
     field_objectInfo_dateModified = env->GetFieldID(clazz, "mDateModified", "J");
     if (field_objectInfo_dateModified == NULL) {
-        LOGE("Can't find MtpObjectInfo.mDateModified");
+        ALOGE("Can't find MtpObjectInfo.mDateModified");
         return -1;
     }
     field_objectInfo_keywords = env->GetFieldID(clazz, "mKeywords", "Ljava/lang/String;");
     if (field_objectInfo_keywords == NULL) {
-        LOGE("Can't find MtpObjectInfo.mKeywords");
+        ALOGE("Can't find MtpObjectInfo.mKeywords");
         return -1;
     }
     clazz_objectInfo = (jclass)env->NewGlobalRef(clazz);
 
     clazz = env->FindClass("android/mtp/MtpDevice");
     if (clazz == NULL) {
-        LOGE("Can't find android/mtp/MtpDevice");
+        ALOGE("Can't find android/mtp/MtpDevice");
         return -1;
     }
     field_context = env->GetFieldID(clazz, "mNativeContext", "I");
     if (field_context == NULL) {
-        LOGE("Can't find MtpDevice.mNativeContext");
+        ALOGE("Can't find MtpDevice.mNativeContext");
         return -1;
     }
 
diff --git a/media/jni/android_mtp_MtpServer.cpp b/media/jni/android_mtp_MtpServer.cpp
index 107db08..5252a3a 100644
--- a/media/jni/android_mtp_MtpServer.cpp
+++ b/media/jni/android_mtp_MtpServer.cpp
@@ -65,7 +65,7 @@
                 usePtp, AID_MEDIA_RW, 0664, 0775);
         env->SetIntField(thiz, field_MtpServer_nativeContext, (int)server);
     } else {
-        LOGE("could not open MTP driver, errno: %d", errno);
+        ALOGE("could not open MTP driver, errno: %d", errno);
     }
 }
 
@@ -76,7 +76,7 @@
     if (server)
         server->run();
     else
-        LOGE("server is null in run");
+        ALOGE("server is null in run");
 }
 
 static void
@@ -89,7 +89,7 @@
         delete server;
         env->SetIntField(thiz, field_MtpServer_nativeContext, 0);
     } else {
-        LOGE("server is null in cleanup");
+        ALOGE("server is null in cleanup");
     }
 }
 
@@ -102,7 +102,7 @@
     if (server)
         server->sendObjectAdded(handle);
     else
-        LOGE("server is null in send_object_added");
+        ALOGE("server is null in send_object_added");
 }
 
 static void
@@ -114,7 +114,7 @@
     if (server)
         server->sendObjectRemoved(handle);
     else
-        LOGE("server is null in send_object_removed");
+        ALOGE("server is null in send_object_removed");
 }
 
 static void
@@ -145,7 +145,7 @@
             }
         }
     } else {
-        LOGE("server is null in add_storage");
+        ALOGE("server is null in add_storage");
     }
 }
 
@@ -162,7 +162,7 @@
             delete storage;
         }
     } else
-        LOGE("server is null in remove_storage");
+        ALOGE("server is null in remove_storage");
 }
 
 // ----------------------------------------------------------------------------
@@ -187,48 +187,48 @@
 
     clazz = env->FindClass("android/mtp/MtpStorage");
     if (clazz == NULL) {
-        LOGE("Can't find android/mtp/MtpStorage");
+        ALOGE("Can't find android/mtp/MtpStorage");
         return -1;
     }
     field_MtpStorage_storageId = env->GetFieldID(clazz, "mStorageId", "I");
     if (field_MtpStorage_storageId == NULL) {
-        LOGE("Can't find MtpStorage.mStorageId");
+        ALOGE("Can't find MtpStorage.mStorageId");
         return -1;
     }
     field_MtpStorage_path = env->GetFieldID(clazz, "mPath", "Ljava/lang/String;");
     if (field_MtpStorage_path == NULL) {
-        LOGE("Can't find MtpStorage.mPath");
+        ALOGE("Can't find MtpStorage.mPath");
         return -1;
     }
     field_MtpStorage_description = env->GetFieldID(clazz, "mDescription", "Ljava/lang/String;");
     if (field_MtpStorage_description == NULL) {
-        LOGE("Can't find MtpStorage.mDescription");
+        ALOGE("Can't find MtpStorage.mDescription");
         return -1;
     }
     field_MtpStorage_reserveSpace = env->GetFieldID(clazz, "mReserveSpace", "J");
     if (field_MtpStorage_reserveSpace == NULL) {
-        LOGE("Can't find MtpStorage.mReserveSpace");
+        ALOGE("Can't find MtpStorage.mReserveSpace");
         return -1;
     }
     field_MtpStorage_removable = env->GetFieldID(clazz, "mRemovable", "Z");
     if (field_MtpStorage_removable == NULL) {
-        LOGE("Can't find MtpStorage.mRemovable");
+        ALOGE("Can't find MtpStorage.mRemovable");
         return -1;
     }
     field_MtpStorage_maxFileSize = env->GetFieldID(clazz, "mMaxFileSize", "J");
     if (field_MtpStorage_maxFileSize == NULL) {
-        LOGE("Can't find MtpStorage.mMaxFileSize");
+        ALOGE("Can't find MtpStorage.mMaxFileSize");
         return -1;
     }
 
     clazz = env->FindClass("android/mtp/MtpServer");
     if (clazz == NULL) {
-        LOGE("Can't find android/mtp/MtpServer");
+        ALOGE("Can't find android/mtp/MtpServer");
         return -1;
     }
     field_MtpServer_nativeContext = env->GetFieldID(clazz, "mNativeContext", "I");
     if (field_MtpServer_nativeContext == NULL) {
-        LOGE("Can't find MtpServer.mNativeContext");
+        ALOGE("Can't find MtpServer.mNativeContext");
         return -1;
     }
 
diff --git a/media/jni/audioeffect/android_media_AudioEffect.cpp b/media/jni/audioeffect/android_media_AudioEffect.cpp
index 277ea55..3b325b7 100644
--- a/media/jni/audioeffect/android_media_AudioEffect.cpp
+++ b/media/jni/audioeffect/android_media_AudioEffect.cpp
@@ -106,38 +106,38 @@
     effect_callback_cookie *callbackInfo = (effect_callback_cookie *)user;
     JNIEnv *env = AndroidRuntime::getJNIEnv();
 
-    LOGV("effectCallback: callbackInfo %p, audioEffect_ref %p audioEffect_class %p",
+    ALOGV("effectCallback: callbackInfo %p, audioEffect_ref %p audioEffect_class %p",
             callbackInfo,
             callbackInfo->audioEffect_ref,
             callbackInfo->audioEffect_class);
 
     if (!user || !env) {
-        LOGW("effectCallback error user %p, env %p", user, env);
+        ALOGW("effectCallback error user %p, env %p", user, env);
         return;
     }
 
     switch (event) {
     case AudioEffect::EVENT_CONTROL_STATUS_CHANGED:
         if (info == 0) {
-            LOGW("EVENT_CONTROL_STATUS_CHANGED info == NULL");
+            ALOGW("EVENT_CONTROL_STATUS_CHANGED info == NULL");
             goto effectCallback_Exit;
         }
         param = *(bool *)info;
         arg1 = (int)param;
-        LOGV("EVENT_CONTROL_STATUS_CHANGED");
+        ALOGV("EVENT_CONTROL_STATUS_CHANGED");
         break;
     case AudioEffect::EVENT_ENABLE_STATUS_CHANGED:
         if (info == 0) {
-            LOGW("EVENT_ENABLE_STATUS_CHANGED info == NULL");
+            ALOGW("EVENT_ENABLE_STATUS_CHANGED info == NULL");
             goto effectCallback_Exit;
         }
         param = *(bool *)info;
         arg1 = (int)param;
-        LOGV("EVENT_ENABLE_STATUS_CHANGED");
+        ALOGV("EVENT_ENABLE_STATUS_CHANGED");
         break;
     case AudioEffect::EVENT_PARAMETER_CHANGED:
         if (info == 0) {
-            LOGW("EVENT_PARAMETER_CHANGED info == NULL");
+            ALOGW("EVENT_PARAMETER_CHANGED info == NULL");
             goto effectCallback_Exit;
         }
         p = (effect_param_t *)info;
@@ -149,17 +149,17 @@
         size = arg1 + p->vsize;
         array = env->NewByteArray(size);
         if (array == NULL) {
-            LOGE("effectCallback: Couldn't allocate byte array for parameter data");
+            ALOGE("effectCallback: Couldn't allocate byte array for parameter data");
             goto effectCallback_Exit;
         }
         bytes = env->GetByteArrayElements(array, NULL);
         memcpy(bytes, p, size);
         env->ReleaseByteArrayElements(array, bytes, 0);
         obj = array;
-        LOGV("EVENT_PARAMETER_CHANGED");
+        ALOGV("EVENT_PARAMETER_CHANGED");
        break;
     case AudioEffect::EVENT_ERROR:
-        LOGW("EVENT_ERROR");
+        ALOGW("EVENT_ERROR");
         break;
     }
 
@@ -187,7 +187,7 @@
 android_media_AudioEffect_native_init(JNIEnv *env)
 {
 
-    LOGV("android_media_AudioEffect_native_init");
+    ALOGV("android_media_AudioEffect_native_init");
 
     fields.clazzEffect = NULL;
     fields.clazzDesc = NULL;
@@ -195,7 +195,7 @@
     // Get the AudioEffect class
     jclass clazz = env->FindClass(kClassPathName);
     if (clazz == NULL) {
-        LOGE("Can't find %s", kClassPathName);
+        ALOGE("Can't find %s", kClassPathName);
         return;
     }
 
@@ -206,7 +206,7 @@
             fields.clazzEffect,
             "postEventFromNative", "(Ljava/lang/Object;IIILjava/lang/Object;)V");
     if (fields.midPostNativeEvent == NULL) {
-        LOGE("Can't find AudioEffect.%s", "postEventFromNative");
+        ALOGE("Can't find AudioEffect.%s", "postEventFromNative");
         return;
     }
 
@@ -216,7 +216,7 @@
             fields.clazzEffect,
             "mNativeAudioEffect", "I");
     if (fields.fidNativeAudioEffect == NULL) {
-        LOGE("Can't find AudioEffect.%s", "mNativeAudioEffect");
+        ALOGE("Can't find AudioEffect.%s", "mNativeAudioEffect");
         return;
     }
     //      fidJniData;
@@ -224,13 +224,13 @@
             fields.clazzEffect,
             "mJniData", "I");
     if (fields.fidJniData == NULL) {
-        LOGE("Can't find AudioEffect.%s", "mJniData");
+        ALOGE("Can't find AudioEffect.%s", "mJniData");
         return;
     }
 
     clazz = env->FindClass("android/media/audiofx/AudioEffect$Descriptor");
     if (clazz == NULL) {
-        LOGE("Can't find android/media/audiofx/AudioEffect$Descriptor class");
+        ALOGE("Can't find android/media/audiofx/AudioEffect$Descriptor class");
         return;
     }
     fields.clazzDesc = (jclass)env->NewGlobalRef(clazz);
@@ -241,7 +241,7 @@
                     "<init>",
                     "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
     if (fields.midDescCstor == NULL) {
-        LOGE("Can't find android/media/audiofx/AudioEffect$Descriptor class constructor");
+        ALOGE("Can't find android/media/audiofx/AudioEffect$Descriptor class constructor");
         return;
     }
 }
@@ -251,7 +251,7 @@
 android_media_AudioEffect_native_setup(JNIEnv *env, jobject thiz, jobject weak_this,
         jstring type, jstring uuid, jint priority, jint sessionId, jintArray jId, jobjectArray javadesc)
 {
-    LOGV("android_media_AudioEffect_native_setup");
+    ALOGV("android_media_AudioEffect_native_setup");
     AudioEffectJniStorage* lpJniStorage = NULL;
     int lStatus = AUDIOEFFECT_ERROR_NO_MEMORY;
     AudioEffect* lpAudioEffect = NULL;
@@ -290,7 +290,7 @@
 
     lpJniStorage = new AudioEffectJniStorage();
     if (lpJniStorage == NULL) {
-        LOGE("setup: Error creating JNI Storage");
+        ALOGE("setup: Error creating JNI Storage");
         goto setup_failure;
     }
 
@@ -298,14 +298,14 @@
     // we use a weak reference so the AudioEffect object can be garbage collected.
     lpJniStorage->mCallbackData.audioEffect_ref = env->NewGlobalRef(weak_this);
 
-    LOGV("setup: lpJniStorage: %p audioEffect_ref %p audioEffect_class %p, &mCallbackData %p",
+    ALOGV("setup: lpJniStorage: %p audioEffect_ref %p audioEffect_class %p, &mCallbackData %p",
             lpJniStorage,
             lpJniStorage->mCallbackData.audioEffect_ref,
             lpJniStorage->mCallbackData.audioEffect_class,
             &lpJniStorage->mCallbackData);
 
     if (jId == NULL) {
-        LOGE("setup: NULL java array for id pointer");
+        ALOGE("setup: NULL java array for id pointer");
         lStatus = AUDIOEFFECT_ERROR_BAD_VALUE;
         goto setup_failure;
     }
@@ -319,19 +319,19 @@
                                     sessionId,
                                     0);
     if (lpAudioEffect == NULL) {
-        LOGE("Error creating AudioEffect");
+        ALOGE("Error creating AudioEffect");
         goto setup_failure;
     }
 
     lStatus = translateError(lpAudioEffect->initCheck());
     if (lStatus != AUDIOEFFECT_SUCCESS && lStatus != AUDIOEFFECT_ERROR_ALREADY_EXISTS) {
-        LOGE("AudioEffect initCheck failed %d", lStatus);
+        ALOGE("AudioEffect initCheck failed %d", lStatus);
         goto setup_failure;
     }
 
     nId = (jint *) env->GetPrimitiveArrayCritical(jId, NULL);
     if (nId == NULL) {
-        LOGE("setup: Error retrieving id pointer");
+        ALOGE("setup: Error retrieving id pointer");
         lStatus = AUDIOEFFECT_ERROR_BAD_VALUE;
         goto setup_failure;
     }
@@ -382,7 +382,7 @@
     env->DeleteLocalRef(jdescName);
     env->DeleteLocalRef(jdescImplementor);
     if (jdesc == NULL) {
-        LOGE("env->NewObject(fields.clazzDesc, fields.midDescCstor)");
+        ALOGE("env->NewObject(fields.clazzDesc, fields.midDescCstor)");
         goto setup_failure;
     }
 
@@ -425,13 +425,13 @@
 
 // ----------------------------------------------------------------------------
 static void android_media_AudioEffect_native_finalize(JNIEnv *env,  jobject thiz) {
-    LOGV("android_media_AudioEffect_native_finalize jobject: %x\n", (int)thiz);
+    ALOGV("android_media_AudioEffect_native_finalize jobject: %x\n", (int)thiz);
 
     // delete the AudioEffect object
     AudioEffect* lpAudioEffect = (AudioEffect *)env->GetIntField(
         thiz, fields.fidNativeAudioEffect);
     if (lpAudioEffect) {
-        LOGV("deleting AudioEffect: %x\n", (int)lpAudioEffect);
+        ALOGV("deleting AudioEffect: %x\n", (int)lpAudioEffect);
         delete lpAudioEffect;
     }
 
@@ -439,7 +439,7 @@
     AudioEffectJniStorage* lpJniStorage = (AudioEffectJniStorage *)env->GetIntField(
         thiz, fields.fidJniData);
     if (lpJniStorage) {
-        LOGV("deleting pJniStorage: %x\n", (int)lpJniStorage);
+        ALOGV("deleting pJniStorage: %x\n", (int)lpJniStorage);
         delete lpJniStorage;
     }
 }
@@ -534,14 +534,14 @@
     // get the pointer for the param from the java array
     lpParam = (jbyte *) env->GetPrimitiveArrayCritical(pJavaParam, NULL);
     if (lpParam == NULL) {
-        LOGE("setParameter: Error retrieving param pointer");
+        ALOGE("setParameter: Error retrieving param pointer");
         goto setParameter_Exit;
     }
 
     // get the pointer for the value from the java array
     lpValue = (jbyte *) env->GetPrimitiveArrayCritical(pJavaValue, NULL);
     if (lpValue == NULL) {
-        LOGE("setParameter: Error retrieving value pointer");
+        ALOGE("setParameter: Error retrieving value pointer");
         goto setParameter_Exit;
     }
 
@@ -597,14 +597,14 @@
     // get the pointer for the param from the java array
     lpParam = (jbyte *) env->GetPrimitiveArrayCritical(pJavaParam, NULL);
     if (lpParam == NULL) {
-        LOGE("getParameter: Error retrieving param pointer");
+        ALOGE("getParameter: Error retrieving param pointer");
         goto getParameter_Exit;
     }
 
     // get the pointer for the value from the java array
     lpValue = (jbyte *) env->GetPrimitiveArrayCritical(pJavaValue, NULL);
     if (lpValue == NULL) {
-        LOGE("getParameter: Error retrieving value pointer");
+        ALOGE("getParameter: Error retrieving value pointer");
         goto getParameter_Exit;
     }
 
@@ -665,7 +665,7 @@
     if (cmdSize != 0) {
         pCmdData = (jbyte *) env->GetPrimitiveArrayCritical(jCmdData, NULL);
         if (pCmdData == NULL) {
-            LOGE("setParameter: Error retrieving command pointer");
+            ALOGE("setParameter: Error retrieving command pointer");
             goto command_Exit;
         }
     }
@@ -674,7 +674,7 @@
     if (replySize != 0 && jReplyData != NULL) {
         pReplyData = (jbyte *) env->GetPrimitiveArrayCritical(jReplyData, NULL);
         if (pReplyData == NULL) {
-            LOGE("setParameter: Error retrieving reply pointer");
+            ALOGE("setParameter: Error retrieving reply pointer");
             goto command_Exit;
         }
     }
@@ -720,7 +720,7 @@
         return ret;
     }
 
-    LOGV("queryEffects() numEffects: %d", numEffects);
+    ALOGV("queryEffects() numEffects: %d", numEffects);
 
     for (i = 0; i < numEffects; i++) {
         if (AudioEffect::queryEffect(i, &desc) != NO_ERROR) {
@@ -759,7 +759,7 @@
         env->DeleteLocalRef(jdescName);
         env->DeleteLocalRef(jdescImplementor);
         if (jdesc == NULL) {
-            LOGE("env->NewObject(fields.clazzDesc, fields.midDescCstor)");
+            ALOGE("env->NewObject(fields.clazzDesc, fields.midDescCstor)");
             goto queryEffects_failure;
         }
 
@@ -808,7 +808,7 @@
         delete[] descriptors;
         return NULL;
     }
-    LOGV("queryDefaultPreProcessing() got %d effects", numEffects);
+    ALOGV("queryDefaultPreProcessing() got %d effects", numEffects);
 
     jobjectArray ret = env->NewObjectArray(numEffects, fields.clazzDesc, NULL);
     if (ret == NULL) {
@@ -847,7 +847,7 @@
         env->DeleteLocalRef(jdescName);
         env->DeleteLocalRef(jdescImplementor);
         if (jdesc == NULL) {
-            LOGE("env->NewObject(fields.clazzDesc, fields.midDescCstor)");
+            ALOGE("env->NewObject(fields.clazzDesc, fields.midDescCstor)");
             env->DeleteLocalRef(ret);
             return NULL;;
         }
@@ -895,18 +895,18 @@
     jint result = -1;
 
     if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
-        LOGE("ERROR: GetEnv failed\n");
+        ALOGE("ERROR: GetEnv failed\n");
         goto bail;
     }
     assert(env != NULL);
 
     if (register_android_media_AudioEffect(env) < 0) {
-        LOGE("ERROR: AudioEffect native registration failed\n");
+        ALOGE("ERROR: AudioEffect native registration failed\n");
         goto bail;
     }
 
     if (register_android_media_visualizer(env) < 0) {
-        LOGE("ERROR: Visualizer native registration failed\n");
+        ALOGE("ERROR: Visualizer native registration failed\n");
         goto bail;
     }
 
diff --git a/media/jni/audioeffect/android_media_Visualizer.cpp b/media/jni/audioeffect/android_media_Visualizer.cpp
index 27b28ee..ecd4d07 100644
--- a/media/jni/audioeffect/android_media_Visualizer.cpp
+++ b/media/jni/audioeffect/android_media_Visualizer.cpp
@@ -107,13 +107,13 @@
     visualizer_callback_cookie *callbackInfo = (visualizer_callback_cookie *)user;
     JNIEnv *env = AndroidRuntime::getJNIEnv();
 
-    LOGV("captureCallback: callbackInfo %p, visualizer_ref %p visualizer_class %p",
+    ALOGV("captureCallback: callbackInfo %p, visualizer_ref %p visualizer_class %p",
             callbackInfo,
             callbackInfo->visualizer_ref,
             callbackInfo->visualizer_class);
 
     if (!user || !env) {
-        LOGW("captureCallback error user %p, env %p", user, env);
+        ALOGW("captureCallback error user %p, env %p", user, env);
         return;
     }
 
@@ -178,14 +178,14 @@
 android_media_visualizer_native_init(JNIEnv *env)
 {
 
-    LOGV("android_media_visualizer_native_init");
+    ALOGV("android_media_visualizer_native_init");
 
     fields.clazzEffect = NULL;
 
     // Get the Visualizer class
     jclass clazz = env->FindClass(kClassPathName);
     if (clazz == NULL) {
-        LOGE("Can't find %s", kClassPathName);
+        ALOGE("Can't find %s", kClassPathName);
         return;
     }
 
@@ -196,7 +196,7 @@
             fields.clazzEffect,
             "postEventFromNative", "(Ljava/lang/Object;IIILjava/lang/Object;)V");
     if (fields.midPostNativeEvent == NULL) {
-        LOGE("Can't find Visualizer.%s", "postEventFromNative");
+        ALOGE("Can't find Visualizer.%s", "postEventFromNative");
         return;
     }
 
@@ -206,7 +206,7 @@
             fields.clazzEffect,
             "mNativeVisualizer", "I");
     if (fields.fidNativeVisualizer == NULL) {
-        LOGE("Can't find Visualizer.%s", "mNativeVisualizer");
+        ALOGE("Can't find Visualizer.%s", "mNativeVisualizer");
         return;
     }
     //      fidJniData;
@@ -214,7 +214,7 @@
             fields.clazzEffect,
             "mJniData", "I");
     if (fields.fidJniData == NULL) {
-        LOGE("Can't find Visualizer.%s", "mJniData");
+        ALOGE("Can't find Visualizer.%s", "mJniData");
         return;
     }
 
@@ -225,7 +225,7 @@
 android_media_visualizer_native_setup(JNIEnv *env, jobject thiz, jobject weak_this,
         jint sessionId, jintArray jId)
 {
-    LOGV("android_media_visualizer_native_setup");
+    ALOGV("android_media_visualizer_native_setup");
     visualizerJniStorage* lpJniStorage = NULL;
     int lStatus = VISUALIZER_ERROR_NO_MEMORY;
     Visualizer* lpVisualizer = NULL;
@@ -233,7 +233,7 @@
 
     lpJniStorage = new visualizerJniStorage();
     if (lpJniStorage == NULL) {
-        LOGE("setup: Error creating JNI Storage");
+        ALOGE("setup: Error creating JNI Storage");
         goto setup_failure;
     }
 
@@ -241,14 +241,14 @@
     // we use a weak reference so the Visualizer object can be garbage collected.
     lpJniStorage->mCallbackData.visualizer_ref = env->NewGlobalRef(weak_this);
 
-    LOGV("setup: lpJniStorage: %p visualizer_ref %p visualizer_class %p, &mCallbackData %p",
+    ALOGV("setup: lpJniStorage: %p visualizer_ref %p visualizer_class %p, &mCallbackData %p",
             lpJniStorage,
             lpJniStorage->mCallbackData.visualizer_ref,
             lpJniStorage->mCallbackData.visualizer_class,
             &lpJniStorage->mCallbackData);
 
     if (jId == NULL) {
-        LOGE("setup: NULL java array for id pointer");
+        ALOGE("setup: NULL java array for id pointer");
         lStatus = VISUALIZER_ERROR_BAD_VALUE;
         goto setup_failure;
     }
@@ -259,19 +259,19 @@
                                   NULL,
                                   sessionId);
     if (lpVisualizer == NULL) {
-        LOGE("Error creating Visualizer");
+        ALOGE("Error creating Visualizer");
         goto setup_failure;
     }
 
     lStatus = translateError(lpVisualizer->initCheck());
     if (lStatus != VISUALIZER_SUCCESS && lStatus != VISUALIZER_ERROR_ALREADY_EXISTS) {
-        LOGE("Visualizer initCheck failed %d", lStatus);
+        ALOGE("Visualizer initCheck failed %d", lStatus);
         goto setup_failure;
     }
 
     nId = (jint *) env->GetPrimitiveArrayCritical(jId, NULL);
     if (nId == NULL) {
-        LOGE("setup: Error retrieving id pointer");
+        ALOGE("setup: Error retrieving id pointer");
         lStatus = VISUALIZER_ERROR_BAD_VALUE;
         goto setup_failure;
     }
@@ -307,13 +307,13 @@
 
 // ----------------------------------------------------------------------------
 static void android_media_visualizer_native_finalize(JNIEnv *env,  jobject thiz) {
-    LOGV("android_media_visualizer_native_finalize jobject: %x\n", (int)thiz);
+    ALOGV("android_media_visualizer_native_finalize jobject: %x\n", (int)thiz);
 
     // delete the Visualizer object
     Visualizer* lpVisualizer = (Visualizer *)env->GetIntField(
         thiz, fields.fidNativeVisualizer);
     if (lpVisualizer) {
-        LOGV("deleting Visualizer: %x\n", (int)lpVisualizer);
+        ALOGV("deleting Visualizer: %x\n", (int)lpVisualizer);
         delete lpVisualizer;
     }
 
@@ -321,7 +321,7 @@
     visualizerJniStorage* lpJniStorage = (visualizerJniStorage *)env->GetIntField(
         thiz, fields.fidJniData);
     if (lpJniStorage) {
-        LOGV("deleting pJniStorage: %x\n", (int)lpJniStorage);
+        ALOGV("deleting pJniStorage: %x\n", (int)lpJniStorage);
         delete lpJniStorage;
     }
 }
@@ -366,7 +366,7 @@
     jint *nRange = env->GetIntArrayElements(jRange, NULL);
     nRange[0] = Visualizer::getMinCaptureSize();
     nRange[1] = Visualizer::getMaxCaptureSize();
-    LOGV("getCaptureSizeRange() min %d max %d", nRange[0], nRange[1]);
+    ALOGV("getCaptureSizeRange() min %d max %d", nRange[0], nRange[1]);
     env->ReleaseIntArrayElements(jRange, nRange, 0);
     return jRange;
 }
@@ -458,7 +458,7 @@
         return VISUALIZER_ERROR_NO_INIT;
     }
 
-    LOGV("setPeriodicCapture: rate %d, jWaveform %d jFft %d",
+    ALOGV("setPeriodicCapture: rate %d, jWaveform %d jFft %d",
             rate,
             jWaveform,
             jFft);
diff --git a/media/jni/mediaeditor/VideoEditorLogging.h b/media/jni/mediaeditor/VideoEditorLogging.h
index c13f6ff..479d8b6 100755
--- a/media/jni/mediaeditor/VideoEditorLogging.h
+++ b/media/jni/mediaeditor/VideoEditorLogging.h
@@ -29,7 +29,7 @@
 #define VIDEOEDIT_LOG_ALLOCATION                        __android_log_print
 #define VIDEOEDIT_LOG_API                               __android_log_print
 #define VIDEOEDIT_LOG_FUNCTION                          __android_log_print
-#define VIDEOEDIT_LOG_RESULT(x,y, ...)                     LOGI(y, __VA_ARGS__ )
+#define VIDEOEDIT_LOG_RESULT(x,y, ...)                     ALOGI(y, __VA_ARGS__ )
 #define VIDEOEDIT_LOG_SETTING                           __android_log_print
 #define VIDEOEDIT_LOG_EDIT_SETTINGS(m_settings)         videoEditClasses_logEditSettings\
                                                (m_settings, VIDEOEDIT_LOG_INDENTATION)
diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp
index 3d6d857..c84a883 100755
--- a/media/jni/mediaeditor/VideoEditorMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorMain.cpp
@@ -419,7 +419,7 @@
             pContext->mIsUpdateOverlay = true;
             pCurrEditInfo = (VideoEditorCurretEditInfo*)argc;
             overlayEffectIndex = pCurrEditInfo->overlaySettingsIndex;
-            LOGV("MSG_TYPE_OVERLAY_UPDATE");
+            ALOGV("MSG_TYPE_OVERLAY_UPDATE");
 
             if (pContext->mOverlayFileName != NULL) {
                 free(pContext->mOverlayFileName);
@@ -441,16 +441,16 @@
                 if (extPos != NULL) {
                     *extPos = '\0';
                 } else {
-                    LOGE("ERROR the overlay file is incorrect");
+                    ALOGE("ERROR the overlay file is incorrect");
                 }
 
                 strcat(pContext->mOverlayFileName, ".png");
-                LOGV("Conv string is %s", pContext->mOverlayFileName);
-                LOGV("Current Clip index = %d", pCurrEditInfo->clipIndex);
+                ALOGV("Conv string is %s", pContext->mOverlayFileName);
+                ALOGV("Current Clip index = %d", pCurrEditInfo->clipIndex);
 
                 pContext->mOverlayRenderingMode = pContext->pEditSettings->\
                          pClipList[pCurrEditInfo->clipIndex]->xVSS.MediaRendering;
-                LOGV("rendering mode %d ", pContext->mOverlayRenderingMode);
+                ALOGV("rendering mode %d ", pContext->mOverlayRenderingMode);
 
             }
 
@@ -464,7 +464,7 @@
                 pContext->mOverlayFileName = NULL;
             }
 
-            LOGV("MSG_TYPE_OVERLAY_CLEAR");
+            ALOGV("MSG_TYPE_OVERLAY_CLEAR");
             //argc is not used
             pContext->mIsUpdateOverlay = true;
             break;
@@ -499,7 +499,7 @@
     M4OSA_Bool foundCodec = M4OSA_FALSE;
     M4OSA_ERR  result = M4VSS3GPP_ERR_EDITING_UNSUPPORTED_VIDEO_PROFILE;
     M4OSA_Bool foundProfile = M4OSA_FALSE;
-    LOGV("checkClipVideoProfileAndLevel format %d profile;%d level:0x%x",
+    ALOGV("checkClipVideoProfileAndLevel format %d profile;%d level:0x%x",
        format, profile, level);
 
     switch (format) {
@@ -518,7 +518,7 @@
              // For these case we do not check the profile and level
              return M4NO_ERROR;
         default :
-            LOGE("checkClipVideoProfileAndLevel unsupport Video format %ld", format);
+            ALOGE("checkClipVideoProfileAndLevel unsupport Video format %ld", format);
             break;
     }
 
@@ -971,7 +971,7 @@
         if (extPos != NULL) {
             *extPos = '\0';
         } else {
-            LOGE("ERROR the overlay file is incorrect");
+            ALOGE("ERROR the overlay file is incorrect");
         }
 
         strcat(tmpOverlayFilename, ".png");
@@ -1431,7 +1431,7 @@
     M4OSA_UInt8 curProgress = 0;
     int         lastProgress = 0;
 
-    LOGV("LVME_generateAudio Current progress is =%d", curProgress);
+    ALOGV("LVME_generateAudio Current progress is =%d", curProgress);
     pEnv->CallVoidMethod(pContext->engine,
             pContext->onProgressUpdateMethodId, 1/*task status*/,
             curProgress/*progress*/);
@@ -1439,17 +1439,17 @@
         result = M4MCS_step(mcsContext, &curProgress);
 
         if (result != M4NO_ERROR) {
-            LOGV("LVME_generateAudio M4MCS_step returned 0x%x",result);
+            ALOGV("LVME_generateAudio M4MCS_step returned 0x%x",result);
 
             if (result == M4MCS_WAR_TRANSCODING_DONE) {
-                LOGV("LVME_generateAudio MCS process ended");
+                ALOGV("LVME_generateAudio MCS process ended");
 
                 // Send a progress notification.
                 curProgress = 100;
                 pEnv->CallVoidMethod(pContext->engine,
                     pContext->onProgressUpdateMethodId, 1/*task status*/,
                     curProgress);
-                LOGV("LVME_generateAudio Current progress is =%d", curProgress);
+                ALOGV("LVME_generateAudio Current progress is =%d", curProgress);
             }
         } else {
             // Send a progress notification if needed
@@ -1458,7 +1458,7 @@
                 pEnv->CallVoidMethod(pContext->engine,
                     pContext->onProgressUpdateMethodId, 0/*task status*/,
                     curProgress/*progress*/);
-                LOGV("LVME_generateAudio Current progress is =%d",curProgress);
+                ALOGV("LVME_generateAudio Current progress is =%d",curProgress);
             }
         }
     } while (result == M4NO_ERROR);
@@ -1506,11 +1506,11 @@
     M4OSA_Context lImageFileFp  = M4OSA_NULL;
     M4OSA_ERR err = M4NO_ERROR;
 
-    LOGV("removeAlphafromRGB8888: width %d", pFramingCtx->width);
+    ALOGV("removeAlphafromRGB8888: width %d", pFramingCtx->width);
 
     M4OSA_UInt8 *pTmpData = (M4OSA_UInt8*) M4OSA_32bitAlignedMalloc(frameSize_argb, M4VS, (M4OSA_Char*)"Image argb data");
     if (pTmpData == M4OSA_NULL) {
-        LOGE("Failed to allocate memory for Image clip");
+        ALOGE("Failed to allocate memory for Image clip");
         return M4ERR_ALLOC;
     }
 
@@ -1520,7 +1520,7 @@
 
     if ((lerr != M4NO_ERROR) || (lImageFileFp == M4OSA_NULL))
     {
-        LOGE("removeAlphafromRGB8888: Can not open the file ");
+        ALOGE("removeAlphafromRGB8888: Can not open the file ");
         free(pTmpData);
         return M4ERR_FILE_NOT_FOUND;
     }
@@ -1529,7 +1529,7 @@
     lerr = M4OSA_fileReadData(lImageFileFp, (M4OSA_MemAddr8)pTmpData, &frameSize_argb);
     if (lerr != M4NO_ERROR)
     {
-        LOGE("removeAlphafromRGB8888: can not read the data ");
+        ALOGE("removeAlphafromRGB8888: can not read the data ");
         M4OSA_fileReadClose(lImageFileFp);
         free(pTmpData);
         return lerr;
@@ -1545,7 +1545,7 @@
 
     if (pFramingCtx->FramingRgb == M4OSA_NULL)
     {
-        LOGE("Failed to allocate memory for Image clip");
+        ALOGE("Failed to allocate memory for Image clip");
         free(pTmpData);
         return M4ERR_ALLOC;
     }
@@ -2786,9 +2786,9 @@
     }
 
     // Send the command.
-    LOGV("videoEditor_processClip ITEM %d Calling M4xVSS_SendCommand()", unuseditemID);
+    ALOGV("videoEditor_processClip ITEM %d Calling M4xVSS_SendCommand()", unuseditemID);
     result = M4xVSS_SendCommand(pContext->engineContext, pContext->pEditSettings);
-    LOGV("videoEditor_processClip ITEM %d M4xVSS_SendCommand() returned 0x%x",
+    ALOGV("videoEditor_processClip ITEM %d M4xVSS_SendCommand() returned 0x%x",
         unuseditemID, (unsigned int) result);
 
     // Remove warnings indications (we only care about errors here)
@@ -2798,21 +2798,21 @@
     }
 
     // Send the first progress indication (=0)
-    LOGV("VERY FIRST PROGRESS videoEditor_processClip ITEM %d Progress indication %d",
+    ALOGV("VERY FIRST PROGRESS videoEditor_processClip ITEM %d Progress indication %d",
         unuseditemID, progress);
     pEnv->CallVoidMethod(pContext->engine, pContext->onProgressUpdateMethodId,
         unuseditemID, progress);
 
     // Check if a task is being performed.
     // ??? ADD STOPPING MECHANISM
-    LOGV("videoEditor_processClip Entering processing loop");
+    ALOGV("videoEditor_processClip Entering processing loop");
     M4OSA_UInt8 prevReportedProgress = 0;
     while((result == M4NO_ERROR)
         &&(pContext->state!=ManualEditState_SAVED)
         &&(pContext->state!=ManualEditState_STOPPING)) {
 
             // Perform the next processing step.
-            //LOGV("LVME_processClip Entering M4xVSS_Step()");
+            //ALOGV("LVME_processClip Entering M4xVSS_Step()");
             result = M4xVSS_Step(pContext->engineContext, &progress);
 
             if (progress != prevReportedProgress) {
@@ -2836,7 +2836,7 @@
                 if (progress > lastProgress)
                 {
                     // Send a progress notification.
-                    LOGV("videoEditor_processClip ITEM %d Progress indication %d",
+                    ALOGV("videoEditor_processClip ITEM %d Progress indication %d",
                         unuseditemID, progress);
                     pEnv->CallVoidMethod(pContext->engine,
                         pContext->onProgressUpdateMethodId,
@@ -2850,7 +2850,7 @@
             {
                 // Set the state to the completions state.
                 pContext->state = completionState;
-                LOGV("videoEditor_processClip ITEM %d STATE changed to %d",
+                ALOGV("videoEditor_processClip ITEM %d STATE changed to %d",
                     unuseditemID, pContext->state);
 
                 // Reset progress indication, as we switch to next state
@@ -2862,11 +2862,11 @@
                 // Check if we are analyzing input
                 if (pContext->state == ManualEditState_OPENED) {
                     // File is opened, we must start saving it
-                    LOGV("videoEditor_processClip Calling M4xVSS_SaveStart()");
+                    ALOGV("videoEditor_processClip Calling M4xVSS_SaveStart()");
                     result = M4xVSS_SaveStart(pContext->engineContext,
                         (M4OSA_Char*)pContext->pEditSettings->pOutputFile,
                         (M4OSA_UInt32)pContext->pEditSettings->uiOutputPathSize);
-                    LOGV("videoEditor_processClip ITEM %d SaveStart() returned 0x%x",
+                    ALOGV("videoEditor_processClip ITEM %d SaveStart() returned 0x%x",
                         unuseditemID, (unsigned int) result);
 
                     // Set the state to saving.
@@ -2889,7 +2889,7 @@
 
                     // Send a progress notification.
                     progress = 100;
-                    LOGV("videoEditor_processClip ITEM %d Last progress indication %d",
+                    ALOGV("videoEditor_processClip ITEM %d Last progress indication %d",
                         unuseditemID, progress);
                     pEnv->CallVoidMethod(pContext->engine,
                         pContext->onProgressUpdateMethodId,
@@ -2897,14 +2897,14 @@
 
 
                     // Stop the encoding.
-                    LOGV("videoEditor_processClip Calling M4xVSS_SaveStop()");
+                    ALOGV("videoEditor_processClip Calling M4xVSS_SaveStop()");
                     result = M4xVSS_SaveStop(pContext->engineContext);
-                    LOGV("videoEditor_processClip M4xVSS_SaveStop() returned 0x%x", result);
+                    ALOGV("videoEditor_processClip M4xVSS_SaveStop() returned 0x%x", result);
                 }
                 // Other states are unexpected
                 else {
                     result = M4ERR_STATE;
-                    LOGE("videoEditor_processClip ITEM %d State ERROR 0x%x",
+                    ALOGE("videoEditor_processClip ITEM %d State ERROR 0x%x",
                         unuseditemID, (unsigned int) result);
                 }
             }
@@ -2916,13 +2916,13 @@
                 pContext->state = errorState;
 
                 // Log the result.
-                LOGE("videoEditor_processClip ITEM %d Processing ERROR 0x%x",
+                ALOGE("videoEditor_processClip ITEM %d Processing ERROR 0x%x",
                     unuseditemID, (unsigned int) result);
             }
     }
 
     // Return the error result
-    LOGE("videoEditor_processClip ITEM %d END 0x%x", unuseditemID, (unsigned int) result);
+    ALOGE("videoEditor_processClip ITEM %d END 0x%x", unuseditemID, (unsigned int) result);
     return result;
 }
 /*+ PROGRESS CB */
@@ -2936,7 +2936,7 @@
     ManualEditContext* pContext = M4OSA_NULL;
     M4OSA_ERR          result   = M4NO_ERROR;
 
-    LOGV("videoEditor_generateClip START");
+    ALOGV("videoEditor_generateClip START");
 
     // Get the context.
     pContext = (ManualEditContext*)videoEditClasses_getContext(&loaded, pEnv, thiz);
@@ -2954,21 +2954,21 @@
                                              "not initialized");
 
     // Load the clip settings
-    LOGV("videoEditor_generateClip Calling videoEditor_loadSettings");
+    ALOGV("videoEditor_generateClip Calling videoEditor_loadSettings");
     videoEditor_loadSettings(pEnv, thiz, settings);
-    LOGV("videoEditor_generateClip videoEditor_loadSettings returned");
+    ALOGV("videoEditor_generateClip videoEditor_loadSettings returned");
 
     // Generate the clip
-    LOGV("videoEditor_generateClip Calling LVME_processClip");
+    ALOGV("videoEditor_generateClip Calling LVME_processClip");
     result = videoEditor_processClip(pEnv, thiz, 0 /*item id is unused*/);
-    LOGV("videoEditor_generateClip videoEditor_processClip returned 0x%x", result);
+    ALOGV("videoEditor_generateClip videoEditor_processClip returned 0x%x", result);
 
     if (pContext->state != ManualEditState_INITIALIZED) {
         // Free up memory (whatever the result)
         videoEditor_unloadSettings(pEnv, thiz);
     }
 
-    LOGV("videoEditor_generateClip END 0x%x", (unsigned int) result);
+    ALOGV("videoEditor_generateClip END 0x%x", (unsigned int) result);
     return result;
 }
 
@@ -3024,7 +3024,7 @@
         VIDEOEDIT_LOG_API(ANDROID_LOG_INFO, "VIDEO_EDITOR", "inside load settings");
         VIDEOEDIT_LOG_EDIT_SETTINGS(pContext->pEditSettings);
     }
-    LOGV("videoEditor_loadSettings END");
+    ALOGV("videoEditor_loadSettings END");
 }
 
 
@@ -3051,7 +3051,7 @@
     // Check if the context is valid (required because the context is dereferenced).
     if (needToBeUnLoaded)
     {
-        LOGV("videoEditor_unloadSettings state %d", pContext->state);
+        ALOGV("videoEditor_unloadSettings state %d", pContext->state);
         // Make sure that we are in a correct state.
         videoEditJava_checkAndThrowIllegalStateException(&needToBeUnLoaded, pEnv,
                      ((pContext->state != ManualEditState_ANALYZING      ) &&
@@ -3070,9 +3070,9 @@
         if (needToBeUnLoaded)
         {
             // Close the command.
-            LOGV("videoEditor_unloadSettings Calling M4xVSS_CloseCommand()");
+            ALOGV("videoEditor_unloadSettings Calling M4xVSS_CloseCommand()");
             result = M4xVSS_CloseCommand(pContext->engineContext);
-            LOGV("videoEditor_unloadSettings M4xVSS_CloseCommand() returned 0x%x",
+            ALOGV("videoEditor_unloadSettings M4xVSS_CloseCommand() returned 0x%x",
                 (unsigned int)result);
 
             // Check if the command could be closed.
@@ -3107,7 +3107,7 @@
     ManualEditContext* pContext = M4OSA_NULL;
     M4OSA_ERR          result   = M4NO_ERROR;
 
-    LOGV("videoEditor_stopEncoding START");
+    ALOGV("videoEditor_stopEncoding START");
 
     // Get the context.
     pContext = (ManualEditContext*)videoEditClasses_getContext(&stopped, pEnv, thiz);
@@ -3128,9 +3128,9 @@
         if (pContext->state != ManualEditState_INITIALIZED)
         {
             // Close the command.
-            LOGV("videoEditor_stopEncoding Calling M4xVSS_CloseCommand()");
+            ALOGV("videoEditor_stopEncoding Calling M4xVSS_CloseCommand()");
             result = M4xVSS_CloseCommand(pContext->engineContext);
-            LOGV("videoEditor_stopEncoding M4xVSS_CloseCommand() returned 0x%x",
+            ALOGV("videoEditor_stopEncoding M4xVSS_CloseCommand() returned 0x%x",
                 (unsigned int)result);
         }
 
@@ -3166,7 +3166,7 @@
 
     // If context is not set, return (we consider release already happened)
     if (pContext == NULL) {
-        LOGV("videoEditor_release Nothing to do, context is aleady NULL");
+        ALOGV("videoEditor_release Nothing to do, context is aleady NULL");
         return;
     }
 
@@ -3189,10 +3189,10 @@
         if (pContext->state != ManualEditState_INITIALIZED)
         {
             // Close the command.
-            LOGV("videoEditor_release Calling M4xVSS_CloseCommand() state =%d",
+            ALOGV("videoEditor_release Calling M4xVSS_CloseCommand() state =%d",
                 pContext->state);
             result = M4xVSS_CloseCommand(pContext->engineContext);
-            LOGV("videoEditor_release M4xVSS_CloseCommand() returned 0x%x",
+            ALOGV("videoEditor_release M4xVSS_CloseCommand() returned 0x%x",
                 (unsigned int)result);
 
             // Check if the command could be closed.
@@ -3201,9 +3201,9 @@
         }
 
         // Cleanup the engine.
-        LOGV("videoEditor_release Calling M4xVSS_CleanUp()");
+        ALOGV("videoEditor_release Calling M4xVSS_CleanUp()");
         result = M4xVSS_CleanUp(pContext->engineContext);
-        LOGV("videoEditor_release M4xVSS_CleanUp() returned 0x%x", (unsigned int)result);
+        ALOGV("videoEditor_release M4xVSS_CleanUp() returned 0x%x", (unsigned int)result);
 
         // Check if the cleanup succeeded.
         videoEditJava_checkAndThrowRuntimeException(&released, pEnv,
@@ -3245,17 +3245,17 @@
                 pDecoder = pContext->decoders->decoder;
                 for (int32_t k = 0; k < decoderNumber; k++) {
                     // free each component
-                    LOGV("decoder index :%d",k);
+                    ALOGV("decoder index :%d",k);
                     if (pDecoder != NULL &&
                         pDecoder->component != NULL &&
                         pDecoder->componentNumber > 0) {
-                        LOGV("component number %d",pDecoder->componentNumber);
+                        ALOGV("component number %d",pDecoder->componentNumber);
                         int32_t componentNumber =
                            pDecoder->componentNumber;
 
                         pComponents = pDecoder->component;
                         for (int32_t i = 0; i< componentNumber; i++) {
-                            LOGV("component index :%d",i);
+                            ALOGV("component index :%d",i);
                             if (pComponents != NULL &&
                                 pComponents->profileLevel != NULL) {
                                 free(pComponents->profileLevel);
diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp
index 4ffb2c0..14a5309 100644
--- a/media/jni/soundpool/SoundPool.cpp
+++ b/media/jni/soundpool/SoundPool.cpp
@@ -41,7 +41,7 @@
 
 SoundPool::SoundPool(int maxChannels, int streamType, int srcQuality)
 {
-    LOGV("SoundPool constructor: maxChannels=%d, streamType=%d, srcQuality=%d",
+    ALOGV("SoundPool constructor: maxChannels=%d, streamType=%d, srcQuality=%d",
             maxChannels, streamType, srcQuality);
 
     // check limits
@@ -52,7 +52,7 @@
     else if (mMaxChannels > 32) {
         mMaxChannels = 32;
     }
-    LOGW_IF(maxChannels != mMaxChannels, "App requested %d channels", maxChannels);
+    ALOGW_IF(maxChannels != mMaxChannels, "App requested %d channels", maxChannels);
 
     mQuit = false;
     mDecodeThread = 0;
@@ -77,7 +77,7 @@
 
 SoundPool::~SoundPool()
 {
-    LOGV("SoundPool destructor");
+    ALOGV("SoundPool destructor");
     mDecodeThread->quit();
     quit();
 
@@ -87,7 +87,7 @@
     if (mChannelPool)
         delete [] mChannelPool;
     // clean up samples
-    LOGV("clear samples");
+    ALOGV("clear samples");
     mSamples.clear();
 
     if (mDecodeThread)
@@ -123,12 +123,12 @@
     mRestartLock.lock();
     while (!mQuit) {
         mCondition.wait(mRestartLock);
-        LOGV("awake");
+        ALOGV("awake");
         if (mQuit) break;
 
         while (!mStop.empty()) {
             SoundChannel* channel;
-            LOGV("Getting channel from stop list");
+            ALOGV("Getting channel from stop list");
             List<SoundChannel* >::iterator iter = mStop.begin();
             channel = *iter;
             mStop.erase(iter);
@@ -143,7 +143,7 @@
 
         while (!mRestart.empty()) {
             SoundChannel* channel;
-            LOGV("Getting channel from list");
+            ALOGV("Getting channel from list");
             List<SoundChannel*>::iterator iter = mRestart.begin();
             channel = *iter;
             mRestart.erase(iter);
@@ -161,7 +161,7 @@
     mRestart.clear();
     mCondition.signal();
     mRestartLock.unlock();
-    LOGV("goodbye");
+    ALOGV("goodbye");
     return 0;
 }
 
@@ -171,7 +171,7 @@
     mQuit = true;
     mCondition.signal();
     mCondition.wait(mRestartLock);
-    LOGV("return from quit");
+    ALOGV("return from quit");
     mRestartLock.unlock();
 }
 
@@ -205,7 +205,7 @@
 
 int SoundPool::load(const char* path, int priority)
 {
-    LOGV("load: path=%s, priority=%d", path, priority);
+    ALOGV("load: path=%s, priority=%d", path, priority);
     Mutex::Autolock lock(&mLock);
     sp<Sample> sample = new Sample(++mNextSampleID, path);
     mSamples.add(sample->sampleID(), sample);
@@ -215,7 +215,7 @@
 
 int SoundPool::load(int fd, int64_t offset, int64_t length, int priority)
 {
-    LOGV("load: fd=%d, offset=%lld, length=%lld, priority=%d",
+    ALOGV("load: fd=%d, offset=%lld, length=%lld, priority=%d",
             fd, offset, length, priority);
     Mutex::Autolock lock(&mLock);
     sp<Sample> sample = new Sample(++mNextSampleID, fd, offset, length);
@@ -226,14 +226,14 @@
 
 void SoundPool::doLoad(sp<Sample>& sample)
 {
-    LOGV("doLoad: loading sample sampleID=%d", sample->sampleID());
+    ALOGV("doLoad: loading sample sampleID=%d", sample->sampleID());
     sample->startLoad();
     mDecodeThread->loadSample(sample->sampleID());
 }
 
 bool SoundPool::unload(int sampleID)
 {
-    LOGV("unload: sampleID=%d", sampleID);
+    ALOGV("unload: sampleID=%d", sampleID);
     Mutex::Autolock lock(&mLock);
     return mSamples.removeItem(sampleID);
 }
@@ -241,7 +241,7 @@
 int SoundPool::play(int sampleID, float leftVolume, float rightVolume,
         int priority, int loop, float rate)
 {
-    LOGV("play sampleID=%d, leftVolume=%f, rightVolume=%f, priority=%d, loop=%d, rate=%f",
+    ALOGV("play sampleID=%d, leftVolume=%f, rightVolume=%f, priority=%d, loop=%d, rate=%f",
             sampleID, leftVolume, rightVolume, priority, loop, rate);
     sp<Sample> sample;
     SoundChannel* channel;
@@ -255,7 +255,7 @@
     // is sample ready?
     sample = findSample(sampleID);
     if ((sample == 0) || (sample->state() != Sample::READY)) {
-        LOGW("  sample %d not READY", sampleID);
+        ALOGW("  sample %d not READY", sampleID);
         return 0;
     }
 
@@ -266,13 +266,13 @@
 
     // no channel allocated - return 0
     if (!channel) {
-        LOGV("No channel allocated");
+        ALOGV("No channel allocated");
         return 0;
     }
 
     channelID = ++mNextChannelID;
 
-    LOGV("play channel %p state = %d", channel, channel->state());
+    ALOGV("play channel %p state = %d", channel, channel->state());
     channel->play(sample, channelID, leftVolume, rightVolume, priority, loop, rate);
     return channelID;
 }
@@ -288,7 +288,7 @@
         if (priority >= (*iter)->priority()) {
             channel = *iter;
             mChannels.erase(iter);
-            LOGV("Allocated active channel");
+            ALOGV("Allocated active channel");
         }
     }
 
@@ -319,7 +319,7 @@
 
 void SoundPool::pause(int channelID)
 {
-    LOGV("pause(%d)", channelID);
+    ALOGV("pause(%d)", channelID);
     Mutex::Autolock lock(&mLock);
     SoundChannel* channel = findChannel(channelID);
     if (channel) {
@@ -329,7 +329,7 @@
 
 void SoundPool::autoPause()
 {
-    LOGV("autoPause()");
+    ALOGV("autoPause()");
     Mutex::Autolock lock(&mLock);
     for (int i = 0; i < mMaxChannels; ++i) {
         SoundChannel* channel = &mChannelPool[i];
@@ -339,7 +339,7 @@
 
 void SoundPool::resume(int channelID)
 {
-    LOGV("resume(%d)", channelID);
+    ALOGV("resume(%d)", channelID);
     Mutex::Autolock lock(&mLock);
     SoundChannel* channel = findChannel(channelID);
     if (channel) {
@@ -349,7 +349,7 @@
 
 void SoundPool::autoResume()
 {
-    LOGV("autoResume()");
+    ALOGV("autoResume()");
     Mutex::Autolock lock(&mLock);
     for (int i = 0; i < mMaxChannels; ++i) {
         SoundChannel* channel = &mChannelPool[i];
@@ -359,7 +359,7 @@
 
 void SoundPool::stop(int channelID)
 {
-    LOGV("stop(%d)", channelID);
+    ALOGV("stop(%d)", channelID);
     Mutex::Autolock lock(&mLock);
     SoundChannel* channel = findChannel(channelID);
     if (channel) {
@@ -382,7 +382,7 @@
 
 void SoundPool::setPriority(int channelID, int priority)
 {
-    LOGV("setPriority(%d, %d)", channelID, priority);
+    ALOGV("setPriority(%d, %d)", channelID, priority);
     Mutex::Autolock lock(&mLock);
     SoundChannel* channel = findChannel(channelID);
     if (channel) {
@@ -392,7 +392,7 @@
 
 void SoundPool::setLoop(int channelID, int loop)
 {
-    LOGV("setLoop(%d, %d)", channelID, loop);
+    ALOGV("setLoop(%d, %d)", channelID, loop);
     Mutex::Autolock lock(&mLock);
     SoundChannel* channel = findChannel(channelID);
     if (channel) {
@@ -402,7 +402,7 @@
 
 void SoundPool::setRate(int channelID, float rate)
 {
-    LOGV("setRate(%d, %f)", channelID, rate);
+    ALOGV("setRate(%d, %f)", channelID, rate);
     Mutex::Autolock lock(&mLock);
     SoundChannel* channel = findChannel(channelID);
     if (channel) {
@@ -413,16 +413,16 @@
 // call with lock held
 void SoundPool::done_l(SoundChannel* channel)
 {
-    LOGV("done_l(%d)", channel->channelID());
+    ALOGV("done_l(%d)", channel->channelID());
     // if "stolen", play next event
     if (channel->nextChannelID() != 0) {
-        LOGV("add to restart list");
+        ALOGV("add to restart list");
         addToRestartList(channel);
     }
 
     // return to idle state
     else {
-        LOGV("move to front");
+        ALOGV("move to front");
         moveToFront_l(channel);
     }
 }
@@ -455,7 +455,7 @@
     init();
     mSampleID = sampleID;
     mUrl = strdup(url);
-    LOGV("create sampleID=%d, url=%s", mSampleID, mUrl);
+    ALOGV("create sampleID=%d, url=%s", mSampleID, mUrl);
 }
 
 Sample::Sample(int sampleID, int fd, int64_t offset, int64_t length)
@@ -465,7 +465,7 @@
     mFd = dup(fd);
     mOffset = offset;
     mLength = length;
-    LOGV("create sampleID=%d, fd=%d, offset=%lld, length=%lld", mSampleID, mFd, mLength, mOffset);
+    ALOGV("create sampleID=%d, fd=%d, offset=%lld, length=%lld", mSampleID, mFd, mLength, mOffset);
 }
 
 void Sample::init()
@@ -483,9 +483,9 @@
 
 Sample::~Sample()
 {
-    LOGV("Sample::destructor sampleID=%d, fd=%d", mSampleID, mFd);
+    ALOGV("Sample::destructor sampleID=%d, fd=%d", mSampleID, mFd);
     if (mFd > 0) {
-        LOGV("close(%d)", mFd);
+        ALOGV("close(%d)", mFd);
         ::close(mFd);
     }
     mData.clear();
@@ -498,29 +498,29 @@
     int numChannels;
     int format;
     sp<IMemory> p;
-    LOGV("Start decode");
+    ALOGV("Start decode");
     if (mUrl) {
         p = MediaPlayer::decode(mUrl, &sampleRate, &numChannels, &format);
     } else {
         p = MediaPlayer::decode(mFd, mOffset, mLength, &sampleRate, &numChannels, &format);
-        LOGV("close(%d)", mFd);
+        ALOGV("close(%d)", mFd);
         ::close(mFd);
         mFd = -1;
     }
     if (p == 0) {
-        LOGE("Unable to load sample: %s", mUrl);
+        ALOGE("Unable to load sample: %s", mUrl);
         return -1;
     }
-    LOGV("pointer = %p, size = %u, sampleRate = %u, numChannels = %d",
+    ALOGV("pointer = %p, size = %u, sampleRate = %u, numChannels = %d",
             p->pointer(), p->size(), sampleRate, numChannels);
 
     if (sampleRate > kMaxSampleRate) {
-       LOGE("Sample rate (%u) out of range", sampleRate);
+       ALOGE("Sample rate (%u) out of range", sampleRate);
        return - 1;
     }
 
     if ((numChannels < 1) || (numChannels > 2)) {
-        LOGE("Sample channel count (%d) out of range", numChannels);
+        ALOGE("Sample channel count (%d) out of range", numChannels);
         return - 1;
     }
 
@@ -554,14 +554,14 @@
     { // scope for the lock
         Mutex::Autolock lock(&mLock);
 
-        LOGV("SoundChannel::play %p: sampleID=%d, channelID=%d, leftVolume=%f, rightVolume=%f,"
+        ALOGV("SoundChannel::play %p: sampleID=%d, channelID=%d, leftVolume=%f, rightVolume=%f,"
                 " priority=%d, loop=%d, rate=%f",
                 this, sample->sampleID(), nextChannelID, leftVolume, rightVolume,
                 priority, loop, rate);
 
         // if not idle, this voice is being stolen
         if (mState != IDLE) {
-            LOGV("channel %d stolen - event queued for channel %d", channelID(), nextChannelID);
+            ALOGV("channel %d stolen - event queued for channel %d", channelID(), nextChannelID);
             mNextEvent.set(sample, nextChannelID, leftVolume, rightVolume, priority, loop, rate);
             stop_l();
             return;
@@ -616,10 +616,10 @@
         oldTrack = mAudioTrack;
         status = newTrack->initCheck();
         if (status != NO_ERROR) {
-            LOGE("Error creating AudioTrack");
+            ALOGE("Error creating AudioTrack");
             goto exit;
         }
-        LOGV("setVolume %p", newTrack);
+        ALOGV("setVolume %p", newTrack);
         newTrack->setVolume(leftVolume, rightVolume);
         newTrack->setLoop(0, frameCount, loop);
 
@@ -642,7 +642,7 @@
     }
 
 exit:
-    LOGV("delete oldTrack %p", oldTrack);
+    ALOGV("delete oldTrack %p", oldTrack);
     delete oldTrack;
     if (status != NO_ERROR) {
         delete newTrack;
@@ -665,7 +665,7 @@
         Mutex::Autolock lock(&mLock);
         nextChannelID = mNextEvent.channelID();
         if (nextChannelID  == 0) {
-            LOGV("stolen channel has no event");
+            ALOGV("stolen channel has no event");
             return;
         }
 
@@ -677,7 +677,7 @@
         rate = mNextEvent.rate();
     }
 
-    LOGV("Starting stolen channel %d -> %d", channelID(), nextChannelID);
+    ALOGV("Starting stolen channel %d -> %d", channelID(), nextChannelID);
     play(sample, nextChannelID, leftVolume, rightVolume, priority, loop, rate);
 }
 
@@ -690,7 +690,7 @@
 
 void SoundChannel::process(int event, void *info, unsigned long toggle)
 {
-    //LOGV("process(%d)", mChannelID);
+    //ALOGV("process(%d)", mChannelID);
 
     Mutex::Autolock lock(&mLock);
 
@@ -700,7 +700,7 @@
     }
 
     if (mToggle != toggle) {
-        LOGV("process wrong toggle %p channel %d", this, mChannelID);
+        ALOGV("process wrong toggle %p channel %d", this, mChannelID);
         if (b != NULL) {
             b->size = 0;
         }
@@ -709,7 +709,7 @@
 
     sp<Sample> sample = mSample;
 
-//    LOGV("SoundChannel::process event %d", event);
+//    ALOGV("SoundChannel::process event %d", event);
 
     if (event == AudioTrack::EVENT_MORE_DATA) {
 
@@ -733,25 +733,25 @@
                     count = b->size;
                 }
                 memcpy(q, p, count);
-//              LOGV("fill: q=%p, p=%p, mPos=%u, b->size=%u, count=%d", q, p, mPos, b->size, count);
+//              ALOGV("fill: q=%p, p=%p, mPos=%u, b->size=%u, count=%d", q, p, mPos, b->size, count);
             } else if (mPos < mAudioBufferSize) {
                 count = mAudioBufferSize - mPos;
                 if (count > b->size) {
                     count = b->size;
                 }
                 memset(q, 0, count);
-//              LOGV("fill extra: q=%p, mPos=%u, b->size=%u, count=%d", q, mPos, b->size, count);
+//              ALOGV("fill extra: q=%p, mPos=%u, b->size=%u, count=%d", q, mPos, b->size, count);
             }
 
             mPos += count;
             b->size = count;
-            //LOGV("buffer=%p, [0]=%d", b->i16, b->i16[0]);
+            //ALOGV("buffer=%p, [0]=%d", b->i16, b->i16[0]);
         }
     } else if (event == AudioTrack::EVENT_UNDERRUN) {
-        LOGV("process %p channel %d EVENT_UNDERRUN", this, mChannelID);
+        ALOGV("process %p channel %d EVENT_UNDERRUN", this, mChannelID);
         mSoundPool->addToStopList(this);
     } else if (event == AudioTrack::EVENT_LOOP_END) {
-        LOGV("End loop %p channel %d count %d", this, mChannelID, *(int *)info);
+        ALOGV("End loop %p channel %d count %d", this, mChannelID, *(int *)info);
     }
 }
 
@@ -761,7 +761,7 @@
 {
     if (mState != IDLE) {
         setVolume_l(0, 0);
-        LOGV("stop");
+        ALOGV("stop");
         mAudioTrack->stop();
         mSample.clear();
         mState = IDLE;
@@ -798,7 +798,7 @@
 {
     Mutex::Autolock lock(&mLock);
     if (mState == PLAYING) {
-        LOGV("pause track");
+        ALOGV("pause track");
         mState = PAUSED;
         mAudioTrack->pause();
     }
@@ -808,7 +808,7 @@
 {
     Mutex::Autolock lock(&mLock);
     if (mState == PLAYING) {
-        LOGV("pause track");
+        ALOGV("pause track");
         mState = PAUSED;
         mAutoPaused = true;
         mAudioTrack->pause();
@@ -819,7 +819,7 @@
 {
     Mutex::Autolock lock(&mLock);
     if (mState == PAUSED) {
-        LOGV("resume track");
+        ALOGV("resume track");
         mState = PLAYING;
         mAutoPaused = false;
         mAudioTrack->start();
@@ -830,7 +830,7 @@
 {
     Mutex::Autolock lock(&mLock);
     if (mAutoPaused && (mState == PAUSED)) {
-        LOGV("resume track");
+        ALOGV("resume track");
         mState = PLAYING;
         mAutoPaused = false;
         mAudioTrack->start();
@@ -874,7 +874,7 @@
 
 SoundChannel::~SoundChannel()
 {
-    LOGV("SoundChannel destructor %p", this);
+    ALOGV("SoundChannel destructor %p", this);
     {
         Mutex::Autolock lock(&mLock);
         clearNextEvent();
@@ -887,7 +887,7 @@
 
 void SoundChannel::dump()
 {
-    LOGV("mState = %d mChannelID=%d, mNumChannels=%d, mPos = %d, mPriority=%d, mLoop=%d",
+    ALOGV("mState = %d mChannelID=%d, mNumChannels=%d, mPos = %d, mPriority=%d, mLoop=%d",
             mState, mChannelID, mNumChannels, mPos, mPriority, mLoop);
 }
 
diff --git a/media/jni/soundpool/SoundPoolThread.cpp b/media/jni/soundpool/SoundPoolThread.cpp
index 275c519..ba3b482 100644
--- a/media/jni/soundpool/SoundPoolThread.cpp
+++ b/media/jni/soundpool/SoundPoolThread.cpp
@@ -55,7 +55,7 @@
         mCondition.signal();
         mCondition.wait(mLock);
     }
-    LOGV("return from quit");
+    ALOGV("return from quit");
 }
 
 SoundPoolThread::SoundPoolThread(SoundPool* soundPool) :
@@ -73,25 +73,25 @@
 }
 
 int SoundPoolThread::beginThread(void* arg) {
-    LOGV("beginThread");
+    ALOGV("beginThread");
     SoundPoolThread* soundPoolThread = (SoundPoolThread*)arg;
     return soundPoolThread->run();
 }
 
 int SoundPoolThread::run() {
-    LOGV("run");
+    ALOGV("run");
     for (;;) {
         SoundPoolMsg msg = read();
-        LOGV("Got message m=%d, mData=%d", msg.mMessageType, msg.mData);
+        ALOGV("Got message m=%d, mData=%d", msg.mMessageType, msg.mData);
         switch (msg.mMessageType) {
         case SoundPoolMsg::KILL:
-            LOGV("goodbye");
+            ALOGV("goodbye");
             return NO_ERROR;
         case SoundPoolMsg::LOAD_SAMPLE:
             doLoadSample(msg.mData);
             break;
         default:
-            LOGW("run: Unrecognized message %d\n",
+            ALOGW("run: Unrecognized message %d\n",
                     msg.mMessageType);
             break;
         }
diff --git a/media/jni/soundpool/android_media_SoundPool.cpp b/media/jni/soundpool/android_media_SoundPool.cpp
index 03d3388..fe1c20a 100644
--- a/media/jni/soundpool/android_media_SoundPool.cpp
+++ b/media/jni/soundpool/android_media_SoundPool.cpp
@@ -41,7 +41,7 @@
 static int
 android_media_SoundPool_load_URL(JNIEnv *env, jobject thiz, jstring path, jint priority)
 {
-    LOGV("android_media_SoundPool_load_URL");
+    ALOGV("android_media_SoundPool_load_URL");
     SoundPool *ap = MusterSoundPool(env, thiz);
     if (path == NULL) {
         jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
@@ -57,7 +57,7 @@
 android_media_SoundPool_load_FD(JNIEnv *env, jobject thiz, jobject fileDescriptor,
         jlong offset, jlong length, jint priority)
 {
-    LOGV("android_media_SoundPool_load_FD");
+    ALOGV("android_media_SoundPool_load_FD");
     SoundPool *ap = MusterSoundPool(env, thiz);
     if (ap == NULL) return 0;
     return ap->load(jniGetFDFromFileDescriptor(env, fileDescriptor),
@@ -66,7 +66,7 @@
 
 static bool
 android_media_SoundPool_unload(JNIEnv *env, jobject thiz, jint sampleID) {
-    LOGV("android_media_SoundPool_unload\n");
+    ALOGV("android_media_SoundPool_unload\n");
     SoundPool *ap = MusterSoundPool(env, thiz);
     if (ap == NULL) return 0;
     return ap->unload(sampleID);
@@ -77,7 +77,7 @@
         jfloat leftVolume, jfloat rightVolume, jint priority, jint loop,
         jfloat rate)
 {
-    LOGV("android_media_SoundPool_play\n");
+    ALOGV("android_media_SoundPool_play\n");
     SoundPool *ap = MusterSoundPool(env, thiz);
     if (ap == NULL) return 0;
     return ap->play(sampleID, leftVolume, rightVolume, priority, loop, rate);
@@ -86,7 +86,7 @@
 static void
 android_media_SoundPool_pause(JNIEnv *env, jobject thiz, jint channelID)
 {
-    LOGV("android_media_SoundPool_pause");
+    ALOGV("android_media_SoundPool_pause");
     SoundPool *ap = MusterSoundPool(env, thiz);
     if (ap == NULL) return;
     ap->pause(channelID);
@@ -95,7 +95,7 @@
 static void
 android_media_SoundPool_resume(JNIEnv *env, jobject thiz, jint channelID)
 {
-    LOGV("android_media_SoundPool_resume");
+    ALOGV("android_media_SoundPool_resume");
     SoundPool *ap = MusterSoundPool(env, thiz);
     if (ap == NULL) return;
     ap->resume(channelID);
@@ -104,7 +104,7 @@
 static void
 android_media_SoundPool_autoPause(JNIEnv *env, jobject thiz)
 {
-    LOGV("android_media_SoundPool_autoPause");
+    ALOGV("android_media_SoundPool_autoPause");
     SoundPool *ap = MusterSoundPool(env, thiz);
     if (ap == NULL) return;
     ap->autoPause();
@@ -113,7 +113,7 @@
 static void
 android_media_SoundPool_autoResume(JNIEnv *env, jobject thiz)
 {
-    LOGV("android_media_SoundPool_autoResume");
+    ALOGV("android_media_SoundPool_autoResume");
     SoundPool *ap = MusterSoundPool(env, thiz);
     if (ap == NULL) return;
     ap->autoResume();
@@ -122,7 +122,7 @@
 static void
 android_media_SoundPool_stop(JNIEnv *env, jobject thiz, jint channelID)
 {
-    LOGV("android_media_SoundPool_stop");
+    ALOGV("android_media_SoundPool_stop");
     SoundPool *ap = MusterSoundPool(env, thiz);
     if (ap == NULL) return;
     ap->stop(channelID);
@@ -132,7 +132,7 @@
 android_media_SoundPool_setVolume(JNIEnv *env, jobject thiz, jint channelID,
         float leftVolume, float rightVolume)
 {
-    LOGV("android_media_SoundPool_setVolume");
+    ALOGV("android_media_SoundPool_setVolume");
     SoundPool *ap = MusterSoundPool(env, thiz);
     if (ap == NULL) return;
     ap->setVolume(channelID, leftVolume, rightVolume);
@@ -142,7 +142,7 @@
 android_media_SoundPool_setPriority(JNIEnv *env, jobject thiz, jint channelID,
         int priority)
 {
-    LOGV("android_media_SoundPool_setPriority");
+    ALOGV("android_media_SoundPool_setPriority");
     SoundPool *ap = MusterSoundPool(env, thiz);
     if (ap == NULL) return;
     ap->setPriority(channelID, priority);
@@ -152,7 +152,7 @@
 android_media_SoundPool_setLoop(JNIEnv *env, jobject thiz, jint channelID,
         int loop)
 {
-    LOGV("android_media_SoundPool_setLoop");
+    ALOGV("android_media_SoundPool_setLoop");
     SoundPool *ap = MusterSoundPool(env, thiz);
     if (ap == NULL) return;
     ap->setLoop(channelID, loop);
@@ -162,7 +162,7 @@
 android_media_SoundPool_setRate(JNIEnv *env, jobject thiz, jint channelID,
         float rate)
 {
-    LOGV("android_media_SoundPool_setRate");
+    ALOGV("android_media_SoundPool_setRate");
     SoundPool *ap = MusterSoundPool(env, thiz);
     if (ap == NULL) return;
     ap->setRate(channelID, rate);
@@ -170,7 +170,7 @@
 
 static void android_media_callback(SoundPoolEvent event, SoundPool* soundPool, void* user)
 {
-    LOGV("callback: (%d, %d, %d, %p, %p)", event.mMsg, event.mArg1, event.mArg2, soundPool, user);
+    ALOGV("callback: (%d, %d, %d, %p, %p)", event.mMsg, event.mArg1, event.mArg2, soundPool, user);
     JNIEnv *env = AndroidRuntime::getJNIEnv();
     env->CallStaticVoidMethod(fields.mSoundPoolClass, fields.mPostEvent, user, event.mMsg, event.mArg1, event.mArg2, NULL);
 }
@@ -178,7 +178,7 @@
 static jint
 android_media_SoundPool_native_setup(JNIEnv *env, jobject thiz, jobject weakRef, jint maxChannels, jint streamType, jint srcQuality)
 {
-    LOGV("android_media_SoundPool_native_setup");
+    ALOGV("android_media_SoundPool_native_setup");
     SoundPool *ap = new SoundPool(maxChannels, streamType, srcQuality);
     if (ap == NULL) {
         return -1;
@@ -196,7 +196,7 @@
 static void
 android_media_SoundPool_release(JNIEnv *env, jobject thiz)
 {
-    LOGV("android_media_SoundPool_release");
+    ALOGV("android_media_SoundPool_release");
     SoundPool *ap = MusterSoundPool(env, thiz);
     if (ap != NULL) {
 
@@ -288,27 +288,27 @@
     jclass clazz;
 
     if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
-        LOGE("ERROR: GetEnv failed\n");
+        ALOGE("ERROR: GetEnv failed\n");
         goto bail;
     }
     assert(env != NULL);
 
     clazz = env->FindClass(kClassPathName);
     if (clazz == NULL) {
-        LOGE("Can't find %s", kClassPathName);
+        ALOGE("Can't find %s", kClassPathName);
         goto bail;
     }
 
     fields.mNativeContext = env->GetFieldID(clazz, "mNativeContext", "I");
     if (fields.mNativeContext == NULL) {
-        LOGE("Can't find SoundPool.mNativeContext");
+        ALOGE("Can't find SoundPool.mNativeContext");
         goto bail;
     }
 
     fields.mPostEvent = env->GetStaticMethodID(clazz, "postEventFromNative",
                                                "(Ljava/lang/Object;IIILjava/lang/Object;)V");
     if (fields.mPostEvent == NULL) {
-        LOGE("Can't find android/media/SoundPool.postEventFromNative");
+        ALOGE("Can't find android/media/SoundPool.postEventFromNative");
         goto bail;
     }
 
diff --git a/media/libdrm/mobile1/src/parser/parser_dm.c b/media/libdrm/mobile1/src/parser/parser_dm.c
index 567e650..f5b7aaf 100644
--- a/media/libdrm/mobile1/src/parser/parser_dm.c
+++ b/media/libdrm/mobile1/src/parser/parser_dm.c
@@ -138,7 +138,7 @@
 
                     /* error: more than one content id */
                     if(drm_strnstr(pStart, (uint8_t*)HEADERS_CONTENT_ID, pBufferEnd - pStart)){
-                        LOGD("drm_dmParser: error: more than one content id\r\n");
+                        ALOGD("drm_dmParser: error: more than one content id\r\n");
                         return FALSE;
                     }
 
diff --git a/media/libeffects/factory/EffectsFactory.c b/media/libeffects/factory/EffectsFactory.c
index d333510..9f6599f 100644
--- a/media/libeffects/factory/EffectsFactory.c
+++ b/media/libeffects/factory/EffectsFactory.c
@@ -188,7 +188,7 @@
     *pNumEffects = gNumEffects;
     gCanQueryEffect = 1;
     pthread_mutex_unlock(&gLibLock);
-    LOGV("EffectQueryNumberEffects(): %d", *pNumEffects);
+    ALOGV("EffectQueryNumberEffects(): %d", *pNumEffects);
     return ret;
 }
 
@@ -230,7 +230,7 @@
 #if (LOG_NDEBUG == 0)
     char str[256];
     dumpEffectDescriptor(pDescriptor, str, 256);
-    LOGV("EffectQueryEffect() desc:%s", str);
+    ALOGV("EffectQueryEffect() desc:%s", str);
 #endif
     pthread_mutex_unlock(&gLibLock);
     return ret;
@@ -271,7 +271,7 @@
         return -EINVAL;
     }
 
-    LOGV("EffectCreate() UUID: %08X-%04X-%04X-%04X-%02X%02X%02X%02X%02X%02X\n",
+    ALOGV("EffectCreate() UUID: %08X-%04X-%04X-%04X-%02X%02X%02X%02X%02X%02X\n",
             uuid->timeLow, uuid->timeMid, uuid->timeHiAndVersion,
             uuid->clockSeq, uuid->node[0], uuid->node[1],uuid->node[2],
             uuid->node[3],uuid->node[4],uuid->node[5]);
@@ -279,7 +279,7 @@
     ret = init();
 
     if (ret < 0) {
-        LOGW("EffectCreate() init error: %d", ret);
+        ALOGW("EffectCreate() init error: %d", ret);
         return ret;
     }
 
@@ -293,7 +293,7 @@
     // create effect in library
     ret = l->desc->create_effect(uuid, sessionId, ioId, &itfe);
     if (ret != 0) {
-        LOGW("EffectCreate() library %s: could not create fx %s, error %d", l->name, d->name, ret);
+        ALOGW("EffectCreate() library %s: could not create fx %s, error %d", l->name, d->name, ret);
         goto exit;
     }
 
@@ -302,10 +302,10 @@
     fx->subItfe = itfe;
     if ((*itfe)->process_reverse != NULL) {
         fx->itfe = (struct effect_interface_s *)&gInterfaceWithReverse;
-        LOGV("EffectCreate() gInterfaceWithReverse");
+        ALOGV("EffectCreate() gInterfaceWithReverse");
     }   else {
         fx->itfe = (struct effect_interface_s *)&gInterface;
-        LOGV("EffectCreate() gInterface");
+        ALOGV("EffectCreate() gInterface");
     }
     fx->lib = l;
 
@@ -316,7 +316,7 @@
 
     *pHandle = (effect_handle_t)fx;
 
-    LOGV("EffectCreate() created entry %p with sub itfe %p in library %s", *pHandle, itfe, l->name);
+    ALOGV("EffectCreate() created entry %p with sub itfe %p in library %s", *pHandle, itfe, l->name);
 
 exit:
     pthread_mutex_unlock(&gLibLock);
@@ -359,7 +359,7 @@
 
     // release effect in library
     if (fx->lib == NULL) {
-        LOGW("EffectRelease() fx %p library already unloaded", handle);
+        ALOGW("EffectRelease() fx %p library already unloaded", handle);
     } else {
         pthread_mutex_lock(&fx->lib->lock);
         fx->lib->desc->release_effect(fx->subItfe);
@@ -401,7 +401,7 @@
 
     updateNumEffects();
     gInitDone = 1;
-    LOGV("init() done");
+    ALOGV("init() done");
     return 0;
 }
 
@@ -456,24 +456,24 @@
 
     hdl = dlopen(node->value, RTLD_NOW);
     if (hdl == NULL) {
-        LOGW("loadLibrary() failed to open %s", node->value);
+        ALOGW("loadLibrary() failed to open %s", node->value);
         goto error;
     }
 
     desc = (audio_effect_library_t *)dlsym(hdl, AUDIO_EFFECT_LIBRARY_INFO_SYM_AS_STR);
     if (desc == NULL) {
-        LOGW("loadLibrary() could not find symbol %s", AUDIO_EFFECT_LIBRARY_INFO_SYM_AS_STR);
+        ALOGW("loadLibrary() could not find symbol %s", AUDIO_EFFECT_LIBRARY_INFO_SYM_AS_STR);
         goto error;
     }
 
     if (AUDIO_EFFECT_LIBRARY_TAG != desc->tag) {
-        LOGW("getLibrary() bad tag %08x in lib info struct", desc->tag);
+        ALOGW("getLibrary() bad tag %08x in lib info struct", desc->tag);
         goto error;
     }
 
     if (EFFECT_API_VERSION_MAJOR(desc->version) !=
             EFFECT_API_VERSION_MAJOR(EFFECT_LIBRARY_API_VERSION)) {
-        LOGW("loadLibrary() bad lib version %08x", desc->version);
+        ALOGW("loadLibrary() bad lib version %08x", desc->version);
         goto error;
     }
 
@@ -492,7 +492,7 @@
     e->next = gLibraryList;
     gLibraryList = e;
     pthread_mutex_unlock(&gLibLock);
-    LOGV("getLibrary() linked library %p for path %s", l, node->value);
+    ALOGV("getLibrary() linked library %p for path %s", l, node->value);
 
     return 0;
 
@@ -534,7 +534,7 @@
 
     l = getLibrary(node->value);
     if (l == NULL) {
-        LOGW("loadEffect() could not get library %s", node->value);
+        ALOGW("loadEffect() could not get library %s", node->value);
         return -EINVAL;
     }
 
@@ -543,7 +543,7 @@
         return -EINVAL;
     }
     if (stringToUuid(node->value, &uuid) != 0) {
-        LOGW("loadEffect() invalid uuid %s", node->value);
+        ALOGW("loadEffect() invalid uuid %s", node->value);
         return -EINVAL;
     }
 
@@ -551,18 +551,18 @@
     if (l->desc->get_descriptor(&uuid, d) != 0) {
         char s[40];
         uuidToString(&uuid, s, 40);
-        LOGW("Error querying effect %s on lib %s", s, l->name);
+        ALOGW("Error querying effect %s on lib %s", s, l->name);
         free(d);
         return -EINVAL;
     }
 #if (LOG_NDEBUG==0)
     char s[256];
     dumpEffectDescriptor(d, s, 256);
-    LOGV("loadEffect() read descriptor %p:%s",d, s);
+    ALOGV("loadEffect() read descriptor %p:%s",d, s);
 #endif
     if (EFFECT_API_VERSION_MAJOR(d->apiVersion) !=
             EFFECT_API_VERSION_MAJOR(EFFECT_CONTROL_API_VERSION)) {
-        LOGW("Bad API version %08x on lib %s", d->apiVersion, l->name);
+        ALOGW("Bad API version %08x on lib %s", d->apiVersion, l->name);
         free(d);
         return -EINVAL;
     }
@@ -657,10 +657,10 @@
         e = e->next;
     }
     if (!found) {
-        LOGV("findEffect() effect not found");
+        ALOGV("findEffect() effect not found");
         ret = -ENOENT;
     } else {
-        LOGV("findEffect() found effect: %s in lib %s", d->name, l->name);
+        ALOGV("findEffect() found effect: %s in lib %s", d->name, l->name);
         *lib = l;
         if (desc) {
             *desc = d;
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index 5a1e93a..62be78c 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -32,19 +32,19 @@
 
 #define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc){\
         if (LvmStatus == LVM_NULLADDRESS){\
-            LOGV("\tLVM_ERROR : Parameter error - "\
+            ALOGV("\tLVM_ERROR : Parameter error - "\
                     "null pointer returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
         if (LvmStatus == LVM_ALIGNMENTERROR){\
-            LOGV("\tLVM_ERROR : Parameter error - "\
+            ALOGV("\tLVM_ERROR : Parameter error - "\
                     "bad alignment returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
         if (LvmStatus == LVM_INVALIDNUMSAMPLES){\
-            LOGV("\tLVM_ERROR : Parameter error - "\
+            ALOGV("\tLVM_ERROR : Parameter error - "\
                     "bad number of samples returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
         if (LvmStatus == LVM_OUTOFRANGE){\
-            LOGV("\tLVM_ERROR : Parameter error - "\
+            ALOGV("\tLVM_ERROR : Parameter error - "\
                     "out of range returned by %s in %s\n", callingFunc, calledFunc);\
         }\
     }
@@ -71,7 +71,7 @@
 /* local functions */
 #define CHECK_ARG(cond) {                     \
     if (!(cond)) {                            \
-        LOGV("\tLVM_ERROR : Invalid argument: "#cond);      \
+        ALOGV("\tLVM_ERROR : Invalid argument: "#cond);      \
         return -EINVAL;                       \
     }                                         \
 }
@@ -158,39 +158,39 @@
 
 /* Effect Library Interface Implementation */
 extern "C" int EffectQueryNumberEffects(uint32_t *pNumEffects){
-    LOGV("\n\tEffectQueryNumberEffects start");
+    ALOGV("\n\tEffectQueryNumberEffects start");
     *pNumEffects = 4;
-    LOGV("\tEffectQueryNumberEffects creating %d effects", *pNumEffects);
-    LOGV("\tEffectQueryNumberEffects end\n");
+    ALOGV("\tEffectQueryNumberEffects creating %d effects", *pNumEffects);
+    ALOGV("\tEffectQueryNumberEffects end\n");
     return 0;
 }     /* end EffectQueryNumberEffects */
 
 extern "C" int EffectQueryEffect(uint32_t index, effect_descriptor_t *pDescriptor){
-    LOGV("\n\tEffectQueryEffect start");
-    LOGV("\tEffectQueryEffect processing index %d", index);
+    ALOGV("\n\tEffectQueryEffect start");
+    ALOGV("\tEffectQueryEffect processing index %d", index);
 
     if (pDescriptor == NULL){
-        LOGV("\tLVM_ERROR : EffectQueryEffect was passed NULL pointer");
+        ALOGV("\tLVM_ERROR : EffectQueryEffect was passed NULL pointer");
         return -EINVAL;
     }
     if (index > 3){
-        LOGV("\tLVM_ERROR : EffectQueryEffect index out of range %d", index);
+        ALOGV("\tLVM_ERROR : EffectQueryEffect index out of range %d", index);
         return -ENOENT;
     }
     if(index == LVM_BASS_BOOST){
-        LOGV("\tEffectQueryEffect processing LVM_BASS_BOOST");
+        ALOGV("\tEffectQueryEffect processing LVM_BASS_BOOST");
         memcpy(pDescriptor, &gBassBoostDescriptor,   sizeof(effect_descriptor_t));
     }else if(index == LVM_VIRTUALIZER){
-        LOGV("\tEffectQueryEffect processing LVM_VIRTUALIZER");
+        ALOGV("\tEffectQueryEffect processing LVM_VIRTUALIZER");
         memcpy(pDescriptor, &gVirtualizerDescriptor, sizeof(effect_descriptor_t));
     } else if(index == LVM_EQUALIZER){
-        LOGV("\tEffectQueryEffect processing LVM_EQUALIZER");
+        ALOGV("\tEffectQueryEffect processing LVM_EQUALIZER");
         memcpy(pDescriptor, &gEqualizerDescriptor,   sizeof(effect_descriptor_t));
     } else if(index == LVM_VOLUME){
-        LOGV("\tEffectQueryEffect processing LVM_VOLUME");
+        ALOGV("\tEffectQueryEffect processing LVM_VOLUME");
         memcpy(pDescriptor, &gVolumeDescriptor, sizeof(effect_descriptor_t));
     }
-    LOGV("\tEffectQueryEffect end\n");
+    ALOGV("\tEffectQueryEffect end\n");
     return 0;
 }     /* end EffectQueryEffect */
 
@@ -205,17 +205,17 @@
     bool newBundle = false;
     SessionContext *pSessionContext;
 
-    LOGV("\n\tEffectCreate start session %d", sessionId);
+    ALOGV("\n\tEffectCreate start session %d", sessionId);
 
     if (pHandle == NULL || uuid == NULL){
-        LOGV("\tLVM_ERROR : EffectCreate() called with NULL pointer");
+        ALOGV("\tLVM_ERROR : EffectCreate() called with NULL pointer");
         ret = -EINVAL;
         goto exit;
     }
 
     if(LvmInitFlag == LVM_FALSE){
         LvmInitFlag = LVM_TRUE;
-        LOGV("\tEffectCreate - Initializing all global memory");
+        ALOGV("\tEffectCreate - Initializing all global memory");
         LvmGlobalBundle_init();
     }
 
@@ -224,13 +224,13 @@
         if((SessionIndex[i] == LVM_UNUSED_SESSION)||(SessionIndex[i] == sessionId)){
             sessionNo       = i;
             SessionIndex[i] = sessionId;
-            LOGV("\tEffectCreate: Allocating SessionNo %d for SessionId %d\n", sessionNo,sessionId);
+            ALOGV("\tEffectCreate: Allocating SessionNo %d for SessionId %d\n", sessionNo,sessionId);
             break;
         }
     }
 
     if(i==LVM_MAX_SESSIONS){
-        LOGV("\tLVM_ERROR : Cannot find memory to allocate for current session");
+        ALOGV("\tLVM_ERROR : Cannot find memory to allocate for current session");
         ret = -EINVAL;
         goto exit;
     }
@@ -239,7 +239,7 @@
 
     // If this is the first create in this session
     if(GlobalSessionMemory[sessionNo].bBundledEffectsEnabled == LVM_FALSE){
-        LOGV("\tEffectCreate - This is the first effect in current sessionId %d sessionNo %d",
+        ALOGV("\tEffectCreate - This is the first effect in current sessionId %d sessionNo %d",
                 sessionId, sessionNo);
 
         GlobalSessionMemory[sessionNo].bBundledEffectsEnabled = LVM_TRUE;
@@ -265,7 +265,7 @@
         snprintf(fileName, 256, "/data/tmp/bundle_%p_pcm_in.pcm", pContext->pBundledContext);
         pContext->pBundledContext->PcmInPtr = fopen(fileName, "w");
         if (pContext->pBundledContext->PcmInPtr == NULL) {
-            LOGV("cannot open %s", fileName);
+            ALOGV("cannot open %s", fileName);
             ret = -EINVAL;
             goto exit;
         }
@@ -273,7 +273,7 @@
         snprintf(fileName, 256, "/data/tmp/bundle_%p_pcm_out.pcm", pContext->pBundledContext);
         pContext->pBundledContext->PcmOutPtr = fopen(fileName, "w");
         if (pContext->pBundledContext->PcmOutPtr == NULL) {
-            LOGV("cannot open %s", fileName);
+            ALOGV("cannot open %s", fileName);
             fclose(pContext->pBundledContext->PcmInPtr);
            pContext->pBundledContext->PcmInPtr = NULL;
            ret = -EINVAL;
@@ -298,28 +298,28 @@
         pContext->pBundledContext->SamplesToExitCountBb     = 0;
         pContext->pBundledContext->SamplesToExitCountEq     = 0;
 
-        LOGV("\tEffectCreate - Calling LvmBundle_init");
+        ALOGV("\tEffectCreate - Calling LvmBundle_init");
         ret = LvmBundle_init(pContext);
 
         if (ret < 0){
-            LOGV("\tLVM_ERROR : EffectCreate() Bundle init failed");
+            ALOGV("\tLVM_ERROR : EffectCreate() Bundle init failed");
             goto exit;
         }
     }
     else{
-        LOGV("\tEffectCreate - Assigning memory for previously created effect on sessionNo %d",
+        ALOGV("\tEffectCreate - Assigning memory for previously created effect on sessionNo %d",
                 sessionNo);
         pContext->pBundledContext =
                 GlobalSessionMemory[sessionNo].pBundledContext;
     }
-    LOGV("\tEffectCreate - pBundledContext is %p", pContext->pBundledContext);
+    ALOGV("\tEffectCreate - pBundledContext is %p", pContext->pBundledContext);
 
     pSessionContext = &GlobalSessionMemory[pContext->pBundledContext->SessionNo];
 
     // Create each Effect
     if (memcmp(uuid, &gBassBoostDescriptor.uuid, sizeof(effect_uuid_t)) == 0){
         // Create Bass Boost
-        LOGV("\tEffectCreate - Effect to be created is LVM_BASS_BOOST");
+        ALOGV("\tEffectCreate - Effect to be created is LVM_BASS_BOOST");
         pSessionContext->bBassInstantiated = LVM_TRUE;
         pContext->pBundledContext->SamplesToExitCountBb = 0;
 
@@ -327,7 +327,7 @@
         pContext->EffectType = LVM_BASS_BOOST;
     } else if (memcmp(uuid, &gVirtualizerDescriptor.uuid, sizeof(effect_uuid_t)) == 0){
         // Create Virtualizer
-        LOGV("\tEffectCreate - Effect to be created is LVM_VIRTUALIZER");
+        ALOGV("\tEffectCreate - Effect to be created is LVM_VIRTUALIZER");
         pSessionContext->bVirtualizerInstantiated=LVM_TRUE;
         pContext->pBundledContext->SamplesToExitCountVirt = 0;
 
@@ -335,7 +335,7 @@
         pContext->EffectType = LVM_VIRTUALIZER;
     } else if (memcmp(uuid, &gEqualizerDescriptor.uuid, sizeof(effect_uuid_t)) == 0){
         // Create Equalizer
-        LOGV("\tEffectCreate - Effect to be created is LVM_EQUALIZER");
+        ALOGV("\tEffectCreate - Effect to be created is LVM_EQUALIZER");
         pSessionContext->bEqualizerInstantiated = LVM_TRUE;
         pContext->pBundledContext->SamplesToExitCountEq = 0;
 
@@ -343,14 +343,14 @@
         pContext->EffectType = LVM_EQUALIZER;
     } else if (memcmp(uuid, &gVolumeDescriptor.uuid, sizeof(effect_uuid_t)) == 0){
         // Create Volume
-        LOGV("\tEffectCreate - Effect to be created is LVM_VOLUME");
+        ALOGV("\tEffectCreate - Effect to be created is LVM_VOLUME");
         pSessionContext->bVolumeInstantiated = LVM_TRUE;
 
         pContext->itfe       = &gLvmEffectInterface;
         pContext->EffectType = LVM_VOLUME;
     }
     else{
-        LOGV("\tLVM_ERROR : EffectCreate() invalid UUID");
+        ALOGV("\tLVM_ERROR : EffectCreate() invalid UUID");
         ret = -EINVAL;
         goto exit;
     }
@@ -369,17 +369,17 @@
     } else {
         *pHandle = (effect_handle_t)pContext;
     }
-    LOGV("\tEffectCreate end..\n\n");
+    ALOGV("\tEffectCreate end..\n\n");
     return ret;
 } /* end EffectCreate */
 
 extern "C" int EffectRelease(effect_handle_t handle){
-    LOGV("\n\tEffectRelease start %p", handle);
+    ALOGV("\n\tEffectRelease start %p", handle);
     EffectContext * pContext = (EffectContext *)handle;
 
-    LOGV("\tEffectRelease start handle: %p, context %p", handle, pContext->pBundledContext);
+    ALOGV("\tEffectRelease start handle: %p, context %p", handle, pContext->pBundledContext);
     if (pContext == NULL){
-        LOGV("\tLVM_ERROR : EffectRelease called with NULL pointer");
+        ALOGV("\tLVM_ERROR : EffectRelease called with NULL pointer");
         return -EINVAL;
     }
 
@@ -388,34 +388,34 @@
     // Clear the instantiated flag for the effect
     // protect agains the case where an effect is un-instantiated without being disabled
     if(pContext->EffectType == LVM_BASS_BOOST) {
-        LOGV("\tEffectRelease LVM_BASS_BOOST Clearing global intstantiated flag");
+        ALOGV("\tEffectRelease LVM_BASS_BOOST Clearing global intstantiated flag");
         pSessionContext->bBassInstantiated = LVM_FALSE;
         if(pContext->pBundledContext->SamplesToExitCountBb > 0){
             pContext->pBundledContext->NumberEffectsEnabled--;
         }
         pContext->pBundledContext->SamplesToExitCountBb = 0;
     } else if(pContext->EffectType == LVM_VIRTUALIZER) {
-        LOGV("\tEffectRelease LVM_VIRTUALIZER Clearing global intstantiated flag");
+        ALOGV("\tEffectRelease LVM_VIRTUALIZER Clearing global intstantiated flag");
         pSessionContext->bVirtualizerInstantiated = LVM_FALSE;
         if(pContext->pBundledContext->SamplesToExitCountVirt > 0){
             pContext->pBundledContext->NumberEffectsEnabled--;
         }
         pContext->pBundledContext->SamplesToExitCountVirt = 0;
     } else if(pContext->EffectType == LVM_EQUALIZER) {
-        LOGV("\tEffectRelease LVM_EQUALIZER Clearing global intstantiated flag");
+        ALOGV("\tEffectRelease LVM_EQUALIZER Clearing global intstantiated flag");
         pSessionContext->bEqualizerInstantiated =LVM_FALSE;
         if(pContext->pBundledContext->SamplesToExitCountEq > 0){
             pContext->pBundledContext->NumberEffectsEnabled--;
         }
         pContext->pBundledContext->SamplesToExitCountEq = 0;
     } else if(pContext->EffectType == LVM_VOLUME) {
-        LOGV("\tEffectRelease LVM_VOLUME Clearing global intstantiated flag");
+        ALOGV("\tEffectRelease LVM_VOLUME Clearing global intstantiated flag");
         pSessionContext->bVolumeInstantiated = LVM_FALSE;
         if (pContext->pBundledContext->bVolumeEnabled == LVM_TRUE){
             pContext->pBundledContext->NumberEffectsEnabled--;
         }
     } else {
-        LOGV("\tLVM_ERROR : EffectRelease : Unsupported effect\n\n\n\n\n\n\n");
+        ALOGV("\tLVM_ERROR : EffectRelease : Unsupported effect\n\n\n\n\n\n\n");
     }
 
     // Disable effect, in this case ignore errors (return codes)
@@ -444,18 +444,18 @@
         for(int i=0; i<LVM_MAX_SESSIONS; i++){
             if(SessionIndex[i] == pContext->pBundledContext->SessionId){
                 SessionIndex[i] = LVM_UNUSED_SESSION;
-                LOGV("\tEffectRelease: Clearing SessionIndex SessionNo %d for SessionId %d\n",
+                ALOGV("\tEffectRelease: Clearing SessionIndex SessionNo %d for SessionId %d\n",
                         i, pContext->pBundledContext->SessionId);
                 break;
             }
         }
 
-        LOGV("\tEffectRelease: All effects are no longer instantiated\n");
+        ALOGV("\tEffectRelease: All effects are no longer instantiated\n");
         pSessionContext->bBundledEffectsEnabled = LVM_FALSE;
         pSessionContext->pBundledContext = LVM_NULL;
-        LOGV("\tEffectRelease: Freeing LVM Bundle memory\n");
+        ALOGV("\tEffectRelease: Freeing LVM Bundle memory\n");
         LvmEffect_free(pContext);
-        LOGV("\tEffectRelease: Deleting LVM Bundle context %p\n", pContext->pBundledContext);
+        ALOGV("\tEffectRelease: Deleting LVM Bundle context %p\n", pContext->pBundledContext);
         if (pContext->pBundledContext->workBuffer != NULL) {
             free(pContext->pBundledContext->workBuffer);
         }
@@ -465,7 +465,7 @@
     // free the effect context for current effect
     delete pContext;
 
-    LOGV("\tEffectRelease end\n");
+    ALOGV("\tEffectRelease end\n");
     return 0;
 
 } /* end EffectRelease */
@@ -475,7 +475,7 @@
     const effect_descriptor_t *desc = NULL;
 
     if (pDescriptor == NULL || uuid == NULL){
-        LOGV("EffectGetDescriptor() called with NULL pointer");
+        ALOGV("EffectGetDescriptor() called with NULL pointer");
         return -EINVAL;
     }
 
@@ -499,7 +499,7 @@
 } /* end EffectGetDescriptor */
 
 void LvmGlobalBundle_init(){
-    LOGV("\tLvmGlobalBundle_init start");
+    ALOGV("\tLvmGlobalBundle_init start");
     for(int i=0; i<LVM_MAX_SESSIONS; i++){
         GlobalSessionMemory[i].bBundledEffectsEnabled   = LVM_FALSE;
         GlobalSessionMemory[i].bVolumeInstantiated      = LVM_FALSE;
@@ -528,7 +528,7 @@
 int LvmBundle_init(EffectContext *pContext){
     int status;
 
-    LOGV("\tLvmBundle_init start");
+    ALOGV("\tLvmBundle_init start");
 
     pContext->config.inputCfg.accessMode                    = EFFECT_BUFFER_ACCESS_READ;
     pContext->config.inputCfg.channels                      = AUDIO_CHANNEL_OUT_STEREO;
@@ -550,12 +550,12 @@
     CHECK_ARG(pContext != NULL);
 
     if (pContext->pBundledContext->hInstance != NULL){
-        LOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
+        ALOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
                 "-> Calling pContext->pBassBoost->free()");
 
         LvmEffect_free(pContext);
 
-        LOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
+        ALOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
                 "-> Called pContext->pBassBoost->free()");
     }
 
@@ -582,7 +582,7 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetMemoryTable", "LvmBundle_init")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    LOGV("\tCreateInstance Succesfully called LVM_GetMemoryTable\n");
+    ALOGV("\tCreateInstance Succesfully called LVM_GetMemoryTable\n");
 
     /* Allocate memory */
     for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
@@ -590,11 +590,11 @@
             MemTab.Region[i].pBaseAddress = malloc(MemTab.Region[i].Size);
 
             if (MemTab.Region[i].pBaseAddress == LVM_NULL){
-                LOGV("\tLVM_ERROR :LvmBundle_init CreateInstance Failed to allocate %ld bytes "
+                ALOGV("\tLVM_ERROR :LvmBundle_init CreateInstance Failed to allocate %ld bytes "
                         "for region %u\n", MemTab.Region[i].Size, i );
                 bMallocFailure = LVM_TRUE;
             }else{
-                LOGV("\tLvmBundle_init CreateInstance allocated %ld bytes for region %u at %p\n",
+                ALOGV("\tLvmBundle_init CreateInstance allocated %ld bytes for region %u at %p\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
             }
         }
@@ -606,10 +606,10 @@
     if(bMallocFailure == LVM_TRUE){
         for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
             if (MemTab.Region[i].pBaseAddress == LVM_NULL){
-                LOGV("\tLVM_ERROR :LvmBundle_init CreateInstance Failed to allocate %ld bytes "
+                ALOGV("\tLVM_ERROR :LvmBundle_init CreateInstance Failed to allocate %ld bytes "
                         "for region %u Not freeing\n", MemTab.Region[i].Size, i );
             }else{
-                LOGV("\tLVM_ERROR :LvmBundle_init CreateInstance Failed: but allocated %ld bytes "
+                ALOGV("\tLVM_ERROR :LvmBundle_init CreateInstance Failed: but allocated %ld bytes "
                      "for region %u at %p- free\n",
                      MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
                 free(MemTab.Region[i].pBaseAddress);
@@ -617,7 +617,7 @@
         }
         return -EINVAL;
     }
-    LOGV("\tLvmBundle_init CreateInstance Succesfully malloc'd memory\n");
+    ALOGV("\tLvmBundle_init CreateInstance Succesfully malloc'd memory\n");
 
     /* Initialise */
     pContext->pBundledContext->hInstance = LVM_NULL;
@@ -630,7 +630,7 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetInstanceHandle", "LvmBundle_init")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    LOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_GetInstanceHandle\n");
+    ALOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_GetInstanceHandle\n");
 
     /* Set the initial process parameters */
     /* General parameters */
@@ -692,7 +692,7 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmBundle_init")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    LOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_SetControlParameters\n");
+    ALOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_SetControlParameters\n");
 
     /* Set the headroom parameters */
     HeadroomBandDef[0].Limit_Low          = 20;
@@ -711,8 +711,8 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetHeadroomParams", "LvmBundle_init")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    LOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_SetHeadroomParams\n");
-    LOGV("\tLvmBundle_init End");
+    ALOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_SetHeadroomParams\n");
+    ALOGV("\tLvmBundle_init End");
     return 0;
 }   /* end LvmBundle_init */
 
@@ -757,7 +757,7 @@
         }
         pOutTmp = pContext->pBundledContext->workBuffer;
     }else{
-        LOGV("LVM_ERROR : LvmBundle_process invalid access mode");
+        ALOGV("LVM_ERROR : LvmBundle_process invalid access mode");
         return -EINVAL;
     }
 
@@ -766,7 +766,7 @@
     fflush(pContext->pBundledContext->PcmInPtr);
     #endif
 
-    //LOGV("Calling LVM_Process");
+    //ALOGV("Calling LVM_Process");
 
     /* Process the samples */
     LvmStatus = LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */
@@ -804,7 +804,7 @@
 //----------------------------------------------------------------------------
 
 int LvmEffect_enable(EffectContext *pContext){
-    //LOGV("\tLvmEffect_enable start");
+    //ALOGV("\tLvmEffect_enable start");
 
     LVM_ControlParams_t     ActiveParams;                           /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;                /* Function call status */
@@ -815,30 +815,30 @@
 
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "LvmEffect_enable")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
-    //LOGV("\tLvmEffect_enable Succesfully called LVM_GetControlParameters\n");
+    //ALOGV("\tLvmEffect_enable Succesfully called LVM_GetControlParameters\n");
 
     if(pContext->EffectType == LVM_BASS_BOOST) {
-        LOGV("\tLvmEffect_enable : Enabling LVM_BASS_BOOST");
+        ALOGV("\tLvmEffect_enable : Enabling LVM_BASS_BOOST");
         ActiveParams.BE_OperatingMode       = LVM_BE_ON;
     }
     if(pContext->EffectType == LVM_VIRTUALIZER) {
-        LOGV("\tLvmEffect_enable : Enabling LVM_VIRTUALIZER");
+        ALOGV("\tLvmEffect_enable : Enabling LVM_VIRTUALIZER");
         ActiveParams.VirtualizerOperatingMode   = LVM_MODE_ON;
     }
     if(pContext->EffectType == LVM_EQUALIZER) {
-        LOGV("\tLvmEffect_enable : Enabling LVM_EQUALIZER");
+        ALOGV("\tLvmEffect_enable : Enabling LVM_EQUALIZER");
         ActiveParams.EQNB_OperatingMode     = LVM_EQNB_ON;
     }
     if(pContext->EffectType == LVM_VOLUME) {
-        LOGV("\tLvmEffect_enable : Enabling LVM_VOLUME");
+        ALOGV("\tLvmEffect_enable : Enabling LVM_VOLUME");
     }
 
     LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmEffect_enable")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tLvmEffect_enable Succesfully called LVM_SetControlParameters\n");
-    //LOGV("\tLvmEffect_enable end");
+    //ALOGV("\tLvmEffect_enable Succesfully called LVM_SetControlParameters\n");
+    //ALOGV("\tLvmEffect_enable end");
     return 0;
 }
 
@@ -855,7 +855,7 @@
 //----------------------------------------------------------------------------
 
 int LvmEffect_disable(EffectContext *pContext){
-    //LOGV("\tLvmEffect_disable start");
+    //ALOGV("\tLvmEffect_disable start");
 
     LVM_ControlParams_t     ActiveParams;                           /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;                /* Function call status */
@@ -865,30 +865,30 @@
 
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "LvmEffect_disable")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
-    //LOGV("\tLvmEffect_disable Succesfully called LVM_GetControlParameters\n");
+    //ALOGV("\tLvmEffect_disable Succesfully called LVM_GetControlParameters\n");
 
     if(pContext->EffectType == LVM_BASS_BOOST) {
-        LOGV("\tLvmEffect_disable : Disabling LVM_BASS_BOOST");
+        ALOGV("\tLvmEffect_disable : Disabling LVM_BASS_BOOST");
         ActiveParams.BE_OperatingMode       = LVM_BE_OFF;
     }
     if(pContext->EffectType == LVM_VIRTUALIZER) {
-        LOGV("\tLvmEffect_disable : Disabling LVM_VIRTUALIZER");
+        ALOGV("\tLvmEffect_disable : Disabling LVM_VIRTUALIZER");
         ActiveParams.VirtualizerOperatingMode   = LVM_MODE_OFF;
     }
     if(pContext->EffectType == LVM_EQUALIZER) {
-        LOGV("\tLvmEffect_disable : Disabling LVM_EQUALIZER");
+        ALOGV("\tLvmEffect_disable : Disabling LVM_EQUALIZER");
         ActiveParams.EQNB_OperatingMode     = LVM_EQNB_OFF;
     }
     if(pContext->EffectType == LVM_VOLUME) {
-        LOGV("\tLvmEffect_disable : Disabling LVM_VOLUME");
+        ALOGV("\tLvmEffect_disable : Disabling LVM_VOLUME");
     }
 
     LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmEffect_disable")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tLvmEffect_disable Succesfully called LVM_SetControlParameters\n");
-    //LOGV("\tLvmEffect_disable end");
+    //ALOGV("\tLvmEffect_disable Succesfully called LVM_SetControlParameters\n");
+    //ALOGV("\tLvmEffect_disable end");
     return 0;
 }
 
@@ -919,15 +919,15 @@
     for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
         if (MemTab.Region[i].Size != 0){
             if (MemTab.Region[i].pBaseAddress != NULL){
-                LOGV("\tLvmEffect_free - START freeing %ld bytes for region %u at %p\n",
+                ALOGV("\tLvmEffect_free - START freeing %ld bytes for region %u at %p\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
 
                 free(MemTab.Region[i].pBaseAddress);
 
-                LOGV("\tLvmEffect_free - END   freeing %ld bytes for region %u at %p\n",
+                ALOGV("\tLvmEffect_free - END   freeing %ld bytes for region %u at %p\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
             }else{
-                LOGV("\tLVM_ERROR : LvmEffect_free - trying to free with NULL pointer %ld bytes "
+                ALOGV("\tLVM_ERROR : LvmEffect_free - trying to free with NULL pointer %ld bytes "
                         "for region %u at %p ERROR\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
             }
@@ -951,7 +951,7 @@
 
 int Effect_configure(EffectContext *pContext, effect_config_t *pConfig){
     LVM_Fs_en   SampleRate;
-    //LOGV("\tEffect_configure start");
+    //ALOGV("\tEffect_configure start");
 
     CHECK_ARG(pContext != NULL);
     CHECK_ARG(pConfig != NULL);
@@ -992,7 +992,7 @@
         pContext->pBundledContext->SamplesPerSecond = 48000*2; // 2 secs Stereo
         break;
     default:
-        LOGV("\tEffect_Configure invalid sampling rate %d", pConfig->inputCfg.samplingRate);
+        ALOGV("\tEffect_Configure invalid sampling rate %d", pConfig->inputCfg.samplingRate);
         return -EINVAL;
     }
 
@@ -1001,7 +1001,7 @@
         LVM_ControlParams_t     ActiveParams;
         LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;
 
-        LOGV("\tEffect_configure change sampling rate to %d", SampleRate);
+        ALOGV("\tEffect_configure change sampling rate to %d", SampleRate);
 
         /* Get the current settings */
         LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
@@ -1013,14 +1013,14 @@
         LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
 
         LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "Effect_configure")
-        LOGV("\tEffect_configure Succesfully called LVM_SetControlParameters\n");
+        ALOGV("\tEffect_configure Succesfully called LVM_SetControlParameters\n");
         pContext->pBundledContext->SampleRate = SampleRate;
 
     }else{
-        //LOGV("\tEffect_configure keep sampling rate at %d", SampleRate);
+        //ALOGV("\tEffect_configure keep sampling rate at %d", SampleRate);
     }
 
-    //LOGV("\tEffect_configure End....");
+    //ALOGV("\tEffect_configure End....");
     return 0;
 }   /* end Effect_configure */
 
@@ -1039,7 +1039,7 @@
 //----------------------------------------------------------------------------
 
 uint32_t BassGetStrength(EffectContext *pContext){
-    //LOGV("\tBassGetStrength() (0-1000) -> %d\n", pContext->pBundledContext->BassStrengthSaved);
+    //ALOGV("\tBassGetStrength() (0-1000) -> %d\n", pContext->pBundledContext->BassStrengthSaved);
 
     LVM_ControlParams_t     ActiveParams;                           /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;                /* Function call status */
@@ -1050,18 +1050,18 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "BassGetStrength")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tBassGetStrength Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tBassGetStrength Succesfully returned from LVM_GetControlParameters\n");
 
     /* Check that the strength returned matches the strength that was set earlier */
     if(ActiveParams.BE_EffectLevel !=
        (LVM_INT16)((15*pContext->pBundledContext->BassStrengthSaved)/1000)){
-        LOGV("\tLVM_ERROR : BassGetStrength module strength does not match savedStrength %d %d\n",
+        ALOGV("\tLVM_ERROR : BassGetStrength module strength does not match savedStrength %d %d\n",
                 ActiveParams.BE_EffectLevel, pContext->pBundledContext->BassStrengthSaved);
         return -EINVAL;
     }
 
-    //LOGV("\tBassGetStrength() (0-15)   -> %d\n", ActiveParams.BE_EffectLevel );
-    //LOGV("\tBassGetStrength() (saved)  -> %d\n", pContext->pBundledContext->BassStrengthSaved );
+    //ALOGV("\tBassGetStrength() (0-15)   -> %d\n", ActiveParams.BE_EffectLevel );
+    //ALOGV("\tBassGetStrength() (saved)  -> %d\n", pContext->pBundledContext->BassStrengthSaved );
     return pContext->pBundledContext->BassStrengthSaved;
 }    /* end BassGetStrength */
 
@@ -1078,7 +1078,7 @@
 //----------------------------------------------------------------------------
 
 void BassSetStrength(EffectContext *pContext, uint32_t strength){
-    //LOGV("\tBassSetStrength(%d)", strength);
+    //ALOGV("\tBassSetStrength(%d)", strength);
 
     pContext->pBundledContext->BassStrengthSaved = (int)strength;
 
@@ -1090,19 +1090,19 @@
                                          &ActiveParams);
 
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "BassSetStrength")
-    //LOGV("\tBassSetStrength Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tBassSetStrength Succesfully returned from LVM_GetControlParameters\n");
 
     /* Bass Enhancement parameters */
     ActiveParams.BE_EffectLevel    = (LVM_INT16)((15*strength)/1000);
     ActiveParams.BE_CentreFreq     = LVM_BE_CENTRE_90Hz;
 
-    //LOGV("\tBassSetStrength() (0-15)   -> %d\n", ActiveParams.BE_EffectLevel );
+    //ALOGV("\tBassSetStrength() (0-15)   -> %d\n", ActiveParams.BE_EffectLevel );
 
     /* Activate the initial settings */
     LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
 
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "BassSetStrength")
-    //LOGV("\tBassSetStrength Succesfully called LVM_SetControlParameters\n");
+    //ALOGV("\tBassSetStrength Succesfully called LVM_SetControlParameters\n");
 }    /* end BassSetStrength */
 
 //----------------------------------------------------------------------------
@@ -1120,7 +1120,7 @@
 //----------------------------------------------------------------------------
 
 uint32_t VirtualizerGetStrength(EffectContext *pContext){
-    //LOGV("\tVirtualizerGetStrength (0-1000) -> %d\n",pContext->pBundledContext->VirtStrengthSaved);
+    //ALOGV("\tVirtualizerGetStrength (0-1000) -> %d\n",pContext->pBundledContext->VirtStrengthSaved);
 
     LVM_ControlParams_t     ActiveParams;                           /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;                /* Function call status */
@@ -1130,8 +1130,8 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VirtualizerGetStrength")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVirtualizerGetStrength Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tVirtualizerGetStrength() (0-100)   -> %d\n", ActiveParams.VirtualizerReverbLevel*10);
+    //ALOGV("\tVirtualizerGetStrength Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tVirtualizerGetStrength() (0-100)   -> %d\n", ActiveParams.VirtualizerReverbLevel*10);
     return pContext->pBundledContext->VirtStrengthSaved;
 }    /* end getStrength */
 
@@ -1148,7 +1148,7 @@
 //----------------------------------------------------------------------------
 
 void VirtualizerSetStrength(EffectContext *pContext, uint32_t strength){
-    //LOGV("\tVirtualizerSetStrength(%d)", strength);
+    //ALOGV("\tVirtualizerSetStrength(%d)", strength);
     LVM_ControlParams_t     ActiveParams;              /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus=LVM_SUCCESS;     /* Function call status */
 
@@ -1158,18 +1158,18 @@
     LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,&ActiveParams);
 
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VirtualizerSetStrength")
-    //LOGV("\tVirtualizerSetStrength Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tVirtualizerSetStrength Succesfully returned from LVM_GetControlParameters\n");
 
     /* Virtualizer parameters */
     ActiveParams.CS_EffectLevel             = (int)((strength*32767)/1000);
 
-    //LOGV("\tVirtualizerSetStrength() (0-1000)   -> %d\n", strength );
-    //LOGV("\tVirtualizerSetStrength() (0- 100)   -> %d\n", ActiveParams.CS_EffectLevel );
+    //ALOGV("\tVirtualizerSetStrength() (0-1000)   -> %d\n", strength );
+    //ALOGV("\tVirtualizerSetStrength() (0- 100)   -> %d\n", ActiveParams.CS_EffectLevel );
 
     /* Activate the initial settings */
     LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "VirtualizerSetStrength")
-    //LOGV("\tVirtualizerSetStrength Succesfully called LVM_SetControlParameters\n\n");
+    //ALOGV("\tVirtualizerSetStrength Succesfully called LVM_SetControlParameters\n\n");
 }    /* end setStrength */
 
 //----------------------------------------------------------------------------
@@ -1199,8 +1199,8 @@
     BandDef = ActiveParams.pEQNB_BandDefinition;
     Gain    = (int32_t)BandDef[band].Gain*100;    // Convert to millibels
 
-    //LOGV("\tEqualizerGetBandLevel -> %d\n", Gain );
-    //LOGV("\tEqualizerGetBandLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tEqualizerGetBandLevel -> %d\n", Gain );
+    //ALOGV("\tEqualizerGetBandLevel Succesfully returned from LVM_GetControlParameters\n");
     return Gain;
 }
 
@@ -1225,7 +1225,7 @@
     }else{
         gainRounded = (int)((Gain-50)/100);
     }
-    //LOGV("\tEqualizerSetBandLevel(%d)->(%d)", Gain, gainRounded);
+    //ALOGV("\tEqualizerSetBandLevel(%d)->(%d)", Gain, gainRounded);
 
 
     LVM_ControlParams_t     ActiveParams;              /* Current control Parameters */
@@ -1235,8 +1235,8 @@
     /* Get the current settings */
     LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "EqualizerSetBandLevel")
-    //LOGV("\tEqualizerSetBandLevel Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tEqualizerSetBandLevel just Got -> %d\n",ActiveParams.pEQNB_BandDefinition[band].Gain);
+    //ALOGV("\tEqualizerSetBandLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tEqualizerSetBandLevel just Got -> %d\n",ActiveParams.pEQNB_BandDefinition[band].Gain);
 
     /* Set local EQ parameters */
     BandDef = ActiveParams.pEQNB_BandDefinition;
@@ -1245,7 +1245,7 @@
     /* Activate the initial settings */
     LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "EqualizerSetBandLevel")
-    //LOGV("\tEqualizerSetBandLevel just Set -> %d\n",ActiveParams.pEQNB_BandDefinition[band].Gain);
+    //ALOGV("\tEqualizerSetBandLevel just Set -> %d\n",ActiveParams.pEQNB_BandDefinition[band].Gain);
 
     pContext->pBundledContext->CurPreset = PRESET_CUSTOM;
     return;
@@ -1277,8 +1277,8 @@
     BandDef   = ActiveParams.pEQNB_BandDefinition;
     Frequency = (int32_t)BandDef[band].Frequency*1000;     // Convert to millibels
 
-    //LOGV("\tEqualizerGetCentreFrequency -> %d\n", Frequency );
-    //LOGV("\tEqualizerGetCentreFrequency Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tEqualizerGetCentreFrequency -> %d\n", Frequency );
+    //ALOGV("\tEqualizerGetCentreFrequency Succesfully returned from LVM_GetControlParameters\n");
     return Frequency;
 }
 
@@ -1372,7 +1372,7 @@
 //----------------------------------------------------------------------------
 void EqualizerSetPreset(EffectContext *pContext, int preset){
 
-    //LOGV("\tEqualizerSetPreset(%d)", preset);
+    //ALOGV("\tEqualizerSetPreset(%d)", preset);
     pContext->pBundledContext->CurPreset = preset;
 
     LVM_ControlParams_t     ActiveParams;              /* Current control Parameters */
@@ -1381,7 +1381,7 @@
     /* Get the current settings */
     LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "EqualizerSetPreset")
-    //LOGV("\tEqualizerSetPreset Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tEqualizerSetPreset Succesfully returned from LVM_GetControlParameters\n");
 
     //ActiveParams.pEQNB_BandDefinition = &BandDefs[0];
     for (int i=0; i<FIVEBAND_NUMBANDS; i++)
@@ -1395,7 +1395,7 @@
     LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "EqualizerSetPreset")
 
-    //LOGV("\tEqualizerSetPreset Succesfully called LVM_SetControlParameters\n");
+    //ALOGV("\tEqualizerSetPreset Succesfully called LVM_SetControlParameters\n");
     return;
 }
 
@@ -1415,13 +1415,13 @@
 //
 //-------------------------------------------------------------------------
 const char * EqualizerGetPresetName(int32_t preset){
-    //LOGV("\tEqualizerGetPresetName start(%d)", preset);
+    //ALOGV("\tEqualizerGetPresetName start(%d)", preset);
     if (preset == PRESET_CUSTOM) {
         return "Custom";
     } else {
         return gEqualizerPresets[preset].name;
     }
-    //LOGV("\tEqualizerGetPresetName end(%d)", preset);
+    //ALOGV("\tEqualizerGetPresetName end(%d)", preset);
     return 0;
 }
 
@@ -1441,35 +1441,35 @@
     LVM_ControlParams_t     ActiveParams;              /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus=LVM_SUCCESS;     /* Function call status */
 
-    //LOGV("\tVolumeSetVolumeLevel Level to be set is %d %d\n", level, (LVM_INT16)(level/100));
+    //ALOGV("\tVolumeSetVolumeLevel Level to be set is %d %d\n", level, (LVM_INT16)(level/100));
     /* Get the current settings */
     LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeSetVolumeLevel")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
-    //LOGV("\tVolumeSetVolumeLevel Succesfully returned from LVM_GetControlParameters got: %d\n",
+    //ALOGV("\tVolumeSetVolumeLevel Succesfully returned from LVM_GetControlParameters got: %d\n",
     //ActiveParams.VC_EffectLevel);
 
     /* Volume parameters */
     ActiveParams.VC_EffectLevel  = (LVM_INT16)(level/100);
-    //LOGV("\tVolumeSetVolumeLevel() (-96dB -> 0dB)   -> %d\n", ActiveParams.VC_EffectLevel );
+    //ALOGV("\tVolumeSetVolumeLevel() (-96dB -> 0dB)   -> %d\n", ActiveParams.VC_EffectLevel );
 
     /* Activate the initial settings */
     LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "VolumeSetVolumeLevel")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeSetVolumeLevel Succesfully called LVM_SetControlParameters\n");
+    //ALOGV("\tVolumeSetVolumeLevel Succesfully called LVM_SetControlParameters\n");
 
     /* Get the current settings */
     LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeSetVolumeLevel")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeSetVolumeLevel just set (-96dB -> 0dB)   -> %d\n",ActiveParams.VC_EffectLevel );
+    //ALOGV("\tVolumeSetVolumeLevel just set (-96dB -> 0dB)   -> %d\n",ActiveParams.VC_EffectLevel );
     if(pContext->pBundledContext->firstVolume == LVM_TRUE){
         LvmStatus = LVM_SetVolumeNoSmoothing(pContext->pBundledContext->hInstance, &ActiveParams);
         LVM_ERROR_CHECK(LvmStatus, "LVM_SetVolumeNoSmoothing", "LvmBundle_process")
-        LOGV("\tLVM_VOLUME: Disabling Smoothing for first volume change to remove spikes/clicks");
+        ALOGV("\tLVM_VOLUME: Disabling Smoothing for first volume change to remove spikes/clicks");
         pContext->pBundledContext->firstVolume = LVM_FALSE;
     }
     return 0;
@@ -1487,7 +1487,7 @@
 
 int VolumeGetVolumeLevel(EffectContext *pContext, int16_t *level){
 
-    //LOGV("\tVolumeGetVolumeLevel start");
+    //ALOGV("\tVolumeGetVolumeLevel start");
 
     LVM_ControlParams_t     ActiveParams;                           /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;                /* Function call status */
@@ -1496,11 +1496,11 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeGetVolumeLevel")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeGetVolumeLevel() (-96dB -> 0dB) -> %d\n", ActiveParams.VC_EffectLevel );
-    //LOGV("\tVolumeGetVolumeLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tVolumeGetVolumeLevel() (-96dB -> 0dB) -> %d\n", ActiveParams.VC_EffectLevel );
+    //ALOGV("\tVolumeGetVolumeLevel Succesfully returned from LVM_GetControlParameters\n");
 
     *level = ActiveParams.VC_EffectLevel*100;     // Convert dB to millibels
-    //LOGV("\tVolumeGetVolumeLevel end");
+    //ALOGV("\tVolumeGetVolumeLevel end");
     return 0;
 }    /* end VolumeGetVolumeLevel */
 
@@ -1516,7 +1516,7 @@
 //----------------------------------------------------------------------------
 
 int32_t VolumeSetMute(EffectContext *pContext, uint32_t mute){
-    //LOGV("\tVolumeSetMute start(%d)", mute);
+    //ALOGV("\tVolumeSetMute start(%d)", mute);
 
     pContext->pBundledContext->bMuteEnabled = mute;
 
@@ -1528,8 +1528,8 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeSetMute")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeSetMute Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tVolumeSetMute to %d, level was %d\n", mute, ActiveParams.VC_EffectLevel );
+    //ALOGV("\tVolumeSetMute Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tVolumeSetMute to %d, level was %d\n", mute, ActiveParams.VC_EffectLevel );
 
     /* Set appropriate volume level */
     if(pContext->pBundledContext->bMuteEnabled == LVM_TRUE){
@@ -1544,8 +1544,8 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "VolumeSetMute")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeSetMute Succesfully called LVM_SetControlParameters\n");
-    //LOGV("\tVolumeSetMute end");
+    //ALOGV("\tVolumeSetMute Succesfully called LVM_SetControlParameters\n");
+    //ALOGV("\tVolumeSetMute end");
     return 0;
 }    /* end setMute */
 
@@ -1562,17 +1562,17 @@
 //----------------------------------------------------------------------------
 
 int32_t VolumeGetMute(EffectContext *pContext, uint32_t *mute){
-    //LOGV("\tVolumeGetMute start");
+    //ALOGV("\tVolumeGetMute start");
     if((pContext->pBundledContext->bMuteEnabled == LVM_FALSE)||
        (pContext->pBundledContext->bMuteEnabled == LVM_TRUE)){
         *mute = pContext->pBundledContext->bMuteEnabled;
         return 0;
     }else{
-        LOGV("\tLVM_ERROR : VolumeGetMute read an invalid value from context %d",
+        ALOGV("\tLVM_ERROR : VolumeGetMute read an invalid value from context %d",
               pContext->pBundledContext->bMuteEnabled);
         return -EINVAL;
     }
-    //LOGV("\tVolumeGetMute end");
+    //ALOGV("\tVolumeGetMute end");
 }    /* end getMute */
 
 int16_t VolumeConvertStereoPosition(int16_t position){
@@ -1606,43 +1606,43 @@
     pContext->pBundledContext->positionSaved = position;
     Balance = VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
 
-    //LOGV("\tVolumeSetStereoPosition start pContext->pBundledContext->positionSaved = %d",
+    //ALOGV("\tVolumeSetStereoPosition start pContext->pBundledContext->positionSaved = %d",
     //pContext->pBundledContext->positionSaved);
 
     if(pContext->pBundledContext->bStereoPositionEnabled == LVM_TRUE){
 
-        //LOGV("\tVolumeSetStereoPosition Position to be set is %d %d\n", position, Balance);
+        //ALOGV("\tVolumeSetStereoPosition Position to be set is %d %d\n", position, Balance);
         pContext->pBundledContext->positionSaved = position;
         /* Get the current settings */
         LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
         LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeSetStereoPosition")
         if(LvmStatus != LVM_SUCCESS) return -EINVAL;
-        //LOGV("\tVolumeSetStereoPosition Succesfully returned from LVM_GetControlParameters got:"
+        //ALOGV("\tVolumeSetStereoPosition Succesfully returned from LVM_GetControlParameters got:"
         //     " %d\n", ActiveParams.VC_Balance);
 
         /* Volume parameters */
         ActiveParams.VC_Balance  = Balance;
-        //LOGV("\tVolumeSetStereoPosition() (-96dB -> +96dB)   -> %d\n", ActiveParams.VC_Balance );
+        //ALOGV("\tVolumeSetStereoPosition() (-96dB -> +96dB)   -> %d\n", ActiveParams.VC_Balance );
 
         /* Activate the initial settings */
         LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
         LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "VolumeSetStereoPosition")
         if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-        //LOGV("\tVolumeSetStereoPosition Succesfully called LVM_SetControlParameters\n");
+        //ALOGV("\tVolumeSetStereoPosition Succesfully called LVM_SetControlParameters\n");
 
         /* Get the current settings */
         LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
         LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeSetStereoPosition")
         if(LvmStatus != LVM_SUCCESS) return -EINVAL;
-        //LOGV("\tVolumeSetStereoPosition Succesfully returned from LVM_GetControlParameters got: "
+        //ALOGV("\tVolumeSetStereoPosition Succesfully returned from LVM_GetControlParameters got: "
         //     "%d\n", ActiveParams.VC_Balance);
     }
     else{
-        //LOGV("\tVolumeSetStereoPosition Position attempting to set, but not enabled %d %d\n",
+        //ALOGV("\tVolumeSetStereoPosition Position attempting to set, but not enabled %d %d\n",
         //position, Balance);
     }
-    //LOGV("\tVolumeSetStereoPosition end pContext->pBundledContext->positionSaved = %d\n",
+    //ALOGV("\tVolumeSetStereoPosition end pContext->pBundledContext->positionSaved = %d\n",
     //pContext->pBundledContext->positionSaved);
     return 0;
 }    /* end VolumeSetStereoPosition */
@@ -1661,21 +1661,21 @@
 //----------------------------------------------------------------------------
 
 int32_t VolumeGetStereoPosition(EffectContext *pContext, int16_t *position){
-    //LOGV("\tVolumeGetStereoPosition start");
+    //ALOGV("\tVolumeGetStereoPosition start");
 
     LVM_ControlParams_t     ActiveParams;                           /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;                /* Function call status */
     LVM_INT16               balance;
 
-    //LOGV("\tVolumeGetStereoPosition start pContext->pBundledContext->positionSaved = %d",
+    //ALOGV("\tVolumeGetStereoPosition start pContext->pBundledContext->positionSaved = %d",
     //pContext->pBundledContext->positionSaved);
 
     LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeGetStereoPosition")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeGetStereoPosition -> %d\n", ActiveParams.VC_Balance);
-    //LOGV("\tVolumeGetStereoPosition Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tVolumeGetStereoPosition -> %d\n", ActiveParams.VC_Balance);
+    //ALOGV("\tVolumeGetStereoPosition Succesfully returned from LVM_GetControlParameters\n");
 
     balance = VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
 
@@ -1685,7 +1685,7 @@
         }
     }
     *position = (LVM_INT16)pContext->pBundledContext->positionSaved;     // Convert dB to millibels
-    //LOGV("\tVolumeGetStereoPosition end returning pContext->pBundledContext->positionSaved =%d\n",
+    //ALOGV("\tVolumeGetStereoPosition end returning pContext->pBundledContext->positionSaved =%d\n",
     //pContext->pBundledContext->positionSaved);
     return 0;
 }    /* end VolumeGetStereoPosition */
@@ -1702,7 +1702,7 @@
 //----------------------------------------------------------------------------
 
 int32_t VolumeEnableStereoPosition(EffectContext *pContext, uint32_t enabled){
-    //LOGV("\tVolumeEnableStereoPosition start()");
+    //ALOGV("\tVolumeEnableStereoPosition start()");
 
     pContext->pBundledContext->bStereoPositionEnabled = enabled;
 
@@ -1714,8 +1714,8 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeEnableStereoPosition")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeEnableStereoPosition Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tVolumeEnableStereoPosition to %d, position was %d\n",
+    //ALOGV("\tVolumeEnableStereoPosition Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tVolumeEnableStereoPosition to %d, position was %d\n",
     //     enabled, ActiveParams.VC_Balance );
 
     /* Set appropriate stereo position */
@@ -1731,8 +1731,8 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "VolumeEnableStereoPosition")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeEnableStereoPosition Succesfully called LVM_SetControlParameters\n");
-    //LOGV("\tVolumeEnableStereoPosition end()\n");
+    //ALOGV("\tVolumeEnableStereoPosition Succesfully called LVM_SetControlParameters\n");
+    //ALOGV("\tVolumeEnableStereoPosition end()\n");
     return 0;
 }    /* end VolumeEnableStereoPosition */
 
@@ -1767,26 +1767,26 @@
     int32_t param2;
     char *name;
 
-    //LOGV("\tBassBoost_getParameter start");
+    //ALOGV("\tBassBoost_getParameter start");
 
     switch (param){
         case BASSBOOST_PARAM_STRENGTH_SUPPORTED:
             if (*pValueSize != sizeof(uint32_t)){
-                LOGV("\tLVM_ERROR : BassBoost_getParameter() invalid pValueSize1 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : BassBoost_getParameter() invalid pValueSize1 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(uint32_t);
             break;
         case BASSBOOST_PARAM_STRENGTH:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : BassBoost_getParameter() invalid pValueSize2 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : BassBoost_getParameter() invalid pValueSize2 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
 
         default:
-            LOGV("\tLVM_ERROR : BassBoost_getParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : BassBoost_getParameter() invalid param %d", param);
             return -EINVAL;
     }
 
@@ -1794,24 +1794,24 @@
         case BASSBOOST_PARAM_STRENGTH_SUPPORTED:
             *(uint32_t *)pValue = 1;
 
-            //LOGV("\tBassBoost_getParameter() BASSBOOST_PARAM_STRENGTH_SUPPORTED Value is %d",
+            //ALOGV("\tBassBoost_getParameter() BASSBOOST_PARAM_STRENGTH_SUPPORTED Value is %d",
             //        *(uint32_t *)pValue);
             break;
 
         case BASSBOOST_PARAM_STRENGTH:
             *(int16_t *)pValue = BassGetStrength(pContext);
 
-            //LOGV("\tBassBoost_getParameter() BASSBOOST_PARAM_STRENGTH Value is %d",
+            //ALOGV("\tBassBoost_getParameter() BASSBOOST_PARAM_STRENGTH Value is %d",
             //        *(int16_t *)pValue);
             break;
 
         default:
-            LOGV("\tLVM_ERROR : BassBoost_getParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : BassBoost_getParameter() invalid param %d", param);
             status = -EINVAL;
             break;
     }
 
-    //LOGV("\tBassBoost_getParameter end");
+    //ALOGV("\tBassBoost_getParameter end");
     return status;
 } /* end BassBoost_getParameter */
 
@@ -1835,22 +1835,22 @@
     int16_t strength;
     int32_t *pParamTemp = (int32_t *)pParam;
 
-    //LOGV("\tBassBoost_setParameter start");
+    //ALOGV("\tBassBoost_setParameter start");
 
     switch (*pParamTemp){
         case BASSBOOST_PARAM_STRENGTH:
             strength = *(int16_t *)pValue;
-            //LOGV("\tBassBoost_setParameter() BASSBOOST_PARAM_STRENGTH value is %d", strength);
-            //LOGV("\tBassBoost_setParameter() Calling pBassBoost->BassSetStrength");
+            //ALOGV("\tBassBoost_setParameter() BASSBOOST_PARAM_STRENGTH value is %d", strength);
+            //ALOGV("\tBassBoost_setParameter() Calling pBassBoost->BassSetStrength");
             BassSetStrength(pContext, (int32_t)strength);
-            //LOGV("\tBassBoost_setParameter() Called pBassBoost->BassSetStrength");
+            //ALOGV("\tBassBoost_setParameter() Called pBassBoost->BassSetStrength");
            break;
         default:
-            LOGV("\tLVM_ERROR : BassBoost_setParameter() invalid param %d", *pParamTemp);
+            ALOGV("\tLVM_ERROR : BassBoost_setParameter() invalid param %d", *pParamTemp);
             break;
     }
 
-    //LOGV("\tBassBoost_setParameter end");
+    //ALOGV("\tBassBoost_setParameter end");
     return status;
 } /* end BassBoost_setParameter */
 
@@ -1885,26 +1885,26 @@
     int32_t param2;
     char *name;
 
-    //LOGV("\tVirtualizer_getParameter start");
+    //ALOGV("\tVirtualizer_getParameter start");
 
     switch (param){
         case VIRTUALIZER_PARAM_STRENGTH_SUPPORTED:
             if (*pValueSize != sizeof(uint32_t)){
-                LOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid pValueSize %d",*pValueSize);
+                ALOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid pValueSize %d",*pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(uint32_t);
             break;
         case VIRTUALIZER_PARAM_STRENGTH:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid pValueSize2 %d",*pValueSize);
+                ALOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid pValueSize2 %d",*pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid param %d", param);
             return -EINVAL;
     }
 
@@ -1912,24 +1912,24 @@
         case VIRTUALIZER_PARAM_STRENGTH_SUPPORTED:
             *(uint32_t *)pValue = 1;
 
-            //LOGV("\tVirtualizer_getParameter() VIRTUALIZER_PARAM_STRENGTH_SUPPORTED Value is %d",
+            //ALOGV("\tVirtualizer_getParameter() VIRTUALIZER_PARAM_STRENGTH_SUPPORTED Value is %d",
             //        *(uint32_t *)pValue);
             break;
 
         case VIRTUALIZER_PARAM_STRENGTH:
             *(int16_t *)pValue = VirtualizerGetStrength(pContext);
 
-            //LOGV("\tVirtualizer_getParameter() VIRTUALIZER_PARAM_STRENGTH Value is %d",
+            //ALOGV("\tVirtualizer_getParameter() VIRTUALIZER_PARAM_STRENGTH Value is %d",
             //        *(int16_t *)pValue);
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid param %d", param);
             status = -EINVAL;
             break;
     }
 
-    //LOGV("\tVirtualizer_getParameter end");
+    //ALOGV("\tVirtualizer_getParameter end");
     return status;
 } /* end Virtualizer_getParameter */
 
@@ -1954,22 +1954,22 @@
     int32_t *pParamTemp = (int32_t *)pParam;
     int32_t param = *pParamTemp++;
 
-    //LOGV("\tVirtualizer_setParameter start");
+    //ALOGV("\tVirtualizer_setParameter start");
 
     switch (param){
         case VIRTUALIZER_PARAM_STRENGTH:
             strength = *(int16_t *)pValue;
-            //LOGV("\tVirtualizer_setParameter() VIRTUALIZER_PARAM_STRENGTH value is %d", strength);
-            //LOGV("\tVirtualizer_setParameter() Calling pVirtualizer->setStrength");
+            //ALOGV("\tVirtualizer_setParameter() VIRTUALIZER_PARAM_STRENGTH value is %d", strength);
+            //ALOGV("\tVirtualizer_setParameter() Calling pVirtualizer->setStrength");
             VirtualizerSetStrength(pContext, (int32_t)strength);
-            //LOGV("\tVirtualizer_setParameter() Called pVirtualizer->setStrength");
+            //ALOGV("\tVirtualizer_setParameter() Called pVirtualizer->setStrength");
            break;
         default:
-            LOGV("\tLVM_ERROR : Virtualizer_setParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Virtualizer_setParameter() invalid param %d", param);
             break;
     }
 
-    //LOGV("\tVirtualizer_setParameter end");
+    //ALOGV("\tVirtualizer_setParameter end");
     return status;
 } /* end Virtualizer_setParameter */
 
@@ -2004,7 +2004,7 @@
     int32_t param2;
     char *name;
 
-    //LOGV("\tEqualizer_getParameter start");
+    //ALOGV("\tEqualizer_getParameter start");
 
     switch (param) {
     case EQ_PARAM_NUM_BANDS:
@@ -2013,7 +2013,7 @@
     case EQ_PARAM_BAND_LEVEL:
     case EQ_PARAM_GET_BAND:
         if (*pValueSize < sizeof(int16_t)) {
-            LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 1  %d", *pValueSize);
+            ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 1  %d", *pValueSize);
             return -EINVAL;
         }
         *pValueSize = sizeof(int16_t);
@@ -2021,14 +2021,14 @@
 
     case EQ_PARAM_LEVEL_RANGE:
         if (*pValueSize < 2 * sizeof(int16_t)) {
-            LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 2  %d", *pValueSize);
+            ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 2  %d", *pValueSize);
             return -EINVAL;
         }
         *pValueSize = 2 * sizeof(int16_t);
         break;
     case EQ_PARAM_BAND_FREQ_RANGE:
         if (*pValueSize < 2 * sizeof(int32_t)) {
-            LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 3  %d", *pValueSize);
+            ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 3  %d", *pValueSize);
             return -EINVAL;
         }
         *pValueSize = 2 * sizeof(int32_t);
@@ -2036,7 +2036,7 @@
 
     case EQ_PARAM_CENTER_FREQ:
         if (*pValueSize < sizeof(int32_t)) {
-            LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 5  %d", *pValueSize);
+            ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 5  %d", *pValueSize);
             return -EINVAL;
         }
         *pValueSize = sizeof(int32_t);
@@ -2047,27 +2047,27 @@
 
     case EQ_PARAM_PROPERTIES:
         if (*pValueSize < (2 + FIVEBAND_NUMBANDS) * sizeof(uint16_t)) {
-            LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 1  %d", *pValueSize);
+            ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 1  %d", *pValueSize);
             return -EINVAL;
         }
         *pValueSize = (2 + FIVEBAND_NUMBANDS) * sizeof(uint16_t);
         break;
 
     default:
-        LOGV("\tLVM_ERROR : Equalizer_getParameter unknown param %d", param);
+        ALOGV("\tLVM_ERROR : Equalizer_getParameter unknown param %d", param);
         return -EINVAL;
     }
 
     switch (param) {
     case EQ_PARAM_NUM_BANDS:
         *(uint16_t *)pValue = (uint16_t)FIVEBAND_NUMBANDS;
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_NUM_BANDS %d", *(int16_t *)pValue);
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_NUM_BANDS %d", *(int16_t *)pValue);
         break;
 
     case EQ_PARAM_LEVEL_RANGE:
         *(int16_t *)pValue = -1500;
         *((int16_t *)pValue + 1) = 1500;
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_LEVEL_RANGE min %d, max %d",
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_LEVEL_RANGE min %d, max %d",
         //      *(int16_t *)pValue, *((int16_t *)pValue + 1));
         break;
 
@@ -2078,7 +2078,7 @@
             break;
         }
         *(int16_t *)pValue = (int16_t)EqualizerGetBandLevel(pContext, param2);
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_BAND_LEVEL band %d, level %d",
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_BAND_LEVEL band %d, level %d",
         //      param2, *(int32_t *)pValue);
         break;
 
@@ -2089,7 +2089,7 @@
             break;
         }
         *(int32_t *)pValue = EqualizerGetCentreFrequency(pContext, param2);
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_CENTER_FREQ band %d, frequency %d",
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_CENTER_FREQ band %d, frequency %d",
         //      param2, *(int32_t *)pValue);
         break;
 
@@ -2100,25 +2100,25 @@
             break;
         }
         EqualizerGetBandFreqRange(pContext, param2, (uint32_t *)pValue, ((uint32_t *)pValue + 1));
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_BAND_FREQ_RANGE band %d, min %d, max %d",
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_BAND_FREQ_RANGE band %d, min %d, max %d",
         //      param2, *(int32_t *)pValue, *((int32_t *)pValue + 1));
         break;
 
     case EQ_PARAM_GET_BAND:
         param2 = *pParamTemp;
         *(uint16_t *)pValue = (uint16_t)EqualizerGetBand(pContext, param2);
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_GET_BAND frequency %d, band %d",
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_GET_BAND frequency %d, band %d",
         //      param2, *(uint16_t *)pValue);
         break;
 
     case EQ_PARAM_CUR_PRESET:
         *(uint16_t *)pValue = (uint16_t)EqualizerGetPreset(pContext);
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_CUR_PRESET %d", *(int32_t *)pValue);
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_CUR_PRESET %d", *(int32_t *)pValue);
         break;
 
     case EQ_PARAM_GET_NUM_OF_PRESETS:
         *(uint16_t *)pValue = (uint16_t)EqualizerGetNumPresets();
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_GET_NUM_OF_PRESETS %d", *(int16_t *)pValue);
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_GET_NUM_OF_PRESETS %d", *(int16_t *)pValue);
         break;
 
     case EQ_PARAM_GET_PRESET_NAME:
@@ -2132,13 +2132,13 @@
         strncpy(name, EqualizerGetPresetName(param2), *pValueSize - 1);
         name[*pValueSize - 1] = 0;
         *pValueSize = strlen(name) + 1;
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_GET_PRESET_NAME preset %d, name %s len %d",
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_GET_PRESET_NAME preset %d, name %s len %d",
         //      param2, gEqualizerPresets[param2].name, *pValueSize);
         break;
 
     case EQ_PARAM_PROPERTIES: {
         int16_t *p = (int16_t *)pValue;
-        LOGV("\tEqualizer_getParameter() EQ_PARAM_PROPERTIES");
+        ALOGV("\tEqualizer_getParameter() EQ_PARAM_PROPERTIES");
         p[0] = (int16_t)EqualizerGetPreset(pContext);
         p[1] = (int16_t)FIVEBAND_NUMBANDS;
         for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
@@ -2147,7 +2147,7 @@
     } break;
 
     default:
-        LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid param %d", param);
+        ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid param %d", param);
         status = -EINVAL;
         break;
     }
@@ -2179,12 +2179,12 @@
     int32_t param = *pParamTemp++;
 
 
-    //LOGV("\tEqualizer_setParameter start");
+    //ALOGV("\tEqualizer_setParameter start");
     switch (param) {
     case EQ_PARAM_CUR_PRESET:
         preset = (int32_t)(*(uint16_t *)pValue);
 
-        //LOGV("\tEqualizer_setParameter() EQ_PARAM_CUR_PRESET %d", preset);
+        //ALOGV("\tEqualizer_setParameter() EQ_PARAM_CUR_PRESET %d", preset);
         if ((preset >= EqualizerGetNumPresets())||(preset < 0)) {
             status = -EINVAL;
             break;
@@ -2194,7 +2194,7 @@
     case EQ_PARAM_BAND_LEVEL:
         band =  *pParamTemp;
         level = (int32_t)(*(int16_t *)pValue);
-        //LOGV("\tEqualizer_setParameter() EQ_PARAM_BAND_LEVEL band %d, level %d", band, level);
+        //ALOGV("\tEqualizer_setParameter() EQ_PARAM_BAND_LEVEL band %d, level %d", band, level);
         if (band >= FIVEBAND_NUMBANDS) {
             status = -EINVAL;
             break;
@@ -2202,7 +2202,7 @@
         EqualizerSetBandLevel(pContext, band, level);
         break;
     case EQ_PARAM_PROPERTIES: {
-        //LOGV("\tEqualizer_setParameter() EQ_PARAM_PROPERTIES");
+        //ALOGV("\tEqualizer_setParameter() EQ_PARAM_PROPERTIES");
         int16_t *p = (int16_t *)pValue;
         if ((int)p[0] >= EqualizerGetNumPresets()) {
             status = -EINVAL;
@@ -2221,12 +2221,12 @@
         }
     } break;
     default:
-        LOGV("\tLVM_ERROR : Equalizer_setParameter() invalid param %d", param);
+        ALOGV("\tLVM_ERROR : Equalizer_setParameter() invalid param %d", param);
         status = -EINVAL;
         break;
     }
 
-    //LOGV("\tEqualizer_setParameter end");
+    //ALOGV("\tEqualizer_setParameter end");
     return status;
 } /* end Equalizer_setParameter */
 
@@ -2261,14 +2261,14 @@
     int32_t param = *pParamTemp++;;
     char *name;
 
-    //LOGV("\tVolume_getParameter start");
+    //ALOGV("\tVolume_getParameter start");
 
     switch (param){
         case VOLUME_PARAM_LEVEL:
         case VOLUME_PARAM_MAXLEVEL:
         case VOLUME_PARAM_STEREOPOSITION:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Volume_getParameter() invalid pValueSize 1  %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Volume_getParameter() invalid pValueSize 1  %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
@@ -2277,55 +2277,55 @@
         case VOLUME_PARAM_MUTE:
         case VOLUME_PARAM_ENABLESTEREOPOSITION:
             if (*pValueSize < sizeof(int32_t)){
-                LOGV("\tLVM_ERROR : Volume_getParameter() invalid pValueSize 2  %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Volume_getParameter() invalid pValueSize 2  %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int32_t);
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Volume_getParameter unknown param %d", param);
+            ALOGV("\tLVM_ERROR : Volume_getParameter unknown param %d", param);
             return -EINVAL;
     }
 
     switch (param){
         case VOLUME_PARAM_LEVEL:
             status = VolumeGetVolumeLevel(pContext, (int16_t *)(pValue));
-            //LOGV("\tVolume_getParameter() VOLUME_PARAM_LEVEL Value is %d",
+            //ALOGV("\tVolume_getParameter() VOLUME_PARAM_LEVEL Value is %d",
             //        *(int16_t *)pValue);
             break;
 
         case VOLUME_PARAM_MAXLEVEL:
             *(int16_t *)pValue = 0;
-            //LOGV("\tVolume_getParameter() VOLUME_PARAM_MAXLEVEL Value is %d",
+            //ALOGV("\tVolume_getParameter() VOLUME_PARAM_MAXLEVEL Value is %d",
             //        *(int16_t *)pValue);
             break;
 
         case VOLUME_PARAM_STEREOPOSITION:
             VolumeGetStereoPosition(pContext, (int16_t *)pValue);
-            //LOGV("\tVolume_getParameter() VOLUME_PARAM_STEREOPOSITION Value is %d",
+            //ALOGV("\tVolume_getParameter() VOLUME_PARAM_STEREOPOSITION Value is %d",
             //        *(int16_t *)pValue);
             break;
 
         case VOLUME_PARAM_MUTE:
             status = VolumeGetMute(pContext, (uint32_t *)pValue);
-            LOGV("\tVolume_getParameter() VOLUME_PARAM_MUTE Value is %d",
+            ALOGV("\tVolume_getParameter() VOLUME_PARAM_MUTE Value is %d",
                     *(uint32_t *)pValue);
             break;
 
         case VOLUME_PARAM_ENABLESTEREOPOSITION:
             *(int32_t *)pValue = pContext->pBundledContext->bStereoPositionEnabled;
-            //LOGV("\tVolume_getParameter() VOLUME_PARAM_ENABLESTEREOPOSITION Value is %d",
+            //ALOGV("\tVolume_getParameter() VOLUME_PARAM_ENABLESTEREOPOSITION Value is %d",
             //        *(uint32_t *)pValue);
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Volume_getParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Volume_getParameter() invalid param %d", param);
             status = -EINVAL;
             break;
     }
 
-    //LOGV("\tVolume_getParameter end");
+    //ALOGV("\tVolume_getParameter end");
     return status;
 } /* end Volume_getParameter */
 
@@ -2354,46 +2354,46 @@
     int32_t *pParamTemp = (int32_t *)pParam;
     int32_t param = *pParamTemp++;
 
-    //LOGV("\tVolume_setParameter start");
+    //ALOGV("\tVolume_setParameter start");
 
     switch (param){
         case VOLUME_PARAM_LEVEL:
             level = *(int16_t *)pValue;
-            //LOGV("\tVolume_setParameter() VOLUME_PARAM_LEVEL value is %d", level);
-            //LOGV("\tVolume_setParameter() Calling pVolume->setVolumeLevel");
+            //ALOGV("\tVolume_setParameter() VOLUME_PARAM_LEVEL value is %d", level);
+            //ALOGV("\tVolume_setParameter() Calling pVolume->setVolumeLevel");
             status = VolumeSetVolumeLevel(pContext, (int16_t)level);
-            //LOGV("\tVolume_setParameter() Called pVolume->setVolumeLevel");
+            //ALOGV("\tVolume_setParameter() Called pVolume->setVolumeLevel");
             break;
 
         case VOLUME_PARAM_MUTE:
             mute = *(uint32_t *)pValue;
-            //LOGV("\tVolume_setParameter() Calling pVolume->setMute, mute is %d", mute);
-            //LOGV("\tVolume_setParameter() Calling pVolume->setMute");
+            //ALOGV("\tVolume_setParameter() Calling pVolume->setMute, mute is %d", mute);
+            //ALOGV("\tVolume_setParameter() Calling pVolume->setMute");
             status = VolumeSetMute(pContext, mute);
-            //LOGV("\tVolume_setParameter() Called pVolume->setMute");
+            //ALOGV("\tVolume_setParameter() Called pVolume->setMute");
             break;
 
         case VOLUME_PARAM_ENABLESTEREOPOSITION:
             positionEnabled = *(uint32_t *)pValue;
             status = VolumeEnableStereoPosition(pContext, positionEnabled);
             status = VolumeSetStereoPosition(pContext, pContext->pBundledContext->positionSaved);
-            //LOGV("\tVolume_setParameter() VOLUME_PARAM_ENABLESTEREOPOSITION called");
+            //ALOGV("\tVolume_setParameter() VOLUME_PARAM_ENABLESTEREOPOSITION called");
             break;
 
         case VOLUME_PARAM_STEREOPOSITION:
             position = *(int16_t *)pValue;
-            //LOGV("\tVolume_setParameter() VOLUME_PARAM_STEREOPOSITION value is %d", position);
-            //LOGV("\tVolume_setParameter() Calling pVolume->VolumeSetStereoPosition");
+            //ALOGV("\tVolume_setParameter() VOLUME_PARAM_STEREOPOSITION value is %d", position);
+            //ALOGV("\tVolume_setParameter() Calling pVolume->VolumeSetStereoPosition");
             status = VolumeSetStereoPosition(pContext, (int16_t)position);
-            //LOGV("\tVolume_setParameter() Called pVolume->VolumeSetStereoPosition");
+            //ALOGV("\tVolume_setParameter() Called pVolume->VolumeSetStereoPosition");
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Volume_setParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Volume_setParameter() invalid param %d", param);
             break;
     }
 
-    //LOGV("\tVolume_setParameter end");
+    //ALOGV("\tVolume_setParameter end");
     return status;
 } /* end Volume_setParameter */
 
@@ -2459,7 +2459,7 @@
 
 int Effect_setEnabled(EffectContext *pContext, bool enabled)
 {
-    LOGV("\tEffect_setEnabled() type %d, enabled %d", pContext->EffectType, enabled);
+    ALOGV("\tEffect_setEnabled() type %d, enabled %d", pContext->EffectType, enabled);
 
     if (enabled) {
         // Bass boost or Virtualizer can be temporarily disabled if playing over device speaker due
@@ -2468,7 +2468,7 @@
         switch (pContext->EffectType) {
             case LVM_BASS_BOOST:
                 if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
-                     LOGV("\tEffect_setEnabled() LVM_BASS_BOOST is already enabled");
+                     ALOGV("\tEffect_setEnabled() LVM_BASS_BOOST is already enabled");
                      return -EINVAL;
                 }
                 if(pContext->pBundledContext->SamplesToExitCountBb <= 0){
@@ -2481,7 +2481,7 @@
                 break;
             case LVM_EQUALIZER:
                 if (pContext->pBundledContext->bEqualizerEnabled == LVM_TRUE) {
-                    LOGV("\tEffect_setEnabled() LVM_EQUALIZER is already enabled");
+                    ALOGV("\tEffect_setEnabled() LVM_EQUALIZER is already enabled");
                     return -EINVAL;
                 }
                 if(pContext->pBundledContext->SamplesToExitCountEq <= 0){
@@ -2493,7 +2493,7 @@
                 break;
             case LVM_VIRTUALIZER:
                 if (pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE) {
-                    LOGV("\tEffect_setEnabled() LVM_VIRTUALIZER is already enabled");
+                    ALOGV("\tEffect_setEnabled() LVM_VIRTUALIZER is already enabled");
                     return -EINVAL;
                 }
                 if(pContext->pBundledContext->SamplesToExitCountVirt <= 0){
@@ -2506,14 +2506,14 @@
                 break;
             case LVM_VOLUME:
                 if (pContext->pBundledContext->bVolumeEnabled == LVM_TRUE) {
-                    LOGV("\tEffect_setEnabled() LVM_VOLUME is already enabled");
+                    ALOGV("\tEffect_setEnabled() LVM_VOLUME is already enabled");
                     return -EINVAL;
                 }
                 pContext->pBundledContext->NumberEffectsEnabled++;
                 pContext->pBundledContext->bVolumeEnabled = LVM_TRUE;
                 break;
             default:
-                LOGV("\tEffect_setEnabled() invalid effect type");
+                ALOGV("\tEffect_setEnabled() invalid effect type");
                 return -EINVAL;
         }
         if (!tempDisabled) {
@@ -2523,34 +2523,34 @@
         switch (pContext->EffectType) {
             case LVM_BASS_BOOST:
                 if (pContext->pBundledContext->bBassEnabled == LVM_FALSE) {
-                    LOGV("\tEffect_setEnabled() LVM_BASS_BOOST is already disabled");
+                    ALOGV("\tEffect_setEnabled() LVM_BASS_BOOST is already disabled");
                     return -EINVAL;
                 }
                 pContext->pBundledContext->bBassEnabled = LVM_FALSE;
                 break;
             case LVM_EQUALIZER:
                 if (pContext->pBundledContext->bEqualizerEnabled == LVM_FALSE) {
-                    LOGV("\tEffect_setEnabled() LVM_EQUALIZER is already disabled");
+                    ALOGV("\tEffect_setEnabled() LVM_EQUALIZER is already disabled");
                     return -EINVAL;
                 }
                 pContext->pBundledContext->bEqualizerEnabled = LVM_FALSE;
                 break;
             case LVM_VIRTUALIZER:
                 if (pContext->pBundledContext->bVirtualizerEnabled == LVM_FALSE) {
-                    LOGV("\tEffect_setEnabled() LVM_VIRTUALIZER is already disabled");
+                    ALOGV("\tEffect_setEnabled() LVM_VIRTUALIZER is already disabled");
                     return -EINVAL;
                 }
                 pContext->pBundledContext->bVirtualizerEnabled = LVM_FALSE;
                 break;
             case LVM_VOLUME:
                 if (pContext->pBundledContext->bVolumeEnabled == LVM_FALSE) {
-                    LOGV("\tEffect_setEnabled() LVM_VOLUME is already disabled");
+                    ALOGV("\tEffect_setEnabled() LVM_VOLUME is already disabled");
                     return -EINVAL;
                 }
                 pContext->pBundledContext->bVolumeEnabled = LVM_FALSE;
                 break;
             default:
-                LOGV("\tEffect_setEnabled() invalid effect type");
+                ALOGV("\tEffect_setEnabled() invalid effect type");
                 return -EINVAL;
         }
         LvmEffect_disable(pContext);
@@ -2595,77 +2595,77 @@
     LVM_INT16   *in  = (LVM_INT16 *)inBuffer->raw;
     LVM_INT16   *out = (LVM_INT16 *)outBuffer->raw;
 
-//LOGV("\tEffect_process Start : Enabled = %d     Called = %d (%8d %8d %8d)",
+//ALOGV("\tEffect_process Start : Enabled = %d     Called = %d (%8d %8d %8d)",
 //pContext->pBundledContext->NumberEffectsEnabled,pContext->pBundledContext->NumberEffectsCalled,
 //    pContext->pBundledContext->SamplesToExitCountBb,
 //    pContext->pBundledContext->SamplesToExitCountVirt,
 //    pContext->pBundledContext->SamplesToExitCountEq);
 
     if (pContext == NULL){
-        LOGV("\tLVM_ERROR : Effect_process() ERROR pContext == NULL");
+        ALOGV("\tLVM_ERROR : Effect_process() ERROR pContext == NULL");
         return -EINVAL;
     }
 
     //if(pContext->EffectType == LVM_BASS_BOOST){
-    //  LOGV("\tEffect_process: Effect type is BASS_BOOST");
+    //  ALOGV("\tEffect_process: Effect type is BASS_BOOST");
     //}else if(pContext->EffectType == LVM_EQUALIZER){
-    //  LOGV("\tEffect_process: Effect type is LVM_EQUALIZER");
+    //  ALOGV("\tEffect_process: Effect type is LVM_EQUALIZER");
     //}else if(pContext->EffectType == LVM_VIRTUALIZER){
-    //  LOGV("\tEffect_process: Effect type is LVM_VIRTUALIZER");
+    //  ALOGV("\tEffect_process: Effect type is LVM_VIRTUALIZER");
     //}
 
     if (inBuffer == NULL  || inBuffer->raw == NULL  ||
             outBuffer == NULL || outBuffer->raw == NULL ||
             inBuffer->frameCount != outBuffer->frameCount){
-        LOGV("\tLVM_ERROR : Effect_process() ERROR NULL INPUT POINTER OR FRAME COUNT IS WRONG");
+        ALOGV("\tLVM_ERROR : Effect_process() ERROR NULL INPUT POINTER OR FRAME COUNT IS WRONG");
         return -EINVAL;
     }
     if ((pContext->pBundledContext->bBassEnabled == LVM_FALSE)&&
         (pContext->EffectType == LVM_BASS_BOOST)){
-        //LOGV("\tEffect_process() LVM_BASS_BOOST Effect is not enabled");
+        //ALOGV("\tEffect_process() LVM_BASS_BOOST Effect is not enabled");
         if(pContext->pBundledContext->SamplesToExitCountBb > 0){
             pContext->pBundledContext->SamplesToExitCountBb -= outBuffer->frameCount * 2; // STEREO
-            //LOGV("\tEffect_process: Waiting to turn off BASS_BOOST, %d samples left",
+            //ALOGV("\tEffect_process: Waiting to turn off BASS_BOOST, %d samples left",
             //    pContext->pBundledContext->SamplesToExitCountBb);
         }
         if(pContext->pBundledContext->SamplesToExitCountBb <= 0) {
             status = -ENODATA;
             pContext->pBundledContext->NumberEffectsEnabled--;
-            LOGV("\tEffect_process() this is the last frame for LVM_BASS_BOOST");
+            ALOGV("\tEffect_process() this is the last frame for LVM_BASS_BOOST");
         }
     }
     if ((pContext->pBundledContext->bVolumeEnabled == LVM_FALSE)&&
         (pContext->EffectType == LVM_VOLUME)){
-        //LOGV("\tEffect_process() LVM_VOLUME Effect is not enabled");
+        //ALOGV("\tEffect_process() LVM_VOLUME Effect is not enabled");
         status = -ENODATA;
         pContext->pBundledContext->NumberEffectsEnabled--;
     }
     if ((pContext->pBundledContext->bEqualizerEnabled == LVM_FALSE)&&
         (pContext->EffectType == LVM_EQUALIZER)){
-        //LOGV("\tEffect_process() LVM_EQUALIZER Effect is not enabled");
+        //ALOGV("\tEffect_process() LVM_EQUALIZER Effect is not enabled");
         if(pContext->pBundledContext->SamplesToExitCountEq > 0){
             pContext->pBundledContext->SamplesToExitCountEq -= outBuffer->frameCount * 2; // STEREO
-            //LOGV("\tEffect_process: Waiting to turn off EQUALIZER, %d samples left",
+            //ALOGV("\tEffect_process: Waiting to turn off EQUALIZER, %d samples left",
             //    pContext->pBundledContext->SamplesToExitCountEq);
         }
         if(pContext->pBundledContext->SamplesToExitCountEq <= 0) {
             status = -ENODATA;
             pContext->pBundledContext->NumberEffectsEnabled--;
-            LOGV("\tEffect_process() this is the last frame for LVM_EQUALIZER");
+            ALOGV("\tEffect_process() this is the last frame for LVM_EQUALIZER");
         }
     }
     if ((pContext->pBundledContext->bVirtualizerEnabled == LVM_FALSE)&&
         (pContext->EffectType == LVM_VIRTUALIZER)){
-        //LOGV("\tEffect_process() LVM_VIRTUALIZER Effect is not enabled");
+        //ALOGV("\tEffect_process() LVM_VIRTUALIZER Effect is not enabled");
         if(pContext->pBundledContext->SamplesToExitCountVirt > 0){
             pContext->pBundledContext->SamplesToExitCountVirt -= outBuffer->frameCount * 2;// STEREO
-            //LOGV("\tEffect_process: Waiting for to turn off VIRTUALIZER, %d samples left",
+            //ALOGV("\tEffect_process: Waiting for to turn off VIRTUALIZER, %d samples left",
             //    pContext->pBundledContext->SamplesToExitCountVirt);
         }
         if(pContext->pBundledContext->SamplesToExitCountVirt <= 0) {
             status = -ENODATA;
             pContext->pBundledContext->NumberEffectsEnabled--;
-            LOGV("\tEffect_process() this is the last frame for LVM_VIRTUALIZER");
+            ALOGV("\tEffect_process() this is the last frame for LVM_VIRTUALIZER");
         }
     }
 
@@ -2675,12 +2675,12 @@
 
     if(pContext->pBundledContext->NumberEffectsCalled ==
        pContext->pBundledContext->NumberEffectsEnabled){
-        //LOGV("\tEffect_process     Calling process with %d effects enabled, %d called: Effect %d",
+        //ALOGV("\tEffect_process     Calling process with %d effects enabled, %d called: Effect %d",
         //pContext->pBundledContext->NumberEffectsEnabled,
         //pContext->pBundledContext->NumberEffectsCalled, pContext->EffectType);
 
         if(status == -ENODATA){
-            LOGV("\tEffect_process() processing last frame");
+            ALOGV("\tEffect_process() processing last frame");
         }
         pContext->pBundledContext->NumberEffectsCalled = 0;
         /* Process all the available frames, block processing is
@@ -2690,11 +2690,11 @@
                                                 outBuffer->frameCount,
                                                 pContext);
         if(lvmStatus != LVM_SUCCESS){
-            LOGV("\tLVM_ERROR : LvmBundle_process returned error %d", lvmStatus);
+            ALOGV("\tLVM_ERROR : LvmBundle_process returned error %d", lvmStatus);
             return lvmStatus;
         }
     } else {
-        //LOGV("\tEffect_process Not Calling process with %d effects enabled, %d called: Effect %d",
+        //ALOGV("\tEffect_process Not Calling process with %d effects enabled, %d called: Effect %d",
         //pContext->pBundledContext->NumberEffectsEnabled,
         //pContext->pBundledContext->NumberEffectsCalled, pContext->EffectType);
         // 2 is for stereo input
@@ -2721,92 +2721,92 @@
     EffectContext * pContext = (EffectContext *) self;
     int retsize;
 
-    //LOGV("\t\nEffect_command start");
+    //ALOGV("\t\nEffect_command start");
 
     if(pContext->EffectType == LVM_BASS_BOOST){
-        //LOGV("\tEffect_command setting command for LVM_BASS_BOOST");
+        //ALOGV("\tEffect_command setting command for LVM_BASS_BOOST");
     }
     if(pContext->EffectType == LVM_VIRTUALIZER){
-        //LOGV("\tEffect_command setting command for LVM_VIRTUALIZER");
+        //ALOGV("\tEffect_command setting command for LVM_VIRTUALIZER");
     }
     if(pContext->EffectType == LVM_EQUALIZER){
-        //LOGV("\tEffect_command setting command for LVM_EQUALIZER");
+        //ALOGV("\tEffect_command setting command for LVM_EQUALIZER");
     }
     if(pContext->EffectType == LVM_VOLUME){
-        //LOGV("\tEffect_command setting command for LVM_VOLUME");
+        //ALOGV("\tEffect_command setting command for LVM_VOLUME");
     }
 
     if (pContext == NULL){
-        LOGV("\tLVM_ERROR : Effect_command ERROR pContext == NULL");
+        ALOGV("\tLVM_ERROR : Effect_command ERROR pContext == NULL");
         return -EINVAL;
     }
 
-    //LOGV("\tEffect_command INPUTS are: command %d cmdSize %d",cmdCode, cmdSize);
+    //ALOGV("\tEffect_command INPUTS are: command %d cmdSize %d",cmdCode, cmdSize);
 
     // Incase we disable an effect, next time process is
     // called the number of effect called could be greater
     // pContext->pBundledContext->NumberEffectsCalled = 0;
 
-    //LOGV("\tEffect_command NumberEffectsCalled = %d, NumberEffectsEnabled = %d",
+    //ALOGV("\tEffect_command NumberEffectsCalled = %d, NumberEffectsEnabled = %d",
     //        pContext->pBundledContext->NumberEffectsCalled,
     //        pContext->pBundledContext->NumberEffectsEnabled);
 
     switch (cmdCode){
         case EFFECT_CMD_INIT:
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("\tLVM_ERROR, EFFECT_CMD_INIT: ERROR for effect type %d",
+                ALOGV("\tLVM_ERROR, EFFECT_CMD_INIT: ERROR for effect type %d",
                         pContext->EffectType);
                 return -EINVAL;
             }
             *(int *) pReplyData = 0;
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT start");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT start");
             if(pContext->EffectType == LVM_BASS_BOOST){
-                //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_BASS_BOOST");
+                //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_BASS_BOOST");
                 android::BassSetStrength(pContext, 0);
             }
             if(pContext->EffectType == LVM_VIRTUALIZER){
-                //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_VIRTUALIZER");
+                //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_VIRTUALIZER");
                 android::VirtualizerSetStrength(pContext, 0);
             }
             if(pContext->EffectType == LVM_EQUALIZER){
-                //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_EQUALIZER");
+                //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_EQUALIZER");
                 android::EqualizerSetPreset(pContext, 0);
             }
             if(pContext->EffectType == LVM_VOLUME){
-                //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_VOLUME");
+                //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_VOLUME");
                 *(int *) pReplyData = android::VolumeSetVolumeLevel(pContext, 0);
             }
             break;
 
         case EFFECT_CMD_CONFIGURE:
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_CONFIGURE start");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_CONFIGURE start");
             if (pCmdData    == NULL||
                 cmdSize     != sizeof(effect_config_t)||
                 pReplyData  == NULL||
                 *replySize  != sizeof(int)){
-                LOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
                         "EFFECT_CMD_CONFIGURE: ERROR");
                 return -EINVAL;
             }
             *(int *) pReplyData = android::Effect_configure(pContext, (effect_config_t *) pCmdData);
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_CONFIGURE end");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_CONFIGURE end");
             break;
 
         case EFFECT_CMD_RESET:
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_RESET start");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_RESET start");
             android::Effect_configure(pContext, &pContext->config);
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_RESET end");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_RESET end");
             break;
 
         case EFFECT_CMD_GET_PARAM:{
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
 
             if(pContext->EffectType == LVM_BASS_BOOST){
                 if (pCmdData == NULL ||
                         cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
                         pReplyData == NULL ||
                         *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
-                    LOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
                             "EFFECT_CMD_GET_PARAM: ERROR");
                     return -EINVAL;
                 }
@@ -2825,7 +2825,7 @@
 
                 *replySize = sizeof(effect_param_t) + voffset + p->vsize;
 
-                //LOGV("\tBassBoost_command EFFECT_CMD_GET_PARAM "
+                //ALOGV("\tBassBoost_command EFFECT_CMD_GET_PARAM "
                 //        "*pCmdData %d, *replySize %d, *pReplyData %d ",
                 //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
                 //        *replySize,
@@ -2837,7 +2837,7 @@
                         cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
                         pReplyData == NULL ||
                         *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
-                    LOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
                             "EFFECT_CMD_GET_PARAM: ERROR");
                     return -EINVAL;
                 }
@@ -2856,20 +2856,20 @@
 
                 *replySize = sizeof(effect_param_t) + voffset + p->vsize;
 
-                //LOGV("\tVirtualizer_command EFFECT_CMD_GET_PARAM "
+                //ALOGV("\tVirtualizer_command EFFECT_CMD_GET_PARAM "
                 //        "*pCmdData %d, *replySize %d, *pReplyData %d ",
                 //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
                 //        *replySize,
                 //        *(int16_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset));
             }
             if(pContext->EffectType == LVM_EQUALIZER){
-                //LOGV("\tEqualizer_command cmdCode Case: "
+                //ALOGV("\tEqualizer_command cmdCode Case: "
                 //        "EFFECT_CMD_GET_PARAM start");
                 if (pCmdData == NULL ||
                     cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
                     pReplyData == NULL ||
                     *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))) {
-                    LOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
                             "EFFECT_CMD_GET_PARAM");
                     return -EINVAL;
                 }
@@ -2888,7 +2888,7 @@
 
                 *replySize = sizeof(effect_param_t) + voffset + p->vsize;
 
-                //LOGV("\tEqualizer_command EFFECT_CMD_GET_PARAM *pCmdData %d, *replySize %d, "
+                //ALOGV("\tEqualizer_command EFFECT_CMD_GET_PARAM *pCmdData %d, *replySize %d, "
                 //       "*pReplyData %08x %08x",
                 //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)), *replySize,
                 //        *(int32_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset),
@@ -2896,12 +2896,12 @@
                 //        sizeof(int32_t)));
             }
             if(pContext->EffectType == LVM_VOLUME){
-                //LOGV("\tVolume_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
+                //ALOGV("\tVolume_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
                 if (pCmdData == NULL ||
                         cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
                         pReplyData == NULL ||
                         *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
-                    LOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
                             "EFFECT_CMD_GET_PARAM: ERROR");
                     return -EINVAL;
                 }
@@ -2920,18 +2920,18 @@
 
                 *replySize = sizeof(effect_param_t) + voffset + p->vsize;
 
-                //LOGV("\tVolume_command EFFECT_CMD_GET_PARAM "
+                //ALOGV("\tVolume_command EFFECT_CMD_GET_PARAM "
                 //        "*pCmdData %d, *replySize %d, *pReplyData %d ",
                 //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
                 //        *replySize,
                 //        *(int16_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset));
             }
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM end");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM end");
         } break;
         case EFFECT_CMD_SET_PARAM:{
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_PARAM start");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_PARAM start");
             if(pContext->EffectType == LVM_BASS_BOOST){
-                //LOGV("\tBassBoost_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d",
+                //ALOGV("\tBassBoost_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d",
                 //       *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
                 //       *replySize,
                 //       *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
@@ -2940,19 +2940,19 @@
                     cmdSize    != (int)(sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t))||
                     pReplyData == NULL||
                     *replySize != sizeof(int32_t)){
-                    LOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
                             "EFFECT_CMD_SET_PARAM: ERROR");
                     return -EINVAL;
                 }
                 effect_param_t *p = (effect_param_t *) pCmdData;
 
                 if (p->psize != sizeof(int32_t)){
-                    LOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
                             "EFFECT_CMD_SET_PARAM: ERROR, psize is not sizeof(int32_t)");
                     return -EINVAL;
                 }
 
-                //LOGV("\tnBassBoost_command cmdSize is %d\n"
+                //ALOGV("\tnBassBoost_command cmdSize is %d\n"
                 //        "\tsizeof(effect_param_t) is  %d\n"
                 //        "\tp->psize is %d\n"
                 //        "\tp->vsize is %d"
@@ -2964,7 +2964,7 @@
                                                                     p->data + p->psize);
             }
             if(pContext->EffectType == LVM_VIRTUALIZER){
-              //LOGV("\tVirtualizer_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d",
+              //ALOGV("\tVirtualizer_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d",
               //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
               //        *replySize,
               //        *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
@@ -2973,19 +2973,19 @@
                     cmdSize    != (int)(sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t))||
                     pReplyData == NULL||
                     *replySize != sizeof(int32_t)){
-                    LOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
                             "EFFECT_CMD_SET_PARAM: ERROR");
                     return -EINVAL;
                 }
                 effect_param_t *p = (effect_param_t *) pCmdData;
 
                 if (p->psize != sizeof(int32_t)){
-                    LOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
                             "EFFECT_CMD_SET_PARAM: ERROR, psize is not sizeof(int32_t)");
                     return -EINVAL;
                 }
 
-                //LOGV("\tnVirtualizer_command cmdSize is %d\n"
+                //ALOGV("\tnVirtualizer_command cmdSize is %d\n"
                 //        "\tsizeof(effect_param_t) is  %d\n"
                 //        "\tp->psize is %d\n"
                 //        "\tp->vsize is %d"
@@ -2997,16 +2997,16 @@
                                                                        p->data + p->psize);
             }
             if(pContext->EffectType == LVM_EQUALIZER){
-               //LOGV("\tEqualizer_command cmdCode Case: "
+               //ALOGV("\tEqualizer_command cmdCode Case: "
                //        "EFFECT_CMD_SET_PARAM start");
-               //LOGV("\tEqualizer_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
+               //ALOGV("\tEqualizer_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
                //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
                //        *replySize,
                //        *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
 
                 if (pCmdData == NULL || cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
                     pReplyData == NULL || *replySize != sizeof(int32_t)) {
-                    LOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
                             "EFFECT_CMD_SET_PARAM: ERROR");
                     return -EINVAL;
                 }
@@ -3017,8 +3017,8 @@
                                                                      p->data + p->psize);
             }
             if(pContext->EffectType == LVM_VOLUME){
-                //LOGV("\tVolume_command cmdCode Case: EFFECT_CMD_SET_PARAM start");
-                //LOGV("\tVolume_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
+                //ALOGV("\tVolume_command cmdCode Case: EFFECT_CMD_SET_PARAM start");
+                //ALOGV("\tVolume_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
                 //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
                 //        *replySize,
                 //        *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) +sizeof(int32_t)));
@@ -3027,7 +3027,7 @@
                         cmdSize    < (int)(sizeof(effect_param_t) + sizeof(int32_t))||
                         pReplyData == NULL||
                         *replySize != sizeof(int32_t)){
-                    LOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
                             "EFFECT_CMD_SET_PARAM: ERROR");
                     return -EINVAL;
                 }
@@ -3037,13 +3037,13 @@
                                                                  (void *)p->data,
                                                                  p->data + p->psize);
             }
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_PARAM end");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_PARAM end");
         } break;
 
         case EFFECT_CMD_ENABLE:
-            LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_ENABLE start");
+            ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_ENABLE start");
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_ENABLE: ERROR");
+                ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_ENABLE: ERROR");
                 return -EINVAL;
             }
 
@@ -3051,9 +3051,9 @@
             break;
 
         case EFFECT_CMD_DISABLE:
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_DISABLE start");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_DISABLE start");
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_DISABLE: ERROR");
+                ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_DISABLE: ERROR");
                 return -EINVAL;
             }
             *(int *)pReplyData = android::Effect_setEnabled(pContext, LVM_FALSE);
@@ -3061,37 +3061,37 @@
 
         case EFFECT_CMD_SET_DEVICE:
         {
-            LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE start");
+            ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE start");
             uint32_t device = *(uint32_t *)pCmdData;
 
             if (pContext->EffectType == LVM_BASS_BOOST) {
                 if((device == AUDIO_DEVICE_OUT_SPEAKER) ||
                         (device == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT) ||
                         (device == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER)){
-                    LOGV("\tEFFECT_CMD_SET_DEVICE device is invalid for LVM_BASS_BOOST %d",
+                    ALOGV("\tEFFECT_CMD_SET_DEVICE device is invalid for LVM_BASS_BOOST %d",
                           *(int32_t *)pCmdData);
-                    LOGV("\tEFFECT_CMD_SET_DEVICE temporary disable LVM_BAS_BOOST");
+                    ALOGV("\tEFFECT_CMD_SET_DEVICE temporary disable LVM_BAS_BOOST");
 
                     // If a device doesnt support bassboost the effect must be temporarily disabled
                     // the effect must still report its original state as this can only be changed
                     // by the ENABLE/DISABLE command
 
                     if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
-                        LOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_BASS_BOOST %d",
-                             *(int32_t *)pCmdData);
+                        ALOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_BASS_BOOST %d",
+                              *(int32_t *)pCmdData);
                         android::LvmEffect_disable(pContext);
                     }
                     pContext->pBundledContext->bBassTempDisabled = LVM_TRUE;
                 } else {
-                    LOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_BASS_BOOST %d",
-                         *(int32_t *)pCmdData);
+                    ALOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_BASS_BOOST %d",
+                          *(int32_t *)pCmdData);
 
                     // If a device supports bassboost and the effect has been temporarily disabled
                     // previously then re-enable it
 
                     if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
-                        LOGV("\tEFFECT_CMD_SET_DEVICE re-enable LVM_BASS_BOOST %d",
-                             *(int32_t *)pCmdData);
+                        ALOGV("\tEFFECT_CMD_SET_DEVICE re-enable LVM_BASS_BOOST %d",
+                              *(int32_t *)pCmdData);
                         android::LvmEffect_enable(pContext);
                     }
                     pContext->pBundledContext->bBassTempDisabled = LVM_FALSE;
@@ -3101,36 +3101,36 @@
                 if((device == AUDIO_DEVICE_OUT_SPEAKER)||
                         (device == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT)||
                         (device == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER)){
-                    LOGV("\tEFFECT_CMD_SET_DEVICE device is invalid for LVM_VIRTUALIZER %d",
+                    ALOGV("\tEFFECT_CMD_SET_DEVICE device is invalid for LVM_VIRTUALIZER %d",
                           *(int32_t *)pCmdData);
-                    LOGV("\tEFFECT_CMD_SET_DEVICE temporary disable LVM_VIRTUALIZER");
+                    ALOGV("\tEFFECT_CMD_SET_DEVICE temporary disable LVM_VIRTUALIZER");
 
                     //If a device doesnt support virtualizer the effect must be temporarily disabled
                     // the effect must still report its original state as this can only be changed
                     // by the ENABLE/DISABLE command
 
                     if (pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE) {
-                        LOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_VIRTUALIZER %d",
+                        ALOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_VIRTUALIZER %d",
                               *(int32_t *)pCmdData);
                         android::LvmEffect_disable(pContext);
                     }
                     pContext->pBundledContext->bVirtualizerTempDisabled = LVM_TRUE;
                 } else {
-                    LOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_VIRTUALIZER %d",
+                    ALOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_VIRTUALIZER %d",
                           *(int32_t *)pCmdData);
 
                     // If a device supports virtualizer and the effect has been temporarily disabled
                     // previously then re-enable it
 
                     if(pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE){
-                        LOGV("\tEFFECT_CMD_SET_DEVICE re-enable LVM_VIRTUALIZER %d",
+                        ALOGV("\tEFFECT_CMD_SET_DEVICE re-enable LVM_VIRTUALIZER %d",
                               *(int32_t *)pCmdData);
                         android::LvmEffect_enable(pContext);
                     }
                     pContext->pBundledContext->bVirtualizerTempDisabled = LVM_FALSE;
                 }
             }
-            LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE end");
+            ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE end");
             break;
         }
         case EFFECT_CMD_SET_VOLUME:
@@ -3150,7 +3150,7 @@
 
             if (pCmdData == NULL ||
                 cmdSize != 2 * sizeof(uint32_t)) {
-                LOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
                         "EFFECT_CMD_SET_VOLUME: ERROR");
                 return -EINVAL;
             }
@@ -3176,12 +3176,12 @@
             if(rightdB > maxdB){
                 maxdB = rightdB;
             }
-            //LOGV("\tEFFECT_CMD_SET_VOLUME Session: %d, SessionID: %d VOLUME is %d dB (%d), "
+            //ALOGV("\tEFFECT_CMD_SET_VOLUME Session: %d, SessionID: %d VOLUME is %d dB (%d), "
             //      "effect is %d",
             //pContext->pBundledContext->SessionNo, pContext->pBundledContext->SessionId,
             //(int32_t)maxdB, maxVol<<7, pContext->EffectType);
-            //LOGV("\tEFFECT_CMD_SET_VOLUME: Left is %d, Right is %d", leftVolume, rightVolume);
-            //LOGV("\tEFFECT_CMD_SET_VOLUME: Left %ddB, Right %ddB, Position %ddB",
+            //ALOGV("\tEFFECT_CMD_SET_VOLUME: Left is %d, Right is %d", leftVolume, rightVolume);
+            //ALOGV("\tEFFECT_CMD_SET_VOLUME: Left %ddB, Right %ddB, Position %ddB",
             //        leftdB, rightdB, pandB);
 
             memcpy(pReplyData, vol_ret, sizeof(int32_t)*2);
@@ -3194,7 +3194,7 @@
 
             /* Volume parameters */
             ActiveParams.VC_Balance  = pandB;
-            LOGV("\t\tVolumeSetStereoPosition() (-96dB -> +96dB)-> %d\n", ActiveParams.VC_Balance );
+            ALOGV("\t\tVolumeSetStereoPosition() (-96dB -> +96dB)-> %d\n", ActiveParams.VC_Balance );
 
             /* Activate the initial settings */
             LvmStatus =LVM_SetControlParameters(pContext->pBundledContext->hInstance,&ActiveParams);
@@ -3208,7 +3208,7 @@
             return -EINVAL;
     }
 
-    //LOGV("\tEffect_command end...\n\n");
+    //ALOGV("\tEffect_command end...\n\n");
     return 0;
 }    /* end Effect_command */
 
@@ -3220,7 +3220,7 @@
     const effect_descriptor_t *desc;
 
     if (pContext == NULL || pDescriptor == NULL) {
-        LOGV("Effect_getDescriptor() invalid param");
+        ALOGV("Effect_getDescriptor() invalid param");
         return -EINVAL;
     }
 
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 663f8ff..1825aab 100755
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -32,15 +32,15 @@
 
 #define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc){\
         if (LvmStatus == LVREV_NULLADDRESS){\
-            LOGV("\tLVREV_ERROR : Parameter error - "\
+            ALOGV("\tLVREV_ERROR : Parameter error - "\
                     "null pointer returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
         if (LvmStatus == LVREV_INVALIDNUMSAMPLES){\
-            LOGV("\tLVREV_ERROR : Parameter error - "\
+            ALOGV("\tLVREV_ERROR : Parameter error - "\
                     "bad number of samples returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
         if (LvmStatus == LVREV_OUTOFRANGE){\
-            LOGV("\tLVREV_ERROR : Parameter error - "\
+            ALOGV("\tLVREV_ERROR : Parameter error - "\
                     "out of range returned by %s in %s\n", callingFunc, calledFunc);\
         }\
     }
@@ -185,27 +185,27 @@
 
 /* Effect Library Interface Implementation */
 extern "C" int EffectQueryNumberEffects(uint32_t *pNumEffects){
-    LOGV("\n\tEffectQueryNumberEffects start");
+    ALOGV("\n\tEffectQueryNumberEffects start");
     *pNumEffects = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
-    LOGV("\tEffectQueryNumberEffects creating %d effects", *pNumEffects);
-    LOGV("\tEffectQueryNumberEffects end\n");
+    ALOGV("\tEffectQueryNumberEffects creating %d effects", *pNumEffects);
+    ALOGV("\tEffectQueryNumberEffects end\n");
     return 0;
 }     /* end EffectQueryNumberEffects */
 
 extern "C" int EffectQueryEffect(uint32_t index,
                                  effect_descriptor_t *pDescriptor){
-    LOGV("\n\tEffectQueryEffect start");
-    LOGV("\tEffectQueryEffect processing index %d", index);
+    ALOGV("\n\tEffectQueryEffect start");
+    ALOGV("\tEffectQueryEffect processing index %d", index);
     if (pDescriptor == NULL){
-        LOGV("\tLVM_ERROR : EffectQueryEffect was passed NULL pointer");
+        ALOGV("\tLVM_ERROR : EffectQueryEffect was passed NULL pointer");
         return -EINVAL;
     }
     if (index >= sizeof(gDescriptors) / sizeof(const effect_descriptor_t *)) {
-        LOGV("\tLVM_ERROR : EffectQueryEffect index out of range %d", index);
+        ALOGV("\tLVM_ERROR : EffectQueryEffect index out of range %d", index);
         return -ENOENT;
     }
     memcpy(pDescriptor, gDescriptors[index], sizeof(effect_descriptor_t));
-    LOGV("\tEffectQueryEffect end\n");
+    ALOGV("\tEffectQueryEffect end\n");
     return 0;
 }     /* end EffectQueryEffect */
 
@@ -218,10 +218,10 @@
     int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
     const effect_descriptor_t *desc;
 
-    LOGV("\t\nEffectCreate start");
+    ALOGV("\t\nEffectCreate start");
 
     if (pHandle == NULL || uuid == NULL){
-        LOGV("\tLVM_ERROR : EffectCreate() called with NULL pointer");
+        ALOGV("\tLVM_ERROR : EffectCreate() called with NULL pointer");
         return -EINVAL;
     }
 
@@ -229,7 +229,7 @@
         desc = gDescriptors[i];
         if (memcmp(uuid, &desc->uuid, sizeof(effect_uuid_t))
                 == 0) {
-            LOGV("\tEffectCreate - UUID matched Reverb type %d, UUID = %x", i, desc->uuid.timeLow);
+            ALOGV("\tEffectCreate - UUID matched Reverb type %d, UUID = %x", i, desc->uuid.timeLow);
             break;
         }
     }
@@ -246,9 +246,9 @@
     pContext->auxiliary = false;
     if ((desc->flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_AUXILIARY){
         pContext->auxiliary = true;
-        LOGV("\tEffectCreate - AUX");
+        ALOGV("\tEffectCreate - AUX");
     }else{
-        LOGV("\tEffectCreate - INS");
+        ALOGV("\tEffectCreate - INS");
     }
 
     pContext->preset = false;
@@ -257,16 +257,16 @@
         // force reloading preset at first call to process()
         pContext->curPreset = REVERB_PRESET_LAST + 1;
         pContext->nextPreset = REVERB_DEFAULT_PRESET;
-        LOGV("\tEffectCreate - PRESET");
+        ALOGV("\tEffectCreate - PRESET");
     }else{
-        LOGV("\tEffectCreate - ENVIRONMENTAL");
+        ALOGV("\tEffectCreate - ENVIRONMENTAL");
     }
 
-    LOGV("\tEffectCreate - Calling Reverb_init");
+    ALOGV("\tEffectCreate - Calling Reverb_init");
     ret = Reverb_init(pContext);
 
     if (ret < 0){
-        LOGV("\tLVM_ERROR : EffectCreate() init failed");
+        ALOGV("\tLVM_ERROR : EffectCreate() init failed");
         delete pContext;
         return ret;
     }
@@ -291,17 +291,17 @@
     pContext->InFrames32  = (LVM_INT32 *)malloc(LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2);
     pContext->OutFrames32 = (LVM_INT32 *)malloc(LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2);
 
-    LOGV("\tEffectCreate %p, size %d", pContext, sizeof(ReverbContext));
-    LOGV("\tEffectCreate end\n");
+    ALOGV("\tEffectCreate %p, size %d", pContext, sizeof(ReverbContext));
+    ALOGV("\tEffectCreate end\n");
     return 0;
 } /* end EffectCreate */
 
 extern "C" int EffectRelease(effect_handle_t handle){
     ReverbContext * pContext = (ReverbContext *)handle;
 
-    LOGV("\tEffectRelease %p", handle);
+    ALOGV("\tEffectRelease %p", handle);
     if (pContext == NULL){
-        LOGV("\tLVM_ERROR : EffectRelease called with NULL pointer");
+        ALOGV("\tLVM_ERROR : EffectRelease called with NULL pointer");
         return -EINVAL;
     }
 
@@ -322,14 +322,14 @@
     int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
 
     if (pDescriptor == NULL || uuid == NULL){
-        LOGV("EffectGetDescriptor() called with NULL pointer");
+        ALOGV("EffectGetDescriptor() called with NULL pointer");
         return -EINVAL;
     }
 
     for (i = 0; i < length; i++) {
         if (memcmp(uuid, &gDescriptors[i]->uuid, sizeof(effect_uuid_t)) == 0) {
             memcpy(pDescriptor, gDescriptors[i], sizeof(effect_descriptor_t));
-            LOGV("EffectGetDescriptor - UUID matched Reverb type %d, UUID = %x",
+            ALOGV("EffectGetDescriptor - UUID matched Reverb type %d, UUID = %x",
                  i, gDescriptors[i]->uuid.timeLow);
             return 0;
         }
@@ -341,7 +341,7 @@
 /* local functions */
 #define CHECK_ARG(cond) {                     \
     if (!(cond)) {                            \
-        LOGV("\tLVM_ERROR : Invalid argument: "#cond);      \
+        ALOGV("\tLVM_ERROR : Invalid argument: "#cond);      \
         return -EINVAL;                       \
     }                                         \
 }
@@ -444,7 +444,7 @@
     if (pContext->config.inputCfg.channels == AUDIO_CHANNEL_OUT_STEREO) {
         samplesPerFrame = 2;
     } else if (pContext->config.inputCfg.channels != AUDIO_CHANNEL_OUT_MONO) {
-        LOGV("\tLVREV_ERROR : process invalid PCM format");
+        ALOGV("\tLVREV_ERROR : process invalid PCM format");
         return -EINVAL;
     }
 
@@ -452,7 +452,7 @@
 
     // Check for NULL pointers
     if((pContext->InFrames32 == NULL)||(pContext->OutFrames32 == NULL)){
-        LOGV("\tLVREV_ERROR : process failed to allocate memory for temporary buffers ");
+        ALOGV("\tLVREV_ERROR : process failed to allocate memory for temporary buffers ");
         return -EINVAL;
     }
 
@@ -485,7 +485,7 @@
     } else {
         if(pContext->bEnabled == LVM_FALSE && pContext->SamplesToExitCount > 0) {
             memset(pContext->InFrames32,0,frameCount * sizeof(LVM_INT32) * samplesPerFrame);
-            LOGV("\tZeroing %d samples per frame at the end of call", samplesPerFrame);
+            ALOGV("\tZeroing %d samples per frame at the end of call", samplesPerFrame);
         }
 
         /* Process the samples, producing a stereo output */
@@ -552,12 +552,12 @@
 
     // Accumulate if required
     if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
-        //LOGV("\tBuffer access is ACCUMULATE");
+        //ALOGV("\tBuffer access is ACCUMULATE");
         for (int i=0; i<frameCount*2; i++){ //always stereo here
             pOut[i] = clamp16((int32_t)pOut[i] + (int32_t)OutFrames16[i]);
         }
     }else{
-        //LOGV("\tBuffer access is WRITE");
+        //ALOGV("\tBuffer access is WRITE");
         memcpy(pOut, OutFrames16, frameCount*sizeof(LVM_INT16)*2);
     }
 
@@ -592,15 +592,15 @@
     for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
         if (MemTab.Region[i].Size != 0){
             if (MemTab.Region[i].pBaseAddress != NULL){
-                LOGV("\tfree() - START freeing %ld bytes for region %u at %p\n",
+                ALOGV("\tfree() - START freeing %ld bytes for region %u at %p\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
 
                 free(MemTab.Region[i].pBaseAddress);
 
-                LOGV("\tfree() - END   freeing %ld bytes for region %u at %p\n",
+                ALOGV("\tfree() - END   freeing %ld bytes for region %u at %p\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
             }else{
-                LOGV("\tLVM_ERROR : free() - trying to free with NULL pointer %ld bytes "
+                ALOGV("\tLVM_ERROR : free() - trying to free with NULL pointer %ld bytes "
                         "for region %u at %p ERROR\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
             }
@@ -624,7 +624,7 @@
 
 int Reverb_configure(ReverbContext *pContext, effect_config_t *pConfig){
     LVM_Fs_en   SampleRate;
-    //LOGV("\tReverb_configure start");
+    //ALOGV("\tReverb_configure start");
 
     CHECK_ARG(pContext != NULL);
     CHECK_ARG(pConfig != NULL);
@@ -642,7 +642,7 @@
         return -EINVAL;
     }
 
-    //LOGV("\tReverb_configure calling memcpy");
+    //ALOGV("\tReverb_configure calling memcpy");
     memcpy(&pContext->config, pConfig, sizeof(effect_config_t));
 
 
@@ -666,7 +666,7 @@
         SampleRate = LVM_FS_48000;
         break;
     default:
-        LOGV("\rReverb_Configure invalid sampling rate %d", pConfig->inputCfg.samplingRate);
+        ALOGV("\rReverb_Configure invalid sampling rate %d", pConfig->inputCfg.samplingRate);
         return -EINVAL;
     }
 
@@ -675,7 +675,7 @@
         LVREV_ControlParams_st    ActiveParams;
         LVREV_ReturnStatus_en     LvmStatus = LVREV_SUCCESS;
 
-        //LOGV("\tReverb_configure change sampling rate to %d", SampleRate);
+        //ALOGV("\tReverb_configure change sampling rate to %d", SampleRate);
 
         /* Get the current settings */
         LvmStatus = LVREV_GetControlParameters(pContext->hInstance,
@@ -687,13 +687,13 @@
         LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
 
         LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "Reverb_configure")
-        //LOGV("\tReverb_configure Succesfully called LVREV_SetControlParameters\n");
+        //ALOGV("\tReverb_configure Succesfully called LVREV_SetControlParameters\n");
 
     }else{
-        //LOGV("\tReverb_configure keep sampling rate at %d", SampleRate);
+        //ALOGV("\tReverb_configure keep sampling rate at %d", SampleRate);
     }
 
-    //LOGV("\tReverb_configure End");
+    //ALOGV("\tReverb_configure End");
     return 0;
 }   /* end Reverb_configure */
 
@@ -713,7 +713,7 @@
 int Reverb_init(ReverbContext *pContext){
     int status;
 
-    LOGV("\tReverb_init start");
+    ALOGV("\tReverb_init start");
 
     CHECK_ARG(pContext != NULL);
 
@@ -768,7 +768,7 @@
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetMemoryTable", "Reverb_init")
     if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
 
-    LOGV("\tCreateInstance Succesfully called LVM_GetMemoryTable\n");
+    ALOGV("\tCreateInstance Succesfully called LVM_GetMemoryTable\n");
 
     /* Allocate memory */
     for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
@@ -776,11 +776,11 @@
             MemTab.Region[i].pBaseAddress = malloc(MemTab.Region[i].Size);
 
             if (MemTab.Region[i].pBaseAddress == LVM_NULL){
-                LOGV("\tLVREV_ERROR :Reverb_init CreateInstance Failed to allocate %ld "
+                ALOGV("\tLVREV_ERROR :Reverb_init CreateInstance Failed to allocate %ld "
                         "bytes for region %u\n", MemTab.Region[i].Size, i );
                 bMallocFailure = LVM_TRUE;
             }else{
-                LOGV("\tReverb_init CreateInstance allocate %ld bytes for region %u at %p\n",
+                ALOGV("\tReverb_init CreateInstance allocate %ld bytes for region %u at %p\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
             }
         }
@@ -792,10 +792,10 @@
     if(bMallocFailure == LVM_TRUE){
         for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
             if (MemTab.Region[i].pBaseAddress == LVM_NULL){
-                LOGV("\tLVM_ERROR :Reverb_init CreateInstance Failed to allocate %ld bytes "
+                ALOGV("\tLVM_ERROR :Reverb_init CreateInstance Failed to allocate %ld bytes "
                         "for region %u - Not freeing\n", MemTab.Region[i].Size, i );
             }else{
-                LOGV("\tLVM_ERROR :Reverb_init CreateInstance Failed: but allocated %ld bytes "
+                ALOGV("\tLVM_ERROR :Reverb_init CreateInstance Failed: but allocated %ld bytes "
                         "for region %u at %p- free\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
                 free(MemTab.Region[i].pBaseAddress);
@@ -803,7 +803,7 @@
         }
         return -EINVAL;
     }
-    LOGV("\tReverb_init CreateInstance Succesfully malloc'd memory\n");
+    ALOGV("\tReverb_init CreateInstance Succesfully malloc'd memory\n");
 
     /* Initialise */
     pContext->hInstance = LVM_NULL;
@@ -816,7 +816,7 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetInstanceHandle", "Reverb_init")
     if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
 
-    LOGV("\tReverb_init CreateInstance Succesfully called LVM_GetInstanceHandle\n");
+    ALOGV("\tReverb_init CreateInstance Succesfully called LVM_GetInstanceHandle\n");
 
     /* Set the initial process parameters */
     /* General parameters */
@@ -860,8 +860,8 @@
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "Reverb_init")
     if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
 
-    LOGV("\tReverb_init CreateInstance Succesfully called LVREV_SetControlParameters\n");
-    LOGV("\tReverb_init End");
+    ALOGV("\tReverb_init CreateInstance Succesfully called LVREV_SetControlParameters\n");
+    ALOGV("\tReverb_init End");
     return 0;
 }   /* end Reverb_init */
 
@@ -960,7 +960,7 @@
 //----------------------------------------------------------------------------
 
 void ReverbSetRoomHfLevel(ReverbContext *pContext, int16_t level){
-    //LOGV("\tReverbSetRoomHfLevel start (%d)", level);
+    //ALOGV("\tReverbSetRoomHfLevel start (%d)", level);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -968,17 +968,17 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetRoomHfLevel")
-    //LOGV("\tReverbSetRoomHfLevel Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbSetRoomHfLevel() just Got -> %d\n", ActiveParams.LPF);
+    //ALOGV("\tReverbSetRoomHfLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbSetRoomHfLevel() just Got -> %d\n", ActiveParams.LPF);
 
     ActiveParams.LPF = ReverbConvertHfLevel(level);
 
     /* Activate the initial settings */
     LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetRoomHfLevel")
-    //LOGV("\tReverbSetRoomhfLevel() just Set -> %d\n", ActiveParams.LPF);
+    //ALOGV("\tReverbSetRoomhfLevel() just Set -> %d\n", ActiveParams.LPF);
     pContext->SavedHfLevel = level;
-    //LOGV("\tReverbSetHfRoomLevel end.. saving %d", pContext->SavedHfLevel);
+    //ALOGV("\tReverbSetHfRoomLevel end.. saving %d", pContext->SavedHfLevel);
     return;
 }
 
@@ -995,7 +995,7 @@
 
 int16_t ReverbGetRoomHfLevel(ReverbContext *pContext){
     int16_t level;
-    //LOGV("\tReverbGetRoomHfLevel start, saved level is %d", pContext->SavedHfLevel);
+    //ALOGV("\tReverbGetRoomHfLevel start, saved level is %d", pContext->SavedHfLevel);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1003,20 +1003,20 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetRoomHfLevel")
-    //LOGV("\tReverbGetRoomHfLevel Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbGetRoomHfLevel() just Got -> %d\n", ActiveParams.LPF);
+    //ALOGV("\tReverbGetRoomHfLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbGetRoomHfLevel() just Got -> %d\n", ActiveParams.LPF);
 
     level = ReverbConvertHfLevel(pContext->SavedHfLevel);
 
-    //LOGV("\tReverbGetRoomHfLevel() ActiveParams.LPFL %d, pContext->SavedHfLevel: %d, "
+    //ALOGV("\tReverbGetRoomHfLevel() ActiveParams.LPFL %d, pContext->SavedHfLevel: %d, "
     //     "converted level: %d\n", ActiveParams.LPF, pContext->SavedHfLevel, level);
 
     if(ActiveParams.LPF != level){
-        LOGV("\tLVM_ERROR : (ignore at start up) ReverbGetRoomHfLevel() has wrong level -> %d %d\n",
+        ALOGV("\tLVM_ERROR : (ignore at start up) ReverbGetRoomHfLevel() has wrong level -> %d %d\n",
                ActiveParams.Level, level);
     }
 
-    //LOGV("\tReverbGetRoomHfLevel end");
+    //ALOGV("\tReverbGetRoomHfLevel end");
     return pContext->SavedHfLevel;
 }
 
@@ -1033,7 +1033,7 @@
 //----------------------------------------------------------------------------
 
 void ReverbSetReverbLevel(ReverbContext *pContext, int16_t level){
-    //LOGV("\n\tReverbSetReverbLevel start (%d)", level);
+    //ALOGV("\n\tReverbSetReverbLevel start (%d)", level);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1042,25 +1042,25 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetReverbLevel")
-    //LOGV("\tReverbSetReverbLevel Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbSetReverbLevel just Got -> %d\n", ActiveParams.Level);
+    //ALOGV("\tReverbSetReverbLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbSetReverbLevel just Got -> %d\n", ActiveParams.Level);
 
     // needs to subtract max levels for both RoomLevel and ReverbLevel
     CombinedLevel = (level + pContext->SavedRoomLevel)-LVREV_MAX_REVERB_LEVEL;
-    //LOGV("\tReverbSetReverbLevel() CombinedLevel is %d = %d + %d\n",
+    //ALOGV("\tReverbSetReverbLevel() CombinedLevel is %d = %d + %d\n",
     //      CombinedLevel, level, pContext->SavedRoomLevel);
 
     ActiveParams.Level = ReverbConvertLevel(CombinedLevel);
 
-    //LOGV("\tReverbSetReverbLevel() Trying to set -> %d\n", ActiveParams.Level);
+    //ALOGV("\tReverbSetReverbLevel() Trying to set -> %d\n", ActiveParams.Level);
 
     /* Activate the initial settings */
     LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetReverbLevel")
-    //LOGV("\tReverbSetReverbLevel() just Set -> %d\n", ActiveParams.Level);
+    //ALOGV("\tReverbSetReverbLevel() just Set -> %d\n", ActiveParams.Level);
 
     pContext->SavedReverbLevel = level;
-    //LOGV("\tReverbSetReverbLevel end pContext->SavedReverbLevel is %d\n\n",
+    //ALOGV("\tReverbSetReverbLevel end pContext->SavedReverbLevel is %d\n\n",
     //     pContext->SavedReverbLevel);
     return;
 }
@@ -1078,7 +1078,7 @@
 
 int16_t ReverbGetReverbLevel(ReverbContext *pContext){
     int16_t level;
-    //LOGV("\tReverbGetReverbLevel start");
+    //ALOGV("\tReverbGetReverbLevel start");
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1087,26 +1087,26 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetReverbLevel")
-    //LOGV("\tReverbGetReverbLevel Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbGetReverbLevel() just Got -> %d\n", ActiveParams.Level);
+    //ALOGV("\tReverbGetReverbLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbGetReverbLevel() just Got -> %d\n", ActiveParams.Level);
 
     // needs to subtract max levels for both RoomLevel and ReverbLevel
     CombinedLevel = (pContext->SavedReverbLevel + pContext->SavedRoomLevel)-LVREV_MAX_REVERB_LEVEL;
 
-    //LOGV("\tReverbGetReverbLevel() CombinedLevel is %d = %d + %d\n",
+    //ALOGV("\tReverbGetReverbLevel() CombinedLevel is %d = %d + %d\n",
     //CombinedLevel, pContext->SavedReverbLevel, pContext->SavedRoomLevel);
     level = ReverbConvertLevel(CombinedLevel);
 
-    //LOGV("\tReverbGetReverbLevel(): ActiveParams.Level: %d, pContext->SavedReverbLevel: %d, "
+    //ALOGV("\tReverbGetReverbLevel(): ActiveParams.Level: %d, pContext->SavedReverbLevel: %d, "
     //"pContext->SavedRoomLevel: %d, CombinedLevel: %d, converted level: %d\n",
     //ActiveParams.Level, pContext->SavedReverbLevel,pContext->SavedRoomLevel, CombinedLevel,level);
 
     if(ActiveParams.Level != level){
-        LOGV("\tLVM_ERROR : (ignore at start up) ReverbGetReverbLevel() has wrong level -> %d %d\n",
+        ALOGV("\tLVM_ERROR : (ignore at start up) ReverbGetReverbLevel() has wrong level -> %d %d\n",
                 ActiveParams.Level, level);
     }
 
-    //LOGV("\tReverbGetReverbLevel end\n");
+    //ALOGV("\tReverbGetReverbLevel end\n");
 
     return pContext->SavedReverbLevel;
 }
@@ -1124,7 +1124,7 @@
 //----------------------------------------------------------------------------
 
 void ReverbSetRoomLevel(ReverbContext *pContext, int16_t level){
-    //LOGV("\tReverbSetRoomLevel start (%d)", level);
+    //ALOGV("\tReverbSetRoomLevel start (%d)", level);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1133,8 +1133,8 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetRoomLevel")
-    //LOGV("\tReverbSetRoomLevel Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbSetRoomLevel() just Got -> %d\n", ActiveParams.Level);
+    //ALOGV("\tReverbSetRoomLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbSetRoomLevel() just Got -> %d\n", ActiveParams.Level);
 
     // needs to subtract max levels for both RoomLevel and ReverbLevel
     CombinedLevel = (level + pContext->SavedReverbLevel)-LVREV_MAX_REVERB_LEVEL;
@@ -1143,10 +1143,10 @@
     /* Activate the initial settings */
     LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetRoomLevel")
-    //LOGV("\tReverbSetRoomLevel() just Set -> %d\n", ActiveParams.Level);
+    //ALOGV("\tReverbSetRoomLevel() just Set -> %d\n", ActiveParams.Level);
 
     pContext->SavedRoomLevel = level;
-    //LOGV("\tReverbSetRoomLevel end");
+    //ALOGV("\tReverbSetRoomLevel end");
     return;
 }
 
@@ -1163,7 +1163,7 @@
 
 int16_t ReverbGetRoomLevel(ReverbContext *pContext){
     int16_t level;
-    //LOGV("\tReverbGetRoomLevel start");
+    //ALOGV("\tReverbGetRoomLevel start");
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1172,24 +1172,24 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetRoomLevel")
-    //LOGV("\tReverbGetRoomLevel Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbGetRoomLevel() just Got -> %d\n", ActiveParams.Level);
+    //ALOGV("\tReverbGetRoomLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbGetRoomLevel() just Got -> %d\n", ActiveParams.Level);
 
     // needs to subtract max levels for both RoomLevel and ReverbLevel
     CombinedLevel = (pContext->SavedRoomLevel + pContext->SavedReverbLevel-LVREV_MAX_REVERB_LEVEL);
     level = ReverbConvertLevel(CombinedLevel);
 
-    //LOGV("\tReverbGetRoomLevel, Level = %d, pContext->SavedRoomLevel = %d, "
+    //ALOGV("\tReverbGetRoomLevel, Level = %d, pContext->SavedRoomLevel = %d, "
     //     "pContext->SavedReverbLevel = %d, CombinedLevel = %d, level = %d",
     //     ActiveParams.Level, pContext->SavedRoomLevel,
     //     pContext->SavedReverbLevel, CombinedLevel, level);
 
     if(ActiveParams.Level != level){
-        LOGV("\tLVM_ERROR : (ignore at start up) ReverbGetRoomLevel() has wrong level -> %d %d\n",
+        ALOGV("\tLVM_ERROR : (ignore at start up) ReverbGetRoomLevel() has wrong level -> %d %d\n",
               ActiveParams.Level, level);
     }
 
-    //LOGV("\tReverbGetRoomLevel end");
+    //ALOGV("\tReverbGetRoomLevel end");
     return pContext->SavedRoomLevel;
 }
 
@@ -1206,7 +1206,7 @@
 //----------------------------------------------------------------------------
 
 void ReverbSetDecayTime(ReverbContext *pContext, uint32_t time){
-    //LOGV("\tReverbSetDecayTime start (%d)", time);
+    //ALOGV("\tReverbSetDecayTime start (%d)", time);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1214,8 +1214,8 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetDecayTime")
-    //LOGV("\tReverbSetDecayTime Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbSetDecayTime() just Got -> %d\n", ActiveParams.T60);
+    //ALOGV("\tReverbSetDecayTime Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbSetDecayTime() just Got -> %d\n", ActiveParams.T60);
 
     if (time <= LVREV_MAX_T60) {
         ActiveParams.T60 = (LVM_UINT16)time;
@@ -1227,12 +1227,12 @@
     /* Activate the initial settings */
     LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetDecayTime")
-    //LOGV("\tReverbSetDecayTime() just Set -> %d\n", ActiveParams.T60);
+    //ALOGV("\tReverbSetDecayTime() just Set -> %d\n", ActiveParams.T60);
 
     pContext->SamplesToExitCount = (ActiveParams.T60 * pContext->config.inputCfg.samplingRate)/1000;
-    //LOGV("\tReverbSetDecayTime() just Set SamplesToExitCount-> %d\n",pContext->SamplesToExitCount);
+    //ALOGV("\tReverbSetDecayTime() just Set SamplesToExitCount-> %d\n",pContext->SamplesToExitCount);
     pContext->SavedDecayTime = (int16_t)time;
-    //LOGV("\tReverbSetDecayTime end");
+    //ALOGV("\tReverbSetDecayTime end");
     return;
 }
 
@@ -1248,7 +1248,7 @@
 //----------------------------------------------------------------------------
 
 uint32_t ReverbGetDecayTime(ReverbContext *pContext){
-    //LOGV("\tReverbGetDecayTime start");
+    //ALOGV("\tReverbGetDecayTime start");
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1256,16 +1256,16 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetDecayTime")
-    //LOGV("\tReverbGetDecayTime Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbGetDecayTime() just Got -> %d\n", ActiveParams.T60);
+    //ALOGV("\tReverbGetDecayTime Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbGetDecayTime() just Got -> %d\n", ActiveParams.T60);
 
     if(ActiveParams.T60 != pContext->SavedDecayTime){
         // This will fail if the decay time is set to more than 7000
-        LOGV("\tLVM_ERROR : ReverbGetDecayTime() has wrong level -> %d %d\n",
+        ALOGV("\tLVM_ERROR : ReverbGetDecayTime() has wrong level -> %d %d\n",
          ActiveParams.T60, pContext->SavedDecayTime);
     }
 
-    //LOGV("\tReverbGetDecayTime end");
+    //ALOGV("\tReverbGetDecayTime end");
     return (uint32_t)ActiveParams.T60;
 }
 
@@ -1282,7 +1282,7 @@
 //----------------------------------------------------------------------------
 
 void ReverbSetDecayHfRatio(ReverbContext *pContext, int16_t ratio){
-    //LOGV("\tReverbSetDecayHfRatioe start (%d)", ratio);
+    //ALOGV("\tReverbSetDecayHfRatioe start (%d)", ratio);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;   /* Function call status */
@@ -1290,18 +1290,18 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetDecayHfRatio")
-    //LOGV("\tReverbSetDecayHfRatio Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbSetDecayHfRatio() just Got -> %d\n", ActiveParams.Damping);
+    //ALOGV("\tReverbSetDecayHfRatio Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbSetDecayHfRatio() just Got -> %d\n", ActiveParams.Damping);
 
     ActiveParams.Damping = (LVM_INT16)(ratio/20);
 
     /* Activate the initial settings */
     LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetDecayHfRatio")
-    //LOGV("\tReverbSetDecayHfRatio() just Set -> %d\n", ActiveParams.Damping);
+    //ALOGV("\tReverbSetDecayHfRatio() just Set -> %d\n", ActiveParams.Damping);
 
     pContext->SavedDecayHfRatio = ratio;
-    //LOGV("\tReverbSetDecayHfRatio end");
+    //ALOGV("\tReverbSetDecayHfRatio end");
     return;
 }
 
@@ -1317,7 +1317,7 @@
 //----------------------------------------------------------------------------
 
 int32_t ReverbGetDecayHfRatio(ReverbContext *pContext){
-    //LOGV("\tReverbGetDecayHfRatio start");
+    //ALOGV("\tReverbGetDecayHfRatio start");
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;   /* Function call status */
@@ -1325,15 +1325,15 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetDecayHfRatio")
-    //LOGV("\tReverbGetDecayHfRatio Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbGetDecayHfRatio() just Got -> %d\n", ActiveParams.Damping);
+    //ALOGV("\tReverbGetDecayHfRatio Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbGetDecayHfRatio() just Got -> %d\n", ActiveParams.Damping);
 
     if(ActiveParams.Damping != (LVM_INT16)(pContext->SavedDecayHfRatio / 20)){
-        LOGV("\tLVM_ERROR : ReverbGetDecayHfRatio() has wrong level -> %d %d\n",
+        ALOGV("\tLVM_ERROR : ReverbGetDecayHfRatio() has wrong level -> %d %d\n",
          ActiveParams.Damping, pContext->SavedDecayHfRatio);
     }
 
-    //LOGV("\tReverbGetDecayHfRatio end");
+    //ALOGV("\tReverbGetDecayHfRatio end");
     return pContext->SavedDecayHfRatio;
 }
 
@@ -1350,7 +1350,7 @@
 //----------------------------------------------------------------------------
 
 void ReverbSetDiffusion(ReverbContext *pContext, int16_t level){
-    //LOGV("\tReverbSetDiffusion start (%d)", level);
+    //ALOGV("\tReverbSetDiffusion start (%d)", level);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1358,18 +1358,18 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetDiffusion")
-    //LOGV("\tReverbSetDiffusion Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbSetDiffusion() just Got -> %d\n", ActiveParams.Density);
+    //ALOGV("\tReverbSetDiffusion Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbSetDiffusion() just Got -> %d\n", ActiveParams.Density);
 
     ActiveParams.Density = (LVM_INT16)(level/10);
 
     /* Activate the initial settings */
     LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetDiffusion")
-    //LOGV("\tReverbSetDiffusion() just Set -> %d\n", ActiveParams.Density);
+    //ALOGV("\tReverbSetDiffusion() just Set -> %d\n", ActiveParams.Density);
 
     pContext->SavedDiffusion = level;
-    //LOGV("\tReverbSetDiffusion end");
+    //ALOGV("\tReverbSetDiffusion end");
     return;
 }
 
@@ -1385,7 +1385,7 @@
 //----------------------------------------------------------------------------
 
 int32_t ReverbGetDiffusion(ReverbContext *pContext){
-    //LOGV("\tReverbGetDiffusion start");
+    //ALOGV("\tReverbGetDiffusion start");
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1394,16 +1394,16 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetDiffusion")
-    //LOGV("\tReverbGetDiffusion Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbGetDiffusion just Got -> %d\n", ActiveParams.Density);
+    //ALOGV("\tReverbGetDiffusion Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbGetDiffusion just Got -> %d\n", ActiveParams.Density);
 
     Temp = (LVM_INT16)(pContext->SavedDiffusion/10);
 
     if(ActiveParams.Density != Temp){
-        LOGV("\tLVM_ERROR : ReverbGetDiffusion invalid value %d %d", Temp, ActiveParams.Density);
+        ALOGV("\tLVM_ERROR : ReverbGetDiffusion invalid value %d %d", Temp, ActiveParams.Density);
     }
 
-    //LOGV("\tReverbGetDiffusion end");
+    //ALOGV("\tReverbGetDiffusion end");
     return pContext->SavedDiffusion;
 }
 
@@ -1420,7 +1420,7 @@
 //----------------------------------------------------------------------------
 
 void ReverbSetDensity(ReverbContext *pContext, int16_t level){
-    //LOGV("\tReverbSetDensity start (%d)", level);
+    //ALOGV("\tReverbSetDensity start (%d)", level);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1428,18 +1428,18 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetDensity")
-    //LOGV("\tReverbSetDensity Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbSetDensity just Got -> %d\n", ActiveParams.RoomSize);
+    //ALOGV("\tReverbSetDensity Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbSetDensity just Got -> %d\n", ActiveParams.RoomSize);
 
     ActiveParams.RoomSize = (LVM_INT16)(((level * 99) / 1000) + 1);
 
     /* Activate the initial settings */
     LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetDensity")
-    //LOGV("\tReverbSetDensity just Set -> %d\n", ActiveParams.RoomSize);
+    //ALOGV("\tReverbSetDensity just Set -> %d\n", ActiveParams.RoomSize);
 
     pContext->SavedDensity = level;
-    //LOGV("\tReverbSetDensity end");
+    //ALOGV("\tReverbSetDensity end");
     return;
 }
 
@@ -1455,7 +1455,7 @@
 //----------------------------------------------------------------------------
 
 int32_t ReverbGetDensity(ReverbContext *pContext){
-    //LOGV("\tReverbGetDensity start");
+    //ALOGV("\tReverbGetDensity start");
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1463,17 +1463,17 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetDensity")
-    //LOGV("\tReverbGetDensity Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbGetDensity() just Got -> %d\n", ActiveParams.RoomSize);
+    //ALOGV("\tReverbGetDensity Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbGetDensity() just Got -> %d\n", ActiveParams.RoomSize);
 
 
     Temp = (LVM_INT16)(((pContext->SavedDensity * 99) / 1000) + 1);
 
     if(Temp != ActiveParams.RoomSize){
-        LOGV("\tLVM_ERROR : ReverbGetDensity invalid value %d %d", Temp, ActiveParams.RoomSize);
+        ALOGV("\tLVM_ERROR : ReverbGetDensity invalid value %d %d", Temp, ActiveParams.RoomSize);
     }
 
-    //LOGV("\tReverbGetDensity end");
+    //ALOGV("\tReverbGetDensity end");
     return pContext->SavedDensity;
 }
 
@@ -1546,98 +1546,98 @@
     char *name;
     t_reverb_settings *pProperties;
 
-    //LOGV("\tReverb_getParameter start");
+    //ALOGV("\tReverb_getParameter start");
     if (pContext->preset) {
         if (param != REVERB_PARAM_PRESET || *pValueSize < sizeof(uint16_t)) {
             return -EINVAL;
         }
 
         *(uint16_t *)pValue = pContext->nextPreset;
-        LOGV("get REVERB_PARAM_PRESET, preset %d", pContext->nextPreset);
+        ALOGV("get REVERB_PARAM_PRESET, preset %d", pContext->nextPreset);
         return 0;
     }
 
     switch (param){
         case REVERB_PARAM_ROOM_LEVEL:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize1 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize1 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
         case REVERB_PARAM_ROOM_HF_LEVEL:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize12 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize12 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
         case REVERB_PARAM_DECAY_TIME:
             if (*pValueSize != sizeof(uint32_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize3 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize3 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(uint32_t);
             break;
         case REVERB_PARAM_DECAY_HF_RATIO:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize4 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize4 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
         case REVERB_PARAM_REFLECTIONS_LEVEL:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize5 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize5 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
         case REVERB_PARAM_REFLECTIONS_DELAY:
             if (*pValueSize != sizeof(uint32_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize6 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize6 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(uint32_t);
             break;
         case REVERB_PARAM_REVERB_LEVEL:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize7 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize7 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
         case REVERB_PARAM_REVERB_DELAY:
             if (*pValueSize != sizeof(uint32_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize8 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize8 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(uint32_t);
             break;
         case REVERB_PARAM_DIFFUSION:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize9 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize9 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
         case REVERB_PARAM_DENSITY:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize10 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize10 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
         case REVERB_PARAM_PROPERTIES:
             if (*pValueSize != sizeof(t_reverb_settings)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize11 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize11 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(t_reverb_settings);
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Reverb_getParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid param %d", param);
             return -EINVAL;
     }
 
@@ -1656,68 +1656,68 @@
             pProperties->diffusion = ReverbGetDiffusion(pContext);
             pProperties->density = ReverbGetDensity(pContext);
 
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is roomLevel        %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is roomLevel        %d",
                 pProperties->roomLevel);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is roomHFLevel      %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is roomHFLevel      %d",
                 pProperties->roomHFLevel);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is decayTime        %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is decayTime        %d",
                 pProperties->decayTime);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is decayHFRatio     %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is decayHFRatio     %d",
                 pProperties->decayHFRatio);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reflectionsLevel %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reflectionsLevel %d",
                 pProperties->reflectionsLevel);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reflectionsDelay %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reflectionsDelay %d",
                 pProperties->reflectionsDelay);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reverbDelay      %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reverbDelay      %d",
                 pProperties->reverbDelay);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reverbLevel      %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reverbLevel      %d",
                 pProperties->reverbLevel);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is diffusion        %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is diffusion        %d",
                 pProperties->diffusion);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is density          %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is density          %d",
                 pProperties->density);
             break;
 
         case REVERB_PARAM_ROOM_LEVEL:
             *(int16_t *)pValue = ReverbGetRoomLevel(pContext);
 
-            //LOGV("\tReverb_getParameter() REVERB_PARAM_ROOM_LEVEL Value is %d",
+            //ALOGV("\tReverb_getParameter() REVERB_PARAM_ROOM_LEVEL Value is %d",
             //        *(int16_t *)pValue);
             break;
         case REVERB_PARAM_ROOM_HF_LEVEL:
             *(int16_t *)pValue = ReverbGetRoomHfLevel(pContext);
 
-            //LOGV("\tReverb_getParameter() REVERB_PARAM_ROOM_HF_LEVEL Value is %d",
+            //ALOGV("\tReverb_getParameter() REVERB_PARAM_ROOM_HF_LEVEL Value is %d",
             //        *(int16_t *)pValue);
             break;
         case REVERB_PARAM_DECAY_TIME:
             *(uint32_t *)pValue = ReverbGetDecayTime(pContext);
 
-            //LOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_TIME Value is %d",
+            //ALOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_TIME Value is %d",
             //        *(int32_t *)pValue);
             break;
         case REVERB_PARAM_DECAY_HF_RATIO:
             *(int16_t *)pValue = ReverbGetDecayHfRatio(pContext);
 
-            //LOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_HF_RATION Value is %d",
+            //ALOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_HF_RATION Value is %d",
             //        *(int16_t *)pValue);
             break;
         case REVERB_PARAM_REVERB_LEVEL:
              *(int16_t *)pValue = ReverbGetReverbLevel(pContext);
 
-            //LOGV("\tReverb_getParameter() REVERB_PARAM_REVERB_LEVEL Value is %d",
+            //ALOGV("\tReverb_getParameter() REVERB_PARAM_REVERB_LEVEL Value is %d",
             //        *(int16_t *)pValue);
             break;
         case REVERB_PARAM_DIFFUSION:
             *(int16_t *)pValue = ReverbGetDiffusion(pContext);
 
-            //LOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_DIFFUSION Value is %d",
+            //ALOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_DIFFUSION Value is %d",
             //        *(int16_t *)pValue);
             break;
         case REVERB_PARAM_DENSITY:
             *(uint16_t *)pValue = 0;
             *(int16_t *)pValue = ReverbGetDensity(pContext);
-            //LOGV("\tReverb_getParameter() REVERB_PARAM_DENSITY Value is %d",
+            //ALOGV("\tReverb_getParameter() REVERB_PARAM_DENSITY Value is %d",
             //        *(uint32_t *)pValue);
             break;
         case REVERB_PARAM_REFLECTIONS_LEVEL:
@@ -1729,12 +1729,12 @@
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Reverb_getParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid param %d", param);
             status = -EINVAL;
             break;
     }
 
-    //LOGV("\tReverb_getParameter end");
+    //ALOGV("\tReverb_getParameter end");
     return status;
 } /* end Reverb_getParameter */
 
@@ -1762,14 +1762,14 @@
     int32_t *pParamTemp = (int32_t *)pParam;
     int32_t param = *pParamTemp++;
 
-    //LOGV("\tReverb_setParameter start");
+    //ALOGV("\tReverb_setParameter start");
     if (pContext->preset) {
         if (param != REVERB_PARAM_PRESET) {
             return -EINVAL;
         }
 
         uint16_t preset = *(uint16_t *)pValue;
-        LOGV("set REVERB_PARAM_PRESET, preset %d", preset);
+        ALOGV("set REVERB_PARAM_PRESET, preset %d", preset);
         if (preset > REVERB_PRESET_LAST) {
             return -EINVAL;
         }
@@ -1779,7 +1779,7 @@
 
     switch (param){
         case REVERB_PARAM_PROPERTIES:
-            LOGV("\tReverb_setParameter() REVERB_PARAM_PROPERTIES");
+            ALOGV("\tReverb_setParameter() REVERB_PARAM_PROPERTIES");
             pProperties = (t_reverb_settings *) pValue;
             ReverbSetRoomLevel(pContext, pProperties->roomLevel);
             ReverbSetRoomHfLevel(pContext, pProperties->roomHFLevel);
@@ -1791,52 +1791,52 @@
             break;
         case REVERB_PARAM_ROOM_LEVEL:
             level = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_ROOM_LEVEL value is %d", level);
-            //LOGV("\tReverb_setParameter() Calling ReverbSetRoomLevel");
+            //ALOGV("\tReverb_setParameter() REVERB_PARAM_ROOM_LEVEL value is %d", level);
+            //ALOGV("\tReverb_setParameter() Calling ReverbSetRoomLevel");
             ReverbSetRoomLevel(pContext, level);
-            //LOGV("\tReverb_setParameter() Called ReverbSetRoomLevel");
+            //ALOGV("\tReverb_setParameter() Called ReverbSetRoomLevel");
            break;
         case REVERB_PARAM_ROOM_HF_LEVEL:
             level = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_ROOM_HF_LEVEL value is %d", level);
-            //LOGV("\tReverb_setParameter() Calling ReverbSetRoomHfLevel");
+            //ALOGV("\tReverb_setParameter() REVERB_PARAM_ROOM_HF_LEVEL value is %d", level);
+            //ALOGV("\tReverb_setParameter() Calling ReverbSetRoomHfLevel");
             ReverbSetRoomHfLevel(pContext, level);
-            //LOGV("\tReverb_setParameter() Called ReverbSetRoomHfLevel");
+            //ALOGV("\tReverb_setParameter() Called ReverbSetRoomHfLevel");
            break;
         case REVERB_PARAM_DECAY_TIME:
             time = *(uint32_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_TIME value is %d", time);
-            //LOGV("\tReverb_setParameter() Calling ReverbSetDecayTime");
+            //ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_TIME value is %d", time);
+            //ALOGV("\tReverb_setParameter() Calling ReverbSetDecayTime");
             ReverbSetDecayTime(pContext, time);
-            //LOGV("\tReverb_setParameter() Called ReverbSetDecayTime");
+            //ALOGV("\tReverb_setParameter() Called ReverbSetDecayTime");
            break;
         case REVERB_PARAM_DECAY_HF_RATIO:
             ratio = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_HF_RATIO value is %d", ratio);
-            //LOGV("\tReverb_setParameter() Calling ReverbSetDecayHfRatio");
+            //ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_HF_RATIO value is %d", ratio);
+            //ALOGV("\tReverb_setParameter() Calling ReverbSetDecayHfRatio");
             ReverbSetDecayHfRatio(pContext, ratio);
-            //LOGV("\tReverb_setParameter() Called ReverbSetDecayHfRatio");
+            //ALOGV("\tReverb_setParameter() Called ReverbSetDecayHfRatio");
             break;
          case REVERB_PARAM_REVERB_LEVEL:
             level = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_REVERB_LEVEL value is %d", level);
-            //LOGV("\tReverb_setParameter() Calling ReverbSetReverbLevel");
+            //ALOGV("\tReverb_setParameter() REVERB_PARAM_REVERB_LEVEL value is %d", level);
+            //ALOGV("\tReverb_setParameter() Calling ReverbSetReverbLevel");
             ReverbSetReverbLevel(pContext, level);
-            //LOGV("\tReverb_setParameter() Called ReverbSetReverbLevel");
+            //ALOGV("\tReverb_setParameter() Called ReverbSetReverbLevel");
            break;
         case REVERB_PARAM_DIFFUSION:
             ratio = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DIFFUSION value is %d", ratio);
-            //LOGV("\tReverb_setParameter() Calling ReverbSetDiffusion");
+            //ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DIFFUSION value is %d", ratio);
+            //ALOGV("\tReverb_setParameter() Calling ReverbSetDiffusion");
             ReverbSetDiffusion(pContext, ratio);
-            //LOGV("\tReverb_setParameter() Called ReverbSetDiffusion");
+            //ALOGV("\tReverb_setParameter() Called ReverbSetDiffusion");
             break;
         case REVERB_PARAM_DENSITY:
             ratio = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DENSITY value is %d", ratio);
-            //LOGV("\tReverb_setParameter() Calling ReverbSetDensity");
+            //ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DENSITY value is %d", ratio);
+            //ALOGV("\tReverb_setParameter() Calling ReverbSetDensity");
             ReverbSetDensity(pContext, ratio);
-            //LOGV("\tReverb_setParameter() Called ReverbSetDensity");
+            //ALOGV("\tReverb_setParameter() Called ReverbSetDensity");
             break;
            break;
         case REVERB_PARAM_REFLECTIONS_LEVEL:
@@ -1844,11 +1844,11 @@
         case REVERB_PARAM_REVERB_DELAY:
             break;
         default:
-            LOGV("\tLVM_ERROR : Reverb_setParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Reverb_setParameter() invalid param %d", param);
             break;
     }
 
-    //LOGV("\tReverb_setParameter end");
+    //ALOGV("\tReverb_setParameter end");
     return status;
 } /* end Reverb_setParameter */
 
@@ -1864,16 +1864,16 @@
     int    status = 0;
 
     if (pContext == NULL){
-        LOGV("\tLVM_ERROR : Reverb_process() ERROR pContext == NULL");
+        ALOGV("\tLVM_ERROR : Reverb_process() ERROR pContext == NULL");
         return -EINVAL;
     }
     if (inBuffer == NULL  || inBuffer->raw == NULL  ||
             outBuffer == NULL || outBuffer->raw == NULL ||
             inBuffer->frameCount != outBuffer->frameCount){
-        LOGV("\tLVM_ERROR : Reverb_process() ERROR NULL INPUT POINTER OR FRAME COUNT IS WRONG");
+        ALOGV("\tLVM_ERROR : Reverb_process() ERROR NULL INPUT POINTER OR FRAME COUNT IS WRONG");
         return -EINVAL;
     }
-    //LOGV("\tReverb_process() Calling process with %d frames", outBuffer->frameCount);
+    //ALOGV("\tReverb_process() Calling process with %d frames", outBuffer->frameCount);
     /* Process all the available frames, block processing is handled internalLY by the LVM bundle */
     status = process(    (LVM_INT16 *)inBuffer->raw,
                          (LVM_INT16 *)outBuffer->raw,
@@ -1905,19 +1905,19 @@
 
 
     if (pContext == NULL){
-        LOGV("\tLVM_ERROR : Reverb_command ERROR pContext == NULL");
+        ALOGV("\tLVM_ERROR : Reverb_command ERROR pContext == NULL");
         return -EINVAL;
     }
 
-    //LOGV("\tReverb_command INPUTS are: command %d cmdSize %d",cmdCode, cmdSize);
+    //ALOGV("\tReverb_command INPUTS are: command %d cmdSize %d",cmdCode, cmdSize);
 
     switch (cmdCode){
         case EFFECT_CMD_INIT:
-            //LOGV("\tReverb_command cmdCode Case: "
+            //ALOGV("\tReverb_command cmdCode Case: "
             //        "EFFECT_CMD_INIT start");
 
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_INIT: ERROR");
                 return -EINVAL;
             }
@@ -1925,13 +1925,13 @@
             break;
 
         case EFFECT_CMD_CONFIGURE:
-            //LOGV("\tReverb_command cmdCode Case: "
+            //ALOGV("\tReverb_command cmdCode Case: "
             //        "EFFECT_CMD_CONFIGURE start");
             if (pCmdData    == NULL||
                 cmdSize     != sizeof(effect_config_t)||
                 pReplyData  == NULL||
                 *replySize  != sizeof(int)){
-                LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_CONFIGURE: ERROR");
                 return -EINVAL;
             }
@@ -1939,19 +1939,19 @@
             break;
 
         case EFFECT_CMD_RESET:
-            //LOGV("\tReverb_command cmdCode Case: "
+            //ALOGV("\tReverb_command cmdCode Case: "
             //        "EFFECT_CMD_RESET start");
             Reverb_configure(pContext, &pContext->config);
             break;
 
         case EFFECT_CMD_GET_PARAM:{
-            //LOGV("\tReverb_command cmdCode Case: "
+            //ALOGV("\tReverb_command cmdCode Case: "
             //        "EFFECT_CMD_GET_PARAM start");
             if (pCmdData == NULL ||
                     cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
                     pReplyData == NULL ||
                     *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
-                LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_GET_PARAM: ERROR");
                 return -EINVAL;
             }
@@ -1970,7 +1970,7 @@
 
             *replySize = sizeof(effect_param_t) + voffset + p->vsize;
 
-            //LOGV("\tReverb_command EFFECT_CMD_GET_PARAM "
+            //ALOGV("\tReverb_command EFFECT_CMD_GET_PARAM "
             //        "*pCmdData %d, *replySize %d, *pReplyData %d ",
             //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
             //        *replySize,
@@ -1979,16 +1979,16 @@
         } break;
         case EFFECT_CMD_SET_PARAM:{
 
-            //LOGV("\tReverb_command cmdCode Case: "
+            //ALOGV("\tReverb_command cmdCode Case: "
             //        "EFFECT_CMD_SET_PARAM start");
-            //LOGV("\tReverb_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
+            //ALOGV("\tReverb_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
             //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
             //        *replySize,
             //        *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
 
             if (pCmdData == NULL || (cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)))
                     || pReplyData == NULL || *replySize != (int)sizeof(int32_t)) {
-                LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_SET_PARAM: ERROR");
                 return -EINVAL;
             }
@@ -1996,12 +1996,12 @@
             effect_param_t *p = (effect_param_t *) pCmdData;
 
             if (p->psize != sizeof(int32_t)){
-                LOGV("\t4LVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\t4LVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_SET_PARAM: ERROR, psize is not sizeof(int32_t)");
                 return -EINVAL;
             }
 
-            //LOGV("\tn5Reverb_command cmdSize is %d\n"
+            //ALOGV("\tn5Reverb_command cmdSize is %d\n"
             //        "\tsizeof(effect_param_t) is  %d\n"
             //        "\tp->psize is %d\n"
             //        "\tp->vsize is %d"
@@ -2014,16 +2014,16 @@
         } break;
 
         case EFFECT_CMD_ENABLE:
-            //LOGV("\tReverb_command cmdCode Case: "
+            //ALOGV("\tReverb_command cmdCode Case: "
             //        "EFFECT_CMD_ENABLE start");
 
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_ENABLE: ERROR");
                 return -EINVAL;
             }
             if(pContext->bEnabled == LVM_TRUE){
-                 LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                 ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                          "EFFECT_CMD_ENABLE: ERROR-Effect is already enabled");
                  return -EINVAL;
              }
@@ -2036,19 +2036,19 @@
                     (ActiveParams.T60 * pContext->config.inputCfg.samplingRate)/1000;
             // force no volume ramp for first buffer processed after enabling the effect
             pContext->volumeMode = android::REVERB_VOLUME_FLAT;
-            //LOGV("\tEFFECT_CMD_ENABLE SamplesToExitCount = %d", pContext->SamplesToExitCount);
+            //ALOGV("\tEFFECT_CMD_ENABLE SamplesToExitCount = %d", pContext->SamplesToExitCount);
             break;
         case EFFECT_CMD_DISABLE:
-            //LOGV("\tReverb_command cmdCode Case: "
+            //ALOGV("\tReverb_command cmdCode Case: "
             //        "EFFECT_CMD_DISABLE start");
 
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_DISABLE: ERROR");
                 return -EINVAL;
             }
             if(pContext->bEnabled == LVM_FALSE){
-                 LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                 ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                          "EFFECT_CMD_DISABLE: ERROR-Effect is not yet enabled");
                  return -EINVAL;
              }
@@ -2059,7 +2059,7 @@
         case EFFECT_CMD_SET_VOLUME:
             if (pCmdData == NULL ||
                 cmdSize != 2 * sizeof(uint32_t)) {
-                LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_SET_VOLUME: ERROR");
                 return -EINVAL;
             }
@@ -2079,23 +2079,23 @@
                 pContext->rightVolume = REVERB_UNIT_VOLUME;
                 pContext->volumeMode = android::REVERB_VOLUME_OFF;
             }
-            LOGV("EFFECT_CMD_SET_VOLUME left %d, right %d mode %d",
+            ALOGV("EFFECT_CMD_SET_VOLUME left %d, right %d mode %d",
                     pContext->leftVolume, pContext->rightVolume,  pContext->volumeMode);
             break;
 
         case EFFECT_CMD_SET_DEVICE:
         case EFFECT_CMD_SET_AUDIO_MODE:
-        //LOGV("\tReverb_command cmdCode Case: "
+        //ALOGV("\tReverb_command cmdCode Case: "
         //        "EFFECT_CMD_SET_DEVICE/EFFECT_CMD_SET_VOLUME/EFFECT_CMD_SET_AUDIO_MODE start");
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+            ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                     "DEFAULT start %d ERROR",cmdCode);
             return -EINVAL;
     }
 
-    //LOGV("\tReverb_command end\n\n");
+    //ALOGV("\tReverb_command end\n\n");
     return 0;
 }    /* end Reverb_command */
 
@@ -2107,7 +2107,7 @@
     const effect_descriptor_t *desc;
 
     if (pContext == NULL || pDescriptor == NULL) {
-        LOGV("Reverb_getDescriptor() invalid param");
+        ALOGV("Reverb_getDescriptor() invalid param");
         return -EINVAL;
     }
 
diff --git a/media/libeffects/preprocessing/PreProcessing.cpp b/media/libeffects/preprocessing/PreProcessing.cpp
index ba286a1..6267d1d 100755
--- a/media/libeffects/preprocessing/PreProcessing.cpp
+++ b/media/libeffects/preprocessing/PreProcessing.cpp
@@ -226,7 +226,7 @@
 
 int  AgcInit (preproc_effect_t *effect)
 {
-    LOGV("AgcInit");
+    ALOGV("AgcInit");
     webrtc::GainControl *agc = static_cast<webrtc::GainControl *>(effect->engine);
     agc->set_mode(webrtc::GainControl::kFixedDigital);
     agc->set_target_level_dbfs(kAgcDefaultTargetLevel);
@@ -238,9 +238,9 @@
 int  AgcCreate(preproc_effect_t *effect)
 {
     webrtc::GainControl *agc = effect->session->apm->gain_control();
-    LOGV("AgcCreate got agc %p", agc);
+    ALOGV("AgcCreate got agc %p", agc);
     if (agc == NULL) {
-        LOGW("AgcCreate Error");
+        ALOGW("AgcCreate Error");
         return -ENOMEM;
     }
     effect->engine = static_cast<preproc_fx_handle_t>(agc);
@@ -280,7 +280,7 @@
         break;
 
     default:
-        LOGW("AgcGetParameter() unknown param %08x", param);
+        ALOGW("AgcGetParameter() unknown param %08x", param);
         status = -EINVAL;
         break;
     }
@@ -288,15 +288,15 @@
     switch (param) {
     case AGC_PARAM_TARGET_LEVEL:
         *(int16_t *) pValue = (int16_t)(agc->target_level_dbfs() * -100);
-        LOGV("AgcGetParameter() target level %d milliBels", *(int16_t *) pValue);
+        ALOGV("AgcGetParameter() target level %d milliBels", *(int16_t *) pValue);
         break;
     case AGC_PARAM_COMP_GAIN:
         *(int16_t *) pValue = (int16_t)(agc->compression_gain_db() * 100);
-        LOGV("AgcGetParameter() comp gain %d milliBels", *(int16_t *) pValue);
+        ALOGV("AgcGetParameter() comp gain %d milliBels", *(int16_t *) pValue);
         break;
     case AGC_PARAM_LIMITER_ENA:
         *(bool *) pValue = (bool)agc->is_limiter_enabled();
-        LOGV("AgcGetParameter() limiter enabled %s",
+        ALOGV("AgcGetParameter() limiter enabled %s",
              (*(int16_t *) pValue != 0) ? "true" : "false");
         break;
     case AGC_PARAM_PROPERTIES:
@@ -305,7 +305,7 @@
         pProperties->limiterEnabled = (bool)agc->is_limiter_enabled();
         break;
     default:
-        LOGW("AgcGetParameter() unknown param %d", param);
+        ALOGW("AgcGetParameter() unknown param %d", param);
         status = -EINVAL;
         break;
     }
@@ -321,19 +321,19 @@
 
     switch (param) {
     case AGC_PARAM_TARGET_LEVEL:
-        LOGV("AgcSetParameter() target level %d milliBels", *(int16_t *)pValue);
+        ALOGV("AgcSetParameter() target level %d milliBels", *(int16_t *)pValue);
         status = agc->set_target_level_dbfs(-(*(int16_t *)pValue / 100));
         break;
     case AGC_PARAM_COMP_GAIN:
-        LOGV("AgcSetParameter() comp gain %d milliBels", *(int16_t *)pValue);
+        ALOGV("AgcSetParameter() comp gain %d milliBels", *(int16_t *)pValue);
         status = agc->set_compression_gain_db(*(int16_t *)pValue / 100);
         break;
     case AGC_PARAM_LIMITER_ENA:
-        LOGV("AgcSetParameter() limiter enabled %s", *(bool *)pValue ? "true" : "false");
+        ALOGV("AgcSetParameter() limiter enabled %s", *(bool *)pValue ? "true" : "false");
         status = agc->enable_limiter(*(bool *)pValue);
         break;
     case AGC_PARAM_PROPERTIES:
-        LOGV("AgcSetParameter() properties level %d, gain %d limiter %d",
+        ALOGV("AgcSetParameter() properties level %d, gain %d limiter %d",
              pProperties->targetLevel,
              pProperties->compGain,
              pProperties->limiterEnabled);
@@ -344,12 +344,12 @@
         status = agc->enable_limiter(pProperties->limiterEnabled);
         break;
     default:
-        LOGW("AgcSetParameter() unknown param %08x value %08x", param, *(uint32_t *)pValue);
+        ALOGW("AgcSetParameter() unknown param %08x value %08x", param, *(uint32_t *)pValue);
         status = -EINVAL;
         break;
     }
 
-    LOGV("AgcSetParameter() done status %d", status);
+    ALOGV("AgcSetParameter() done status %d", status);
 
     return status;
 }
@@ -357,13 +357,13 @@
 void AgcEnable(preproc_effect_t *effect)
 {
     webrtc::GainControl *agc = static_cast<webrtc::GainControl *>(effect->engine);
-    LOGV("AgcEnable agc %p", agc);
+    ALOGV("AgcEnable agc %p", agc);
     agc->Enable(true);
 }
 
 void AgcDisable(preproc_effect_t *effect)
 {
-    LOGV("AgcDisable");
+    ALOGV("AgcDisable");
     webrtc::GainControl *agc = static_cast<webrtc::GainControl *>(effect->engine);
     agc->Enable(false);
 }
@@ -391,7 +391,7 @@
 
 int  AecInit (preproc_effect_t *effect)
 {
-    LOGV("AecInit");
+    ALOGV("AecInit");
     webrtc::EchoControlMobile *aec = static_cast<webrtc::EchoControlMobile *>(effect->engine);
     aec->set_routing_mode(kAecDefaultMode);
     aec->enable_comfort_noise(kAecDefaultComfortNoise);
@@ -401,9 +401,9 @@
 int  AecCreate(preproc_effect_t *effect)
 {
     webrtc::EchoControlMobile *aec = effect->session->apm->echo_control_mobile();
-    LOGV("AecCreate got aec %p", aec);
+    ALOGV("AecCreate got aec %p", aec);
     if (aec == NULL) {
-        LOGW("AgcCreate Error");
+        ALOGW("AgcCreate Error");
         return -ENOMEM;
     }
     effect->engine = static_cast<preproc_fx_handle_t>(aec);
@@ -426,10 +426,10 @@
     case AEC_PARAM_ECHO_DELAY:
     case AEC_PARAM_PROPERTIES:
         *(uint32_t *)pValue = 1000 * effect->session->apm->stream_delay_ms();
-        LOGV("AecGetParameter() echo delay %d us", *(uint32_t *)pValue);
+        ALOGV("AecGetParameter() echo delay %d us", *(uint32_t *)pValue);
         break;
     default:
-        LOGW("AecGetParameter() unknown param %08x value %08x", param, *(uint32_t *)pValue);
+        ALOGW("AecGetParameter() unknown param %08x value %08x", param, *(uint32_t *)pValue);
         status = -EINVAL;
         break;
     }
@@ -446,10 +446,10 @@
     case AEC_PARAM_ECHO_DELAY:
     case AEC_PARAM_PROPERTIES:
         status = effect->session->apm->set_stream_delay_ms(value/1000);
-        LOGV("AecSetParameter() echo delay %d us, status %d", value, status);
+        ALOGV("AecSetParameter() echo delay %d us, status %d", value, status);
         break;
     default:
-        LOGW("AecSetParameter() unknown param %08x value %08x", param, *(uint32_t *)pValue);
+        ALOGW("AecSetParameter() unknown param %08x value %08x", param, *(uint32_t *)pValue);
         status = -EINVAL;
         break;
     }
@@ -459,20 +459,20 @@
 void AecEnable(preproc_effect_t *effect)
 {
     webrtc::EchoControlMobile *aec = static_cast<webrtc::EchoControlMobile *>(effect->engine);
-    LOGV("AecEnable aec %p", aec);
+    ALOGV("AecEnable aec %p", aec);
     aec->Enable(true);
 }
 
 void AecDisable(preproc_effect_t *effect)
 {
-    LOGV("AecDisable");
+    ALOGV("AecDisable");
     webrtc::EchoControlMobile *aec = static_cast<webrtc::EchoControlMobile *>(effect->engine);
     aec->Enable(false);
 }
 
 int AecSetDevice(preproc_effect_t *effect, uint32_t device)
 {
-    LOGV("AecSetDevice %08x", device);
+    ALOGV("AecSetDevice %08x", device);
     webrtc::EchoControlMobile *aec = static_cast<webrtc::EchoControlMobile *>(effect->engine);
     webrtc::EchoControlMobile::RoutingMode mode = webrtc::EchoControlMobile::kQuietEarpieceOrHeadset;
 
@@ -511,7 +511,7 @@
 
 int  NsInit (preproc_effect_t *effect)
 {
-    LOGV("NsInit");
+    ALOGV("NsInit");
     webrtc::NoiseSuppression *ns = static_cast<webrtc::NoiseSuppression *>(effect->engine);
     ns->set_level(kNsDefaultLevel);
     return 0;
@@ -520,9 +520,9 @@
 int  NsCreate(preproc_effect_t *effect)
 {
     webrtc::NoiseSuppression *ns = effect->session->apm->noise_suppression();
-    LOGV("NsCreate got ns %p", ns);
+    ALOGV("NsCreate got ns %p", ns);
     if (ns == NULL) {
-        LOGW("AgcCreate Error");
+        ALOGW("AgcCreate Error");
         return -ENOMEM;
     }
     effect->engine = static_cast<preproc_fx_handle_t>(ns);
@@ -548,13 +548,13 @@
 void NsEnable(preproc_effect_t *effect)
 {
     webrtc::NoiseSuppression *ns = static_cast<webrtc::NoiseSuppression *>(effect->engine);
-    LOGV("NsEnable ns %p", ns);
+    ALOGV("NsEnable ns %p", ns);
     ns->Enable(true);
 }
 
 void NsDisable(preproc_effect_t *effect)
 {
-    LOGV("NsDisable");
+    ALOGV("NsDisable");
     webrtc::NoiseSuppression *ns = static_cast<webrtc::NoiseSuppression *>(effect->engine);
     ns->Enable(false);
 }
@@ -593,7 +593,7 @@
 int Effect_SetState(preproc_effect_t *effect, uint32_t state)
 {
     int status = 0;
-    LOGV("Effect_SetState proc %d, new %d old %d", effect->procId, state, effect->state);
+    ALOGV("Effect_SetState proc %d, new %d old %d", effect->procId, state, effect->state);
     switch(state) {
     case PREPROC_EFFECT_STATE_INIT:
         switch(effect->state) {
@@ -616,7 +616,7 @@
         case PREPROC_EFFECT_STATE_CREATED:
         case PREPROC_EFFECT_STATE_ACTIVE:
         case PREPROC_EFFECT_STATE_CONFIG:
-            LOGE("Effect_SetState invalid transition");
+            ALOGE("Effect_SetState invalid transition");
             status = -ENOSYS;
             break;
         default:
@@ -626,7 +626,7 @@
     case PREPROC_EFFECT_STATE_CONFIG:
         switch(effect->state) {
         case PREPROC_EFFECT_STATE_INIT:
-            LOGE("Effect_SetState invalid transition");
+            ALOGE("Effect_SetState invalid transition");
             status = -ENOSYS;
             break;
         case PREPROC_EFFECT_STATE_ACTIVE:
@@ -645,7 +645,7 @@
         case PREPROC_EFFECT_STATE_INIT:
         case PREPROC_EFFECT_STATE_CREATED:
         case PREPROC_EFFECT_STATE_ACTIVE:
-            LOGE("Effect_SetState invalid transition");
+            ALOGE("Effect_SetState invalid transition");
             status = -ENOSYS;
             break;
         case PREPROC_EFFECT_STATE_CONFIG:
@@ -725,12 +725,12 @@
 {
     int status = -ENOMEM;
 
-    LOGV("Session_CreateEffect procId %d, createdMsk %08x", procId, session->createdMsk);
+    ALOGV("Session_CreateEffect procId %d, createdMsk %08x", procId, session->createdMsk);
 
     if (session->createdMsk == 0) {
         session->apm = webrtc::AudioProcessing::Create(session->io);
         if (session->apm == NULL) {
-            LOGW("Session_CreateEffect could not get apm engine");
+            ALOGW("Session_CreateEffect could not get apm engine");
             goto error;
         }
         session->apm->set_sample_rate_hz(kPreprocDefaultSr);
@@ -738,12 +738,12 @@
         session->apm->set_num_reverse_channels(kPreProcDefaultCnl);
         session->procFrame = new webrtc::AudioFrame();
         if (session->procFrame == NULL) {
-            LOGW("Session_CreateEffect could not allocate audio frame");
+            ALOGW("Session_CreateEffect could not allocate audio frame");
             goto error;
         }
         session->revFrame = new webrtc::AudioFrame();
         if (session->revFrame == NULL) {
-            LOGW("Session_CreateEffect could not allocate reverse audio frame");
+            ALOGW("Session_CreateEffect could not allocate reverse audio frame");
             goto error;
         }
         session->apmSamplingRate = kPreprocDefaultSr;
@@ -775,7 +775,7 @@
     if (status < 0) {
         goto error;
     }
-    LOGV("Session_CreateEffect OK");
+    ALOGV("Session_CreateEffect OK");
     session->createdMsk |= (1<<procId);
     return status;
 
@@ -794,7 +794,7 @@
 int Session_ReleaseEffect(preproc_session_t *session,
                           preproc_effect_t *fx)
 {
-    LOGW_IF(Effect_Release(fx) != 0, " Effect_Release() failed for proc ID %d", fx->procId);
+    ALOGW_IF(Effect_Release(fx) != 0, " Effect_Release() failed for proc ID %d", fx->procId);
     session->createdMsk &= ~(1<<fx->procId);
     if (session->createdMsk == 0) {
         webrtc::AudioProcessing::Destroy(session->apm);
@@ -841,7 +841,7 @@
         return -EINVAL;
     }
 
-    LOGV("Session_SetConfig sr %d cnl %08x",
+    ALOGV("Session_SetConfig sr %d cnl %08x",
          config->inputCfg.samplingRate, config->inputCfg.channels);
     int status;
 
@@ -904,7 +904,7 @@
                                                     RESAMPLER_QUALITY,
                                                     &error);
         if (session->inResampler == NULL) {
-            LOGW("Session_SetConfig Cannot create speex resampler: %s",
+            ALOGW("Session_SetConfig Cannot create speex resampler: %s",
                  speex_resampler_strerror(error));
             return -EINVAL;
         }
@@ -914,7 +914,7 @@
                                                     RESAMPLER_QUALITY,
                                                     &error);
         if (session->outResampler == NULL) {
-            LOGW("Session_SetConfig Cannot create speex resampler: %s",
+            ALOGW("Session_SetConfig Cannot create speex resampler: %s",
                  speex_resampler_strerror(error));
             speex_resampler_destroy(session->inResampler);
             session->inResampler = NULL;
@@ -926,7 +926,7 @@
                                                     RESAMPLER_QUALITY,
                                                     &error);
         if (session->revResampler == NULL) {
-            LOGW("Session_SetConfig Cannot create speex resampler: %s",
+            ALOGW("Session_SetConfig Cannot create speex resampler: %s",
                  speex_resampler_strerror(error));
             speex_resampler_destroy(session->inResampler);
             session->inResampler = NULL;
@@ -948,7 +948,7 @@
         return -EINVAL;
     }
 
-    LOGV("Session_SetReverseConfig sr %d cnl %08x",
+    ALOGV("Session_SetReverseConfig sr %d cnl %08x",
          config->inputCfg.samplingRate, config->inputCfg.channels);
 
     if (session->state < PREPROC_SESSION_STATE_CONFIG) {
@@ -996,7 +996,7 @@
             session->revEnabledMsk &= ~(1 << procId);
         }
     }
-    LOGV("Session_SetProcEnabled proc %d, enabled %d enabledMsk %08x revEnabledMsk %08x",
+    ALOGV("Session_SetProcEnabled proc %d, enabled %d enabledMsk %08x revEnabledMsk %08x",
          procId, enabled, session->enabledMsk, session->revEnabledMsk);
     session->processedMsk = 0;
     if (HasReverseStream(procId)) {
@@ -1074,20 +1074,20 @@
     int    status = 0;
 
     if (effect == NULL){
-        LOGV("PreProcessingFx_Process() ERROR effect == NULL");
+        ALOGV("PreProcessingFx_Process() ERROR effect == NULL");
         return -EINVAL;
     }
     preproc_session_t * session = (preproc_session_t *)effect->session;
 
     if (inBuffer == NULL  || inBuffer->raw == NULL  ||
             outBuffer == NULL || outBuffer->raw == NULL){
-        LOGW("PreProcessingFx_Process() ERROR bad pointer");
+        ALOGW("PreProcessingFx_Process() ERROR bad pointer");
         return -EINVAL;
     }
 
     session->processedMsk |= (1<<effect->procId);
 
-//    LOGV("PreProcessingFx_Process In %d frames enabledMsk %08x processedMsk %08x",
+//    ALOGV("PreProcessingFx_Process In %d frames enabledMsk %08x processedMsk %08x",
 //         inBuffer->frameCount, session->enabledMsk, session->processedMsk);
 
     if ((session->processedMsk & session->enabledMsk) == session->enabledMsk) {
@@ -1237,7 +1237,7 @@
         return -EINVAL;
     }
 
-    //LOGV("PreProcessingFx_Command: command %d cmdSize %d",cmdCode, cmdSize);
+    //ALOGV("PreProcessingFx_Command: command %d cmdSize %d",cmdCode, cmdSize);
 
     switch (cmdCode){
         case EFFECT_CMD_INIT:
@@ -1255,7 +1255,7 @@
                 cmdSize     != sizeof(effect_config_t)||
                 pReplyData  == NULL||
                 *replySize  != sizeof(int)){
-                LOGV("PreProcessingFx_Command cmdCode Case: "
+                ALOGV("PreProcessingFx_Command cmdCode Case: "
                         "EFFECT_CMD_CONFIGURE: ERROR");
                 return -EINVAL;
             }
@@ -1271,7 +1271,7 @@
                 cmdSize     != sizeof(effect_config_t)||
                 pReplyData  == NULL||
                 *replySize  != sizeof(int)){
-                LOGV("PreProcessingFx_Command cmdCode Case: "
+                ALOGV("PreProcessingFx_Command cmdCode Case: "
                         "EFFECT_CMD_CONFIGURE_REVERSE: ERROR");
                 return -EINVAL;
             }
@@ -1293,7 +1293,7 @@
                     cmdSize < (int)sizeof(effect_param_t) ||
                     pReplyData == NULL ||
                     *replySize < (int)sizeof(effect_param_t)){
-                LOGV("PreProcessingFx_Command cmdCode Case: "
+                ALOGV("PreProcessingFx_Command cmdCode Case: "
                         "EFFECT_CMD_GET_PARAM: ERROR");
                 return -EINVAL;
             }
@@ -1318,14 +1318,14 @@
                     cmdSize < (int)sizeof(effect_param_t) ||
                     pReplyData == NULL ||
                     *replySize != sizeof(int32_t)){
-                LOGV("PreProcessingFx_Command cmdCode Case: "
+                ALOGV("PreProcessingFx_Command cmdCode Case: "
                         "EFFECT_CMD_SET_PARAM: ERROR");
                 return -EINVAL;
             }
             effect_param_t *p = (effect_param_t *) pCmdData;
 
             if (p->psize != sizeof(int32_t)){
-                LOGV("PreProcessingFx_Command cmdCode Case: "
+                ALOGV("PreProcessingFx_Command cmdCode Case: "
                         "EFFECT_CMD_SET_PARAM: ERROR, psize is not sizeof(int32_t)");
                 return -EINVAL;
             }
@@ -1338,7 +1338,7 @@
 
         case EFFECT_CMD_ENABLE:
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("PreProcessingFx_Command cmdCode Case: EFFECT_CMD_ENABLE: ERROR");
+                ALOGV("PreProcessingFx_Command cmdCode Case: EFFECT_CMD_ENABLE: ERROR");
                 return -EINVAL;
             }
             *(int *)pReplyData = Effect_SetState(effect, PREPROC_EFFECT_STATE_ACTIVE);
@@ -1346,7 +1346,7 @@
 
         case EFFECT_CMD_DISABLE:
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("PreProcessingFx_Command cmdCode Case: EFFECT_CMD_DISABLE: ERROR");
+                ALOGV("PreProcessingFx_Command cmdCode Case: EFFECT_CMD_DISABLE: ERROR");
                 return -EINVAL;
             }
             *(int *)pReplyData  = Effect_SetState(effect, PREPROC_EFFECT_STATE_CONFIG);
@@ -1356,7 +1356,7 @@
         case EFFECT_CMD_SET_INPUT_DEVICE:
             if (pCmdData == NULL ||
                 cmdSize != sizeof(uint32_t)) {
-                LOGV("PreProcessingFx_Command cmdCode Case: EFFECT_CMD_SET_DEVICE: ERROR");
+                ALOGV("PreProcessingFx_Command cmdCode Case: EFFECT_CMD_SET_DEVICE: ERROR");
                 return -EINVAL;
             }
 
@@ -1398,19 +1398,19 @@
     int    status = 0;
 
     if (effect == NULL){
-        LOGW("PreProcessingFx_ProcessReverse() ERROR effect == NULL");
+        ALOGW("PreProcessingFx_ProcessReverse() ERROR effect == NULL");
         return -EINVAL;
     }
     preproc_session_t * session = (preproc_session_t *)effect->session;
 
     if (inBuffer == NULL  || inBuffer->raw == NULL){
-        LOGW("PreProcessingFx_ProcessReverse() ERROR bad pointer");
+        ALOGW("PreProcessingFx_ProcessReverse() ERROR bad pointer");
         return -EINVAL;
     }
 
     session->revProcessedMsk |= (1<<effect->procId);
 
-//    LOGV("PreProcessingFx_ProcessReverse In %d frames revEnabledMsk %08x revProcessedMsk %08x",
+//    ALOGV("PreProcessingFx_ProcessReverse In %d frames revEnabledMsk %08x revProcessedMsk %08x",
 //         inBuffer->frameCount, session->revEnabledMsk, session->revProcessedMsk);
 
 
@@ -1528,7 +1528,7 @@
                             int32_t             ioId,
                             effect_handle_t  *pInterface)
 {
-    LOGV("EffectCreate: uuid: %08x session %d IO: %d", uuid->timeLow, sessionId, ioId);
+    ALOGV("EffectCreate: uuid: %08x session %d IO: %d", uuid->timeLow, sessionId, ioId);
 
     int status;
     const effect_descriptor_t *desc;
@@ -1540,14 +1540,14 @@
     }
     desc =  PreProc_GetDescriptor(uuid);
     if (desc == NULL) {
-        LOGW("EffectCreate: fx not found uuid: %08x", uuid->timeLow);
+        ALOGW("EffectCreate: fx not found uuid: %08x", uuid->timeLow);
         return -EINVAL;
     }
     procId = UuidToProcId(&desc->type);
 
     session = PreProc_GetSession(procId, sessionId, ioId);
     if (session == NULL) {
-        LOGW("EffectCreate: no more session available");
+        ALOGW("EffectCreate: no more session available");
         return -EINVAL;
     }
 
@@ -1562,7 +1562,7 @@
 int PreProcessingLib_Release(effect_handle_t interface)
 {
     int status;
-    LOGV("EffectRelease start %p", interface);
+    ALOGV("EffectRelease start %p", interface);
     if (PreProc_Init() != 0) {
         return sInitStatus;
     }
@@ -1584,11 +1584,11 @@
 
     const effect_descriptor_t *desc = PreProc_GetDescriptor(uuid);
     if (desc == NULL) {
-        LOGV("PreProcessingLib_GetDescriptor() not found");
+        ALOGV("PreProcessingLib_GetDescriptor() not found");
         return  -EINVAL;
     }
 
-    LOGV("PreProcessingLib_GetDescriptor() got fx %s", desc->name);
+    ALOGV("PreProcessingLib_GetDescriptor() got fx %s", desc->name);
 
     memcpy(pDescriptor, desc, sizeof(effect_descriptor_t));
     return 0;
diff --git a/media/libeffects/testlibs/AudioEqualizer.cpp b/media/libeffects/testlibs/AudioEqualizer.cpp
index 44c9476..4f3a308 100644
--- a/media/libeffects/testlibs/AudioEqualizer.cpp
+++ b/media/libeffects/testlibs/AudioEqualizer.cpp
@@ -39,7 +39,7 @@
                                                 int nChannels, int sampleRate,
                                                 const PresetConfig * presets,
                                                 int nPresets) {
-    LOGV("AudioEqualizer::CreateInstance(pMem=%p, nBands=%d, nChannels=%d, "
+    ALOGV("AudioEqualizer::CreateInstance(pMem=%p, nBands=%d, nChannels=%d, "
          "sampleRate=%d, nPresets=%d)",
          pMem, nBands, nChannels, sampleRate, nPresets);
     assert(nBands >= 2);
@@ -56,7 +56,7 @@
 }
 
 void AudioEqualizer::configure(int nChannels, int sampleRate) {
-    LOGV("AudioEqualizer::configure(nChannels=%d, sampleRate=%d)", nChannels,
+    ALOGV("AudioEqualizer::configure(nChannels=%d, sampleRate=%d)", nChannels,
          sampleRate);
     mpLowShelf->configure(nChannels, sampleRate);
     for (int i = 0; i < mNumPeaking; ++i) {
@@ -66,7 +66,7 @@
 }
 
 void AudioEqualizer::clear() {
-    LOGV("AudioEqualizer::clear()");
+    ALOGV("AudioEqualizer::clear()");
     mpLowShelf->clear();
     for (int i = 0; i < mNumPeaking; ++i) {
         mpPeakingFilters[i].clear();
@@ -75,14 +75,14 @@
 }
 
 void AudioEqualizer::free() {
-    LOGV("AudioEqualizer::free()");
+    ALOGV("AudioEqualizer::free()");
     if (mpMem != NULL) {
         ::free(mpMem);
     }
 }
 
 void AudioEqualizer::reset() {
-    LOGV("AudioEqualizer::reset()");
+    ALOGV("AudioEqualizer::reset()");
     const int32_t bottom = Effects_log2(kMinFreq);
     const int32_t top = Effects_log2(mSampleRate * 500);
     const int32_t jump = (top - bottom) / (mNumPeaking + 2);
@@ -103,7 +103,7 @@
 }
 
 void AudioEqualizer::setGain(int band, int32_t millibel) {
-    LOGV("AudioEqualizer::setGain(band=%d, millibel=%d)", band, millibel);
+    ALOGV("AudioEqualizer::setGain(band=%d, millibel=%d)", band, millibel);
     assert(band >= 0 && band < mNumPeaking + 2);
     if (band == 0) {
         mpLowShelf->setGain(millibel);
@@ -116,7 +116,7 @@
 }
 
 void AudioEqualizer::setFrequency(int band, uint32_t millihertz) {
-    LOGV("AudioEqualizer::setFrequency(band=%d, millihertz=%d)", band,
+    ALOGV("AudioEqualizer::setFrequency(band=%d, millihertz=%d)", band,
          millihertz);
     assert(band >= 0 && band < mNumPeaking + 2);
     if (band == 0) {
@@ -130,7 +130,7 @@
 }
 
 void AudioEqualizer::setBandwidth(int band, uint32_t cents) {
-    LOGV("AudioEqualizer::setBandwidth(band=%d, cents=%d)", band, cents);
+    ALOGV("AudioEqualizer::setBandwidth(band=%d, cents=%d)", band, cents);
     assert(band >= 0 && band < mNumPeaking + 2);
     if (band > 0 && band < mNumPeaking + 1) {
         mpPeakingFilters[band - 1].setBandwidth(cents);
@@ -201,7 +201,7 @@
 }
 
 void AudioEqualizer::setPreset(int preset) {
-    LOGV("AudioEqualizer::setPreset(preset=%d)", preset);
+    ALOGV("AudioEqualizer::setPreset(preset=%d)", preset);
     assert(preset < mNumPresets && preset >= 0);
     const PresetConfig &presetCfg = mpPresets[preset];
     for (int band = 0; band < (mNumPeaking + 2); ++band) {
@@ -214,7 +214,7 @@
 }
 
 void AudioEqualizer::commit(bool immediate) {
-    LOGV("AudioEqualizer::commit(immediate=%d)", immediate);
+    ALOGV("AudioEqualizer::commit(immediate=%d)", immediate);
     mpLowShelf->commit(immediate);
     for (int i = 0; i < mNumPeaking; ++i) {
         mpPeakingFilters[i].commit(immediate);
@@ -225,7 +225,7 @@
 void AudioEqualizer::process(const audio_sample_t * pIn,
                              audio_sample_t * pOut,
                              int frameCount) {
-//    LOGV("AudioEqualizer::process(frameCount=%d)", frameCount);
+//    ALOGV("AudioEqualizer::process(frameCount=%d)", frameCount);
     mpLowShelf->process(pIn, pOut, frameCount);
     for (int i = 0; i < mNumPeaking; ++i) {
         mpPeakingFilters[i].process(pIn, pOut, frameCount);
@@ -234,7 +234,7 @@
 }
 
 void AudioEqualizer::enable(bool immediate) {
-    LOGV("AudioEqualizer::enable(immediate=%d)", immediate);
+    ALOGV("AudioEqualizer::enable(immediate=%d)", immediate);
     mpLowShelf->enable(immediate);
     for (int i = 0; i < mNumPeaking; ++i) {
         mpPeakingFilters[i].enable(immediate);
@@ -243,7 +243,7 @@
 }
 
 void AudioEqualizer::disable(bool immediate) {
-    LOGV("AudioEqualizer::disable(immediate=%d)", immediate);
+    ALOGV("AudioEqualizer::disable(immediate=%d)", immediate);
     mpLowShelf->disable(immediate);
     for (int i = 0; i < mNumPeaking; ++i) {
         mpPeakingFilters[i].disable(immediate);
diff --git a/media/libeffects/testlibs/EffectEqualizer.cpp b/media/libeffects/testlibs/EffectEqualizer.cpp
index b22ebec..43f34de 100644
--- a/media/libeffects/testlibs/EffectEqualizer.cpp
+++ b/media/libeffects/testlibs/EffectEqualizer.cpp
@@ -147,7 +147,7 @@
     int ret;
     int i;
 
-    LOGV("EffectLibCreateEffect start");
+    ALOGV("EffectLibCreateEffect start");
 
     if (pHandle == NULL || uuid == NULL) {
         return -EINVAL;
@@ -165,7 +165,7 @@
 
     ret = Equalizer_init(pContext);
     if (ret < 0) {
-        LOGW("EffectLibCreateEffect() init failed");
+        ALOGW("EffectLibCreateEffect() init failed");
         delete pContext;
         return ret;
     }
@@ -173,7 +173,7 @@
     *pHandle = (effect_handle_t)pContext;
     pContext->state = EQUALIZER_STATE_INITIALIZED;
 
-    LOGV("EffectLibCreateEffect %p, size %d",
+    ALOGV("EffectLibCreateEffect %p, size %d",
          pContext, AudioEqualizer::GetInstanceSize(kNumBands)+sizeof(EqualizerContext));
 
     return 0;
@@ -183,7 +183,7 @@
 extern "C" int EffectRelease(effect_handle_t handle) {
     EqualizerContext * pContext = (EqualizerContext *)handle;
 
-    LOGV("EffectLibReleaseEffect %p", handle);
+    ALOGV("EffectLibReleaseEffect %p", handle);
     if (pContext == NULL) {
         return -EINVAL;
     }
@@ -199,7 +199,7 @@
                                    effect_descriptor_t *pDescriptor) {
 
     if (pDescriptor == NULL || uuid == NULL){
-        LOGV("EffectGetDescriptor() called with NULL pointer");
+        ALOGV("EffectGetDescriptor() called with NULL pointer");
         return -EINVAL;
     }
 
@@ -218,7 +218,7 @@
 
 #define CHECK_ARG(cond) {                     \
     if (!(cond)) {                            \
-        LOGV("Invalid argument: "#cond);      \
+        ALOGV("Invalid argument: "#cond);      \
         return -EINVAL;                       \
     }                                         \
 }
@@ -239,7 +239,7 @@
 
 int Equalizer_configure(EqualizerContext *pContext, effect_config_t *pConfig)
 {
-    LOGV("Equalizer_configure start");
+    ALOGV("Equalizer_configure start");
 
     CHECK_ARG(pContext != NULL);
     CHECK_ARG(pConfig != NULL);
@@ -292,7 +292,7 @@
 {
     int status;
 
-    LOGV("Equalizer_init start");
+    ALOGV("Equalizer_init start");
 
     CHECK_ARG(pContext != NULL);
 
@@ -416,13 +416,13 @@
     switch (param) {
     case EQ_PARAM_NUM_BANDS:
         *(uint16_t *)pValue = (uint16_t)kNumBands;
-        LOGV("Equalizer_getParameter() EQ_PARAM_NUM_BANDS %d", *(int16_t *)pValue);
+        ALOGV("Equalizer_getParameter() EQ_PARAM_NUM_BANDS %d", *(int16_t *)pValue);
         break;
 
     case EQ_PARAM_LEVEL_RANGE:
         *(int16_t *)pValue = -9600;
         *((int16_t *)pValue + 1) = 4800;
-        LOGV("Equalizer_getParameter() EQ_PARAM_LEVEL_RANGE min %d, max %d",
+        ALOGV("Equalizer_getParameter() EQ_PARAM_LEVEL_RANGE min %d, max %d",
              *(int32_t *)pValue, *((int32_t *)pValue + 1));
         break;
 
@@ -433,7 +433,7 @@
             break;
         }
         *(int16_t *)pValue = (int16_t)pEqualizer->getGain(param2);
-        LOGV("Equalizer_getParameter() EQ_PARAM_BAND_LEVEL band %d, level %d",
+        ALOGV("Equalizer_getParameter() EQ_PARAM_BAND_LEVEL band %d, level %d",
              param2, *(int32_t *)pValue);
         break;
 
@@ -444,7 +444,7 @@
             break;
         }
         *(int32_t *)pValue = pEqualizer->getFrequency(param2);
-        LOGV("Equalizer_getParameter() EQ_PARAM_CENTER_FREQ band %d, frequency %d",
+        ALOGV("Equalizer_getParameter() EQ_PARAM_CENTER_FREQ band %d, frequency %d",
              param2, *(int32_t *)pValue);
         break;
 
@@ -455,25 +455,25 @@
             break;
         }
         pEqualizer->getBandRange(param2, *(uint32_t *)pValue, *((uint32_t *)pValue + 1));
-        LOGV("Equalizer_getParameter() EQ_PARAM_BAND_FREQ_RANGE band %d, min %d, max %d",
+        ALOGV("Equalizer_getParameter() EQ_PARAM_BAND_FREQ_RANGE band %d, min %d, max %d",
              param2, *(int32_t *)pValue, *((int32_t *)pValue + 1));
         break;
 
     case EQ_PARAM_GET_BAND:
         param2 = *pParam;
         *(uint16_t *)pValue = (uint16_t)pEqualizer->getMostRelevantBand(param2);
-        LOGV("Equalizer_getParameter() EQ_PARAM_GET_BAND frequency %d, band %d",
+        ALOGV("Equalizer_getParameter() EQ_PARAM_GET_BAND frequency %d, band %d",
              param2, *(int32_t *)pValue);
         break;
 
     case EQ_PARAM_CUR_PRESET:
         *(uint16_t *)pValue = (uint16_t)pEqualizer->getPreset();
-        LOGV("Equalizer_getParameter() EQ_PARAM_CUR_PRESET %d", *(int32_t *)pValue);
+        ALOGV("Equalizer_getParameter() EQ_PARAM_CUR_PRESET %d", *(int32_t *)pValue);
         break;
 
     case EQ_PARAM_GET_NUM_OF_PRESETS:
         *(uint16_t *)pValue = (uint16_t)pEqualizer->getNumPresets();
-        LOGV("Equalizer_getParameter() EQ_PARAM_GET_NUM_OF_PRESETS %d", *(int16_t *)pValue);
+        ALOGV("Equalizer_getParameter() EQ_PARAM_GET_NUM_OF_PRESETS %d", *(int16_t *)pValue);
         break;
 
     case EQ_PARAM_GET_PRESET_NAME:
@@ -486,13 +486,13 @@
         strncpy(name, pEqualizer->getPresetName(param2), *pValueSize - 1);
         name[*pValueSize - 1] = 0;
         *pValueSize = strlen(name) + 1;
-        LOGV("Equalizer_getParameter() EQ_PARAM_GET_PRESET_NAME preset %d, name %s len %d",
+        ALOGV("Equalizer_getParameter() EQ_PARAM_GET_PRESET_NAME preset %d, name %s len %d",
              param2, gEqualizerPresets[param2].name, *pValueSize);
         break;
 
     case EQ_PARAM_PROPERTIES: {
         int16_t *p = (int16_t *)pValue;
-        LOGV("Equalizer_getParameter() EQ_PARAM_PROPERTIES");
+        ALOGV("Equalizer_getParameter() EQ_PARAM_PROPERTIES");
         p[0] = (int16_t)pEqualizer->getPreset();
         p[1] = (int16_t)kNumBands;
         for (int i = 0; i < kNumBands; i++) {
@@ -501,7 +501,7 @@
     } break;
 
     default:
-        LOGV("Equalizer_getParameter() invalid param %d", param);
+        ALOGV("Equalizer_getParameter() invalid param %d", param);
         status = -EINVAL;
         break;
     }
@@ -541,7 +541,7 @@
     case EQ_PARAM_CUR_PRESET:
         preset = (int32_t)(*(uint16_t *)pValue);
 
-        LOGV("setParameter() EQ_PARAM_CUR_PRESET %d", preset);
+        ALOGV("setParameter() EQ_PARAM_CUR_PRESET %d", preset);
         if (preset < 0 || preset >= pEqualizer->getNumPresets()) {
             status = -EINVAL;
             break;
@@ -552,7 +552,7 @@
     case EQ_PARAM_BAND_LEVEL:
         band =  *pParam;
         level = (int32_t)(*(int16_t *)pValue);
-        LOGV("setParameter() EQ_PARAM_BAND_LEVEL band %d, level %d", band, level);
+        ALOGV("setParameter() EQ_PARAM_BAND_LEVEL band %d, level %d", band, level);
         if (band >= kNumBands) {
             status = -EINVAL;
             break;
@@ -561,7 +561,7 @@
         pEqualizer->commit(true);
        break;
     case EQ_PARAM_PROPERTIES: {
-        LOGV("setParameter() EQ_PARAM_PROPERTIES");
+        ALOGV("setParameter() EQ_PARAM_PROPERTIES");
         int16_t *p = (int16_t *)pValue;
         if ((int)p[0] >= pEqualizer->getNumPresets()) {
             status = -EINVAL;
@@ -581,7 +581,7 @@
         pEqualizer->commit(true);
     } break;
     default:
-        LOGV("setParameter() invalid param %d", param);
+        ALOGV("setParameter() invalid param %d", param);
         status = -EINVAL;
         break;
     }
@@ -634,7 +634,7 @@
 
     android::AudioEqualizer * pEqualizer = pContext->pEqualizer;
 
-    LOGV("Equalizer_command command %d cmdSize %d",cmdCode, cmdSize);
+    ALOGV("Equalizer_command command %d cmdSize %d",cmdCode, cmdSize);
 
     switch (cmdCode) {
     case EFFECT_CMD_INIT:
@@ -666,14 +666,14 @@
         p->status = android::Equalizer_getParameter(pEqualizer, (int32_t *)p->data, &p->vsize,
                 p->data + voffset);
         *replySize = sizeof(effect_param_t) + voffset + p->vsize;
-        LOGV("Equalizer_command EFFECT_CMD_GET_PARAM *pCmdData %d, *replySize %d, *pReplyData %08x %08x",
+        ALOGV("Equalizer_command EFFECT_CMD_GET_PARAM *pCmdData %d, *replySize %d, *pReplyData %08x %08x",
                 *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)), *replySize,
                 *(int32_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset),
                 *(int32_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset + sizeof(int32_t)));
 
         } break;
     case EFFECT_CMD_SET_PARAM: {
-        LOGV("Equalizer_command EFFECT_CMD_SET_PARAM cmdSize %d pCmdData %p, *replySize %d, pReplyData %p",
+        ALOGV("Equalizer_command EFFECT_CMD_SET_PARAM cmdSize %d pCmdData %p, *replySize %d, pReplyData %p",
              cmdSize, pCmdData, *replySize, pReplyData);
         if (pCmdData == NULL || cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
             pReplyData == NULL || *replySize != sizeof(int32_t)) {
@@ -691,7 +691,7 @@
             return -ENOSYS;
         }
         pContext->state = EQUALIZER_STATE_ACTIVE;
-        LOGV("EFFECT_CMD_ENABLE() OK");
+        ALOGV("EFFECT_CMD_ENABLE() OK");
         *(int *)pReplyData = 0;
         break;
     case EFFECT_CMD_DISABLE:
@@ -702,7 +702,7 @@
             return -ENOSYS;
         }
         pContext->state = EQUALIZER_STATE_INITIALIZED;
-        LOGV("EFFECT_CMD_DISABLE() OK");
+        ALOGV("EFFECT_CMD_DISABLE() OK");
         *(int *)pReplyData = 0;
         break;
     case EFFECT_CMD_SET_DEVICE:
@@ -710,7 +710,7 @@
     case EFFECT_CMD_SET_AUDIO_MODE:
         break;
     default:
-        LOGW("Equalizer_command invalid command %d",cmdCode);
+        ALOGW("Equalizer_command invalid command %d",cmdCode);
         return -EINVAL;
     }
 
@@ -723,7 +723,7 @@
     android::EqualizerContext * pContext = (android::EqualizerContext *) self;
 
     if (pContext == NULL || pDescriptor == NULL) {
-        LOGV("Equalizer_getDescriptor() invalid param");
+        ALOGV("Equalizer_getDescriptor() invalid param");
         return -EINVAL;
     }
 
diff --git a/media/libeffects/testlibs/EffectReverb.c b/media/libeffects/testlibs/EffectReverb.c
index 405f908..d22868a 100644
--- a/media/libeffects/testlibs/EffectReverb.c
+++ b/media/libeffects/testlibs/EffectReverb.c
@@ -122,7 +122,7 @@
     int aux = 0;
     int preset = 0;
 
-    LOGV("EffectLibCreateEffect start");
+    ALOGV("EffectLibCreateEffect start");
 
     if (pHandle == NULL || uuid == NULL) {
         return -EINVAL;
@@ -154,7 +154,7 @@
     }
     ret = Reverb_Init(module, aux, preset);
     if (ret < 0) {
-        LOGW("EffectLibCreateEffect() init failed");
+        ALOGW("EffectLibCreateEffect() init failed");
         free(module);
         return ret;
     }
@@ -163,7 +163,7 @@
 
     module->context.mState = REVERB_STATE_INITIALIZED;
 
-    LOGV("EffectLibCreateEffect %p ,size %d", module, sizeof(reverb_module_t));
+    ALOGV("EffectLibCreateEffect %p ,size %d", module, sizeof(reverb_module_t));
 
     return 0;
 }
@@ -171,7 +171,7 @@
 int EffectRelease(effect_handle_t handle) {
     reverb_module_t *pRvbModule = (reverb_module_t *)handle;
 
-    LOGV("EffectLibReleaseEffect %p", handle);
+    ALOGV("EffectLibReleaseEffect %p", handle);
     if (handle == NULL) {
         return -EINVAL;
     }
@@ -188,14 +188,14 @@
     int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
 
     if (pDescriptor == NULL || uuid == NULL){
-        LOGV("EffectGetDescriptor() called with NULL pointer");
+        ALOGV("EffectGetDescriptor() called with NULL pointer");
         return -EINVAL;
     }
 
     for (i = 0; i < length; i++) {
         if (memcmp(uuid, &gDescriptors[i]->uuid, sizeof(effect_uuid_t)) == 0) {
             memcpy(pDescriptor, gDescriptors[i], sizeof(effect_descriptor_t));
-            LOGV("EffectGetDescriptor - UUID matched Reverb type %d, UUID = %x",
+            ALOGV("EffectGetDescriptor - UUID matched Reverb type %d, UUID = %x",
                  i, gDescriptors[i]->uuid.timeLow);
             return 0;
         }
@@ -306,7 +306,7 @@
 
     pReverb = (reverb_object_t*) &pRvbModule->context;
 
-    LOGV("Reverb_Command command %d cmdSize %d",cmdCode, cmdSize);
+    ALOGV("Reverb_Command command %d cmdSize %d",cmdCode, cmdSize);
 
     switch (cmdCode) {
     case EFFECT_CMD_INIT:
@@ -330,7 +330,7 @@
         Reverb_Reset(pReverb, false);
         break;
     case EFFECT_CMD_GET_PARAM:
-        LOGV("Reverb_Command EFFECT_CMD_GET_PARAM pCmdData %p, *replySize %d, pReplyData: %p",pCmdData, *replySize, pReplyData);
+        ALOGV("Reverb_Command EFFECT_CMD_GET_PARAM pCmdData %p, *replySize %d, pReplyData: %p",pCmdData, *replySize, pReplyData);
 
         if (pCmdData == NULL || cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
             pReplyData == NULL || *replySize < (int) sizeof(effect_param_t)) {
@@ -338,13 +338,13 @@
         }
         effect_param_t *rep = (effect_param_t *) pReplyData;
         memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + sizeof(int32_t));
-        LOGV("Reverb_Command EFFECT_CMD_GET_PARAM param %d, replySize %d",*(int32_t *)rep->data, rep->vsize);
+        ALOGV("Reverb_Command EFFECT_CMD_GET_PARAM param %d, replySize %d",*(int32_t *)rep->data, rep->vsize);
         rep->status = Reverb_getParameter(pReverb, *(int32_t *)rep->data, &rep->vsize,
                 rep->data + sizeof(int32_t));
         *replySize = sizeof(effect_param_t) + sizeof(int32_t) + rep->vsize;
         break;
     case EFFECT_CMD_SET_PARAM:
-        LOGV("Reverb_Command EFFECT_CMD_SET_PARAM cmdSize %d pCmdData %p, *replySize %d, pReplyData %p",
+        ALOGV("Reverb_Command EFFECT_CMD_SET_PARAM cmdSize %d pCmdData %p, *replySize %d, pReplyData %p",
                 cmdSize, pCmdData, *replySize, pReplyData);
         if (pCmdData == NULL || (cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)))
                 || pReplyData == NULL || *replySize != (int)sizeof(int32_t)) {
@@ -362,7 +362,7 @@
             return -ENOSYS;
         }
         pReverb->mState = REVERB_STATE_ACTIVE;
-        LOGV("EFFECT_CMD_ENABLE() OK");
+        ALOGV("EFFECT_CMD_ENABLE() OK");
         *(int *)pReplyData = 0;
         break;
     case EFFECT_CMD_DISABLE:
@@ -373,14 +373,14 @@
             return -ENOSYS;
         }
         pReverb->mState = REVERB_STATE_INITIALIZED;
-        LOGV("EFFECT_CMD_DISABLE() OK");
+        ALOGV("EFFECT_CMD_DISABLE() OK");
         *(int *)pReplyData = 0;
         break;
     case EFFECT_CMD_SET_DEVICE:
         if (pCmdData == NULL || cmdSize != (int)sizeof(uint32_t)) {
             return -EINVAL;
         }
-        LOGV("Reverb_Command EFFECT_CMD_SET_DEVICE: 0x%08x", *(uint32_t *)pCmdData);
+        ALOGV("Reverb_Command EFFECT_CMD_SET_DEVICE: 0x%08x", *(uint32_t *)pCmdData);
         break;
     case EFFECT_CMD_SET_VOLUME: {
         // audio output is always stereo => 2 channel volumes
@@ -389,17 +389,17 @@
         }
         float left = (float)(*(uint32_t *)pCmdData) / (1 << 24);
         float right = (float)(*((uint32_t *)pCmdData + 1)) / (1 << 24);
-        LOGV("Reverb_Command EFFECT_CMD_SET_VOLUME: left %f, right %f ", left, right);
+        ALOGV("Reverb_Command EFFECT_CMD_SET_VOLUME: left %f, right %f ", left, right);
         break;
         }
     case EFFECT_CMD_SET_AUDIO_MODE:
         if (pCmdData == NULL || cmdSize != (int)sizeof(uint32_t)) {
             return -EINVAL;
         }
-        LOGV("Reverb_Command EFFECT_CMD_SET_AUDIO_MODE: %d", *(uint32_t *)pCmdData);
+        ALOGV("Reverb_Command EFFECT_CMD_SET_AUDIO_MODE: %d", *(uint32_t *)pCmdData);
         break;
     default:
-        LOGW("Reverb_Command invalid command %d",cmdCode);
+        ALOGW("Reverb_Command invalid command %d",cmdCode);
         return -EINVAL;
     }
 
@@ -464,7 +464,7 @@
 int Reverb_Init(reverb_module_t *pRvbModule, int aux, int preset) {
     int ret;
 
-    LOGV("Reverb_Init module %p, aux: %d, preset: %d", pRvbModule,aux, preset);
+    ALOGV("Reverb_Init module %p, aux: %d, preset: %d", pRvbModule,aux, preset);
 
     memset(&pRvbModule->context, 0, sizeof(reverb_object_t));
 
@@ -494,7 +494,7 @@
 
     ret = Reverb_Configure(pRvbModule, &pRvbModule->config, true);
     if (ret < 0) {
-        LOGV("Reverb_Init error %d on module %p", ret, pRvbModule);
+        ALOGV("Reverb_Init error %d on module %p", ret, pRvbModule);
     }
 
     return ret;
@@ -531,12 +531,12 @@
         || pConfig->outputCfg.channels != OUTPUT_CHANNELS
         || pConfig->inputCfg.format != AUDIO_FORMAT_PCM_16_BIT
         || pConfig->outputCfg.format != AUDIO_FORMAT_PCM_16_BIT) {
-        LOGV("Reverb_Configure invalid config");
+        ALOGV("Reverb_Configure invalid config");
         return -EINVAL;
     }
     if ((pReverb->m_Aux && (pConfig->inputCfg.channels != AUDIO_CHANNEL_OUT_MONO)) ||
         (!pReverb->m_Aux && (pConfig->inputCfg.channels != AUDIO_CHANNEL_OUT_STEREO))) {
-        LOGV("Reverb_Configure invalid config");
+        ALOGV("Reverb_Configure invalid config");
         return -EINVAL;
     }
 
@@ -576,7 +576,7 @@
         pReverb->m_nCosWT_5KHz = 25997;
         break;
     default:
-        LOGV("Reverb_Configure invalid sampling rate %d", pReverb->m_nSamplingRate);
+        ALOGV("Reverb_Configure invalid sampling rate %d", pReverb->m_nSamplingRate);
         return -EINVAL;
     }
 
@@ -761,7 +761,7 @@
         } else {
             *pValue16 = (int16_t)(pReverb->m_nNextRoom + 1);
         }
-        LOGV("get REVERB_PARAM_PRESET, preset %d", *pValue16);
+        ALOGV("get REVERB_PARAM_PRESET, preset %d", *pValue16);
     } else {
         switch (param) {
         case REVERB_PARAM_ROOM_LEVEL:
@@ -812,7 +812,7 @@
                     / (32767 - pReverb->m_nRoomLpfFbk);
             *pValue16 = Effects_Linear16ToMillibels(temp);
 
-            LOGV("get REVERB_PARAM_ROOM_LEVEL %d, gain %d, m_nRoomLpfFwd %d, m_nRoomLpfFbk %d", *pValue16, temp, pReverb->m_nRoomLpfFwd, pReverb->m_nRoomLpfFbk);
+            ALOGV("get REVERB_PARAM_ROOM_LEVEL %d, gain %d, m_nRoomLpfFwd %d, m_nRoomLpfFbk %d", *pValue16, temp, pReverb->m_nRoomLpfFwd, pReverb->m_nRoomLpfFbk);
 
             if (param == REVERB_PARAM_ROOM_LEVEL) {
                 break;
@@ -827,17 +827,17 @@
             // - C is cos(2piWT) @ 5000Hz: pReverb->m_nCosWT_5KHz
 
             temp = MULT_EG1_EG1(pReverb->m_nRoomLpfFbk, pReverb->m_nRoomLpfFbk);
-            LOGV("get REVERB_PARAM_ROOM_HF_LEVEL, a1^2 %d", temp);
+            ALOGV("get REVERB_PARAM_ROOM_HF_LEVEL, a1^2 %d", temp);
             temp2 = MULT_EG1_EG1(pReverb->m_nRoomLpfFbk, pReverb->m_nCosWT_5KHz)
                     << 1;
-            LOGV("get REVERB_PARAM_ROOM_HF_LEVEL, 2 Cos a1 %d", temp2);
+            ALOGV("get REVERB_PARAM_ROOM_HF_LEVEL, 2 Cos a1 %d", temp2);
             temp = 32767 + temp - temp2;
-            LOGV("get REVERB_PARAM_ROOM_HF_LEVEL, a1^2 + 2 Cos a1 + 1 %d", temp);
+            ALOGV("get REVERB_PARAM_ROOM_HF_LEVEL, a1^2 + 2 Cos a1 + 1 %d", temp);
             temp = Effects_Sqrt(temp) * 181;
-            LOGV("get REVERB_PARAM_ROOM_HF_LEVEL, SQRT(a1^2 + 2 Cos a1 + 1) %d", temp);
+            ALOGV("get REVERB_PARAM_ROOM_HF_LEVEL, SQRT(a1^2 + 2 Cos a1 + 1) %d", temp);
             temp = ((32767 - pReverb->m_nRoomLpfFbk) << 15) / temp;
 
-            LOGV("get REVERB_PARAM_ROOM_HF_LEVEL, gain %d, m_nRoomLpfFwd %d, m_nRoomLpfFbk %d", temp, pReverb->m_nRoomLpfFwd, pReverb->m_nRoomLpfFbk);
+            ALOGV("get REVERB_PARAM_ROOM_HF_LEVEL, gain %d, m_nRoomLpfFwd %d, m_nRoomLpfFbk %d", temp, pReverb->m_nRoomLpfFwd, pReverb->m_nRoomLpfFbk);
 
             *pValue16 = Effects_Linear16ToMillibels(temp);
 
@@ -858,7 +858,7 @@
             // Convert samples to ms
             *pValue32 = (temp * 1000) / pReverb->m_nSamplingRate;
 
-            LOGV("get REVERB_PARAM_DECAY_TIME, samples %d, ms %d", temp, *pValue32);
+            ALOGV("get REVERB_PARAM_DECAY_TIME, samples %d, ms %d", temp, *pValue32);
 
             if (param == REVERB_PARAM_DECAY_TIME) {
                 break;
@@ -877,7 +877,7 @@
             // - C is cos(2piWT) @ 5000Hz: pReverb->m_nCosWT_5KHz
             if (pReverb->m_nRvbLpfFbk == 0) {
                 *pValue16 = 1000;
-                LOGV("get REVERB_PARAM_DECAY_HF_RATIO, pReverb->m_nRvbLpfFbk == 0, ratio %d", *pValue16);
+                ALOGV("get REVERB_PARAM_DECAY_HF_RATIO, pReverb->m_nRvbLpfFbk == 0, ratio %d", *pValue16);
             } else {
                 temp = MULT_EG1_EG1(pReverb->m_nRvbLpfFbk, pReverb->m_nRvbLpfFbk);
                 temp2 = MULT_EG1_EG1(pReverb->m_nRvbLpfFbk, pReverb->m_nCosWT_5KHz)
@@ -891,7 +891,7 @@
 
                 temp = Effects_Linear16ToMillibels(temp);
                 temp2 = Effects_Linear16ToMillibels(temp2);
-                LOGV("get REVERB_PARAM_DECAY_HF_RATIO, gain 5KHz %d mB, gain DC %d mB", temp, temp2);
+                ALOGV("get REVERB_PARAM_DECAY_HF_RATIO, gain 5KHz %d mB, gain DC %d mB", temp, temp2);
 
                 if (temp == 0)
                     temp = 1;
@@ -900,7 +900,7 @@
                     temp = 1000;
 
                 *pValue16 = temp;
-                LOGV("get REVERB_PARAM_DECAY_HF_RATIO, ratio %d", *pValue16);
+                ALOGV("get REVERB_PARAM_DECAY_HF_RATIO, ratio %d", *pValue16);
             }
 
             if (param == REVERB_PARAM_DECAY_HF_RATIO) {
@@ -912,7 +912,7 @@
         case REVERB_PARAM_REFLECTIONS_LEVEL:
             *pValue16 = Effects_Linear16ToMillibels(pReverb->m_nEarlyGain);
 
-            LOGV("get REVERB_PARAM_REFLECTIONS_LEVEL, %d", *pValue16);
+            ALOGV("get REVERB_PARAM_REFLECTIONS_LEVEL, %d", *pValue16);
             if (param == REVERB_PARAM_REFLECTIONS_LEVEL) {
                 break;
             }
@@ -923,7 +923,7 @@
             // convert samples to ms
             *pValue32 = (pReverb->m_nEarlyDelay * 1000) / pReverb->m_nSamplingRate;
 
-            LOGV("get REVERB_PARAM_REFLECTIONS_DELAY, samples %d, ms %d", pReverb->m_nEarlyDelay, *pValue32);
+            ALOGV("get REVERB_PARAM_REFLECTIONS_DELAY, samples %d, ms %d", pReverb->m_nEarlyDelay, *pValue32);
 
             if (param == REVERB_PARAM_REFLECTIONS_DELAY) {
                 break;
@@ -935,7 +935,7 @@
             // Convert linear gain to millibels
             *pValue16 = Effects_Linear16ToMillibels(pReverb->m_nLateGain << 2);
 
-            LOGV("get REVERB_PARAM_REVERB_LEVEL %d", *pValue16);
+            ALOGV("get REVERB_PARAM_REVERB_LEVEL %d", *pValue16);
 
             if (param == REVERB_PARAM_REVERB_LEVEL) {
                 break;
@@ -947,7 +947,7 @@
             // convert samples to ms
             *pValue32 = (pReverb->m_nLateDelay * 1000) / pReverb->m_nSamplingRate;
 
-            LOGV("get REVERB_PARAM_REVERB_DELAY, samples %d, ms %d", pReverb->m_nLateDelay, *pValue32);
+            ALOGV("get REVERB_PARAM_REVERB_DELAY, samples %d, ms %d", pReverb->m_nLateDelay, *pValue32);
 
             if (param == REVERB_PARAM_REVERB_DELAY) {
                 break;
@@ -965,7 +965,7 @@
                 temp = 1000;
 
             *pValue16 = temp;
-            LOGV("get REVERB_PARAM_DIFFUSION, %d, AP0 gain %d", *pValue16, pReverb->m_sAp0.m_nApGain);
+            ALOGV("get REVERB_PARAM_DIFFUSION, %d, AP0 gain %d", *pValue16, pReverb->m_sAp0.m_nApGain);
 
             if (param == REVERB_PARAM_DIFFUSION) {
                 break;
@@ -987,7 +987,7 @@
 
             *pValue16 = temp;
 
-            LOGV("get REVERB_PARAM_DENSITY, %d, AP0 delay smps %d", *pValue16, pReverb->m_sAp0.m_zApOut - pReverb->m_sAp0.m_zApIn);
+            ALOGV("get REVERB_PARAM_DENSITY, %d, AP0 delay smps %d", *pValue16, pReverb->m_sAp0.m_zApOut - pReverb->m_sAp0.m_zApIn);
             break;
 
         default:
@@ -997,7 +997,7 @@
 
     *pSize = size;
 
-    LOGV("Reverb_getParameter, context %p, param %d, value %d",
+    ALOGV("Reverb_getParameter, context %p, param %d, value %d",
             pReverb, param, *(int *)pValue);
 
     return 0;
@@ -1035,7 +1035,7 @@
     int32_t averageDelay;
     size_t paramSize;
 
-    LOGV("Reverb_setParameter, context %p, param %d, value16 %d, value32 %d",
+    ALOGV("Reverb_setParameter, context %p, param %d, value16 %d, value32 %d",
             pReverb, param, *(int16_t *)pValue, *(int32_t *)pValue);
 
     if (pReverb->m_Preset) {
@@ -1043,7 +1043,7 @@
             return -EINVAL;
         }
         value16 = *(int16_t *)pValue;
-        LOGV("set REVERB_PARAM_PRESET, preset %d", value16);
+        ALOGV("set REVERB_PARAM_PRESET, preset %d", value16);
         if (value16 < REVERB_PRESET_NONE || value16 > REVERB_PRESET_PLATE) {
             return -EINVAL;
         }
@@ -1114,7 +1114,7 @@
             pReverb->m_nRoomLpfFwd
                     = MULT_EG1_EG1(temp, (32767 - pReverb->m_nRoomLpfFbk));
 
-            LOGV("REVERB_PARAM_ROOM_LEVEL, gain %d, new m_nRoomLpfFwd %d, m_nRoomLpfFbk %d", temp, pReverb->m_nRoomLpfFwd, pReverb->m_nRoomLpfFbk);
+            ALOGV("REVERB_PARAM_ROOM_LEVEL, gain %d, new m_nRoomLpfFwd %d, m_nRoomLpfFbk %d", temp, pReverb->m_nRoomLpfFwd, pReverb->m_nRoomLpfFbk);
             if (param == REVERB_PARAM_ROOM_LEVEL)
                 break;
             value16 = pProperties->roomHFLevel;
@@ -1142,11 +1142,11 @@
 
                 // dG^2
                 temp = Effects_MillibelsToLinear16(value16);
-                LOGV("REVERB_PARAM_ROOM_HF_LEVEL, HF gain %d", temp);
+                ALOGV("REVERB_PARAM_ROOM_HF_LEVEL, HF gain %d", temp);
                 temp = (1 << 30) / temp;
-                LOGV("REVERB_PARAM_ROOM_HF_LEVEL, 1/ HF gain %d", temp);
+                ALOGV("REVERB_PARAM_ROOM_HF_LEVEL, 1/ HF gain %d", temp);
                 dG2 = (int32_t) (((int64_t) temp * (int64_t) temp) >> 15);
-                LOGV("REVERB_PARAM_ROOM_HF_LEVEL, 1/ HF gain ^ 2 %d", dG2);
+                ALOGV("REVERB_PARAM_ROOM_HF_LEVEL, 1/ HF gain ^ 2 %d", dG2);
                 // b = 2*(C-dG^2)/(1-dG^2)
                 b = (int32_t) ((((int64_t) 1 << (15 + 1))
                         * ((int64_t) pReverb->m_nCosWT_5KHz - (int64_t) dG2))
@@ -1156,18 +1156,18 @@
                 delta = (int32_t) ((((int64_t) b * (int64_t) b) >> 15) - (1 << (15
                         + 2)));
 
-                LOGV_IF(delta > (1<<30), " delta overflow %d", delta);
+                ALOGV_IF(delta > (1<<30), " delta overflow %d", delta);
 
-                LOGV("REVERB_PARAM_ROOM_HF_LEVEL, dG2 %d, b %d, delta %d, m_nCosWT_5KHz %d", dG2, b, delta, pReverb->m_nCosWT_5KHz);
+                ALOGV("REVERB_PARAM_ROOM_HF_LEVEL, dG2 %d, b %d, delta %d, m_nCosWT_5KHz %d", dG2, b, delta, pReverb->m_nCosWT_5KHz);
                 // m_nRoomLpfFbk = -a1 = - (- b + sqrt(delta)) / 2
                 pReverb->m_nRoomLpfFbk = (b - Effects_Sqrt(delta) * 181) >> 1;
             }
-            LOGV("REVERB_PARAM_ROOM_HF_LEVEL, olg DC gain %d new m_nRoomLpfFbk %d, old m_nRoomLpfFwd %d",
+            ALOGV("REVERB_PARAM_ROOM_HF_LEVEL, olg DC gain %d new m_nRoomLpfFbk %d, old m_nRoomLpfFwd %d",
                     temp2, pReverb->m_nRoomLpfFbk, pReverb->m_nRoomLpfFwd);
 
             pReverb->m_nRoomLpfFwd
                     = MULT_EG1_EG1(temp2, (32767 - pReverb->m_nRoomLpfFbk));
-            LOGV("REVERB_PARAM_ROOM_HF_LEVEL, new m_nRoomLpfFwd %d", pReverb->m_nRoomLpfFwd);
+            ALOGV("REVERB_PARAM_ROOM_HF_LEVEL, new m_nRoomLpfFwd %d", pReverb->m_nRoomLpfFwd);
 
             if (param == REVERB_PARAM_ROOM_HF_LEVEL)
                 break;
@@ -1189,7 +1189,7 @@
                     + (pReverb->m_sAp1.m_zApOut - pReverb->m_sAp1.m_zApIn)) >> 1;
 
             temp = (-6000 * averageDelay) / value32;
-            LOGV("REVERB_PARAM_DECAY_TIME, delay smps %d, DT smps %d, gain mB %d",averageDelay, value32, temp);
+            ALOGV("REVERB_PARAM_DECAY_TIME, delay smps %d, DT smps %d, gain mB %d",averageDelay, value32, temp);
             if (temp < -4000 || temp > -100)
                 return -EINVAL;
 
@@ -1202,7 +1202,7 @@
             pReverb->m_nRvbLpfFwd
                     = MULT_EG1_EG1(temp, (32767 - pReverb->m_nRvbLpfFbk));
 
-            LOGV("REVERB_PARAM_DECAY_TIME, gain %d, new m_nRvbLpfFwd %d, old m_nRvbLpfFbk %d, reverb gain %d", temp, pReverb->m_nRvbLpfFwd, pReverb->m_nRvbLpfFbk, Effects_Linear16ToMillibels(pReverb->m_nLateGain));
+            ALOGV("REVERB_PARAM_DECAY_TIME, gain %d, new m_nRvbLpfFwd %d, old m_nRvbLpfFbk %d, reverb gain %d", temp, pReverb->m_nRvbLpfFwd, pReverb->m_nRvbLpfFbk, Effects_Linear16ToMillibels(pReverb->m_nLateGain));
 
             if (param == REVERB_PARAM_DECAY_TIME)
                 break;
@@ -1229,17 +1229,17 @@
                 // G_5000Hz = G_DC * (1000/REVERB_PARAM_DECAY_HF_RATIO) in millibels
 
                 value32 = ((int32_t) 1000 << 15) / (int32_t) value16;
-                LOGV("REVERB_PARAM_DECAY_HF_RATIO, DC gain %d, DC gain mB %d, 1000/R %d", temp2, temp, value32);
+                ALOGV("REVERB_PARAM_DECAY_HF_RATIO, DC gain %d, DC gain mB %d, 1000/R %d", temp2, temp, value32);
 
                 temp = (int32_t) (((int64_t) temp * (int64_t) value32) >> 15);
 
                 if (temp < -4000) {
-                    LOGV("REVERB_PARAM_DECAY_HF_RATIO HF gain overflow %d mB", temp);
+                    ALOGV("REVERB_PARAM_DECAY_HF_RATIO HF gain overflow %d mB", temp);
                     temp = -4000;
                 }
 
                 temp = Effects_MillibelsToLinear16(temp);
-                LOGV("REVERB_PARAM_DECAY_HF_RATIO, HF gain %d", temp);
+                ALOGV("REVERB_PARAM_DECAY_HF_RATIO, HF gain %d", temp);
                 // dG^2
                 temp = (temp2 << 15) / temp;
                 dG2 = (int32_t) (((int64_t) temp * (int64_t) temp) >> 15);
@@ -1256,11 +1256,11 @@
                 // m_nRoomLpfFbk = -a1 = - (- b + sqrt(delta)) / 2
                 pReverb->m_nRvbLpfFbk = (b - Effects_Sqrt(delta) * 181) >> 1;
 
-                LOGV("REVERB_PARAM_DECAY_HF_RATIO, dG2 %d, b %d, delta %d", dG2, b, delta);
+                ALOGV("REVERB_PARAM_DECAY_HF_RATIO, dG2 %d, b %d, delta %d", dG2, b, delta);
 
             }
 
-            LOGV("REVERB_PARAM_DECAY_HF_RATIO, gain %d, m_nRvbLpfFbk %d, m_nRvbLpfFwd %d", temp2, pReverb->m_nRvbLpfFbk, pReverb->m_nRvbLpfFwd);
+            ALOGV("REVERB_PARAM_DECAY_HF_RATIO, gain %d, m_nRvbLpfFbk %d, m_nRvbLpfFwd %d", temp2, pReverb->m_nRvbLpfFbk, pReverb->m_nRvbLpfFwd);
 
             pReverb->m_nRvbLpfFwd
                     = MULT_EG1_EG1(temp2, (32767 - pReverb->m_nRvbLpfFbk));
@@ -1284,7 +1284,7 @@
                         = MULT_EG1_EG1(pPreset->m_sEarlyR.m_nGain[i],value16);
             }
             pReverb->m_nEarlyGain = value16;
-            LOGV("REVERB_PARAM_REFLECTIONS_LEVEL, m_nEarlyGain %d", pReverb->m_nEarlyGain);
+            ALOGV("REVERB_PARAM_REFLECTIONS_LEVEL, m_nEarlyGain %d", pReverb->m_nEarlyGain);
 
             if (param == REVERB_PARAM_REFLECTIONS_LEVEL)
                 break;
@@ -1315,7 +1315,7 @@
             }
             pReverb->m_nEarlyDelay = temp;
 
-            LOGV("REVERB_PARAM_REFLECTIONS_DELAY, m_nEarlyDelay smps %d max smp delay %d", pReverb->m_nEarlyDelay, maxSamples);
+            ALOGV("REVERB_PARAM_REFLECTIONS_DELAY, m_nEarlyDelay smps %d max smp delay %d", pReverb->m_nEarlyDelay, maxSamples);
 
             // Convert milliseconds to sample count => m_nEarlyDelay
             if (param == REVERB_PARAM_REFLECTIONS_DELAY)
@@ -1330,7 +1330,7 @@
             // Convert millibels to linear 16 bits (gange 0 - 8191) => m_nLateGain.
             pReverb->m_nLateGain = Effects_MillibelsToLinear16(value16) >> 2;
 
-            LOGV("REVERB_PARAM_REVERB_LEVEL, m_nLateGain %d", pReverb->m_nLateGain);
+            ALOGV("REVERB_PARAM_REVERB_LEVEL, m_nLateGain %d", pReverb->m_nLateGain);
 
             if (param == REVERB_PARAM_REVERB_LEVEL)
                 break;
@@ -1359,7 +1359,7 @@
             pReverb->m_nDelay1Out += temp;
             pReverb->m_nLateDelay += temp;
 
-            LOGV("REVERB_PARAM_REVERB_DELAY, m_nLateDelay smps %d max smp delay %d", pReverb->m_nLateDelay, maxSamples);
+            ALOGV("REVERB_PARAM_REVERB_DELAY, m_nLateDelay smps %d max smp delay %d", pReverb->m_nLateDelay, maxSamples);
 
             // Convert milliseconds to sample count => m_nDelay1Out + m_nMaxExcursion
             if (param == REVERB_PARAM_REVERB_DELAY)
@@ -1378,7 +1378,7 @@
             pReverb->m_sAp1.m_nApGain = AP1_GAIN_BASE + ((int32_t) value16
                     * AP1_GAIN_RANGE) / 1000;
 
-            LOGV("REVERB_PARAM_DIFFUSION, m_sAp0.m_nApGain %d m_sAp1.m_nApGain %d", pReverb->m_sAp0.m_nApGain, pReverb->m_sAp1.m_nApGain);
+            ALOGV("REVERB_PARAM_DIFFUSION, m_sAp0.m_nApGain %d m_sAp1.m_nApGain %d", pReverb->m_sAp0.m_nApGain, pReverb->m_sAp1.m_nApGain);
 
             if (param == REVERB_PARAM_DIFFUSION)
                 break;
@@ -1400,7 +1400,7 @@
                 temp = maxSamples;
             pReverb->m_sAp0.m_zApOut = (uint16_t) (pReverb->m_sAp0.m_zApIn + temp);
 
-            LOGV("REVERB_PARAM_DENSITY, Ap0 delay smps %d", temp);
+            ALOGV("REVERB_PARAM_DENSITY, Ap0 delay smps %d", temp);
 
             temp = AP1_TIME_BASE + ((int32_t) value16 * AP1_TIME_RANGE) / 1000;
             /*lint -e{702} shift for performance */
@@ -1409,7 +1409,7 @@
                 temp = maxSamples;
             pReverb->m_sAp1.m_zApOut = (uint16_t) (pReverb->m_sAp1.m_zApIn + temp);
 
-            LOGV("Ap1 delay smps %d", temp);
+            ALOGV("Ap1 delay smps %d", temp);
 
             break;
 
diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp
index 1a06cc6..c441710 100644
--- a/media/libeffects/visualizer/EffectVisualizer.cpp
+++ b/media/libeffects/visualizer/EffectVisualizer.cpp
@@ -93,7 +93,7 @@
 
 int Visualizer_configure(VisualizerContext *pContext, effect_config_t *pConfig)
 {
-    LOGV("Visualizer_configure start");
+    ALOGV("Visualizer_configure start");
 
     if (pConfig->inputCfg.samplingRate != pConfig->outputCfg.samplingRate) return -EINVAL;
     if (pConfig->inputCfg.channels != pConfig->outputCfg.channels) return -EINVAL;
@@ -192,7 +192,7 @@
 
     ret = Visualizer_init(pContext);
     if (ret < 0) {
-        LOGW("VisualizerLib_Create() init failed");
+        ALOGW("VisualizerLib_Create() init failed");
         delete pContext;
         return ret;
     }
@@ -201,7 +201,7 @@
 
     pContext->mState = VISUALIZER_STATE_INITIALIZED;
 
-    LOGV("VisualizerLib_Create %p", pContext);
+    ALOGV("VisualizerLib_Create %p", pContext);
 
     return 0;
 
@@ -210,7 +210,7 @@
 int VisualizerLib_Release(effect_handle_t handle) {
     VisualizerContext * pContext = (VisualizerContext *)handle;
 
-    LOGV("VisualizerLib_Release %p", handle);
+    ALOGV("VisualizerLib_Release %p", handle);
     if (pContext == NULL) {
         return -EINVAL;
     }
@@ -224,7 +224,7 @@
                                 effect_descriptor_t *pDescriptor) {
 
     if (pDescriptor == NULL || uuid == NULL){
-        LOGV("VisualizerLib_GetDescriptor() called with NULL pointer");
+        ALOGV("VisualizerLib_GetDescriptor() called with NULL pointer");
         return -EINVAL;
     }
 
@@ -328,7 +328,7 @@
         return -EINVAL;
     }
 
-//    LOGV("Visualizer_command command %d cmdSize %d",cmdCode, cmdSize);
+//    ALOGV("Visualizer_command command %d cmdSize %d",cmdCode, cmdSize);
 
     switch (cmdCode) {
     case EFFECT_CMD_INIT:
@@ -356,7 +356,7 @@
             return -ENOSYS;
         }
         pContext->mState = VISUALIZER_STATE_ACTIVE;
-        LOGV("EFFECT_CMD_ENABLE() OK");
+        ALOGV("EFFECT_CMD_ENABLE() OK");
         *(int *)pReplyData = 0;
         break;
     case EFFECT_CMD_DISABLE:
@@ -367,7 +367,7 @@
             return -ENOSYS;
         }
         pContext->mState = VISUALIZER_STATE_INITIALIZED;
-        LOGV("EFFECT_CMD_DISABLE() OK");
+        ALOGV("EFFECT_CMD_DISABLE() OK");
         *(int *)pReplyData = 0;
         break;
     case EFFECT_CMD_GET_PARAM: {
@@ -386,7 +386,7 @@
             p->status = -EINVAL;
             break;
         }
-        LOGV("get mCaptureSize = %d", pContext->mCaptureSize);
+        ALOGV("get mCaptureSize = %d", pContext->mCaptureSize);
         *((uint32_t *)p->data + 1) = pContext->mCaptureSize;
         p->vsize = sizeof(uint32_t);
         *replySize += sizeof(uint32_t);
@@ -406,7 +406,7 @@
             break;;
         }
         pContext->mCaptureSize = *((uint32_t *)p->data + 1);
-        LOGV("set mCaptureSize = %d", pContext->mCaptureSize);
+        ALOGV("set mCaptureSize = %d", pContext->mCaptureSize);
         } break;
     case EFFECT_CMD_SET_DEVICE:
     case EFFECT_CMD_SET_VOLUME:
@@ -416,7 +416,7 @@
 
     case VISUALIZER_CMD_CAPTURE:
         if (pReplyData == NULL || *replySize != pContext->mCaptureSize) {
-            LOGV("VISUALIZER_CMD_CAPTURE() error *replySize %d pContext->mCaptureSize %d",
+            ALOGV("VISUALIZER_CMD_CAPTURE() error *replySize %d pContext->mCaptureSize %d",
                     *replySize, pContext->mCaptureSize);
             return -EINVAL;
         }
@@ -445,7 +445,7 @@
         break;
 
     default:
-        LOGW("Visualizer_command invalid command %d",cmdCode);
+        ALOGW("Visualizer_command invalid command %d",cmdCode);
         return -EINVAL;
     }
 
@@ -459,7 +459,7 @@
     VisualizerContext * pContext = (VisualizerContext *) self;
 
     if (pContext == NULL || pDescriptor == NULL) {
-        LOGV("Visualizer_getDescriptor() invalid param");
+        ALOGV("Visualizer_getDescriptor() invalid param");
         return -EINVAL;
     }
 
diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp
index 0633744..6639d06 100644
--- a/media/libmedia/AudioEffect.cpp
+++ b/media/libmedia/AudioEffect.cpp
@@ -69,7 +69,7 @@
     effect_uuid_t uuid;
     effect_uuid_t *pUuid = NULL;
 
-    LOGV("Constructor string\n - type: %s\n - uuid: %s", typeStr, uuidStr);
+    ALOGV("Constructor string\n - type: %s\n - uuid: %s", typeStr, uuidStr);
 
     if (typeStr != NULL) {
         if (stringToGuid(typeStr, &type) == NO_ERROR) {
@@ -98,21 +98,21 @@
     sp<IMemory> cblk;
     int enabled;
 
-    LOGV("set %p mUserData: %p uuid: %p timeLow %08x", this, user, type, type ? type->timeLow : 0);
+    ALOGV("set %p mUserData: %p uuid: %p timeLow %08x", this, user, type, type ? type->timeLow : 0);
 
     if (mIEffect != 0) {
-        LOGW("Effect already in use");
+        ALOGW("Effect already in use");
         return INVALID_OPERATION;
     }
 
     const sp<IAudioFlinger>& audioFlinger = AudioSystem::get_audio_flinger();
     if (audioFlinger == 0) {
-        LOGE("set(): Could not get audioflinger");
+        ALOGE("set(): Could not get audioflinger");
         return NO_INIT;
     }
 
     if (type == NULL && uuid == NULL) {
-        LOGW("Must specify at least type or uuid");
+        ALOGW("Must specify at least type or uuid");
         return BAD_VALUE;
     }
 
@@ -138,7 +138,7 @@
             mIEffectClient, priority, io, mSessionId, &mStatus, &mId, &enabled);
 
     if (iEffect == 0 || (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS)) {
-        LOGE("set(): AudioFlinger could not create effect, status: %d", mStatus);
+        ALOGE("set(): AudioFlinger could not create effect, status: %d", mStatus);
         return mStatus;
     }
 
@@ -148,7 +148,7 @@
     cblk = iEffect->getCblk();
     if (cblk == 0) {
         mStatus = NO_INIT;
-        LOGE("Could not get control block");
+        ALOGE("Could not get control block");
         return mStatus;
     }
 
@@ -159,7 +159,7 @@
     mCblk->buffer = (uint8_t *)mCblk + bufOffset;
 
     iEffect->asBinder()->linkToDeath(mIEffectClient);
-    LOGV("set() %p OK effect: %s id: %d status %d enabled %d, ", this, mDescriptor.name, mId, mStatus, mEnabled);
+    ALOGV("set() %p OK effect: %s id: %d status %d enabled %d, ", this, mDescriptor.name, mId, mStatus, mEnabled);
 
     return mStatus;
 }
@@ -167,7 +167,7 @@
 
 AudioEffect::~AudioEffect()
 {
-    LOGV("Destructor %p", this);
+    ALOGV("Destructor %p", this);
 
     if (mStatus == NO_ERROR || mStatus == ALREADY_EXISTS) {
         if (mIEffect != NULL) {
@@ -210,10 +210,10 @@
     AutoMutex lock(mLock);
     if (enabled != mEnabled) {
         if (enabled) {
-            LOGV("enable %p", this);
+            ALOGV("enable %p", this);
             status = mIEffect->enable();
         } else {
-            LOGV("disable %p", this);
+            ALOGV("disable %p", this);
             status = mIEffect->disable();
         }
         if (status == NO_ERROR) {
@@ -230,7 +230,7 @@
                               void *replyData)
 {
     if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) {
-        LOGV("command() bad status %d", mStatus);
+        ALOGV("command() bad status %d", mStatus);
         return INVALID_OPERATION;
     }
 
@@ -273,7 +273,7 @@
     uint32_t size = sizeof(int);
     uint32_t psize = ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize;
 
-    LOGV("setParameter: param: %d, param2: %d", *(int *)param->data, (param->psize == 8) ? *((int *)param->data + 1): -1);
+    ALOGV("setParameter: param: %d, param2: %d", *(int *)param->data, (param->psize == 8) ? *((int *)param->data + 1): -1);
 
     return mIEffect->command(EFFECT_CMD_SET_PARAM, sizeof (effect_param_t) + psize, param, &size, &param->status);
 }
@@ -328,7 +328,7 @@
         return BAD_VALUE;
     }
 
-    LOGV("getParameter: param: %d, param2: %d", *(int *)param->data, (param->psize == 8) ? *((int *)param->data + 1): -1);
+    ALOGV("getParameter: param: %d, param2: %d", *(int *)param->data, (param->psize == 8) ? *((int *)param->data + 1): -1);
 
     uint32_t psize = sizeof(effect_param_t) + ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize;
 
@@ -340,7 +340,7 @@
 
 void AudioEffect::binderDied()
 {
-    LOGW("IEffect died");
+    ALOGW("IEffect died");
     mStatus = NO_INIT;
     if (mCbf) {
         status_t status = DEAD_OBJECT;
@@ -353,7 +353,7 @@
 
 void AudioEffect::controlStatusChanged(bool controlGranted)
 {
-    LOGV("controlStatusChanged %p control %d callback %p mUserData %p", this, controlGranted, mCbf, mUserData);
+    ALOGV("controlStatusChanged %p control %d callback %p mUserData %p", this, controlGranted, mCbf, mUserData);
     if (controlGranted) {
         if (mStatus == ALREADY_EXISTS) {
             mStatus = NO_ERROR;
@@ -370,7 +370,7 @@
 
 void AudioEffect::enableStatusChanged(bool enabled)
 {
-    LOGV("enableStatusChanged %p enabled %d mCbf %p", this, enabled, mCbf);
+    ALOGV("enableStatusChanged %p enabled %d mCbf %p", this, enabled, mCbf);
     if (mStatus == ALREADY_EXISTS) {
         mEnabled = enabled;
         if (mCbf) {
diff --git a/media/libmedia/AudioParameter.cpp b/media/libmedia/AudioParameter.cpp
index 59ccfd0..abc7b3f 100644
--- a/media/libmedia/AudioParameter.cpp
+++ b/media/libmedia/AudioParameter.cpp
@@ -53,7 +53,7 @@
                 mParameters.replaceValueFor(key, value);
             }
         } else {
-            LOGV("AudioParameter() cstor empty key value pair");
+            ALOGV("AudioParameter() cstor empty key value pair");
         }
         pair = strtok(NULL, ";");
     }
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index e5062ab..34a5eb7 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -56,12 +56,12 @@
     size_t size = 0;
     if (AudioSystem::getInputBufferSize(sampleRate, format, channelCount, &size)
             != NO_ERROR) {
-        LOGE("AudioSystem could not query the input buffer size.");
+        ALOGE("AudioSystem could not query the input buffer size.");
         return NO_INIT;
     }
 
     if (size == 0) {
-        LOGE("Unsupported configuration: sampleRate %d, format %d, channelCount %d",
+        ALOGE("Unsupported configuration: sampleRate %d, format %d, channelCount %d",
             sampleRate, format, channelCount);
         return BAD_VALUE;
     }
@@ -132,7 +132,7 @@
         int sessionId)
 {
 
-    LOGV("set(): sampleRate %d, channelMask %d, frameCount %d",sampleRate, channelMask, frameCount);
+    ALOGV("set(): sampleRate %d, channelMask %d, frameCount %d",sampleRate, channelMask, frameCount);
 
     AutoMutex lock(mLock);
 
@@ -153,7 +153,7 @@
     }
     // validate parameters
     if (!audio_is_valid_format(format)) {
-        LOGE("Invalid format");
+        ALOGE("Invalid format");
         return BAD_VALUE;
     }
 
@@ -168,7 +168,7 @@
     } else {
         mSessionId = sessionId;
     }
-    LOGV("set(): mSessionId %d", mSessionId);
+    ALOGV("set(): mSessionId %d", mSessionId);
 
     audio_io_handle_t input = AudioSystem::getInput(inputSource,
                                                     sampleRate,
@@ -177,7 +177,7 @@
                                                     (audio_in_acoustics_t)flags,
                                                     mSessionId);
     if (input == 0) {
-        LOGE("Could not get audio input for record source %d", inputSource);
+        ALOGE("Could not get audio input for record source %d", inputSource);
         return BAD_VALUE;
     }
 
@@ -187,7 +187,7 @@
     if (status != NO_ERROR) {
         return status;
     }
-    LOGV("AudioRecord::set() minFrameCount = %d", minFrameCount);
+    ALOGV("AudioRecord::set() minFrameCount = %d", minFrameCount);
 
     if (frameCount == 0) {
         frameCount = minFrameCount;
@@ -287,12 +287,12 @@
     status_t ret = NO_ERROR;
     sp<ClientRecordThread> t = mClientRecordThread;
 
-    LOGV("start");
+    ALOGV("start");
 
     if (t != 0) {
         if (t->exitPending()) {
             if (t->requestExitAndWait() == WOULD_BLOCK) {
-                LOGE("AudioRecord::start called from thread");
+                ALOGE("AudioRecord::start called from thread");
                 return WOULD_BLOCK;
             }
         }
@@ -346,7 +346,7 @@
 {
     sp<ClientRecordThread> t = mClientRecordThread;
 
-    LOGV("stop");
+    ALOGV("stop");
 
     if (t != 0) {
         t->mLock.lock();
@@ -469,12 +469,12 @@
                                                        &status);
 
     if (record == 0) {
-        LOGE("AudioFlinger could not create record track, status: %d", status);
+        ALOGE("AudioFlinger could not create record track, status: %d", status);
         return status;
     }
     sp<IMemory> cblk = record->getCblk();
     if (cblk == 0) {
-        LOGE("Could not get control block");
+        ALOGE("Could not get control block");
         return NO_INIT;
     }
     mAudioRecord.clear();
@@ -532,7 +532,7 @@
             if (__builtin_expect(result!=NO_ERROR, false)) {
                 cblk->waitTimeMs += waitTimeMs;
                 if (cblk->waitTimeMs >= cblk->bufferTimeoutMs) {
-                    LOGW(   "obtainBuffer timed out (is the CPU pegged?) "
+                    ALOGW(   "obtainBuffer timed out (is the CPU pegged?) "
                             "user=%08x, server=%08x", cblk->user, cblk->server);
                     cblk->lock.unlock();
                     result = mAudioRecord->start();
@@ -543,7 +543,7 @@
                         result = AudioRecord::restoreRecord_l(cblk);
                     }
                     if (result != NO_ERROR) {
-                        LOGW("obtainBuffer create Track error %d", result);
+                        ALOGW("obtainBuffer create Track error %d", result);
                         cblk->lock.unlock();
                         return result;
                     }
@@ -623,7 +623,7 @@
 
     if (ssize_t(userSize) < 0) {
         // sanity-check. user is most-likely passing an error code.
-        LOGE("AudioRecord::read(buffer=%p, size=%u (%d)",
+        ALOGE("AudioRecord::read(buffer=%p, size=%u (%d)",
                 buffer, userSize, userSize);
         return BAD_VALUE;
     }
@@ -706,7 +706,7 @@
         status_t err = obtainBuffer(&audioBuffer, 1);
         if (err < NO_ERROR) {
             if (err != TIMED_OUT) {
-                LOGE_IF(err != status_t(NO_MORE_BUFFERS), "Error obtaining an audio buffer, giving up.");
+                ALOGE_IF(err != status_t(NO_MORE_BUFFERS), "Error obtaining an audio buffer, giving up.");
                 return false;
             }
             break;
@@ -739,7 +739,7 @@
 
     // Manage overrun callback
     if (mActive && (cblk->framesAvailable() == 0)) {
-        LOGV("Overrun user: %x, server: %x, flags %04x", cblk->user, cblk->server, cblk->flags);
+        ALOGV("Overrun user: %x, server: %x, flags %04x", cblk->user, cblk->server, cblk->flags);
         if (!(android_atomic_or(CBLK_UNDERRUN_ON, &cblk->flags) & CBLK_UNDERRUN_MSK)) {
             mCbf(EVENT_OVERRUN, mUserData, 0);
         }
@@ -761,7 +761,7 @@
     status_t result;
 
     if (!(android_atomic_or(CBLK_RESTORING_ON, &cblk->flags) & CBLK_RESTORING_MSK)) {
-        LOGW("dead IAudioRecord, creating a new one");
+        ALOGW("dead IAudioRecord, creating a new one");
         // signal old cblk condition so that other threads waiting for available buffers stop
         // waiting now
         cblk->cv.broadcast();
@@ -784,13 +784,13 @@
         cblk->cv.broadcast();
     } else {
         if (!(cblk->flags & CBLK_RESTORED_MSK)) {
-            LOGW("dead IAudioRecord, waiting for a new one to be created");
+            ALOGW("dead IAudioRecord, waiting for a new one to be created");
             mLock.unlock();
             result = cblk->cv.waitRelative(cblk->lock, milliseconds(RESTORE_TIMEOUT_MS));
             cblk->lock.unlock();
             mLock.lock();
         } else {
-            LOGW("dead IAudioRecord, already restored");
+            ALOGW("dead IAudioRecord, already restored");
             result = NO_ERROR;
             cblk->lock.unlock();
         }
@@ -798,7 +798,7 @@
             result = status_t(STOPPED);
         }
     }
-    LOGV("restoreRecord_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x",
+    ALOGV("restoreRecord_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x",
          result, mActive, mCblk, cblk, mCblk->flags, cblk->flags);
 
     if (result == NO_ERROR) {
@@ -807,7 +807,7 @@
     }
     cblk->lock.lock();
 
-    LOGW_IF(result != NO_ERROR, "restoreRecord_l() error %d", result);
+    ALOGW_IF(result != NO_ERROR, "restoreRecord_l() error %d", result);
 
     return result;
 }
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index 7b14c18..f7f129c 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -56,7 +56,7 @@
             binder = sm->getService(String16("media.audio_flinger"));
             if (binder != 0)
                 break;
-            LOGW("AudioFlinger not published, waiting...");
+            ALOGW("AudioFlinger not published, waiting...");
             usleep(500000); // 0.5 s
         } while(true);
         if (gAudioFlingerClient == NULL) {
@@ -70,7 +70,7 @@
         gAudioFlinger = interface_cast<IAudioFlinger>(binder);
         gAudioFlinger->registerClient(gAudioFlingerClient);
     }
-    LOGE_IF(gAudioFlinger==0, "no AudioFlinger!?");
+    ALOGE_IF(gAudioFlinger==0, "no AudioFlinger!?");
 
     return gAudioFlinger;
 }
@@ -190,7 +190,7 @@
 float AudioSystem::linearToLog(int volume)
 {
     // float v = volume ? exp(float(100 - volume) * dBConvert) : 0;
-    // LOGD("linearToLog(%d)=%f", volume, v);
+    // ALOGD("linearToLog(%d)=%f", volume, v);
     // return v;
     return volume ? exp(float(100 - volume) * dBConvert) : 0;
 }
@@ -198,7 +198,7 @@
 int AudioSystem::logToLinear(float volume)
 {
     // int v = volume ? 100 - int(dBConvertInverse * log(volume) + 0.5) : 0;
-    // LOGD("logTolinear(%d)=%f", v, volume);
+    // ALOGD("logTolinear(%d)=%f", v, volume);
     // return v;
     return volume ? 100 - int(dBConvertInverse * log(volume) + 0.5) : 0;
 }
@@ -220,18 +220,18 @@
     gLock.lock();
     outputDesc = AudioSystem::gOutputs.valueFor(output);
     if (outputDesc == 0) {
-        LOGV("getOutputSamplingRate() no output descriptor for output %d in gOutputs", output);
+        ALOGV("getOutputSamplingRate() no output descriptor for output %d in gOutputs", output);
         gLock.unlock();
         const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
         if (af == 0) return PERMISSION_DENIED;
         *samplingRate = af->sampleRate(output);
     } else {
-        LOGV("getOutputSamplingRate() reading from output desc");
+        ALOGV("getOutputSamplingRate() reading from output desc");
         *samplingRate = outputDesc->samplingRate;
         gLock.unlock();
     }
 
-    LOGV("getOutputSamplingRate() streamType %d, output %d, sampling rate %d", streamType, output, *samplingRate);
+    ALOGV("getOutputSamplingRate() streamType %d, output %d, sampling rate %d", streamType, output, *samplingRate);
 
     return NO_ERROR;
 }
@@ -262,7 +262,7 @@
         gLock.unlock();
     }
 
-    LOGV("getOutputFrameCount() streamType %d, output %d, frameCount %d", streamType, output, *frameCount);
+    ALOGV("getOutputFrameCount() streamType %d, output %d, frameCount %d", streamType, output, *frameCount);
 
     return NO_ERROR;
 }
@@ -293,7 +293,7 @@
         gLock.unlock();
     }
 
-    LOGV("getOutputLatency() streamType %d, output %d, latency %d", streamType, output, *latency);
+    ALOGV("getOutputLatency() streamType %d, output %d, latency %d", streamType, output, *latency);
 
     return NO_ERROR;
 }
@@ -383,11 +383,11 @@
     if (gAudioErrorCallback) {
         gAudioErrorCallback(DEAD_OBJECT);
     }
-    LOGW("AudioFlinger server died!");
+    ALOGW("AudioFlinger server died!");
 }
 
 void AudioSystem::AudioFlingerClient::ioConfigChanged(int event, int ioHandle, void *param2) {
-    LOGV("ioConfigChanged() event %d", event);
+    ALOGV("ioConfigChanged() event %d", event);
     OutputDescriptor *desc;
     uint32_t stream;
 
@@ -399,14 +399,14 @@
     case STREAM_CONFIG_CHANGED:
         if (param2 == 0) break;
         stream = *(uint32_t *)param2;
-        LOGV("ioConfigChanged() STREAM_CONFIG_CHANGED stream %d, output %d", stream, ioHandle);
+        ALOGV("ioConfigChanged() STREAM_CONFIG_CHANGED stream %d, output %d", stream, ioHandle);
         if (gStreamOutputMap.indexOfKey(stream) >= 0) {
             gStreamOutputMap.replaceValueFor(stream, ioHandle);
         }
         break;
     case OUTPUT_OPENED: {
         if (gOutputs.indexOfKey(ioHandle) >= 0) {
-            LOGV("ioConfigChanged() opening already existing output! %d", ioHandle);
+            ALOGV("ioConfigChanged() opening already existing output! %d", ioHandle);
             break;
         }
         if (param2 == 0) break;
@@ -414,15 +414,15 @@
 
         OutputDescriptor *outputDesc =  new OutputDescriptor(*desc);
         gOutputs.add(ioHandle, outputDesc);
-        LOGV("ioConfigChanged() new output samplingRate %d, format %d channels %d frameCount %d latency %d",
+        ALOGV("ioConfigChanged() new output samplingRate %d, format %d channels %d frameCount %d latency %d",
                 outputDesc->samplingRate, outputDesc->format, outputDesc->channels, outputDesc->frameCount, outputDesc->latency);
         } break;
     case OUTPUT_CLOSED: {
         if (gOutputs.indexOfKey(ioHandle) < 0) {
-            LOGW("ioConfigChanged() closing unknow output! %d", ioHandle);
+            ALOGW("ioConfigChanged() closing unknow output! %d", ioHandle);
             break;
         }
-        LOGV("ioConfigChanged() output %d closed", ioHandle);
+        ALOGV("ioConfigChanged() output %d closed", ioHandle);
 
         gOutputs.removeItem(ioHandle);
         for (int i = gStreamOutputMap.size() - 1; i >= 0 ; i--) {
@@ -435,13 +435,13 @@
     case OUTPUT_CONFIG_CHANGED: {
         int index = gOutputs.indexOfKey(ioHandle);
         if (index < 0) {
-            LOGW("ioConfigChanged() modifying unknow output! %d", ioHandle);
+            ALOGW("ioConfigChanged() modifying unknow output! %d", ioHandle);
             break;
         }
         if (param2 == 0) break;
         desc = (OutputDescriptor *)param2;
 
-        LOGV("ioConfigChanged() new config for output %d samplingRate %d, format %d channels %d frameCount %d latency %d",
+        ALOGV("ioConfigChanged() new config for output %d samplingRate %d, format %d channels %d frameCount %d latency %d",
                 ioHandle, desc->samplingRate, desc->format,
                 desc->channels, desc->frameCount, desc->latency);
         OutputDescriptor *outputDesc = gOutputs.valueAt(index);
@@ -491,7 +491,7 @@
             binder = sm->getService(String16("media.audio_policy"));
             if (binder != 0)
                 break;
-            LOGW("AudioPolicyService not published, waiting...");
+            ALOGW("AudioPolicyService not published, waiting...");
             usleep(500000); // 0.5 s
         } while(true);
         if (gAudioPolicyServiceClient == NULL) {
@@ -582,7 +582,7 @@
          (samplingRate != 8000 && samplingRate != 16000))) {
         Mutex::Autolock _l(gLock);
         output = AudioSystem::gStreamOutputMap.valueFor(stream);
-        LOGV_IF((output != 0), "getOutput() read %d from cache for stream %d", output, stream);
+        ALOGV_IF((output != 0), "getOutput() read %d from cache for stream %d", output, stream);
     }
     if (output == 0) {
         const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
@@ -736,7 +736,7 @@
 void AudioSystem::clearAudioConfigCache()
 {
     Mutex::Autolock _l(gLock);
-    LOGV("clearAudioConfigCache()");
+    ALOGV("clearAudioConfigCache()");
     gStreamOutputMap.clear();
     gOutputs.clear();
 }
@@ -747,7 +747,7 @@
     Mutex::Autolock _l(AudioSystem::gLock);
     AudioSystem::gAudioPolicyService.clear();
 
-    LOGW("AudioPolicyService server died!");
+    ALOGW("AudioPolicyService server died!");
 }
 
 }; // namespace android
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 498ad45..3a8bfa3 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -121,7 +121,7 @@
 
 AudioTrack::~AudioTrack()
 {
-    LOGV_IF(mSharedBuffer != 0, "Destructor sharedBuffer: %p", mSharedBuffer->pointer());
+    ALOGV_IF(mSharedBuffer != 0, "Destructor sharedBuffer: %p", mSharedBuffer->pointer());
 
     if (mStatus == NO_ERROR) {
         // Make sure that callback function exits in the case where
@@ -153,11 +153,11 @@
         int sessionId)
 {
 
-    LOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size());
+    ALOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size());
 
     AutoMutex lock(mLock);
     if (mAudioTrack != 0) {
-        LOGE("Track already in use");
+        ALOGE("Track already in use");
         return INVALID_OPERATION;
     }
 
@@ -187,7 +187,7 @@
 
     // validate parameters
     if (!audio_is_valid_format(format)) {
-        LOGE("Invalid format");
+        ALOGE("Invalid format");
         return BAD_VALUE;
     }
 
@@ -197,7 +197,7 @@
     }
 
     if (!audio_is_output_channel(channelMask)) {
-        LOGE("Invalid channel mask");
+        ALOGE("Invalid channel mask");
         return BAD_VALUE;
     }
     uint32_t channelCount = popcount(channelMask);
@@ -208,7 +208,7 @@
                                     (audio_policy_output_flags_t)flags);
 
     if (output == 0) {
-        LOGE("Could not get audio output for stream type %d", streamType);
+        ALOGE("Could not get audio output for stream type %d", streamType);
         return BAD_VALUE;
     }
 
@@ -238,7 +238,7 @@
     if (cbf != 0) {
         mAudioTrackThread = new AudioTrackThread(*this, threadCanCallJava);
         if (mAudioTrackThread == 0) {
-          LOGE("Could not create callback thread");
+          ALOGE("Could not create callback thread");
           return NO_INIT;
         }
     }
@@ -319,11 +319,11 @@
     sp<AudioTrackThread> t = mAudioTrackThread;
     status_t status = NO_ERROR;
 
-    LOGV("start %p", this);
+    ALOGV("start %p", this);
     if (t != 0) {
         if (t->exitPending()) {
             if (t->requestExitAndWait() == WOULD_BLOCK) {
-                LOGE("AudioTrack::start called from thread");
+                ALOGE("AudioTrack::start called from thread");
                 return;
             }
         }
@@ -351,7 +351,7 @@
             setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_AUDIO);
         }
 
-        LOGV("start %p before lock cblk %p", this, mCblk);
+        ALOGV("start %p before lock cblk %p", this, mCblk);
         if (!(cblk->flags & CBLK_INVALID_MSK)) {
             cblk->lock.unlock();
             status = mAudioTrack->start();
@@ -365,7 +365,7 @@
         }
         cblk->lock.unlock();
         if (status != NO_ERROR) {
-            LOGV("start() failed");
+            ALOGV("start() failed");
             mActive = 0;
             if (t != 0) {
                 t->requestExit();
@@ -384,7 +384,7 @@
 {
     sp<AudioTrackThread> t = mAudioTrackThread;
 
-    LOGV("stop %p", this);
+    ALOGV("stop %p", this);
     if (t != 0) {
         t->mLock.lock();
     }
@@ -431,7 +431,7 @@
 // must be called with mLock held
 void AudioTrack::flush_l()
 {
-    LOGV("flush");
+    ALOGV("flush");
 
     // clear playback marker and periodic update counter
     mMarkerPosition = 0;
@@ -449,7 +449,7 @@
 
 void AudioTrack::pause()
 {
-    LOGV("pause");
+    ALOGV("pause");
     AutoMutex lock(mLock);
     if (mActive == 1) {
         mActive = 0;
@@ -496,7 +496,7 @@
 
 status_t AudioTrack::setAuxEffectSendLevel(float level)
 {
-    LOGV("setAuxEffectSendLevel(%f)", level);
+    ALOGV("setAuxEffectSendLevel(%f)", level);
     if (level > 1.0f) {
         return BAD_VALUE;
     }
@@ -561,12 +561,12 @@
     if (loopStart >= loopEnd ||
         loopEnd - loopStart > cblk->frameCount ||
         cblk->server > loopStart) {
-        LOGE("setLoop invalid value: loopStart %d, loopEnd %d, loopCount %d, framecount %d, user %d", loopStart, loopEnd, loopCount, cblk->frameCount, cblk->user);
+        ALOGE("setLoop invalid value: loopStart %d, loopEnd %d, loopCount %d, framecount %d, user %d", loopStart, loopEnd, loopCount, cblk->frameCount, cblk->user);
         return BAD_VALUE;
     }
 
     if ((mSharedBuffer != 0) && (loopEnd > cblk->frameCount)) {
-        LOGE("setLoop invalid value: loop markers beyond data: loopStart %d, loopEnd %d, framecount %d",
+        ALOGE("setLoop invalid value: loop markers beyond data: loopStart %d, loopEnd %d, framecount %d",
             loopStart, loopEnd, cblk->frameCount);
         return BAD_VALUE;
     }
@@ -696,7 +696,7 @@
 
 status_t AudioTrack::attachAuxEffect(int effectId)
 {
-    LOGV("attachAuxEffect(%d)", effectId);
+    ALOGV("attachAuxEffect(%d)", effectId);
     status_t status = mAudioTrack->attachAuxEffect(effectId);
     if (status == NO_ERROR) {
         mAuxEffectId = effectId;
@@ -721,7 +721,7 @@
     status_t status;
     const sp<IAudioFlinger>& audioFlinger = AudioSystem::get_audio_flinger();
     if (audioFlinger == 0) {
-       LOGE("Could not get audioflinger");
+       ALOGE("Could not get audioflinger");
        return NO_INIT;
     }
 
@@ -763,7 +763,7 @@
                 mNotificationFramesAct = frameCount/2;
             }
             if (frameCount < minFrameCount) {
-                LOGW_IF(enforceFrameCount, "Minimum buffer size corrected from %d to %d",
+                ALOGW_IF(enforceFrameCount, "Minimum buffer size corrected from %d to %d",
                          frameCount, minFrameCount);
                 frameCount = minFrameCount;
             }
@@ -771,7 +771,7 @@
             // Ensure that buffer alignment matches channelcount
             int channelCount = popcount(channelMask);
             if (((uint32_t)sharedBuffer->pointer() & (channelCount | 1)) != 0) {
-                LOGE("Invalid buffer alignement: address %p, channelCount %d", sharedBuffer->pointer(), channelCount);
+                ALOGE("Invalid buffer alignement: address %p, channelCount %d", sharedBuffer->pointer(), channelCount);
                 return BAD_VALUE;
             }
             frameCount = sharedBuffer->size()/channelCount/sizeof(int16_t);
@@ -791,12 +791,12 @@
                                                       &status);
 
     if (track == 0) {
-        LOGE("AudioFlinger could not create track, status: %d", status);
+        ALOGE("AudioFlinger could not create track, status: %d", status);
         return status;
     }
     sp<IMemory> cblk = track->getCblk();
     if (cblk == 0) {
-        LOGE("Could not get control block");
+        ALOGE("Could not get control block");
         return NO_INIT;
     }
     mAudioTrack.clear();
@@ -849,7 +849,7 @@
         while (framesAvail == 0) {
             active = mActive;
             if (UNLIKELY(!active)) {
-                LOGV("Not active and NO_MORE_BUFFERS");
+                ALOGV("Not active and NO_MORE_BUFFERS");
                 cblk->lock.unlock();
                 return NO_MORE_BUFFERS;
             }
@@ -877,7 +877,7 @@
                     // timing out when a loop has been set and we have already written upto loop end
                     // is a normal condition: no need to wake AudioFlinger up.
                     if (cblk->user < cblk->loopEnd) {
-                        LOGW(   "obtainBuffer timed out (is the CPU pegged?) %p "
+                        ALOGW(   "obtainBuffer timed out (is the CPU pegged?) %p "
                                 "user=%08x, server=%08x", this, cblk->user, cblk->server);
                         //unlock cblk mutex before calling mAudioTrack->start() (see issue #1617140)
                         cblk->lock.unlock();
@@ -889,7 +889,7 @@
                             result = restoreTrack_l(cblk, false);
                         }
                         if (result != NO_ERROR) {
-                            LOGW("obtainBuffer create Track error %d", result);
+                            ALOGW("obtainBuffer create Track error %d", result);
                             cblk->lock.unlock();
                             return result;
                         }
@@ -912,7 +912,7 @@
     // restart track if it was disabled by audioflinger due to previous underrun
     if (mActive && (cblk->flags & CBLK_DISABLED_MSK)) {
         android_atomic_and(~CBLK_DISABLED_ON, &cblk->flags);
-        LOGW("obtainBuffer() track %p disabled, restarting", this);
+        ALOGW("obtainBuffer() track %p disabled, restarting", this);
         mAudioTrack->start();
     }
 
@@ -958,12 +958,12 @@
 
     if (ssize_t(userSize) < 0) {
         // sanity-check. user is most-likely passing an error code.
-        LOGE("AudioTrack::write(buffer=%p, size=%u (%d)",
+        ALOGE("AudioTrack::write(buffer=%p, size=%u (%d)",
                 buffer, userSize, userSize);
         return BAD_VALUE;
     }
 
-    LOGV("write %p: %d bytes, mActive=%d", this, userSize, mActive);
+    ALOGV("write %p: %d bytes, mActive=%d", this, userSize, mActive);
 
     // acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed
     // while we are accessing the cblk
@@ -1033,7 +1033,7 @@
 
     // Manage underrun callback
     if (mActive && (cblk->framesAvailable() == cblk->frameCount)) {
-        LOGV("Underrun user: %x, server: %x, flags %04x", cblk->user, cblk->server, cblk->flags);
+        ALOGV("Underrun user: %x, server: %x, flags %04x", cblk->user, cblk->server, cblk->flags);
         if (!(android_atomic_or(CBLK_UNDERRUN_ON, &cblk->flags) & CBLK_UNDERRUN_MSK)) {
             mCbf(EVENT_UNDERRUN, mUserData, 0);
             if (cblk->server == cblk->frameCount) {
@@ -1090,7 +1090,7 @@
         status_t err = obtainBuffer(&audioBuffer, waitCount);
         if (err < NO_ERROR) {
             if (err != TIMED_OUT) {
-                LOGE_IF(err != status_t(NO_MORE_BUFFERS), "Error obtaining an audio buffer, giving up.");
+                ALOGE_IF(err != status_t(NO_MORE_BUFFERS), "Error obtaining an audio buffer, giving up.");
                 return false;
             }
             break;
@@ -1158,7 +1158,7 @@
     status_t result;
 
     if (!(android_atomic_or(CBLK_RESTORING_ON, &cblk->flags) & CBLK_RESTORING_MSK)) {
-        LOGW("dead IAudioTrack, creating a new one from %s TID %d",
+        ALOGW("dead IAudioTrack, creating a new one from %s TID %d",
              fromStart ? "start()" : "obtainBuffer()", gettid());
 
         // signal old cblk condition so that other threads waiting for available buffers stop
@@ -1214,7 +1214,7 @@
             }
             if (mActive) {
                 result = mAudioTrack->start();
-                LOGW_IF(result != NO_ERROR, "restoreTrack_l() start() failed status %d", result);
+                ALOGW_IF(result != NO_ERROR, "restoreTrack_l() start() failed status %d", result);
             }
             if (fromStart && result == NO_ERROR) {
                 mNewPosition = mCblk->server + mUpdatePeriod;
@@ -1222,7 +1222,7 @@
         }
         if (result != NO_ERROR) {
             android_atomic_and(~CBLK_RESTORING_ON, &cblk->flags);
-            LOGW_IF(result != NO_ERROR, "restoreTrack_l() failed status %d", result);
+            ALOGW_IF(result != NO_ERROR, "restoreTrack_l() failed status %d", result);
         }
         mRestoreStatus = result;
         // signal old cblk condition for other threads waiting for restore completion
@@ -1230,7 +1230,7 @@
         cblk->cv.broadcast();
     } else {
         if (!(cblk->flags & CBLK_RESTORED_MSK)) {
-            LOGW("dead IAudioTrack, waiting for a new one TID %d", gettid());
+            ALOGW("dead IAudioTrack, waiting for a new one TID %d", gettid());
             mLock.unlock();
             result = cblk->cv.waitRelative(cblk->lock, milliseconds(RESTORE_TIMEOUT_MS));
             if (result == NO_ERROR) {
@@ -1239,12 +1239,12 @@
             cblk->lock.unlock();
             mLock.lock();
         } else {
-            LOGW("dead IAudioTrack, already restored TID %d", gettid());
+            ALOGW("dead IAudioTrack, already restored TID %d", gettid());
             result = mRestoreStatus;
             cblk->lock.unlock();
         }
     }
-    LOGV("restoreTrack_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x",
+    ALOGV("restoreTrack_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x",
          result, mActive, mCblk, cblk, mCblk->flags, cblk->flags);
 
     if (result == NO_ERROR) {
@@ -1253,7 +1253,7 @@
     }
     cblk->lock.lock();
 
-    LOGW_IF(result != NO_ERROR, "restoreTrack_l() error %d TID %d", result, gettid());
+    ALOGW_IF(result != NO_ERROR, "restoreTrack_l() error %d TID %d", result, gettid());
 
     return result;
 }
@@ -1322,7 +1322,7 @@
             bufferTimeoutMs = MAX_RUN_TIMEOUT_MS;
         }
     } else if (u > this->server) {
-        LOGW("stepServer occured after track reset");
+        ALOGW("stepServer occured after track reset");
         u = this->server;
     }
 
@@ -1343,7 +1343,7 @@
 bool audio_track_cblk_t::stepServer(uint32_t frameCount)
 {
     if (!tryLock()) {
-        LOGW("stepServer() could not lock cblk");
+        ALOGW("stepServer() could not lock cblk");
         return false;
     }
 
@@ -1361,13 +1361,13 @@
         // stepServer() is called After the flush() has reset u & s and
         // we have s > u
         if (s > this->user) {
-            LOGW("stepServer occured after track reset");
+            ALOGW("stepServer occured after track reset");
             s = this->user;
         }
     }
 
     if (s >= loopEnd) {
-        LOGW_IF(s > loopEnd, "stepServer: s %u > loopEnd %u", s, loopEnd);
+        ALOGW_IF(s > loopEnd, "stepServer: s %u > loopEnd %u", s, loopEnd);
         s = loopStart;
         if (--loopCount == 0) {
             loopEnd = UINT_MAX;
@@ -1422,7 +1422,7 @@
         } else {
             // do not block on mutex shared with client on AudioFlinger side
             if (!tryLock()) {
-                LOGW("framesReady() could not lock cblk");
+                ALOGW("framesReady() could not lock cblk");
                 return 0;
             }
             uint32_t frames = UINT_MAX;
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index d58834b..abd491f 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -112,7 +112,7 @@
         data.writeInt32(lSessionId);
         status_t lStatus = remote()->transact(CREATE_TRACK, data, &reply);
         if (lStatus != NO_ERROR) {
-            LOGE("createTrack error: %s", strerror(-lStatus));
+            ALOGE("createTrack error: %s", strerror(-lStatus));
         } else {
             lSessionId = reply.readInt32();
             if (sessionId != NULL) {
@@ -155,7 +155,7 @@
         data.writeInt32(lSessionId);
         status_t lStatus = remote()->transact(OPEN_RECORD, data, &reply);
         if (lStatus != NO_ERROR) {
-            LOGE("openRecord error: %s", strerror(-lStatus));
+            ALOGE("openRecord error: %s", strerror(-lStatus));
         } else {
             lSessionId = reply.readInt32();
             if (sessionId != NULL) {
@@ -377,7 +377,7 @@
         data.writeInt32(flags);
         remote()->transact(OPEN_OUTPUT, data, &reply);
         int  output = reply.readInt32();
-        LOGV("openOutput() returned output, %p", output);
+        ALOGV("openOutput() returned output, %p", output);
         devices = reply.readInt32();
         if (pDevices) *pDevices = devices;
         samplingRate = reply.readInt32();
@@ -632,7 +632,7 @@
 
         status_t lStatus = remote()->transact(CREATE_EFFECT, data, &reply);
         if (lStatus != NO_ERROR) {
-            LOGE("createEffect error: %s", strerror(-lStatus));
+            ALOGE("createEffect error: %s", strerror(-lStatus));
         } else {
             lStatus = reply.readInt32();
             int tmp = reply.readInt32();
@@ -844,7 +844,7 @@
                                      &channels,
                                      &latency,
                                      flags);
-            LOGV("OPEN_OUTPUT output, %p", output);
+            ALOGV("OPEN_OUTPUT output, %p", output);
             reply->writeInt32(output);
             reply->writeInt32(devices);
             reply->writeInt32(samplingRate);
diff --git a/media/libmedia/IAudioFlingerClient.cpp b/media/libmedia/IAudioFlingerClient.cpp
index 3900de4..5a3f250 100644
--- a/media/libmedia/IAudioFlingerClient.cpp
+++ b/media/libmedia/IAudioFlingerClient.cpp
@@ -47,7 +47,7 @@
         data.writeInt32(ioHandle);
         if (event == AudioSystem::STREAM_CONFIG_CHANGED) {
             uint32_t stream = *(uint32_t *)param2;
-            LOGV("ioConfigChanged stream %d", stream);
+            ALOGV("ioConfigChanged stream %d", stream);
             data.writeInt32(stream);
         } else if (event != AudioSystem::OUTPUT_CLOSED && event != AudioSystem::INPUT_CLOSED) {
             AudioSystem::OutputDescriptor *desc = (AudioSystem::OutputDescriptor *)param2;
@@ -79,7 +79,7 @@
             if (event == AudioSystem::STREAM_CONFIG_CHANGED) {
                 stream = data.readInt32();
                 param2 = &stream;
-                LOGV("STREAM_CONFIG_CHANGED stream %d", stream);
+                ALOGV("STREAM_CONFIG_CHANGED stream %d", stream);
             } else if (event != AudioSystem::OUTPUT_CLOSED && event != AudioSystem::INPUT_CLOSED) {
                 desc.samplingRate = data.readInt32();
                 desc.format = data.readInt32();
diff --git a/media/libmedia/IAudioRecord.cpp b/media/libmedia/IAudioRecord.cpp
index ba0d55b..8c7a960 100644
--- a/media/libmedia/IAudioRecord.cpp
+++ b/media/libmedia/IAudioRecord.cpp
@@ -50,7 +50,7 @@
         if (status == NO_ERROR) {
             status = reply.readInt32();
         } else {
-            LOGW("start() error: %s", strerror(-status));
+            ALOGW("start() error: %s", strerror(-status));
         }
         return status;
     }
diff --git a/media/libmedia/IAudioTrack.cpp b/media/libmedia/IAudioTrack.cpp
index bc8ff34..0b372f3 100644
--- a/media/libmedia/IAudioTrack.cpp
+++ b/media/libmedia/IAudioTrack.cpp
@@ -54,7 +54,7 @@
         if (status == NO_ERROR) {
             status = reply.readInt32();
         } else {
-            LOGW("start() error: %s", strerror(-status));
+            ALOGW("start() error: %s", strerror(-status));
         }
         return status;
     }
@@ -109,7 +109,7 @@
         if (status == NO_ERROR) {
             status = reply.readInt32();
         } else {
-            LOGW("attachAuxEffect() error: %s", strerror(-status));
+            ALOGW("attachAuxEffect() error: %s", strerror(-status));
         }
         return status;
     }
diff --git a/media/libmedia/IEffect.cpp b/media/libmedia/IEffect.cpp
index a945b97..d469e28 100644
--- a/media/libmedia/IEffect.cpp
+++ b/media/libmedia/IEffect.cpp
@@ -43,7 +43,7 @@
 
     status_t enable()
     {
-        LOGV("enable");
+        ALOGV("enable");
         Parcel data, reply;
         data.writeInterfaceToken(IEffect::getInterfaceDescriptor());
         remote()->transact(ENABLE, data, &reply);
@@ -52,7 +52,7 @@
 
     status_t disable()
     {
-        LOGV("disable");
+        ALOGV("disable");
         Parcel data, reply;
         data.writeInterfaceToken(IEffect::getInterfaceDescriptor());
         remote()->transact(DISABLE, data, &reply);
@@ -65,7 +65,7 @@
                      uint32_t *pReplySize,
                      void *pReplyData)
     {
-        LOGV("command");
+        ALOGV("command");
         Parcel data, reply;
         data.writeInterfaceToken(IEffect::getInterfaceDescriptor());
         data.writeInt32(cmdCode);
@@ -95,7 +95,7 @@
 
     void disconnect()
     {
-        LOGV("disconnect");
+        ALOGV("disconnect");
         Parcel data, reply;
         data.writeInterfaceToken(IEffect::getInterfaceDescriptor());
         remote()->transact(DISCONNECT, data, &reply);
@@ -124,21 +124,21 @@
 {
     switch(code) {
         case ENABLE: {
-            LOGV("ENABLE");
+            ALOGV("ENABLE");
             CHECK_INTERFACE(IEffect, data, reply);
             reply->writeInt32(enable());
             return NO_ERROR;
         } break;
 
         case DISABLE: {
-            LOGV("DISABLE");
+            ALOGV("DISABLE");
             CHECK_INTERFACE(IEffect, data, reply);
             reply->writeInt32(disable());
             return NO_ERROR;
         } break;
 
         case COMMAND: {
-            LOGV("COMMAND");
+            ALOGV("COMMAND");
             CHECK_INTERFACE(IEffect, data, reply);
             uint32_t cmdCode = data.readInt32();
             uint32_t cmdSize = data.readInt32();
@@ -172,7 +172,7 @@
         } break;
 
         case DISCONNECT: {
-            LOGV("DISCONNECT");
+            ALOGV("DISCONNECT");
             CHECK_INTERFACE(IEffect, data, reply);
             disconnect();
             return NO_ERROR;
diff --git a/media/libmedia/IEffectClient.cpp b/media/libmedia/IEffectClient.cpp
index 1fa9cbe..4693b45 100644
--- a/media/libmedia/IEffectClient.cpp
+++ b/media/libmedia/IEffectClient.cpp
@@ -40,7 +40,7 @@
 
     void controlStatusChanged(bool controlGranted)
     {
-        LOGV("controlStatusChanged");
+        ALOGV("controlStatusChanged");
         Parcel data, reply;
         data.writeInterfaceToken(IEffectClient::getInterfaceDescriptor());
         data.writeInt32((uint32_t)controlGranted);
@@ -49,7 +49,7 @@
 
     void enableStatusChanged(bool enabled)
     {
-        LOGV("enableStatusChanged");
+        ALOGV("enableStatusChanged");
         Parcel data, reply;
         data.writeInterfaceToken(IEffectClient::getInterfaceDescriptor());
         data.writeInt32((uint32_t)enabled);
@@ -62,7 +62,7 @@
                          uint32_t replySize,
                          void *pReplyData)
     {
-        LOGV("commandExecuted");
+        ALOGV("commandExecuted");
         Parcel data, reply;
         data.writeInterfaceToken(IEffectClient::getInterfaceDescriptor());
         data.writeInt32(cmdCode);
@@ -96,21 +96,21 @@
 {
     switch(code) {
         case CONTROL_STATUS_CHANGED: {
-            LOGV("CONTROL_STATUS_CHANGED");
+            ALOGV("CONTROL_STATUS_CHANGED");
             CHECK_INTERFACE(IEffectClient, data, reply);
             bool hasControl = (bool)data.readInt32();
             controlStatusChanged(hasControl);
             return NO_ERROR;
         } break;
         case ENABLE_STATUS_CHANGED: {
-            LOGV("ENABLE_STATUS_CHANGED");
+            ALOGV("ENABLE_STATUS_CHANGED");
             CHECK_INTERFACE(IEffectClient, data, reply);
             bool enabled = (bool)data.readInt32();
             enableStatusChanged(enabled);
             return NO_ERROR;
         } break;
         case COMMAND_EXECUTED: {
-            LOGV("COMMAND_EXECUTED");
+            ALOGV("COMMAND_EXECUTED");
             CHECK_INTERFACE(IEffectClient, data, reply);
             uint32_t cmdCode = data.readInt32();
             uint32_t cmdSize = data.readInt32();
diff --git a/media/libmedia/IMediaDeathNotifier.cpp b/media/libmedia/IMediaDeathNotifier.cpp
index 39ac076..8525482 100644
--- a/media/libmedia/IMediaDeathNotifier.cpp
+++ b/media/libmedia/IMediaDeathNotifier.cpp
@@ -34,7 +34,7 @@
 /*static*/const sp<IMediaPlayerService>&
 IMediaDeathNotifier::getMediaPlayerService()
 {
-    LOGV("getMediaPlayerService");
+    ALOGV("getMediaPlayerService");
     Mutex::Autolock _l(sServiceLock);
     if (sMediaPlayerService.get() == 0) {
         sp<IServiceManager> sm = defaultServiceManager();
@@ -44,7 +44,7 @@
             if (binder != 0) {
                 break;
              }
-             LOGW("Media player service not published, waiting...");
+             ALOGW("Media player service not published, waiting...");
              usleep(500000); // 0.5 s
         } while(true);
 
@@ -54,14 +54,14 @@
     binder->linkToDeath(sDeathNotifier);
     sMediaPlayerService = interface_cast<IMediaPlayerService>(binder);
     }
-    LOGE_IF(sMediaPlayerService == 0, "no media player service!?");
+    ALOGE_IF(sMediaPlayerService == 0, "no media player service!?");
     return sMediaPlayerService;
 }
 
 /*static*/ void
 IMediaDeathNotifier::addObitRecipient(const wp<IMediaDeathNotifier>& recipient)
 {
-    LOGV("addObitRecipient");
+    ALOGV("addObitRecipient");
     Mutex::Autolock _l(sServiceLock);
     sObitRecipients.add(recipient);
 }
@@ -69,14 +69,14 @@
 /*static*/ void
 IMediaDeathNotifier::removeObitRecipient(const wp<IMediaDeathNotifier>& recipient)
 {
-    LOGV("removeObitRecipient");
+    ALOGV("removeObitRecipient");
     Mutex::Autolock _l(sServiceLock);
     sObitRecipients.remove(recipient);
 }
 
 void
 IMediaDeathNotifier::DeathNotifier::binderDied(const wp<IBinder>& who) {
-    LOGW("media server died");
+    ALOGW("media server died");
 
     // Need to do this with the lock held
     SortedVector< wp<IMediaDeathNotifier> > list;
@@ -100,7 +100,7 @@
 
 IMediaDeathNotifier::DeathNotifier::~DeathNotifier()
 {
-    LOGV("DeathNotifier::~DeathNotifier");
+    ALOGV("DeathNotifier::~DeathNotifier");
     Mutex::Autolock _l(sServiceLock);
     sObitRecipients.clear();
     if (sMediaPlayerService != 0) {
diff --git a/media/libmedia/IMediaMetadataRetriever.cpp b/media/libmedia/IMediaMetadataRetriever.cpp
index 07152d8..9b8d7c3 100644
--- a/media/libmedia/IMediaMetadataRetriever.cpp
+++ b/media/libmedia/IMediaMetadataRetriever.cpp
@@ -118,7 +118,7 @@
 
     sp<IMemory> getFrameAtTime(int64_t timeUs, int option)
     {
-        LOGV("getTimeAtTime: time(%lld us) and option(%d)", timeUs, option);
+        ALOGV("getTimeAtTime: time(%lld us) and option(%d)", timeUs, option);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaMetadataRetriever::getInterfaceDescriptor());
         data.writeInt64(timeUs);
@@ -208,7 +208,7 @@
             CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
             int64_t timeUs = data.readInt64();
             int option = data.readInt32();
-            LOGV("getTimeAtTime: time(%lld us) and option(%d)", timeUs, option);
+            ALOGV("getTimeAtTime: time(%lld us) and option(%d)", timeUs, option);
 #ifndef DISABLE_GROUP_SCHEDULE_HACK
             setSchedPolicy(data);
 #endif
diff --git a/media/libmedia/IMediaRecorder.cpp b/media/libmedia/IMediaRecorder.cpp
index 38e111e..42f55c2 100644
--- a/media/libmedia/IMediaRecorder.cpp
+++ b/media/libmedia/IMediaRecorder.cpp
@@ -64,7 +64,7 @@
 
     status_t setCamera(const sp<ICamera>& camera, const sp<ICameraRecordingProxy>& proxy)
     {
-        LOGV("setCamera(%p,%p)", camera.get(), proxy.get());
+        ALOGV("setCamera(%p,%p)", camera.get(), proxy.get());
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeStrongBinder(camera->asBinder());
@@ -75,7 +75,7 @@
 
     sp<ISurfaceTexture> querySurfaceMediaSource()
     {
-        LOGV("Query SurfaceMediaSource");
+        ALOGV("Query SurfaceMediaSource");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(QUERY_SURFACE_MEDIASOURCE, data, &reply);
@@ -88,7 +88,7 @@
 
     status_t setPreviewSurface(const sp<Surface>& surface)
     {
-        LOGV("setPreviewSurface(%p)", surface.get());
+        ALOGV("setPreviewSurface(%p)", surface.get());
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         Surface::writeToParcel(surface, &data);
@@ -98,7 +98,7 @@
 
     status_t init()
     {
-        LOGV("init");
+        ALOGV("init");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(INIT, data, &reply);
@@ -107,7 +107,7 @@
 
     status_t setVideoSource(int vs)
     {
-        LOGV("setVideoSource(%d)", vs);
+        ALOGV("setVideoSource(%d)", vs);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeInt32(vs);
@@ -117,7 +117,7 @@
 
     status_t setAudioSource(int as)
     {
-        LOGV("setAudioSource(%d)", as);
+        ALOGV("setAudioSource(%d)", as);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeInt32(as);
@@ -127,7 +127,7 @@
 
     status_t setOutputFormat(int of)
     {
-        LOGV("setOutputFormat(%d)", of);
+        ALOGV("setOutputFormat(%d)", of);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeInt32(of);
@@ -137,7 +137,7 @@
 
     status_t setVideoEncoder(int ve)
     {
-        LOGV("setVideoEncoder(%d)", ve);
+        ALOGV("setVideoEncoder(%d)", ve);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeInt32(ve);
@@ -147,7 +147,7 @@
 
     status_t setAudioEncoder(int ae)
     {
-        LOGV("setAudioEncoder(%d)", ae);
+        ALOGV("setAudioEncoder(%d)", ae);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeInt32(ae);
@@ -157,7 +157,7 @@
 
     status_t setOutputFile(const char* path)
     {
-        LOGV("setOutputFile(%s)", path);
+        ALOGV("setOutputFile(%s)", path);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeCString(path);
@@ -166,7 +166,7 @@
     }
 
     status_t setOutputFile(int fd, int64_t offset, int64_t length) {
-        LOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
+        ALOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeFileDescriptor(fd);
@@ -178,7 +178,7 @@
 
     status_t setVideoSize(int width, int height)
     {
-        LOGV("setVideoSize(%dx%d)", width, height);
+        ALOGV("setVideoSize(%dx%d)", width, height);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeInt32(width);
@@ -189,7 +189,7 @@
 
     status_t setVideoFrameRate(int frames_per_second)
     {
-        LOGV("setVideoFrameRate(%d)", frames_per_second);
+        ALOGV("setVideoFrameRate(%d)", frames_per_second);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeInt32(frames_per_second);
@@ -199,7 +199,7 @@
 
     status_t setParameters(const String8& params)
     {
-        LOGV("setParameter(%s)", params.string());
+        ALOGV("setParameter(%s)", params.string());
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeString8(params);
@@ -209,7 +209,7 @@
 
     status_t setListener(const sp<IMediaRecorderClient>& listener)
     {
-        LOGV("setListener(%p)", listener.get());
+        ALOGV("setListener(%p)", listener.get());
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeStrongBinder(listener->asBinder());
@@ -219,7 +219,7 @@
 
     status_t prepare()
     {
-        LOGV("prepare");
+        ALOGV("prepare");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(PREPARE, data, &reply);
@@ -228,7 +228,7 @@
 
     status_t getMaxAmplitude(int* max)
     {
-        LOGV("getMaxAmplitude");
+        ALOGV("getMaxAmplitude");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(GET_MAX_AMPLITUDE, data, &reply);
@@ -238,7 +238,7 @@
 
     status_t start()
     {
-        LOGV("start");
+        ALOGV("start");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(START, data, &reply);
@@ -247,7 +247,7 @@
 
     status_t stop()
     {
-        LOGV("stop");
+        ALOGV("stop");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(STOP, data, &reply);
@@ -256,7 +256,7 @@
 
     status_t reset()
     {
-        LOGV("reset");
+        ALOGV("reset");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(RESET, data, &reply);
@@ -265,7 +265,7 @@
 
     status_t close()
     {
-        LOGV("close");
+        ALOGV("close");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(CLOSE, data, &reply);
@@ -274,7 +274,7 @@
 
     status_t release()
     {
-        LOGV("release");
+        ALOGV("release");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(RELEASE, data, &reply);
@@ -291,49 +291,49 @@
 {
     switch(code) {
         case RELEASE: {
-            LOGV("RELEASE");
+            ALOGV("RELEASE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(release());
             return NO_ERROR;
         } break;
         case INIT: {
-            LOGV("INIT");
+            ALOGV("INIT");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(init());
             return NO_ERROR;
         } break;
         case CLOSE: {
-            LOGV("CLOSE");
+            ALOGV("CLOSE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(close());
             return NO_ERROR;
         } break;
         case RESET: {
-            LOGV("RESET");
+            ALOGV("RESET");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(reset());
             return NO_ERROR;
         } break;
         case STOP: {
-            LOGV("STOP");
+            ALOGV("STOP");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(stop());
             return NO_ERROR;
         } break;
         case START: {
-            LOGV("START");
+            ALOGV("START");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(start());
             return NO_ERROR;
         } break;
         case PREPARE: {
-            LOGV("PREPARE");
+            ALOGV("PREPARE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(prepare());
             return NO_ERROR;
         } break;
         case GET_MAX_AMPLITUDE: {
-            LOGV("GET_MAX_AMPLITUDE");
+            ALOGV("GET_MAX_AMPLITUDE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int max = 0;
             status_t ret = getMaxAmplitude(&max);
@@ -342,35 +342,35 @@
             return NO_ERROR;
         } break;
         case SET_VIDEO_SOURCE: {
-            LOGV("SET_VIDEO_SOURCE");
+            ALOGV("SET_VIDEO_SOURCE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int vs = data.readInt32();
             reply->writeInt32(setVideoSource(vs));
             return NO_ERROR;
         } break;
         case SET_AUDIO_SOURCE: {
-            LOGV("SET_AUDIO_SOURCE");
+            ALOGV("SET_AUDIO_SOURCE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int as = data.readInt32();
             reply->writeInt32(setAudioSource(as));
             return NO_ERROR;
         } break;
         case SET_OUTPUT_FORMAT: {
-            LOGV("SET_OUTPUT_FORMAT");
+            ALOGV("SET_OUTPUT_FORMAT");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int of = data.readInt32();
             reply->writeInt32(setOutputFormat(of));
             return NO_ERROR;
         } break;
         case SET_VIDEO_ENCODER: {
-            LOGV("SET_VIDEO_ENCODER");
+            ALOGV("SET_VIDEO_ENCODER");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int ve = data.readInt32();
             reply->writeInt32(setVideoEncoder(ve));
             return NO_ERROR;
         } break;
         case SET_AUDIO_ENCODER: {
-            LOGV("SET_AUDIO_ENCODER");
+            ALOGV("SET_AUDIO_ENCODER");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int ae = data.readInt32();
             reply->writeInt32(setAudioEncoder(ae));
@@ -378,14 +378,14 @@
 
         } break;
         case SET_OUTPUT_FILE_PATH: {
-            LOGV("SET_OUTPUT_FILE_PATH");
+            ALOGV("SET_OUTPUT_FILE_PATH");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             const char* path = data.readCString();
             reply->writeInt32(setOutputFile(path));
             return NO_ERROR;
         } break;
         case SET_OUTPUT_FILE_FD: {
-            LOGV("SET_OUTPUT_FILE_FD");
+            ALOGV("SET_OUTPUT_FILE_FD");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int fd = dup(data.readFileDescriptor());
             int64_t offset = data.readInt64();
@@ -395,7 +395,7 @@
             return NO_ERROR;
         } break;
         case SET_VIDEO_SIZE: {
-            LOGV("SET_VIDEO_SIZE");
+            ALOGV("SET_VIDEO_SIZE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int width = data.readInt32();
             int height = data.readInt32();
@@ -403,20 +403,20 @@
             return NO_ERROR;
         } break;
         case SET_VIDEO_FRAMERATE: {
-            LOGV("SET_VIDEO_FRAMERATE");
+            ALOGV("SET_VIDEO_FRAMERATE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int frames_per_second = data.readInt32();
             reply->writeInt32(setVideoFrameRate(frames_per_second));
             return NO_ERROR;
         } break;
         case SET_PARAMETERS: {
-            LOGV("SET_PARAMETER");
+            ALOGV("SET_PARAMETER");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(setParameters(data.readString8()));
             return NO_ERROR;
         } break;
         case SET_LISTENER: {
-            LOGV("SET_LISTENER");
+            ALOGV("SET_LISTENER");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             sp<IMediaRecorderClient> listener =
                 interface_cast<IMediaRecorderClient>(data.readStrongBinder());
@@ -424,14 +424,14 @@
             return NO_ERROR;
         } break;
         case SET_PREVIEW_SURFACE: {
-            LOGV("SET_PREVIEW_SURFACE");
+            ALOGV("SET_PREVIEW_SURFACE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             sp<Surface> surface = Surface::readFromParcel(data);
             reply->writeInt32(setPreviewSurface(surface));
             return NO_ERROR;
         } break;
         case SET_CAMERA: {
-            LOGV("SET_CAMERA");
+            ALOGV("SET_CAMERA");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             sp<ICamera> camera = interface_cast<ICamera>(data.readStrongBinder());
             sp<ICameraRecordingProxy> proxy =
@@ -440,7 +440,7 @@
             return NO_ERROR;
         } break;
         case QUERY_SURFACE_MEDIASOURCE: {
-            LOGV("QUERY_SURFACE_MEDIASOURCE");
+            ALOGV("QUERY_SURFACE_MEDIASOURCE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             // call the mediaserver side to create
             // a surfacemediasource
diff --git a/media/libmedia/IOMX.cpp b/media/libmedia/IOMX.cpp
index 7d2fbce..d2f5f71 100644
--- a/media/libmedia/IOMX.cpp
+++ b/media/libmedia/IOMX.cpp
@@ -407,7 +407,7 @@
 
 #define CHECK_INTERFACE(interface, data, reply) \
         do { if (!data.enforceInterface(interface::getInterfaceDescriptor())) { \
-            LOGW("Call incorrectly routed to " #interface); \
+            ALOGW("Call incorrectly routed to " #interface); \
             return PERMISSION_DENIED; \
         } } while (0)
 
diff --git a/media/libmedia/JetPlayer.cpp b/media/libmedia/JetPlayer.cpp
index 8b953e0..fa5b67a 100644
--- a/media/libmedia/JetPlayer.cpp
+++ b/media/libmedia/JetPlayer.cpp
@@ -42,7 +42,7 @@
         mAudioTrack(NULL),
         mTrackBufferSize(trackBufferSize)
 {
-    LOGV("JetPlayer constructor");
+    ALOGV("JetPlayer constructor");
     mPreviousJetStatus.currentUserID = -1;
     mPreviousJetStatus.segmentRepeatCount = -1;
     mPreviousJetStatus.numQueuedSegments = -1;
@@ -52,7 +52,7 @@
 //-------------------------------------------------------------------------------------------------
 JetPlayer::~JetPlayer()
 {
-    LOGV("~JetPlayer");
+    ALOGV("~JetPlayer");
     release();
 
 }
@@ -68,21 +68,21 @@
     if (pLibConfig == NULL)
         pLibConfig = EAS_Config();
     if (pLibConfig == NULL) {
-        LOGE("JetPlayer::init(): EAS library configuration could not be retrieved, aborting.");
+        ALOGE("JetPlayer::init(): EAS library configuration could not be retrieved, aborting.");
         return EAS_FAILURE;
     }
 
     // init the EAS library
     result = EAS_Init(&mEasData);
     if( result != EAS_SUCCESS) {
-        LOGE("JetPlayer::init(): Error initializing Sonivox EAS library, aborting.");
+        ALOGE("JetPlayer::init(): Error initializing Sonivox EAS library, aborting.");
         mState = EAS_STATE_ERROR;
         return result;
     }
     // init the JET library with the default app event controller range
     result = JET_Init(mEasData, NULL, sizeof(S_JET_CONFIG));
     if( result != EAS_SUCCESS) {
-        LOGE("JetPlayer::init(): Error initializing JET library, aborting.");
+        ALOGE("JetPlayer::init(): Error initializing JET library, aborting.");
         mState = EAS_STATE_ERROR;
         return result;
     }
@@ -99,16 +99,16 @@
     // create render and playback thread
     {
         Mutex::Autolock l(mMutex);
-        LOGV("JetPlayer::init(): trying to start render thread");
+        ALOGV("JetPlayer::init(): trying to start render thread");
         createThreadEtc(renderThread, this, "jetRenderThread", ANDROID_PRIORITY_AUDIO);
         mCondition.wait(mMutex);
     }
     if (mTid > 0) {
         // render thread started, we're ready
-        LOGV("JetPlayer::init(): render thread(%d) successfully started.", mTid);
+        ALOGV("JetPlayer::init(): render thread(%d) successfully started.", mTid);
         mState = EAS_STATE_READY;
     } else {
-        LOGE("JetPlayer::init(): failed to start render thread.");
+        ALOGE("JetPlayer::init(): failed to start render thread.");
         mState = EAS_STATE_ERROR;
         return EAS_FAILURE;
     }
@@ -125,7 +125,7 @@
 //-------------------------------------------------------------------------------------------------
 int JetPlayer::release()
 {
-    LOGV("JetPlayer::release()");
+    ALOGV("JetPlayer::release()");
     Mutex::Autolock lock(mMutex);
     mPaused = true;
     mRender = false;
@@ -168,13 +168,13 @@
     int temp;
     bool audioStarted = false;
 
-    LOGV("JetPlayer::render(): entering");
+    ALOGV("JetPlayer::render(): entering");
 
     // allocate render buffer
     mAudioBuffer = 
         new EAS_PCM[pLibConfig->mixBufferSize * pLibConfig->numChannels * MIX_NUM_BUFFERS];
     if (!mAudioBuffer) {
-        LOGE("JetPlayer::render(): mAudioBuffer allocate failed");
+        ALOGE("JetPlayer::render(): mAudioBuffer allocate failed");
         goto threadExit;
     }
 
@@ -182,7 +182,7 @@
     {
         Mutex::Autolock l(mMutex);
         mTid = gettid();
-        LOGV("JetPlayer::render(): render thread(%d) signal", mTid);
+        ALOGV("JetPlayer::render(): render thread(%d) signal", mTid);
         mCondition.signal();
     }
 
@@ -192,21 +192,21 @@
 
         if (mEasData == NULL) {
             mMutex.unlock();
-            LOGV("JetPlayer::render(): NULL EAS data, exiting render.");
+            ALOGV("JetPlayer::render(): NULL EAS data, exiting render.");
             goto threadExit;
         }
             
         // nothing to render, wait for client thread to wake us up
         while (!mRender)
         {
-            LOGV("JetPlayer::render(): signal wait");
+            ALOGV("JetPlayer::render(): signal wait");
             if (audioStarted) { 
                 mAudioTrack->pause(); 
                 // we have to restart the playback once we start rendering again
                 audioStarted = false;
             }
             mCondition.wait(mMutex);
-            LOGV("JetPlayer::render(): signal rx'd");
+            ALOGV("JetPlayer::render(): signal rx'd");
         }
         
         // render midi data into the input buffer
@@ -215,7 +215,7 @@
         for (int i = 0; i < MIX_NUM_BUFFERS; i++) {
             result = EAS_Render(mEasData, p, pLibConfig->mixBufferSize, &count);
             if (result != EAS_SUCCESS) {
-                LOGE("JetPlayer::render(): EAS_Render returned error %ld", result);
+                ALOGE("JetPlayer::render(): EAS_Render returned error %ld", result);
             }
             p += count * pLibConfig->numChannels;
             num_output += count * pLibConfig->numChannels * sizeof(EAS_PCM);
@@ -225,7 +225,7 @@
         }
 
         // update playback state
-        //LOGV("JetPlayer::render(): updating state");
+        //ALOGV("JetPlayer::render(): updating state");
         JET_Status(mEasData, &mJetStatus);
         fireUpdateOnStatusChange();
         mPaused = mJetStatus.paused;
@@ -234,20 +234,20 @@
 
         // check audio output track
         if (mAudioTrack == NULL) {
-            LOGE("JetPlayer::render(): output AudioTrack was not created");
+            ALOGE("JetPlayer::render(): output AudioTrack was not created");
             goto threadExit;
         }
 
         // Write data to the audio hardware
-        //LOGV("JetPlayer::render(): writing to audio output");
+        //ALOGV("JetPlayer::render(): writing to audio output");
         if ((temp = mAudioTrack->write(mAudioBuffer, num_output)) < 0) {
-            LOGE("JetPlayer::render(): Error in writing:%d",temp);
+            ALOGE("JetPlayer::render(): Error in writing:%d",temp);
             return temp;
         }
 
         // start audio output if necessary
         if (!audioStarted) {
-            LOGV("JetPlayer::render(): starting audio playback");
+            ALOGV("JetPlayer::render(): starting audio playback");
             mAudioTrack->start();
             audioStarted = true;
         }
@@ -338,7 +338,7 @@
 //-------------------------------------------------------------------------------------------------
 int JetPlayer::loadFromFile(const char* path)
 {
-    LOGV("JetPlayer::loadFromFile(): path=%s", path);
+    ALOGV("JetPlayer::loadFromFile(): path=%s", path);
 
     Mutex::Autolock lock(mMutex);
 
@@ -363,7 +363,7 @@
 //-------------------------------------------------------------------------------------------------
 int JetPlayer::loadFromFD(const int fd, const long long offset, const long long length)
 {
-    LOGV("JetPlayer::loadFromFD(): fd=%d offset=%lld length=%lld", fd, offset, length);
+    ALOGV("JetPlayer::loadFromFD(): fd=%d offset=%lld length=%lld", fd, offset, length);
     
     Mutex::Autolock lock(mMutex);
 
@@ -393,7 +393,7 @@
 //-------------------------------------------------------------------------------------------------
 int JetPlayer::play()
 {
-    LOGV("JetPlayer::play(): entering");
+    ALOGV("JetPlayer::play(): entering");
     Mutex::Autolock lock(mMutex);
 
     EAS_RESULT result = JET_Play(mEasData);
@@ -407,7 +407,7 @@
     fireUpdateOnStatusChange();
 
     // wake up render thread
-    LOGV("JetPlayer::play(): wakeup render thread");
+    ALOGV("JetPlayer::play(): wakeup render thread");
     mCondition.signal();
 
     return result;
@@ -435,7 +435,7 @@
 int JetPlayer::queueSegment(int segmentNum, int libNum, int repeatCount, int transpose,
         EAS_U32 muteFlags, EAS_U8 userID)
 {
-    LOGV("JetPlayer::queueSegment segmentNum=%d, libNum=%d, repeatCount=%d, transpose=%d",
+    ALOGV("JetPlayer::queueSegment segmentNum=%d, libNum=%d, repeatCount=%d, transpose=%d",
         segmentNum, libNum, repeatCount, transpose);
     Mutex::Autolock lock(mMutex);
     return JET_QueueSegment(mEasData, segmentNum, libNum, repeatCount, transpose, muteFlags, userID);
@@ -458,7 +458,7 @@
 //-------------------------------------------------------------------------------------------------
 int JetPlayer::triggerClip(int clipId)
 {
-    LOGV("JetPlayer::triggerClip clipId=%d", clipId);
+    ALOGV("JetPlayer::triggerClip clipId=%d", clipId);
     Mutex::Autolock lock(mMutex);
     return JET_TriggerClip(mEasData, clipId);
 }
@@ -466,7 +466,7 @@
 //-------------------------------------------------------------------------------------------------
 int JetPlayer::clearQueue()
 {
-    LOGV("JetPlayer::clearQueue");
+    ALOGV("JetPlayer::clearQueue");
     Mutex::Autolock lock(mMutex);
     return JET_Clear_Queue(mEasData);
 }
@@ -474,17 +474,17 @@
 //-------------------------------------------------------------------------------------------------
 void JetPlayer::dump()
 {
-    LOGE("JetPlayer dump: JET file=%s", mEasJetFileLoc->path);
+    ALOGE("JetPlayer dump: JET file=%s", mEasJetFileLoc->path);
 }
 
 void JetPlayer::dumpJetStatus(S_JET_STATUS* pJetStatus)
 {
     if(pJetStatus!=NULL)
-        LOGV(">> current JET player status: userID=%d segmentRepeatCount=%d numQueuedSegments=%d paused=%d",
+        ALOGV(">> current JET player status: userID=%d segmentRepeatCount=%d numQueuedSegments=%d paused=%d",
                 pJetStatus->currentUserID, pJetStatus->segmentRepeatCount,
                 pJetStatus->numQueuedSegments, pJetStatus->paused);
     else
-        LOGE(">> JET player status is NULL");
+        ALOGE(">> JET player status is NULL");
 }
 
 
diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp
index 6096b72..c905762 100644
--- a/media/libmedia/MediaProfiles.cpp
+++ b/media/libmedia/MediaProfiles.cpp
@@ -82,67 +82,67 @@
 /*static*/ void
 MediaProfiles::logVideoCodec(const MediaProfiles::VideoCodec& codec)
 {
-    LOGV("video codec:");
-    LOGV("codec = %d", codec.mCodec);
-    LOGV("bit rate: %d", codec.mBitRate);
-    LOGV("frame width: %d", codec.mFrameWidth);
-    LOGV("frame height: %d", codec.mFrameHeight);
-    LOGV("frame rate: %d", codec.mFrameRate);
+    ALOGV("video codec:");
+    ALOGV("codec = %d", codec.mCodec);
+    ALOGV("bit rate: %d", codec.mBitRate);
+    ALOGV("frame width: %d", codec.mFrameWidth);
+    ALOGV("frame height: %d", codec.mFrameHeight);
+    ALOGV("frame rate: %d", codec.mFrameRate);
 }
 
 /*static*/ void
 MediaProfiles::logAudioCodec(const MediaProfiles::AudioCodec& codec)
 {
-    LOGV("audio codec:");
-    LOGV("codec = %d", codec.mCodec);
-    LOGV("bit rate: %d", codec.mBitRate);
-    LOGV("sample rate: %d", codec.mSampleRate);
-    LOGV("number of channels: %d", codec.mChannels);
+    ALOGV("audio codec:");
+    ALOGV("codec = %d", codec.mCodec);
+    ALOGV("bit rate: %d", codec.mBitRate);
+    ALOGV("sample rate: %d", codec.mSampleRate);
+    ALOGV("number of channels: %d", codec.mChannels);
 }
 
 /*static*/ void
 MediaProfiles::logVideoEncoderCap(const MediaProfiles::VideoEncoderCap& cap)
 {
-    LOGV("video encoder cap:");
-    LOGV("codec = %d", cap.mCodec);
-    LOGV("bit rate: min = %d and max = %d", cap.mMinBitRate, cap.mMaxBitRate);
-    LOGV("frame width: min = %d and max = %d", cap.mMinFrameWidth, cap.mMaxFrameWidth);
-    LOGV("frame height: min = %d and max = %d", cap.mMinFrameHeight, cap.mMaxFrameHeight);
-    LOGV("frame rate: min = %d and max = %d", cap.mMinFrameRate, cap.mMaxFrameRate);
+    ALOGV("video encoder cap:");
+    ALOGV("codec = %d", cap.mCodec);
+    ALOGV("bit rate: min = %d and max = %d", cap.mMinBitRate, cap.mMaxBitRate);
+    ALOGV("frame width: min = %d and max = %d", cap.mMinFrameWidth, cap.mMaxFrameWidth);
+    ALOGV("frame height: min = %d and max = %d", cap.mMinFrameHeight, cap.mMaxFrameHeight);
+    ALOGV("frame rate: min = %d and max = %d", cap.mMinFrameRate, cap.mMaxFrameRate);
 }
 
 /*static*/ void
 MediaProfiles::logAudioEncoderCap(const MediaProfiles::AudioEncoderCap& cap)
 {
-    LOGV("audio encoder cap:");
-    LOGV("codec = %d", cap.mCodec);
-    LOGV("bit rate: min = %d and max = %d", cap.mMinBitRate, cap.mMaxBitRate);
-    LOGV("sample rate: min = %d and max = %d", cap.mMinSampleRate, cap.mMaxSampleRate);
-    LOGV("number of channels: min = %d and max = %d", cap.mMinChannels, cap.mMaxChannels);
+    ALOGV("audio encoder cap:");
+    ALOGV("codec = %d", cap.mCodec);
+    ALOGV("bit rate: min = %d and max = %d", cap.mMinBitRate, cap.mMaxBitRate);
+    ALOGV("sample rate: min = %d and max = %d", cap.mMinSampleRate, cap.mMaxSampleRate);
+    ALOGV("number of channels: min = %d and max = %d", cap.mMinChannels, cap.mMaxChannels);
 }
 
 /*static*/ void
 MediaProfiles::logVideoDecoderCap(const MediaProfiles::VideoDecoderCap& cap)
 {
-    LOGV("video decoder cap:");
-    LOGV("codec = %d", cap.mCodec);
+    ALOGV("video decoder cap:");
+    ALOGV("codec = %d", cap.mCodec);
 }
 
 /*static*/ void
 MediaProfiles::logAudioDecoderCap(const MediaProfiles::AudioDecoderCap& cap)
 {
-    LOGV("audio codec cap:");
-    LOGV("codec = %d", cap.mCodec);
+    ALOGV("audio codec cap:");
+    ALOGV("codec = %d", cap.mCodec);
 }
 
 /*static*/ void
 MediaProfiles::logVideoEditorCap(const MediaProfiles::VideoEditorCap& cap)
 {
-    LOGV("videoeditor cap:");
-    LOGV("mMaxInputFrameWidth = %d", cap.mMaxInputFrameWidth);
-    LOGV("mMaxInputFrameHeight = %d", cap.mMaxInputFrameHeight);
-    LOGV("mMaxOutputFrameWidth = %d", cap.mMaxOutputFrameWidth);
-    LOGV("mMaxOutputFrameHeight = %d", cap.mMaxOutputFrameHeight);
+    ALOGV("videoeditor cap:");
+    ALOGV("mMaxInputFrameWidth = %d", cap.mMaxInputFrameWidth);
+    ALOGV("mMaxInputFrameHeight = %d", cap.mMaxInputFrameHeight);
+    ALOGV("mMaxOutputFrameWidth = %d", cap.mMaxOutputFrameWidth);
+    ALOGV("mMaxOutputFrameHeight = %d", cap.mMaxOutputFrameHeight);
 }
 
 /*static*/ int
@@ -349,7 +349,7 @@
 {
     CHECK(!strcmp("quality", atts[0]));
     int quality = atoi(atts[1]);
-    LOGV("%s: cameraId=%d, quality=%d\n", __func__, cameraId, quality);
+    ALOGV("%s: cameraId=%d, quality=%d\n", __func__, cameraId, quality);
     ImageEncodingQualityLevels *levels = findImageEncodingQualityLevels(cameraId);
 
     if (levels == NULL) {
@@ -377,7 +377,7 @@
         offsetTimeMs = atoi(atts[3]);
     }
 
-    LOGV("%s: cameraId=%d, offset=%d ms", __func__, cameraId, offsetTimeMs);
+    ALOGV("%s: cameraId=%d, offset=%d ms", __func__, cameraId, offsetTimeMs);
     mStartTimeOffsets.replaceValueFor(cameraId, offsetTimeMs);
 }
 /*static*/ MediaProfiles::ExportVideoProfile*
@@ -465,7 +465,7 @@
 }
 
 void MediaProfiles::initRequiredProfileRefs(const Vector<int>& cameraIds) {
-    LOGV("Number of camera ids: %d", cameraIds.size());
+    ALOGV("Number of camera ids: %d", cameraIds.size());
     CHECK(cameraIds.size() > 0);
     mRequiredProfileRefs = new RequiredProfiles[cameraIds.size()];
     for (size_t i = 0, n = cameraIds.size(); i < n; ++i) {
@@ -592,14 +592,14 @@
 
                 int index = getCamcorderProfileIndex(cameraId, profile->mQuality);
                 if (index != -1) {
-                    LOGV("Profile quality %d for camera %d already exists",
+                    ALOGV("Profile quality %d for camera %d already exists",
                         profile->mQuality, cameraId);
                     CHECK(index == refIndex);
                     continue;
                 }
 
                 // Insert the new profile
-                LOGV("Add a profile: quality %d=>%d for camera %d",
+                ALOGV("Add a profile: quality %d=>%d for camera %d",
                         mCamcorderProfiles[info->mRefProfileIndex]->mQuality,
                         profile->mQuality, cameraId);
 
@@ -612,7 +612,7 @@
 /*static*/ MediaProfiles*
 MediaProfiles::getInstance()
 {
-    LOGV("getInstance");
+    ALOGV("getInstance");
     Mutex::Autolock lock(sLock);
     if (!sIsInitialized) {
         char value[PROPERTY_VALUE_MAX];
@@ -620,7 +620,7 @@
             const char *defaultXmlFile = "/etc/media_profiles.xml";
             FILE *fp = fopen(defaultXmlFile, "r");
             if (fp == NULL) {
-                LOGW("could not find media config xml file");
+                ALOGW("could not find media config xml file");
                 sInstance = createDefaultInstance();
             } else {
                 fclose(fp);  // close the file first.
@@ -903,7 +903,7 @@
       expat is not compiled with -DXML_DTD. We don't have DTD parsing support.
 
       if (!::XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS)) {
-          LOGE("failed to enable DTD support in the xml file");
+          ALOGE("failed to enable DTD support in the xml file");
           return UNKNOWN_ERROR;
       }
 
@@ -913,7 +913,7 @@
     for (;;) {
         void *buff = ::XML_GetBuffer(parser, BUFF_SIZE);
         if (buff == NULL) {
-            LOGE("failed to in call to XML_GetBuffer()");
+            ALOGE("failed to in call to XML_GetBuffer()");
             delete profiles;
             profiles = NULL;
             goto exit;
@@ -921,7 +921,7 @@
 
         int bytes_read = ::fread(buff, 1, BUFF_SIZE, fp);
         if (bytes_read < 0) {
-            LOGE("failed in call to read");
+            ALOGE("failed in call to read");
             delete profiles;
             profiles = NULL;
             goto exit;
@@ -954,7 +954,7 @@
 
 int MediaProfiles::getVideoEncoderParamByName(const char *name, video_encoder codec) const
 {
-    LOGV("getVideoEncoderParamByName: %s for codec %d", name, codec);
+    ALOGV("getVideoEncoderParamByName: %s for codec %d", name, codec);
     int index = -1;
     for (size_t i = 0, n = mVideoEncoders.size(); i < n; ++i) {
         if (mVideoEncoders[i]->mCodec == codec) {
@@ -963,7 +963,7 @@
         }
     }
     if (index == -1) {
-        LOGE("The given video encoder %d is not found", codec);
+        ALOGE("The given video encoder %d is not found", codec);
         return -1;
     }
 
@@ -976,13 +976,13 @@
     if (!strcmp("enc.vid.fps.min", name)) return mVideoEncoders[index]->mMinFrameRate;
     if (!strcmp("enc.vid.fps.max", name)) return mVideoEncoders[index]->mMaxFrameRate;
 
-    LOGE("The given video encoder param name %s is not found", name);
+    ALOGE("The given video encoder param name %s is not found", name);
     return -1;
 }
 int MediaProfiles::getVideoEditorExportParamByName(
     const char *name, int codec) const
 {
-    LOGV("getVideoEditorExportParamByName: name %s codec %d", name, codec);
+    ALOGV("getVideoEditorExportParamByName: name %s codec %d", name, codec);
     ExportVideoProfile *exportProfile = NULL;
     int index = -1;
     for (size_t i =0; i < mVideoEditorExportProfiles.size(); i++) {
@@ -993,7 +993,7 @@
         }
     }
     if (index == -1) {
-        LOGE("The given video decoder %d is not found", codec);
+        ALOGE("The given video decoder %d is not found", codec);
         return -1;
     }
     if (!strcmp("videoeditor.export.profile", name))
@@ -1001,15 +1001,15 @@
     if (!strcmp("videoeditor.export.level", name))
         return exportProfile->mLevel;
 
-    LOGE("The given video editor export param name %s is not found", name);
+    ALOGE("The given video editor export param name %s is not found", name);
     return -1;
 }
 int MediaProfiles::getVideoEditorCapParamByName(const char *name) const
 {
-    LOGV("getVideoEditorCapParamByName: %s", name);
+    ALOGV("getVideoEditorCapParamByName: %s", name);
 
     if (mVideoEditorCap == NULL) {
-        LOGE("The mVideoEditorCap is not created, then create default cap.");
+        ALOGE("The mVideoEditorCap is not created, then create default cap.");
         createDefaultVideoEditorCap(sInstance);
     }
 
@@ -1024,7 +1024,7 @@
     if (!strcmp("maxPrefetchYUVFrames", name))
         return mVideoEditorCap->mMaxPrefetchYUVFrames;
 
-    LOGE("The given video editor param name %s is not found", name);
+    ALOGE("The given video editor param name %s is not found", name);
     return -1;
 }
 
@@ -1039,7 +1039,7 @@
 
 int MediaProfiles::getAudioEncoderParamByName(const char *name, audio_encoder codec) const
 {
-    LOGV("getAudioEncoderParamByName: %s for codec %d", name, codec);
+    ALOGV("getAudioEncoderParamByName: %s for codec %d", name, codec);
     int index = -1;
     for (size_t i = 0, n = mAudioEncoders.size(); i < n; ++i) {
         if (mAudioEncoders[i]->mCodec == codec) {
@@ -1048,7 +1048,7 @@
         }
     }
     if (index == -1) {
-        LOGE("The given audio encoder %d is not found", codec);
+        ALOGE("The given audio encoder %d is not found", codec);
         return -1;
     }
 
@@ -1059,7 +1059,7 @@
     if (!strcmp("enc.aud.hz.min", name)) return mAudioEncoders[index]->mMinSampleRate;
     if (!strcmp("enc.aud.hz.max", name)) return mAudioEncoders[index]->mMaxSampleRate;
 
-    LOGE("The given audio encoder param name %s is not found", name);
+    ALOGE("The given audio encoder param name %s is not found", name);
     return -1;
 }
 
@@ -1098,12 +1098,12 @@
                                                   int cameraId,
                                                   camcorder_quality quality) const
 {
-    LOGV("getCamcorderProfileParamByName: %s for camera %d, quality %d",
+    ALOGV("getCamcorderProfileParamByName: %s for camera %d, quality %d",
          name, cameraId, quality);
 
     int index = getCamcorderProfileIndex(cameraId, quality);
     if (index == -1) {
-        LOGE("The given camcorder profile camera %d quality %d is not found",
+        ALOGE("The given camcorder profile camera %d quality %d is not found",
              cameraId, quality);
         return -1;
     }
@@ -1120,7 +1120,7 @@
     if (!strcmp("aud.ch", name)) return mCamcorderProfiles[index]->mAudioCodec->mChannels;
     if (!strcmp("aud.hz", name)) return mCamcorderProfiles[index]->mAudioCodec->mSampleRate;
 
-    LOGE("The given camcorder profile param id %d name %s is not found", cameraId, name);
+    ALOGE("The given camcorder profile param id %d name %s is not found", cameraId, name);
     return -1;
 }
 
@@ -1145,7 +1145,7 @@
     if (index >= 0) {
         offsetTimeMs = mStartTimeOffsets.valueFor(cameraId);
     }
-    LOGV("offsetTime=%d ms and cameraId=%d", offsetTimeMs, cameraId);
+    ALOGV("offsetTime=%d ms and cameraId=%d", offsetTimeMs, cameraId);
     return offsetTimeMs;
 }
 
diff --git a/media/libmedia/MediaScanner.cpp b/media/libmedia/MediaScanner.cpp
index 19dedfc..79cab74 100644
--- a/media/libmedia/MediaScanner.cpp
+++ b/media/libmedia/MediaScanner.cpp
@@ -135,7 +135,7 @@
     struct dirent* entry;
 
     if (shouldSkipDirectory(path)) {
-      LOGD("Skipping: %s", path);
+      ALOGD("Skipping: %s", path);
       return MEDIA_SCAN_RESULT_OK;
     }
 
@@ -143,7 +143,7 @@
     if (pathRemaining >= 8 /* strlen(".nomedia") */ ) {
         strcpy(fileSpot, ".nomedia");
         if (access(path, F_OK) == 0) {
-            LOGV("found .nomedia, setting noMedia flag\n");
+            ALOGV("found .nomedia, setting noMedia flag\n");
             noMedia = true;
         }
 
@@ -153,7 +153,7 @@
 
     DIR* dir = opendir(path);
     if (!dir) {
-        LOGW("Error opening directory '%s', skipping: %s.", path, strerror(errno));
+        ALOGW("Error opening directory '%s', skipping: %s.", path, strerror(errno));
         return MEDIA_SCAN_RESULT_SKIPPED;
     }
 
@@ -199,7 +199,7 @@
                 type = DT_DIR;
             }
         } else {
-            LOGD("stat() failed for %s: %s", path, strerror(errno) );
+            ALOGD("stat() failed for %s: %s", path, strerror(errno) );
         }
     }
     if (type == DT_DIR) {
diff --git a/media/libmedia/MediaScannerClient.cpp b/media/libmedia/MediaScannerClient.cpp
index 629b165..40b8188 100644
--- a/media/libmedia/MediaScannerClient.cpp
+++ b/media/libmedia/MediaScannerClient.cpp
@@ -142,12 +142,12 @@
 
         UConverter *conv = ucnv_open(enc, &status);
         if (U_FAILURE(status)) {
-            LOGE("could not create UConverter for %s\n", enc);
+            ALOGE("could not create UConverter for %s\n", enc);
             return;
         }
         UConverter *utf8Conv = ucnv_open("UTF-8", &status);
         if (U_FAILURE(status)) {
-            LOGE("could not create UConverter for UTF-8\n");
+            ALOGE("could not create UConverter for UTF-8\n");
             ucnv_close(conv);
             return;
         }
@@ -180,7 +180,7 @@
             ucnv_convertEx(utf8Conv, conv, &target, target + targetLength,
                     &source, (const char *)dest, NULL, NULL, NULL, NULL, TRUE, TRUE, &status);
             if (U_FAILURE(status)) {
-                LOGE("ucnv_convertEx failed: %d\n", status);
+                ALOGE("ucnv_convertEx failed: %d\n", status);
                 mValues->setEntry(i, "???");
             } else {
                 // zero terminate
diff --git a/media/libmedia/Metadata.cpp b/media/libmedia/Metadata.cpp
index 8eeebbb..546a9b0 100644
--- a/media/libmedia/Metadata.cpp
+++ b/media/libmedia/Metadata.cpp
@@ -135,7 +135,7 @@
 {
     if (key < FIRST_SYSTEM_ID ||
         (LAST_SYSTEM_ID < key && key < FIRST_CUSTOM_ID)) {
-        LOGE("Bad key %d", key);
+        ALOGE("Bad key %d", key);
         return false;
     }
     size_t curr = mData->dataPosition();
@@ -152,7 +152,7 @@
             break;
         }
         if (mData->readInt32() == key) {
-            LOGE("Key exists already %d", key);
+            ALOGE("Key exists already %d", key);
             error = true;
             break;
         }
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp
index 7c2200e..35dfbb8 100644
--- a/media/libmedia/ToneGenerator.cpp
+++ b/media/libmedia/ToneGenerator.cpp
@@ -800,12 +800,12 @@
 ////////////////////////////////////////////////////////////////////////////////
 ToneGenerator::ToneGenerator(int streamType, float volume, bool threadCanCallJava) {
 
-    LOGV("ToneGenerator constructor: streamType=%d, volume=%f\n", streamType, volume);
+    ALOGV("ToneGenerator constructor: streamType=%d, volume=%f\n", streamType, volume);
 
     mState = TONE_IDLE;
 
     if (AudioSystem::getOutputSamplingRate(&mSamplingRate, streamType) != NO_ERROR) {
-        LOGE("Unable to marshal AudioFlinger");
+        ALOGE("Unable to marshal AudioFlinger");
         return;
     }
     mThreadCanCallJava = threadCanCallJava;
@@ -829,9 +829,9 @@
     }
 
     if (initAudioTrack()) {
-        LOGV("ToneGenerator INIT OK, time: %d\n", (unsigned int)(systemTime()/1000000));
+        ALOGV("ToneGenerator INIT OK, time: %d\n", (unsigned int)(systemTime()/1000000));
     } else {
-        LOGV("!!!ToneGenerator INIT FAILED!!!\n");
+        ALOGV("!!!ToneGenerator INIT FAILED!!!\n");
     }
 }
 
@@ -853,11 +853,11 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 ToneGenerator::~ToneGenerator() {
-    LOGV("ToneGenerator destructor\n");
+    ALOGV("ToneGenerator destructor\n");
 
     if (mpAudioTrack) {
         stopTone();
-        LOGV("Delete Track: %p\n", mpAudioTrack);
+        ALOGV("Delete Track: %p\n", mpAudioTrack);
         delete mpAudioTrack;
     }
 }
@@ -886,13 +886,13 @@
         return lResult;
 
     if (mState == TONE_IDLE) {
-        LOGV("startTone: try to re-init AudioTrack");
+        ALOGV("startTone: try to re-init AudioTrack");
         if (!initAudioTrack()) {
             return lResult;
         }
     }
 
-    LOGV("startTone\n");
+    ALOGV("startTone\n");
 
     mLock.lock();
 
@@ -903,10 +903,10 @@
     mDurationMs = durationMs;
 
     if (mState == TONE_STOPPED) {
-        LOGV("Start waiting for previous tone to stop");
+        ALOGV("Start waiting for previous tone to stop");
         lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
         if (lStatus != NO_ERROR) {
-            LOGE("--- start wait for stop timed out, status %d", lStatus);
+            ALOGE("--- start wait for stop timed out, status %d", lStatus);
             mState = TONE_IDLE;
             mLock.unlock();
             return lResult;
@@ -915,17 +915,17 @@
 
     if (mState == TONE_INIT) {
         if (prepareWave()) {
-            LOGV("Immediate start, time %d\n", (unsigned int)(systemTime()/1000000));
+            ALOGV("Immediate start, time %d\n", (unsigned int)(systemTime()/1000000));
             lResult = true;
             mState = TONE_STARTING;
             mLock.unlock();
             mpAudioTrack->start();
             mLock.lock();
             if (mState == TONE_STARTING) {
-                LOGV("Wait for start callback");
+                ALOGV("Wait for start callback");
                 lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
                 if (lStatus != NO_ERROR) {
-                    LOGE("--- Immediate start timed out, status %d", lStatus);
+                    ALOGE("--- Immediate start timed out, status %d", lStatus);
                     mState = TONE_IDLE;
                     lResult = false;
                 }
@@ -934,23 +934,23 @@
             mState = TONE_IDLE;
         }
     } else {
-        LOGV("Delayed start\n");
+        ALOGV("Delayed start\n");
         mState = TONE_RESTARTING;
         lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
         if (lStatus == NO_ERROR) {
             if (mState != TONE_IDLE) {
                 lResult = true;
             }
-            LOGV("cond received");
+            ALOGV("cond received");
         } else {
-            LOGE("--- Delayed start timed out, status %d", lStatus);
+            ALOGE("--- Delayed start timed out, status %d", lStatus);
             mState = TONE_IDLE;
         }
     }
     mLock.unlock();
 
-    LOGV_IF(lResult, "Tone started, time %d\n", (unsigned int)(systemTime()/1000000));
-    LOGW_IF(!lResult, "Tone start failed!!!, time %d\n", (unsigned int)(systemTime()/1000000));
+    ALOGV_IF(lResult, "Tone started, time %d\n", (unsigned int)(systemTime()/1000000));
+    ALOGW_IF(!lResult, "Tone start failed!!!, time %d\n", (unsigned int)(systemTime()/1000000));
 
     return lResult;
 }
@@ -969,17 +969,17 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 void ToneGenerator::stopTone() {
-    LOGV("stopTone");
+    ALOGV("stopTone");
 
     mLock.lock();
     if (mState == TONE_PLAYING || mState == TONE_STARTING || mState == TONE_RESTARTING) {
         mState = TONE_STOPPING;
-        LOGV("waiting cond");
+        ALOGV("waiting cond");
         status_t lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
         if (lStatus == NO_ERROR) {
-            LOGV("track stop complete, time %d", (unsigned int)(systemTime()/1000000));
+            ALOGV("track stop complete, time %d", (unsigned int)(systemTime()/1000000));
         } else {
-            LOGE("--- Stop timed out");
+            ALOGE("--- Stop timed out");
             mState = TONE_IDLE;
             mpAudioTrack->stop();
         }
@@ -1018,10 +1018,10 @@
    // Open audio track in mono, PCM 16bit, default sampling rate, default buffer size
     mpAudioTrack = new AudioTrack();
     if (mpAudioTrack == 0) {
-        LOGE("AudioTrack allocation failed");
+        ALOGE("AudioTrack allocation failed");
         goto initAudioTrack_exit;
     }
-    LOGV("Create Track: %p\n", mpAudioTrack);
+    ALOGV("Create Track: %p\n", mpAudioTrack);
 
     mpAudioTrack->set(mStreamType,
                       0,
@@ -1036,7 +1036,7 @@
                       mThreadCanCallJava);
 
     if (mpAudioTrack->initCheck() != NO_ERROR) {
-        LOGE("AudioTrack->initCheck failed");
+        ALOGE("AudioTrack->initCheck failed");
         goto initAudioTrack_exit;
     }
 
@@ -1050,7 +1050,7 @@
 
     // Cleanup
     if (mpAudioTrack) {
-        LOGV("Delete Track I: %p\n", mpAudioTrack);
+        ALOGV("Delete Track I: %p\n", mpAudioTrack);
         delete mpAudioTrack;
         mpAudioTrack = 0;
     }
@@ -1109,22 +1109,22 @@
             lWaveCmd = WaveGenerator::WAVEGEN_CONT;
             break;
         case TONE_STARTING:
-            LOGV("Starting Cbk");
+            ALOGV("Starting Cbk");
 
             lWaveCmd = WaveGenerator::WAVEGEN_START;
             break;
         case TONE_STOPPING:
         case TONE_RESTARTING:
-            LOGV("Stop/restart Cbk");
+            ALOGV("Stop/restart Cbk");
 
             lWaveCmd = WaveGenerator::WAVEGEN_STOP;
             lpToneGen->mNextSegSmp = TONEGEN_INF; // forced to skip state machine management below
             break;
         case TONE_STOPPED:
-            LOGV("Stopped Cbk");
+            ALOGV("Stopped Cbk");
             goto audioCallback_EndLoop;
         default:
-            LOGV("Extra Cbk");
+            ALOGV("Extra Cbk");
             goto audioCallback_EndLoop;
         }
 
@@ -1145,7 +1145,7 @@
         if (lpToneGen->mTotalSmp > lpToneGen->mNextSegSmp) {
             // Time to go to next sequence segment
 
-            LOGV("End Segment, time: %d\n", (unsigned int)(systemTime()/1000000));
+            ALOGV("End Segment, time: %d\n", (unsigned int)(systemTime()/1000000));
 
             lGenSmp = lReqSmp;
 
@@ -1160,13 +1160,13 @@
                     lpWaveGen->getSamples(lpOut, lGenSmp, lWaveCmd);
                     lFrequency = lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[++lFreqIdx];
                 }
-                LOGV("ON->OFF, lGenSmp: %d, lReqSmp: %d\n", lGenSmp, lReqSmp);
+                ALOGV("ON->OFF, lGenSmp: %d, lReqSmp: %d\n", lGenSmp, lReqSmp);
             }
 
             // check if we need to loop and loop for the reqd times
             if (lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt) {
                 if (lpToneGen->mLoopCounter < lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt) {
-                    LOGV ("in if loop loopCnt(%d) loopctr(%d), CurSeg(%d) \n",
+                    ALOGV ("in if loop loopCnt(%d) loopctr(%d), CurSeg(%d) \n",
                           lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt,
                           lpToneGen->mLoopCounter,
                           lpToneGen->mCurSegment);
@@ -1176,14 +1176,14 @@
                     // completed loop. go to next segment
                     lpToneGen->mLoopCounter = 0;
                     lpToneGen->mCurSegment++;
-                    LOGV ("in else loop loopCnt(%d) loopctr(%d), CurSeg(%d) \n",
+                    ALOGV ("in else loop loopCnt(%d) loopctr(%d), CurSeg(%d) \n",
                           lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt,
                           lpToneGen->mLoopCounter,
                           lpToneGen->mCurSegment);
                 }
             } else {
                 lpToneGen->mCurSegment++;
-                LOGV ("Goto next seg loopCnt(%d) loopctr(%d), CurSeg(%d) \n",
+                ALOGV ("Goto next seg loopCnt(%d) loopctr(%d), CurSeg(%d) \n",
                       lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt,
                       lpToneGen->mLoopCounter,
                       lpToneGen->mCurSegment);
@@ -1192,32 +1192,32 @@
 
             // Handle loop if last segment reached
             if (lpToneDesc->segments[lpToneGen->mCurSegment].duration == 0) {
-                LOGV("Last Seg: %d\n", lpToneGen->mCurSegment);
+                ALOGV("Last Seg: %d\n", lpToneGen->mCurSegment);
 
                 // Pre increment loop count and restart if total count not reached. Stop sequence otherwise
                 if (++lpToneGen->mCurCount <= lpToneDesc->repeatCnt) {
-                    LOGV("Repeating Count: %d\n", lpToneGen->mCurCount);
+                    ALOGV("Repeating Count: %d\n", lpToneGen->mCurCount);
 
                     lpToneGen->mCurSegment = lpToneDesc->repeatSegment;
                     if (lpToneDesc->segments[lpToneDesc->repeatSegment].waveFreq[0] != 0) {
                         lWaveCmd = WaveGenerator::WAVEGEN_START;
                     }
 
-                    LOGV("New segment %d, Next Time: %d\n", lpToneGen->mCurSegment,
+                    ALOGV("New segment %d, Next Time: %d\n", lpToneGen->mCurSegment,
                             (lpToneGen->mNextSegSmp*1000)/lpToneGen->mSamplingRate);
 
                 } else {
                     lGenSmp = 0;
-                    LOGV("End repeat, time: %d\n", (unsigned int)(systemTime()/1000000));
+                    ALOGV("End repeat, time: %d\n", (unsigned int)(systemTime()/1000000));
                 }
             } else {
-                LOGV("New segment %d, Next Time: %d\n", lpToneGen->mCurSegment,
+                ALOGV("New segment %d, Next Time: %d\n", lpToneGen->mCurSegment,
                         (lpToneGen->mNextSegSmp*1000)/lpToneGen->mSamplingRate);
                 if (lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[0] != 0) {
                     // If next segment is not silent,  OFF -> ON transition : reset wave generator
                     lWaveCmd = WaveGenerator::WAVEGEN_START;
 
-                    LOGV("OFF->ON, lGenSmp: %d, lReqSmp: %d\n", lGenSmp, lReqSmp);
+                    ALOGV("OFF->ON, lGenSmp: %d, lReqSmp: %d\n", lGenSmp, lReqSmp);
                 } else {
                     lGenSmp = 0;
                 }
@@ -1255,13 +1255,13 @@
 
         switch (lpToneGen->mState) {
         case TONE_RESTARTING:
-            LOGV("Cbk restarting track\n");
+            ALOGV("Cbk restarting track\n");
             if (lpToneGen->prepareWave()) {
                 lpToneGen->mState = TONE_STARTING;
                 // must reload lpToneDesc as prepareWave() may change mpToneDesc
                 lpToneDesc = lpToneGen->mpToneDesc;
             } else {
-                LOGW("Cbk restarting prepareWave() failed\n");
+                ALOGW("Cbk restarting prepareWave() failed\n");
                 lpToneGen->mState = TONE_IDLE;
                 lpToneGen->mpAudioTrack->stop();
                 // Force loop exit
@@ -1270,14 +1270,14 @@
             lSignal = true;
             break;
         case TONE_STOPPING:
-            LOGV("Cbk Stopping\n");
+            ALOGV("Cbk Stopping\n");
             lpToneGen->mState = TONE_STOPPED;
             // Force loop exit
             lNumSmp = 0;
             break;
         case TONE_STOPPED:
             lpToneGen->mState = TONE_INIT;
-            LOGV("Cbk Stopped track\n");
+            ALOGV("Cbk Stopped track\n");
             lpToneGen->mpAudioTrack->stop();
             // Force loop exit
             lNumSmp = 0;
@@ -1285,7 +1285,7 @@
             lSignal = true;
             break;
         case TONE_STARTING:
-            LOGV("Cbk starting track\n");
+            ALOGV("Cbk starting track\n");
             lpToneGen->mState = TONE_PLAYING;
             lSignal = true;
            break;
@@ -1338,7 +1338,7 @@
         } else {
             mMaxSmp = (mDurationMs * mSamplingRate) / 1000;
         }
-        LOGV("prepareWave, duration limited to %d ms", mDurationMs);
+        ALOGV("prepareWave, duration limited to %d ms", mDurationMs);
     }
 
     while (mpToneDesc->segments[segmentIdx].duration) {
@@ -1425,7 +1425,7 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 void ToneGenerator::clearWaveGens() {
-    LOGV("Clearing mWaveGens:");
+    ALOGV("Clearing mWaveGens:");
 
     for (size_t lIdx = 0; lIdx < mWaveGens.size(); lIdx++) {
         delete mWaveGens.valueAt(lIdx);
@@ -1456,7 +1456,7 @@
         regionTone = sToneMappingTable[mRegion][toneType - FIRST_SUP_TONE];
     }
 
-    LOGV("getToneForRegion, tone %d, region %d, regionTone %d", toneType, mRegion, regionTone);
+    ALOGV("getToneForRegion, tone %d, region %d, regionTone %d", toneType, mRegion, regionTone);
 
     return regionTone;
 }
@@ -1504,7 +1504,7 @@
         d0 = 32767;
     mA1_Q14 = (short) d0;
 
-    LOGV("WaveGenerator init, mA1_Q14: %d, mS2_0: %d, mAmplitude_Q15: %d\n",
+    ALOGV("WaveGenerator init, mA1_Q14: %d, mS2_0: %d, mAmplitude_Q15: %d\n",
             mA1_Q14, mS2_0, mAmplitude_Q15);
 }
 
diff --git a/media/libmedia/Visualizer.cpp b/media/libmedia/Visualizer.cpp
index bf40481..d08ffa5 100644
--- a/media/libmedia/Visualizer.cpp
+++ b/media/libmedia/Visualizer.cpp
@@ -61,7 +61,7 @@
         if (enabled) {
             if (t->exitPending()) {
                 if (t->requestExitAndWait() == WOULD_BLOCK) {
-                    LOGE("Visualizer::enable() called from thread");
+                    ALOGE("Visualizer::enable() called from thread");
                     return INVALID_OPERATION;
                 }
             }
@@ -116,11 +116,11 @@
     if (cbk != NULL) {
         mCaptureThread = new CaptureThread(*this, rate, ((flags & CAPTURE_CALL_JAVA) != 0));
         if (mCaptureThread == 0) {
-            LOGE("Could not create callback thread");
+            ALOGE("Could not create callback thread");
             return NO_INIT;
         }
     }
-    LOGV("setCaptureCallBack() rate: %d thread %p flags 0x%08x",
+    ALOGV("setCaptureCallBack() rate: %d thread %p flags 0x%08x",
             rate, mCaptureThread.get(), mCaptureFlags);
     return NO_ERROR;
 }
@@ -147,7 +147,7 @@
     *((int32_t *)p->data + 1)= size;
     status_t status = setParameter(p);
 
-    LOGV("setCaptureSize size %d  status %d p->status %d", size, status, p->status);
+    ALOGV("setCaptureSize size %d  status %d p->status %d", size, status, p->status);
 
     if (status == NO_ERROR) {
         status = p->status;
@@ -172,12 +172,12 @@
     if (mEnabled) {
         uint32_t replySize = mCaptureSize;
         status = command(VISUALIZER_CMD_CAPTURE, 0, NULL, &replySize, waveform);
-        LOGV("getWaveForm() command returned %d", status);
+        ALOGV("getWaveForm() command returned %d", status);
         if (replySize == 0) {
             status = NOT_ENOUGH_DATA;
         }
     } else {
-        LOGV("getWaveForm() disabled");
+        ALOGV("getWaveForm() disabled");
         memset(waveform, 0x80, mCaptureSize);
     }
     return status;
@@ -236,7 +236,7 @@
 void Visualizer::periodicCapture()
 {
     Mutex::Autolock _l(mLock);
-    LOGV("periodicCapture() %p mCaptureCallBack %p mCaptureFlags 0x%08x",
+    ALOGV("periodicCapture() %p mCaptureCallBack %p mCaptureFlags 0x%08x",
             this, mCaptureCallBack, mCaptureFlags);
     if (mCaptureCallBack != NULL &&
         (mCaptureFlags & (CAPTURE_WAVEFORM|CAPTURE_FFT)) &&
@@ -289,7 +289,7 @@
     }
     mCaptureSize = size;
 
-    LOGV("initCaptureSize size %d status %d", mCaptureSize, status);
+    ALOGV("initCaptureSize size %d status %d", mCaptureSize, status);
 
     return size;
 }
@@ -300,18 +300,18 @@
     : Thread(bCanCallJava), mReceiver(receiver)
 {
     mSleepTimeUs = 1000000000 / captureRate;
-    LOGV("CaptureThread cstor %p captureRate %d mSleepTimeUs %d", this, captureRate, mSleepTimeUs);
+    ALOGV("CaptureThread cstor %p captureRate %d mSleepTimeUs %d", this, captureRate, mSleepTimeUs);
 }
 
 bool Visualizer::CaptureThread::threadLoop()
 {
-    LOGV("CaptureThread %p enter", this);
+    ALOGV("CaptureThread %p enter", this);
     while (!exitPending())
     {
         usleep(mSleepTimeUs);
         mReceiver.periodicCapture();
     }
-    LOGV("CaptureThread %p exiting", this);
+    ALOGV("CaptureThread %p exiting", this);
     return false;
 }
 
diff --git a/media/libmedia/mediametadataretriever.cpp b/media/libmedia/mediametadataretriever.cpp
index cee06ab..88e269f 100644
--- a/media/libmedia/mediametadataretriever.cpp
+++ b/media/libmedia/mediametadataretriever.cpp
@@ -43,7 +43,7 @@
             if (binder != 0) {
                 break;
             }
-            LOGW("MediaPlayerService not published, waiting...");
+            ALOGW("MediaPlayerService not published, waiting...");
             usleep(500000); // 0.5 s
         } while(true);
         if (sDeathNotifier == NULL) {
@@ -52,35 +52,35 @@
         binder->linkToDeath(sDeathNotifier);
         sService = interface_cast<IMediaPlayerService>(binder);
     }
-    LOGE_IF(sService == 0, "no MediaPlayerService!?");
+    ALOGE_IF(sService == 0, "no MediaPlayerService!?");
     return sService;
 }
 
 MediaMetadataRetriever::MediaMetadataRetriever()
 {
-    LOGV("constructor");
+    ALOGV("constructor");
     const sp<IMediaPlayerService>& service(getService());
     if (service == 0) {
-        LOGE("failed to obtain MediaMetadataRetrieverService");
+        ALOGE("failed to obtain MediaMetadataRetrieverService");
         return;
     }
     sp<IMediaMetadataRetriever> retriever(service->createMetadataRetriever(getpid()));
     if (retriever == 0) {
-        LOGE("failed to create IMediaMetadataRetriever object from server");
+        ALOGE("failed to create IMediaMetadataRetriever object from server");
     }
     mRetriever = retriever;
 }
 
 MediaMetadataRetriever::~MediaMetadataRetriever()
 {
-    LOGV("destructor");
+    ALOGV("destructor");
     disconnect();
     IPCThreadState::self()->flushCommands();
 }
 
 void MediaMetadataRetriever::disconnect()
 {
-    LOGV("disconnect");
+    ALOGV("disconnect");
     sp<IMediaMetadataRetriever> retriever;
     {
         Mutex::Autolock _l(mLock);
@@ -95,30 +95,30 @@
 status_t MediaMetadataRetriever::setDataSource(
         const char *srcUrl, const KeyedVector<String8, String8> *headers)
 {
-    LOGV("setDataSource");
+    ALOGV("setDataSource");
     Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
-        LOGE("retriever is not initialized");
+        ALOGE("retriever is not initialized");
         return INVALID_OPERATION;
     }
     if (srcUrl == NULL) {
-        LOGE("data source is a null pointer");
+        ALOGE("data source is a null pointer");
         return UNKNOWN_ERROR;
     }
-    LOGV("data source (%s)", srcUrl);
+    ALOGV("data source (%s)", srcUrl);
     return mRetriever->setDataSource(srcUrl, headers);
 }
 
 status_t MediaMetadataRetriever::setDataSource(int fd, int64_t offset, int64_t length)
 {
-    LOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
     Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
-        LOGE("retriever is not initialized");
+        ALOGE("retriever is not initialized");
         return INVALID_OPERATION;
     }
     if (fd < 0 || offset < 0 || length < 0) {
-        LOGE("Invalid negative argument");
+        ALOGE("Invalid negative argument");
         return UNKNOWN_ERROR;
     }
     return mRetriever->setDataSource(fd, offset, length);
@@ -126,10 +126,10 @@
 
 sp<IMemory> MediaMetadataRetriever::getFrameAtTime(int64_t timeUs, int option)
 {
-    LOGV("getFrameAtTime: time(%lld us) option(%d)", timeUs, option);
+    ALOGV("getFrameAtTime: time(%lld us) option(%d)", timeUs, option);
     Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
-        LOGE("retriever is not initialized");
+        ALOGE("retriever is not initialized");
         return NULL;
     }
     return mRetriever->getFrameAtTime(timeUs, option);
@@ -137,10 +137,10 @@
 
 const char* MediaMetadataRetriever::extractMetadata(int keyCode)
 {
-    LOGV("extractMetadata(%d)", keyCode);
+    ALOGV("extractMetadata(%d)", keyCode);
     Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
-        LOGE("retriever is not initialized");
+        ALOGE("retriever is not initialized");
         return NULL;
     }
     return mRetriever->extractMetadata(keyCode);
@@ -148,10 +148,10 @@
 
 sp<IMemory> MediaMetadataRetriever::extractAlbumArt()
 {
-    LOGV("extractAlbumArt");
+    ALOGV("extractAlbumArt");
     Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
-        LOGE("retriever is not initialized");
+        ALOGE("retriever is not initialized");
         return NULL;
     }
     return mRetriever->extractAlbumArt();
@@ -160,7 +160,7 @@
 void MediaMetadataRetriever::DeathNotifier::binderDied(const wp<IBinder>& who) {
     Mutex::Autolock lock(MediaMetadataRetriever::sServiceLock);
     MediaMetadataRetriever::sService.clear();
-    LOGW("MediaMetadataRetriever server died!");
+    ALOGW("MediaMetadataRetriever server died!");
 }
 
 MediaMetadataRetriever::DeathNotifier::~DeathNotifier()
diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp
index c2e1ddf..2284927 100644
--- a/media/libmedia/mediaplayer.cpp
+++ b/media/libmedia/mediaplayer.cpp
@@ -46,7 +46,7 @@
 
 MediaPlayer::MediaPlayer()
 {
-    LOGV("constructor");
+    ALOGV("constructor");
     mListener = NULL;
     mCookie = NULL;
     mDuration = -1;
@@ -67,7 +67,7 @@
 
 MediaPlayer::~MediaPlayer()
 {
-    LOGV("destructor");
+    ALOGV("destructor");
     AudioSystem::releaseAudioSessionId(mAudioSessionId);
     disconnect();
     IPCThreadState::self()->flushCommands();
@@ -75,7 +75,7 @@
 
 void MediaPlayer::disconnect()
 {
-    LOGV("disconnect");
+    ALOGV("disconnect");
     sp<IMediaPlayer> p;
     {
         Mutex::Autolock _l(mLock);
@@ -99,7 +99,7 @@
 
 status_t MediaPlayer::setListener(const sp<MediaPlayerListener>& listener)
 {
-    LOGV("setListener");
+    ALOGV("setListener");
     Mutex::Autolock _l(mLock);
     mListener = listener;
     return NO_ERROR;
@@ -115,7 +115,7 @@
 
         if ( !( (mCurrentState & MEDIA_PLAYER_IDLE) ||
                 (mCurrentState == MEDIA_PLAYER_STATE_ERROR ) ) ) {
-            LOGE("attachNewPlayer called in state %d", mCurrentState);
+            ALOGE("attachNewPlayer called in state %d", mCurrentState);
             return INVALID_OPERATION;
         }
 
@@ -126,7 +126,7 @@
             mCurrentState = MEDIA_PLAYER_INITIALIZED;
             err = NO_ERROR;
         } else {
-            LOGE("Unable to to create media player");
+            ALOGE("Unable to to create media player");
         }
     }
 
@@ -140,7 +140,7 @@
 status_t MediaPlayer::setDataSource(
         const char *url, const KeyedVector<String8, String8> *headers)
 {
-    LOGV("setDataSource(%s)", url);
+    ALOGV("setDataSource(%s)", url);
     status_t err = BAD_VALUE;
     if (url != NULL) {
         const sp<IMediaPlayerService>& service(getMediaPlayerService());
@@ -157,7 +157,7 @@
 
 status_t MediaPlayer::setDataSource(int fd, int64_t offset, int64_t length)
 {
-    LOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
     status_t err = UNKNOWN_ERROR;
     const sp<IMediaPlayerService>& service(getMediaPlayerService());
     if (service != 0) {
@@ -172,7 +172,7 @@
 
 status_t MediaPlayer::setDataSource(const sp<IStreamSource> &source)
 {
-    LOGV("setDataSource");
+    ALOGV("setDataSource");
     status_t err = UNKNOWN_ERROR;
     const sp<IMediaPlayerService>& service(getMediaPlayerService());
     if (service != 0) {
@@ -192,16 +192,16 @@
             (mCurrentState != MEDIA_PLAYER_STATE_ERROR) &&
             ((mCurrentState & MEDIA_PLAYER_IDLE) != MEDIA_PLAYER_IDLE);
     if ((mPlayer != NULL) && hasBeenInitialized) {
-         LOGV("invoke %d", request.dataSize());
+         ALOGV("invoke %d", request.dataSize());
          return  mPlayer->invoke(request, reply);
     }
-    LOGE("invoke failed: wrong state %X", mCurrentState);
+    ALOGE("invoke failed: wrong state %X", mCurrentState);
     return INVALID_OPERATION;
 }
 
 status_t MediaPlayer::setMetadataFilter(const Parcel& filter)
 {
-    LOGD("setMetadataFilter");
+    ALOGD("setMetadataFilter");
     Mutex::Autolock lock(mLock);
     if (mPlayer == NULL) {
         return NO_INIT;
@@ -211,7 +211,7 @@
 
 status_t MediaPlayer::getMetadata(bool update_only, bool apply_filter, Parcel *metadata)
 {
-    LOGD("getMetadata");
+    ALOGD("getMetadata");
     Mutex::Autolock lock(mLock);
     if (mPlayer == NULL) {
         return NO_INIT;
@@ -222,7 +222,7 @@
 status_t MediaPlayer::setVideoSurfaceTexture(
         const sp<ISurfaceTexture>& surfaceTexture)
 {
-    LOGV("setVideoSurfaceTexture");
+    ALOGV("setVideoSurfaceTexture");
     Mutex::Autolock _l(mLock);
     if (mPlayer == 0) return NO_INIT;
     return mPlayer->setVideoSurfaceTexture(surfaceTexture);
@@ -236,7 +236,7 @@
         mCurrentState = MEDIA_PLAYER_PREPARING;
         return mPlayer->prepareAsync();
     }
-    LOGE("prepareAsync called in state %d", mCurrentState);
+    ALOGE("prepareAsync called in state %d", mCurrentState);
     return INVALID_OPERATION;
 }
 
@@ -246,7 +246,7 @@
 // code.
 status_t MediaPlayer::prepare()
 {
-    LOGV("prepare");
+    ALOGV("prepare");
     Mutex::Autolock _l(mLock);
     mLockThreadId = getThreadId();
     if (mPrepareSync) {
@@ -264,21 +264,21 @@
         mSignal.wait(mLock);  // wait for prepare done
         mPrepareSync = false;
     }
-    LOGV("prepare complete - status=%d", mPrepareStatus);
+    ALOGV("prepare complete - status=%d", mPrepareStatus);
     mLockThreadId = 0;
     return mPrepareStatus;
 }
 
 status_t MediaPlayer::prepareAsync()
 {
-    LOGV("prepareAsync");
+    ALOGV("prepareAsync");
     Mutex::Autolock _l(mLock);
     return prepareAsync_l();
 }
 
 status_t MediaPlayer::start()
 {
-    LOGV("start");
+    ALOGV("start");
     Mutex::Autolock _l(mLock);
     if (mCurrentState & MEDIA_PLAYER_STARTED)
         return NO_ERROR;
@@ -293,18 +293,18 @@
             mCurrentState = MEDIA_PLAYER_STATE_ERROR;
         } else {
             if (mCurrentState == MEDIA_PLAYER_PLAYBACK_COMPLETE) {
-                LOGV("playback completed immediately following start()");
+                ALOGV("playback completed immediately following start()");
             }
         }
         return ret;
     }
-    LOGE("start called in state %d", mCurrentState);
+    ALOGE("start called in state %d", mCurrentState);
     return INVALID_OPERATION;
 }
 
 status_t MediaPlayer::stop()
 {
-    LOGV("stop");
+    ALOGV("stop");
     Mutex::Autolock _l(mLock);
     if (mCurrentState & MEDIA_PLAYER_STOPPED) return NO_ERROR;
     if ( (mPlayer != 0) && ( mCurrentState & ( MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PREPARED |
@@ -317,13 +317,13 @@
         }
         return ret;
     }
-    LOGE("stop called in state %d", mCurrentState);
+    ALOGE("stop called in state %d", mCurrentState);
     return INVALID_OPERATION;
 }
 
 status_t MediaPlayer::pause()
 {
-    LOGV("pause");
+    ALOGV("pause");
     Mutex::Autolock _l(mLock);
     if (mCurrentState & (MEDIA_PLAYER_PAUSED|MEDIA_PLAYER_PLAYBACK_COMPLETE))
         return NO_ERROR;
@@ -336,7 +336,7 @@
         }
         return ret;
     }
-    LOGE("pause called in state %d", mCurrentState);
+    ALOGE("pause called in state %d", mCurrentState);
     return INVALID_OPERATION;
 }
 
@@ -346,20 +346,20 @@
     if (mPlayer != 0) {
         bool temp = false;
         mPlayer->isPlaying(&temp);
-        LOGV("isPlaying: %d", temp);
+        ALOGV("isPlaying: %d", temp);
         if ((mCurrentState & MEDIA_PLAYER_STARTED) && ! temp) {
-            LOGE("internal/external state mismatch corrected");
+            ALOGE("internal/external state mismatch corrected");
             mCurrentState = MEDIA_PLAYER_PAUSED;
         }
         return temp;
     }
-    LOGV("isPlaying: no active player");
+    ALOGV("isPlaying: no active player");
     return false;
 }
 
 status_t MediaPlayer::getVideoWidth(int *w)
 {
-    LOGV("getVideoWidth");
+    ALOGV("getVideoWidth");
     Mutex::Autolock _l(mLock);
     if (mPlayer == 0) return INVALID_OPERATION;
     *w = mVideoWidth;
@@ -368,7 +368,7 @@
 
 status_t MediaPlayer::getVideoHeight(int *h)
 {
-    LOGV("getVideoHeight");
+    ALOGV("getVideoHeight");
     Mutex::Autolock _l(mLock);
     if (mPlayer == 0) return INVALID_OPERATION;
     *h = mVideoHeight;
@@ -377,11 +377,11 @@
 
 status_t MediaPlayer::getCurrentPosition(int *msec)
 {
-    LOGV("getCurrentPosition");
+    ALOGV("getCurrentPosition");
     Mutex::Autolock _l(mLock);
     if (mPlayer != 0) {
         if (mCurrentPosition >= 0) {
-            LOGV("Using cached seek position: %d", mCurrentPosition);
+            ALOGV("Using cached seek position: %d", mCurrentPosition);
             *msec = mCurrentPosition;
             return NO_ERROR;
         }
@@ -392,7 +392,7 @@
 
 status_t MediaPlayer::getDuration_l(int *msec)
 {
-    LOGV("getDuration");
+    ALOGV("getDuration");
     bool isValidState = (mCurrentState & (MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PAUSED | MEDIA_PLAYER_STOPPED | MEDIA_PLAYER_PLAYBACK_COMPLETE));
     if (mPlayer != 0 && isValidState) {
         status_t ret = NO_ERROR;
@@ -402,7 +402,7 @@
             *msec = mDuration;
         return ret;
     }
-    LOGE("Attempt to call getDuration without a valid mediaplayer");
+    ALOGE("Attempt to call getDuration without a valid mediaplayer");
     return INVALID_OPERATION;
 }
 
@@ -414,13 +414,13 @@
 
 status_t MediaPlayer::seekTo_l(int msec)
 {
-    LOGV("seekTo %d", msec);
+    ALOGV("seekTo %d", msec);
     if ((mPlayer != 0) && ( mCurrentState & ( MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_PAUSED |  MEDIA_PLAYER_PLAYBACK_COMPLETE) ) ) {
         if ( msec < 0 ) {
-            LOGW("Attempt to seek to invalid position: %d", msec);
+            ALOGW("Attempt to seek to invalid position: %d", msec);
             msec = 0;
         } else if ((mDuration > 0) && (msec > mDuration)) {
-            LOGW("Attempt to seek to past end of file: request = %d, EOF = %d", msec, mDuration);
+            ALOGW("Attempt to seek to past end of file: request = %d, EOF = %d", msec, mDuration);
             msec = mDuration;
         }
         // cache duration
@@ -431,11 +431,11 @@
             return mPlayer->seekTo(msec);
         }
         else {
-            LOGV("Seek in progress - queue up seekTo[%d]", msec);
+            ALOGV("Seek in progress - queue up seekTo[%d]", msec);
             return NO_ERROR;
         }
     }
-    LOGE("Attempt to perform seekTo in wrong state: mPlayer=%p, mCurrentState=%u", mPlayer.get(), mCurrentState);
+    ALOGE("Attempt to perform seekTo in wrong state: mPlayer=%p, mCurrentState=%u", mPlayer.get(), mCurrentState);
     return INVALID_OPERATION;
 }
 
@@ -457,7 +457,7 @@
     if (mPlayer != 0) {
         status_t ret = mPlayer->reset();
         if (ret != NO_ERROR) {
-            LOGE("reset() failed with return code (%d)", ret);
+            ALOGE("reset() failed with return code (%d)", ret);
             mCurrentState = MEDIA_PLAYER_STATE_ERROR;
         } else {
             mCurrentState = MEDIA_PLAYER_IDLE;
@@ -473,20 +473,20 @@
 
 status_t MediaPlayer::reset()
 {
-    LOGV("reset");
+    ALOGV("reset");
     Mutex::Autolock _l(mLock);
     return reset_l();
 }
 
 status_t MediaPlayer::setAudioStreamType(int type)
 {
-    LOGV("MediaPlayer::setAudioStreamType");
+    ALOGV("MediaPlayer::setAudioStreamType");
     Mutex::Autolock _l(mLock);
     if (mStreamType == type) return NO_ERROR;
     if (mCurrentState & ( MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_STARTED |
                 MEDIA_PLAYER_PAUSED | MEDIA_PLAYER_PLAYBACK_COMPLETE ) ) {
         // Can't change the stream type after prepare
-        LOGE("setAudioStream called in state %d", mCurrentState);
+        ALOGE("setAudioStream called in state %d", mCurrentState);
         return INVALID_OPERATION;
     }
     // cache
@@ -496,7 +496,7 @@
 
 status_t MediaPlayer::setLooping(int loop)
 {
-    LOGV("MediaPlayer::setLooping");
+    ALOGV("MediaPlayer::setLooping");
     Mutex::Autolock _l(mLock);
     mLoop = (loop != 0);
     if (mPlayer != 0) {
@@ -506,18 +506,18 @@
 }
 
 bool MediaPlayer::isLooping() {
-    LOGV("isLooping");
+    ALOGV("isLooping");
     Mutex::Autolock _l(mLock);
     if (mPlayer != 0) {
         return mLoop;
     }
-    LOGV("isLooping: no active player");
+    ALOGV("isLooping: no active player");
     return false;
 }
 
 status_t MediaPlayer::setVolume(float leftVolume, float rightVolume)
 {
-    LOGV("MediaPlayer::setVolume(%f, %f)", leftVolume, rightVolume);
+    ALOGV("MediaPlayer::setVolume(%f, %f)", leftVolume, rightVolume);
     Mutex::Autolock _l(mLock);
     mLeftVolume = leftVolume;
     mRightVolume = rightVolume;
@@ -529,10 +529,10 @@
 
 status_t MediaPlayer::setAudioSessionId(int sessionId)
 {
-    LOGV("MediaPlayer::setAudioSessionId(%d)", sessionId);
+    ALOGV("MediaPlayer::setAudioSessionId(%d)", sessionId);
     Mutex::Autolock _l(mLock);
     if (!(mCurrentState & MEDIA_PLAYER_IDLE)) {
-        LOGE("setAudioSessionId called in state %d", mCurrentState);
+        ALOGE("setAudioSessionId called in state %d", mCurrentState);
         return INVALID_OPERATION;
     }
     if (sessionId < 0) {
@@ -554,7 +554,7 @@
 
 status_t MediaPlayer::setAuxEffectSendLevel(float level)
 {
-    LOGV("MediaPlayer::setAuxEffectSendLevel(%f)", level);
+    ALOGV("MediaPlayer::setAuxEffectSendLevel(%f)", level);
     Mutex::Autolock _l(mLock);
     mSendLevel = level;
     if (mPlayer != 0) {
@@ -565,12 +565,12 @@
 
 status_t MediaPlayer::attachAuxEffect(int effectId)
 {
-    LOGV("MediaPlayer::attachAuxEffect(%d)", effectId);
+    ALOGV("MediaPlayer::attachAuxEffect(%d)", effectId);
     Mutex::Autolock _l(mLock);
     if (mPlayer == 0 ||
         (mCurrentState & MEDIA_PLAYER_IDLE) ||
         (mCurrentState == MEDIA_PLAYER_STATE_ERROR )) {
-        LOGE("attachAuxEffect called in state %d", mCurrentState);
+        ALOGE("attachAuxEffect called in state %d", mCurrentState);
         return INVALID_OPERATION;
     }
 
@@ -579,29 +579,29 @@
 
 status_t MediaPlayer::setParameter(int key, const Parcel& request)
 {
-    LOGV("MediaPlayer::setParameter(%d)", key);
+    ALOGV("MediaPlayer::setParameter(%d)", key);
     Mutex::Autolock _l(mLock);
     if (mPlayer != NULL) {
         return  mPlayer->setParameter(key, request);
     }
-    LOGV("setParameter: no active player");
+    ALOGV("setParameter: no active player");
     return INVALID_OPERATION;
 }
 
 status_t MediaPlayer::getParameter(int key, Parcel *reply)
 {
-    LOGV("MediaPlayer::getParameter(%d)", key);
+    ALOGV("MediaPlayer::getParameter(%d)", key);
     Mutex::Autolock _l(mLock);
     if (mPlayer != NULL) {
          return  mPlayer->getParameter(key, reply);
     }
-    LOGV("getParameter: no active player");
+    ALOGV("getParameter: no active player");
     return INVALID_OPERATION;
 }
 
 void MediaPlayer::notify(int msg, int ext1, int ext2, const Parcel *obj)
 {
-    LOGV("message received msg=%d, ext1=%d, ext2=%d", msg, ext1, ext2);
+    ALOGV("message received msg=%d, ext1=%d, ext2=%d", msg, ext1, ext2);
     bool send = true;
     bool locked = false;
 
@@ -620,7 +620,7 @@
 
     // Allows calls from JNI in idle state to notify errors
     if (!(msg == MEDIA_ERROR && mCurrentState == MEDIA_PLAYER_IDLE) && mPlayer == 0) {
-        LOGV("notify(%d, %d, %d) callback on disconnected mediaplayer", msg, ext1, ext2);
+        ALOGV("notify(%d, %d, %d) callback on disconnected mediaplayer", msg, ext1, ext2);
         if (locked) mLock.unlock();   // release the lock when done.
         return;
     }
@@ -629,19 +629,19 @@
     case MEDIA_NOP: // interface test message
         break;
     case MEDIA_PREPARED:
-        LOGV("prepared");
+        ALOGV("prepared");
         mCurrentState = MEDIA_PLAYER_PREPARED;
         if (mPrepareSync) {
-            LOGV("signal application thread");
+            ALOGV("signal application thread");
             mPrepareSync = false;
             mPrepareStatus = NO_ERROR;
             mSignal.signal();
         }
         break;
     case MEDIA_PLAYBACK_COMPLETE:
-        LOGV("playback complete");
+        ALOGV("playback complete");
         if (mCurrentState == MEDIA_PLAYER_IDLE) {
-            LOGE("playback complete in idle state");
+            ALOGE("playback complete in idle state");
         }
         if (!mLoop) {
             mCurrentState = MEDIA_PLAYER_PLAYBACK_COMPLETE;
@@ -651,11 +651,11 @@
         // Always log errors.
         // ext1: Media framework error code.
         // ext2: Implementation dependant error code.
-        LOGE("error (%d, %d)", ext1, ext2);
+        ALOGE("error (%d, %d)", ext1, ext2);
         mCurrentState = MEDIA_PLAYER_STATE_ERROR;
         if (mPrepareSync)
         {
-            LOGV("signal application thread");
+            ALOGV("signal application thread");
             mPrepareSync = false;
             mPrepareStatus = ext1;
             mSignal.signal();
@@ -666,34 +666,34 @@
         // ext1: Media framework error code.
         // ext2: Implementation dependant error code.
         if (ext1 != MEDIA_INFO_VIDEO_TRACK_LAGGING) {
-            LOGW("info/warning (%d, %d)", ext1, ext2);
+            ALOGW("info/warning (%d, %d)", ext1, ext2);
         }
         break;
     case MEDIA_SEEK_COMPLETE:
-        LOGV("Received seek complete");
+        ALOGV("Received seek complete");
         if (mSeekPosition != mCurrentPosition) {
-            LOGV("Executing queued seekTo(%d)", mSeekPosition);
+            ALOGV("Executing queued seekTo(%d)", mSeekPosition);
             mSeekPosition = -1;
             seekTo_l(mCurrentPosition);
         }
         else {
-            LOGV("All seeks complete - return to regularly scheduled program");
+            ALOGV("All seeks complete - return to regularly scheduled program");
             mCurrentPosition = mSeekPosition = -1;
         }
         break;
     case MEDIA_BUFFERING_UPDATE:
-        LOGV("buffering %d", ext1);
+        ALOGV("buffering %d", ext1);
         break;
     case MEDIA_SET_VIDEO_SIZE:
-        LOGV("New video size %d x %d", ext1, ext2);
+        ALOGV("New video size %d x %d", ext1, ext2);
         mVideoWidth = ext1;
         mVideoHeight = ext2;
         break;
     case MEDIA_TIMED_TEXT:
-        LOGV("Received timed text message");
+        ALOGV("Received timed text message");
         break;
     default:
-        LOGV("unrecognized message: (%d, %d, %d)", msg, ext1, ext2);
+        ALOGV("unrecognized message: (%d, %d, %d)", msg, ext1, ext2);
         break;
     }
 
@@ -703,21 +703,21 @@
     // this prevents re-entrant calls into client code
     if ((listener != 0) && send) {
         Mutex::Autolock _l(mNotifyLock);
-        LOGV("callback application");
+        ALOGV("callback application");
         listener->notify(msg, ext1, ext2, obj);
-        LOGV("back from callback");
+        ALOGV("back from callback");
     }
 }
 
 /*static*/ sp<IMemory> MediaPlayer::decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, int* pFormat)
 {
-    LOGV("decode(%s)", url);
+    ALOGV("decode(%s)", url);
     sp<IMemory> p;
     const sp<IMediaPlayerService>& service = getMediaPlayerService();
     if (service != 0) {
         p = service->decode(url, pSampleRate, pNumChannels, pFormat);
     } else {
-        LOGE("Unable to locate media service");
+        ALOGE("Unable to locate media service");
     }
     return p;
 
@@ -725,19 +725,19 @@
 
 void MediaPlayer::died()
 {
-    LOGV("died");
+    ALOGV("died");
     notify(MEDIA_ERROR, MEDIA_ERROR_SERVER_DIED, 0);
 }
 
 /*static*/ sp<IMemory> MediaPlayer::decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, int* pFormat)
 {
-    LOGV("decode(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("decode(%d, %lld, %lld)", fd, offset, length);
     sp<IMemory> p;
     const sp<IMediaPlayerService>& service = getMediaPlayerService();
     if (service != 0) {
         p = service->decode(fd, offset, length, pSampleRate, pNumChannels, pFormat);
     } else {
-        LOGE("Unable to locate media service");
+        ALOGE("Unable to locate media service");
     }
     return p;
 
diff --git a/media/libmedia/mediarecorder.cpp b/media/libmedia/mediarecorder.cpp
index 11d281f..8d947d8 100644
--- a/media/libmedia/mediarecorder.cpp
+++ b/media/libmedia/mediarecorder.cpp
@@ -31,19 +31,19 @@
 
 status_t MediaRecorder::setCamera(const sp<ICamera>& camera, const sp<ICameraRecordingProxy>& proxy)
 {
-    LOGV("setCamera(%p,%p)", camera.get(), proxy.get());
+    ALOGV("setCamera(%p,%p)", camera.get(), proxy.get());
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (!(mCurrentState & MEDIA_RECORDER_IDLE)) {
-        LOGE("setCamera called in an invalid state(%d)", mCurrentState);
+        ALOGE("setCamera called in an invalid state(%d)", mCurrentState);
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->setCamera(camera, proxy);
     if (OK != ret) {
-        LOGV("setCamera failed: %d", ret);
+        ALOGV("setCamera failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -52,23 +52,23 @@
 
 status_t MediaRecorder::setPreviewSurface(const sp<Surface>& surface)
 {
-    LOGV("setPreviewSurface(%p)", surface.get());
+    ALOGV("setPreviewSurface(%p)", surface.get());
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) {
-        LOGE("setPreviewSurface called in an invalid state(%d)", mCurrentState);
+        ALOGE("setPreviewSurface called in an invalid state(%d)", mCurrentState);
         return INVALID_OPERATION;
     }
     if (!mIsVideoSourceSet) {
-        LOGE("try to set preview surface without setting the video source first");
+        ALOGE("try to set preview surface without setting the video source first");
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->setPreviewSurface(surface);
     if (OK != ret) {
-        LOGV("setPreviewSurface failed: %d", ret);
+        ALOGV("setPreviewSurface failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -77,26 +77,26 @@
 
 status_t MediaRecorder::init()
 {
-    LOGV("init");
+    ALOGV("init");
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (!(mCurrentState & MEDIA_RECORDER_IDLE)) {
-        LOGE("init called in an invalid state(%d)", mCurrentState);
+        ALOGE("init called in an invalid state(%d)", mCurrentState);
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->init();
     if (OK != ret) {
-        LOGV("init failed: %d", ret);
+        ALOGV("init failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
 
     ret = mMediaRecorder->setListener(this);
     if (OK != ret) {
-        LOGV("setListener failed: %d", ret);
+        ALOGV("setListener failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -107,24 +107,24 @@
 
 status_t MediaRecorder::setVideoSource(int vs)
 {
-    LOGV("setVideoSource(%d)", vs);
+    ALOGV("setVideoSource(%d)", vs);
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (mIsVideoSourceSet) {
-        LOGE("video source has already been set");
+        ALOGE("video source has already been set");
         return INVALID_OPERATION;
     }
     if (mCurrentState & MEDIA_RECORDER_IDLE) {
-        LOGV("Call init() since the media recorder is not initialized yet");
+        ALOGV("Call init() since the media recorder is not initialized yet");
         status_t ret = init();
         if (OK != ret) {
             return ret;
         }
     }
     if (!(mCurrentState & MEDIA_RECORDER_INITIALIZED)) {
-        LOGE("setVideoSource called in an invalid state(%d)", mCurrentState);
+        ALOGE("setVideoSource called in an invalid state(%d)", mCurrentState);
         return INVALID_OPERATION;
     }
 
@@ -132,7 +132,7 @@
     status_t ret = mMediaRecorder->setVideoSource(vs);
 
     if (OK != ret) {
-        LOGV("setVideoSource failed: %d", ret);
+        ALOGV("setVideoSource failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -142,30 +142,30 @@
 
 status_t MediaRecorder::setAudioSource(int as)
 {
-    LOGV("setAudioSource(%d)", as);
+    ALOGV("setAudioSource(%d)", as);
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (mCurrentState & MEDIA_RECORDER_IDLE) {
-        LOGV("Call init() since the media recorder is not initialized yet");
+        ALOGV("Call init() since the media recorder is not initialized yet");
         status_t ret = init();
         if (OK != ret) {
             return ret;
         }
     }
     if (mIsAudioSourceSet) {
-        LOGE("audio source has already been set");
+        ALOGE("audio source has already been set");
         return INVALID_OPERATION;
     }
     if (!(mCurrentState & MEDIA_RECORDER_INITIALIZED)) {
-        LOGE("setAudioSource called in an invalid state(%d)", mCurrentState);
+        ALOGE("setAudioSource called in an invalid state(%d)", mCurrentState);
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->setAudioSource(as);
     if (OK != ret) {
-        LOGV("setAudioSource failed: %d", ret);
+        ALOGV("setAudioSource failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -175,23 +175,23 @@
 
 status_t MediaRecorder::setOutputFormat(int of)
 {
-    LOGV("setOutputFormat(%d)", of);
+    ALOGV("setOutputFormat(%d)", of);
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (!(mCurrentState & MEDIA_RECORDER_INITIALIZED)) {
-        LOGE("setOutputFormat called in an invalid state: %d", mCurrentState);
+        ALOGE("setOutputFormat called in an invalid state: %d", mCurrentState);
         return INVALID_OPERATION;
     }
     if (mIsVideoSourceSet && of >= OUTPUT_FORMAT_AUDIO_ONLY_START && of != OUTPUT_FORMAT_RTP_AVP && of != OUTPUT_FORMAT_MPEG2TS) { //first non-video output format
-        LOGE("output format (%d) is meant for audio recording only and incompatible with video recording", of);
+        ALOGE("output format (%d) is meant for audio recording only and incompatible with video recording", of);
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->setOutputFormat(of);
     if (OK != ret) {
-        LOGE("setOutputFormat failed: %d", ret);
+        ALOGE("setOutputFormat failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -201,27 +201,27 @@
 
 status_t MediaRecorder::setVideoEncoder(int ve)
 {
-    LOGV("setVideoEncoder(%d)", ve);
+    ALOGV("setVideoEncoder(%d)", ve);
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (!mIsVideoSourceSet) {
-        LOGE("try to set the video encoder without setting the video source first");
+        ALOGE("try to set the video encoder without setting the video source first");
         return INVALID_OPERATION;
     }
     if (mIsVideoEncoderSet) {
-        LOGE("video encoder has already been set");
+        ALOGE("video encoder has already been set");
         return INVALID_OPERATION;
     }
     if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) {
-        LOGE("setVideoEncoder called in an invalid state(%d)", mCurrentState);
+        ALOGE("setVideoEncoder called in an invalid state(%d)", mCurrentState);
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->setVideoEncoder(ve);
     if (OK != ret) {
-        LOGV("setVideoEncoder failed: %d", ret);
+        ALOGV("setVideoEncoder failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -231,27 +231,27 @@
 
 status_t MediaRecorder::setAudioEncoder(int ae)
 {
-    LOGV("setAudioEncoder(%d)", ae);
+    ALOGV("setAudioEncoder(%d)", ae);
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (!mIsAudioSourceSet) {
-        LOGE("try to set the audio encoder without setting the audio source first");
+        ALOGE("try to set the audio encoder without setting the audio source first");
         return INVALID_OPERATION;
     }
     if (mIsAudioEncoderSet) {
-        LOGE("audio encoder has already been set");
+        ALOGE("audio encoder has already been set");
         return INVALID_OPERATION;
     }
     if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) {
-        LOGE("setAudioEncoder called in an invalid state(%d)", mCurrentState);
+        ALOGE("setAudioEncoder called in an invalid state(%d)", mCurrentState);
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->setAudioEncoder(ae);
     if (OK != ret) {
-        LOGV("setAudioEncoder failed: %d", ret);
+        ALOGV("setAudioEncoder failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -261,23 +261,23 @@
 
 status_t MediaRecorder::setOutputFile(const char* path)
 {
-    LOGV("setOutputFile(%s)", path);
+    ALOGV("setOutputFile(%s)", path);
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (mIsOutputFileSet) {
-        LOGE("output file has already been set");
+        ALOGE("output file has already been set");
         return INVALID_OPERATION;
     }
     if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) {
-        LOGE("setOutputFile called in an invalid state(%d)", mCurrentState);
+        ALOGE("setOutputFile called in an invalid state(%d)", mCurrentState);
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->setOutputFile(path);
     if (OK != ret) {
-        LOGV("setOutputFile failed: %d", ret);
+        ALOGV("setOutputFile failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -287,17 +287,17 @@
 
 status_t MediaRecorder::setOutputFile(int fd, int64_t offset, int64_t length)
 {
-    LOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (mIsOutputFileSet) {
-        LOGE("output file has already been set");
+        ALOGE("output file has already been set");
         return INVALID_OPERATION;
     }
     if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) {
-        LOGE("setOutputFile called in an invalid state(%d)", mCurrentState);
+        ALOGE("setOutputFile called in an invalid state(%d)", mCurrentState);
         return INVALID_OPERATION;
     }
 
@@ -308,13 +308,13 @@
     // this issue by checking the file descriptor first before passing
     // it through binder call.
     if (fd < 0) {
-        LOGE("Invalid file descriptor: %d", fd);
+        ALOGE("Invalid file descriptor: %d", fd);
         return BAD_VALUE;
     }
 
     status_t ret = mMediaRecorder->setOutputFile(fd, offset, length);
     if (OK != ret) {
-        LOGV("setOutputFile failed: %d", ret);
+        ALOGV("setOutputFile failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -324,23 +324,23 @@
 
 status_t MediaRecorder::setVideoSize(int width, int height)
 {
-    LOGV("setVideoSize(%d, %d)", width, height);
+    ALOGV("setVideoSize(%d, %d)", width, height);
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) {
-        LOGE("setVideoSize called in an invalid state: %d", mCurrentState);
+        ALOGE("setVideoSize called in an invalid state: %d", mCurrentState);
         return INVALID_OPERATION;
     }
     if (!mIsVideoSourceSet) {
-        LOGE("Cannot set video size without setting video source first");
+        ALOGE("Cannot set video size without setting video source first");
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->setVideoSize(width, height);
     if (OK != ret) {
-        LOGE("setVideoSize failed: %d", ret);
+        ALOGE("setVideoSize failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -358,7 +358,7 @@
     mSurfaceMediaSource =
             mMediaRecorder->querySurfaceMediaSource();
     if (mSurfaceMediaSource == NULL) {
-        LOGE("SurfaceMediaSource could not be initialized!");
+        ALOGE("SurfaceMediaSource could not be initialized!");
     }
     return mSurfaceMediaSource;
 }
@@ -367,23 +367,23 @@
 
 status_t MediaRecorder::setVideoFrameRate(int frames_per_second)
 {
-    LOGV("setVideoFrameRate(%d)", frames_per_second);
+    ALOGV("setVideoFrameRate(%d)", frames_per_second);
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) {
-        LOGE("setVideoFrameRate called in an invalid state: %d", mCurrentState);
+        ALOGE("setVideoFrameRate called in an invalid state: %d", mCurrentState);
         return INVALID_OPERATION;
     }
     if (!mIsVideoSourceSet) {
-        LOGE("Cannot set video frame rate without setting video source first");
+        ALOGE("Cannot set video frame rate without setting video source first");
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->setVideoFrameRate(frames_per_second);
     if (OK != ret) {
-        LOGE("setVideoFrameRate failed: %d", ret);
+        ALOGE("setVideoFrameRate failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -391,9 +391,9 @@
 }
 
 status_t MediaRecorder::setParameters(const String8& params) {
-    LOGV("setParameters(%s)", params.string());
+    ALOGV("setParameters(%s)", params.string());
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
 
@@ -402,13 +402,13 @@
                             MEDIA_RECORDER_RECORDING |
                             MEDIA_RECORDER_ERROR));
     if (isInvalidState) {
-        LOGE("setParameters is called in an invalid state: %d", mCurrentState);
+        ALOGE("setParameters is called in an invalid state: %d", mCurrentState);
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->setParameters(params);
     if (OK != ret) {
-        LOGE("setParameters(%s) failed: %d", params.string(), ret);
+        ALOGE("setParameters(%s) failed: %d", params.string(), ret);
         // Do not change our current state to MEDIA_RECORDER_ERROR, failures
         // of the only currently supported parameters, "max-duration" and
         // "max-filesize" are _not_ fatal.
@@ -419,36 +419,36 @@
 
 status_t MediaRecorder::prepare()
 {
-    LOGV("prepare");
+    ALOGV("prepare");
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) {
-        LOGE("prepare called in an invalid state: %d", mCurrentState);
+        ALOGE("prepare called in an invalid state: %d", mCurrentState);
         return INVALID_OPERATION;
     }
     if (mIsAudioSourceSet != mIsAudioEncoderSet) {
         if (mIsAudioSourceSet) {
-            LOGE("audio source is set, but audio encoder is not set");
+            ALOGE("audio source is set, but audio encoder is not set");
         } else {  // must not happen, since setAudioEncoder checks this already
-            LOGE("audio encoder is set, but audio source is not set");
+            ALOGE("audio encoder is set, but audio source is not set");
         }
         return INVALID_OPERATION;
     }
 
     if (mIsVideoSourceSet != mIsVideoEncoderSet) {
         if (mIsVideoSourceSet) {
-            LOGE("video source is set, but video encoder is not set");
+            ALOGE("video source is set, but video encoder is not set");
         } else {  // must not happen, since setVideoEncoder checks this already
-            LOGE("video encoder is set, but video source is not set");
+            ALOGE("video encoder is set, but video source is not set");
         }
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->prepare();
     if (OK != ret) {
-        LOGE("prepare failed: %d", ret);
+        ALOGE("prepare failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -458,19 +458,19 @@
 
 status_t MediaRecorder::getMaxAmplitude(int* max)
 {
-    LOGV("getMaxAmplitude");
+    ALOGV("getMaxAmplitude");
     if(mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (mCurrentState & MEDIA_RECORDER_ERROR) {
-        LOGE("getMaxAmplitude called in an invalid state: %d", mCurrentState);
+        ALOGE("getMaxAmplitude called in an invalid state: %d", mCurrentState);
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->getMaxAmplitude(max);
     if (OK != ret) {
-        LOGE("getMaxAmplitude failed: %d", ret);
+        ALOGE("getMaxAmplitude failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -479,19 +479,19 @@
 
 status_t MediaRecorder::start()
 {
-    LOGV("start");
+    ALOGV("start");
     if (mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (!(mCurrentState & MEDIA_RECORDER_PREPARED)) {
-        LOGE("start called in an invalid state: %d", mCurrentState);
+        ALOGE("start called in an invalid state: %d", mCurrentState);
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->start();
     if (OK != ret) {
-        LOGE("start failed: %d", ret);
+        ALOGE("start failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -501,19 +501,19 @@
 
 status_t MediaRecorder::stop()
 {
-    LOGV("stop");
+    ALOGV("stop");
     if (mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (!(mCurrentState & MEDIA_RECORDER_RECORDING)) {
-        LOGE("stop called in an invalid state: %d", mCurrentState);
+        ALOGE("stop called in an invalid state: %d", mCurrentState);
         return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->stop();
     if (OK != ret) {
-        LOGE("stop failed: %d", ret);
+        ALOGE("stop failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -529,9 +529,9 @@
 // Reset should be OK in any state
 status_t MediaRecorder::reset()
 {
-    LOGV("reset");
+    ALOGV("reset");
     if (mMediaRecorder == NULL) {
-        LOGE("media recorder is not initialized yet");
+        ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
 
@@ -556,7 +556,7 @@
             break;
 
         default: {
-            LOGE("Unexpected non-existing state: %d", mCurrentState);
+            ALOGE("Unexpected non-existing state: %d", mCurrentState);
             break;
         }
     }
@@ -565,14 +565,14 @@
 
 status_t MediaRecorder::close()
 {
-    LOGV("close");
+    ALOGV("close");
     if (!(mCurrentState & MEDIA_RECORDER_INITIALIZED)) {
-        LOGE("close called in an invalid state: %d", mCurrentState);
+        ALOGE("close called in an invalid state: %d", mCurrentState);
         return INVALID_OPERATION;
     }
     status_t ret = mMediaRecorder->close();
     if (OK != ret) {
-        LOGE("close failed: %d", ret);
+        ALOGE("close failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return UNKNOWN_ERROR;
     } else {
@@ -583,10 +583,10 @@
 
 status_t MediaRecorder::doReset()
 {
-    LOGV("doReset");
+    ALOGV("doReset");
     status_t ret = mMediaRecorder->reset();
     if (OK != ret) {
-        LOGE("doReset failed: %d", ret);
+        ALOGE("doReset failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     } else {
@@ -597,7 +597,7 @@
 
 void MediaRecorder::doCleanUp()
 {
-    LOGV("doCleanUp");
+    ALOGV("doCleanUp");
     mIsAudioSourceSet  = false;
     mIsVideoSourceSet  = false;
     mIsAudioEncoderSet = false;
@@ -608,7 +608,7 @@
 // Release should be OK in any state
 status_t MediaRecorder::release()
 {
-    LOGV("release");
+    ALOGV("release");
     if (mMediaRecorder != NULL) {
         return mMediaRecorder->release();
     }
@@ -617,7 +617,7 @@
 
 MediaRecorder::MediaRecorder() : mSurfaceMediaSource(NULL)
 {
-    LOGV("constructor");
+    ALOGV("constructor");
 
     const sp<IMediaPlayerService>& service(getMediaPlayerService());
     if (service != NULL) {
@@ -638,7 +638,7 @@
 
 MediaRecorder::~MediaRecorder()
 {
-    LOGV("destructor");
+    ALOGV("destructor");
     if (mMediaRecorder != NULL) {
         mMediaRecorder.clear();
     }
@@ -650,7 +650,7 @@
 
 status_t MediaRecorder::setListener(const sp<MediaRecorderListener>& listener)
 {
-    LOGV("setListener");
+    ALOGV("setListener");
     Mutex::Autolock _l(mLock);
     mListener = listener;
 
@@ -659,7 +659,7 @@
 
 void MediaRecorder::notify(int msg, int ext1, int ext2)
 {
-    LOGV("message received msg=%d, ext1=%d, ext2=%d", msg, ext1, ext2);
+    ALOGV("message received msg=%d, ext1=%d, ext2=%d", msg, ext1, ext2);
 
     sp<MediaRecorderListener> listener;
     mLock.lock();
@@ -668,15 +668,15 @@
 
     if (listener != NULL) {
         Mutex::Autolock _l(mNotifyLock);
-        LOGV("callback application");
+        ALOGV("callback application");
         listener->notify(msg, ext1, ext2);
-        LOGV("back from callback");
+        ALOGV("back from callback");
     }
 }
 
 void MediaRecorder::died()
 {
-    LOGV("died");
+    ALOGV("died");
     notify(MEDIA_RECORDER_EVENT_ERROR, MEDIA_ERROR_SERVER_DIED, 0);
 }
 
diff --git a/media/libmedia_native/Android.mk b/media/libmedia_native/Android.mk
new file mode 100644
index 0000000..065a90f
--- /dev/null
+++ b/media/libmedia_native/Android.mk
@@ -0,0 +1,11 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES :=
+
+LOCAL_MODULE:= libmedia_native
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index e8d0f0c..f5cb019 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -112,14 +112,14 @@
     int32_t val;
     if (p.readInt32(&val) != OK)
     {
-        LOGE("Failed to read filter's length");
+        ALOGE("Failed to read filter's length");
         *status = NOT_ENOUGH_DATA;
         return false;
     }
 
     if( val > kMaxFilterSize || val < 0)
     {
-        LOGE("Invalid filter len %d", val);
+        ALOGE("Invalid filter len %d", val);
         *status = BAD_VALUE;
         return false;
     }
@@ -134,7 +134,7 @@
 
     if (p.dataAvail() < size)
     {
-        LOGE("Filter too short expected %d but got %d", size, p.dataAvail());
+        ALOGE("Filter too short expected %d but got %d", size, p.dataAvail());
         *status = NOT_ENOUGH_DATA;
         return false;
     }
@@ -144,7 +144,7 @@
 
     if (NULL == data)
     {
-        LOGE("Filter had no data");
+        ALOGE("Filter had no data");
         *status = BAD_VALUE;
         return false;
     }
@@ -184,7 +184,7 @@
 #endif
     if (getpid() == IPCThreadState::self()->getCallingPid()) return true;
     bool ok = checkCallingPermission(String16(permissionString));
-    if (!ok) LOGE("Request requires %s", permissionString);
+    if (!ok) ALOGE("Request requires %s", permissionString);
     return ok;
 }
 
@@ -215,7 +215,7 @@
 
 MediaPlayerService::MediaPlayerService()
 {
-    LOGV("MediaPlayerService created");
+    ALOGV("MediaPlayerService created");
     mNextConnId = 1;
 
     mBatteryAudio.refCount = 0;
@@ -230,7 +230,7 @@
 
 MediaPlayerService::~MediaPlayerService()
 {
-    LOGV("MediaPlayerService destroyed");
+    ALOGV("MediaPlayerService destroyed");
 }
 
 sp<IMediaRecorder> MediaPlayerService::createMediaRecorder(pid_t pid)
@@ -239,7 +239,7 @@
     wp<MediaRecorderClient> w = recorder;
     Mutex::Autolock lock(mLock);
     mMediaRecorderClients.add(w);
-    LOGV("Create new media recorder client from pid %d", pid);
+    ALOGV("Create new media recorder client from pid %d", pid);
     return recorder;
 }
 
@@ -247,13 +247,13 @@
 {
     Mutex::Autolock lock(mLock);
     mMediaRecorderClients.remove(client);
-    LOGV("Delete media recorder client");
+    ALOGV("Delete media recorder client");
 }
 
 sp<IMediaMetadataRetriever> MediaPlayerService::createMetadataRetriever(pid_t pid)
 {
     sp<MetadataRetrieverClient> retriever = new MetadataRetrieverClient(pid);
-    LOGV("Create new media retriever from pid %d", pid);
+    ALOGV("Create new media retriever from pid %d", pid);
     return retriever;
 }
 
@@ -266,7 +266,7 @@
             this, pid, connId, client, audioSessionId,
             IPCThreadState::self()->getCallingUid());
 
-    LOGV("Create new client(%d) from pid %d, uid %d, ", connId, pid,
+    ALOGV("Create new client(%d) from pid %d, uid %d, ", connId, pid,
          IPCThreadState::self()->getCallingUid());
 
     wp<Client> w = c;
@@ -478,7 +478,7 @@
         int32_t connId, const sp<IMediaPlayerClient>& client,
         int audioSessionId, uid_t uid)
 {
-    LOGV("Client(%d) constructor", connId);
+    ALOGV("Client(%d) constructor", connId);
     mPid = pid;
     mConnId = connId;
     mService = service;
@@ -489,14 +489,14 @@
     mUID = uid;
 
 #if CALLBACK_ANTAGONIZER
-    LOGD("create Antagonizer");
+    ALOGD("create Antagonizer");
     mAntagonizer = new Antagonizer(notify, this);
 #endif
 }
 
 MediaPlayerService::Client::~Client()
 {
-    LOGV("Client(%d) destructor pid = %d", mConnId, mPid);
+    ALOGV("Client(%d) destructor pid = %d", mConnId, mPid);
     mAudioOutput.clear();
     wp<Client> client(this);
     disconnect();
@@ -505,7 +505,7 @@
 
 void MediaPlayerService::Client::disconnect()
 {
-    LOGV("disconnect(%d) from pid %d", mConnId, mPid);
+    ALOGV("disconnect(%d) from pid %d", mConnId, mPid);
     // grab local reference and clear main reference to prevent future
     // access to object
     sp<MediaPlayerBase> p;
@@ -523,7 +523,7 @@
     if (p != 0) {
         p->setNotifyCallback(0, 0);
 #if CALLBACK_ANTAGONIZER
-        LOGD("kill Antagonizer");
+        ALOGD("kill Antagonizer");
         mAntagonizer->kill();
 #endif
         p->reset();
@@ -614,23 +614,23 @@
     sp<MediaPlayerBase> p;
     switch (playerType) {
         case SONIVOX_PLAYER:
-            LOGV(" create MidiFile");
+            ALOGV(" create MidiFile");
             p = new MidiFile();
             break;
         case STAGEFRIGHT_PLAYER:
-            LOGV(" create StagefrightPlayer");
+            ALOGV(" create StagefrightPlayer");
             p = new StagefrightPlayer;
             break;
         case NU_PLAYER:
-            LOGV(" create NuPlayer");
+            ALOGV(" create NuPlayer");
             p = new NuPlayerDriver;
             break;
         case TEST_PLAYER:
-            LOGV("Create Test Player stub");
+            ALOGV("Create Test Player stub");
             p = new TestPlayerStub();
             break;
         default:
-            LOGE("Unknown player type: %d", playerType);
+            ALOGE("Unknown player type: %d", playerType);
             return NULL;
     }
     if (p != NULL) {
@@ -641,7 +641,7 @@
         }
     }
     if (p == NULL) {
-        LOGE("Failed to create player object");
+        ALOGE("Failed to create player object");
     }
     return p;
 }
@@ -651,7 +651,7 @@
     // determine if we have the right player type
     sp<MediaPlayerBase> p = mPlayer;
     if ((p != NULL) && (p->playerType() != playerType)) {
-        LOGV("delete player");
+        ALOGV("delete player");
         p.clear();
     }
     if (p == NULL) {
@@ -668,7 +668,7 @@
 status_t MediaPlayerService::Client::setDataSource(
         const char *url, const KeyedVector<String8, String8> *headers)
 {
-    LOGV("setDataSource(%s)", url);
+    ALOGV("setDataSource(%s)", url);
     if (url == NULL)
         return UNKNOWN_ERROR;
 
@@ -688,7 +688,7 @@
         int fd = android::openContentProviderFile(url16);
         if (fd < 0)
         {
-            LOGE("Couldn't open fd for %s", url);
+            ALOGE("Couldn't open fd for %s", url);
             return UNKNOWN_ERROR;
         }
         setDataSource(fd, 0, 0x7fffffffffLL); // this sets mStatus
@@ -696,7 +696,7 @@
         return mStatus;
     } else {
         player_type playerType = getPlayerType(url);
-        LOGV("player type = %d", playerType);
+        ALOGV("player type = %d", playerType);
 
         // create the right type of player
         sp<MediaPlayerBase> p = createPlayer(playerType);
@@ -708,12 +708,12 @@
         }
 
         // now set data source
-        LOGV(" setDataSource");
+        ALOGV(" setDataSource");
         mStatus = p->setDataSource(url, headers);
         if (mStatus == NO_ERROR) {
             mPlayer = p;
         } else {
-            LOGE("  error: %d", mStatus);
+            ALOGE("  error: %d", mStatus);
         }
         return mStatus;
     }
@@ -721,32 +721,32 @@
 
 status_t MediaPlayerService::Client::setDataSource(int fd, int64_t offset, int64_t length)
 {
-    LOGV("setDataSource fd=%d, offset=%lld, length=%lld", fd, offset, length);
+    ALOGV("setDataSource fd=%d, offset=%lld, length=%lld", fd, offset, length);
     struct stat sb;
     int ret = fstat(fd, &sb);
     if (ret != 0) {
-        LOGE("fstat(%d) failed: %d, %s", fd, ret, strerror(errno));
+        ALOGE("fstat(%d) failed: %d, %s", fd, ret, strerror(errno));
         return UNKNOWN_ERROR;
     }
 
-    LOGV("st_dev  = %llu", sb.st_dev);
-    LOGV("st_mode = %u", sb.st_mode);
-    LOGV("st_uid  = %lu", sb.st_uid);
-    LOGV("st_gid  = %lu", sb.st_gid);
-    LOGV("st_size = %llu", sb.st_size);
+    ALOGV("st_dev  = %llu", sb.st_dev);
+    ALOGV("st_mode = %u", sb.st_mode);
+    ALOGV("st_uid  = %lu", sb.st_uid);
+    ALOGV("st_gid  = %lu", sb.st_gid);
+    ALOGV("st_size = %llu", sb.st_size);
 
     if (offset >= sb.st_size) {
-        LOGE("offset error");
+        ALOGE("offset error");
         ::close(fd);
         return UNKNOWN_ERROR;
     }
     if (offset + length > sb.st_size) {
         length = sb.st_size - offset;
-        LOGV("calculated length = %lld", length);
+        ALOGV("calculated length = %lld", length);
     }
 
     player_type playerType = getPlayerType(fd, offset, length);
-    LOGV("player type = %d", playerType);
+    ALOGV("player type = %d", playerType);
 
     // create the right type of player
     sp<MediaPlayerBase> p = createPlayer(playerType);
@@ -794,7 +794,7 @@
                 NATIVE_WINDOW_API_MEDIA);
 
         if (err != OK) {
-            LOGW("native_window_api_disconnect returned an error: %s (%d)",
+            ALOGW("native_window_api_disconnect returned an error: %s (%d)",
                     strerror(-err), err);
         }
     }
@@ -804,7 +804,7 @@
 status_t MediaPlayerService::Client::setVideoSurfaceTexture(
         const sp<ISurfaceTexture>& surfaceTexture)
 {
-    LOGV("[%d] setVideoSurfaceTexture(%p)", mConnId, surfaceTexture.get());
+    ALOGV("[%d] setVideoSurfaceTexture(%p)", mConnId, surfaceTexture.get());
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
 
@@ -821,7 +821,7 @@
                 NATIVE_WINDOW_API_MEDIA);
 
         if (err != OK) {
-            LOGE("setVideoSurfaceTexture failed: %d", err);
+            ALOGE("setVideoSurfaceTexture failed: %d", err);
             // Note that we must do the reset before disconnecting from the ANW.
             // Otherwise queue/dequeue calls could be made on the disconnected
             // ANW, which may result in errors.
@@ -905,7 +905,7 @@
 
     if (status != OK) {
         metadata.resetParcel();
-        LOGE("getMetadata failed %d", status);
+        ALOGE("getMetadata failed %d", status);
         return status;
     }
 
@@ -920,12 +920,12 @@
 
 status_t MediaPlayerService::Client::prepareAsync()
 {
-    LOGV("[%d] prepareAsync", mConnId);
+    ALOGV("[%d] prepareAsync", mConnId);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     status_t ret = p->prepareAsync();
 #if CALLBACK_ANTAGONIZER
-    LOGD("start Antagonizer");
+    ALOGD("start Antagonizer");
     if (ret == NO_ERROR) mAntagonizer->start();
 #endif
     return ret;
@@ -933,7 +933,7 @@
 
 status_t MediaPlayerService::Client::start()
 {
-    LOGV("[%d] start", mConnId);
+    ALOGV("[%d] start", mConnId);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     p->setLooping(mLoop);
@@ -942,7 +942,7 @@
 
 status_t MediaPlayerService::Client::stop()
 {
-    LOGV("[%d] stop", mConnId);
+    ALOGV("[%d] stop", mConnId);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     return p->stop();
@@ -950,7 +950,7 @@
 
 status_t MediaPlayerService::Client::pause()
 {
-    LOGV("[%d] pause", mConnId);
+    ALOGV("[%d] pause", mConnId);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     return p->pause();
@@ -962,41 +962,41 @@
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     *state = p->isPlaying();
-    LOGV("[%d] isPlaying: %d", mConnId, *state);
+    ALOGV("[%d] isPlaying: %d", mConnId, *state);
     return NO_ERROR;
 }
 
 status_t MediaPlayerService::Client::getCurrentPosition(int *msec)
 {
-    LOGV("getCurrentPosition");
+    ALOGV("getCurrentPosition");
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     status_t ret = p->getCurrentPosition(msec);
     if (ret == NO_ERROR) {
-        LOGV("[%d] getCurrentPosition = %d", mConnId, *msec);
+        ALOGV("[%d] getCurrentPosition = %d", mConnId, *msec);
     } else {
-        LOGE("getCurrentPosition returned %d", ret);
+        ALOGE("getCurrentPosition returned %d", ret);
     }
     return ret;
 }
 
 status_t MediaPlayerService::Client::getDuration(int *msec)
 {
-    LOGV("getDuration");
+    ALOGV("getDuration");
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     status_t ret = p->getDuration(msec);
     if (ret == NO_ERROR) {
-        LOGV("[%d] getDuration = %d", mConnId, *msec);
+        ALOGV("[%d] getDuration = %d", mConnId, *msec);
     } else {
-        LOGE("getDuration returned %d", ret);
+        ALOGE("getDuration returned %d", ret);
     }
     return ret;
 }
 
 status_t MediaPlayerService::Client::seekTo(int msec)
 {
-    LOGV("[%d] seekTo(%d)", mConnId, msec);
+    ALOGV("[%d] seekTo(%d)", mConnId, msec);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     return p->seekTo(msec);
@@ -1004,7 +1004,7 @@
 
 status_t MediaPlayerService::Client::reset()
 {
-    LOGV("[%d] reset", mConnId);
+    ALOGV("[%d] reset", mConnId);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     return p->reset();
@@ -1012,7 +1012,7 @@
 
 status_t MediaPlayerService::Client::setAudioStreamType(int type)
 {
-    LOGV("[%d] setAudioStreamType(%d)", mConnId, type);
+    ALOGV("[%d] setAudioStreamType(%d)", mConnId, type);
     // TODO: for hardware output, call player instead
     Mutex::Autolock l(mLock);
     if (mAudioOutput != 0) mAudioOutput->setAudioStreamType(type);
@@ -1021,7 +1021,7 @@
 
 status_t MediaPlayerService::Client::setLooping(int loop)
 {
-    LOGV("[%d] setLooping(%d)", mConnId, loop);
+    ALOGV("[%d] setLooping(%d)", mConnId, loop);
     mLoop = loop;
     sp<MediaPlayerBase> p = getPlayer();
     if (p != 0) return p->setLooping(loop);
@@ -1030,7 +1030,7 @@
 
 status_t MediaPlayerService::Client::setVolume(float leftVolume, float rightVolume)
 {
-    LOGV("[%d] setVolume(%f, %f)", mConnId, leftVolume, rightVolume);
+    ALOGV("[%d] setVolume(%f, %f)", mConnId, leftVolume, rightVolume);
     // TODO: for hardware output, call player instead
     Mutex::Autolock l(mLock);
     if (mAudioOutput != 0) mAudioOutput->setVolume(leftVolume, rightVolume);
@@ -1039,7 +1039,7 @@
 
 status_t MediaPlayerService::Client::setAuxEffectSendLevel(float level)
 {
-    LOGV("[%d] setAuxEffectSendLevel(%f)", mConnId, level);
+    ALOGV("[%d] setAuxEffectSendLevel(%f)", mConnId, level);
     Mutex::Autolock l(mLock);
     if (mAudioOutput != 0) return mAudioOutput->setAuxEffectSendLevel(level);
     return NO_ERROR;
@@ -1047,21 +1047,21 @@
 
 status_t MediaPlayerService::Client::attachAuxEffect(int effectId)
 {
-    LOGV("[%d] attachAuxEffect(%d)", mConnId, effectId);
+    ALOGV("[%d] attachAuxEffect(%d)", mConnId, effectId);
     Mutex::Autolock l(mLock);
     if (mAudioOutput != 0) return mAudioOutput->attachAuxEffect(effectId);
     return NO_ERROR;
 }
 
 status_t MediaPlayerService::Client::setParameter(int key, const Parcel &request) {
-    LOGV("[%d] setParameter(%d)", mConnId, key);
+    ALOGV("[%d] setParameter(%d)", mConnId, key);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     return p->setParameter(key, request);
 }
 
 status_t MediaPlayerService::Client::getParameter(int key, Parcel *reply) {
-    LOGV("[%d] getParameter(%d)", mConnId, key);
+    ALOGV("[%d] getParameter(%d)", mConnId, key);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     return p->getParameter(key, reply);
@@ -1084,7 +1084,7 @@
         // also access mMetadataUpdated and clears it.
         client->addNewMetadataUpdate(metadata_type);
     }
-    LOGV("[%d] notify (%p, %d, %d, %d)", client->mConnId, cookie, msg, ext1, ext2);
+    ALOGV("[%d] notify (%p, %d, %d, %d)", client->mConnId, cookie, msg, ext1, ext2);
     client->mClient->notify(msg, ext1, ext2, obj);
 }
 
@@ -1131,18 +1131,18 @@
 
 int Antagonizer::callbackThread(void* user)
 {
-    LOGD("Antagonizer started");
+    ALOGD("Antagonizer started");
     Antagonizer* p = reinterpret_cast<Antagonizer*>(user);
     while (!p->mExit) {
         if (p->mActive) {
-            LOGV("send event");
+            ALOGV("send event");
             p->mCb(p->mClient, 0, 0, 0);
         }
         usleep(interval);
     }
     Mutex::Autolock _l(p->mLock);
     p->mCondition.signal();
-    LOGD("Antagonizer stopped");
+    ALOGD("Antagonizer stopped");
     return 0;
 }
 #endif
@@ -1151,7 +1151,7 @@
 
 sp<IMemory> MediaPlayerService::decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, int* pFormat)
 {
-    LOGV("decode(%s)", url);
+    ALOGV("decode(%s)", url);
     sp<MemoryBase> mem;
     sp<MediaPlayerBase> player;
 
@@ -1160,12 +1160,12 @@
     // If the application wants to decode those, it should open a
     // filedescriptor for them and use that.
     if (url != NULL && strncmp(url, "http://", 7) != 0) {
-        LOGD("Can't decode %s by path, use filedescriptor instead", url);
+        ALOGD("Can't decode %s by path, use filedescriptor instead", url);
         return mem;
     }
 
     player_type playerType = getPlayerType(url);
-    LOGV("player type = %d", playerType);
+    ALOGV("player type = %d", playerType);
 
     // create the right type of player
     sp<AudioCache> cache = new AudioCache(url);
@@ -1178,16 +1178,16 @@
     // set data source
     if (player->setDataSource(url) != NO_ERROR) goto Exit;
 
-    LOGV("prepare");
+    ALOGV("prepare");
     player->prepareAsync();
 
-    LOGV("wait for prepare");
+    ALOGV("wait for prepare");
     if (cache->wait() != NO_ERROR) goto Exit;
 
-    LOGV("start");
+    ALOGV("start");
     player->start();
 
-    LOGV("wait for playback complete");
+    ALOGV("wait for playback complete");
     cache->wait();
     // in case of error, return what was successfully decoded.
     if (cache->size() == 0) {
@@ -1198,7 +1198,7 @@
     *pSampleRate = cache->sampleRate();
     *pNumChannels = cache->channelCount();
     *pFormat = (int)cache->format();
-    LOGV("return memory @ %p, sampleRate=%u, channelCount = %d, format = %d", mem->pointer(), *pSampleRate, *pNumChannels, *pFormat);
+    ALOGV("return memory @ %p, sampleRate=%u, channelCount = %d, format = %d", mem->pointer(), *pSampleRate, *pNumChannels, *pFormat);
 
 Exit:
     if (player != 0) player->reset();
@@ -1207,12 +1207,12 @@
 
 sp<IMemory> MediaPlayerService::decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, int* pFormat)
 {
-    LOGV("decode(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("decode(%d, %lld, %lld)", fd, offset, length);
     sp<MemoryBase> mem;
     sp<MediaPlayerBase> player;
 
     player_type playerType = getPlayerType(fd, offset, length);
-    LOGV("player type = %d", playerType);
+    ALOGV("player type = %d", playerType);
 
     // create the right type of player
     sp<AudioCache> cache = new AudioCache("decode_fd");
@@ -1225,16 +1225,16 @@
     // set data source
     if (player->setDataSource(fd, offset, length) != NO_ERROR) goto Exit;
 
-    LOGV("prepare");
+    ALOGV("prepare");
     player->prepareAsync();
 
-    LOGV("wait for prepare");
+    ALOGV("wait for prepare");
     if (cache->wait() != NO_ERROR) goto Exit;
 
-    LOGV("start");
+    ALOGV("start");
     player->start();
 
-    LOGV("wait for playback complete");
+    ALOGV("wait for playback complete");
     cache->wait();
     // in case of error, return what was successfully decoded.
     if (cache->size() == 0) {
@@ -1245,7 +1245,7 @@
     *pSampleRate = cache->sampleRate();
     *pNumChannels = cache->channelCount();
     *pFormat = cache->format();
-    LOGV("return memory @ %p, sampleRate=%u, channelCount = %d, format = %d", mem->pointer(), *pSampleRate, *pNumChannels, *pFormat);
+    ALOGV("return memory @ %p, sampleRate=%u, channelCount = %d, format = %d", mem->pointer(), *pSampleRate, *pNumChannels, *pFormat);
 
 Exit:
     if (player != 0) player->reset();
@@ -1260,7 +1260,7 @@
     : mCallback(NULL),
       mCallbackCookie(NULL),
       mSessionId(sessionId) {
-    LOGV("AudioOutput(%d)", sessionId);
+    ALOGV("AudioOutput(%d)", sessionId);
     mTrack = 0;
     mStreamType = AUDIO_STREAM_MUSIC;
     mLeftVolume = 1.0;
@@ -1347,11 +1347,11 @@
 
     // Check argument "bufferCount" against the mininum buffer count
     if (bufferCount < mMinBufferCount) {
-        LOGD("bufferCount (%d) is too small and increased to %d", bufferCount, mMinBufferCount);
+        ALOGD("bufferCount (%d) is too small and increased to %d", bufferCount, mMinBufferCount);
         bufferCount = mMinBufferCount;
 
     }
-    LOGV("open(%u, %d, %d, %d, %d)", sampleRate, channelCount, format, bufferCount,mSessionId);
+    ALOGV("open(%u, %d, %d, %d, %d)", sampleRate, channelCount, format, bufferCount,mSessionId);
     if (mTrack) close();
     int afSampleRate;
     int afFrameCount;
@@ -1394,12 +1394,12 @@
     }
 
     if ((t == 0) || (t->initCheck() != NO_ERROR)) {
-        LOGE("Unable to create audio track");
+        ALOGE("Unable to create audio track");
         delete t;
         return NO_INIT;
     }
 
-    LOGV("setVolume");
+    ALOGV("setVolume");
     t->setVolume(mLeftVolume, mRightVolume);
 
     mMsecsPerFrame = 1.e3 / (float) sampleRate;
@@ -1412,7 +1412,7 @@
 
 void MediaPlayerService::AudioOutput::start()
 {
-    LOGV("start");
+    ALOGV("start");
     if (mTrack) {
         mTrack->setVolume(mLeftVolume, mRightVolume);
         mTrack->setAuxEffectSendLevel(mSendLevel);
@@ -1426,7 +1426,7 @@
 {
     LOG_FATAL_IF(mCallback != NULL, "Don't call write if supplying a callback.");
 
-    //LOGV("write(%p, %u)", buffer, size);
+    //ALOGV("write(%p, %u)", buffer, size);
     if (mTrack) {
         ssize_t ret = mTrack->write(buffer, size);
         return ret;
@@ -1436,32 +1436,32 @@
 
 void MediaPlayerService::AudioOutput::stop()
 {
-    LOGV("stop");
+    ALOGV("stop");
     if (mTrack) mTrack->stop();
 }
 
 void MediaPlayerService::AudioOutput::flush()
 {
-    LOGV("flush");
+    ALOGV("flush");
     if (mTrack) mTrack->flush();
 }
 
 void MediaPlayerService::AudioOutput::pause()
 {
-    LOGV("pause");
+    ALOGV("pause");
     if (mTrack) mTrack->pause();
 }
 
 void MediaPlayerService::AudioOutput::close()
 {
-    LOGV("close");
+    ALOGV("close");
     delete mTrack;
     mTrack = 0;
 }
 
 void MediaPlayerService::AudioOutput::setVolume(float left, float right)
 {
-    LOGV("setVolume(%f, %f)", left, right);
+    ALOGV("setVolume(%f, %f)", left, right);
     mLeftVolume = left;
     mRightVolume = right;
     if (mTrack) {
@@ -1471,7 +1471,7 @@
 
 status_t MediaPlayerService::AudioOutput::setAuxEffectSendLevel(float level)
 {
-    LOGV("setAuxEffectSendLevel(%f)", level);
+    ALOGV("setAuxEffectSendLevel(%f)", level);
     mSendLevel = level;
     if (mTrack) {
         return mTrack->setAuxEffectSendLevel(level);
@@ -1481,7 +1481,7 @@
 
 status_t MediaPlayerService::AudioOutput::attachAuxEffect(int effectId)
 {
-    LOGV("attachAuxEffect(%d)", effectId);
+    ALOGV("attachAuxEffect(%d)", effectId);
     mAuxEffectId = effectId;
     if (mTrack) {
         return mTrack->attachAuxEffect(effectId);
@@ -1492,7 +1492,7 @@
 // static
 void MediaPlayerService::AudioOutput::CallbackWrapper(
         int event, void *cookie, void *info) {
-    //LOGV("callbackwrapper");
+    //ALOGV("callbackwrapper");
     if (event != AudioTrack::EVENT_MORE_DATA) {
         return;
     }
@@ -1614,7 +1614,7 @@
         uint32_t sampleRate, int channelCount, int format, int bufferCount,
         AudioCallback cb, void *cookie)
 {
-    LOGV("open(%u, %d, %d, %d)", sampleRate, channelCount, format, bufferCount);
+    ALOGV("open(%u, %d, %d, %d)", sampleRate, channelCount, format, bufferCount);
     if (mHeap->getHeapID() < 0) {
         return NO_INIT;
     }
@@ -1644,15 +1644,15 @@
 
 ssize_t MediaPlayerService::AudioCache::write(const void* buffer, size_t size)
 {
-    LOGV("write(%p, %u)", buffer, size);
+    ALOGV("write(%p, %u)", buffer, size);
     if ((buffer == 0) || (size == 0)) return size;
 
     uint8_t* p = static_cast<uint8_t*>(mHeap->getBase());
     if (p == NULL) return NO_INIT;
     p += mSize;
-    LOGV("memcpy(%p, %p, %u)", p, buffer, size);
+    ALOGV("memcpy(%p, %p, %u)", p, buffer, size);
     if (mSize + size > mHeap->getSize()) {
-        LOGE("Heap size overflow! req size: %d, max size: %d", (mSize + size), mHeap->getSize());
+        ALOGE("Heap size overflow! req size: %d, max size: %d", (mSize + size), mHeap->getSize());
         size = mHeap->getSize() - mSize;
     }
     memcpy(p, buffer, size);
@@ -1670,9 +1670,9 @@
     mCommandComplete = false;
 
     if (mError == NO_ERROR) {
-        LOGV("wait - success");
+        ALOGV("wait - success");
     } else {
-        LOGV("wait - error");
+        ALOGV("wait - error");
     }
     return mError;
 }
@@ -1680,24 +1680,24 @@
 void MediaPlayerService::AudioCache::notify(
         void* cookie, int msg, int ext1, int ext2, const Parcel *obj)
 {
-    LOGV("notify(%p, %d, %d, %d)", cookie, msg, ext1, ext2);
+    ALOGV("notify(%p, %d, %d, %d)", cookie, msg, ext1, ext2);
     AudioCache* p = static_cast<AudioCache*>(cookie);
 
     // ignore buffering messages
     switch (msg)
     {
     case MEDIA_ERROR:
-        LOGE("Error %d, %d occurred", ext1, ext2);
+        ALOGE("Error %d, %d occurred", ext1, ext2);
         p->mError = ext1;
         break;
     case MEDIA_PREPARED:
-        LOGV("prepared");
+        ALOGV("prepared");
         break;
     case MEDIA_PLAYBACK_COMPLETE:
-        LOGV("playback complete");
+        ALOGV("playback complete");
         break;
     default:
-        LOGV("ignored");
+        ALOGV("ignored");
         return;
     }
 
@@ -1772,7 +1772,7 @@
 
     } else if (params & kBatteryDataAudioFlingerStop) {
         if (mBatteryAudio.refCount <= 0) {
-            LOGW("Battery track warning: refCount is <= 0");
+            ALOGW("Battery track warning: refCount is <= 0");
             return;
         }
 
@@ -1807,7 +1807,7 @@
         info.refCount = 0;
 
         if (mBatteryData.add(uid, info) == NO_MEMORY) {
-            LOGE("Battery track error: no memory for new app");
+            ALOGE("Battery track error: no memory for new app");
             return;
         }
     }
@@ -1825,10 +1825,10 @@
         }
     } else {
         if (info.refCount == 0) {
-            LOGW("Battery track warning: refCount is already 0");
+            ALOGW("Battery track warning: refCount is already 0");
             return;
         } else if (info.refCount < 0) {
-            LOGE("Battery track error: refCount < 0");
+            ALOGE("Battery track error: refCount < 0");
             mBatteryData.removeItem(uid);
             return;
         }
diff --git a/media/libmediaplayerservice/MediaRecorderClient.cpp b/media/libmediaplayerservice/MediaRecorderClient.cpp
index 6f80b35..d219fc2 100644
--- a/media/libmediaplayerservice/MediaRecorderClient.cpp
+++ b/media/libmediaplayerservice/MediaRecorderClient.cpp
@@ -54,17 +54,17 @@
 #endif
     if (getpid() == IPCThreadState::self()->getCallingPid()) return true;
     bool ok = checkCallingPermission(String16(permissionString));
-    if (!ok) LOGE("Request requires %s", permissionString);
+    if (!ok) ALOGE("Request requires %s", permissionString);
     return ok;
 }
 
 
 sp<ISurfaceTexture> MediaRecorderClient::querySurfaceMediaSource()
 {
-    LOGV("Query SurfaceMediaSource");
+    ALOGV("Query SurfaceMediaSource");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NULL;
     }
     return mRecorder->querySurfaceMediaSource();
@@ -75,10 +75,10 @@
 status_t MediaRecorderClient::setCamera(const sp<ICamera>& camera,
                                         const sp<ICameraRecordingProxy>& proxy)
 {
-    LOGV("setCamera");
+    ALOGV("setCamera");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->setCamera(camera, proxy);
@@ -86,10 +86,10 @@
 
 status_t MediaRecorderClient::setPreviewSurface(const sp<Surface>& surface)
 {
-    LOGV("setPreviewSurface");
+    ALOGV("setPreviewSurface");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->setPreviewSurface(surface);
@@ -97,13 +97,13 @@
 
 status_t MediaRecorderClient::setVideoSource(int vs)
 {
-    LOGV("setVideoSource(%d)", vs);
+    ALOGV("setVideoSource(%d)", vs);
     if (!checkPermission(cameraPermission)) {
         return PERMISSION_DENIED;
     }
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL)	{
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->setVideoSource((video_source)vs);
@@ -111,13 +111,13 @@
 
 status_t MediaRecorderClient::setAudioSource(int as)
 {
-    LOGV("setAudioSource(%d)", as);
+    ALOGV("setAudioSource(%d)", as);
     if (!checkPermission(recordAudioPermission)) {
         return PERMISSION_DENIED;
     }
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL)  {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->setAudioSource((audio_source_t)as);
@@ -125,10 +125,10 @@
 
 status_t MediaRecorderClient::setOutputFormat(int of)
 {
-    LOGV("setOutputFormat(%d)", of);
+    ALOGV("setOutputFormat(%d)", of);
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->setOutputFormat((output_format)of);
@@ -136,10 +136,10 @@
 
 status_t MediaRecorderClient::setVideoEncoder(int ve)
 {
-    LOGV("setVideoEncoder(%d)", ve);
+    ALOGV("setVideoEncoder(%d)", ve);
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->setVideoEncoder((video_encoder)ve);
@@ -147,10 +147,10 @@
 
 status_t MediaRecorderClient::setAudioEncoder(int ae)
 {
-    LOGV("setAudioEncoder(%d)", ae);
+    ALOGV("setAudioEncoder(%d)", ae);
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->setAudioEncoder((audio_encoder)ae);
@@ -158,10 +158,10 @@
 
 status_t MediaRecorderClient::setOutputFile(const char* path)
 {
-    LOGV("setOutputFile(%s)", path);
+    ALOGV("setOutputFile(%s)", path);
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->setOutputFile(path);
@@ -169,10 +169,10 @@
 
 status_t MediaRecorderClient::setOutputFile(int fd, int64_t offset, int64_t length)
 {
-    LOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->setOutputFile(fd, offset, length);
@@ -180,10 +180,10 @@
 
 status_t MediaRecorderClient::setVideoSize(int width, int height)
 {
-    LOGV("setVideoSize(%dx%d)", width, height);
+    ALOGV("setVideoSize(%dx%d)", width, height);
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->setVideoSize(width, height);
@@ -191,20 +191,20 @@
 
 status_t MediaRecorderClient::setVideoFrameRate(int frames_per_second)
 {
-    LOGV("setVideoFrameRate(%d)", frames_per_second);
+    ALOGV("setVideoFrameRate(%d)", frames_per_second);
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->setVideoFrameRate(frames_per_second);
 }
 
 status_t MediaRecorderClient::setParameters(const String8& params) {
-    LOGV("setParameters(%s)", params.string());
+    ALOGV("setParameters(%s)", params.string());
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->setParameters(params);
@@ -212,10 +212,10 @@
 
 status_t MediaRecorderClient::prepare()
 {
-    LOGV("prepare");
+    ALOGV("prepare");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->prepare();
@@ -224,10 +224,10 @@
 
 status_t MediaRecorderClient::getMaxAmplitude(int* max)
 {
-    LOGV("getMaxAmplitude");
+    ALOGV("getMaxAmplitude");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->getMaxAmplitude(max);
@@ -235,10 +235,10 @@
 
 status_t MediaRecorderClient::start()
 {
-    LOGV("start");
+    ALOGV("start");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->start();
@@ -247,10 +247,10 @@
 
 status_t MediaRecorderClient::stop()
 {
-    LOGV("stop");
+    ALOGV("stop");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->stop();
@@ -258,10 +258,10 @@
 
 status_t MediaRecorderClient::init()
 {
-    LOGV("init");
+    ALOGV("init");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->init();
@@ -269,10 +269,10 @@
 
 status_t MediaRecorderClient::close()
 {
-    LOGV("close");
+    ALOGV("close");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->close();
@@ -281,10 +281,10 @@
 
 status_t MediaRecorderClient::reset()
 {
-    LOGV("reset");
+    ALOGV("reset");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->reset();
@@ -292,7 +292,7 @@
 
 status_t MediaRecorderClient::release()
 {
-    LOGV("release");
+    ALOGV("release");
     Mutex::Autolock lock(mLock);
     if (mRecorder != NULL) {
         delete mRecorder;
@@ -305,7 +305,7 @@
 
 MediaRecorderClient::MediaRecorderClient(const sp<MediaPlayerService>& service, pid_t pid)
 {
-    LOGV("Client constructor");
+    ALOGV("Client constructor");
     mPid = pid;
     mRecorder = new StagefrightRecorder;
     mMediaPlayerService = service;
@@ -313,16 +313,16 @@
 
 MediaRecorderClient::~MediaRecorderClient()
 {
-    LOGV("Client destructor");
+    ALOGV("Client destructor");
     release();
 }
 
 status_t MediaRecorderClient::setListener(const sp<IMediaRecorderClient>& listener)
 {
-    LOGV("setListener");
+    ALOGV("setListener");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
-        LOGE("recorder is not initialized");
+        ALOGE("recorder is not initialized");
         return NO_INIT;
     }
     return mRecorder->setListener(listener);
diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.cpp b/media/libmediaplayerservice/MetadataRetrieverClient.cpp
index d574ea3..7dbb57f 100644
--- a/media/libmediaplayerservice/MetadataRetrieverClient.cpp
+++ b/media/libmediaplayerservice/MetadataRetrieverClient.cpp
@@ -46,7 +46,7 @@
 
 MetadataRetrieverClient::MetadataRetrieverClient(pid_t pid)
 {
-    LOGV("MetadataRetrieverClient constructor pid(%d)", pid);
+    ALOGV("MetadataRetrieverClient constructor pid(%d)", pid);
     mPid = pid;
     mThumbnail = NULL;
     mAlbumArt = NULL;
@@ -55,7 +55,7 @@
 
 MetadataRetrieverClient::~MetadataRetrieverClient()
 {
-    LOGV("MetadataRetrieverClient destructor");
+    ALOGV("MetadataRetrieverClient destructor");
     disconnect();
 }
 
@@ -74,7 +74,7 @@
 
 void MetadataRetrieverClient::disconnect()
 {
-    LOGV("disconnect from pid %d", mPid);
+    ALOGV("disconnect from pid %d", mPid);
     Mutex::Autolock lock(mLock);
     mRetriever.clear();
     mThumbnail.clear();
@@ -92,17 +92,17 @@
             break;
         }
         case SONIVOX_PLAYER:
-            LOGV("create midi metadata retriever");
+            ALOGV("create midi metadata retriever");
             p = new MidiMetadataRetriever();
             break;
         default:
             // TODO:
             // support for TEST_PLAYER
-            LOGE("player type %d is not supported",  playerType);
+            ALOGE("player type %d is not supported",  playerType);
             break;
     }
     if (p == NULL) {
-        LOGE("failed to create a retriever object");
+        ALOGE("failed to create a retriever object");
     }
     return p;
 }
@@ -110,13 +110,13 @@
 status_t MetadataRetrieverClient::setDataSource(
         const char *url, const KeyedVector<String8, String8> *headers)
 {
-    LOGV("setDataSource(%s)", url);
+    ALOGV("setDataSource(%s)", url);
     Mutex::Autolock lock(mLock);
     if (url == NULL) {
         return UNKNOWN_ERROR;
     }
     player_type playerType = getPlayerType(url);
-    LOGV("player type = %d", playerType);
+    ALOGV("player type = %d", playerType);
     sp<MediaMetadataRetrieverBase> p = createRetriever(playerType);
     if (p == NULL) return NO_INIT;
     status_t ret = p->setDataSource(url, headers);
@@ -126,32 +126,32 @@
 
 status_t MetadataRetrieverClient::setDataSource(int fd, int64_t offset, int64_t length)
 {
-    LOGV("setDataSource fd=%d, offset=%lld, length=%lld", fd, offset, length);
+    ALOGV("setDataSource fd=%d, offset=%lld, length=%lld", fd, offset, length);
     Mutex::Autolock lock(mLock);
     struct stat sb;
     int ret = fstat(fd, &sb);
     if (ret != 0) {
-        LOGE("fstat(%d) failed: %d, %s", fd, ret, strerror(errno));
+        ALOGE("fstat(%d) failed: %d, %s", fd, ret, strerror(errno));
         return BAD_VALUE;
     }
-    LOGV("st_dev  = %llu", sb.st_dev);
-    LOGV("st_mode = %u", sb.st_mode);
-    LOGV("st_uid  = %lu", sb.st_uid);
-    LOGV("st_gid  = %lu", sb.st_gid);
-    LOGV("st_size = %llu", sb.st_size);
+    ALOGV("st_dev  = %llu", sb.st_dev);
+    ALOGV("st_mode = %u", sb.st_mode);
+    ALOGV("st_uid  = %lu", sb.st_uid);
+    ALOGV("st_gid  = %lu", sb.st_gid);
+    ALOGV("st_size = %llu", sb.st_size);
 
     if (offset >= sb.st_size) {
-        LOGE("offset (%lld) bigger than file size (%llu)", offset, sb.st_size);
+        ALOGE("offset (%lld) bigger than file size (%llu)", offset, sb.st_size);
         ::close(fd);
         return BAD_VALUE;
     }
     if (offset + length > sb.st_size) {
         length = sb.st_size - offset;
-        LOGV("calculated length = %lld", length);
+        ALOGV("calculated length = %lld", length);
     }
 
     player_type playerType = getPlayerType(fd, offset, length);
-    LOGV("player type = %d", playerType);
+    ALOGV("player type = %d", playerType);
     sp<MediaMetadataRetrieverBase> p = createRetriever(playerType);
     if (p == NULL) {
         ::close(fd);
@@ -165,28 +165,28 @@
 
 sp<IMemory> MetadataRetrieverClient::getFrameAtTime(int64_t timeUs, int option)
 {
-    LOGV("getFrameAtTime: time(%lld us) option(%d)", timeUs, option);
+    ALOGV("getFrameAtTime: time(%lld us) option(%d)", timeUs, option);
     Mutex::Autolock lock(mLock);
     mThumbnail.clear();
     if (mRetriever == NULL) {
-        LOGE("retriever is not initialized");
+        ALOGE("retriever is not initialized");
         return NULL;
     }
     VideoFrame *frame = mRetriever->getFrameAtTime(timeUs, option);
     if (frame == NULL) {
-        LOGE("failed to capture a video frame");
+        ALOGE("failed to capture a video frame");
         return NULL;
     }
     size_t size = sizeof(VideoFrame) + frame->mSize;
     sp<MemoryHeapBase> heap = new MemoryHeapBase(size, 0, "MetadataRetrieverClient");
     if (heap == NULL) {
-        LOGE("failed to create MemoryDealer");
+        ALOGE("failed to create MemoryDealer");
         delete frame;
         return NULL;
     }
     mThumbnail = new MemoryBase(heap, 0, size);
     if (mThumbnail == NULL) {
-        LOGE("not enough memory for VideoFrame size=%u", size);
+        ALOGE("not enough memory for VideoFrame size=%u", size);
         delete frame;
         return NULL;
     }
@@ -197,7 +197,7 @@
     frameCopy->mDisplayHeight = frame->mDisplayHeight;
     frameCopy->mSize = frame->mSize;
     frameCopy->mRotationAngle = frame->mRotationAngle;
-    LOGV("rotation: %d", frameCopy->mRotationAngle);
+    ALOGV("rotation: %d", frameCopy->mRotationAngle);
     frameCopy->mData = (uint8_t *)frameCopy + sizeof(VideoFrame);
     memcpy(frameCopy->mData, frame->mData, frame->mSize);
     delete frame;  // Fix memory leakage
@@ -206,28 +206,28 @@
 
 sp<IMemory> MetadataRetrieverClient::extractAlbumArt()
 {
-    LOGV("extractAlbumArt");
+    ALOGV("extractAlbumArt");
     Mutex::Autolock lock(mLock);
     mAlbumArt.clear();
     if (mRetriever == NULL) {
-        LOGE("retriever is not initialized");
+        ALOGE("retriever is not initialized");
         return NULL;
     }
     MediaAlbumArt *albumArt = mRetriever->extractAlbumArt();
     if (albumArt == NULL) {
-        LOGE("failed to extract an album art");
+        ALOGE("failed to extract an album art");
         return NULL;
     }
     size_t size = sizeof(MediaAlbumArt) + albumArt->mSize;
     sp<MemoryHeapBase> heap = new MemoryHeapBase(size, 0, "MetadataRetrieverClient");
     if (heap == NULL) {
-        LOGE("failed to create MemoryDealer object");
+        ALOGE("failed to create MemoryDealer object");
         delete albumArt;
         return NULL;
     }
     mAlbumArt = new MemoryBase(heap, 0, size);
     if (mAlbumArt == NULL) {
-        LOGE("not enough memory for MediaAlbumArt size=%u", size);
+        ALOGE("not enough memory for MediaAlbumArt size=%u", size);
         delete albumArt;
         return NULL;
     }
@@ -241,10 +241,10 @@
 
 const char* MetadataRetrieverClient::extractMetadata(int keyCode)
 {
-    LOGV("extractMetadata");
+    ALOGV("extractMetadata");
     Mutex::Autolock lock(mLock);
     if (mRetriever == NULL) {
-        LOGE("retriever is not initialized");
+        ALOGE("retriever is not initialized");
         return NULL;
     }
     return mRetriever->extractMetadata(keyCode);
diff --git a/media/libmediaplayerservice/MidiFile.cpp b/media/libmediaplayerservice/MidiFile.cpp
index 7e04523..d89b5f4 100644
--- a/media/libmediaplayerservice/MidiFile.cpp
+++ b/media/libmediaplayerservice/MidiFile.cpp
@@ -58,7 +58,7 @@
     mStreamType(AUDIO_STREAM_MUSIC), mLoop(false), mExit(false),
     mPaused(false), mRender(false), mTid(-1)
 {
-    LOGV("constructor");
+    ALOGV("constructor");
 
     mFileLocator.path = NULL;
     mFileLocator.fd = -1;
@@ -69,13 +69,13 @@
     if (pLibConfig == NULL)
         pLibConfig = EAS_Config();
     if ((pLibConfig == NULL) || (LIB_VERSION != pLibConfig->libVersion)) {
-        LOGE("EAS library/header mismatch");
+        ALOGE("EAS library/header mismatch");
         goto Failed;
     }
 
     // initialize EAS library
     if (EAS_Init(&mEasData) != EAS_SUCCESS) {
-        LOGE("EAS_Init failed");
+        ALOGE("EAS_Init failed");
         goto Failed;
     }
 
@@ -88,12 +88,12 @@
         Mutex::Autolock l(mMutex);
         createThreadEtc(renderThread, this, "midithread", ANDROID_PRIORITY_AUDIO);
         mCondition.wait(mMutex);
-        LOGV("thread started");
+        ALOGV("thread started");
     }
 
     // indicate success
     if (mTid > 0) {
-        LOGV(" render thread(%d) started", mTid);
+        ALOGV(" render thread(%d) started", mTid);
         mState = EAS_STATE_READY;
     }
 
@@ -108,13 +108,13 @@
 }
 
 MidiFile::~MidiFile() {
-    LOGV("MidiFile destructor");
+    ALOGV("MidiFile destructor");
     release();
 }
 
 status_t MidiFile::setDataSource(
         const char* path, const KeyedVector<String8, String8> *) {
-    LOGV("MidiFile::setDataSource url=%s", path);
+    ALOGV("MidiFile::setDataSource url=%s", path);
     Mutex::Autolock lock(mMutex);
 
     // file still open?
@@ -133,7 +133,7 @@
     }
 
     if (result != EAS_SUCCESS) {
-        LOGE("EAS_OpenFile failed: [%d]", (int)result);
+        ALOGE("EAS_OpenFile failed: [%d]", (int)result);
         mState = EAS_STATE_ERROR;
         return ERROR_OPEN_FAILED;
     }
@@ -145,7 +145,7 @@
 
 status_t MidiFile::setDataSource(int fd, int64_t offset, int64_t length)
 {
-    LOGV("MidiFile::setDataSource fd=%d", fd);
+    ALOGV("MidiFile::setDataSource fd=%d", fd);
     Mutex::Autolock lock(mMutex);
 
     // file still open?
@@ -161,7 +161,7 @@
     updateState();
 
     if (result != EAS_SUCCESS) {
-        LOGE("EAS_OpenFile failed: [%d]", (int)result);
+        ALOGE("EAS_OpenFile failed: [%d]", (int)result);
         mState = EAS_STATE_ERROR;
         return ERROR_OPEN_FAILED;
     }
@@ -173,14 +173,14 @@
 
 status_t MidiFile::prepare()
 {
-    LOGV("MidiFile::prepare");
+    ALOGV("MidiFile::prepare");
     Mutex::Autolock lock(mMutex);
     if (!mEasHandle) {
         return ERROR_NOT_OPEN;
     }
     EAS_RESULT result;
     if ((result = EAS_Prepare(mEasData, mEasHandle)) != EAS_SUCCESS) {
-        LOGE("EAS_Prepare failed: [%ld]", result);
+        ALOGE("EAS_Prepare failed: [%ld]", result);
         return ERROR_EAS_FAILURE;
     }
     updateState();
@@ -189,7 +189,7 @@
 
 status_t MidiFile::prepareAsync()
 {
-    LOGV("MidiFile::prepareAsync");
+    ALOGV("MidiFile::prepareAsync");
     status_t ret = prepare();
 
     // don't hold lock during callback
@@ -203,7 +203,7 @@
 
 status_t MidiFile::start()
 {
-    LOGV("MidiFile::start");
+    ALOGV("MidiFile::start");
     Mutex::Autolock lock(mMutex);
     if (!mEasHandle) {
         return ERROR_NOT_OPEN;
@@ -221,14 +221,14 @@
     mRender = true;
 
     // wake up render thread
-    LOGV("  wakeup render thread");
+    ALOGV("  wakeup render thread");
     mCondition.signal();
     return NO_ERROR;
 }
 
 status_t MidiFile::stop()
 {
-    LOGV("MidiFile::stop");
+    ALOGV("MidiFile::stop");
     Mutex::Autolock lock(mMutex);
     if (!mEasHandle) {
         return ERROR_NOT_OPEN;
@@ -236,7 +236,7 @@
     if (!mPaused && (mState != EAS_STATE_STOPPED)) {
         EAS_RESULT result = EAS_Pause(mEasData, mEasHandle);
         if (result != EAS_SUCCESS) {
-            LOGE("EAS_Pause returned error %ld", result);
+            ALOGE("EAS_Pause returned error %ld", result);
             return ERROR_EAS_FAILURE;
         }
     }
@@ -246,7 +246,7 @@
 
 status_t MidiFile::seekTo(int position)
 {
-    LOGV("MidiFile::seekTo %d", position);
+    ALOGV("MidiFile::seekTo %d", position);
     // hold lock during EAS calls
     {
         Mutex::Autolock lock(mMutex);
@@ -257,7 +257,7 @@
         if ((result = EAS_Locate(mEasData, mEasHandle, position, false))
                 != EAS_SUCCESS)
         {
-            LOGE("EAS_Locate returned %ld", result);
+            ALOGE("EAS_Locate returned %ld", result);
             return ERROR_EAS_FAILURE;
         }
         EAS_GetLocation(mEasData, mEasHandle, &mPlayTime);
@@ -268,7 +268,7 @@
 
 status_t MidiFile::pause()
 {
-    LOGV("MidiFile::pause");
+    ALOGV("MidiFile::pause");
     Mutex::Autolock lock(mMutex);
     if (!mEasHandle) {
         return ERROR_NOT_OPEN;
@@ -283,20 +283,20 @@
 
 bool MidiFile::isPlaying()
 {
-    LOGV("MidiFile::isPlaying, mState=%d", int(mState));
+    ALOGV("MidiFile::isPlaying, mState=%d", int(mState));
     if (!mEasHandle || mPaused) return false;
     return (mState == EAS_STATE_PLAY);
 }
 
 status_t MidiFile::getCurrentPosition(int* position)
 {
-    LOGV("MidiFile::getCurrentPosition");
+    ALOGV("MidiFile::getCurrentPosition");
     if (!mEasHandle) {
-        LOGE("getCurrentPosition(): file not open");
+        ALOGE("getCurrentPosition(): file not open");
         return ERROR_NOT_OPEN;
     }
     if (mPlayTime < 0) {
-        LOGE("getCurrentPosition(): mPlayTime = %ld", mPlayTime);
+        ALOGE("getCurrentPosition(): mPlayTime = %ld", mPlayTime);
         return ERROR_EAS_FAILURE;
     }
     *position = mPlayTime;
@@ -306,7 +306,7 @@
 status_t MidiFile::getDuration(int* duration)
 {
 
-    LOGV("MidiFile::getDuration");
+    ALOGV("MidiFile::getDuration");
     {
         Mutex::Autolock lock(mMutex);
         if (!mEasHandle) return ERROR_NOT_OPEN;
@@ -349,7 +349,7 @@
 
 status_t MidiFile::release()
 {
-    LOGV("MidiFile::release");
+    ALOGV("MidiFile::release");
     Mutex::Autolock l(mMutex);
     reset_nosync();
 
@@ -372,7 +372,7 @@
 
 status_t MidiFile::reset()
 {
-    LOGV("MidiFile::reset");
+    ALOGV("MidiFile::reset");
     Mutex::Autolock lock(mMutex);
     return reset_nosync();
 }
@@ -380,7 +380,7 @@
 // call only with mutex held
 status_t MidiFile::reset_nosync()
 {
-    LOGV("MidiFile::reset_nosync");
+    ALOGV("MidiFile::reset_nosync");
     // close file
     if (mEasHandle) {
         EAS_CloseFile(mEasData, mEasHandle);
@@ -407,7 +407,7 @@
 
 status_t MidiFile::setLooping(int loop)
 {
-    LOGV("MidiFile::setLooping");
+    ALOGV("MidiFile::setLooping");
     Mutex::Autolock lock(mMutex);
     if (!mEasHandle) {
         return ERROR_NOT_OPEN;
@@ -421,7 +421,7 @@
 
 status_t MidiFile::createOutputTrack() {
     if (mAudioSink->open(pLibConfig->sampleRate, pLibConfig->numChannels, AUDIO_FORMAT_PCM_16_BIT, 2) != NO_ERROR) {
-        LOGE("mAudioSink open failed");
+        ALOGE("mAudioSink open failed");
         return ERROR_OPEN_FAILED;
     }
     return NO_ERROR;
@@ -438,12 +438,12 @@
     int temp;
     bool audioStarted = false;
 
-    LOGV("MidiFile::render");
+    ALOGV("MidiFile::render");
 
     // allocate render buffer
     mAudioBuffer = new EAS_PCM[pLibConfig->mixBufferSize * pLibConfig->numChannels * NUM_BUFFERS];
     if (!mAudioBuffer) {
-        LOGE("mAudioBuffer allocate failed");
+        ALOGE("mAudioBuffer allocate failed");
         goto threadExit;
     }
 
@@ -451,7 +451,7 @@
     {
         Mutex::Autolock l(mMutex);
         mTid = gettid();
-        LOGV("render thread(%d) signal", mTid);
+        ALOGV("render thread(%d) signal", mTid);
         mCondition.signal();
     }
 
@@ -461,9 +461,9 @@
         // nothing to render, wait for client thread to wake us up
         while (!mRender && !mExit)
         {
-            LOGV("MidiFile::render - signal wait");
+            ALOGV("MidiFile::render - signal wait");
             mCondition.wait(mMutex);
-            LOGV("MidiFile::render - signal rx'd");
+            ALOGV("MidiFile::render - signal rx'd");
         }
         if (mExit) {
             mMutex.unlock();
@@ -471,41 +471,41 @@
         }
 
         // render midi data into the input buffer
-        //LOGV("MidiFile::render - rendering audio");
+        //ALOGV("MidiFile::render - rendering audio");
         int num_output = 0;
         EAS_PCM* p = mAudioBuffer;
         for (int i = 0; i < NUM_BUFFERS; i++) {
             result = EAS_Render(mEasData, p, pLibConfig->mixBufferSize, &count);
             if (result != EAS_SUCCESS) {
-                LOGE("EAS_Render returned %ld", result);
+                ALOGE("EAS_Render returned %ld", result);
             }
             p += count * pLibConfig->numChannels;
             num_output += count * pLibConfig->numChannels * sizeof(EAS_PCM);
         }
 
         // update playback state and position
-        // LOGV("MidiFile::render - updating state");
+        // ALOGV("MidiFile::render - updating state");
         EAS_GetLocation(mEasData, mEasHandle, &mPlayTime);
         EAS_State(mEasData, mEasHandle, &mState);
         mMutex.unlock();
 
         // create audio output track if necessary
         if (!mAudioSink->ready()) {
-            LOGV("MidiFile::render - create output track");
+            ALOGV("MidiFile::render - create output track");
             if (createOutputTrack() != NO_ERROR)
                 goto threadExit;
         }
 
         // Write data to the audio hardware
-        // LOGV("MidiFile::render - writing to audio output");
+        // ALOGV("MidiFile::render - writing to audio output");
         if ((temp = mAudioSink->write(mAudioBuffer, num_output)) < 0) {
-            LOGE("Error in writing:%d",temp);
+            ALOGE("Error in writing:%d",temp);
             return temp;
         }
 
         // start audio output if necessary
         if (!audioStarted) {
-            //LOGV("MidiFile::render - starting audio");
+            //ALOGV("MidiFile::render - starting audio");
             mAudioSink->start();
             audioStarted = true;
         }
@@ -517,18 +517,18 @@
             switch(mState) {
             case EAS_STATE_STOPPED:
             {
-                LOGV("MidiFile::render - stopped");
+                ALOGV("MidiFile::render - stopped");
                 sendEvent(MEDIA_PLAYBACK_COMPLETE);
                 break;
             }
             case EAS_STATE_ERROR:
             {
-                LOGE("MidiFile::render - error");
+                ALOGE("MidiFile::render - error");
                 sendEvent(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN);
                 break;
             }
             case EAS_STATE_PAUSED:
-                LOGV("MidiFile::render - paused");
+                ALOGV("MidiFile::render - paused");
                 break;
             default:
                 break;
diff --git a/media/libmediaplayerservice/MidiMetadataRetriever.cpp b/media/libmediaplayerservice/MidiMetadataRetriever.cpp
index aaf2d18..465209f 100644
--- a/media/libmediaplayerservice/MidiMetadataRetriever.cpp
+++ b/media/libmediaplayerservice/MidiMetadataRetriever.cpp
@@ -31,14 +31,14 @@
 
 void MidiMetadataRetriever::clearMetadataValues()
 {
-    LOGV("clearMetadataValues");
+    ALOGV("clearMetadataValues");
     mMetadataValues[0][0] = '\0';
 }
 
 status_t MidiMetadataRetriever::setDataSource(
         const char *url, const KeyedVector<String8, String8> *headers)
 {
-    LOGV("setDataSource: %s", url? url: "NULL pointer");
+    ALOGV("setDataSource: %s", url? url: "NULL pointer");
     Mutex::Autolock lock(mLock);
     clearMetadataValues();
     if (mMidiPlayer == 0) {
@@ -49,7 +49,7 @@
 
 status_t MidiMetadataRetriever::setDataSource(int fd, int64_t offset, int64_t length)
 {
-    LOGV("setDataSource: fd(%d), offset(%lld), and length(%lld)", fd, offset, length);
+    ALOGV("setDataSource: fd(%d), offset(%lld), and length(%lld)", fd, offset, length);
     Mutex::Autolock lock(mLock);
     clearMetadataValues();
     if (mMidiPlayer == 0) {
@@ -60,10 +60,10 @@
 
 const char* MidiMetadataRetriever::extractMetadata(int keyCode)
 {
-    LOGV("extractMetdata: key(%d)", keyCode);
+    ALOGV("extractMetdata: key(%d)", keyCode);
     Mutex::Autolock lock(mLock);
     if (mMidiPlayer == 0 || mMidiPlayer->initCheck() != NO_ERROR) {
-        LOGE("Midi player is not initialized yet");
+        ALOGE("Midi player is not initialized yet");
         return NULL;
     }
     switch (keyCode) {
@@ -72,17 +72,17 @@
             if (mMetadataValues[0][0] == '\0') {
                 int duration = -1;
                 if (mMidiPlayer->getDuration(&duration) != NO_ERROR) {
-                    LOGE("failed to get duration");
+                    ALOGE("failed to get duration");
                     return NULL;
                 }
                 snprintf(mMetadataValues[0], MAX_METADATA_STRING_LENGTH, "%d", duration);
             }
 
-            LOGV("duration: %s ms", mMetadataValues[0]);
+            ALOGV("duration: %s ms", mMetadataValues[0]);
             return mMetadataValues[0];
         }
     default:
-        LOGE("Unsupported key code (%d)", keyCode);
+        ALOGE("Unsupported key code (%d)", keyCode);
         return NULL;
     }
     return NULL;
diff --git a/media/libmediaplayerservice/StagefrightPlayer.cpp b/media/libmediaplayerservice/StagefrightPlayer.cpp
index 598d573..6d7771a 100644
--- a/media/libmediaplayerservice/StagefrightPlayer.cpp
+++ b/media/libmediaplayerservice/StagefrightPlayer.cpp
@@ -29,13 +29,13 @@
 
 StagefrightPlayer::StagefrightPlayer()
     : mPlayer(new AwesomePlayer) {
-    LOGV("StagefrightPlayer");
+    ALOGV("StagefrightPlayer");
 
     mPlayer->setListener(this);
 }
 
 StagefrightPlayer::~StagefrightPlayer() {
-    LOGV("~StagefrightPlayer");
+    ALOGV("~StagefrightPlayer");
     reset();
 
     delete mPlayer;
@@ -43,7 +43,7 @@
 }
 
 status_t StagefrightPlayer::initCheck() {
-    LOGV("initCheck");
+    ALOGV("initCheck");
     return OK;
 }
 
@@ -61,7 +61,7 @@
 // Warning: The filedescriptor passed into this method will only be valid until
 // the method returns, if you want to keep it, dup it!
 status_t StagefrightPlayer::setDataSource(int fd, int64_t offset, int64_t length) {
-    LOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
     return mPlayer->setDataSource(dup(fd), offset, length);
 }
 
@@ -71,7 +71,7 @@
 
 status_t StagefrightPlayer::setVideoSurfaceTexture(
         const sp<ISurfaceTexture> &surfaceTexture) {
-    LOGV("setVideoSurfaceTexture");
+    ALOGV("setVideoSurfaceTexture");
 
     return mPlayer->setSurfaceTexture(surfaceTexture);
 }
@@ -85,30 +85,30 @@
 }
 
 status_t StagefrightPlayer::start() {
-    LOGV("start");
+    ALOGV("start");
 
     return mPlayer->play();
 }
 
 status_t StagefrightPlayer::stop() {
-    LOGV("stop");
+    ALOGV("stop");
 
     return pause();  // what's the difference?
 }
 
 status_t StagefrightPlayer::pause() {
-    LOGV("pause");
+    ALOGV("pause");
 
     return mPlayer->pause();
 }
 
 bool StagefrightPlayer::isPlaying() {
-    LOGV("isPlaying");
+    ALOGV("isPlaying");
     return mPlayer->isPlaying();
 }
 
 status_t StagefrightPlayer::seekTo(int msec) {
-    LOGV("seekTo %.2f secs", msec / 1E3);
+    ALOGV("seekTo %.2f secs", msec / 1E3);
 
     status_t err = mPlayer->seekTo((int64_t)msec * 1000);
 
@@ -116,7 +116,7 @@
 }
 
 status_t StagefrightPlayer::getCurrentPosition(int *msec) {
-    LOGV("getCurrentPosition");
+    ALOGV("getCurrentPosition");
 
     int64_t positionUs;
     status_t err = mPlayer->getPosition(&positionUs);
@@ -131,7 +131,7 @@
 }
 
 status_t StagefrightPlayer::getDuration(int *msec) {
-    LOGV("getDuration");
+    ALOGV("getDuration");
 
     int64_t durationUs;
     status_t err = mPlayer->getDuration(&durationUs);
@@ -147,7 +147,7 @@
 }
 
 status_t StagefrightPlayer::reset() {
-    LOGV("reset");
+    ALOGV("reset");
 
     mPlayer->reset();
 
@@ -155,13 +155,13 @@
 }
 
 status_t StagefrightPlayer::setLooping(int loop) {
-    LOGV("setLooping");
+    ALOGV("setLooping");
 
     return mPlayer->setLooping(loop);
 }
 
 player_type StagefrightPlayer::playerType() {
-    LOGV("playerType");
+    ALOGV("playerType");
     return STAGEFRIGHT_PLAYER;
 }
 
@@ -176,12 +176,12 @@
 }
 
 status_t StagefrightPlayer::setParameter(int key, const Parcel &request) {
-    LOGV("setParameter");
+    ALOGV("setParameter");
     return mPlayer->setParameter(key, request);
 }
 
 status_t StagefrightPlayer::getParameter(int key, Parcel *reply) {
-    LOGV("getParameter");
+    ALOGV("getParameter");
     return mPlayer->getParameter(key, reply);
 }
 
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index 6981668..4632016 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -71,17 +71,17 @@
       mVideoSource(VIDEO_SOURCE_LIST_END),
       mStarted(false), mSurfaceMediaSource(NULL) {
 
-    LOGV("Constructor");
+    ALOGV("Constructor");
     reset();
 }
 
 StagefrightRecorder::~StagefrightRecorder() {
-    LOGV("Destructor");
+    ALOGV("Destructor");
     stop();
 }
 
 status_t StagefrightRecorder::init() {
-    LOGV("init");
+    ALOGV("init");
     return OK;
 }
 
@@ -89,15 +89,15 @@
 // and return a interface reference. The client side will use that
 // while encoding GL Frames
 sp<ISurfaceTexture> StagefrightRecorder::querySurfaceMediaSource() const {
-    LOGV("Get SurfaceMediaSource");
+    ALOGV("Get SurfaceMediaSource");
     return mSurfaceMediaSource;
 }
 
 status_t StagefrightRecorder::setAudioSource(audio_source_t as) {
-    LOGV("setAudioSource: %d", as);
+    ALOGV("setAudioSource: %d", as);
     if (as < AUDIO_SOURCE_DEFAULT ||
         as >= AUDIO_SOURCE_CNT) {
-        LOGE("Invalid audio source: %d", as);
+        ALOGE("Invalid audio source: %d", as);
         return BAD_VALUE;
     }
 
@@ -111,10 +111,10 @@
 }
 
 status_t StagefrightRecorder::setVideoSource(video_source vs) {
-    LOGV("setVideoSource: %d", vs);
+    ALOGV("setVideoSource: %d", vs);
     if (vs < VIDEO_SOURCE_DEFAULT ||
         vs >= VIDEO_SOURCE_LIST_END) {
-        LOGE("Invalid video source: %d", vs);
+        ALOGE("Invalid video source: %d", vs);
         return BAD_VALUE;
     }
 
@@ -128,10 +128,10 @@
 }
 
 status_t StagefrightRecorder::setOutputFormat(output_format of) {
-    LOGV("setOutputFormat: %d", of);
+    ALOGV("setOutputFormat: %d", of);
     if (of < OUTPUT_FORMAT_DEFAULT ||
         of >= OUTPUT_FORMAT_LIST_END) {
-        LOGE("Invalid output format: %d", of);
+        ALOGE("Invalid output format: %d", of);
         return BAD_VALUE;
     }
 
@@ -145,10 +145,10 @@
 }
 
 status_t StagefrightRecorder::setAudioEncoder(audio_encoder ae) {
-    LOGV("setAudioEncoder: %d", ae);
+    ALOGV("setAudioEncoder: %d", ae);
     if (ae < AUDIO_ENCODER_DEFAULT ||
         ae >= AUDIO_ENCODER_LIST_END) {
-        LOGE("Invalid audio encoder: %d", ae);
+        ALOGE("Invalid audio encoder: %d", ae);
         return BAD_VALUE;
     }
 
@@ -162,10 +162,10 @@
 }
 
 status_t StagefrightRecorder::setVideoEncoder(video_encoder ve) {
-    LOGV("setVideoEncoder: %d", ve);
+    ALOGV("setVideoEncoder: %d", ve);
     if (ve < VIDEO_ENCODER_DEFAULT ||
         ve >= VIDEO_ENCODER_LIST_END) {
-        LOGE("Invalid video encoder: %d", ve);
+        ALOGE("Invalid video encoder: %d", ve);
         return BAD_VALUE;
     }
 
@@ -179,9 +179,9 @@
 }
 
 status_t StagefrightRecorder::setVideoSize(int width, int height) {
-    LOGV("setVideoSize: %dx%d", width, height);
+    ALOGV("setVideoSize: %dx%d", width, height);
     if (width <= 0 || height <= 0) {
-        LOGE("Invalid video size: %dx%d", width, height);
+        ALOGE("Invalid video size: %dx%d", width, height);
         return BAD_VALUE;
     }
 
@@ -193,10 +193,10 @@
 }
 
 status_t StagefrightRecorder::setVideoFrameRate(int frames_per_second) {
-    LOGV("setVideoFrameRate: %d", frames_per_second);
+    ALOGV("setVideoFrameRate: %d", frames_per_second);
     if ((frames_per_second <= 0 && frames_per_second != -1) ||
         frames_per_second > 120) {
-        LOGE("Invalid video frame rate: %d", frames_per_second);
+        ALOGE("Invalid video frame rate: %d", frames_per_second);
         return BAD_VALUE;
     }
 
@@ -208,13 +208,13 @@
 
 status_t StagefrightRecorder::setCamera(const sp<ICamera> &camera,
                                         const sp<ICameraRecordingProxy> &proxy) {
-    LOGV("setCamera");
+    ALOGV("setCamera");
     if (camera == 0) {
-        LOGE("camera is NULL");
+        ALOGE("camera is NULL");
         return BAD_VALUE;
     }
     if (proxy == 0) {
-        LOGE("camera proxy is NULL");
+        ALOGE("camera proxy is NULL");
         return BAD_VALUE;
     }
 
@@ -224,14 +224,14 @@
 }
 
 status_t StagefrightRecorder::setPreviewSurface(const sp<Surface> &surface) {
-    LOGV("setPreviewSurface: %p", surface.get());
+    ALOGV("setPreviewSurface: %p", surface.get());
     mPreviewSurface = surface;
 
     return OK;
 }
 
 status_t StagefrightRecorder::setOutputFile(const char *path) {
-    LOGE("setOutputFile(const char*) must not be called");
+    ALOGE("setOutputFile(const char*) must not be called");
     // We don't actually support this at all, as the media_server process
     // no longer has permissions to create files.
 
@@ -239,13 +239,13 @@
 }
 
 status_t StagefrightRecorder::setOutputFile(int fd, int64_t offset, int64_t length) {
-    LOGV("setOutputFile: %d, %lld, %lld", fd, offset, length);
+    ALOGV("setOutputFile: %d, %lld, %lld", fd, offset, length);
     // These don't make any sense, do they?
     CHECK_EQ(offset, 0);
     CHECK_EQ(length, 0);
 
     if (fd < 0) {
-        LOGE("Invalid file descriptor: %d", fd);
+        ALOGE("Invalid file descriptor: %d", fd);
         return -EBADF;
     }
 
@@ -313,9 +313,9 @@
 }
 
 status_t StagefrightRecorder::setParamAudioSamplingRate(int32_t sampleRate) {
-    LOGV("setParamAudioSamplingRate: %d", sampleRate);
+    ALOGV("setParamAudioSamplingRate: %d", sampleRate);
     if (sampleRate <= 0) {
-        LOGE("Invalid audio sampling rate: %d", sampleRate);
+        ALOGE("Invalid audio sampling rate: %d", sampleRate);
         return BAD_VALUE;
     }
 
@@ -325,9 +325,9 @@
 }
 
 status_t StagefrightRecorder::setParamAudioNumberOfChannels(int32_t channels) {
-    LOGV("setParamAudioNumberOfChannels: %d", channels);
+    ALOGV("setParamAudioNumberOfChannels: %d", channels);
     if (channels <= 0 || channels >= 3) {
-        LOGE("Invalid number of audio channels: %d", channels);
+        ALOGE("Invalid number of audio channels: %d", channels);
         return BAD_VALUE;
     }
 
@@ -337,9 +337,9 @@
 }
 
 status_t StagefrightRecorder::setParamAudioEncodingBitRate(int32_t bitRate) {
-    LOGV("setParamAudioEncodingBitRate: %d", bitRate);
+    ALOGV("setParamAudioEncodingBitRate: %d", bitRate);
     if (bitRate <= 0) {
-        LOGE("Invalid audio encoding bit rate: %d", bitRate);
+        ALOGE("Invalid audio encoding bit rate: %d", bitRate);
         return BAD_VALUE;
     }
 
@@ -352,9 +352,9 @@
 }
 
 status_t StagefrightRecorder::setParamVideoEncodingBitRate(int32_t bitRate) {
-    LOGV("setParamVideoEncodingBitRate: %d", bitRate);
+    ALOGV("setParamVideoEncodingBitRate: %d", bitRate);
     if (bitRate <= 0) {
-        LOGE("Invalid video encoding bit rate: %d", bitRate);
+        ALOGE("Invalid video encoding bit rate: %d", bitRate);
         return BAD_VALUE;
     }
 
@@ -368,9 +368,9 @@
 
 // Always rotate clockwise, and only support 0, 90, 180 and 270 for now.
 status_t StagefrightRecorder::setParamVideoRotation(int32_t degrees) {
-    LOGV("setParamVideoRotation: %d", degrees);
+    ALOGV("setParamVideoRotation: %d", degrees);
     if (degrees < 0 || degrees % 90 != 0) {
-        LOGE("Unsupported video rotation angle: %d", degrees);
+        ALOGE("Unsupported video rotation angle: %d", degrees);
         return BAD_VALUE;
     }
     mRotationDegrees = degrees % 360;
@@ -378,39 +378,39 @@
 }
 
 status_t StagefrightRecorder::setParamMaxFileDurationUs(int64_t timeUs) {
-    LOGV("setParamMaxFileDurationUs: %lld us", timeUs);
+    ALOGV("setParamMaxFileDurationUs: %lld us", timeUs);
 
     // This is meant for backward compatibility for MediaRecorder.java
     if (timeUs <= 0) {
-        LOGW("Max file duration is not positive: %lld us. Disabling duration limit.", timeUs);
+        ALOGW("Max file duration is not positive: %lld us. Disabling duration limit.", timeUs);
         timeUs = 0; // Disable the duration limit for zero or negative values.
     } else if (timeUs <= 100000LL) {  // XXX: 100 milli-seconds
-        LOGE("Max file duration is too short: %lld us", timeUs);
+        ALOGE("Max file duration is too short: %lld us", timeUs);
         return BAD_VALUE;
     }
 
     if (timeUs <= 15 * 1000000LL) {
-        LOGW("Target duration (%lld us) too short to be respected", timeUs);
+        ALOGW("Target duration (%lld us) too short to be respected", timeUs);
     }
     mMaxFileDurationUs = timeUs;
     return OK;
 }
 
 status_t StagefrightRecorder::setParamMaxFileSizeBytes(int64_t bytes) {
-    LOGV("setParamMaxFileSizeBytes: %lld bytes", bytes);
+    ALOGV("setParamMaxFileSizeBytes: %lld bytes", bytes);
 
     // This is meant for backward compatibility for MediaRecorder.java
     if (bytes <= 0) {
-        LOGW("Max file size is not positive: %lld bytes. "
+        ALOGW("Max file size is not positive: %lld bytes. "
              "Disabling file size limit.", bytes);
         bytes = 0; // Disable the file size limit for zero or negative values.
     } else if (bytes <= 1024) {  // XXX: 1 kB
-        LOGE("Max file size is too small: %lld bytes", bytes);
+        ALOGE("Max file size is too small: %lld bytes", bytes);
         return BAD_VALUE;
     }
 
     if (bytes <= 100 * 1024) {
-        LOGW("Target file size (%lld bytes) is too small to be respected", bytes);
+        ALOGW("Target file size (%lld bytes) is too small to be respected", bytes);
     }
 
     mMaxFileSizeBytes = bytes;
@@ -418,18 +418,18 @@
 }
 
 status_t StagefrightRecorder::setParamInterleaveDuration(int32_t durationUs) {
-    LOGV("setParamInterleaveDuration: %d", durationUs);
+    ALOGV("setParamInterleaveDuration: %d", durationUs);
     if (durationUs <= 500000) {           //  500 ms
         // If interleave duration is too small, it is very inefficient to do
         // interleaving since the metadata overhead will count for a significant
         // portion of the saved contents
-        LOGE("Audio/video interleave duration is too small: %d us", durationUs);
+        ALOGE("Audio/video interleave duration is too small: %d us", durationUs);
         return BAD_VALUE;
     } else if (durationUs >= 10000000) {  // 10 seconds
         // If interleaving duration is too large, it can cause the recording
         // session to use too much memory since we have to save the output
         // data before we write them out
-        LOGE("Audio/video interleave duration is too large: %d us", durationUs);
+        ALOGE("Audio/video interleave duration is too large: %d us", durationUs);
         return BAD_VALUE;
     }
     mInterleaveDurationUs = durationUs;
@@ -440,20 +440,20 @@
 // If seconds == 0, all frames are encoded as I frames. No P frames
 // If seconds >  0, it is the time spacing (seconds) between 2 neighboring I frames
 status_t StagefrightRecorder::setParamVideoIFramesInterval(int32_t seconds) {
-    LOGV("setParamVideoIFramesInterval: %d seconds", seconds);
+    ALOGV("setParamVideoIFramesInterval: %d seconds", seconds);
     mIFramesIntervalSec = seconds;
     return OK;
 }
 
 status_t StagefrightRecorder::setParam64BitFileOffset(bool use64Bit) {
-    LOGV("setParam64BitFileOffset: %s",
+    ALOGV("setParam64BitFileOffset: %s",
         use64Bit? "use 64 bit file offset": "use 32 bit file offset");
     mUse64BitFileOffset = use64Bit;
     return OK;
 }
 
 status_t StagefrightRecorder::setParamVideoCameraId(int32_t cameraId) {
-    LOGV("setParamVideoCameraId: %d", cameraId);
+    ALOGV("setParamVideoCameraId: %d", cameraId);
     if (cameraId < 0) {
         return BAD_VALUE;
     }
@@ -462,9 +462,9 @@
 }
 
 status_t StagefrightRecorder::setParamTrackTimeStatus(int64_t timeDurationUs) {
-    LOGV("setParamTrackTimeStatus: %lld", timeDurationUs);
+    ALOGV("setParamTrackTimeStatus: %lld", timeDurationUs);
     if (timeDurationUs < 20000) {  // Infeasible if shorter than 20 ms?
-        LOGE("Tracking time duration too short: %lld us", timeDurationUs);
+        ALOGE("Tracking time duration too short: %lld us", timeDurationUs);
         return BAD_VALUE;
     }
     mTrackEveryTimeDurationUs = timeDurationUs;
@@ -472,7 +472,7 @@
 }
 
 status_t StagefrightRecorder::setParamVideoEncoderProfile(int32_t profile) {
-    LOGV("setParamVideoEncoderProfile: %d", profile);
+    ALOGV("setParamVideoEncoderProfile: %d", profile);
 
     // Additional check will be done later when we load the encoder.
     // For now, we are accepting values defined in OpenMAX IL.
@@ -481,7 +481,7 @@
 }
 
 status_t StagefrightRecorder::setParamVideoEncoderLevel(int32_t level) {
-    LOGV("setParamVideoEncoderLevel: %d", level);
+    ALOGV("setParamVideoEncoderLevel: %d", level);
 
     // Additional check will be done later when we load the encoder.
     // For now, we are accepting values defined in OpenMAX IL.
@@ -490,12 +490,12 @@
 }
 
 status_t StagefrightRecorder::setParamMovieTimeScale(int32_t timeScale) {
-    LOGV("setParamMovieTimeScale: %d", timeScale);
+    ALOGV("setParamMovieTimeScale: %d", timeScale);
 
     // The range is set to be the same as the audio's time scale range
     // since audio's time scale has a wider range.
     if (timeScale < 600 || timeScale > 96000) {
-        LOGE("Time scale (%d) for movie is out of range [600, 96000]", timeScale);
+        ALOGE("Time scale (%d) for movie is out of range [600, 96000]", timeScale);
         return BAD_VALUE;
     }
     mMovieTimeScale = timeScale;
@@ -503,12 +503,12 @@
 }
 
 status_t StagefrightRecorder::setParamVideoTimeScale(int32_t timeScale) {
-    LOGV("setParamVideoTimeScale: %d", timeScale);
+    ALOGV("setParamVideoTimeScale: %d", timeScale);
 
     // 60000 is chosen to make sure that each video frame from a 60-fps
     // video has 1000 ticks.
     if (timeScale < 600 || timeScale > 60000) {
-        LOGE("Time scale (%d) for video is out of range [600, 60000]", timeScale);
+        ALOGE("Time scale (%d) for video is out of range [600, 60000]", timeScale);
         return BAD_VALUE;
     }
     mVideoTimeScale = timeScale;
@@ -516,11 +516,11 @@
 }
 
 status_t StagefrightRecorder::setParamAudioTimeScale(int32_t timeScale) {
-    LOGV("setParamAudioTimeScale: %d", timeScale);
+    ALOGV("setParamAudioTimeScale: %d", timeScale);
 
     // 96000 Hz is the highest sampling rate support in AAC.
     if (timeScale < 600 || timeScale > 96000) {
-        LOGE("Time scale (%d) for audio is out of range [600, 96000]", timeScale);
+        ALOGE("Time scale (%d) for audio is out of range [600, 96000]", timeScale);
         return BAD_VALUE;
     }
     mAudioTimeScale = timeScale;
@@ -528,7 +528,7 @@
 }
 
 status_t StagefrightRecorder::setParamTimeLapseEnable(int32_t timeLapseEnable) {
-    LOGV("setParamTimeLapseEnable: %d", timeLapseEnable);
+    ALOGV("setParamTimeLapseEnable: %d", timeLapseEnable);
 
     if(timeLapseEnable == 0) {
         mCaptureTimeLapse = false;
@@ -541,11 +541,11 @@
 }
 
 status_t StagefrightRecorder::setParamTimeBetweenTimeLapseFrameCapture(int64_t timeUs) {
-    LOGV("setParamTimeBetweenTimeLapseFrameCapture: %lld us", timeUs);
+    ALOGV("setParamTimeBetweenTimeLapseFrameCapture: %lld us", timeUs);
 
     // Not allowing time more than a day
     if (timeUs <= 0 || timeUs > 86400*1E6) {
-        LOGE("Time between time lapse frame capture (%lld) is out of range [0, 1 Day]", timeUs);
+        ALOGE("Time between time lapse frame capture (%lld) is out of range [0, 1 Day]", timeUs);
         return BAD_VALUE;
     }
 
@@ -575,7 +575,7 @@
 
 status_t StagefrightRecorder::setParameter(
         const String8 &key, const String8 &value) {
-    LOGV("setParameter: key (%s) => value (%s)", key.string(), value.string());
+    ALOGV("setParameter: key (%s) => value (%s)", key.string(), value.string());
     if (key == "max-duration") {
         int64_t max_duration_ms;
         if (safe_strtoi64(value.string(), &max_duration_ms)) {
@@ -683,25 +683,25 @@
                     1000LL * timeBetweenTimeLapseFrameCaptureMs);
         }
     } else {
-        LOGE("setParameter: failed to find key %s", key.string());
+        ALOGE("setParameter: failed to find key %s", key.string());
     }
     return BAD_VALUE;
 }
 
 status_t StagefrightRecorder::setParameters(const String8 &params) {
-    LOGV("setParameters: %s", params.string());
+    ALOGV("setParameters: %s", params.string());
     const char *cparams = params.string();
     const char *key_start = cparams;
     for (;;) {
         const char *equal_pos = strchr(key_start, '=');
         if (equal_pos == NULL) {
-            LOGE("Parameters %s miss a value", cparams);
+            ALOGE("Parameters %s miss a value", cparams);
             return BAD_VALUE;
         }
         String8 key(key_start, equal_pos - key_start);
         TrimString(&key);
         if (key.length() == 0) {
-            LOGE("Parameters %s contains an empty key", cparams);
+            ALOGE("Parameters %s contains an empty key", cparams);
             return BAD_VALUE;
         }
         const char *value_start = equal_pos + 1;
@@ -737,7 +737,7 @@
     CHECK(mOutputFd >= 0);
 
     if (mWriter != NULL) {
-        LOGE("File writer is not avaialble");
+        ALOGE("File writer is not avaialble");
         return UNKNOWN_ERROR;
     }
 
@@ -769,7 +769,7 @@
             break;
 
         default:
-            LOGE("Unsupported output file format: %d", mOutputFormat);
+            ALOGE("Unsupported output file format: %d", mOutputFormat);
             status = UNKNOWN_ERROR;
             break;
     }
@@ -801,7 +801,7 @@
     status_t err = audioSource->initCheck();
 
     if (err != OK) {
-        LOGE("audio source is not initialized");
+        ALOGE("audio source is not initialized");
         return NULL;
     }
 
@@ -819,7 +819,7 @@
             mime = MEDIA_MIMETYPE_AUDIO_AAC;
             break;
         default:
-            LOGE("Unknown audio encoder: %d", mAudioEncoder);
+            ALOGE("Unknown audio encoder: %d", mAudioEncoder);
             return NULL;
     }
     encMeta->setCString(kKeyMIMEType, mime);
@@ -872,13 +872,13 @@
     if (mOutputFormat == OUTPUT_FORMAT_AMR_NB) {
         if (mAudioEncoder != AUDIO_ENCODER_DEFAULT &&
             mAudioEncoder != AUDIO_ENCODER_AMR_NB) {
-            LOGE("Invalid encoder %d used for AMRNB recording",
+            ALOGE("Invalid encoder %d used for AMRNB recording",
                     mAudioEncoder);
             return BAD_VALUE;
         }
     } else {  // mOutputFormat must be OUTPUT_FORMAT_AMR_WB
         if (mAudioEncoder != AUDIO_ENCODER_AMR_WB) {
-            LOGE("Invlaid encoder %d used for AMRWB recording",
+            ALOGE("Invlaid encoder %d used for AMRWB recording",
                     mAudioEncoder);
             return BAD_VALUE;
         }
@@ -895,7 +895,7 @@
 
 status_t StagefrightRecorder::startRawAudioRecording() {
     if (mAudioSource >= AUDIO_SOURCE_CNT) {
-        LOGE("Invalid audio source: %d", mAudioSource);
+        ALOGE("Invalid audio source: %d", mAudioSource);
         return BAD_VALUE;
     }
 
@@ -1016,51 +1016,51 @@
 }
 
 void StagefrightRecorder::clipVideoFrameRate() {
-    LOGV("clipVideoFrameRate: encoder %d", mVideoEncoder);
+    ALOGV("clipVideoFrameRate: encoder %d", mVideoEncoder);
     int minFrameRate = mEncoderProfiles->getVideoEncoderParamByName(
                         "enc.vid.fps.min", mVideoEncoder);
     int maxFrameRate = mEncoderProfiles->getVideoEncoderParamByName(
                         "enc.vid.fps.max", mVideoEncoder);
     if (mFrameRate < minFrameRate && mFrameRate != -1) {
-        LOGW("Intended video encoding frame rate (%d fps) is too small"
+        ALOGW("Intended video encoding frame rate (%d fps) is too small"
              " and will be set to (%d fps)", mFrameRate, minFrameRate);
         mFrameRate = minFrameRate;
     } else if (mFrameRate > maxFrameRate) {
-        LOGW("Intended video encoding frame rate (%d fps) is too large"
+        ALOGW("Intended video encoding frame rate (%d fps) is too large"
              " and will be set to (%d fps)", mFrameRate, maxFrameRate);
         mFrameRate = maxFrameRate;
     }
 }
 
 void StagefrightRecorder::clipVideoBitRate() {
-    LOGV("clipVideoBitRate: encoder %d", mVideoEncoder);
+    ALOGV("clipVideoBitRate: encoder %d", mVideoEncoder);
     int minBitRate = mEncoderProfiles->getVideoEncoderParamByName(
                         "enc.vid.bps.min", mVideoEncoder);
     int maxBitRate = mEncoderProfiles->getVideoEncoderParamByName(
                         "enc.vid.bps.max", mVideoEncoder);
     if (mVideoBitRate < minBitRate) {
-        LOGW("Intended video encoding bit rate (%d bps) is too small"
+        ALOGW("Intended video encoding bit rate (%d bps) is too small"
              " and will be set to (%d bps)", mVideoBitRate, minBitRate);
         mVideoBitRate = minBitRate;
     } else if (mVideoBitRate > maxBitRate) {
-        LOGW("Intended video encoding bit rate (%d bps) is too large"
+        ALOGW("Intended video encoding bit rate (%d bps) is too large"
              " and will be set to (%d bps)", mVideoBitRate, maxBitRate);
         mVideoBitRate = maxBitRate;
     }
 }
 
 void StagefrightRecorder::clipVideoFrameWidth() {
-    LOGV("clipVideoFrameWidth: encoder %d", mVideoEncoder);
+    ALOGV("clipVideoFrameWidth: encoder %d", mVideoEncoder);
     int minFrameWidth = mEncoderProfiles->getVideoEncoderParamByName(
                         "enc.vid.width.min", mVideoEncoder);
     int maxFrameWidth = mEncoderProfiles->getVideoEncoderParamByName(
                         "enc.vid.width.max", mVideoEncoder);
     if (mVideoWidth < minFrameWidth) {
-        LOGW("Intended video encoding frame width (%d) is too small"
+        ALOGW("Intended video encoding frame width (%d) is too small"
              " and will be set to (%d)", mVideoWidth, minFrameWidth);
         mVideoWidth = minFrameWidth;
     } else if (mVideoWidth > maxFrameWidth) {
-        LOGW("Intended video encoding frame width (%d) is too large"
+        ALOGW("Intended video encoding frame width (%d) is too large"
              " and will be set to (%d)", mVideoWidth, maxFrameWidth);
         mVideoWidth = maxFrameWidth;
     }
@@ -1082,7 +1082,7 @@
 // Set to use AVC baseline profile if the encoding parameters matches
 // CAMCORDER_QUALITY_LOW profile; this is for the sake of MMS service.
 void StagefrightRecorder::setDefaultProfileIfNecessary() {
-    LOGV("setDefaultProfileIfNecessary");
+    ALOGV("setDefaultProfileIfNecessary");
 
     camcorder_quality quality = CAMCORDER_QUALITY_LOW;
 
@@ -1131,7 +1131,7 @@
         audioSampleRate == mSampleRate &&
         audioChannels == mAudioChannels) {
         if (videoCodec == VIDEO_ENCODER_H264) {
-            LOGI("Force to use AVC baseline profile");
+            ALOGI("Force to use AVC baseline profile");
             setParamVideoEncoderProfile(OMX_VIDEO_AVCProfileBaseline);
         }
     }
@@ -1145,13 +1145,13 @@
 }
 
 void StagefrightRecorder::clipAudioBitRate() {
-    LOGV("clipAudioBitRate: encoder %d", mAudioEncoder);
+    ALOGV("clipAudioBitRate: encoder %d", mAudioEncoder);
 
     int minAudioBitRate =
             mEncoderProfiles->getAudioEncoderParamByName(
                 "enc.aud.bps.min", mAudioEncoder);
     if (mAudioBitRate < minAudioBitRate) {
-        LOGW("Intended audio encoding bit rate (%d) is too small"
+        ALOGW("Intended audio encoding bit rate (%d) is too small"
             " and will be set to (%d)", mAudioBitRate, minAudioBitRate);
         mAudioBitRate = minAudioBitRate;
     }
@@ -1160,20 +1160,20 @@
             mEncoderProfiles->getAudioEncoderParamByName(
                 "enc.aud.bps.max", mAudioEncoder);
     if (mAudioBitRate > maxAudioBitRate) {
-        LOGW("Intended audio encoding bit rate (%d) is too large"
+        ALOGW("Intended audio encoding bit rate (%d) is too large"
             " and will be set to (%d)", mAudioBitRate, maxAudioBitRate);
         mAudioBitRate = maxAudioBitRate;
     }
 }
 
 void StagefrightRecorder::clipAudioSampleRate() {
-    LOGV("clipAudioSampleRate: encoder %d", mAudioEncoder);
+    ALOGV("clipAudioSampleRate: encoder %d", mAudioEncoder);
 
     int minSampleRate =
             mEncoderProfiles->getAudioEncoderParamByName(
                 "enc.aud.hz.min", mAudioEncoder);
     if (mSampleRate < minSampleRate) {
-        LOGW("Intended audio sample rate (%d) is too small"
+        ALOGW("Intended audio sample rate (%d) is too small"
             " and will be set to (%d)", mSampleRate, minSampleRate);
         mSampleRate = minSampleRate;
     }
@@ -1182,20 +1182,20 @@
             mEncoderProfiles->getAudioEncoderParamByName(
                 "enc.aud.hz.max", mAudioEncoder);
     if (mSampleRate > maxSampleRate) {
-        LOGW("Intended audio sample rate (%d) is too large"
+        ALOGW("Intended audio sample rate (%d) is too large"
             " and will be set to (%d)", mSampleRate, maxSampleRate);
         mSampleRate = maxSampleRate;
     }
 }
 
 void StagefrightRecorder::clipNumberOfAudioChannels() {
-    LOGV("clipNumberOfAudioChannels: encoder %d", mAudioEncoder);
+    ALOGV("clipNumberOfAudioChannels: encoder %d", mAudioEncoder);
 
     int minChannels =
             mEncoderProfiles->getAudioEncoderParamByName(
                 "enc.aud.ch.min", mAudioEncoder);
     if (mAudioChannels < minChannels) {
-        LOGW("Intended number of audio channels (%d) is too small"
+        ALOGW("Intended number of audio channels (%d) is too small"
             " and will be set to (%d)", mAudioChannels, minChannels);
         mAudioChannels = minChannels;
     }
@@ -1204,24 +1204,24 @@
             mEncoderProfiles->getAudioEncoderParamByName(
                 "enc.aud.ch.max", mAudioEncoder);
     if (mAudioChannels > maxChannels) {
-        LOGW("Intended number of audio channels (%d) is too large"
+        ALOGW("Intended number of audio channels (%d) is too large"
             " and will be set to (%d)", mAudioChannels, maxChannels);
         mAudioChannels = maxChannels;
     }
 }
 
 void StagefrightRecorder::clipVideoFrameHeight() {
-    LOGV("clipVideoFrameHeight: encoder %d", mVideoEncoder);
+    ALOGV("clipVideoFrameHeight: encoder %d", mVideoEncoder);
     int minFrameHeight = mEncoderProfiles->getVideoEncoderParamByName(
                         "enc.vid.height.min", mVideoEncoder);
     int maxFrameHeight = mEncoderProfiles->getVideoEncoderParamByName(
                         "enc.vid.height.max", mVideoEncoder);
     if (mVideoHeight < minFrameHeight) {
-        LOGW("Intended video encoding frame height (%d) is too small"
+        ALOGW("Intended video encoding frame height (%d) is too small"
              " and will be set to (%d)", mVideoHeight, minFrameHeight);
         mVideoHeight = minFrameHeight;
     } else if (mVideoHeight > maxFrameHeight) {
-        LOGW("Intended video encoding frame height (%d) is too large"
+        ALOGW("Intended video encoding frame height (%d) is too large"
              " and will be set to (%d)", mVideoHeight, maxFrameHeight);
         mVideoHeight = maxFrameHeight;
     }
@@ -1268,7 +1268,7 @@
         int32_t frameRate = 0;
         CHECK (mSurfaceMediaSource->getFormat()->findInt32(
                                         kKeyFrameRate, &frameRate));
-        LOGI("Frame rate is not explicitly set. Use the current frame "
+        ALOGI("Frame rate is not explicitly set. Use the current frame "
              "rate (%d fps)", frameRate);
         mFrameRate = frameRate;
     } else {
@@ -1319,7 +1319,7 @@
         int32_t frameRate = 0;
         CHECK ((*cameraSource)->getFormat()->findInt32(
                     kKeyFrameRate, &frameRate));
-        LOGI("Frame rate is not explicitly set. Use the current frame "
+        ALOGI("Frame rate is not explicitly set. Use the current frame "
              "rate (%d fps)", frameRate);
         mFrameRate = frameRate;
     }
@@ -1406,7 +1406,7 @@
             true /* createEncoder */, cameraSource,
             NULL, encoder_flags);
     if (encoder == NULL) {
-        LOGW("Failed to create the encoder");
+        ALOGW("Failed to create the encoder");
         // When the encoder fails to be created, we need
         // release the camera source due to the camera's lock
         // and unlock mechanism.
@@ -1432,7 +1432,7 @@
             break;
 
         default:
-            LOGE("Unsupported audio encoder: %d", mAudioEncoder);
+            ALOGE("Unsupported audio encoder: %d", mAudioEncoder);
             return UNKNOWN_ERROR;
     }
 
@@ -1548,7 +1548,7 @@
 }
 
 status_t StagefrightRecorder::pause() {
-    LOGV("pause");
+    ALOGV("pause");
     if (mWriter == NULL) {
         return UNKNOWN_ERROR;
     }
@@ -1573,7 +1573,7 @@
 }
 
 status_t StagefrightRecorder::stop() {
-    LOGV("stop");
+    ALOGV("stop");
     status_t err = OK;
 
     if (mCaptureTimeLapse && mCameraSourceTimeLapse != NULL) {
@@ -1610,14 +1610,14 @@
 }
 
 status_t StagefrightRecorder::close() {
-    LOGV("close");
+    ALOGV("close");
     stop();
 
     return OK;
 }
 
 status_t StagefrightRecorder::reset() {
-    LOGV("reset");
+    ALOGV("reset");
     stop();
 
     // No audio or video source by default
@@ -1664,10 +1664,10 @@
 }
 
 status_t StagefrightRecorder::getMaxAmplitude(int *max) {
-    LOGV("getMaxAmplitude");
+    ALOGV("getMaxAmplitude");
 
     if (max == NULL) {
-        LOGE("Null pointer argument");
+        ALOGE("Null pointer argument");
         return BAD_VALUE;
     }
 
@@ -1682,7 +1682,7 @@
 
 status_t StagefrightRecorder::dump(
         int fd, const Vector<String16>& args) const {
-    LOGV("dump");
+    ALOGV("dump");
     const size_t SIZE = 256;
     char buffer[SIZE];
     String8 result;
diff --git a/media/libmediaplayerservice/TestPlayerStub.cpp b/media/libmediaplayerservice/TestPlayerStub.cpp
index 169e49a..5d9728a 100644
--- a/media/libmediaplayerservice/TestPlayerStub.cpp
+++ b/media/libmediaplayerservice/TestPlayerStub.cpp
@@ -134,7 +134,7 @@
     // None of the entry points should be NULL.
     mHandle = ::dlopen(mFilename, RTLD_NOW | RTLD_GLOBAL);
     if (!mHandle) {
-        LOGE("dlopen failed: %s", ::dlerror());
+        ALOGE("dlopen failed: %s", ::dlerror());
         resetInternal();
         return UNKNOWN_ERROR;
     }
@@ -147,7 +147,7 @@
     if (err || mNewPlayer == NULL) {
         // if err is NULL the string <null> is inserted in the logs =>
         // mNewPlayer was NULL.
-        LOGE("dlsym for newPlayer failed %s", err);
+        ALOGE("dlsym for newPlayer failed %s", err);
         resetInternal();
         return UNKNOWN_ERROR;
     }
@@ -156,7 +156,7 @@
                                                           "deletePlayer"));
     err = ::dlerror();
     if (err || mDeletePlayer == NULL) {
-        LOGE("dlsym for deletePlayer failed %s", err);
+        ALOGE("dlsym for deletePlayer failed %s", err);
         resetInternal();
         return UNKNOWN_ERROR;
     }
@@ -176,7 +176,7 @@
     mContentUrl = NULL;
 
     if (mPlayer) {
-        LOG_ASSERT(mDeletePlayer != NULL, "mDeletePlayer is null");
+        ALOG_ASSERT(mDeletePlayer != NULL, "mDeletePlayer is null");
         (*mDeletePlayer)(mPlayer);
         mPlayer = NULL;
     }
diff --git a/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp b/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp
index 079f6fa..22b8847 100644
--- a/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp
@@ -111,9 +111,9 @@
             break;
         } else if (n < 0) {
             if (n != ERROR_END_OF_STREAM) {
-                LOGI("input data EOS reached, error %ld", n);
+                ALOGI("input data EOS reached, error %ld", n);
             } else {
-                LOGI("input data EOS reached.");
+                ALOGI("input data EOS reached.");
             }
             mTSParser->signalEOS(n);
             mFinalResult = n;
@@ -131,7 +131,7 @@
                 status_t err = mTSParser->feedTSPacket(buffer, sizeof(buffer));
 
                 if (err != OK) {
-                    LOGE("TS Parser returned error %d", err);
+                    ALOGE("TS Parser returned error %d", err);
                     mTSParser->signalEOS(err);
                     mFinalResult = err;
                     break;
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 93ab704..a00aaa5 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -160,7 +160,7 @@
     switch (msg->what()) {
         case kWhatSetDataSource:
         {
-            LOGV("kWhatSetDataSource");
+            ALOGV("kWhatSetDataSource");
 
             CHECK(mSource == NULL);
 
@@ -173,7 +173,7 @@
 
         case kWhatSetVideoNativeWindow:
         {
-            LOGV("kWhatSetVideoNativeWindow");
+            ALOGV("kWhatSetVideoNativeWindow");
 
             sp<RefBase> obj;
             CHECK(msg->findObject("native-window", &obj));
@@ -184,7 +184,7 @@
 
         case kWhatSetAudioSink:
         {
-            LOGV("kWhatSetAudioSink");
+            ALOGV("kWhatSetAudioSink");
 
             sp<RefBase> obj;
             CHECK(msg->findObject("sink", &obj));
@@ -195,7 +195,7 @@
 
         case kWhatStart:
         {
-            LOGV("kWhatStart");
+            ALOGV("kWhatStart");
 
             mVideoIsAVC = false;
             mAudioEOS = false;
@@ -229,7 +229,7 @@
 
             mScanSourcesPending = false;
 
-            LOGV("scanning sources haveAudio=%d, haveVideo=%d",
+            ALOGV("scanning sources haveAudio=%d, haveVideo=%d",
                  mAudioDecoder != NULL, mVideoDecoder != NULL);
 
             instantiateDecoder(false, &mVideoDecoder);
@@ -285,9 +285,9 @@
                 CHECK(codecRequest->findInt32("err", &err));
 
                 if (err == ERROR_END_OF_STREAM) {
-                    LOGV("got %s decoder EOS", audio ? "audio" : "video");
+                    ALOGV("got %s decoder EOS", audio ? "audio" : "video");
                 } else {
-                    LOGV("got %s decoder EOS w/ error %d",
+                    ALOGV("got %s decoder EOS w/ error %d",
                          audio ? "audio" : "video",
                          err);
                 }
@@ -306,10 +306,10 @@
                     mVideoLateByUs = 0;
                 }
 
-                LOGV("decoder %s flush completed", audio ? "audio" : "video");
+                ALOGV("decoder %s flush completed", audio ? "audio" : "video");
 
                 if (needShutdown) {
-                    LOGV("initiating %s decoder shutdown",
+                    ALOGV("initiating %s decoder shutdown",
                          audio ? "audio" : "video");
 
                     (audio ? mAudioDecoder : mVideoDecoder)->initiateShutdown();
@@ -330,7 +330,7 @@
                     int32_t sampleRate;
                     CHECK(codecRequest->findInt32("sample-rate", &sampleRate));
 
-                    LOGV("Audio output format changed to %d Hz, %d channels",
+                    ALOGV("Audio output format changed to %d Hz, %d channels",
                          sampleRate, numChannels);
 
                     mAudioSink->close();
@@ -355,7 +355,7 @@
                                 "crop",
                                 &cropLeft, &cropTop, &cropRight, &cropBottom));
 
-                    LOGV("Video output format changed to %d x %d "
+                    ALOGV("Video output format changed to %d x %d "
                          "(crop: %d x %d @ (%d, %d))",
                          width, height,
                          (cropRight - cropLeft + 1),
@@ -368,7 +368,7 @@
                             cropBottom - cropTop + 1);
                 }
             } else if (what == ACodec::kWhatShutdownCompleted) {
-                LOGV("%s shutdown completed", audio ? "audio" : "video");
+                ALOGV("%s shutdown completed", audio ? "audio" : "video");
                 if (audio) {
                     mAudioDecoder.clear();
 
@@ -383,7 +383,7 @@
 
                 finishFlushIfPossible();
             } else if (what == ACodec::kWhatError) {
-                LOGE("Received error from %s decoder, aborting playback.",
+                ALOGE("Received error from %s decoder, aborting playback.",
                      audio ? "audio" : "video");
 
                 mRenderer->queueEOS(audio, UNKNOWN_ERROR);
@@ -415,9 +415,9 @@
                 }
 
                 if (finalResult == ERROR_END_OF_STREAM) {
-                    LOGV("reached %s EOS", audio ? "audio" : "video");
+                    ALOGV("reached %s EOS", audio ? "audio" : "video");
                 } else {
-                    LOGE("%s track encountered an error (%d)",
+                    ALOGE("%s track encountered an error (%d)",
                          audio ? "audio" : "video", finalResult);
 
                     notifyListener(
@@ -449,7 +449,7 @@
                 int32_t audio;
                 CHECK(msg->findInt32("audio", &audio));
 
-                LOGV("renderer %s flush completed.", audio ? "audio" : "video");
+                ALOGV("renderer %s flush completed.", audio ? "audio" : "video");
             }
             break;
         }
@@ -461,7 +461,7 @@
 
         case kWhatReset:
         {
-            LOGV("kWhatReset");
+            ALOGV("kWhatReset");
 
             if (mRenderer != NULL) {
                 // There's an edge case where the renderer owns all output
@@ -479,7 +479,7 @@
                 // We're currently flushing, postpone the reset until that's
                 // completed.
 
-                LOGV("postponing reset mFlushingAudio=%d, mFlushingVideo=%d",
+                ALOGV("postponing reset mFlushingAudio=%d, mFlushingVideo=%d",
                         mFlushingAudio, mFlushingVideo);
 
                 mResetPostponed = true;
@@ -510,7 +510,7 @@
             int64_t seekTimeUs;
             CHECK(msg->findInt64("seekTimeUs", &seekTimeUs));
 
-            LOGV("kWhatSeek seekTimeUs=%lld us (%.2f secs)",
+            ALOGV("kWhatSeek seekTimeUs=%lld us (%.2f secs)",
                  seekTimeUs, seekTimeUs / 1E6);
 
             mSource->seekTo(seekTimeUs);
@@ -554,7 +554,7 @@
         return;
     }
 
-    LOGV("both audio and video are flushed now.");
+    ALOGV("both audio and video are flushed now.");
 
     if (mTimeDiscontinuityPending) {
         mRenderer->signalTimeDiscontinuity();
@@ -573,7 +573,7 @@
     mFlushingVideo = NONE;
 
     if (mResetInProgress) {
-        LOGV("reset completed");
+        ALOGV("reset completed");
 
         mResetInProgress = false;
         finishReset();
@@ -689,8 +689,8 @@
 
                 bool timeChange = (type & ATSParser::DISCONTINUITY_TIME) != 0;
 
-                LOGI("%s discontinuity (formatChange=%d, time=%d)",
-                     audio ? "audio" : "video", formatChange, timeChange);
+                ALOGI("%s discontinuity (formatChange=%d, time=%d)",
+                      audio ? "audio" : "video", formatChange, timeChange);
 
                 if (audio) {
                     mSkipRenderingAudioUntilMediaTimeUs = -1;
@@ -705,7 +705,7 @@
                         int64_t resumeAtMediaTimeUs;
                         if (extra->findInt64(
                                     "resume-at-mediatimeUs", &resumeAtMediaTimeUs)) {
-                            LOGI("suppressing rendering of %s until %lld us",
+                            ALOGI("suppressing rendering of %s until %lld us",
                                     audio ? "audio" : "video", resumeAtMediaTimeUs);
 
                             if (audio) {
@@ -758,12 +758,12 @@
         }
     } while (dropAccessUnit);
 
-    // LOGV("returned a valid buffer of %s data", audio ? "audio" : "video");
+    // ALOGV("returned a valid buffer of %s data", audio ? "audio" : "video");
 
 #if 0
     int64_t mediaTimeUs;
     CHECK(accessUnit->meta()->findInt64("timeUs", &mediaTimeUs));
-    LOGV("feeding %s input buffer at media time %.2f secs",
+    ALOGV("feeding %s input buffer at media time %.2f secs",
          audio ? "audio" : "video",
          mediaTimeUs / 1E6);
 #endif
@@ -775,7 +775,7 @@
 }
 
 void NuPlayer::renderBuffer(bool audio, const sp<AMessage> &msg) {
-    // LOGV("renderBuffer %s", audio ? "audio" : "video");
+    // ALOGV("renderBuffer %s", audio ? "audio" : "video");
 
     sp<AMessage> reply;
     CHECK(msg->findMessage("reply", &reply));
@@ -786,7 +786,7 @@
         // so we don't want any output buffers it sent us (from before
         // we initiated the flush) to be stuck in the renderer's queue.
 
-        LOGV("we're still flushing the %s decoder, sending its output buffer"
+        ALOGV("we're still flushing the %s decoder, sending its output buffer"
              " right back.", audio ? "audio" : "video");
 
         reply->post();
@@ -808,7 +808,7 @@
         CHECK(buffer->meta()->findInt64("timeUs", &mediaTimeUs));
 
         if (mediaTimeUs < skipUntilMediaTimeUs) {
-            LOGV("dropping %s buffer at time %lld as requested.",
+            ALOGV("dropping %s buffer at time %lld as requested.",
                  audio ? "audio" : "video",
                  mediaTimeUs);
 
@@ -838,7 +838,7 @@
 
 void NuPlayer::flushDecoder(bool audio, bool needShutdown) {
     if ((audio && mAudioDecoder == NULL) || (!audio && mVideoDecoder == NULL)) {
-        LOGI("flushDecoder %s without decoder present",
+        ALOGI("flushDecoder %s without decoder present",
              audio ? "audio" : "video");
     }
 
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
index 0cb7f45..074cb4f 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
@@ -228,9 +228,9 @@
 
 #if 0
     if (numFramesAvailableToWrite == mAudioSink->frameCount()) {
-        LOGI("audio sink underrun");
+        ALOGI("audio sink underrun");
     } else {
-        LOGV("audio queue has %d frames left to play",
+        ALOGV("audio queue has %d frames left to play",
              mAudioSink->frameCount() - numFramesAvailableToWrite);
     }
 #endif
@@ -255,7 +255,7 @@
             int64_t mediaTimeUs;
             CHECK(entry->mBuffer->meta()->findInt64("timeUs", &mediaTimeUs));
 
-            LOGV("rendering audio at media time %.2f secs", mediaTimeUs / 1E6);
+            ALOGV("rendering audio at media time %.2f secs", mediaTimeUs / 1E6);
 
             mAnchorTimeMediaUs = mediaTimeUs;
 
@@ -270,7 +270,7 @@
                     + numFramesPendingPlayout
                         * mAudioSink->msecsPerFrame()) * 1000ll;
 
-            // LOGI("realTimeOffsetUs = %lld us", realTimeOffsetUs);
+            // ALOGI("realTimeOffsetUs = %lld us", realTimeOffsetUs);
 
             mAnchorTimeRealUs =
                 ALooper::GetNowUs() + realTimeOffsetUs;
@@ -376,9 +376,9 @@
     bool tooLate = (mVideoLateByUs > 40000);
 
     if (tooLate) {
-        LOGV("video late by %lld us (%.2f secs)", lateByUs, lateByUs / 1E6);
+        ALOGV("video late by %lld us (%.2f secs)", lateByUs, lateByUs / 1E6);
     } else {
-        LOGV("rendering video at media time %.2f secs", mediaTimeUs / 1E6);
+        ALOGV("rendering video at media time %.2f secs", mediaTimeUs / 1E6);
     }
 
     entry->mNotifyConsumed->setInt32("render", !tooLate);
@@ -454,7 +454,7 @@
 
     int64_t diff = firstVideoTimeUs - firstAudioTimeUs;
 
-    LOGV("queueDiff = %.2f secs", diff / 1E6);
+    ALOGV("queueDiff = %.2f secs", diff / 1E6);
 
     if (diff > 100000ll) {
         // Audio data starts More than 0.1 secs before video.
@@ -628,7 +628,7 @@
         mAudioSink->pause();
     }
 
-    LOGV("now paused audio queue has %d entries, video has %d entries",
+    ALOGV("now paused audio queue has %d entries, video has %d entries",
          mAudioQueue.size(), mVideoQueue.size());
 
     mPaused = true;
diff --git a/media/libmediaplayerservice/nuplayer/RTSPSource.cpp b/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
index a3f2bf6..6eb0d07 100644
--- a/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
@@ -226,7 +226,7 @@
             int32_t damaged;
             if (accessUnit->meta()->findInt32("damaged", &damaged)
                     && damaged) {
-                LOGI("dropping damaged access unit.");
+                ALOGI("dropping damaged access unit.");
                 break;
             }
 
@@ -242,7 +242,7 @@
                     // playtime mapping. Assume the first packets correspond
                     // to time 0.
 
-                    LOGV("This is a live stream, assuming time = 0");
+                    ALOGV("This is a live stream, assuming time = 0");
 
                     info->mRTPTime = rtpTime;
                     info->mNormalPlaytimeUs = 0ll;
diff --git a/media/libmediaplayerservice/nuplayer/StreamingSource.cpp b/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
index 2e63b3b..7c9bc5e 100644
--- a/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
@@ -58,7 +58,7 @@
         ssize_t n = mStreamListener->read(buffer, sizeof(buffer), &extra);
 
         if (n == 0) {
-            LOGI("input data EOS reached.");
+            ALOGI("input data EOS reached.");
             mTSParser->signalEOS(ERROR_END_OF_STREAM);
             mFinalResult = ERROR_END_OF_STREAM;
             break;
@@ -70,7 +70,7 @@
                     && extra->findInt32(
                         IStreamListener::kKeyDiscontinuityMask, &mask)) {
                 if (mask == 0) {
-                    LOGE("Client specified an illegal discontinuity type.");
+                    ALOGE("Client specified an illegal discontinuity type.");
                     return ERROR_UNSUPPORTED;
                 }
 
@@ -94,7 +94,7 @@
                 status_t err = mTSParser->feedTSPacket(buffer, sizeof(buffer));
 
                 if (err != OK) {
-                    LOGE("TS Parser returned error %d", err);
+                    ALOGE("TS Parser returned error %d", err);
 
                     mTSParser->signalEOS(err);
                     mFinalResult = err;
diff --git a/media/libstagefright/AACWriter.cpp b/media/libstagefright/AACWriter.cpp
index d133e91..1673ccd 100644
--- a/media/libstagefright/AACWriter.cpp
+++ b/media/libstagefright/AACWriter.cpp
@@ -40,7 +40,7 @@
       mChannelCount(-1),
       mSampleRate(-1) {
 
-    LOGV("AACWriter Constructor");
+    ALOGV("AACWriter Constructor");
 
     mFd = open(filename, O_CREAT | O_LARGEFILE | O_TRUNC | O_RDWR);
     if (mFd >= 0) {
@@ -84,7 +84,7 @@
     }
 
     if (mSource != NULL) {
-        LOGE("AAC files only support a single track of audio.");
+        ALOGE("AAC files only support a single track of audio.");
         return UNKNOWN_ERROR;
     }
 
@@ -209,14 +209,14 @@
     *tableIndex = 0;
     for (int index = 0; index < tableSize; ++index) {
         if (sampleRate == kSampleRateTable[index]) {
-            LOGV("Sample rate: %d and index: %d",
+            ALOGV("Sample rate: %d and index: %d",
                 sampleRate, index);
             *tableIndex = index;
             return true;
         }
     }
 
-    LOGE("Sampling rate %d bps is not supported", sampleRate);
+    ALOGE("Sampling rate %d bps is not supported", sampleRate);
     return false;
 }
 
@@ -322,7 +322,7 @@
 
         int32_t isCodecSpecific = 0;
         if (buffer->meta_data()->findInt32(kKeyIsCodecConfig, &isCodecSpecific) && isCodecSpecific) {
-            LOGV("Drop codec specific info buffer");
+            ALOGV("Drop codec specific info buffer");
             buffer->release();
             buffer = NULL;
             continue;
@@ -338,7 +338,7 @@
             mResumed = false;
         }
         timestampUs -= previousPausedDurationUs;
-        LOGV("time stamp: %lld, previous paused duration: %lld",
+        ALOGV("time stamp: %lld, previous paused duration: %lld",
             timestampUs, previousPausedDurationUs);
         if (timestampUs > maxTimestampUs) {
             maxTimestampUs = timestampUs;
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index dbc9b7e..ca44ea3 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -342,7 +342,7 @@
 }
 
 void ACodec::signalFlush() {
-    LOGV("[%s] signalFlush", mComponentName.c_str());
+    ALOGV("[%s] signalFlush", mComponentName.c_str());
     (new AMessage(kWhatFlush, id()))->post();
 }
 
@@ -375,7 +375,7 @@
         return err;
     }
 
-    LOGV("[%s] Allocating %lu buffers of size %lu on %s port",
+    ALOGV("[%s] Allocating %lu buffers of size %lu on %s port",
             mComponentName.c_str(),
             def.nBufferCountActual, def.nBufferSize,
             portIndex == kPortIndexInput ? "input" : "output");
@@ -394,7 +394,7 @@
             if (portIndex == kPortIndexInput && i == 0) {
                 // Only log this warning once per allocation round.
 
-                LOGW("OMX.TI.DUCATI1.VIDEO.DECODER requires the use of "
+                ALOGW("OMX.TI.DUCATI1.VIDEO.DECODER requires the use of "
                      "OMX_AllocateBuffer instead of the preferred "
                      "OMX_UseBuffer. Vendor must fix this.");
             }
@@ -445,7 +445,7 @@
             def.format.video.eColorFormat);
 
     if (err != 0) {
-        LOGE("native_window_set_buffers_geometry failed: %s (%d)",
+        ALOGE("native_window_set_buffers_geometry failed: %s (%d)",
                 strerror(-err), -err);
         return err;
     }
@@ -454,7 +454,7 @@
     OMX_U32 usage = 0;
     err = mOMX->getGraphicBufferUsage(mNode, kPortIndexOutput, &usage);
     if (err != 0) {
-        LOGW("querying usage flags from OMX IL component failed: %d", err);
+        ALOGW("querying usage flags from OMX IL component failed: %d", err);
         // XXX: Currently this error is logged, but not fatal.
         usage = 0;
     }
@@ -464,7 +464,7 @@
             usage | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP);
 
     if (err != 0) {
-        LOGE("native_window_set_usage failed: %s (%d)", strerror(-err), -err);
+        ALOGE("native_window_set_usage failed: %s (%d)", strerror(-err), -err);
         return err;
     }
 
@@ -474,7 +474,7 @@
             &minUndequeuedBufs);
 
     if (err != 0) {
-        LOGE("NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS query failed: %s (%d)",
+        ALOGE("NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS query failed: %s (%d)",
                 strerror(-err), -err);
         return err;
     }
@@ -489,7 +489,7 @@
                 mNode, OMX_IndexParamPortDefinition, &def, sizeof(def));
 
         if (err != OK) {
-            LOGE("[%s] setting nBufferCountActual to %lu failed: %d",
+            ALOGE("[%s] setting nBufferCountActual to %lu failed: %d",
                     mComponentName.c_str(), newBufferCount, err);
             return err;
         }
@@ -499,12 +499,12 @@
             mNativeWindow.get(), def.nBufferCountActual);
 
     if (err != 0) {
-        LOGE("native_window_set_buffer_count failed: %s (%d)", strerror(-err),
+        ALOGE("native_window_set_buffer_count failed: %s (%d)", strerror(-err),
                 -err);
         return err;
     }
 
-    LOGV("[%s] Allocating %lu buffers from a native window of size %lu on "
+    ALOGV("[%s] Allocating %lu buffers from a native window of size %lu on "
          "output port",
          mComponentName.c_str(), def.nBufferCountActual, def.nBufferSize);
 
@@ -513,7 +513,7 @@
         ANativeWindowBuffer *buf;
         err = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buf);
         if (err != 0) {
-            LOGE("dequeueBuffer failed: %s (%d)", strerror(-err), -err);
+            ALOGE("dequeueBuffer failed: %s (%d)", strerror(-err), -err);
             break;
         }
 
@@ -528,14 +528,14 @@
         err = mOMX->useGraphicBuffer(mNode, kPortIndexOutput, graphicBuffer,
                 &bufferId);
         if (err != 0) {
-            LOGE("registering GraphicBuffer %lu with OMX IL component failed: "
+            ALOGE("registering GraphicBuffer %lu with OMX IL component failed: "
                  "%d", i, err);
             break;
         }
 
         mBuffers[kPortIndexOutput].editItemAt(i).mBufferID = bufferId;
 
-        LOGV("[%s] Registered graphic buffer with ID %p (pointer = %p)",
+        ALOGV("[%s] Registered graphic buffer with ID %p (pointer = %p)",
              mComponentName.c_str(),
              bufferId, graphicBuffer.get());
     }
@@ -565,7 +565,7 @@
 status_t ACodec::cancelBufferToNativeWindow(BufferInfo *info) {
     CHECK_EQ((int)info->mStatus, (int)BufferInfo::OWNED_BY_US);
 
-    LOGV("[%s] Calling cancelBuffer on buffer %p",
+    ALOGV("[%s] Calling cancelBuffer on buffer %p",
          mComponentName.c_str(), info->mBufferID);
 
     int err = mNativeWindow->cancelBuffer(
@@ -581,7 +581,7 @@
 ACodec::BufferInfo *ACodec::dequeueBufferFromNativeWindow() {
     ANativeWindowBuffer *buf;
     if (mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buf) != 0) {
-        LOGE("dequeueBuffer failed.");
+        ALOGE("dequeueBuffer failed.");
         return NULL;
     }
 
@@ -734,7 +734,7 @@
                 &roleParams, sizeof(roleParams));
 
         if (err != OK) {
-            LOGW("[%s] Failed to set standard component role '%s'.",
+            ALOGW("[%s] Failed to set standard component role '%s'.",
                  mComponentName.c_str(), role);
         }
     }
@@ -1114,7 +1114,7 @@
 
         if (info->mStatus != BufferInfo::OWNED_BY_US
                 && info->mStatus != BufferInfo::OWNED_BY_NATIVE_WINDOW) {
-            LOGV("[%s] Buffer %p on port %ld still has status %d",
+            ALOGV("[%s] Buffer %p on port %ld still has status %d",
                     mComponentName.c_str(),
                     info->mBufferID, portIndex, info->mStatus);
             return false;
@@ -1361,13 +1361,13 @@
 bool ACodec::BaseState::onOMXEvent(
         OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) {
     if (event != OMX_EventError) {
-        LOGV("[%s] EVENT(%d, 0x%08lx, 0x%08lx)",
+        ALOGV("[%s] EVENT(%d, 0x%08lx, 0x%08lx)",
              mCodec->mComponentName.c_str(), event, data1, data2);
 
         return false;
     }
 
-    LOGE("[%s] ERROR(0x%08lx)", mCodec->mComponentName.c_str(), data1);
+    ALOGE("[%s] ERROR(0x%08lx)", mCodec->mComponentName.c_str(), data1);
 
     mCodec->signalError((OMX_ERRORTYPE)data1);
 
@@ -1375,7 +1375,7 @@
 }
 
 bool ACodec::BaseState::onOMXEmptyBufferDone(IOMX::buffer_id bufferID) {
-    LOGV("[%s] onOMXEmptyBufferDone %p",
+    ALOGV("[%s] onOMXEmptyBufferDone %p",
          mCodec->mComponentName.c_str(), bufferID);
 
     BufferInfo *info =
@@ -1438,7 +1438,7 @@
     if (!msg->findObject("buffer", &obj)) {
         CHECK(msg->findInt32("err", &err));
 
-        LOGV("[%s] saw error %d instead of an input buffer",
+        ALOGV("[%s] saw error %d instead of an input buffer",
              mCodec->mComponentName.c_str(), err);
 
         obj.clear();
@@ -1482,7 +1482,7 @@
 
                 if (buffer != info->mData) {
                     if (0 && !(flags & OMX_BUFFERFLAG_CODECCONFIG)) {
-                        LOGV("[%s] Needs to copy input data.",
+                        ALOGV("[%s] Needs to copy input data.",
                              mCodec->mComponentName.c_str());
                     }
 
@@ -1491,10 +1491,10 @@
                 }
 
                 if (flags & OMX_BUFFERFLAG_CODECCONFIG) {
-                    LOGV("[%s] calling emptyBuffer %p w/ codec specific data",
+                    ALOGV("[%s] calling emptyBuffer %p w/ codec specific data",
                          mCodec->mComponentName.c_str(), bufferID);
                 } else {
-                    LOGV("[%s] calling emptyBuffer %p w/ time %lld us",
+                    ALOGV("[%s] calling emptyBuffer %p w/ time %lld us",
                          mCodec->mComponentName.c_str(), bufferID, timeUs);
                 }
 
@@ -1512,15 +1512,15 @@
                 getMoreInputDataIfPossible();
             } else if (!mCodec->mPortEOS[kPortIndexInput]) {
                 if (err != ERROR_END_OF_STREAM) {
-                    LOGV("[%s] Signalling EOS on the input port "
+                    ALOGV("[%s] Signalling EOS on the input port "
                          "due to error %d",
                          mCodec->mComponentName.c_str(), err);
                 } else {
-                    LOGV("[%s] Signalling EOS on the input port",
+                    ALOGV("[%s] Signalling EOS on the input port",
                          mCodec->mComponentName.c_str());
                 }
 
-                LOGV("[%s] calling emptyBuffer %p signalling EOS",
+                ALOGV("[%s] calling emptyBuffer %p signalling EOS",
                      mCodec->mComponentName.c_str(), bufferID);
 
                 CHECK_EQ(mCodec->mOMX->emptyBuffer(
@@ -1582,7 +1582,7 @@
         int64_t timeUs,
         void *platformPrivate,
         void *dataPtr) {
-    LOGV("[%s] onOMXFillBufferDone %p time %lld us",
+    ALOGV("[%s] onOMXFillBufferDone %p time %lld us",
          mCodec->mComponentName.c_str(), bufferID, timeUs);
 
     ssize_t index;
@@ -1603,7 +1603,7 @@
         {
             if (rangeLength == 0) {
                 if (!(flags & OMX_BUFFERFLAG_EOS)) {
-                    LOGV("[%s] calling fillBuffer %p",
+                    ALOGV("[%s] calling fillBuffer %p",
                          mCodec->mComponentName.c_str(), info->mBufferID);
 
                     CHECK_EQ(mCodec->mOMX->fillBuffer(
@@ -1717,7 +1717,7 @@
                 }
 
                 if (info != NULL) {
-                    LOGV("[%s] calling fillBuffer %p",
+                    ALOGV("[%s] calling fillBuffer %p",
                          mCodec->mComponentName.c_str(), info->mBufferID);
 
                     CHECK_EQ(mCodec->mOMX->fillBuffer(mCodec->mNode, info->mBufferID),
@@ -1826,7 +1826,7 @@
     }
 
     if (node == NULL) {
-        LOGE("Unable to instantiate a decoder for type '%s'.", mime.c_str());
+        ALOGE("Unable to instantiate a decoder for type '%s'.", mime.c_str());
 
         mCodec->signalError(OMX_ErrorComponentNotFound);
         return;
@@ -1870,11 +1870,11 @@
 }
 
 void ACodec::LoadedToIdleState::stateEntered() {
-    LOGV("[%s] Now Loaded->Idle", mCodec->mComponentName.c_str());
+    ALOGV("[%s] Now Loaded->Idle", mCodec->mComponentName.c_str());
 
     status_t err;
     if ((err = allocateBuffers()) != OK) {
-        LOGE("Failed to allocate buffers after transitioning to IDLE state "
+        ALOGE("Failed to allocate buffers after transitioning to IDLE state "
              "(error 0x%08x)",
              err);
 
@@ -1934,7 +1934,7 @@
 }
 
 void ACodec::IdleToExecutingState::stateEntered() {
-    LOGV("[%s] Now Idle->Executing", mCodec->mComponentName.c_str());
+    ALOGV("[%s] Now Idle->Executing", mCodec->mComponentName.c_str());
 }
 
 bool ACodec::IdleToExecutingState::onMessageReceived(const sp<AMessage> &msg) {
@@ -2001,7 +2001,7 @@
             CHECK_EQ((int)info->mStatus, (int)BufferInfo::OWNED_BY_US);
         }
 
-        LOGV("[%s] calling fillBuffer %p",
+        ALOGV("[%s] calling fillBuffer %p",
              mCodec->mComponentName.c_str(), info->mBufferID);
 
         CHECK_EQ(mCodec->mOMX->fillBuffer(mCodec->mNode, info->mBufferID),
@@ -2013,7 +2013,7 @@
 
 void ACodec::ExecutingState::resume() {
     if (mActive) {
-        LOGV("[%s] We're already active, no need to resume.",
+        ALOGV("[%s] We're already active, no need to resume.",
              mCodec->mComponentName.c_str());
 
         return;
@@ -2031,7 +2031,7 @@
 }
 
 void ACodec::ExecutingState::stateEntered() {
-    LOGV("[%s] Now Executing", mCodec->mComponentName.c_str());
+    ALOGV("[%s] Now Executing", mCodec->mComponentName.c_str());
 
     mCodec->processDeferredMessages();
 }
@@ -2056,7 +2056,7 @@
 
         case kWhatFlush:
         {
-            LOGV("[%s] ExecutingState flushing now "
+            ALOGV("[%s] ExecutingState flushing now "
                  "(codec owns %d/%d input, %d/%d output).",
                     mCodec->mComponentName.c_str(),
                     mCodec->countBuffersOwnedByComponent(kPortIndexInput),
@@ -2111,7 +2111,7 @@
             } else if (data2 == OMX_IndexConfigCommonOutputCrop) {
                 mCodec->mSentFormat = false;
             } else {
-                LOGV("[%s] OMX_EventPortSettingsChanged 0x%08lx",
+                ALOGV("[%s] OMX_EventPortSettingsChanged 0x%08lx",
                      mCodec->mComponentName.c_str(), data2);
             }
 
@@ -2156,7 +2156,7 @@
         case kWhatResume:
         {
             if (msg->what() == kWhatResume) {
-                LOGV("[%s] Deferring resume", mCodec->mComponentName.c_str());
+                ALOGV("[%s] Deferring resume", mCodec->mComponentName.c_str());
             }
 
             mCodec->deferMessage(msg);
@@ -2173,7 +2173,7 @@
 }
 
 void ACodec::OutputPortSettingsChangedState::stateEntered() {
-    LOGV("[%s] Now handling output port settings change",
+    ALOGV("[%s] Now handling output port settings change",
          mCodec->mComponentName.c_str());
 }
 
@@ -2185,7 +2185,7 @@
             if (data1 == (OMX_U32)OMX_CommandPortDisable) {
                 CHECK_EQ(data2, (OMX_U32)kPortIndexOutput);
 
-                LOGV("[%s] Output port now disabled.",
+                ALOGV("[%s] Output port now disabled.",
                         mCodec->mComponentName.c_str());
 
                 CHECK(mCodec->mBuffers[kPortIndexOutput].isEmpty());
@@ -2198,7 +2198,7 @@
                 status_t err;
                 if ((err = mCodec->allocateBuffersOnPort(
                                 kPortIndexOutput)) != OK) {
-                    LOGE("Failed to allocate output port buffers after "
+                    ALOGE("Failed to allocate output port buffers after "
                          "port reconfiguration (error 0x%08x)",
                          err);
 
@@ -2217,7 +2217,7 @@
 
                 mCodec->mSentFormat = false;
 
-                LOGV("[%s] Output port now reenabled.",
+                ALOGV("[%s] Output port now reenabled.",
                         mCodec->mComponentName.c_str());
 
                 if (mCodec->mExecutingState->active()) {
@@ -2272,7 +2272,7 @@
 }
 
 void ACodec::ExecutingToIdleState::stateEntered() {
-    LOGV("[%s] Now Executing->Idle", mCodec->mComponentName.c_str());
+    ALOGV("[%s] Now Executing->Idle", mCodec->mComponentName.c_str());
 
     mCodec->mSentFormat = false;
 }
@@ -2364,7 +2364,7 @@
 }
 
 void ACodec::IdleToLoadedState::stateEntered() {
-    LOGV("[%s] Now Idle->Loaded", mCodec->mComponentName.c_str());
+    ALOGV("[%s] Now Idle->Loaded", mCodec->mComponentName.c_str());
 }
 
 bool ACodec::IdleToLoadedState::onOMXEvent(
@@ -2375,7 +2375,7 @@
             CHECK_EQ(data1, (OMX_U32)OMX_CommandStateSet);
             CHECK_EQ(data2, (OMX_U32)OMX_StateLoaded);
 
-            LOGV("[%s] Now Loaded", mCodec->mComponentName.c_str());
+            ALOGV("[%s] Now Loaded", mCodec->mComponentName.c_str());
 
             CHECK_EQ(mCodec->mOMX->freeNode(mCodec->mNode), (status_t)OK);
 
@@ -2405,7 +2405,7 @@
 }
 
 void ACodec::FlushingState::stateEntered() {
-    LOGV("[%s] Now Flushing", mCodec->mComponentName.c_str());
+    ALOGV("[%s] Now Flushing", mCodec->mComponentName.c_str());
 
     mFlushComplete[kPortIndexInput] = mFlushComplete[kPortIndexOutput] = false;
 }
@@ -2437,7 +2437,7 @@
 
 bool ACodec::FlushingState::onOMXEvent(
         OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) {
-    LOGV("[%s] FlushingState onOMXEvent(%d,%ld)",
+    ALOGV("[%s] FlushingState onOMXEvent(%d,%ld)",
             mCodec->mComponentName.c_str(), event, data1);
 
     switch (event) {
@@ -2473,7 +2473,7 @@
             msg->setInt32("data1", data1);
             msg->setInt32("data2", data2);
 
-            LOGV("[%s] Deferring OMX_EventPortSettingsChanged",
+            ALOGV("[%s] Deferring OMX_EventPortSettingsChanged",
                  mCodec->mComponentName.c_str());
 
             mCodec->deferMessage(msg);
diff --git a/media/libstagefright/AMRExtractor.cpp b/media/libstagefright/AMRExtractor.cpp
index 7eca5e4..5a28347 100644
--- a/media/libstagefright/AMRExtractor.cpp
+++ b/media/libstagefright/AMRExtractor.cpp
@@ -85,7 +85,7 @@
     };
 
     if (FT > 15 || (isWide && FT > 9 && FT < 14) || (!isWide && FT > 11 && FT < 15)) {
-        LOGE("illegal AMR frame type %d", FT);
+        ALOGE("illegal AMR frame type %d", FT);
         return 0;
     }
 
@@ -285,7 +285,7 @@
     if (header & 0x83) {
         // Padding bits must be 0.
 
-        LOGE("padding bits must be 0, header is 0x%02x", header);
+        ALOGE("padding bits must be 0, header is 0x%02x", header);
 
         return ERROR_MALFORMED;
     }
diff --git a/media/libstagefright/AMRWriter.cpp b/media/libstagefright/AMRWriter.cpp
index 6436071..6c4e307 100644
--- a/media/libstagefright/AMRWriter.cpp
+++ b/media/libstagefright/AMRWriter.cpp
@@ -235,7 +235,7 @@
             mResumed = false;
         }
         timestampUs -= previousPausedDurationUs;
-        LOGV("time stamp: %lld, previous paused duration: %lld",
+        ALOGV("time stamp: %lld, previous paused duration: %lld",
                 timestampUs, previousPausedDurationUs);
         if (timestampUs > maxTimestampUs) {
             maxTimestampUs = timestampUs;
diff --git a/media/libstagefright/AVIExtractor.cpp b/media/libstagefright/AVIExtractor.cpp
index 815f987..a3187b7 100644
--- a/media/libstagefright/AVIExtractor.cpp
+++ b/media/libstagefright/AVIExtractor.cpp
@@ -457,7 +457,7 @@
 
         uint32_t subFourcc = U32_AT(&tmp[8]);
 
-        LOGV("%s offset 0x%08llx LIST of '%c%c%c%c', size %d",
+        ALOGV("%s offset 0x%08llx LIST of '%c%c%c%c', size %d",
              prefix,
              offset,
              (char)(subFourcc >> 24),
@@ -486,7 +486,7 @@
             }
         }
     } else {
-        LOGV("%s offset 0x%08llx CHUNK '%c%c%c%c'",
+        ALOGV("%s offset 0x%08llx CHUNK '%c%c%c%c'",
              prefix,
              offset,
              (char)(fourcc >> 24),
@@ -625,7 +625,7 @@
         }
 
         if (mime == NULL) {
-            LOGW("Unsupported video format '%c%c%c%c'",
+            ALOGW("Unsupported video format '%c%c%c%c'",
                  (char)(handler >> 24),
                  (char)((handler >> 16) & 0xff),
                  (char)((handler >> 8) & 0xff),
@@ -705,7 +705,7 @@
         if (format == 0x55) {
             track->mMeta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_MPEG);
         } else {
-            LOGW("Unsupported audio format = 0x%04x", format);
+            ALOGW("Unsupported audio format = 0x%04x", format);
         }
 
         uint32_t numChannels = U16LE_AT(&data[2]);
@@ -856,7 +856,7 @@
             }
         }
 
-        LOGV("Chunk offsets are %s",
+        ALOGV("Chunk offsets are %s",
              mOffsetsAreAbsolute ? "absolute" : "movie-chunk relative");
     }
 
@@ -908,7 +908,7 @@
         CHECK_EQ((status_t)OK,
                  getSampleTime(i, track->mSamples.size() - 1, &durationUs));
 
-        LOGV("track %d duration = %.2f secs", i, durationUs / 1E6);
+        ALOGV("track %d duration = %.2f secs", i, durationUs / 1E6);
 
         track->mMeta->setInt64(kKeyDuration, durationUs);
         track->mMeta->setInt32(kKeyMaxInputSize, track->mMaxSampleSize);
@@ -1080,7 +1080,7 @@
     sp<MetaData> meta = MakeAVCCodecSpecificData(buffer);
 
     if (meta == NULL) {
-        LOGE("Unable to extract AVC codec specific data");
+        ALOGE("Unable to extract AVC codec specific data");
         return ERROR_MALFORMED;
     }
 
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp
index 2581a62..9a9c3ef 100644
--- a/media/libstagefright/AudioPlayer.cpp
+++ b/media/libstagefright/AudioPlayer.cpp
@@ -92,7 +92,7 @@
 
     mFirstBufferResult = mSource->read(&mFirstBuffer, &options);
     if (mFirstBufferResult == INFO_FORMAT_CHANGED) {
-        LOGV("INFO_FORMAT_CHANGED!!!");
+        ALOGV("INFO_FORMAT_CHANGED!!!");
 
         CHECK(mFirstBuffer == NULL);
         mFirstBufferResult = OK;
@@ -223,7 +223,7 @@
     }
 
     if (mInputBuffer != NULL) {
-        LOGV("AudioPlayer releasing input buffer.");
+        ALOGV("AudioPlayer releasing input buffer.");
 
         mInputBuffer->release();
         mInputBuffer = NULL;
@@ -310,7 +310,7 @@
 
 size_t AudioPlayer::fillBuffer(void *data, size_t size) {
     if (mNumFramesPlayed == 0) {
-        LOGV("AudioCallback");
+        ALOGV("AudioCallback");
     }
 
     if (mReachedEOS) {
@@ -390,12 +390,12 @@
                     int64_t timeToCompletionUs =
                         (1000000ll * numFramesPendingPlayout) / mSampleRate;
 
-                    LOGV("total number of frames played: %lld (%lld us)",
+                    ALOGV("total number of frames played: %lld (%lld us)",
                             (mNumFramesPlayed + numAdditionalFrames),
                             1000000ll * (mNumFramesPlayed + numAdditionalFrames)
                                 / mSampleRate);
 
-                    LOGV("%d frames left to play, %lld us (%.2f secs)",
+                    ALOGV("%d frames left to play, %lld us (%.2f secs)",
                          numFramesPendingPlayout,
                          timeToCompletionUs, timeToCompletionUs / 1E6);
 
@@ -415,7 +415,7 @@
                 ((mNumFramesPlayed + size_done / mFrameSize) * 1000000)
                     / mSampleRate;
 
-            LOGV("buffer->size() = %d, "
+            ALOGV("buffer->size() = %d, "
                  "mPositionTimeMediaUs=%.2f mPositionTimeRealUs=%.2f",
                  mInputBuffer->range_length(),
                  mPositionTimeMediaUs / 1E6, mPositionTimeRealUs / 1E6);
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp
index 99c3682..2172cc0 100644
--- a/media/libstagefright/AudioSource.cpp
+++ b/media/libstagefright/AudioSource.cpp
@@ -37,7 +37,7 @@
             break;
         }
         case AudioRecord::EVENT_OVERRUN: {
-            LOGW("AudioRecord reported overrun!");
+            ALOGW("AudioRecord reported overrun!");
             break;
         }
         default:
@@ -54,7 +54,7 @@
       mNumFramesReceived(0),
       mNumClientOwnedBuffers(0) {
 
-    LOGV("sampleRate: %d, channels: %d", sampleRate, channels);
+    ALOGV("sampleRate: %d, channels: %d", sampleRate, channels);
     CHECK(channels == 1 || channels == 2);
     uint32_t flags = AudioRecord::RECORD_AGC_ENABLE |
                      AudioRecord::RECORD_NS_ENABLE  |
@@ -114,7 +114,7 @@
 }
 
 void AudioSource::releaseQueuedFrames_l() {
-    LOGV("releaseQueuedFrames_l");
+    ALOGV("releaseQueuedFrames_l");
     List<MediaBuffer *>::iterator it;
     while (!mBuffersReceived.empty()) {
         it = mBuffersReceived.begin();
@@ -124,7 +124,7 @@
 }
 
 void AudioSource::waitOutstandingEncodingFrames_l() {
-    LOGV("waitOutstandingEncodingFrames_l: %lld", mNumClientOwnedBuffers);
+    ALOGV("waitOutstandingEncodingFrames_l: %lld", mNumClientOwnedBuffers);
     while (mNumClientOwnedBuffers > 0) {
         mFrameEncodingCompletionCondition.wait(mLock);
     }
@@ -245,7 +245,7 @@
 }
 
 void AudioSource::signalBufferReturned(MediaBuffer *buffer) {
-    LOGV("signalBufferReturned: %p", buffer->data());
+    ALOGV("signalBufferReturned: %p", buffer->data());
     Mutex::Autolock autoLock(mLock);
     --mNumClientOwnedBuffers;
     buffer->setObserver(0);
@@ -256,17 +256,17 @@
 
 status_t AudioSource::dataCallbackTimestamp(
         const AudioRecord::Buffer& audioBuffer, int64_t timeUs) {
-    LOGV("dataCallbackTimestamp: %lld us", timeUs);
+    ALOGV("dataCallbackTimestamp: %lld us", timeUs);
     Mutex::Autolock autoLock(mLock);
     if (!mStarted) {
-        LOGW("Spurious callback from AudioRecord. Drop the audio data.");
+        ALOGW("Spurious callback from AudioRecord. Drop the audio data.");
         return OK;
     }
 
     // Drop retrieved and previously lost audio data.
     if (mNumFramesReceived == 0 && timeUs < mStartTimeUs) {
         mRecord->getInputFramesLost();
-        LOGV("Drop audio data at %lld/%lld us", timeUs, mStartTimeUs);
+        ALOGV("Drop audio data at %lld/%lld us", timeUs, mStartTimeUs);
         return OK;
     }
 
@@ -301,7 +301,7 @@
                     audioBuffer.i16, audioBuffer.size);
     } else {
         if (audioBuffer.size == 0) {
-            LOGW("Nothing is available from AudioRecord callback buffer");
+            ALOGW("Nothing is available from AudioRecord callback buffer");
             buffer->release();
             return OK;
         }
@@ -345,7 +345,7 @@
     }
     int16_t value = mMaxAmplitude;
     mMaxAmplitude = 0;
-    LOGV("max amplitude since last call: %d", value);
+    ALOGV("max amplitude since last call: %d", value);
     return value;
 }
 
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index bc45f83..d0cb7ff 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -132,7 +132,7 @@
         status_t err = mNativeWindow->queueBuffer(
                 mNativeWindow.get(), buffer->graphicBuffer().get());
         if (err != 0) {
-            LOGE("queueBuffer failed with error %s (%d)", strerror(-err),
+            ALOGE("queueBuffer failed with error %s (%d)", strerror(-err),
                     -err);
             return;
         }
@@ -247,7 +247,7 @@
 }
 
 void AwesomePlayer::setUID(uid_t uid) {
-    LOGV("AwesomePlayer running on behalf of uid %d", uid);
+    ALOGV("AwesomePlayer running on behalf of uid %d", uid);
 
     mUID = uid;
     mUIDValid = true;
@@ -280,9 +280,9 @@
     }
 
     if (!(mFlags & INCOGNITO)) {
-        LOGI("setDataSource_l('%s')", mUri.string());
+        ALOGI("setDataSource_l('%s')", mUri.string());
     } else {
-        LOGI("setDataSource_l(URL suppressed)");
+        ALOGI("setDataSource_l(URL suppressed)");
     }
 
     // The actual work will be done during preparation in the call to
@@ -360,7 +360,7 @@
         if (!meta->findInt32(kKeyBitRate, &bitrate)) {
             const char *mime;
             CHECK(meta->findCString(kKeyMIMEType, &mime));
-            LOGV("track of type '%s' does not publish bitrate", mime);
+            ALOGV("track of type '%s' does not publish bitrate", mime);
 
             totalBitRate = -1;
             break;
@@ -371,7 +371,7 @@
 
     mBitrate = totalBitRate;
 
-    LOGV("mBitrate = %lld bits/sec", mBitrate);
+    ALOGV("mBitrate = %lld bits/sec", mBitrate);
 
     {
         Mutex::Autolock autoLock(mStatsLock);
@@ -483,7 +483,7 @@
     if (mFlags & PREPARING) {
         modifyFlags(PREPARE_CANCELLED, SET);
         if (mConnectingDataSource != NULL) {
-            LOGI("interrupting the connection process");
+            ALOGI("interrupting the connection process");
             mConnectingDataSource->disconnect();
         }
 
@@ -637,7 +637,7 @@
     int64_t videoLateByUs = audioTimeUs - mVideoTimeUs;
 
     if (!(mFlags & VIDEO_AT_EOS) && videoLateByUs > 300000ll) {
-        LOGV("video late by %lld ms.", videoLateByUs / 1000ll);
+        ALOGV("video late by %lld ms.", videoLateByUs / 1000ll);
 
         notifyListener_l(
                 MEDIA_INFO,
@@ -665,7 +665,7 @@
                 notifyListener_l(MEDIA_BUFFERING_UPDATE, 100);
             }
             if (mFlags & PREPARING) {
-                LOGV("cache has reached EOS, prepare is done.");
+                ALOGV("cache has reached EOS, prepare is done.");
                 finishAsyncPrepare_l();
             }
         } else {
@@ -686,7 +686,7 @@
 
                 if ((mFlags & PLAYING) && !eos
                         && (cachedDataRemaining < kLowWaterMarkBytes)) {
-                    LOGI("cache is running low (< %d) , pausing.",
+                    ALOGI("cache is running low (< %d) , pausing.",
                          kLowWaterMarkBytes);
                     modifyFlags(CACHE_UNDERRUN, SET);
                     pause_l();
@@ -695,13 +695,13 @@
                     notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_START);
                 } else if (eos || cachedDataRemaining > kHighWaterMarkBytes) {
                     if (mFlags & CACHE_UNDERRUN) {
-                        LOGI("cache has filled up (> %d), resuming.",
+                        ALOGI("cache has filled up (> %d), resuming.",
                              kHighWaterMarkBytes);
                         modifyFlags(CACHE_UNDERRUN, CLEAR);
                         play_l();
                         notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_END);
                     } else if (mFlags & PREPARING) {
-                        LOGV("cache has filled up (> %d), prepare is done",
+                        ALOGV("cache has filled up (> %d), prepare is done",
                              kHighWaterMarkBytes);
                         finishAsyncPrepare_l();
                     }
@@ -721,7 +721,7 @@
                 notifyListener_l(MEDIA_BUFFERING_UPDATE, 100);
             }
             if (mFlags & PREPARING) {
-                LOGV("cache has reached EOS, prepare is done.");
+                ALOGV("cache has reached EOS, prepare is done.");
                 finishAsyncPrepare_l();
             }
         } else {
@@ -737,12 +737,12 @@
     int64_t cachedDurationUs;
     bool eos;
     if (getCachedDuration_l(&cachedDurationUs, &eos)) {
-        LOGV("cachedDurationUs = %.2f secs, eos=%d",
+        ALOGV("cachedDurationUs = %.2f secs, eos=%d",
              cachedDurationUs / 1E6, eos);
 
         if ((mFlags & PLAYING) && !eos
                 && (cachedDurationUs < kLowWaterMarkUs)) {
-            LOGI("cache is running low (%.2f secs) , pausing.",
+            ALOGI("cache is running low (%.2f secs) , pausing.",
                  cachedDurationUs / 1E6);
             modifyFlags(CACHE_UNDERRUN, SET);
             pause_l();
@@ -751,13 +751,13 @@
             notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_START);
         } else if (eos || cachedDurationUs > kHighWaterMarkUs) {
             if (mFlags & CACHE_UNDERRUN) {
-                LOGI("cache has filled up (%.2f secs), resuming.",
+                ALOGI("cache has filled up (%.2f secs), resuming.",
                      cachedDurationUs / 1E6);
                 modifyFlags(CACHE_UNDERRUN, CLEAR);
                 play_l();
                 notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_END);
             } else if (mFlags & PREPARING) {
-                LOGV("cache has filled up (%.2f secs), prepare is done",
+                ALOGV("cache has filled up (%.2f secs), prepare is done",
                      cachedDurationUs / 1E6);
                 finishAsyncPrepare_l();
             }
@@ -789,7 +789,7 @@
     mStreamDoneEventPending = false;
 
     if (mStreamDoneStatus != ERROR_END_OF_STREAM) {
-        LOGV("MEDIA_ERROR %d", mStreamDoneStatus);
+        ALOGV("MEDIA_ERROR %d", mStreamDoneStatus);
 
         notifyListener_l(
                 MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, mStreamDoneStatus);
@@ -820,7 +820,7 @@
             postVideoEvent_l();
         }
     } else {
-        LOGV("MEDIA_PLAYBACK_COMPLETE");
+        ALOGV("MEDIA_PLAYBACK_COMPLETE");
         notifyListener_l(MEDIA_PLAYBACK_COMPLETE);
 
         pause_l(true /* at eos */);
@@ -991,20 +991,20 @@
         cropRight = width - 1;
         cropBottom = height - 1;
 
-        LOGV("got dimensions only %d x %d", width, height);
+        ALOGV("got dimensions only %d x %d", width, height);
     } else {
-        LOGV("got crop rect %d, %d, %d, %d",
+        ALOGV("got crop rect %d, %d, %d, %d",
              cropLeft, cropTop, cropRight, cropBottom);
     }
 
     int32_t displayWidth;
     if (meta->findInt32(kKeyDisplayWidth, &displayWidth)) {
-        LOGV("Display width changed (%d=>%d)", mDisplayWidth, displayWidth);
+        ALOGV("Display width changed (%d=>%d)", mDisplayWidth, displayWidth);
         mDisplayWidth = displayWidth;
     }
     int32_t displayHeight;
     if (meta->findInt32(kKeyDisplayHeight, &displayHeight)) {
-        LOGV("Display height changed (%d=>%d)", mDisplayHeight, displayHeight);
+        ALOGV("Display height changed (%d=>%d)", mDisplayHeight, displayHeight);
         mDisplayHeight = displayHeight;
     }
 
@@ -1170,7 +1170,7 @@
         usleep(1000);
     }
     IPCThreadState::self()->flushCommands();
-    LOGV("video decoder shutdown completed");
+    ALOGV("video decoder shutdown completed");
 }
 
 status_t AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) {
@@ -1180,7 +1180,7 @@
         return OK;
     }
 
-    LOGV("attempting to reconfigure to use new surface");
+    ALOGV("attempting to reconfigure to use new surface");
 
     bool wasPlaying = (mFlags & PLAYING) != 0;
 
@@ -1192,7 +1192,7 @@
     status_t err = initVideoDecoder();
 
     if (err != OK) {
-        LOGE("failed to reinstantiate video decoder after surface change.");
+        ALOGE("failed to reinstantiate video decoder after surface change.");
         return err;
     }
 
@@ -1317,7 +1317,7 @@
     }
 
     if (!(mFlags & PLAYING)) {
-        LOGV("seeking while paused, sending SEEK_COMPLETE notification"
+        ALOGV("seeking while paused, sending SEEK_COMPLETE notification"
              " immediately.");
 
         notifyListener_l(MEDIA_SEEK_COMPLETE);
@@ -1470,7 +1470,7 @@
         flags |= OMXCodec::kEnableGrallocUsageProtected;
     }
 #endif
-    LOGV("initVideoDecoder flags=0x%x", flags);
+    ALOGV("initVideoDecoder flags=0x%x", flags);
     mVideoSource = OMXCodec::Create(
             mClient.interface(), mVideoTrack->getFormat(),
             false, // createEncoder
@@ -1534,7 +1534,7 @@
     }
 
     if (mAudioPlayer != NULL) {
-        LOGV("seeking audio to %lld us (%.2f secs).", videoTimeUs, videoTimeUs / 1E6);
+        ALOGV("seeking audio to %lld us (%.2f secs).", videoTimeUs, videoTimeUs / 1E6);
 
         // If we don't have a video time, seek audio to the originally
         // requested seek time instead.
@@ -1597,7 +1597,7 @@
     if (!mVideoBuffer) {
         MediaSource::ReadOptions options;
         if (mSeeking != NO_SEEK) {
-            LOGV("seeking to %lld us (%.2f secs)", mSeekTimeUs, mSeekTimeUs / 1E6);
+            ALOGV("seeking to %lld us (%.2f secs)", mSeekTimeUs, mSeekTimeUs / 1E6);
 
             options.setSeekTo(
                     mSeekTimeUs,
@@ -1613,7 +1613,7 @@
                 CHECK(mVideoBuffer == NULL);
 
                 if (err == INFO_FORMAT_CHANGED) {
-                    LOGV("VideoSource signalled format change.");
+                    ALOGV("VideoSource signalled format change.");
 
                     notifyVideoSize_l();
 
@@ -1628,7 +1628,7 @@
                 // a seek request pending that needs to be applied
                 // to the audio track.
                 if (mSeeking != NO_SEEK) {
-                    LOGV("video stream ended while seeking!");
+                    ALOGV("video stream ended while seeking!");
                 }
                 finishSeekIfNecessary(-1);
 
@@ -1667,7 +1667,7 @@
 
     if (mSeeking == SEEK_VIDEO_ONLY) {
         if (mSeekTimeUs > timeUs) {
-            LOGI("XXX mSeekTimeUs = %lld us, timeUs = %lld us",
+            ALOGI("XXX mSeekTimeUs = %lld us, timeUs = %lld us",
                  mSeekTimeUs, timeUs);
         }
     }
@@ -1683,7 +1683,7 @@
     if (mAudioPlayer != NULL && !(mFlags & (AUDIO_RUNNING | SEEK_PREVIEW))) {
         status_t err = startAudioPlayer_l();
         if (err != OK) {
-            LOGE("Starting the audio player failed w/ err %d", err);
+            ALOGE("Starting the audio player failed w/ err %d", err);
             return;
         }
     }
@@ -1715,7 +1715,7 @@
         int64_t latenessUs = nowUs - timeUs;
 
         if (latenessUs > 0) {
-            LOGI("after SEEK_VIDEO_ONLY we're late by %.2f secs", latenessUs / 1E6);
+            ALOGI("after SEEK_VIDEO_ONLY we're late by %.2f secs", latenessUs / 1E6);
         }
     }
 
@@ -1730,7 +1730,7 @@
                 && mAudioPlayer != NULL
                 && mAudioPlayer->getMediaTimeMapping(
                     &realTimeUs, &mediaTimeUs)) {
-            LOGI("we're much too late (%.2f secs), video skipping ahead",
+            ALOGI("we're much too late (%.2f secs), video skipping ahead",
                  latenessUs / 1E6);
 
             mVideoBuffer->release();
@@ -1745,13 +1745,13 @@
 
         if (latenessUs > 40000) {
             // We're more than 40ms late.
-            LOGV("we're late by %lld us (%.2f secs)",
+            ALOGV("we're late by %lld us (%.2f secs)",
                  latenessUs, latenessUs / 1E6);
 
             if (!(mFlags & SLOW_DECODER_HACK)
                     || mSinceLastDropped > FRAME_DROP_FREQ)
             {
-                LOGV("we're late by %lld us (%.2f secs) dropping "
+                ALOGV("we're late by %lld us (%.2f secs) dropping "
                      "one after %d frames",
                      latenessUs, latenessUs / 1E6, mSinceLastDropped);
 
@@ -1979,7 +1979,7 @@
         if (err != OK) {
             mConnectingDataSource.clear();
 
-            LOGI("mConnectingDataSource->connect() returned %d", err);
+            ALOGI("mConnectingDataSource->connect() returned %d", err);
             return err;
         }
 
@@ -2042,7 +2042,7 @@
                         break;
                     }
 
-                    LOGV("now cached %d bytes of data", cachedDataRemaining);
+                    ALOGV("now cached %d bytes of data", cachedDataRemaining);
 
                     if (metaDataSize < 0
                             && cachedDataRemaining >= kMinBytesForSniffing) {
@@ -2067,7 +2067,7 @@
                         }
 
                         CHECK_GE(metaDataSize, 0ll);
-                        LOGV("metaDataSize = %lld bytes", metaDataSize);
+                        ALOGV("metaDataSize = %lld bytes", metaDataSize);
                     }
 
                     usleep(200000);
@@ -2077,7 +2077,7 @@
             }
 
             if (mFlags & PREPARE_CANCELLED) {
-                LOGI("Prepare cancelled while waiting for initial cache fill.");
+                ALOGI("Prepare cancelled while waiting for initial cache fill.");
                 return UNKNOWN_ERROR;
             }
         }
@@ -2159,7 +2159,7 @@
     Mutex::Autolock autoLock(mLock);
 
     if (mFlags & PREPARE_CANCELLED) {
-        LOGI("prepare was cancelled before doing anything");
+        ALOGI("prepare was cancelled before doing anything");
         abortPrepare(UNKNOWN_ERROR);
         return;
     }
@@ -2260,7 +2260,7 @@
 status_t AwesomePlayer::setCacheStatCollectFreq(const Parcel &request) {
     if (mCachedSource != NULL) {
         int32_t freqMs = request.readInt32();
-        LOGD("Request to keep cache stats in the past %d ms",
+        ALOGD("Request to keep cache stats in the past %d ms",
             freqMs);
         return mCachedSource->setCacheStatCollectFreq(freqMs);
     }
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp
index 57989c5..1850c9c 100755
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -63,12 +63,12 @@
 }
 
 void CameraSourceListener::notify(int32_t msgType, int32_t ext1, int32_t ext2) {
-    LOGV("notify(%d, %d, %d)", msgType, ext1, ext2);
+    ALOGV("notify(%d, %d, %d)", msgType, ext1, ext2);
 }
 
 void CameraSourceListener::postData(int32_t msgType, const sp<IMemory> &dataPtr,
                                     camera_frame_metadata_t *metadata) {
-    LOGV("postData(%d, ptr:%p, size:%d)",
+    ALOGV("postData(%d, ptr:%p, size:%d)",
          msgType, dataPtr->pointer(), dataPtr->size());
 
     sp<CameraSource> source = mSource.promote();
@@ -111,7 +111,7 @@
        return OMX_TI_COLOR_FormatYUV420PackedSemiPlanar;
     }
 
-    LOGE("Uknown color format (%s), please add it to "
+    ALOGE("Uknown color format (%s), please add it to "
          "CameraSource::getColorFormat", colorFormat);
 
     CHECK_EQ(0, "Unknown color format");
@@ -217,7 +217,7 @@
     int32_t width, int32_t height,
     const Vector<Size>& supportedSizes) {
 
-    LOGV("isVideoSizeSupported");
+    ALOGV("isVideoSizeSupported");
     for (size_t i = 0; i < supportedSizes.size(); ++i) {
         if (width  == supportedSizes[i].width &&
             height == supportedSizes[i].height) {
@@ -254,7 +254,7 @@
     *isSetVideoSizeSupported = true;
     params.getSupportedVideoSizes(sizes);
     if (sizes.size() == 0) {
-        LOGD("Camera does not support setVideoSize()");
+        ALOGD("Camera does not support setVideoSize()");
         params.getSupportedPreviewSizes(sizes);
         *isSetVideoSizeSupported = false;
     }
@@ -294,14 +294,14 @@
         CameraParameters* params,
         int32_t width, int32_t height,
         int32_t frameRate) {
-    LOGV("configureCamera");
+    ALOGV("configureCamera");
     Vector<Size> sizes;
     bool isSetVideoSizeSupportedByCamera = true;
     getSupportedVideoSizes(*params, &isSetVideoSizeSupportedByCamera, sizes);
     bool isCameraParamChanged = false;
     if (width != -1 && height != -1) {
         if (!isVideoSizeSupported(width, height, sizes)) {
-            LOGE("Video dimension (%dx%d) is unsupported", width, height);
+            ALOGE("Video dimension (%dx%d) is unsupported", width, height);
             return BAD_VALUE;
         }
         if (isSetVideoSizeSupportedByCamera) {
@@ -314,7 +314,7 @@
                (width != -1 && height == -1)) {
         // If one and only one of the width and height is -1
         // we reject such a request.
-        LOGE("Requested video size (%dx%d) is not supported", width, height);
+        ALOGE("Requested video size (%dx%d) is not supported", width, height);
         return BAD_VALUE;
     } else {  // width == -1 && height == -1
         // Do not configure the camera.
@@ -326,11 +326,11 @@
         const char* supportedFrameRates =
                 params->get(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES);
         CHECK(supportedFrameRates != NULL);
-        LOGV("Supported frame rates: %s", supportedFrameRates);
+        ALOGV("Supported frame rates: %s", supportedFrameRates);
         char buf[4];
         snprintf(buf, 4, "%d", frameRate);
         if (strstr(supportedFrameRates, buf) == NULL) {
-            LOGE("Requested frame rate (%d) is not supported: %s",
+            ALOGE("Requested frame rate (%d) is not supported: %s",
                 frameRate, supportedFrameRates);
             return BAD_VALUE;
         }
@@ -347,7 +347,7 @@
         // Either frame rate or frame size needs to be changed.
         String8 s = params->flatten();
         if (OK != mCamera->setParameters(s)) {
-            LOGE("Could not change settings."
+            ALOGE("Could not change settings."
                  " Someone else is using camera %p?", mCamera.get());
             return -EBUSY;
         }
@@ -370,7 +370,7 @@
         const CameraParameters& params,
         int32_t width, int32_t height) {
 
-    LOGV("checkVideoSize");
+    ALOGV("checkVideoSize");
     // The actual video size is the same as the preview size
     // if the camera hal does not support separate video and
     // preview output. In this case, we retrieve the video
@@ -387,7 +387,7 @@
         params.getVideoSize(&frameWidthActual, &frameHeightActual);
     }
     if (frameWidthActual < 0 || frameHeightActual < 0) {
-        LOGE("Failed to retrieve video frame size (%dx%d)",
+        ALOGE("Failed to retrieve video frame size (%dx%d)",
                 frameWidthActual, frameHeightActual);
         return UNKNOWN_ERROR;
     }
@@ -396,7 +396,7 @@
     // video frame size.
     if (width != -1 && height != -1) {
         if (frameWidthActual != width || frameHeightActual != height) {
-            LOGE("Failed to set video frame size to %dx%d. "
+            ALOGE("Failed to set video frame size to %dx%d. "
                     "The actual video size is %dx%d ", width, height,
                     frameWidthActual, frameHeightActual);
             return UNKNOWN_ERROR;
@@ -422,17 +422,17 @@
         const CameraParameters& params,
         int32_t frameRate) {
 
-    LOGV("checkFrameRate");
+    ALOGV("checkFrameRate");
     int32_t frameRateActual = params.getPreviewFrameRate();
     if (frameRateActual < 0) {
-        LOGE("Failed to retrieve preview frame rate (%d)", frameRateActual);
+        ALOGE("Failed to retrieve preview frame rate (%d)", frameRateActual);
         return UNKNOWN_ERROR;
     }
 
     // Check the actual video frame rate against the target/requested
     // video frame rate.
     if (frameRate != -1 && (frameRateActual - frameRate) != 0) {
-        LOGE("Failed to set preview frame rate to %d fps. The actual "
+        ALOGE("Failed to set preview frame rate to %d fps. The actual "
                 "frame rate is %d", frameRate, frameRateActual);
         return UNKNOWN_ERROR;
     }
@@ -468,7 +468,7 @@
         int32_t frameRate,
         bool storeMetaDataInVideoBuffers) {
 
-    LOGV("init");
+    ALOGV("init");
     status_t err = OK;
     int64_t token = IPCThreadState::self()->clearCallingIdentity();
     err = initWithCameraAccess(camera, proxy, cameraId,
@@ -485,11 +485,11 @@
         Size videoSize,
         int32_t frameRate,
         bool storeMetaDataInVideoBuffers) {
-    LOGV("initWithCameraAccess");
+    ALOGV("initWithCameraAccess");
     status_t err = OK;
 
     if ((err = isCameraAvailable(camera, proxy, cameraId)) != OK) {
-        LOGE("Camera connection could not be established.");
+        ALOGE("Camera connection could not be established.");
         return err;
     }
     CameraParameters params(mCamera->getParameters());
@@ -558,7 +558,7 @@
 }
 
 void CameraSource::startCameraRecording() {
-    LOGV("startCameraRecording");
+    ALOGV("startCameraRecording");
     // Reset the identity to the current thread because media server owns the
     // camera and recording is started by the applications. The applications
     // will connect to the camera in ICameraRecordingProxy::startRecording.
@@ -576,10 +576,10 @@
 }
 
 status_t CameraSource::start(MetaData *meta) {
-    LOGV("start");
+    ALOGV("start");
     CHECK(!mStarted);
     if (mInitCheck != OK) {
-        LOGE("CameraSource is not initialized yet");
+        ALOGE("CameraSource is not initialized yet");
         return mInitCheck;
     }
 
@@ -602,7 +602,7 @@
 }
 
 void CameraSource::stopCameraRecording() {
-    LOGV("stopCameraRecording");
+    ALOGV("stopCameraRecording");
     if (mCameraFlags & FLAGS_HOT_CAMERA) {
         mCameraRecordingProxy->stopRecording();
     } else {
@@ -612,11 +612,11 @@
 }
 
 void CameraSource::releaseCamera() {
-    LOGV("releaseCamera");
+    ALOGV("releaseCamera");
     if (mCamera != 0) {
         int64_t token = IPCThreadState::self()->clearCallingIdentity();
         if ((mCameraFlags & FLAGS_HOT_CAMERA) == 0) {
-            LOGV("Camera was cold when we started, stopping preview");
+            ALOGV("Camera was cold when we started, stopping preview");
             mCamera->stopPreview();
             mCamera->disconnect();
         }
@@ -633,7 +633,7 @@
 }
 
 status_t CameraSource::stop() {
-    LOGD("stop: E");
+    ALOGD("stop: E");
     Mutex::Autolock autoLock(mLock);
     mStarted = false;
     mFrameAvailableCondition.signal();
@@ -649,7 +649,7 @@
         if (NO_ERROR !=
             mFrameCompleteCondition.waitRelative(mLock,
                     mTimeBetweenFrameCaptureUs * 1000LL + CAMERA_SOURCE_TIMEOUT_NS)) {
-            LOGW("Timed out waiting for outstanding frames being encoded: %d",
+            ALOGW("Timed out waiting for outstanding frames being encoded: %d",
                 mFramesBeingEncoded.size());
         }
     }
@@ -660,22 +660,22 @@
     }
 
     if (mCollectStats) {
-        LOGI("Frames received/encoded/dropped: %d/%d/%d in %lld us",
+        ALOGI("Frames received/encoded/dropped: %d/%d/%d in %lld us",
                 mNumFramesReceived, mNumFramesEncoded, mNumFramesDropped,
                 mLastFrameTimestampUs - mFirstFrameTimeUs);
     }
 
     if (mNumGlitches > 0) {
-        LOGW("%d long delays between neighboring video frames", mNumGlitches);
+        ALOGW("%d long delays between neighboring video frames", mNumGlitches);
     }
 
     CHECK_EQ(mNumFramesReceived, mNumFramesEncoded + mNumFramesDropped);
-    LOGD("stop: X");
+    ALOGD("stop: X");
     return OK;
 }
 
 void CameraSource::releaseRecordingFrame(const sp<IMemory>& frame) {
-    LOGV("releaseRecordingFrame");
+    ALOGV("releaseRecordingFrame");
     if (mCameraRecordingProxy != NULL) {
         mCameraRecordingProxy->releaseRecordingFrame(frame);
     } else if (mCamera != NULL) {
@@ -704,7 +704,7 @@
 }
 
 void CameraSource::signalBufferReturned(MediaBuffer *buffer) {
-    LOGV("signalBufferReturned: %p", buffer->data());
+    ALOGV("signalBufferReturned: %p", buffer->data());
     Mutex::Autolock autoLock(mLock);
     for (List<sp<IMemory> >::iterator it = mFramesBeingEncoded.begin();
          it != mFramesBeingEncoded.end(); ++it) {
@@ -723,7 +723,7 @@
 
 status_t CameraSource::read(
         MediaBuffer **buffer, const ReadOptions *options) {
-    LOGV("read");
+    ALOGV("read");
 
     *buffer = NULL;
 
@@ -744,10 +744,10 @@
                     mTimeBetweenFrameCaptureUs * 1000LL + CAMERA_SOURCE_TIMEOUT_NS)) {
                 if (mCameraRecordingProxy != 0 &&
                     !mCameraRecordingProxy->asBinder()->isBinderAlive()) {
-                    LOGW("camera recording proxy is gone");
+                    ALOGW("camera recording proxy is gone");
                     return ERROR_END_OF_STREAM;
                 }
-                LOGW("Timed out waiting for incoming camera video frames: %lld us",
+                ALOGW("Timed out waiting for incoming camera video frames: %lld us",
                     mLastFrameTimestampUs);
             }
         }
@@ -770,10 +770,10 @@
 
 void CameraSource::dataCallbackTimestamp(int64_t timestampUs,
         int32_t msgType, const sp<IMemory> &data) {
-    LOGV("dataCallbackTimestamp: timestamp %lld us", timestampUs);
+    ALOGV("dataCallbackTimestamp: timestamp %lld us", timestampUs);
     Mutex::Autolock autoLock(mLock);
     if (!mStarted || (mNumFramesReceived == 0 && timestampUs < mStartTimeUs)) {
-        LOGV("Drop frame at %lld/%lld us", timestampUs, mStartTimeUs);
+        ALOGV("Drop frame at %lld/%lld us", timestampUs, mStartTimeUs);
         releaseOneRecordingFrame(data);
         return;
     }
@@ -812,13 +812,13 @@
     mFramesReceived.push_back(data);
     int64_t timeUs = mStartTimeUs + (timestampUs - mFirstFrameTimeUs);
     mFrameTimes.push_back(timeUs);
-    LOGV("initial delay: %lld, current time stamp: %lld",
+    ALOGV("initial delay: %lld, current time stamp: %lld",
         mStartTimeUs, timeUs);
     mFrameAvailableCondition.signal();
 }
 
 bool CameraSource::isMetaDataStoredInVideoBuffers() const {
-    LOGV("isMetaDataStoredInVideoBuffers");
+    ALOGV("isMetaDataStoredInVideoBuffers");
     return mIsMetaDataStoredInVideoBuffers;
 }
 
@@ -832,7 +832,7 @@
 }
 
 void CameraSource::DeathNotifier::binderDied(const wp<IBinder>& who) {
-    LOGI("Camera recording proxy died");
+    ALOGI("Camera recording proxy died");
 }
 
 }  // namespace android
diff --git a/media/libstagefright/CameraSourceTimeLapse.cpp b/media/libstagefright/CameraSourceTimeLapse.cpp
index eb456f4..263ab50 100644
--- a/media/libstagefright/CameraSourceTimeLapse.cpp
+++ b/media/libstagefright/CameraSourceTimeLapse.cpp
@@ -69,7 +69,7 @@
       mSkipCurrentFrame(false) {
 
     mTimeBetweenFrameCaptureUs = timeBetweenFrameCaptureUs;
-    LOGD("starting time lapse mode: %lld us",
+    ALOGD("starting time lapse mode: %lld us",
         mTimeBetweenFrameCaptureUs);
 
     mVideoWidth = videoSize.width;
@@ -90,7 +90,7 @@
 }
 
 void CameraSourceTimeLapse::startQuickReadReturns() {
-    LOGV("startQuickReadReturns");
+    ALOGV("startQuickReadReturns");
     Mutex::Autolock autoLock(mQuickStopLock);
 
     // Enable quick stop mode.
@@ -105,7 +105,7 @@
 bool CameraSourceTimeLapse::trySettingVideoSize(
         int32_t width, int32_t height) {
 
-    LOGV("trySettingVideoSize");
+    ALOGV("trySettingVideoSize");
     int64_t token = IPCThreadState::self()->clearCallingIdentity();
     String8 s = mCamera->getParameters();
 
@@ -131,7 +131,7 @@
 
     bool isSuccessful = false;
     if (videoSizeSupported) {
-        LOGV("Video size (%d, %d) is supported", width, height);
+        ALOGV("Video size (%d, %d) is supported", width, height);
         if (videoOutputSupported) {
             params.setVideoSize(width, height);
         } else {
@@ -140,7 +140,7 @@
         if (mCamera->setParameters(params.flatten()) == OK) {
             isSuccessful = true;
         } else {
-            LOGE("Failed to set preview size to %dx%d", width, height);
+            ALOGE("Failed to set preview size to %dx%d", width, height);
             isSuccessful = false;
         }
     }
@@ -150,7 +150,7 @@
 }
 
 void CameraSourceTimeLapse::signalBufferReturned(MediaBuffer* buffer) {
-    LOGV("signalBufferReturned");
+    ALOGV("signalBufferReturned");
     Mutex::Autolock autoLock(mQuickStopLock);
     if (mQuickStop && (buffer == mLastReadBufferCopy)) {
         buffer->setObserver(NULL);
@@ -165,7 +165,7 @@
         int64_t frameTime,
         MediaBuffer **newBuffer) {
 
-    LOGV("createMediaBufferCopy");
+    ALOGV("createMediaBufferCopy");
     size_t sourceSize = sourceBuffer.size();
     void* sourcePointer = sourceBuffer.data();
 
@@ -176,7 +176,7 @@
 }
 
 void CameraSourceTimeLapse::fillLastReadBufferCopy(MediaBuffer& sourceBuffer) {
-    LOGV("fillLastReadBufferCopy");
+    ALOGV("fillLastReadBufferCopy");
     int64_t frameTime;
     CHECK(sourceBuffer.meta_data()->findInt64(kKeyTime, &frameTime));
     createMediaBufferCopy(sourceBuffer, frameTime, &mLastReadBufferCopy);
@@ -186,7 +186,7 @@
 
 status_t CameraSourceTimeLapse::read(
         MediaBuffer **buffer, const ReadOptions *options) {
-    LOGV("read");
+    ALOGV("read");
     if (mLastReadBufferCopy == NULL) {
         mLastReadStatus = CameraSource::read(buffer, options);
 
@@ -205,7 +205,7 @@
 }
 
 void CameraSourceTimeLapse::stopCameraRecording() {
-    LOGV("stopCameraRecording");
+    ALOGV("stopCameraRecording");
     CameraSource::stopCameraRecording();
     if (mLastReadBufferCopy) {
         mLastReadBufferCopy->release();
@@ -216,7 +216,7 @@
 sp<IMemory> CameraSourceTimeLapse::createIMemoryCopy(
         const sp<IMemory> &source_data) {
 
-    LOGV("createIMemoryCopy");
+    ALOGV("createIMemoryCopy");
     size_t source_size = source_data->size();
     void* source_pointer = source_data->pointer();
 
@@ -227,7 +227,7 @@
 }
 
 bool CameraSourceTimeLapse::skipCurrentFrame(int64_t timestampUs) {
-    LOGV("skipCurrentFrame");
+    ALOGV("skipCurrentFrame");
     if (mSkipCurrentFrame) {
         mSkipCurrentFrame = false;
         return true;
@@ -237,11 +237,11 @@
 }
 
 bool CameraSourceTimeLapse::skipFrameAndModifyTimeStamp(int64_t *timestampUs) {
-    LOGV("skipFrameAndModifyTimeStamp");
+    ALOGV("skipFrameAndModifyTimeStamp");
     if (mLastTimeLapseFrameRealTimestampUs == 0) {
         // First time lapse frame. Initialize mLastTimeLapseFrameRealTimestampUs
         // to current time (timestampUs) and save frame data.
-        LOGV("dataCallbackTimestamp timelapse: initial frame");
+        ALOGV("dataCallbackTimestamp timelapse: initial frame");
 
         mLastTimeLapseFrameRealTimestampUs = *timestampUs;
         return false;
@@ -253,14 +253,14 @@
         // mForceRead may be set to true by startQuickReadReturns(). In that
         // case don't skip this frame.
         if (mForceRead) {
-            LOGV("dataCallbackTimestamp timelapse: forced read");
+            ALOGV("dataCallbackTimestamp timelapse: forced read");
             mForceRead = false;
             *timestampUs =
                 mLastFrameTimestampUs + mTimeBetweenTimeLapseVideoFramesUs;
 
             // Really make sure that this video recording frame will not be dropped.
             if (*timestampUs < mStartTimeUs) {
-                LOGI("set timestampUs to start time stamp %lld us", mStartTimeUs);
+                ALOGI("set timestampUs to start time stamp %lld us", mStartTimeUs);
                 *timestampUs = mStartTimeUs;
             }
             return false;
@@ -275,14 +275,14 @@
         // Skip all frames from last encoded frame until
         // sufficient time (mTimeBetweenFrameCaptureUs) has passed.
         // Tell the camera to release its recording frame and return.
-        LOGV("dataCallbackTimestamp timelapse: skipping intermediate frame");
+        ALOGV("dataCallbackTimestamp timelapse: skipping intermediate frame");
         return true;
     } else {
         // Desired frame has arrived after mTimeBetweenFrameCaptureUs time:
         // - Reset mLastTimeLapseFrameRealTimestampUs to current time.
         // - Artificially modify timestampUs to be one frame time (1/framerate) ahead
         // of the last encoded frame's time stamp.
-        LOGV("dataCallbackTimestamp timelapse: got timelapse frame");
+        ALOGV("dataCallbackTimestamp timelapse: got timelapse frame");
 
         mLastTimeLapseFrameRealTimestampUs = *timestampUs;
         *timestampUs = mLastFrameTimestampUs + mTimeBetweenTimeLapseVideoFramesUs;
@@ -293,7 +293,7 @@
 
 void CameraSourceTimeLapse::dataCallbackTimestamp(int64_t timestampUs, int32_t msgType,
             const sp<IMemory> &data) {
-    LOGV("dataCallbackTimestamp");
+    ALOGV("dataCallbackTimestamp");
     mSkipCurrentFrame = skipFrameAndModifyTimeStamp(&timestampUs);
     CameraSource::dataCallbackTimestamp(timestampUs, msgType, data);
 }
diff --git a/media/libstagefright/DRMExtractor.cpp b/media/libstagefright/DRMExtractor.cpp
index 1f3d581..9452ab1 100644
--- a/media/libstagefright/DRMExtractor.cpp
+++ b/media/libstagefright/DRMExtractor.cpp
@@ -286,7 +286,7 @@
             *mimeType = String8("drm+es_based+") + decryptHandle->mimeType;
         } else if (decryptHandle->decryptApiType == DecryptApiType::WV_BASED) {
             *mimeType = MEDIA_MIMETYPE_CONTAINER_WVM;
-            LOGW("SniffWVM: found match\n");
+            ALOGW("SniffWVM: found match\n");
         }
         *confidence = 10.0f;
 
diff --git a/media/libstagefright/ESDS.cpp b/media/libstagefright/ESDS.cpp
index 1f7ee25..4a0c35c 100644
--- a/media/libstagefright/ESDS.cpp
+++ b/media/libstagefright/ESDS.cpp
@@ -91,7 +91,7 @@
     }
     while (more);
 
-    LOGV("tag=0x%02x data_size=%d", *tag, *data_size);
+    ALOGV("tag=0x%02x data_size=%d", *tag, *data_size);
 
     if (*data_size > size) {
         return ERROR_MALFORMED;
@@ -162,7 +162,7 @@
             offset -= 2;
             size += 2;
 
-            LOGW("Found malformed 'esds' atom, ignoring missing OCR_ES_Id.");
+            ALOGW("Found malformed 'esds' atom, ignoring missing OCR_ES_Id.");
         }
     }
 
diff --git a/media/libstagefright/FLACExtractor.cpp b/media/libstagefright/FLACExtractor.cpp
index 8ba5a2d..668d7f7 100644
--- a/media/libstagefright/FLACExtractor.cpp
+++ b/media/libstagefright/FLACExtractor.cpp
@@ -327,7 +327,7 @@
         mWriteCompleted = true;
         return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
     } else {
-        LOGE("FLACParser::writeCallback unexpected");
+        ALOGE("FLACParser::writeCallback unexpected");
         return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
     }
 }
@@ -340,7 +340,7 @@
             mStreamInfo = metadata->data.stream_info;
             mStreamInfoValid = true;
         } else {
-            LOGE("FLACParser::metadataCallback unexpected STREAMINFO");
+            ALOGE("FLACParser::metadataCallback unexpected STREAMINFO");
         }
         break;
     case FLAC__METADATA_TYPE_VORBIS_COMMENT:
@@ -366,14 +366,14 @@
         }
         break;
     default:
-        LOGW("FLACParser::metadataCallback unexpected type %u", metadata->type);
+        ALOGW("FLACParser::metadataCallback unexpected type %u", metadata->type);
         break;
     }
 }
 
 void FLACParser::errorCallback(FLAC__StreamDecoderErrorStatus status)
 {
-    LOGE("FLACParser::errorCallback status=%d", status);
+    ALOGE("FLACParser::errorCallback status=%d", status);
     mErrorStatus = status;
 }
 
@@ -454,7 +454,7 @@
       mWriteBuffer(NULL),
       mErrorStatus((FLAC__StreamDecoderErrorStatus) -1)
 {
-    LOGV("FLACParser::FLACParser");
+    ALOGV("FLACParser::FLACParser");
     memset(&mStreamInfo, 0, sizeof(mStreamInfo));
     memset(&mWriteHeader, 0, sizeof(mWriteHeader));
     mInitCheck = init();
@@ -462,7 +462,7 @@
 
 FLACParser::~FLACParser()
 {
-    LOGV("FLACParser::~FLACParser");
+    ALOGV("FLACParser::~FLACParser");
     if (mDecoder != NULL) {
         FLAC__stream_decoder_delete(mDecoder);
         mDecoder = NULL;
@@ -477,7 +477,7 @@
         // The new should succeed, since probably all it does is a malloc
         // that always succeeds in Android.  But to avoid dependence on the
         // libFLAC internals, we check and log here.
-        LOGE("new failed");
+        ALOGE("new failed");
         return NO_INIT;
     }
     FLAC__stream_decoder_set_md5_checking(mDecoder, false);
@@ -497,12 +497,12 @@
     if (initStatus != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
         // A failure here probably indicates a programming error and so is
         // unlikely to happen. But we check and log here similarly to above.
-        LOGE("init_stream failed %d", initStatus);
+        ALOGE("init_stream failed %d", initStatus);
         return NO_INIT;
     }
     // parse all metadata
     if (!FLAC__stream_decoder_process_until_end_of_metadata(mDecoder)) {
-        LOGE("end_of_metadata failed");
+        ALOGE("end_of_metadata failed");
         return NO_INIT;
     }
     if (mStreamInfoValid) {
@@ -512,7 +512,7 @@
         case 2:
             break;
         default:
-            LOGE("unsupported channel count %u", getChannels());
+            ALOGE("unsupported channel count %u", getChannels());
             return NO_INIT;
         }
         // check bit depth
@@ -522,7 +522,7 @@
         case 24:
             break;
         default:
-            LOGE("unsupported bits per sample %u", getBitsPerSample());
+            ALOGE("unsupported bits per sample %u", getBitsPerSample());
             return NO_INIT;
         }
         // check sample rate
@@ -539,7 +539,7 @@
             break;
         default:
             // 96000 would require a proper downsampler in AudioFlinger
-            LOGE("unsupported sample rate %u", getSampleRate());
+            ALOGE("unsupported sample rate %u", getSampleRate());
             return NO_INIT;
         }
         // configure the appropriate copy function, defaulting to trespass
@@ -572,7 +572,7 @@
                     (getTotalSamples() * 1000000LL) / getSampleRate());
         }
     } else {
-        LOGE("missing STREAMINFO");
+        ALOGE("missing STREAMINFO");
         return NO_INIT;
     }
     if (mFileMetadata != 0) {
@@ -603,30 +603,30 @@
     if (doSeek) {
         // We implement the seek callback, so this works without explicit flush
         if (!FLAC__stream_decoder_seek_absolute(mDecoder, sample)) {
-            LOGE("FLACParser::readBuffer seek to sample %llu failed", sample);
+            ALOGE("FLACParser::readBuffer seek to sample %llu failed", sample);
             return NULL;
         }
-        LOGV("FLACParser::readBuffer seek to sample %llu succeeded", sample);
+        ALOGV("FLACParser::readBuffer seek to sample %llu succeeded", sample);
     } else {
         if (!FLAC__stream_decoder_process_single(mDecoder)) {
-            LOGE("FLACParser::readBuffer process_single failed");
+            ALOGE("FLACParser::readBuffer process_single failed");
             return NULL;
         }
     }
     if (!mWriteCompleted) {
-        LOGV("FLACParser::readBuffer write did not complete");
+        ALOGV("FLACParser::readBuffer write did not complete");
         return NULL;
     }
     // verify that block header keeps the promises made by STREAMINFO
     unsigned blocksize = mWriteHeader.blocksize;
     if (blocksize == 0 || blocksize > getMaxBlockSize()) {
-        LOGE("FLACParser::readBuffer write invalid blocksize %u", blocksize);
+        ALOGE("FLACParser::readBuffer write invalid blocksize %u", blocksize);
         return NULL;
     }
     if (mWriteHeader.sample_rate != getSampleRate() ||
         mWriteHeader.channels != getChannels() ||
         mWriteHeader.bits_per_sample != getBitsPerSample()) {
-        LOGE("FLACParser::readBuffer write changed parameters mid-stream");
+        ALOGE("FLACParser::readBuffer write changed parameters mid-stream");
     }
     // acquire a media buffer
     CHECK(mGroup != NULL);
@@ -661,13 +661,13 @@
       mInitCheck(false),
       mStarted(false)
 {
-    LOGV("FLACSource::FLACSource");
+    ALOGV("FLACSource::FLACSource");
     mInitCheck = init();
 }
 
 FLACSource::~FLACSource()
 {
-    LOGV("~FLACSource::FLACSource");
+    ALOGV("~FLACSource::FLACSource");
     if (mStarted) {
         stop();
     }
@@ -675,7 +675,7 @@
 
 status_t FLACSource::start(MetaData *params)
 {
-    LOGV("FLACSource::start");
+    ALOGV("FLACSource::start");
 
     CHECK(!mStarted);
     mParser->allocateBuffers();
@@ -686,7 +686,7 @@
 
 status_t FLACSource::stop()
 {
-    LOGV("FLACSource::stop");
+    ALOGV("FLACSource::stop");
 
     CHECK(mStarted);
     mParser->releaseBuffers();
@@ -729,7 +729,7 @@
 
 status_t FLACSource::init()
 {
-    LOGV("FLACSource::init");
+    ALOGV("FLACSource::init");
     // re-use the same track metadata passed into constructor from FLACExtractor
     mParser = new FLACParser(mDataSource);
     return mParser->initCheck();
@@ -742,13 +742,13 @@
     : mDataSource(dataSource),
       mInitCheck(false)
 {
-    LOGV("FLACExtractor::FLACExtractor");
+    ALOGV("FLACExtractor::FLACExtractor");
     mInitCheck = init();
 }
 
 FLACExtractor::~FLACExtractor()
 {
-    LOGV("~FLACExtractor::FLACExtractor");
+    ALOGV("~FLACExtractor::FLACExtractor");
 }
 
 size_t FLACExtractor::countTracks()
diff --git a/media/libstagefright/FileSource.cpp b/media/libstagefright/FileSource.cpp
index 0794f57..73cb48c 100644
--- a/media/libstagefright/FileSource.cpp
+++ b/media/libstagefright/FileSource.cpp
@@ -101,7 +101,7 @@
    } else {
         off64_t result = lseek64(mFd, offset + mOffset, SEEK_SET);
         if (result == -1) {
-            LOGE("seek to %lld failed", offset + mOffset);
+            ALOGE("seek to %lld failed", offset + mOffset);
             return UNKNOWN_ERROR;
         }
 
diff --git a/media/libstagefright/HTTPBase.cpp b/media/libstagefright/HTTPBase.cpp
index 3c5a8a5..d7eea3f 100644
--- a/media/libstagefright/HTTPBase.cpp
+++ b/media/libstagefright/HTTPBase.cpp
@@ -111,11 +111,11 @@
     if (freqMs < kMinBandwidthCollectFreqMs
             || freqMs > kMaxBandwidthCollectFreqMs) {
 
-        LOGE("frequency (%d ms) is out of range [1000, 60000]", freqMs);
+        ALOGE("frequency (%d ms) is out of range [1000, 60000]", freqMs);
         return BAD_VALUE;
     }
 
-    LOGI("frequency set to %d ms", freqMs);
+    ALOGI("frequency set to %d ms", freqMs);
     mBandWidthCollectFreqMs = freqMs;
     return OK;
 }
@@ -139,7 +139,7 @@
 void HTTPBase::RegisterSocketUserTag(int sockfd, uid_t uid, uint32_t kTag) {
     int res = qtaguid_tagSocket(sockfd, kTag, uid);
     if (res != 0) {
-        LOGE("Failed tagging socket %d for uid %d (My UID=%d)", sockfd, uid, geteuid());
+        ALOGE("Failed tagging socket %d for uid %d (My UID=%d)", sockfd, uid, geteuid());
     }
 }
 
@@ -147,7 +147,7 @@
 void HTTPBase::UnRegisterSocketUserTag(int sockfd) {
     int res = qtaguid_untagSocket(sockfd);
     if (res != 0) {
-        LOGE("Failed untagging socket %d (My UID=%d)", sockfd, geteuid());
+        ALOGE("Failed untagging socket %d (My UID=%d)", sockfd, geteuid());
     }
 }
 
diff --git a/media/libstagefright/MP3Extractor.cpp b/media/libstagefright/MP3Extractor.cpp
index 34e9cd7..2215c07 100644
--- a/media/libstagefright/MP3Extractor.cpp
+++ b/media/libstagefright/MP3Extractor.cpp
@@ -81,7 +81,7 @@
 
             *inout_pos += len;
 
-            LOGV("skipped ID3 tag, new starting offset is %lld (0x%016llx)",
+            ALOGV("skipped ID3 tag, new starting offset is %lld (0x%016llx)",
                  *inout_pos, *inout_pos);
         }
 
@@ -105,7 +105,7 @@
     do {
         if (pos >= *inout_pos + kMaxBytesChecked) {
             // Don't scan forever.
-            LOGV("giving up at offset %lld", pos);
+            ALOGV("giving up at offset %lld", pos);
             break;
         }
 
@@ -155,7 +155,7 @@
             continue;
         }
 
-        LOGV("found possible 1st frame at %lld (header = 0x%08x)", pos, header);
+        ALOGV("found possible 1st frame at %lld (header = 0x%08x)", pos, header);
 
         // We found what looks like a valid frame,
         // now find its successors.
@@ -172,7 +172,7 @@
 
             uint32_t test_header = U32_AT(tmp);
 
-            LOGV("subsequent header is %08x", test_header);
+            ALOGV("subsequent header is %08x", test_header);
 
             if ((test_header & kMask) != (header & kMask)) {
                 valid = false;
@@ -186,7 +186,7 @@
                 break;
             }
 
-            LOGV("found subsequent frame #%d at %lld", j + 2, test_pos);
+            ALOGV("found subsequent frame #%d at %lld", j + 2, test_pos);
 
             test_pos += test_frame_size;
         }
@@ -198,7 +198,7 @@
                 *out_header = header;
             }
         } else {
-            LOGV("no dice, no valid sequence of frames found.");
+            ALOGV("no dice, no valid sequence of frames found.");
         }
 
         ++pos;
@@ -431,7 +431,7 @@
             int32_t bitrate;
             if (!mMeta->findInt32(kKeyBitRate, &bitrate)) {
                 // bitrate is in bits/sec.
-                LOGI("no bitrate");
+                ALOGI("no bitrate");
 
                 return ERROR_UNSUPPORTED;
             }
@@ -483,11 +483,11 @@
         }
 
         // Lost sync.
-        LOGV("lost sync! header = 0x%08x, old header = 0x%08x\n", header, mFixedHeader);
+        ALOGV("lost sync! header = 0x%08x, old header = 0x%08x\n", header, mFixedHeader);
 
         off64_t pos = mCurrentPos;
         if (!Resync(mDataSource, mFixedHeader, &pos, NULL, NULL)) {
-            LOGE("Unable to resync. Signalling end of stream.");
+            ALOGE("Unable to resync. Signalling end of stream.");
 
             buffer->release();
             buffer = NULL;
diff --git a/media/libstagefright/MPEG2TSWriter.cpp b/media/libstagefright/MPEG2TSWriter.cpp
index 02eeb40..36009ab 100644
--- a/media/libstagefright/MPEG2TSWriter.cpp
+++ b/media/libstagefright/MPEG2TSWriter.cpp
@@ -644,7 +644,7 @@
                 CHECK(source->lastAccessUnit() == NULL);
                 source->setLastAccessUnit(buffer);
 
-                LOGV("lastAccessUnitTimeUs[%d] = %.2f secs",
+                ALOGV("lastAccessUnitTimeUs[%d] = %.2f secs",
                      sourceIndex, source->lastAccessUnitTimeUs() / 1E6);
 
                 int64_t minTimeUs = -1;
@@ -668,11 +668,11 @@
                 }
 
                 if (minTimeUs < 0) {
-                    LOGV("not a all tracks have valid data.");
+                    ALOGV("not a all tracks have valid data.");
                     break;
                 }
 
-                LOGV("writing access unit at time %.2f secs (index %d)",
+                ALOGV("writing access unit at time %.2f secs (index %d)",
                      minTimeUs / 1E6, minIndex);
 
                 source = mSources.editItemAt(minIndex);
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index f6b06c7..22bdd95 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -683,7 +683,7 @@
         case FOURCC('i', 'l', 's', 't'):
         {
             if (chunk_type == FOURCC('s', 't', 'b', 'l')) {
-                LOGV("sampleTable chunk is %d bytes long.", (size_t)chunk_size);
+                ALOGV("sampleTable chunk is %d bytes long.", (size_t)chunk_size);
 
                 if (mDataSource->flags()
                         & (DataSource::kWantsPrefetching
@@ -1250,7 +1250,7 @@
             char buffer[23];
             if (chunk_data_size != 7 &&
                 chunk_data_size != 23) {
-                LOGE("Incorrect D263 box size %lld", chunk_data_size);
+                ALOGE("Incorrect D263 box size %lld", chunk_data_size);
                 return ERROR_MALFORMED;
             }
 
@@ -1417,7 +1417,7 @@
         case FOURCC('c', 'o', 'v', 'r'):
         {
             if (mFileMetaData != NULL) {
-                LOGV("chunk_data_size = %lld and data_offset = %lld",
+                ALOGV("chunk_data_size = %lld and data_offset = %lld",
                         chunk_data_size, data_offset);
                 uint8_t *buffer = new uint8_t[chunk_data_size + 1];
                 if (mDataSource->readAt(
@@ -1499,9 +1499,9 @@
     int32_t dy = U32_AT(&buffer[matrixOffset + 20]);
 
 #if 0
-    LOGI("x' = %.2f * x + %.2f * y + %.2f",
+    ALOGI("x' = %.2f * x + %.2f * y + %.2f",
          a00 / 65536.0f, a01 / 65536.0f, dx / 65536.0f);
-    LOGI("y' = %.2f * x + %.2f * y + %.2f",
+    ALOGI("y' = %.2f * x + %.2f * y + %.2f",
          a10 / 65536.0f, a11 / 65536.0f, dy / 65536.0f);
 #endif
 
@@ -1518,7 +1518,7 @@
     } else if (a00 == -kFixedOne && a01 == 0 && a10 == 0 && a11 == -kFixedOne) {
         rotationDegrees = 180;
     } else {
-        LOGW("We only support 0,90,180,270 degree rotation matrices");
+        ALOGW("We only support 0,90,180,270 degree rotation matrices");
         rotationDegrees = 0;
     }
 
@@ -1750,7 +1750,7 @@
         // The media subtype is MP3 audio
         // Our software MP3 audio decoder may not be able to handle
         // packetized MP3 audio; for now, lets just return ERROR_UNSUPPORTED
-        LOGE("MP3 track in MP4/3GPP file is not supported");
+        ALOGE("MP3 track in MP4/3GPP file is not supported");
         return ERROR_UNSUPPORTED;
     }
 
@@ -1820,7 +1820,7 @@
     CHECK(mLastTrack->meta->findInt32(kKeySampleRate, &prevSampleRate));
 
     if (prevSampleRate != sampleRate) {
-        LOGV("mpeg4 audio sample rate different from previous setting. "
+        ALOGV("mpeg4 audio sample rate different from previous setting. "
              "was: %d, now: %d", prevSampleRate, sampleRate);
     }
 
@@ -1830,7 +1830,7 @@
     CHECK(mLastTrack->meta->findInt32(kKeyChannelCount, &prevChannelCount));
 
     if (prevChannelCount != numChannels) {
-        LOGV("mpeg4 audio channel count different from previous setting. "
+        ALOGV("mpeg4 audio channel count different from previous setting. "
              "was: %d, now: %d", prevChannelCount, numChannels);
     }
 
@@ -2035,7 +2035,7 @@
         CHECK_EQ(OK, mSampleTable->getMetaDataForSample(
                     syncSampleIndex, NULL, NULL, &syncSampleTime));
 
-        LOGI("seek to time %lld us => sample at time %lld us, "
+        ALOGI("seek to time %lld us => sample at time %lld us, "
              "sync sample at time %lld us",
              seekTimeUs,
              sampleTime * 1000000ll / mTimescale,
@@ -2122,7 +2122,7 @@
 
         size_t nal_size = parseNALSize(src);
         if (mBuffer->range_length() < mNALLengthSize + nal_size) {
-            LOGE("incomplete NAL unit.");
+            ALOGE("incomplete NAL unit.");
 
             mBuffer->release();
             mBuffer = NULL;
@@ -2186,7 +2186,7 @@
                 }
 
                 if (isMalFormed) {
-                    LOGE("Video is malformed");
+                    ALOGE("Video is malformed");
                     mBuffer->release();
                     mBuffer = NULL;
                     return ERROR_MALFORMED;
@@ -2407,7 +2407,7 @@
         *meta = new AMessage;
         (*meta)->setInt64("meta-data-size", moovAtomEndOffset);
 
-        LOGV("found metadata size: %lld", moovAtomEndOffset);
+        ALOGV("found metadata size: %lld", moovAtomEndOffset);
     }
 
     return true;
@@ -2421,7 +2421,7 @@
     }
 
     if (LegacySniffMPEG4(source, mimeType, confidence)) {
-        LOGW("Identified supported mpeg4 through LegacySniffMPEG4.");
+        ALOGW("Identified supported mpeg4 through LegacySniffMPEG4.");
         return true;
     }
 
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index 46d87df..06dd875 100755
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -327,7 +327,7 @@
 status_t MPEG4Writer::addSource(const sp<MediaSource> &source) {
     Mutex::Autolock l(mLock);
     if (mStarted) {
-        LOGE("Attempt to add source AFTER recording is started");
+        ALOGE("Attempt to add source AFTER recording is started");
         return UNKNOWN_ERROR;
     }
     Track *track = new Track(this, source, mTracks.size());
@@ -406,7 +406,7 @@
         size = MAX_MOOV_BOX_SIZE;
     }
 
-    LOGI("limits: %lld/%lld bytes/us, bit rate: %d bps and the estimated"
+    ALOGI("limits: %lld/%lld bytes/us, bit rate: %d bps and the estimated"
          " moov size %lld bytes",
          mMaxFileSizeLimitBytes, mMaxFileDurationLimitUs, bitRate, size);
     return factor * size;
@@ -443,7 +443,7 @@
         // If file size is set to be larger than the 32 bit file
         // size limit, treat it as an error.
         if (mMaxFileSizeLimitBytes > kMax32BitFileSize) {
-            LOGW("32-bit file size limit (%lld bytes) too big. "
+            ALOGW("32-bit file size limit (%lld bytes) too big. "
                  "It is changed to %lld bytes",
                 mMaxFileSizeLimitBytes, kMax32BitFileSize);
             mMaxFileSizeLimitBytes = kMax32BitFileSize;
@@ -472,7 +472,7 @@
         mTimeScale = 1000;
     }
     CHECK(mTimeScale > 0);
-    LOGV("movie time scale: %d", mTimeScale);
+    ALOGV("movie time scale: %d", mTimeScale);
 
     mStreamableFile = true;
     mWriteMoovBoxToMemory = false;
@@ -539,7 +539,7 @@
 }
 
 void MPEG4Writer::stopWriterThread() {
-    LOGD("Stopping writer thread");
+    ALOGD("Stopping writer thread");
     if (!mWriterThreadStarted) {
         return;
     }
@@ -554,7 +554,7 @@
     void *dummy;
     pthread_join(mThread, &dummy);
     mWriterThreadStarted = false;
-    LOGD("Writer thread stopped");
+    ALOGD("Writer thread stopped");
 }
 
 /*
@@ -569,7 +569,7 @@
  * u, v and w is in 2.30 format.
  */
 void MPEG4Writer::writeCompositionMatrix(int degrees) {
-    LOGV("writeCompositionMatrix");
+    ALOGV("writeCompositionMatrix");
     uint32_t a = 0x00010000;
     uint32_t b = 0;
     uint32_t c = 0;
@@ -650,7 +650,7 @@
     }
 
     if (mTracks.size() > 1) {
-        LOGD("Duration from tracks range is [%lld, %lld] us",
+        ALOGD("Duration from tracks range is [%lld, %lld] us",
             minDurationUs, maxDurationUs);
     }
 
@@ -701,7 +701,7 @@
         mMoovBoxBuffer = NULL;
         mMoovBoxBufferOffset = 0;
     } else {
-        LOGI("The mp4 file will not be streamable.");
+        ALOGI("The mp4 file will not be streamable.");
     }
 
     CHECK(mBoxes.empty());
@@ -1084,12 +1084,12 @@
 }
 
 void MPEG4Writer::setStartTimestampUs(int64_t timeUs) {
-    LOGI("setStartTimestampUs: %lld", timeUs);
+    ALOGI("setStartTimestampUs: %lld", timeUs);
     CHECK(timeUs >= 0);
     Mutex::Autolock autoLock(mLock);
     if (mStartTimestampUs < 0 || mStartTimestampUs > timeUs) {
         mStartTimestampUs = timeUs;
-        LOGI("Earliest track starting time: %lld", mStartTimestampUs);
+        ALOGI("Earliest track starting time: %lld", mStartTimestampUs);
     }
 }
 
@@ -1173,7 +1173,7 @@
         size_t sampleCount, int32_t duration) {
 
     if (duration == 0) {
-        LOGW("0-duration samples found: %d", sampleCount);
+        ALOGW("0-duration samples found: %d", sampleCount);
     }
     SttsTableEntry sttsEntry(sampleCount, duration);
     mSttsTableEntries.push_back(sttsEntry);
@@ -1200,7 +1200,7 @@
 }
 
 void MPEG4Writer::Track::setTimeScale() {
-    LOGV("setTimeScale");
+    ALOGV("setTimeScale");
     // Default time scale
     mTimeScale = 90000;
 
@@ -1262,14 +1262,14 @@
 }
 
 void MPEG4Writer::Track::initTrackingProgressStatus(MetaData *params) {
-    LOGV("initTrackingProgressStatus");
+    ALOGV("initTrackingProgressStatus");
     mPreviousTrackTimeUs = -1;
     mTrackingProgressStatus = false;
     mTrackEveryTimeDurationUs = 0;
     {
         int64_t timeUs;
         if (params && params->findInt64(kKeyTrackTimeStatus, &timeUs)) {
-            LOGV("Receive request to track progress status for every %lld us", timeUs);
+            ALOGV("Receive request to track progress status for every %lld us", timeUs);
             mTrackEveryTimeDurationUs = timeUs;
             mTrackingProgressStatus = true;
         }
@@ -1278,14 +1278,14 @@
 
 // static
 void *MPEG4Writer::ThreadWrapper(void *me) {
-    LOGV("ThreadWrapper: %p", me);
+    ALOGV("ThreadWrapper: %p", me);
     MPEG4Writer *writer = static_cast<MPEG4Writer *>(me);
     writer->threadFunc();
     return NULL;
 }
 
 void MPEG4Writer::bufferChunk(const Chunk& chunk) {
-    LOGV("bufferChunk: %p", chunk.mTrack);
+    ALOGV("bufferChunk: %p", chunk.mTrack);
     Mutex::Autolock autolock(mLock);
     CHECK_EQ(mDone, false);
 
@@ -1303,7 +1303,7 @@
 }
 
 void MPEG4Writer::writeChunkToFile(Chunk* chunk) {
-    LOGV("writeChunkToFile: %lld from %s track",
+    ALOGV("writeChunkToFile: %lld from %s track",
         chunk->mTimeStampUs, chunk->mTrack->isAudio()? "audio": "video");
 
     int32_t isFirstSample = true;
@@ -1327,7 +1327,7 @@
 }
 
 void MPEG4Writer::writeAllChunks() {
-    LOGV("writeAllChunks");
+    ALOGV("writeAllChunks");
     size_t outstandingChunks = 0;
     Chunk chunk;
     while (findChunkToWrite(&chunk)) {
@@ -1338,11 +1338,11 @@
     sendSessionSummary();
 
     mChunkInfos.clear();
-    LOGD("%d chunks are written in the last batch", outstandingChunks);
+    ALOGD("%d chunks are written in the last batch", outstandingChunks);
 }
 
 bool MPEG4Writer::findChunkToWrite(Chunk *chunk) {
-    LOGV("findChunkToWrite");
+    ALOGV("findChunkToWrite");
 
     int64_t minTimestampUs = 0x7FFFFFFFFFFFFFFFLL;
     Track *track = NULL;
@@ -1358,7 +1358,7 @@
     }
 
     if (track == NULL) {
-        LOGV("Nothing to be written after all");
+        ALOGV("Nothing to be written after all");
         return false;
     }
 
@@ -1387,7 +1387,7 @@
 }
 
 void MPEG4Writer::threadFunc() {
-    LOGV("threadFunc");
+    ALOGV("threadFunc");
 
     prctl(PR_SET_NAME, (unsigned long)"MPEG4Writer", 0, 0, 0);
 
@@ -1413,7 +1413,7 @@
 }
 
 status_t MPEG4Writer::startWriterThread() {
-    LOGV("startWriterThread");
+    ALOGV("startWriterThread");
 
     mDone = false;
     mIsFirstChunk = true;
@@ -1481,7 +1481,7 @@
             startTimeOffsetUs = kInitialDelayTimeUs;
         }
         startTimeUs += startTimeOffsetUs;
-        LOGI("Start time offset: %lld us", startTimeOffsetUs);
+        ALOGI("Start time offset: %lld us", startTimeOffsetUs);
     }
 
     meta->setInt64(kKeyTime, startTimeUs);
@@ -1523,9 +1523,9 @@
 }
 
 status_t MPEG4Writer::Track::stop() {
-    LOGD("Stopping %s track", mIsAudio? "Audio": "Video");
+    ALOGD("Stopping %s track", mIsAudio? "Audio": "Video");
     if (!mStarted) {
-        LOGE("Stop() called but track is not started");
+        ALOGE("Stop() called but track is not started");
         return ERROR_END_OF_STREAM;
     }
 
@@ -1539,7 +1539,7 @@
 
     status_t err = (status_t) dummy;
 
-    LOGD("Stopping %s track source", mIsAudio? "Audio": "Video");
+    ALOGD("Stopping %s track source", mIsAudio? "Audio": "Video");
     {
         status_t status = mSource->stop();
         if (err == OK && status != OK && status != ERROR_END_OF_STREAM) {
@@ -1547,7 +1547,7 @@
         }
     }
 
-    LOGD("%s track stopped", mIsAudio? "Audio": "Video");
+    ALOGD("%s track stopped", mIsAudio? "Audio": "Video");
     return err;
 }
 
@@ -1564,7 +1564,7 @@
 }
 
 static void getNalUnitType(uint8_t byte, uint8_t* type) {
-    LOGV("getNalUnitType: %d", byte);
+    ALOGV("getNalUnitType: %d", byte);
 
     // nal_unit_type: 5-bit unsigned integer
     *type = (byte & 0x1F);
@@ -1573,7 +1573,7 @@
 static const uint8_t *findNextStartCode(
         const uint8_t *data, size_t length) {
 
-    LOGV("findNextStartCode: %p %d", data, length);
+    ALOGV("findNextStartCode: %p %d", data, length);
 
     size_t bytesLeft = length;
     while (bytesLeft > 4  &&
@@ -1589,21 +1589,21 @@
 const uint8_t *MPEG4Writer::Track::parseParamSet(
         const uint8_t *data, size_t length, int type, size_t *paramSetLen) {
 
-    LOGV("parseParamSet");
+    ALOGV("parseParamSet");
     CHECK(type == kNalUnitTypeSeqParamSet ||
           type == kNalUnitTypePicParamSet);
 
     const uint8_t *nextStartCode = findNextStartCode(data, length);
     *paramSetLen = nextStartCode - data;
     if (*paramSetLen == 0) {
-        LOGE("Param set is malformed, since its length is 0");
+        ALOGE("Param set is malformed, since its length is 0");
         return NULL;
     }
 
     AVCParamSet paramSet(*paramSetLen, data);
     if (type == kNalUnitTypeSeqParamSet) {
         if (*paramSetLen < 4) {
-            LOGE("Seq parameter set malformed");
+            ALOGE("Seq parameter set malformed");
             return NULL;
         }
         if (mSeqParamSets.empty()) {
@@ -1614,7 +1614,7 @@
             if (mProfileIdc != data[1] ||
                 mProfileCompatible != data[2] ||
                 mLevelIdc != data[3]) {
-                LOGE("Inconsistent profile/level found in seq parameter sets");
+                ALOGE("Inconsistent profile/level found in seq parameter sets");
                 return NULL;
             }
         }
@@ -1627,12 +1627,12 @@
 
 status_t MPEG4Writer::Track::copyAVCCodecSpecificData(
         const uint8_t *data, size_t size) {
-    LOGV("copyAVCCodecSpecificData");
+    ALOGV("copyAVCCodecSpecificData");
 
     // 2 bytes for each of the parameter set length field
     // plus the 7 bytes for the header
     if (size < 4 + 7) {
-        LOGE("Codec specific data length too short: %d", size);
+        ALOGE("Codec specific data length too short: %d", size);
         return ERROR_MALFORMED;
     }
 
@@ -1645,7 +1645,7 @@
 status_t MPEG4Writer::Track::parseAVCCodecSpecificData(
         const uint8_t *data, size_t size) {
 
-    LOGV("parseAVCCodecSpecificData");
+    ALOGV("parseAVCCodecSpecificData");
     // Data starts with a start code.
     // SPS and PPS are separated with start codes.
     // Also, SPS must come before PPS
@@ -1661,7 +1661,7 @@
         getNalUnitType(*(tmp + 4), &type);
         if (type == kNalUnitTypeSeqParamSet) {
             if (gotPps) {
-                LOGE("SPS must come before PPS");
+                ALOGE("SPS must come before PPS");
                 return ERROR_MALFORMED;
             }
             if (!gotSps) {
@@ -1670,7 +1670,7 @@
             nextStartCode = parseParamSet(tmp + 4, bytesLeft - 4, type, &paramSetLen);
         } else if (type == kNalUnitTypePicParamSet) {
             if (!gotSps) {
-                LOGE("SPS must come before PPS");
+                ALOGE("SPS must come before PPS");
                 return ERROR_MALFORMED;
             }
             if (!gotPps) {
@@ -1678,7 +1678,7 @@
             }
             nextStartCode = parseParamSet(tmp + 4, bytesLeft - 4, type, &paramSetLen);
         } else {
-            LOGE("Only SPS and PPS Nal units are expected");
+            ALOGE("Only SPS and PPS Nal units are expected");
             return ERROR_MALFORMED;
         }
 
@@ -1696,12 +1696,12 @@
         // Check on the number of seq parameter sets
         size_t nSeqParamSets = mSeqParamSets.size();
         if (nSeqParamSets == 0) {
-            LOGE("Cound not find sequence parameter set");
+            ALOGE("Cound not find sequence parameter set");
             return ERROR_MALFORMED;
         }
 
         if (nSeqParamSets > 0x1F) {
-            LOGE("Too many seq parameter sets (%d) found", nSeqParamSets);
+            ALOGE("Too many seq parameter sets (%d) found", nSeqParamSets);
             return ERROR_MALFORMED;
         }
     }
@@ -1710,11 +1710,11 @@
         // Check on the number of pic parameter sets
         size_t nPicParamSets = mPicParamSets.size();
         if (nPicParamSets == 0) {
-            LOGE("Cound not find picture parameter set");
+            ALOGE("Cound not find picture parameter set");
             return ERROR_MALFORMED;
         }
         if (nPicParamSets > 0xFF) {
-            LOGE("Too many pic parameter sets (%d) found", nPicParamSets);
+            ALOGE("Too many pic parameter sets (%d) found", nPicParamSets);
             return ERROR_MALFORMED;
         }
     }
@@ -1727,7 +1727,7 @@
         // These profiles requires additional parameter set extensions
         if (mProfileIdc == 100 || mProfileIdc == 110 ||
             mProfileIdc == 122 || mProfileIdc == 144) {
-            LOGE("Sorry, no support for profile_idc: %d!", mProfileIdc);
+            ALOGE("Sorry, no support for profile_idc: %d!", mProfileIdc);
             return BAD_VALUE;
         }
     }
@@ -1739,12 +1739,12 @@
         const uint8_t *data, size_t size) {
 
     if (mCodecSpecificData != NULL) {
-        LOGE("Already have codec specific data");
+        ALOGE("Already have codec specific data");
         return ERROR_MALFORMED;
     }
 
     if (size < 4) {
-        LOGE("Codec specific data length too short: %d", size);
+        ALOGE("Codec specific data length too short: %d", size);
         return ERROR_MALFORMED;
     }
 
@@ -1987,7 +1987,7 @@
             int64_t timeUs = decodingTimeUs;
             cttsDeltaTimeUs = timestampUs - decodingTimeUs;
             timestampUs = decodingTimeUs;
-            LOGV("decoding time: %lld and ctts delta time: %lld",
+            ALOGV("decoding time: %lld and ctts delta time: %lld",
                 timestampUs, cttsDeltaTimeUs);
         }
 
@@ -1998,7 +1998,7 @@
         }
 
         CHECK(timestampUs >= 0);
-        LOGV("%s media time stamp: %lld and previous paused duration %lld",
+        ALOGV("%s media time stamp: %lld and previous paused duration %lld",
                 mIsAudio? "Audio": "Video", timestampUs, previousPausedDurationUs);
         if (timestampUs > mTrackDurationUs) {
             mTrackDurationUs = timestampUs;
@@ -2020,7 +2020,7 @@
             // Force the first sample to have its own stts entry so that
             // we can adjust its value later to maintain the A/V sync.
             if (mNumSamples == 3 || currDurationTicks != lastDurationTicks) {
-                LOGV("%s lastDurationUs: %lld us, currDurationTicks: %lld us",
+                ALOGV("%s lastDurationUs: %lld us, currDurationTicks: %lld us",
                         mIsAudio? "Audio": "Video", lastDurationUs, currDurationTicks);
                 addOneSttsTableEntry(sampleCount, lastDurationTicks);
                 sampleCount = 1;
@@ -2046,7 +2046,7 @@
             }
             previousSampleSize = sampleSize;
         }
-        LOGV("%s timestampUs/lastTimestampUs: %lld/%lld",
+        ALOGV("%s timestampUs/lastTimestampUs: %lld/%lld",
                 mIsAudio? "Audio": "Video", timestampUs, lastTimestampUs);
         lastDurationUs = timestampUs - lastTimestampUs;
         lastDurationTicks = currDurationTicks;
@@ -2146,10 +2146,10 @@
 
     sendTrackSummary(hasMultipleTracks);
 
-    LOGI("Received total/0-length (%d/%d) buffers and encoded %d frames. - %s",
+    ALOGI("Received total/0-length (%d/%d) buffers and encoded %d frames. - %s",
             count, nZeroLengthFrames, mNumSamples, mIsAudio? "audio": "video");
     if (mIsAudio) {
-        LOGI("Audio track drift time: %lld us", mOwner->getDriftTimeUs());
+        ALOGI("Audio track drift time: %lld us", mOwner->getDriftTimeUs());
     }
 
     if (err == ERROR_END_OF_STREAM) {
@@ -2160,12 +2160,12 @@
 
 bool MPEG4Writer::Track::isTrackMalFormed() const {
     if (mSampleSizes.empty()) {                      // no samples written
-        LOGE("The number of recorded samples is 0");
+        ALOGE("The number of recorded samples is 0");
         return true;
     }
 
     if (!mIsAudio && mNumStssTableEntries == 0) {  // no sync frames for video
-        LOGE("There are no sync frames for video track");
+        ALOGE("There are no sync frames for video track");
         return true;
     }
 
@@ -2232,10 +2232,10 @@
 }
 
 void MPEG4Writer::Track::trackProgressStatus(int64_t timeUs, status_t err) {
-    LOGV("trackProgressStatus: %lld us", timeUs);
+    ALOGV("trackProgressStatus: %lld us", timeUs);
     if (mTrackEveryTimeDurationUs > 0 &&
         timeUs - mPreviousTrackTimeUs >= mTrackEveryTimeDurationUs) {
-        LOGV("Fire time tracking progress status at %lld us", timeUs);
+        ALOGV("Fire time tracking progress status at %lld us", timeUs);
         mOwner->trackProgressStatus(mTrackId, timeUs - mPreviousTrackTimeUs, err);
         mPreviousTrackTimeUs = timeUs;
     }
@@ -2269,13 +2269,13 @@
 }
 
 void MPEG4Writer::setDriftTimeUs(int64_t driftTimeUs) {
-    LOGV("setDriftTimeUs: %lld us", driftTimeUs);
+    ALOGV("setDriftTimeUs: %lld us", driftTimeUs);
     Mutex::Autolock autolock(mLock);
     mDriftTimeUs = driftTimeUs;
 }
 
 int64_t MPEG4Writer::getDriftTimeUs() {
-    LOGV("getDriftTimeUs: %lld us", mDriftTimeUs);
+    ALOGV("getDriftTimeUs: %lld us", mDriftTimeUs);
     Mutex::Autolock autolock(mLock);
     return mDriftTimeUs;
 }
@@ -2285,7 +2285,7 @@
 }
 
 void MPEG4Writer::Track::bufferChunk(int64_t timestampUs) {
-    LOGV("bufferChunk");
+    ALOGV("bufferChunk");
 
     Chunk chunk(this, timestampUs, mChunkSamples);
     mOwner->bufferChunk(chunk);
@@ -2308,13 +2308,13 @@
         !strcasecmp(MEDIA_MIMETYPE_VIDEO_AVC, mime)) {
         if (!mCodecSpecificData ||
             mCodecSpecificDataSize <= 0) {
-            LOGE("Missing codec specific data");
+            ALOGE("Missing codec specific data");
             return ERROR_MALFORMED;
         }
     } else {
         if (mCodecSpecificData ||
             mCodecSpecificDataSize > 0) {
-            LOGE("Unexepected codec specific data found");
+            ALOGE("Unexepected codec specific data found");
             return ERROR_MALFORMED;
         }
     }
@@ -2323,7 +2323,7 @@
 
 void MPEG4Writer::Track::writeTrackHeader(bool use32BitOffset) {
 
-    LOGV("%s track time scale: %d",
+    ALOGV("%s track time scale: %d",
         mIsAudio? "Audio": "Video", mTimeScale);
 
     time_t now = time(NULL);
@@ -2378,7 +2378,7 @@
     } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_AVC, mime)) {
         mOwner->beginBox("avc1");
     } else {
-        LOGE("Unknown mime type '%s'.", mime);
+        ALOGE("Unknown mime type '%s'.", mime);
         CHECK(!"should not be here, unknown mime type.");
     }
 
@@ -2432,7 +2432,7 @@
     } else if (!strcasecmp(MEDIA_MIMETYPE_AUDIO_AAC, mime)) {
         fourcc = "mp4a";
     } else {
-        LOGE("Unknown mime type '%s'.", mime);
+        ALOGE("Unknown mime type '%s'.", mime);
         CHECK(!"should not be here, unknown mime type.");
     }
 
@@ -2730,7 +2730,7 @@
         return;
     }
 
-    LOGV("ctts box has %d entries", mNumCttsTableEntries);
+    ALOGV("ctts box has %d entries", mNumCttsTableEntries);
 
     mOwner->beginBox("ctts");
     if (mHasNegativeCttsDeltaDuration) {
diff --git a/media/libstagefright/MediaBuffer.cpp b/media/libstagefright/MediaBuffer.cpp
index 0b14f1e..96271e4 100644
--- a/media/libstagefright/MediaBuffer.cpp
+++ b/media/libstagefright/MediaBuffer.cpp
@@ -135,7 +135,7 @@
 
 void MediaBuffer::set_range(size_t offset, size_t length) {
     if ((mGraphicBuffer == NULL) && (offset + length > mSize)) {
-        LOGE("offset = %d, length = %d, mSize = %d", offset, length, mSize);
+        ALOGE("offset = %d, length = %d, mSize = %d", offset, length, mSize);
     }
     CHECK((mGraphicBuffer != NULL) || (offset + length <= mSize));
 
diff --git a/media/libstagefright/MediaExtractor.cpp b/media/libstagefright/MediaExtractor.cpp
index 374ecf7..7b17d65 100644
--- a/media/libstagefright/MediaExtractor.cpp
+++ b/media/libstagefright/MediaExtractor.cpp
@@ -58,13 +58,13 @@
     if (mime == NULL) {
         float confidence;
         if (!source->sniff(&tmp, &confidence, &meta)) {
-            LOGV("FAILED to autodetect media content.");
+            ALOGV("FAILED to autodetect media content.");
 
             return NULL;
         }
 
         mime = tmp.string();
-        LOGV("Autodetected media content as '%s' with confidence %.2f",
+        ALOGV("Autodetected media content as '%s' with confidence %.2f",
              mime, confidence);
     }
 
diff --git a/media/libstagefright/MediaSourceSplitter.cpp b/media/libstagefright/MediaSourceSplitter.cpp
index abc7012..8af0694 100644
--- a/media/libstagefright/MediaSourceSplitter.cpp
+++ b/media/libstagefright/MediaSourceSplitter.cpp
@@ -51,7 +51,7 @@
 status_t MediaSourceSplitter::start(int clientId, MetaData *params) {
     Mutex::Autolock autoLock(mLock);
 
-    LOGV("start client (%d)", clientId);
+    ALOGV("start client (%d)", clientId);
     if (mClientsStarted[clientId]) {
         return OK;
     }
@@ -59,7 +59,7 @@
     mNumberOfClientsStarted++;
 
     if (!mSourceStarted) {
-        LOGV("Starting real source from client (%d)", clientId);
+        ALOGV("Starting real source from client (%d)", clientId);
         status_t err = mSource->start(params);
 
         if (err == OK) {
@@ -85,12 +85,12 @@
 status_t MediaSourceSplitter::stop(int clientId) {
     Mutex::Autolock autoLock(mLock);
 
-    LOGV("stop client (%d)", clientId);
+    ALOGV("stop client (%d)", clientId);
     CHECK(clientId >= 0 && clientId < mNumberOfClients);
     CHECK(mClientsStarted[clientId]);
 
     if (--mNumberOfClientsStarted == 0) {
-        LOGV("Stopping real source from client (%d)", clientId);
+        ALOGV("Stopping real source from client (%d)", clientId);
         status_t err = mSource->stop();
         mSourceStarted = false;
         mClientsStarted.editItemAt(clientId) = false;
@@ -114,7 +114,7 @@
 sp<MetaData> MediaSourceSplitter::getFormat(int clientId) {
     Mutex::Autolock autoLock(mLock);
 
-    LOGV("getFormat client (%d)", clientId);
+    ALOGV("getFormat client (%d)", clientId);
     return mSource->getFormat();
 }
 
@@ -124,7 +124,7 @@
 
     CHECK(clientId >= 0 && clientId < mNumberOfClients);
 
-    LOGV("read client (%d)", clientId);
+    ALOGV("read client (%d)", clientId);
     *buffer = NULL;
 
     if (!mClientsStarted[clientId]) {
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp
index 1e1de04..249c298 100644
--- a/media/libstagefright/NuCachedSource2.cpp
+++ b/media/libstagefright/NuCachedSource2.cpp
@@ -135,7 +135,7 @@
 }
 
 void PageCache::copy(size_t from, void *data, size_t size) {
-    LOGV("copy from %d size %d", from, size);
+    ALOGV("copy from %d size %d", from, size);
 
     if (size == 0) {
         return;
@@ -277,7 +277,7 @@
 }
 
 void NuCachedSource2::fetchInternal() {
-    LOGV("fetchInternal");
+    ALOGV("fetchInternal");
 
     bool reconnect = false;
 
@@ -302,7 +302,7 @@
             mNumRetriesLeft = 0;
             return;
         } else if (err != OK) {
-            LOGI("The attempt to reconnect failed, %d retries remaining",
+            ALOGI("The attempt to reconnect failed, %d retries remaining",
                  mNumRetriesLeft);
 
             return;
@@ -317,11 +317,11 @@
     Mutex::Autolock autoLock(mLock);
 
     if (n < 0) {
-        LOGE("source returned error %ld, %d retries left", n, mNumRetriesLeft);
+        ALOGE("source returned error %ld, %d retries left", n, mNumRetriesLeft);
         mFinalStatus = n;
         mCache->releasePage(page);
     } else if (n == 0) {
-        LOGI("ERROR_END_OF_STREAM");
+        ALOGI("ERROR_END_OF_STREAM");
 
         mNumRetriesLeft = 0;
         mFinalStatus = ERROR_END_OF_STREAM;
@@ -329,7 +329,7 @@
         mCache->releasePage(page);
     } else {
         if (mFinalStatus != OK) {
-            LOGI("retrying a previously failed read succeeded.");
+            ALOGI("retrying a previously failed read succeeded.");
         }
         mNumRetriesLeft = kMaxNumRetries;
         mFinalStatus = OK;
@@ -340,10 +340,10 @@
 }
 
 void NuCachedSource2::onFetch() {
-    LOGV("onFetch");
+    ALOGV("onFetch");
 
     if (mFinalStatus != OK && mNumRetriesLeft == 0) {
-        LOGV("EOS reached, done prefetching for now");
+        ALOGV("EOS reached, done prefetching for now");
         mFetching = false;
     }
 
@@ -355,7 +355,7 @@
 
     if (mFetching || keepAlive) {
         if (keepAlive) {
-            LOGI("Keep alive");
+            ALOGI("Keep alive");
         }
 
         fetchInternal();
@@ -363,12 +363,12 @@
         mLastFetchTimeUs = ALooper::GetNowUs();
 
         if (mFetching && mCache->totalSize() >= mHighwaterThresholdBytes) {
-            LOGI("Cache full, done prefetching for now");
+            ALOGI("Cache full, done prefetching for now");
             mFetching = false;
 
             if (mDisconnectAtHighwatermark
                     && (mSource->flags() & DataSource::kIsHTTPBasedSource)) {
-                LOGV("Disconnecting at high watermark");
+                ALOGV("Disconnecting at high watermark");
                 static_cast<HTTPBase *>(mSource.get())->disconnect();
             }
         }
@@ -393,7 +393,7 @@
 }
 
 void NuCachedSource2::onRead(const sp<AMessage> &msg) {
-    LOGV("onRead");
+    ALOGV("onRead");
 
     int64_t offset;
     CHECK(msg->findInt64("offset", &offset));
@@ -448,14 +448,14 @@
     size_t actualBytes = mCache->releaseFromStart(maxBytes);
     mCacheOffset += actualBytes;
 
-    LOGI("restarting prefetcher, totalSize = %d", mCache->totalSize());
+    ALOGI("restarting prefetcher, totalSize = %d", mCache->totalSize());
     mFetching = true;
 }
 
 ssize_t NuCachedSource2::readAt(off64_t offset, void *data, size_t size) {
     Mutex::Autolock autoSerializer(mSerializer);
 
-    LOGV("readAt offset %lld, size %d", offset, size);
+    ALOGV("readAt offset %lld, size %d", offset, size);
 
     Mutex::Autolock autoLock(mLock);
 
@@ -523,7 +523,7 @@
 ssize_t NuCachedSource2::readInternal(off64_t offset, void *data, size_t size) {
     CHECK_LE(size, (size_t)mHighwaterThresholdBytes);
 
-    LOGV("readInternal offset %lld size %d", offset, size);
+    ALOGV("readInternal offset %lld size %d", offset, size);
 
     Mutex::Autolock autoLock(mLock);
 
@@ -571,7 +571,7 @@
         return size;
     }
 
-    LOGV("deferring read");
+    ALOGV("deferring read");
 
     return -EAGAIN;
 }
@@ -584,7 +584,7 @@
         return OK;
     }
 
-    LOGI("new range: offset= %lld", offset);
+    ALOGI("new range: offset= %lld", offset);
 
     mCacheOffset = offset;
 
@@ -634,7 +634,7 @@
 
     if (sscanf(s, "%ld/%ld/%d",
                &lowwaterMarkKb, &highwaterMarkKb, &keepAliveSecs) != 3) {
-        LOGE("Failed to parse cache parameters from '%s'.", s);
+        ALOGE("Failed to parse cache parameters from '%s'.", s);
         return;
     }
 
@@ -651,7 +651,7 @@
     }
 
     if (mLowwaterThresholdBytes >= mHighwaterThresholdBytes) {
-        LOGE("Illegal low/highwater marks specified, reverting to defaults.");
+        ALOGE("Illegal low/highwater marks specified, reverting to defaults.");
 
         mLowwaterThresholdBytes = kDefaultLowWaterThreshold;
         mHighwaterThresholdBytes = kDefaultHighWaterThreshold;
@@ -663,7 +663,7 @@
         mKeepAliveIntervalUs = kDefaultKeepAliveIntervalUs;
     }
 
-    LOGV("lowwater = %d bytes, highwater = %d bytes, keepalive = %lld us",
+    ALOGV("lowwater = %d bytes, highwater = %d bytes, keepalive = %lld us",
          mLowwaterThresholdBytes,
          mHighwaterThresholdBytes,
          mKeepAliveIntervalUs);
@@ -687,7 +687,7 @@
 
         headers->removeItemsAt(index);
 
-        LOGV("Using special cache config '%s'", cacheConfig->string());
+        ALOGV("Using special cache config '%s'", cacheConfig->string());
     }
 
     if ((index = headers->indexOfKey(
@@ -695,7 +695,7 @@
         *disconnectAtHighwatermark = true;
         headers->removeItemsAt(index);
 
-        LOGV("Client requested disconnection at highwater mark");
+        ALOGV("Client requested disconnection at highwater mark");
     }
 }
 
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 86b3fe4..60d9bb7 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -179,9 +179,9 @@
 
 #undef OPTIONAL
 
-#define CODEC_LOGI(x, ...) LOGI("[%s] "x, mComponentName, ##__VA_ARGS__)
-#define CODEC_LOGV(x, ...) LOGV("[%s] "x, mComponentName, ##__VA_ARGS__)
-#define CODEC_LOGE(x, ...) LOGE("[%s] "x, mComponentName, ##__VA_ARGS__)
+#define CODEC_LOGI(x, ...) ALOGI("[%s] "x, mComponentName, ##__VA_ARGS__)
+#define CODEC_LOGV(x, ...) ALOGV("[%s] "x, mComponentName, ##__VA_ARGS__)
+#define CODEC_LOGE(x, ...) ALOGE("[%s] "x, mComponentName, ##__VA_ARGS__)
 
 struct OMXCodecObserver : public BnOMXObserver {
     OMXCodecObserver() {
@@ -467,13 +467,13 @@
                 InstantiateSoftwareEncoder(componentName, source, meta);
 
             if (softwareCodec != NULL) {
-                LOGV("Successfully allocated software codec '%s'", componentName);
+                ALOGV("Successfully allocated software codec '%s'", componentName);
 
                 return softwareCodec;
             }
         }
 
-        LOGV("Attempting to allocate OMX node '%s'", componentName);
+        ALOGV("Attempting to allocate OMX node '%s'", componentName);
 
         uint32_t quirks = getComponentQuirks(componentNameBase, createEncoder);
 
@@ -484,7 +484,7 @@
                 // For OMX.SEC.* decoders we can enable a special mode that
                 // gives the client access to the framebuffer contents.
 
-                LOGW("Component '%s' does not give the client access to "
+                ALOGW("Component '%s' does not give the client access to "
                      "the framebuffer contents. Skipping.",
                      componentName);
 
@@ -494,7 +494,7 @@
 
         status_t err = omx->allocateNode(componentName, observer, &node);
         if (err == OK) {
-            LOGV("Successfully allocated OMX node '%s'", componentName);
+            ALOGV("Successfully allocated OMX node '%s'", componentName);
 
             sp<OMXCodec> codec = new OMXCodec(
                     omx, node, quirks, flags,
@@ -513,7 +513,7 @@
                 return codec;
             }
 
-            LOGV("Failed to configure codec '%s'", componentName);
+            ALOGV("Failed to configure codec '%s'", componentName);
         }
     }
 
@@ -600,7 +600,7 @@
 }
 
 status_t OMXCodec::configureCodec(const sp<MetaData> &meta) {
-    LOGV("configureCodec protected=%d",
+    ALOGV("configureCodec protected=%d",
          (mFlags & kEnableGrallocUsageProtected) ? 1 : 0);
 
     if (!(mFlags & kIgnoreCodecSpecificData)) {
@@ -625,7 +625,7 @@
             status_t err;
             if ((err = parseAVCCodecSpecificData(
                             data, size, &profile, &level)) != OK) {
-                LOGE("Malformed AVC codec specific data.");
+                ALOGE("Malformed AVC codec specific data.");
                 return err;
             }
 
@@ -639,7 +639,7 @@
                 // does not handle this gracefully and would clobber the heap
                 // and wreak havoc instead...
 
-                LOGE("Profile and/or level exceed the decoder's capabilities.");
+                ALOGE("Profile and/or level exceed the decoder's capabilities.");
                 return ERROR_UNSUPPORTED;
             }
         } else if (meta->findData(kKeyVorbisInfo, &type, &data, &size)) {
@@ -904,7 +904,7 @@
 
 status_t OMXCodec::findTargetColorFormat(
         const sp<MetaData>& meta, OMX_COLOR_FORMATTYPE *colorFormat) {
-    LOGV("findTargetColorFormat");
+    ALOGV("findTargetColorFormat");
     CHECK(mIsEncoder);
 
     *colorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
@@ -924,7 +924,7 @@
 
 status_t OMXCodec::isColorFormatSupported(
         OMX_COLOR_FORMATTYPE colorFormat, int portIndex) {
-    LOGV("isColorFormatSupported: %d", static_cast<int>(colorFormat));
+    ALOGV("isColorFormatSupported: %d", static_cast<int>(colorFormat));
 
     // Enumerate all the color formats supported by
     // the omx component to see whether the given
@@ -981,7 +981,7 @@
     } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_H263, mime)) {
         compressionFormat = OMX_VIDEO_CodingH263;
     } else {
-        LOGE("Not a supported video mime type: %s", mime);
+        ALOGE("Not a supported video mime type: %s", mime);
         CHECK(!"Should not be here. Not a supported video mime type.");
     }
 
@@ -1093,7 +1093,7 @@
             mNode, OMX_IndexParamVideoErrorCorrection,
             &errorCorrectionType, sizeof(errorCorrectionType));
     if (err != OK) {
-        LOGW("Error correction param query is not supported");
+        ALOGW("Error correction param query is not supported");
         return OK;  // Optional feature. Ignore this failure
     }
 
@@ -1107,7 +1107,7 @@
             mNode, OMX_IndexParamVideoErrorCorrection,
             &errorCorrectionType, sizeof(errorCorrectionType));
     if (err != OK) {
-        LOGW("Error correction param configuration is not supported");
+        ALOGW("Error correction param configuration is not supported");
     }
 
     // Optional feature. Ignore the failure.
@@ -1375,7 +1375,7 @@
     } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_MPEG2, mime)) {
         compressionFormat = OMX_VIDEO_CodingMPEG2;
     } else {
-        LOGE("Not a supported video mime type: %s", mime);
+        ALOGE("Not a supported video mime type: %s", mime);
         CHECK(!"Should not be here. Not a supported video mime type.");
     }
 
@@ -1579,7 +1579,7 @@
                 &roleParams, sizeof(roleParams));
 
         if (err != OK) {
-            LOGW("Failed to set standard component role '%s'.", role);
+            ALOGW("Failed to set standard component role '%s'.", role);
         }
     }
 }
@@ -1664,7 +1664,7 @@
     }
 
     if ((mFlags & kEnableGrallocUsageProtected) && portIndex == kPortIndexOutput) {
-        LOGE("protected output buffers must be stent to an ANativeWindow");
+        ALOGE("protected output buffers must be stent to an ANativeWindow");
         return PERMISSION_DENIED;
     }
 
@@ -1673,7 +1673,7 @@
             && portIndex == kPortIndexInput) {
         err = mOMX->storeMetaDataInBuffers(mNode, kPortIndexInput, OMX_TRUE);
         if (err != OK) {
-            LOGE("Storing meta data in video buffers is not supported");
+            ALOGE("Storing meta data in video buffers is not supported");
             return err;
         }
     }
@@ -1735,7 +1735,7 @@
         }
 
         if (err != OK) {
-            LOGE("allocate_buffer_with_backup failed");
+            ALOGE("allocate_buffer_with_backup failed");
             return err;
         }
 
@@ -1849,7 +1849,7 @@
             def.format.video.eColorFormat);
 
     if (err != 0) {
-        LOGE("native_window_set_buffers_geometry failed: %s (%d)",
+        ALOGE("native_window_set_buffers_geometry failed: %s (%d)",
                 strerror(-err), -err);
         return err;
     }
@@ -1863,7 +1863,7 @@
     OMX_U32 usage = 0;
     err = mOMX->getGraphicBufferUsage(mNode, kPortIndexOutput, &usage);
     if (err != 0) {
-        LOGW("querying usage flags from OMX IL component failed: %d", err);
+        ALOGW("querying usage flags from OMX IL component failed: %d", err);
         // XXX: Currently this error is logged, but not fatal.
         usage = 0;
     }
@@ -1881,20 +1881,20 @@
                 mNativeWindow.get(), NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER,
                 &queuesToNativeWindow);
         if (err != 0) {
-            LOGE("error authenticating native window: %d", err);
+            ALOGE("error authenticating native window: %d", err);
             return err;
         }
         if (queuesToNativeWindow != 1) {
-            LOGE("native window could not be authenticated");
+            ALOGE("native window could not be authenticated");
             return PERMISSION_DENIED;
         }
     }
 
-    LOGV("native_window_set_usage usage=0x%lx", usage);
+    ALOGV("native_window_set_usage usage=0x%lx", usage);
     err = native_window_set_usage(
             mNativeWindow.get(), usage | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP);
     if (err != 0) {
-        LOGE("native_window_set_usage failed: %s (%d)", strerror(-err), -err);
+        ALOGE("native_window_set_usage failed: %s (%d)", strerror(-err), -err);
         return err;
     }
 
@@ -1902,7 +1902,7 @@
     err = mNativeWindow->query(mNativeWindow.get(),
             NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &minUndequeuedBufs);
     if (err != 0) {
-        LOGE("NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS query failed: %s (%d)",
+        ALOGE("NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS query failed: %s (%d)",
                 strerror(-err), -err);
         return err;
     }
@@ -1925,7 +1925,7 @@
     err = native_window_set_buffer_count(
             mNativeWindow.get(), def.nBufferCountActual);
     if (err != 0) {
-        LOGE("native_window_set_buffer_count failed: %s (%d)", strerror(-err),
+        ALOGE("native_window_set_buffer_count failed: %s (%d)", strerror(-err),
                 -err);
         return err;
     }
@@ -1938,7 +1938,7 @@
         ANativeWindowBuffer* buf;
         err = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buf);
         if (err != 0) {
-            LOGE("dequeueBuffer failed: %s (%d)", strerror(-err), -err);
+            ALOGE("dequeueBuffer failed: %s (%d)", strerror(-err), -err);
             break;
         }
 
@@ -2052,7 +2052,7 @@
     err = native_window_api_disconnect(mNativeWindow.get(),
             NATIVE_WINDOW_API_MEDIA);
     if (err != NO_ERROR) {
-        LOGE("error pushing blank frames: api_disconnect failed: %s (%d)",
+        ALOGE("error pushing blank frames: api_disconnect failed: %s (%d)",
                 strerror(-err), -err);
         return err;
     }
@@ -2060,7 +2060,7 @@
     err = native_window_api_connect(mNativeWindow.get(),
             NATIVE_WINDOW_API_CPU);
     if (err != NO_ERROR) {
-        LOGE("error pushing blank frames: api_connect failed: %s (%d)",
+        ALOGE("error pushing blank frames: api_connect failed: %s (%d)",
                 strerror(-err), -err);
         return err;
     }
@@ -2068,7 +2068,7 @@
     err = native_window_set_scaling_mode(mNativeWindow.get(),
             NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW);
     if (err != NO_ERROR) {
-        LOGE("error pushing blank frames: set_buffers_geometry failed: %s (%d)",
+        ALOGE("error pushing blank frames: set_buffers_geometry failed: %s (%d)",
                 strerror(-err), -err);
         goto error;
     }
@@ -2076,7 +2076,7 @@
     err = native_window_set_buffers_geometry(mNativeWindow.get(), 1, 1,
             HAL_PIXEL_FORMAT_RGBX_8888);
     if (err != NO_ERROR) {
-        LOGE("error pushing blank frames: set_buffers_geometry failed: %s (%d)",
+        ALOGE("error pushing blank frames: set_buffers_geometry failed: %s (%d)",
                 strerror(-err), -err);
         goto error;
     }
@@ -2084,7 +2084,7 @@
     err = native_window_set_usage(mNativeWindow.get(),
             GRALLOC_USAGE_SW_WRITE_OFTEN);
     if (err != NO_ERROR) {
-        LOGE("error pushing blank frames: set_usage failed: %s (%d)",
+        ALOGE("error pushing blank frames: set_usage failed: %s (%d)",
                 strerror(-err), -err);
         goto error;
     }
@@ -2092,7 +2092,7 @@
     err = mNativeWindow->query(mNativeWindow.get(),
             NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &minUndequeuedBufs);
     if (err != NO_ERROR) {
-        LOGE("error pushing blank frames: MIN_UNDEQUEUED_BUFFERS query "
+        ALOGE("error pushing blank frames: MIN_UNDEQUEUED_BUFFERS query "
                 "failed: %s (%d)", strerror(-err), -err);
         goto error;
     }
@@ -2100,7 +2100,7 @@
     numBufs = minUndequeuedBufs + 1;
     err = native_window_set_buffer_count(mNativeWindow.get(), numBufs);
     if (err != NO_ERROR) {
-        LOGE("error pushing blank frames: set_buffer_count failed: %s (%d)",
+        ALOGE("error pushing blank frames: set_buffer_count failed: %s (%d)",
                 strerror(-err), -err);
         goto error;
     }
@@ -2112,7 +2112,7 @@
     for (int i = 0; i < numBufs + 1; i++) {
         err = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &anb);
         if (err != NO_ERROR) {
-            LOGE("error pushing blank frames: dequeueBuffer failed: %s (%d)",
+            ALOGE("error pushing blank frames: dequeueBuffer failed: %s (%d)",
                     strerror(-err), -err);
             goto error;
         }
@@ -2121,7 +2121,7 @@
         err = mNativeWindow->lockBuffer(mNativeWindow.get(),
                 buf->getNativeBuffer());
         if (err != NO_ERROR) {
-            LOGE("error pushing blank frames: lockBuffer failed: %s (%d)",
+            ALOGE("error pushing blank frames: lockBuffer failed: %s (%d)",
                     strerror(-err), -err);
             goto error;
         }
@@ -2130,7 +2130,7 @@
         uint32_t* img = NULL;
         err = buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
         if (err != NO_ERROR) {
-            LOGE("error pushing blank frames: lock failed: %s (%d)",
+            ALOGE("error pushing blank frames: lock failed: %s (%d)",
                     strerror(-err), -err);
             goto error;
         }
@@ -2139,7 +2139,7 @@
 
         err = buf->unlock();
         if (err != NO_ERROR) {
-            LOGE("error pushing blank frames: unlock failed: %s (%d)",
+            ALOGE("error pushing blank frames: unlock failed: %s (%d)",
                     strerror(-err), -err);
             goto error;
         }
@@ -2147,7 +2147,7 @@
         err = mNativeWindow->queueBuffer(mNativeWindow.get(),
                 buf->getNativeBuffer());
         if (err != NO_ERROR) {
-            LOGE("error pushing blank frames: queueBuffer failed: %s (%d)",
+            ALOGE("error pushing blank frames: queueBuffer failed: %s (%d)",
                     strerror(-err), -err);
             goto error;
         }
@@ -2174,7 +2174,7 @@
         err = native_window_api_disconnect(mNativeWindow.get(),
                 NATIVE_WINDOW_API_CPU);
         if (err != NO_ERROR) {
-            LOGE("error pushing blank frames: api_disconnect failed: %s (%d)",
+            ALOGE("error pushing blank frames: api_disconnect failed: %s (%d)",
                     strerror(-err), -err);
             return err;
         }
@@ -2182,7 +2182,7 @@
         err = native_window_api_connect(mNativeWindow.get(),
                 NATIVE_WINDOW_API_MEDIA);
         if (err != NO_ERROR) {
-            LOGE("error pushing blank frames: api_connect failed: %s (%d)",
+            ALOGE("error pushing blank frames: api_connect failed: %s (%d)",
                     strerror(-err), -err);
             return err;
         }
@@ -2214,7 +2214,7 @@
 
 void OMXCodec::on_message(const omx_message &msg) {
     if (mState == ERROR) {
-        LOGW("Dropping OMX message - we're in ERROR state.");
+        ALOGW("Dropping OMX message - we're in ERROR state.");
         return;
     }
 
@@ -2242,7 +2242,7 @@
 
             CHECK(i < buffers->size());
             if ((*buffers)[i].mStatus != OWNED_BY_COMPONENT) {
-                LOGW("We already own input buffer %p, yet received "
+                ALOGW("We already own input buffer %p, yet received "
                      "an EMPTY_BUFFER_DONE.", buffer);
             }
 
@@ -2302,7 +2302,7 @@
             BufferInfo *info = &buffers->editItemAt(i);
 
             if (info->mStatus != OWNED_BY_COMPONENT) {
-                LOGW("We already own output buffer %p, yet received "
+                ALOGW("We already own output buffer %p, yet received "
                      "a FILL_BUFFER_DONE.", buffer);
             }
 
@@ -2568,7 +2568,7 @@
                         // The scale is in 16.16 format.
                         // scale 1.0 = 0x010000. When there is no
                         // need to change the display, skip it.
-                        LOGV("Get OMX_IndexConfigScale: 0x%lx/0x%lx",
+                        ALOGV("Get OMX_IndexConfigScale: 0x%lx/0x%lx",
                                 scale.xWidth, scale.xHeight);
 
                         if (scale.xWidth != 0x010000) {
@@ -3296,7 +3296,7 @@
     }
 
     if (n > 1) {
-        LOGV("coalesced %d frames into one input buffer", n);
+        ALOGV("coalesced %d frames into one input buffer", n);
     }
 
     OMX_U32 flags = OMX_BUFFERFLAG_ENDOFFRAME;
@@ -3556,7 +3556,7 @@
 
 status_t OMXCodec::setAACFormat(int32_t numChannels, int32_t sampleRate, int32_t bitRate) {
     if (numChannels > 2)
-        LOGW("Number of channels: (%d) \n", numChannels);
+        ALOGW("Number of channels: (%d) \n", numChannels);
 
     if (mIsEncoder) {
         //////////////// input port ////////////////////
@@ -4466,14 +4466,14 @@
                 inputFormat->findInt32(kKeySampleRate, &sampleRate);
 
                 if ((OMX_U32)numChannels != params.nChannels) {
-                    LOGV("Codec outputs a different number of channels than "
+                    ALOGV("Codec outputs a different number of channels than "
                          "the input stream contains (contains %d channels, "
                          "codec outputs %ld channels).",
                          numChannels, params.nChannels);
                 }
 
                 if (sampleRate != (int32_t)params.nSamplingRate) {
-                    LOGV("Codec outputs at different sampling rate than "
+                    ALOGV("Codec outputs at different sampling rate than "
                          "what the input stream contains (contains data at "
                          "%d Hz, codec outputs %lu Hz)",
                          sampleRate, params.nSamplingRate);
diff --git a/media/libstagefright/OggExtractor.cpp b/media/libstagefright/OggExtractor.cpp
index 29e6907..73efc27 100644
--- a/media/libstagefright/OggExtractor.cpp
+++ b/media/libstagefright/OggExtractor.cpp
@@ -189,9 +189,9 @@
 #if 0
     int64_t timeUs;
     if (packet->meta_data()->findInt64(kKeyTime, &timeUs)) {
-        LOGI("found time = %lld us", timeUs);
+        ALOGI("found time = %lld us", timeUs);
     } else {
-        LOGI("NO time");
+        ALOGI("NO time");
     }
 #endif
 
@@ -244,7 +244,7 @@
 
         if (!memcmp(signature, "OggS", 4)) {
             if (*pageOffset > startOffset) {
-                LOGV("skipped %lld bytes of junk to reach next frame",
+                ALOGV("skipped %lld bytes of junk to reach next frame",
                      *pageOffset - startOffset);
             }
 
@@ -272,7 +272,7 @@
             prevGuess = 0;
         }
 
-        LOGV("backing up %lld bytes", pageOffset - prevGuess);
+        ALOGV("backing up %lld bytes", pageOffset - prevGuess);
 
         status_t err = findNextPage(prevGuess, &prevPageOffset);
         if (err != OK) {
@@ -289,7 +289,7 @@
         return UNKNOWN_ERROR;
     }
 
-    LOGV("prevPageOffset at %lld, pageOffset at %lld",
+    ALOGV("prevPageOffset at %lld, pageOffset at %lld",
          prevPageOffset, pageOffset);
 
     for (;;) {
@@ -315,7 +315,7 @@
 
         off64_t pos = timeUs * approxBitrate() / 8000000ll;
 
-        LOGV("seeking to offset %lld", pos);
+        ALOGV("seeking to offset %lld", pos);
         return seekToOffset(pos);
     }
 
@@ -338,7 +338,7 @@
 
     const TOCEntry &entry = mTableOfContents.itemAt(left);
 
-    LOGV("seeking to entry %d / %d at offset %lld",
+    ALOGV("seeking to entry %d / %d at offset %lld",
          left, mTableOfContents.size(), entry.mPageOffset);
 
     return seekToOffset(entry.mPageOffset);
@@ -381,7 +381,7 @@
     ssize_t n;
     if ((n = mSource->readAt(offset, header, sizeof(header)))
             < (ssize_t)sizeof(header)) {
-        LOGV("failed to read %d bytes at offset 0x%016llx, got %ld bytes",
+        ALOGV("failed to read %d bytes at offset 0x%016llx, got %ld bytes",
              sizeof(header), offset, n);
 
         if (n < 0) {
@@ -441,7 +441,7 @@
         tmp.append(x);
     }
 
-    LOGV("%c %s", page->mFlags & 1 ? '+' : ' ', tmp.string());
+    ALOGV("%c %s", page->mFlags & 1 ? '+' : ' ', tmp.string());
 #endif
 
     return sizeof(header) + page->mNumSegments + totalSize;
@@ -505,7 +505,7 @@
                     packetSize);
 
             if (n < (ssize_t)packetSize) {
-                LOGV("failed to read %d bytes at 0x%016llx, got %ld bytes",
+                ALOGV("failed to read %d bytes at 0x%016llx, got %ld bytes",
                      packetSize, dataOffset, n);
                 return ERROR_IO;
             }
@@ -546,7 +546,7 @@
                 buffer = NULL;
             }
 
-            LOGV("readPage returned %ld", n);
+            ALOGV("readPage returned %ld", n);
 
             return n < 0 ? n : (status_t)ERROR_END_OF_STREAM;
         }
@@ -590,7 +590,7 @@
     if ((err = readNextPacket(&packet)) != OK) {
         return err;
     }
-    LOGV("read packet of size %d\n", packet->range_length());
+    ALOGV("read packet of size %d\n", packet->range_length());
     err = verifyHeader(packet, 1);
     packet->release();
     packet = NULL;
@@ -601,7 +601,7 @@
     if ((err = readNextPacket(&packet)) != OK) {
         return err;
     }
-    LOGV("read packet of size %d\n", packet->range_length());
+    ALOGV("read packet of size %d\n", packet->range_length());
     err = verifyHeader(packet, 3);
     packet->release();
     packet = NULL;
@@ -612,7 +612,7 @@
     if ((err = readNextPacket(&packet)) != OK) {
         return err;
     }
-    LOGV("read packet of size %d\n", packet->range_length());
+    ALOGV("read packet of size %d\n", packet->range_length());
     err = verifyHeader(packet, 5);
     packet->release();
     packet = NULL;
@@ -722,10 +722,10 @@
             mMeta->setInt32(kKeySampleRate, mVi.rate);
             mMeta->setInt32(kKeyChannelCount, mVi.channels);
 
-            LOGV("lower-bitrate = %ld", mVi.bitrate_lower);
-            LOGV("upper-bitrate = %ld", mVi.bitrate_upper);
-            LOGV("nominal-bitrate = %ld", mVi.bitrate_nominal);
-            LOGV("window-bitrate = %ld", mVi.bitrate_window);
+            ALOGV("lower-bitrate = %ld", mVi.bitrate_lower);
+            ALOGV("upper-bitrate = %ld", mVi.bitrate_upper);
+            ALOGV("nominal-bitrate = %ld", mVi.bitrate_nominal);
+            ALOGV("window-bitrate = %ld", mVi.bitrate_window);
 
             off64_t size;
             if (mSource->getSize(&size) == OK) {
@@ -777,7 +777,7 @@
         const char *comment = mVc.user_comments[i];
         size_t commentLength = mVc.comment_lengths[i];
         parseVorbisComment(mFileMeta, comment, commentLength);
-        //LOGI("comment #%d: '%s'", i + 1, mVc.user_comments[i]);
+        //ALOGI("comment #%d: '%s'", i + 1, mVc.user_comments[i]);
     }
 }
 
@@ -893,17 +893,17 @@
 
 static void extractAlbumArt(
         const sp<MetaData> &fileMeta, const void *data, size_t size) {
-    LOGV("extractAlbumArt from '%s'", (const char *)data);
+    ALOGV("extractAlbumArt from '%s'", (const char *)data);
 
     size_t flacSize;
     uint8_t *flac = DecodeBase64((const char *)data, size, &flacSize);
 
     if (flac == NULL) {
-        LOGE("malformed base64 encoded data.");
+        ALOGE("malformed base64 encoded data.");
         return;
     }
 
-    LOGV("got flac of size %d", flacSize);
+    ALOGV("got flac of size %d", flacSize);
 
     uint32_t picType;
     uint32_t typeLen;
@@ -934,7 +934,7 @@
     memcpy(type, &flac[8], typeLen);
     type[typeLen] = '\0';
 
-    LOGV("picType = %d, type = '%s'", picType, type);
+    ALOGV("picType = %d, type = '%s'", picType, type);
 
     if (!strcmp(type, "-->")) {
         // This is not inline cover art, but an external url instead.
@@ -953,7 +953,7 @@
         goto exit;
     }
 
-    LOGV("got image data, %d trailing bytes",
+    ALOGV("got image data, %d trailing bytes",
          flacSize - 32 - typeLen - descLen - dataLen);
 
     fileMeta->setData(
diff --git a/media/libstagefright/SampleIterator.cpp b/media/libstagefright/SampleIterator.cpp
index c7b00b1..81ec5c1 100644
--- a/media/libstagefright/SampleIterator.cpp
+++ b/media/libstagefright/SampleIterator.cpp
@@ -52,7 +52,7 @@
 }
 
 status_t SampleIterator::seekTo(uint32_t sampleIndex) {
-    LOGV("seekTo(%d)", sampleIndex);
+    ALOGV("seekTo(%d)", sampleIndex);
 
     if (sampleIndex >= mTable->mNumSampleSizes) {
         return ERROR_END_OF_STREAM;
@@ -77,7 +77,7 @@
     if (sampleIndex >= mStopChunkSampleIndex) {
         status_t err;
         if ((err = findChunkRange(sampleIndex)) != OK) {
-            LOGE("findChunkRange failed");
+            ALOGE("findChunkRange failed");
             return err;
         }
     }
@@ -93,7 +93,7 @@
 
         status_t err;
         if ((err = getChunkOffset(chunk, &mCurrentChunkOffset)) != OK) {
-            LOGE("getChunkOffset return error");
+            ALOGE("getChunkOffset return error");
             return err;
         }
 
@@ -107,7 +107,7 @@
             size_t sampleSize;
             if ((err = getSampleSizeDirect(
                             firstChunkSampleIndex + i, &sampleSize)) != OK) {
-                LOGE("getSampleSizeDirect return error");
+                ALOGE("getSampleSizeDirect return error");
                 return err;
             }
 
@@ -134,7 +134,7 @@
 
     status_t err;
     if ((err = findSampleTime(sampleIndex, &mCurrentSampleTime)) != OK) {
-        LOGE("findSampleTime return error");
+        ALOGE("findSampleTime return error");
         return err;
     }
 
diff --git a/media/libstagefright/SampleTable.cpp b/media/libstagefright/SampleTable.cpp
index bf31947..8d80d63 100644
--- a/media/libstagefright/SampleTable.cpp
+++ b/media/libstagefright/SampleTable.cpp
@@ -347,7 +347,7 @@
 
 status_t SampleTable::setCompositionTimeToSampleParams(
         off64_t data_offset, size_t data_size) {
-    LOGI("There are reordered frames present.");
+    ALOGI("There are reordered frames present.");
 
     if (mCompositionTimeDeltaEntries != NULL || data_size < 8) {
         return ERROR_MALFORMED;
@@ -414,7 +414,7 @@
     mNumSyncSamples = U32_AT(&header[4]);
 
     if (mNumSyncSamples < 2) {
-        LOGV("Table of sync samples is empty or has only a single entry!");
+        ALOGV("Table of sync samples is empty or has only a single entry!");
     }
 
     mSyncSamples = new uint32_t[mNumSyncSamples];
@@ -630,7 +630,7 @@
 
     if (left == mNumSyncSamples) {
         if (flags == kFlagAfter) {
-            LOGE("tried to find a sync frame after the last one: %d", left);
+            ALOGE("tried to find a sync frame after the last one: %d", left);
             return ERROR_OUT_OF_RANGE;
         }
     }
diff --git a/media/libstagefright/StagefrightMediaScanner.cpp b/media/libstagefright/StagefrightMediaScanner.cpp
index 2505096..bd7a226 100644
--- a/media/libstagefright/StagefrightMediaScanner.cpp
+++ b/media/libstagefright/StagefrightMediaScanner.cpp
@@ -57,7 +57,7 @@
     // get the library configuration and do sanity check
     const S_EAS_LIB_CONFIG* pLibConfig = EAS_Config();
     if ((pLibConfig == NULL) || (LIB_VERSION != pLibConfig->libVersion)) {
-        LOGE("EAS library/header mismatch\n");
+        ALOGE("EAS library/header mismatch\n");
         return MEDIA_SCAN_RESULT_ERROR;
     }
     EAS_I32 temp;
@@ -103,7 +103,7 @@
 MediaScanResult StagefrightMediaScanner::processFile(
         const char *path, const char *mimeType,
         MediaScannerClient &client) {
-    LOGV("processFile '%s'.", path);
+    ALOGV("processFile '%s'.", path);
 
     client.setLocale(locale());
     client.beginFile();
@@ -188,7 +188,7 @@
 }
 
 char *StagefrightMediaScanner::extractAlbumArt(int fd) {
-    LOGV("extractAlbumArt %d", fd);
+    ALOGV("extractAlbumArt %d", fd);
 
     off64_t size = lseek64(fd, 0, SEEK_END);
     if (size < 0) {
diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp
index 4491c97..43bfd9e 100644
--- a/media/libstagefright/StagefrightMetadataRetriever.cpp
+++ b/media/libstagefright/StagefrightMetadataRetriever.cpp
@@ -34,14 +34,14 @@
 StagefrightMetadataRetriever::StagefrightMetadataRetriever()
     : mParsedMetaData(false),
       mAlbumArt(NULL) {
-    LOGV("StagefrightMetadataRetriever()");
+    ALOGV("StagefrightMetadataRetriever()");
 
     DataSource::RegisterDefaultSniffers();
     CHECK_EQ(mClient.connect(), OK);
 }
 
 StagefrightMetadataRetriever::~StagefrightMetadataRetriever() {
-    LOGV("~StagefrightMetadataRetriever()");
+    ALOGV("~StagefrightMetadataRetriever()");
 
     delete mAlbumArt;
     mAlbumArt = NULL;
@@ -51,7 +51,7 @@
 
 status_t StagefrightMetadataRetriever::setDataSource(
         const char *uri, const KeyedVector<String8, String8> *headers) {
-    LOGV("setDataSource(%s)", uri);
+    ALOGV("setDataSource(%s)", uri);
 
     mParsedMetaData = false;
     mMetaData.clear();
@@ -80,7 +80,7 @@
         int fd, int64_t offset, int64_t length) {
     fd = dup(fd);
 
-    LOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
 
     mParsedMetaData = false;
     mMetaData.clear();
@@ -120,14 +120,14 @@
                 NULL, flags | OMXCodec::kClientNeedsFramebuffer);
 
     if (decoder.get() == NULL) {
-        LOGV("unable to instantiate video decoder.");
+        ALOGV("unable to instantiate video decoder.");
 
         return NULL;
     }
 
     status_t err = decoder->start();
     if (err != OK) {
-        LOGW("OMXCodec::start returned error %d (0x%08x)\n", err, err);
+        ALOGW("OMXCodec::start returned error %d (0x%08x)\n", err, err);
         return NULL;
     }
 
@@ -138,7 +138,7 @@
     if (seekMode < MediaSource::ReadOptions::SEEK_PREVIOUS_SYNC ||
         seekMode > MediaSource::ReadOptions::SEEK_CLOSEST) {
 
-        LOGE("Unknown seek mode: %d", seekMode);
+        ALOGE("Unknown seek mode: %d", seekMode);
         return NULL;
     }
 
@@ -171,18 +171,18 @@
     if (err != OK) {
         CHECK_EQ(buffer, NULL);
 
-        LOGV("decoding frame failed.");
+        ALOGV("decoding frame failed.");
         decoder->stop();
 
         return NULL;
     }
 
-    LOGV("successfully decoded video frame.");
+    ALOGV("successfully decoded video frame.");
 
     int32_t unreadable;
     if (buffer->meta_data()->findInt32(kKeyIsUnreadable, &unreadable)
             && unreadable != 0) {
-        LOGV("video frame is unreadable, decoder does not give us access "
+        ALOGV("video frame is unreadable, decoder does not give us access "
              "to the video data.");
 
         buffer->release();
@@ -200,7 +200,7 @@
             const char *mime;
             CHECK(trackMeta->findCString(kKeyMIMEType, &mime));
 
-            LOGV("thumbNailTime = %lld us, timeUs = %lld us, mime = %s",
+            ALOGV("thumbNailTime = %lld us, timeUs = %lld us, mime = %s",
                  thumbNailTime, timeUs, mime);
         }
     }
@@ -264,7 +264,7 @@
     decoder->stop();
 
     if (err != OK) {
-        LOGE("Colorconverter failed to convert frame.");
+        ALOGE("Colorconverter failed to convert frame.");
 
         delete frame;
         frame = NULL;
@@ -276,23 +276,23 @@
 VideoFrame *StagefrightMetadataRetriever::getFrameAtTime(
         int64_t timeUs, int option) {
 
-    LOGV("getFrameAtTime: %lld us option: %d", timeUs, option);
+    ALOGV("getFrameAtTime: %lld us option: %d", timeUs, option);
 
     if (mExtractor.get() == NULL) {
-        LOGV("no extractor.");
+        ALOGV("no extractor.");
         return NULL;
     }
 
     sp<MetaData> fileMeta = mExtractor->getMetaData();
 
     if (fileMeta == NULL) {
-        LOGV("extractor doesn't publish metadata, failed to initialize?");
+        ALOGV("extractor doesn't publish metadata, failed to initialize?");
         return NULL;
     }
 
     int32_t drm = 0;
     if (fileMeta->findInt32(kKeyIsDRM, &drm) && drm != 0) {
-        LOGE("frame grab not allowed.");
+        ALOGE("frame grab not allowed.");
         return NULL;
     }
 
@@ -310,7 +310,7 @@
     }
 
     if (i == n) {
-        LOGV("no video track found.");
+        ALOGV("no video track found.");
         return NULL;
     }
 
@@ -320,7 +320,7 @@
     sp<MediaSource> source = mExtractor->getTrack(i);
 
     if (source.get() == NULL) {
-        LOGV("unable to instantiate video track.");
+        ALOGV("unable to instantiate video track.");
         return NULL;
     }
 
@@ -341,7 +341,7 @@
                 timeUs, option);
 
     if (frame == NULL) {
-        LOGV("Software decoder failed to extract thumbnail, "
+        ALOGV("Software decoder failed to extract thumbnail, "
              "trying hardware decoder.");
 
         frame = extractVideoFrameWithCodecFlags(&mClient, trackMeta, source, 0,
@@ -352,7 +352,7 @@
 }
 
 MediaAlbumArt *StagefrightMetadataRetriever::extractAlbumArt() {
-    LOGV("extractAlbumArt (extractor: %s)", mExtractor.get() != NULL ? "YES" : "NO");
+    ALOGV("extractAlbumArt (extractor: %s)", mExtractor.get() != NULL ? "YES" : "NO");
 
     if (mExtractor == NULL) {
         return NULL;
@@ -395,7 +395,7 @@
     sp<MetaData> meta = mExtractor->getMetaData();
 
     if (meta == NULL) {
-        LOGV("extractor doesn't publish metadata, failed to initialize?");
+        ALOGV("extractor doesn't publish metadata, failed to initialize?");
         return;
     }
 
diff --git a/media/libstagefright/SurfaceMediaSource.cpp b/media/libstagefright/SurfaceMediaSource.cpp
index 38daf72..48df058 100644
--- a/media/libstagefright/SurfaceMediaSource.cpp
+++ b/media/libstagefright/SurfaceMediaSource.cpp
@@ -50,13 +50,13 @@
                 mNumFramesReceived(0),
                 mNumFramesEncoded(0),
                 mFirstFrameTimestamp(0) {
-    LOGV("SurfaceMediaSource::SurfaceMediaSource");
+    ALOGV("SurfaceMediaSource::SurfaceMediaSource");
     sp<ISurfaceComposer> composer(ComposerService::getComposerService());
     mGraphicBufferAlloc = composer->createGraphicBufferAlloc();
 }
 
 SurfaceMediaSource::~SurfaceMediaSource() {
-    LOGV("SurfaceMediaSource::~SurfaceMediaSource");
+    ALOGV("SurfaceMediaSource::~SurfaceMediaSource");
     if (!mStopped) {
         stop();
     }
@@ -108,9 +108,9 @@
 }
 
 status_t SurfaceMediaSource::setBufferCount(int bufferCount) {
-    LOGV("SurfaceMediaSource::setBufferCount");
+    ALOGV("SurfaceMediaSource::setBufferCount");
     if (bufferCount > NUM_BUFFER_SLOTS) {
-        LOGE("setBufferCount: bufferCount is larger than the number of buffer slots");
+        ALOGE("setBufferCount: bufferCount is larger than the number of buffer slots");
         return BAD_VALUE;
     }
 
@@ -118,7 +118,7 @@
     // Error out if the user has dequeued buffers
     for (int i = 0 ; i < mBufferCount ; i++) {
         if (mSlots[i].mBufferState == BufferSlot::DEQUEUED) {
-            LOGE("setBufferCount: client owns some buffers");
+            ALOGE("setBufferCount: client owns some buffers");
             return INVALID_OPERATION;
         }
     }
@@ -150,10 +150,10 @@
 }
 
 status_t SurfaceMediaSource::requestBuffer(int slot, sp<GraphicBuffer>* buf) {
-    LOGV("SurfaceMediaSource::requestBuffer");
+    ALOGV("SurfaceMediaSource::requestBuffer");
     Mutex::Autolock lock(mMutex);
     if (slot < 0 || mBufferCount <= slot) {
-        LOGE("requestBuffer: slot index out of range [0, %d]: %d",
+        ALOGE("requestBuffer: slot index out of range [0, %d]: %d",
                 mBufferCount, slot);
         return BAD_VALUE;
     }
@@ -164,7 +164,7 @@
 
 status_t SurfaceMediaSource::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
                                             uint32_t format, uint32_t usage) {
-    LOGV("dequeueBuffer");
+    ALOGV("dequeueBuffer");
     Mutex::Autolock lock(mMutex);
 
     // Check for the buffer size- the client should just use the
@@ -181,7 +181,7 @@
     // we might declare mHeight and mWidth and check against those here.
     if ((w != 0) || (h != 0)) {
         if ((w != mDefaultWidth) || (h != mDefaultHeight)) {
-            LOGE("dequeuebuffer: invalid buffer size! Req: %dx%d, Found: %dx%d",
+            ALOGE("dequeuebuffer: invalid buffer size! Req: %dx%d, Found: %dx%d",
                     mDefaultWidth, mDefaultHeight, w, h);
             return BAD_VALUE;
         }
@@ -215,7 +215,7 @@
                         (mServerBufferCount < minBufferCountNeeded))) {
             // wait for the FIFO to drain
             while (!mQueue.isEmpty()) {
-                LOGV("Waiting for the FIFO to drain");
+                ALOGV("Waiting for the FIFO to drain");
                 mDequeueCondition.wait(mMutex);
             }
             if (mStopped) {
@@ -282,7 +282,7 @@
             // than allowed.
             const int avail = mBufferCount - (dequeuedCount+1);
             if (avail < (MIN_UNDEQUEUED_BUFFERS-int(mSynchronousMode))) {
-                LOGE("dequeueBuffer: MIN_UNDEQUEUED_BUFFERS=%d exceeded (dequeued=%d)",
+                ALOGE("dequeueBuffer: MIN_UNDEQUEUED_BUFFERS=%d exceeded (dequeued=%d)",
                         MIN_UNDEQUEUED_BUFFERS-int(mSynchronousMode),
                         dequeuedCount);
                 return -EBUSY;
@@ -293,7 +293,7 @@
         // for for some buffers to be consumed
         tryAgain = mSynchronousMode && (foundSync == INVALID_BUFFER_SLOT);
         if (tryAgain) {
-            LOGV("Waiting..In synchronous mode and no buffer to dequeue");
+            ALOGV("Waiting..In synchronous mode and no buffer to dequeue");
             mDequeueCondition.wait(mMutex);
         }
         if (mStopped) {
@@ -344,7 +344,7 @@
                     mGraphicBufferAlloc->createGraphicBuffer(
                                     w, h, format, usage, &error));
             if (graphicBuffer == 0) {
-                LOGE("dequeueBuffer: SurfaceComposer::createGraphicBuffer failed");
+                ALOGE("dequeueBuffer: SurfaceComposer::createGraphicBuffer failed");
                 return error;
             }
             if (updateFormat) {
@@ -361,13 +361,13 @@
 status_t SurfaceMediaSource::setSynchronousMode(bool enabled) {
     Mutex::Autolock lock(mMutex);
     if (mStopped) {
-        LOGE("setSynchronousMode: SurfaceMediaSource has been stopped!");
+        ALOGE("setSynchronousMode: SurfaceMediaSource has been stopped!");
         return NO_INIT;
     }
 
     if (!enabled) {
         // Async mode is not allowed
-        LOGE("SurfaceMediaSource can be used only synchronous mode!");
+        ALOGE("SurfaceMediaSource can be used only synchronous mode!");
         return INVALID_OPERATION;
     }
 
@@ -384,11 +384,11 @@
 
 status_t SurfaceMediaSource::connect(int api,
         uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
-    LOGV("SurfaceMediaSource::connect");
+    ALOGV("SurfaceMediaSource::connect");
     Mutex::Autolock lock(mMutex);
 
     if (mStopped) {
-        LOGE("Connect: SurfaceMediaSource has been stopped!");
+        ALOGE("Connect: SurfaceMediaSource has been stopped!");
         return NO_INIT;
     }
 
@@ -425,11 +425,11 @@
 // that need not be required since the thread supplying the
 // frames is separate than the one calling stop.
 status_t SurfaceMediaSource::disconnect(int api) {
-    LOGV("SurfaceMediaSource::disconnect");
+    ALOGV("SurfaceMediaSource::disconnect");
     Mutex::Autolock lock(mMutex);
 
     if (mStopped) {
-        LOGE("disconnect: SurfaceMediaSoource is already stopped!");
+        ALOGE("disconnect: SurfaceMediaSoource is already stopped!");
         return NO_INIT;
     }
 
@@ -457,7 +457,7 @@
 
 status_t SurfaceMediaSource::queueBuffer(int bufIndex, int64_t timestamp,
         uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
-    LOGV("queueBuffer");
+    ALOGV("queueBuffer");
 
     Mutex::Autolock lock(mMutex);
     *outWidth = mDefaultWidth;
@@ -465,15 +465,15 @@
     *outTransform = 0;
 
     if (bufIndex < 0 || bufIndex >= mBufferCount) {
-        LOGE("queueBuffer: slot index out of range [0, %d]: %d",
+        ALOGE("queueBuffer: slot index out of range [0, %d]: %d",
                 mBufferCount, bufIndex);
         return -EINVAL;
     } else if (mSlots[bufIndex].mBufferState != BufferSlot::DEQUEUED) {
-        LOGE("queueBuffer: slot %d is not owned by the client (state=%d)",
+        ALOGE("queueBuffer: slot %d is not owned by the client (state=%d)",
                 bufIndex, mSlots[bufIndex].mBufferState);
         return -EINVAL;
     } else if (!mSlots[bufIndex].mRequestBufferCalled) {
-        LOGE("queueBuffer: slot %d was enqueued without requesting a "
+        ALOGE("queueBuffer: slot %d was enqueued without requesting a "
                 "buffer", bufIndex);
         return -EINVAL;
     }
@@ -497,7 +497,7 @@
     if (mSynchronousMode) {
         // in synchronous mode we queue all buffers in a FIFO
         mQueue.push_back(bufIndex);
-        LOGV("Client queued buf# %d @slot: %d, Q size = %d, handle = %p, timestamp = %lld",
+        ALOGV("Client queued buf# %d @slot: %d, Q size = %d, handle = %p, timestamp = %lld",
             mNumFramesReceived, bufIndex, mQueue.size(),
             mSlots[bufIndex].mGraphicBuffer->handle, timestamp);
     } else {
@@ -536,7 +536,7 @@
 // wait to hear from StageFrightRecorder to set the buffer FREE
 // Make sure this is called when the mutex is locked
 status_t SurfaceMediaSource::onFrameReceivedLocked() {
-    LOGV("On Frame Received locked");
+    ALOGV("On Frame Received locked");
     // Signal the encoder that a new frame has arrived
     mFrameAvailableCondition.signal();
 
@@ -556,14 +556,14 @@
 
 
 void SurfaceMediaSource::cancelBuffer(int bufIndex) {
-    LOGV("SurfaceMediaSource::cancelBuffer");
+    ALOGV("SurfaceMediaSource::cancelBuffer");
     Mutex::Autolock lock(mMutex);
     if (bufIndex < 0 || bufIndex >= mBufferCount) {
-        LOGE("cancelBuffer: slot index out of range [0, %d]: %d",
+        ALOGE("cancelBuffer: slot index out of range [0, %d]: %d",
                 mBufferCount, bufIndex);
         return;
     } else if (mSlots[bufIndex].mBufferState != BufferSlot::DEQUEUED) {
-        LOGE("cancelBuffer: slot %d is not owned by the client (state=%d)",
+        ALOGE("cancelBuffer: slot %d is not owned by the client (state=%d)",
                 bufIndex, mSlots[bufIndex].mBufferState);
         return;
     }
@@ -572,7 +572,7 @@
 }
 
 nsecs_t SurfaceMediaSource::getTimestamp() {
-    LOGV("SurfaceMediaSource::getTimestamp");
+    ALOGV("SurfaceMediaSource::getTimestamp");
     Mutex::Autolock lock(mMutex);
     return mCurrentTimestamp;
 }
@@ -580,13 +580,13 @@
 
 void SurfaceMediaSource::setFrameAvailableListener(
         const sp<FrameAvailableListener>& listener) {
-    LOGV("SurfaceMediaSource::setFrameAvailableListener");
+    ALOGV("SurfaceMediaSource::setFrameAvailableListener");
     Mutex::Autolock lock(mMutex);
     mFrameAvailableListener = listener;
 }
 
 void SurfaceMediaSource::freeAllBuffersLocked() {
-    LOGV("freeAllBuffersLocked");
+    ALOGV("freeAllBuffersLocked");
     for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
         mSlots[i].mGraphicBuffer = 0;
         mSlots[i].mBufferState = BufferSlot::FREE;
@@ -600,7 +600,7 @@
 
 int SurfaceMediaSource::query(int what, int* outValue)
 {
-    LOGV("query");
+    ALOGV("query");
     Mutex::Autolock lock(mMutex);
     int value;
     switch (what) {
@@ -691,7 +691,7 @@
 }
 
 bool SurfaceMediaSource::isMetaDataStoredInVideoBuffers() const {
-    LOGV("isMetaDataStoredInVideoBuffers");
+    ALOGV("isMetaDataStoredInVideoBuffers");
     return true;
 }
 
@@ -702,7 +702,7 @@
 
 status_t SurfaceMediaSource::start(MetaData *params)
 {
-    LOGV("started!");
+    ALOGV("started!");
 
     mStartTimeNs = 0;
     int64_t startTimeUs;
@@ -716,7 +716,7 @@
 
 status_t SurfaceMediaSource::stop()
 {
-    LOGV("Stop");
+    ALOGV("Stop");
 
     Mutex::Autolock lock(mMutex);
     // TODO: Add waiting on mFrameCompletedCondition here?
@@ -731,7 +731,7 @@
 
 sp<MetaData> SurfaceMediaSource::getFormat()
 {
-    LOGV("getFormat");
+    ALOGV("getFormat");
     Mutex::Autolock autoLock(mMutex);
     sp<MetaData> meta = new MetaData;
 
@@ -753,20 +753,20 @@
 {
     Mutex::Autolock autoLock(mMutex) ;
 
-    LOGV("Read. Size of queued buffer: %d", mQueue.size());
+    ALOGV("Read. Size of queued buffer: %d", mQueue.size());
     *buffer = NULL;
 
     // If the recording has started and the queue is empty, then just
     // wait here till the frames come in from the client side
     while (!mStopped && mQueue.empty()) {
-        LOGV("NO FRAMES! Recorder waiting for FrameAvailableCondition");
+        ALOGV("NO FRAMES! Recorder waiting for FrameAvailableCondition");
         mFrameAvailableCondition.wait(mMutex);
     }
 
     // If the loop was exited as a result of stopping the recording,
     // it is OK
     if (mStopped) {
-        LOGV("Read: SurfaceMediaSource is stopped. Returning ERROR_END_OF_STREAM.");
+        ALOGV("Read: SurfaceMediaSource is stopped. Returning ERROR_END_OF_STREAM.");
         return ERROR_END_OF_STREAM;
     }
 
@@ -787,7 +787,7 @@
     (*buffer)->setObserver(this);
     (*buffer)->add_ref();
     (*buffer)->meta_data()->setInt64(kKeyTime, mCurrentTimestamp / 1000);
-    LOGV("Frames encoded = %d, timestamp = %lld, time diff = %lld",
+    ALOGV("Frames encoded = %d, timestamp = %lld, time diff = %lld",
             mNumFramesEncoded, mCurrentTimestamp / 1000,
             mCurrentTimestamp / 1000 - prevTimeStamp / 1000);
 
@@ -806,13 +806,13 @@
 // --------------------------------------------------------------
 // Note: Call only when you have the lock
 void SurfaceMediaSource::passMetadataBufferLocked(MediaBuffer **buffer) {
-    LOGV("passMetadataBuffer");
+    ALOGV("passMetadataBuffer");
     // MediaBuffer allocates and owns this data
     MediaBuffer *tempBuffer =
         new MediaBuffer(4 + sizeof(buffer_handle_t));
     char *data = (char *)tempBuffer->data();
     if (data == NULL) {
-        LOGE("Cannot allocate memory for metadata buffer!");
+        ALOGE("Cannot allocate memory for metadata buffer!");
         return;
     }
     OMX_U32 type = kMetadataBufferTypeGrallocSource;
@@ -820,18 +820,18 @@
     memcpy(data + 4, &(mCurrentBuf->handle), sizeof(buffer_handle_t));
     *buffer = tempBuffer;
 
-    LOGV("handle = %p, , offset = %d, length = %d",
+    ALOGV("handle = %p, , offset = %d, length = %d",
             mCurrentBuf->handle, (*buffer)->range_length(), (*buffer)->range_offset());
 }
 
 void SurfaceMediaSource::signalBufferReturned(MediaBuffer *buffer) {
-    LOGV("signalBufferReturned");
+    ALOGV("signalBufferReturned");
 
     bool foundBuffer = false;
     Mutex::Autolock autoLock(mMutex);
 
     if (mStopped) {
-        LOGV("signalBufferReturned: mStopped = true! Nothing to do!");
+        ALOGV("signalBufferReturned: mStopped = true! Nothing to do!");
         return;
     }
 
@@ -840,7 +840,7 @@
             continue;
         }
         if (checkBufferMatchesSlot(id, buffer)) {
-            LOGV("Slot %d returned, matches handle = %p", id,
+            ALOGV("Slot %d returned, matches handle = %p", id,
                     mSlots[id].mGraphicBuffer->handle);
             mSlots[id].mBufferState = BufferSlot::FREE;
             buffer->setObserver(0);
@@ -858,7 +858,7 @@
 }
 
 bool SurfaceMediaSource::checkBufferMatchesSlot(int slot, MediaBuffer *buffer) {
-    LOGV("Check if Buffer matches slot");
+    ALOGV("Check if Buffer matches slot");
     // need to convert to char* for pointer arithmetic and then
     // copy the byte stream into our handle
     buffer_handle_t bufferHandle ;
diff --git a/media/libstagefright/TimedEventQueue.cpp b/media/libstagefright/TimedEventQueue.cpp
index 100d8a3..12c9c36 100644
--- a/media/libstagefright/TimedEventQueue.cpp
+++ b/media/libstagefright/TimedEventQueue.cpp
@@ -173,7 +173,7 @@
             mQueueHeadChangedCondition.signal();
         }
 
-        LOGV("cancelling event %d", (*it).event->eventID());
+        ALOGV("cancelling event %d", (*it).event->eventID());
 
         (*it).event->setEventID(0);
         it = mQueue.erase(it);
@@ -265,7 +265,7 @@
                 static int64_t kMaxTimeoutUs = 10000000ll;  // 10 secs
                 bool timeoutCapped = false;
                 if (delay_us > kMaxTimeoutUs) {
-                    LOGW("delay_us exceeds max timeout: %lld us", delay_us);
+                    ALOGW("delay_us exceeds max timeout: %lld us", delay_us);
 
                     // We'll never block for more than 10 secs, instead
                     // we will split up the full timeout into chunks of
@@ -315,7 +315,7 @@
         }
     }
 
-    LOGW("Event %d was not found in the queue, already cancelled?", id);
+    ALOGW("Event %d was not found in the queue, already cancelled?", id);
 
     return NULL;
 }
diff --git a/media/libstagefright/VBRISeeker.cpp b/media/libstagefright/VBRISeeker.cpp
index 6f968be..6ac5a83 100644
--- a/media/libstagefright/VBRISeeker.cpp
+++ b/media/libstagefright/VBRISeeker.cpp
@@ -69,13 +69,13 @@
     int64_t durationUs =
         numFrames * 1000000ll * (sampleRate >= 32000 ? 1152 : 576) / sampleRate;
 
-    LOGV("duration = %.2f secs", durationUs / 1E6);
+    ALOGV("duration = %.2f secs", durationUs / 1E6);
 
     size_t numEntries = U16_AT(&vbriHeader[18]);
     size_t entrySize = U16_AT(&vbriHeader[22]);
     size_t scale = U16_AT(&vbriHeader[20]);
 
-    LOGV("%d entries, scale=%d, size_per_entry=%d",
+    ALOGV("%d entries, scale=%d, size_per_entry=%d",
          numEntries,
          scale,
          entrySize);
@@ -113,14 +113,14 @@
 
         seeker->mSegments.push(numBytes);
 
-        LOGV("entry #%d: %d offset 0x%08lx", i, numBytes, offset);
+        ALOGV("entry #%d: %d offset 0x%08lx", i, numBytes, offset);
         offset += numBytes;
     }
 
     delete[] buffer;
     buffer = NULL;
 
-    LOGI("Found VBRI header.");
+    ALOGI("Found VBRI header.");
 
     return seeker;
 }
@@ -154,7 +154,7 @@
         *pos += mSegments.itemAt(segmentIndex++);
     }
 
-    LOGV("getOffsetForTime %lld us => 0x%08lx", *timeUs, *pos);
+    ALOGV("getOffsetForTime %lld us => 0x%08lx", *timeUs, *pos);
 
     *timeUs = nowUs;
 
diff --git a/media/libstagefright/VideoSourceDownSampler.cpp b/media/libstagefright/VideoSourceDownSampler.cpp
index ea7b09a..1b66990 100644
--- a/media/libstagefright/VideoSourceDownSampler.cpp
+++ b/media/libstagefright/VideoSourceDownSampler.cpp
@@ -29,7 +29,7 @@
 
 VideoSourceDownSampler::VideoSourceDownSampler(const sp<MediaSource> &videoSource,
         int32_t width, int32_t height) {
-    LOGV("Construct VideoSourceDownSampler");
+    ALOGV("Construct VideoSourceDownSampler");
     CHECK(width > 0);
     CHECK(height > 0);
 
@@ -94,23 +94,23 @@
 }
 
 status_t VideoSourceDownSampler::start(MetaData *params) {
-    LOGV("start");
+    ALOGV("start");
     return mRealVideoSource->start();
 }
 
 status_t VideoSourceDownSampler::stop() {
-    LOGV("stop");
+    ALOGV("stop");
     return mRealVideoSource->stop();
 }
 
 sp<MetaData> VideoSourceDownSampler::getFormat() {
-    LOGV("getFormat");
+    ALOGV("getFormat");
     return mMeta;
 }
 
 status_t VideoSourceDownSampler::read(
         MediaBuffer **buffer, const ReadOptions *options) {
-    LOGV("read");
+    ALOGV("read");
     MediaBuffer *realBuffer;
     status_t err = mRealVideoSource->read(&realBuffer, options);
 
@@ -135,7 +135,7 @@
 }
 
 status_t VideoSourceDownSampler::pause() {
-    LOGV("pause");
+    ALOGV("pause");
     return mRealVideoSource->pause();
 }
 
diff --git a/media/libstagefright/WAVExtractor.cpp b/media/libstagefright/WAVExtractor.cpp
index c406964..0bcaf08 100644
--- a/media/libstagefright/WAVExtractor.cpp
+++ b/media/libstagefright/WAVExtractor.cpp
@@ -275,7 +275,7 @@
 }
 
 status_t WAVSource::start(MetaData *params) {
-    LOGV("WAVSource::start");
+    ALOGV("WAVSource::start");
 
     CHECK(!mStarted);
 
@@ -295,7 +295,7 @@
 }
 
 status_t WAVSource::stop() {
-    LOGV("WAVSource::stop");
+    ALOGV("WAVSource::stop");
 
     CHECK(mStarted);
 
@@ -308,7 +308,7 @@
 }
 
 sp<MetaData> WAVSource::getFormat() {
-    LOGV("WAVSource::getFormat");
+    ALOGV("WAVSource::getFormat");
 
     return mMeta;
 }
diff --git a/media/libstagefright/WVMExtractor.cpp b/media/libstagefright/WVMExtractor.cpp
index 26eda0c..2092cb6 100644
--- a/media/libstagefright/WVMExtractor.cpp
+++ b/media/libstagefright/WVMExtractor.cpp
@@ -53,7 +53,7 @@
         }
 
         if (gVendorLibHandle == NULL) {
-            LOGE("Failed to open libwvm.so");
+            ALOGE("Failed to open libwvm.so");
             return;
         }
     }
@@ -67,7 +67,7 @@
         mImpl = (*getInstanceFunc)(source);
         CHECK(mImpl != NULL);
     } else {
-        LOGE("Failed to locate GetInstance in libwvm.so");
+        ALOGE("Failed to locate GetInstance in libwvm.so");
     }
 }
 
diff --git a/media/libstagefright/avc_utils.cpp b/media/libstagefright/avc_utils.cpp
index 153ee33..65c1848 100644
--- a/media/libstagefright/avc_utils.cpp
+++ b/media/libstagefright/avc_utils.cpp
@@ -119,7 +119,7 @@
             cropUnitY = subHeightC * (2 - frame_mbs_only_flag);
         }
 
-        LOGV("frame_crop = (%u, %u, %u, %u), cropUnitX = %u, cropUnitY = %u",
+        ALOGV("frame_crop = (%u, %u, %u, %u), cropUnitX = %u, cropUnitY = %u",
              frame_crop_left_offset, frame_crop_right_offset,
              frame_crop_top_offset, frame_crop_bottom_offset,
              cropUnitX, cropUnitY);
@@ -290,7 +290,7 @@
     memcpy(out, picParamSet->data(), picParamSet->size());
 
 #if 0
-    LOGI("AVC seq param set");
+    ALOGI("AVC seq param set");
     hexdump(seqParamSet->data(), seqParamSet->size());
 #endif
 
@@ -301,7 +301,7 @@
     meta->setInt32(kKeyWidth, width);
     meta->setInt32(kKeyHeight, height);
 
-    LOGI("found AVC codec config (%d x %d, %s-profile level %d.%d)",
+    ALOGI("found AVC codec config (%d x %d, %s-profile level %d.%d)",
          width, height, AVCProfileToString(profile), level / 10, level % 10);
 
     return meta;
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC.cpp b/media/libstagefright/codecs/aacdec/SoftAAC.cpp
index 2abdb56..da9d280 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC.cpp
@@ -116,7 +116,7 @@
 
     Int err = PVMP4AudioDecoderInitLibrary(mConfig, mDecoderBuf);
     if (err != MP4AUDEC_SUCCESS) {
-        LOGE("Failed to initialize MP4 audio decoder");
+        ALOGE("Failed to initialize MP4 audio decoder");
         return UNKNOWN_ERROR;
     }
 
@@ -317,16 +317,16 @@
          * AAC+/eAAC+ until the first data frame is decoded.
          */
         if (decoderErr == MP4AUDEC_SUCCESS && mInputBufferCount <= 2) {
-            LOGV("audio/extended audio object type: %d + %d",
+            ALOGV("audio/extended audio object type: %d + %d",
                 mConfig->audioObjectType, mConfig->extendedAudioObjectType);
-            LOGV("aac+ upsampling factor: %d desired channels: %d",
+            ALOGV("aac+ upsampling factor: %d desired channels: %d",
                 mConfig->aacPlusUpsamplingFactor, mConfig->desiredChannels);
 
             if (mInputBufferCount == 1) {
                 mUpsamplingFactor = mConfig->aacPlusUpsamplingFactor;
                 // Check on the sampling rate to see whether it is changed.
                 if (mConfig->samplingRate != prevSamplingRate) {
-                    LOGW("Sample rate was %d Hz, but now is %d Hz",
+                    ALOGW("Sample rate was %d Hz, but now is %d Hz",
                             prevSamplingRate, mConfig->samplingRate);
 
                     // We'll hold onto the input buffer and will decode
@@ -341,7 +341,7 @@
                     mConfig->extendedAudioObjectType == MP4AUDIO_LTP) {
                     if (mUpsamplingFactor == 2) {
                         // The stream turns out to be not aacPlus mode anyway
-                        LOGW("Disable AAC+/eAAC+ since extended audio object "
+                        ALOGW("Disable AAC+/eAAC+ since extended audio object "
                              "type is %d",
                              mConfig->extendedAudioObjectType);
                         mConfig->aacPlusEnabled = 0;
@@ -351,7 +351,7 @@
                         // aacPlus mode does not buy us anything, but to cause
                         // 1. CPU load to increase, and
                         // 2. a half speed of decoding
-                        LOGW("Disable AAC+/eAAC+ since upsampling factor is 1");
+                        ALOGW("Disable AAC+/eAAC+ since upsampling factor is 1");
                         mConfig->aacPlusEnabled = 0;
                     }
                 }
@@ -367,7 +367,7 @@
             inHeader->nFilledLen -= mConfig->inputBufferUsedLength;
             inHeader->nOffset += mConfig->inputBufferUsedLength;
         } else {
-            LOGW("AAC decoder returned error %d, substituting silence",
+            ALOGW("AAC decoder returned error %d, substituting silence",
                  decoderErr);
 
             memset(outHeader->pBuffer + outHeader->nOffset, 0, numOutBytes);
diff --git a/media/libstagefright/codecs/aacenc/AACEncoder.cpp b/media/libstagefright/codecs/aacenc/AACEncoder.cpp
index 0bff52d..2b8633d 100644
--- a/media/libstagefright/codecs/aacenc/AACEncoder.cpp
+++ b/media/libstagefright/codecs/aacenc/AACEncoder.cpp
@@ -53,7 +53,7 @@
     CHECK(mApiHandle);
 
     if (VO_ERR_NONE != voGetAACEncAPI(mApiHandle)) {
-        LOGE("Failed to get api handle");
+        ALOGE("Failed to get api handle");
         return UNKNOWN_ERROR;
     }
 
@@ -70,11 +70,11 @@
     userData.memflag = VO_IMF_USERMEMOPERATOR;
     userData.memData = (VO_PTR) mMemOperator;
     if (VO_ERR_NONE != mApiHandle->Init(&mEncoderHandle, VO_AUDIO_CodingAAC, &userData)) {
-        LOGE("Failed to init AAC encoder");
+        ALOGE("Failed to init AAC encoder");
         return UNKNOWN_ERROR;
     }
     if (OK != setAudioSpecificConfigData()) {
-        LOGE("Failed to configure AAC encoder");
+        ALOGE("Failed to configure AAC encoder");
         return UNKNOWN_ERROR;
     }
 
@@ -86,7 +86,7 @@
     params.nChannels = mChannels;
     params.adtsUsed = 0;  // We add adts header in the file writer if needed.
     if (VO_ERR_NONE != mApiHandle->SetParam(mEncoderHandle, VO_PID_AAC_ENCPARAM,  &params)) {
-        LOGE("Failed to set AAC encoder parameters");
+        ALOGE("Failed to set AAC encoder parameters");
         return UNKNOWN_ERROR;
     }
 
@@ -106,18 +106,18 @@
         }
     }
 
-    LOGE("Sampling rate %d bps is not supported", sampleRate);
+    ALOGE("Sampling rate %d bps is not supported", sampleRate);
     return UNKNOWN_ERROR;
 }
 
 status_t AACEncoder::setAudioSpecificConfigData() {
-    LOGV("setAudioSpecificConfigData: %d hz, %d bps, and %d channels",
+    ALOGV("setAudioSpecificConfigData: %d hz, %d bps, and %d channels",
          mSampleRate, mBitRate, mChannels);
 
     int32_t index;
     CHECK_EQ(OK, getSampleRateTableIndex(mSampleRate, index));
     if (mChannels > 2 || mChannels <= 0) {
-        LOGE("Unsupported number of channels(%d)", mChannels);
+        ALOGE("Unsupported number of channels(%d)", mChannels);
         return UNKNOWN_ERROR;
     }
 
@@ -135,7 +135,7 @@
 
 status_t AACEncoder::start(MetaData *params) {
     if (mStarted) {
-        LOGW("Call start() when encoder already started");
+        ALOGW("Call start() when encoder already started");
         return OK;
     }
 
@@ -153,7 +153,7 @@
 
     status_t err = mSource->start(params);
     if (err != OK) {
-         LOGE("AudioSource is not available");
+         ALOGE("AudioSource is not available");
         return err;
     }
 
@@ -177,7 +177,7 @@
     }
 
     if (!mStarted) {
-        LOGW("Call stop() when encoder has not started");
+        ALOGW("Call stop() when encoder has not started");
         return ERROR_END_OF_STREAM;
     }
 
diff --git a/media/libstagefright/codecs/aacenc/Android.mk b/media/libstagefright/codecs/aacenc/Android.mk
index f9cc6a3..c2579c7 100644
--- a/media/libstagefright/codecs/aacenc/Android.mk
+++ b/media/libstagefright/codecs/aacenc/Android.mk
@@ -59,7 +59,7 @@
 
 LOCAL_ARM_MODE := arm
 
-LOCAL_STATIC_LIBRARIES := 
+LOCAL_STATIC_LIBRARIES :=
 
 LOCAL_SHARED_LIBRARIES :=
 
@@ -79,7 +79,7 @@
 endif
 
 ifeq ($(VOTT), v7)
-LOCAL_CFLAGS += -DARMV5E -DARMV7Neon -DARM_INASM -DARMV5_INASM
+LOCAL_CFLAGS += -DARMV5E -DARMV7Neon -DARM_INASM -DARMV5_INASM -DARMV6_INASM
 LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/asm/ARMV5E
 LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/asm/ARMV7
 endif
diff --git a/media/libstagefright/codecs/aacenc/SampleCode/AAC_E_SAMPLES.c b/media/libstagefright/codecs/aacenc/SampleCode/AAC_E_SAMPLES.c
index 2ea9449..2f31de4 100644
--- a/media/libstagefright/codecs/aacenc/SampleCode/AAC_E_SAMPLES.c
+++ b/media/libstagefright/codecs/aacenc/SampleCode/AAC_E_SAMPLES.c
@@ -29,11 +29,11 @@
 #include		"cmnMemory.h"
 
 #define  VO_AAC_E_OUTPUT	  1
-#define READ_SIZE	(1024*8)	
+#define READ_SIZE	(1024*8)
 unsigned char outBuf[1024*8];
 unsigned char inBuf[READ_SIZE];
 
-const char* HelpString = 
+const char* HelpString =
 "VisualOn AAC encoder Usage:\n"
 "voAACEncTest -if <inputfile.pcm> -of <outputfile.aac> -sr <samplerate> -ch <channel> -br <bitrate> -adts <adts> \n"
 "-if input file name \n"
@@ -49,7 +49,7 @@
 {
 	// notice that:
 	// bitRate/nChannels > 8000
-	// bitRate/nChannels < 160000 
+	// bitRate/nChannels < 160000
 	// bitRate/nChannels < sampleRate*6
 	param->adtsUsed = 1;
 	param->bitRate = 0;
@@ -69,7 +69,7 @@
 		{
 			argv++;
 			argc--;
-			*input_filename = *argv; 
+			*input_filename = *argv;
 		}
 		else if (!strcmp(*argv, "-of"))
 		{
diff --git a/media/libstagefright/codecs/aacenc/basic_op/basic_op.h b/media/libstagefright/codecs/aacenc/basic_op/basic_op.h
index 8291684..5cd7e5f 100644
--- a/media/libstagefright/codecs/aacenc/basic_op/basic_op.h
+++ b/media/libstagefright/codecs/aacenc/basic_op/basic_op.h
@@ -91,7 +91,7 @@
 #else
 Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2);
 #endif
-    
+
 /* Long sub,        2 */
 #if (L_SUB_IS_INLINE)
 __inline Word32 L_sub(Word32 L_var1, Word32 L_var2);
@@ -119,7 +119,7 @@
 #else
 Word16 add (Word16 var1, Word16 var2);
 #endif
-    
+
 /* Short sub,           1   */
 #if (SUB_IS_INLINE)
 __inline Word16 sub(Word16 var1, Word16 var2);
@@ -227,62 +227,64 @@
 #if ARMV4_INASM
 __inline Word32 ASM_L_shr(Word32 L_var1, Word16 var2)
 {
-	Word32 result; 
-	asm volatile( 
-		"MOV %[result], %[L_var1], ASR %[var2] \n" 
-		:[result]"=r"(result)
-		:[L_var1]"r"(L_var1), [var2]"r"(var2)
-		); 
-	return result;	
+	return L_var1 >> var2;
 }
- 
+
 __inline Word32 ASM_L_shl(Word32 L_var1, Word16 var2)
 {
-	Word32 result; 
-	asm volatile( 
-		"MOV	r2, %[L_var1] \n"
-		"MOV	r3, #0x7fffffff\n"
-		"MOV	%[result], %[L_var1], ASL %[var2] \n" 
-		"TEQ	r2, %[result], ASR %[var2]\n"
-		"EORNE  %[result],r3,r2,ASR#31\n"
-		:[result]"+r"(result)
-		:[L_var1]"r"(L_var1), [var2]"r"(var2)
-		:"r2", "r3"
-		); 
-	return result;	
+	Word32 result;
+	asm (
+		"MOV	%[result], %[L_var1], ASL %[var2] \n"
+		"TEQ	%[L_var1], %[result], ASR %[var2]\n"
+		"EORNE  %[result], %[mask], %[L_var1], ASR #31\n"
+		:[result]"=&r"(result)
+		:[L_var1]"r"(L_var1), [var2]"r"(var2), [mask]"r"(0x7fffffff)
+		);
+	return result;
 }
 
 __inline Word32 ASM_shr(Word32 L_var1, Word16 var2)
 {
-	Word32 result; 
-	asm volatile( 
+	Word32 result;
+	asm (
 		"CMP	%[var2], #15\n"
-		"MOVGE  %[var2], #15\n"
-		"MOV	%[result], %[L_var1], ASR %[var2]\n"
+		"MOVLT	%[result], %[L_var1], ASR %[var2]\n"
+		"MOVGE	%[result], %[L_var1], ASR #15\n"
 		:[result]"=r"(result)
-		:[L_var1]"r"(L_var1), [var2]"r"(var2) 
-		); 
-	return result;	
-} 
+		:[L_var1]"r"(L_var1), [var2]"r"(var2)
+		);
+	return result;
+}
 
 __inline Word32 ASM_shl(Word32 L_var1, Word16 var2)
 {
-	Word32 result; 
-	asm volatile( 
+#if ARMV6_SAT
+	Word32 result;
+	asm (
 		"CMP	%[var2], #16\n"
-		"MOVGE  %[var2], #16\n"
-		"MOV    %[result], %[L_var1], ASL %[var2]\n"
-		"MOV    r3, #1\n"
-        "MOV    r2, %[result], ASR #15\n"
-        "RSB    r3,r3,r3,LSL #15 \n"
-        "TEQ    r2, %[result], ASR #31 \n"
-        "EORNE  %[result], r3, %[result],ASR #31"
-		:[result]"+r"(result)
+		"MOVLT  %[result], %[L_var1], ASL %[var2]\n"
+		"MOVGE  %[result], %[L_var1], ASL #16\n"
+		"SSAT   %[result], #16, %[result]\n"
+		:[result]"=r"(result)
 		:[L_var1]"r"(L_var1), [var2]"r"(var2)
-		:"r2", "r3"
-		); 
-	return result;	
-} 
+		);
+	return result;
+#else
+	Word32 result;
+	Word32 tmp;
+	asm (
+		"CMP	%[var2], #16\n"
+		"MOVLT  %[result], %[L_var1], ASL %[var2]\n"
+		"MOVGE  %[result], %[L_var1], ASL #16\n"
+        "MOV    %[tmp], %[result], ASR #15\n"
+        "TEQ    %[tmp], %[result], ASR #31 \n"
+        "EORNE  %[result], %[mask], %[result],ASR #31"
+		:[result]"=&r"(result), [tmp]"=&r"(tmp)
+		:[L_var1]"r"(L_var1), [var2]"r"(var2), [mask]"r"(0x7fff)
+		);
+	return result;
+#endif
+}
 #endif
 
 /*___________________________________________________________________________
@@ -293,24 +295,30 @@
 #if (SATRUATE_IS_INLINE)
 __inline Word16 saturate(Word32 L_var1)
 {
-#if ARMV5TE_SAT
+#if ARMV6_SAT
+    Word16 result;
+	asm (
+		"SSAT %[result], #16, %[L_var1]"
+		: [result]"=r"(result)
+		: [L_var1]"r"(L_var1)
+		);
+	return result;
+#elif ARMV5TE_SAT
 	Word16 result;
+	Word32 tmp;
 	asm volatile (
-		"MOV	%[result], %[L_var1]\n"
-		"MOV	r3, #1\n"
-		"MOV	r2,%[L_var1],ASR#15\n"
-		"RSB	r3, r3, r3, LSL #15\n"
-		"TEQ	r2,%[L_var1],ASR#31\n"	
-		"EORNE	%[result],r3,%[L_var1],ASR#31\n"
-		:[result]"+r"(result)
-		:[L_var1]"r"(L_var1)
-		:"r2", "r3"			
+		"MOV	%[tmp], %[L_var1],ASR#15\n"
+		"TEQ	%[tmp], %[L_var1],ASR#31\n"
+		"EORNE	%[result], %[mask],%[L_var1],ASR#31\n"
+		"MOVEQ	%[result], %[L_var1]\n"
+		:[result]"=&r"(result), [tmp]"=&r"(tmp)
+		:[L_var1]"r"(L_var1), [mask]"r"(0x7fff)
 	);
 
 	return result;
 #else
     Word16 var_out;
-    
+
     //var_out = (L_var1 > (Word32)0X00007fffL) ? (MAX_16) : ((L_var1 < (Word32)0xffff8000L) ? (MIN_16) : ((Word16)L_var1));
 
     if (L_var1 > 0X00007fffL)
@@ -419,13 +427,13 @@
 __inline Word32 L_mult(Word16 var1, Word16 var2)
 {
 #if ARMV5TE_L_MULT
-	Word32 result; 
-	asm volatile( 
-		"SMULBB %[result], %[var1], %[var2] \n" 
-		"QADD %[result], %[result], %[result] \n" 
-		:[result]"+r"(result)
+	Word32 result;
+	asm (
+		"SMULBB %[result], %[var1], %[var2] \n"
+		"QADD %[result], %[result], %[result] \n"
+		:[result]"=r"(result)
 		:[var1]"r"(var1), [var2]"r"(var2)
-		); 
+		);
 	return result;
 #else
     Word32 L_var_out;
@@ -449,14 +457,13 @@
 __inline Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2)
 {
 #if ARMV5TE_L_MSU
-	Word32 result; 
-	asm volatile( 
-		"SMULBB %[result], %[var1], %[var2] \n" 
-		"QADD %[result], %[result], %[result] \n"
-		"QSUB %[result], %[L_var3], %[result]\n"
-		:[result]"+r"(result)
+	Word32 result;
+	asm (
+		"SMULBB %[result], %[var1], %[var2] \n"
+		"QDSUB %[result], %[L_var3], %[result]\n"
+		:[result]"=&r"(result)
 		:[L_var3]"r"(L_var3), [var1]"r"(var1), [var2]"r"(var2)
-		); 
+		);
 	return result;
 #else
     Word32 L_var_out;
@@ -473,12 +480,12 @@
 __inline Word32 L_sub(Word32 L_var1, Word32 L_var2)
 {
 #if ARMV5TE_L_SUB
-	Word32 result; 
-	asm volatile( 
+	Word32 result;
+	asm (
 		"QSUB %[result], %[L_var1], %[L_var2]\n"
-		:[result]"+r"(result)
+		:[result]"=r"(result)
 		:[L_var1]"r"(L_var1), [L_var2]"r"(L_var2)
-		); 
+		);
 	return result;
 #else
     Word32 L_var_out;
@@ -588,18 +595,16 @@
 __inline Word16 add (Word16 var1, Word16 var2)
 {
 #if ARMV5TE_ADD
-	Word32 result; 
-	asm volatile( 
-		"ADD  %[result], %[var1], %[var2] \n" 
-		"MOV  r3, #0x1\n"
-		"MOV  r2, %[result], ASR #15\n"
-		"RSB  r3, r3, r3, LSL, #15\n"
-		"TEQ  r2, %[result], ASR #31\n"
-		"EORNE %[result], r3, %[result], ASR #31"
-		:[result]"+r"(result)
-		:[var1]"r"(var1), [var2]"r"(var2)
-		:"r2", "r3"
-		); 
+	Word32 result;
+	Word32 tmp;
+	asm (
+		"ADD  %[result], %[var1], %[var2] \n"
+		"MOV  %[tmp], %[result], ASR #15 \n"
+		"TEQ  %[tmp], %[result], ASR #31 \n"
+		"EORNE %[result], %[mask], %[result], ASR #31"
+		:[result]"=&r"(result), [tmp]"=&r"(tmp)
+		:[var1]"r"(var1), [var2]"r"(var2), [mask]"r"(0x7fff)
+		);
 	return result;
 #else
     Word16 var_out;
@@ -618,18 +623,16 @@
 __inline Word16 sub(Word16 var1, Word16 var2)
 {
 #if ARMV5TE_SUB
-	Word32 result; 
-	asm volatile( 
-		"MOV   r3, #1\n"
-		"SUB   %[result], %[var1], %[var2] \n"		
-		"RSB   r3,r3,r3,LSL#15\n"
-		"MOV   r2, %[var1], ASR #15 \n" 
-		"TEQ   r2, %[var1], ASR #31 \n"
-		"EORNE %[result], r3, %[result], ASR #31 \n"
-		:[result]"+r"(result)
-		:[var1]"r"(var1), [var2]"r"(var2)
-		:"r2", "r3"
-		); 
+	Word32 result;
+	Word32 tmp;
+	asm (
+		"SUB   %[result], %[var1], %[var2] \n"
+		"MOV   %[tmp], %[var1], ASR #15 \n"
+		"TEQ   %[tmp], %[var1], ASR #31 \n"
+		"EORNE %[result], %[mask], %[result], ASR #31 \n"
+		:[result]"=&r"(result), [tmp]"=&r"(tmp)
+		:[var1]"r"(var1), [var2]"r"(var2), [mask]"r"(0x7fff)
+		);
 	return result;
 #else
     Word16 var_out;
@@ -637,7 +640,7 @@
 
     L_diff = (Word32) var1 - var2;
     var_out = saturate(L_diff);
-   
+
     return (var_out);
 #endif
 }
@@ -657,16 +660,16 @@
     {
     	var_out = 0;
     	L_num = (Word32) var1;
-    
+
     	L_denom = (Word32) var2;
-    	
+
 		//return (L_num<<15)/var2;
 
     	for (iteration = 0; iteration < 15; iteration++)
     	{
     		var_out <<= 1;
     		L_num <<= 1;
-    		
+
     		if (L_num >= L_denom)
     		{
     			L_num -= L_denom;
@@ -682,20 +685,26 @@
 #if (MULT_IS_INLINE)
 __inline Word16 mult (Word16 var1, Word16 var2)
 {
-#if ARMV5TE_MULT
-	Word32 result; 
-	asm volatile( 
-		"SMULBB r2, %[var1], %[var2] \n"
-		"MOV	r3, #1\n"
-		"MOV	%[result], r2, ASR #15\n"
-		"RSB	r3, r3, r3, LSL #15\n"
-		"MOV	r2, %[result], ASR #15\n"
-		"TEQ	r2, %[result], ASR #31\n"
-		"EORNE  %[result], r3, %[result], ASR #31 \n"
-		:[result]"+r"(result)
+#if ARMV5TE_MULT && ARMV6_SAT
+	Word32 result;
+	asm (
+		"SMULBB %[result], %[var1], %[var2] \n"
+		"SSAT   %[result], #16, %[result], ASR #15 \n"
+		:[result]"=r"(result)
 		:[var1]"r"(var1), [var2]"r"(var2)
-		:"r2", "r3"
-		); 
+		);
+	return result;
+#elif ARMV5TE_MULT
+	Word32 result, tmp;
+	asm (
+		"SMULBB %[tmp], %[var1], %[var2] \n"
+		"MOV	%[result], %[tmp], ASR #15\n"
+		"MOV	%[tmp], %[result], ASR #15\n"
+		"TEQ	%[tmp], %[result], ASR #31\n"
+		"EORNE  %[result], %[mask], %[result], ASR #31 \n"
+		:[result]"=&r"(result), [tmp]"=&r"(tmp)
+		:[var1]"r"(var1), [var2]"r"(var2), [mask]"r"(0x7fff)
+		);
 	return result;
 #else
     Word16 var_out;
@@ -718,20 +727,19 @@
 __inline Word16 norm_s (Word16 var1)
 {
 #if ARMV5TE_NORM_S
-	Word16 result; 
-	asm volatile( 
-		"MOV   r2,%[var1] \n"
-		"CMP   r2, #0\n"
-		"RSBLT %[var1], %[var1], #0 \n"
-		"CLZNE %[result], %[var1]\n"
+	Word16 result;
+	Word32 tmp;
+	asm (
+		"RSBS  %[tmp], %[var1], #0 \n"
+		"CLZLT %[result], %[var1]\n"
+		"CLZGT %[result], %[tmp]\n"
 		"SUBNE %[result], %[result], #17\n"
 		"MOVEQ %[result], #0\n"
-		"CMP   r2, #-1\n"
-		"MOVEQ %[result], #15\n" 
-		:[result]"+r"(result)
+		"CMP   %[var1], #-1\n"
+		"MOVEQ %[result], #15\n"
+		:[result]"=&r"(result), [tmp]"=&r"(tmp)
 		:[var1]"r"(var1)
-		:"r2"
-		); 
+		);
 	return result;
 #else
     Word16 var_out;
@@ -768,15 +776,15 @@
 __inline Word16 norm_l (Word32 L_var1)
 {
 #if ARMV5TE_NORM_L
-	Word16 result; 
-	asm volatile( 
+	Word16 result;
+	asm volatile(
 		"CMP    %[L_var1], #0\n"
 		"CLZNE  %[result], %[L_var1]\n"
-		"SUBNE  %[result], %[result], #1\n" 
+		"SUBNE  %[result], %[result], #1\n"
 		"MOVEQ  %[result], #0\n"
-		:[result]"+r"(result)
+		:[result]"=r"(result)
 		:[L_var1]"r"(L_var1)
-		); 
+		);
 	return result;
 #else
     //Word16 var_out;
@@ -805,84 +813,84 @@
     //}
     //return (var_out);
   Word16 a16;
-  Word16 r = 0 ;       
+  Word16 r = 0 ;
 
-   
+
   if ( L_var1 < 0 ) {
-    L_var1 = ~L_var1; 
+    L_var1 = ~L_var1;
   }
 
   if (0 == (L_var1 & 0x7fff8000)) {
     a16 = extract_l(L_var1);
     r += 16;
-       
+
     if (0 == (a16 & 0x7f80)) {
       r += 8;
-         
+
       if (0 == (a16 & 0x0078)) {
         r += 4;
-           
+
         if (0 == (a16 & 0x0006)) {
           r += 2;
-             
+
           if (0 == (a16 & 0x0001)) {
             r += 1;
           }
         }
         else {
-             
+
           if (0 == (a16 & 0x0004)) {
             r += 1;
           }
         }
       }
       else {
-           
+
         if (0 == (a16 & 0x0060)) {
           r += 2;
-             
+
           if (0 == (a16 & 0x0010)) {
             r += 1;
           }
         }
         else {
-             
+
           if (0 == (a16 & 0x0040)) {
             r += 1;
           }
         }
       }
-    } 
-    else { 
-         
+    }
+    else {
+
       if (0 == (a16 & 0x7800)) {
         r += 4;
-           
+
         if (0 == (a16 & 0x0600)) {
           r += 2;
-             
+
           if (0 == (a16 & 0x0100)) {
             r += 1;
           }
         }
         else {
-             
+
           if (0 == (a16 & 0x0400)) {
             r += 1;
           }
         }
       }
       else {
-           
+
         if (0 == (a16 & 0x6000)) {
           r += 2;
-             
+
           if (0 == (a16 & 0x1000)) {
             r += 1;
           }
         }
         else {
-             
+
           if (0 == (a16 & 0x4000)) {
             r += 1;
           }
@@ -892,38 +900,38 @@
   }
   else {
     a16 = extract_h(L_var1);
-       
+
     if (0 == (a16 & 0x7f80)) {
       r += 8;
-         
+
       if (0 == (a16 & 0x0078)) {
         r += 4 ;
-           
+
         if (0 == (a16 & 0x0006)) {
           r += 2;
-             
+
           if (0 == (a16 & 0x0001)) {
             r += 1;
           }
         }
         else {
-             
+
           if (0 == (a16 & 0x0004)) {
             r += 1;
           }
         }
       }
       else {
-           
+
         if (0 == (a16 & 0x0060)) {
           r += 2;
-             
+
           if (0 == (a16 & 0x0010)) {
             r += 1;
           }
         }
         else {
-             
+
           if (0 == (a16 & 0x0040)) {
             r += 1;
           }
@@ -931,35 +939,35 @@
       }
     }
     else {
-         
+
       if (0 == (a16 & 0x7800)) {
         r += 4;
-           
+
         if (0 == (a16 & 0x0600)) {
           r += 2;
-             
+
           if (0 == (a16 & 0x0100)) {
             r += 1;
           }
         }
         else {
-             
+
           if (0 == (a16 & 0x0400)) {
             r += 1;
           }
         }
       }
       else {
-           
+
         if (0 == (a16 & 0x6000)) {
           r += 2;
-             
+
           if (0 == (a16 & 0x1000)) {
             r += 1;
           }
         }
         else {
-             
+
           if (0 == (a16 & 0x4000)) {
             return 1;
           }
@@ -967,7 +975,7 @@
       }
     }
   }
-  
+
   return r ;
 #endif
 }
@@ -978,17 +986,15 @@
 __inline Word16 round16(Word32 L_var1)
 {
 #if ARMV5TE_ROUND
-	Word16 result; 
-	asm volatile( 
-		"MOV   r1,#0x00008000\n"
-		"QADD  %[result], %[L_var1], r1\n"
-		"MOV   %[result], %[result], ASR #16 \n" 
-		:[result]"+r"(result)
-		:[L_var1]"r"(L_var1)
-		:"r1"
-		); 
+	Word16 result;
+	asm (
+		"QADD  %[result], %[L_var1], %[bias]\n"
+		"MOV   %[result], %[result], ASR #16 \n"
+		:[result]"=r"(result)
+		:[L_var1]"r"(L_var1), [bias]"r"(0x8000)
+		);
 	return result;
-#else   
+#else
     Word16 var_out;
     Word32 L_rounded;
 
@@ -1004,14 +1010,13 @@
 __inline Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2)
 {
 #if ARMV5TE_L_MAC
-	Word32 result; 
-	asm volatile( 
+	Word32 result;
+	asm (
 		"SMULBB %[result], %[var1], %[var2]\n"
-		"QADD	%[result], %[result], %[result]\n"
-		"QADD   %[result], %[result], %[L_var3]\n"
-		:[result]"+r"(result)
+		"QDADD  %[result], %[L_var3], %[result]\n"
+		:[result]"=&r"(result)
 		: [L_var3]"r"(L_var3), [var1]"r"(var1), [var2]"r"(var2)
-		); 
+		);
 	return result;
 #else
     Word32 L_var_out;
@@ -1028,12 +1033,12 @@
 __inline Word32 L_add (Word32 L_var1, Word32 L_var2)
 {
 #if ARMV5TE_L_ADD
-	Word32 result; 
-	asm volatile( 
+	Word32 result;
+	asm (
 		"QADD %[result], %[L_var1], %[L_var2]\n"
-		:[result]"+r"(result)
+		:[result]"=r"(result)
 		:[L_var1]"r"(L_var1), [L_var2]"r"(L_var2)
-		); 
+		);
 	return result;
 #else
     Word32 L_var_out;
@@ -1114,7 +1119,7 @@
 
     L_var3 = L_msu (L_var3, var1, var2);
     var_out = (Word16)((L_var3 + 0x8000L) >> 16);
-    
+
     return (var_out);
 }
 #endif
diff --git a/media/libstagefright/codecs/aacenc/basic_op/basicop2.c b/media/libstagefright/codecs/aacenc/basic_op/basicop2.c
index 82d3f38..d43bbd9 100644
--- a/media/libstagefright/codecs/aacenc/basic_op/basicop2.c
+++ b/media/libstagefright/codecs/aacenc/basic_op/basicop2.c
@@ -16,7 +16,7 @@
 /*******************************************************************************
 	File:		basicop2.c
 
-	Content:	Basic arithmetic operators. 
+	Content:	Basic arithmetic operators.
 
 *******************************************************************************/
 
@@ -462,7 +462,7 @@
     {
         L_var_out = MAX_32;
     }
-        
+
     return (L_var_out);
 }
 #endif
diff --git a/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c b/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c
index 0ad82f0..982f4fd 100644
--- a/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c
+++ b/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c
@@ -17,7 +17,7 @@
 	File:		oper_32b.c
 
 	Content:	  This file contains operations in double precision.
- 
+
 *******************************************************************************/
 
 #include "typedef.h"
@@ -200,12 +200,12 @@
 }
 
 /*!
- 
-  \brief  calculates the log dualis times 4 of argument 
+
+  \brief  calculates the log dualis times 4 of argument
           iLog4(x) = (Word32)(4 * log(value)/log(2.0))
 
   \return ilog4 value
- 
+
 */
 Word16 iLog4(Word32 value)
 {
@@ -225,7 +225,7 @@
     iLog4 = (-(iLog4 << 2) - norm_s(tmp16)) - 1;
   }
   else {
-    iLog4 = -128; /* -(INT_BITS*4); */                                          
+    iLog4 = -128; /* -(INT_BITS*4); */
   }
 
   return iLog4;
@@ -268,79 +268,79 @@
 }
 
 static const Word32 pow2Table[POW2_TABLE_SIZE] = {
-0x7fffffff, 0x7fa765ad, 0x7f4f08ae, 0x7ef6e8da, 
-0x7e9f0606, 0x7e476009, 0x7deff6b6, 0x7d98c9e6, 
-0x7d41d96e, 0x7ceb2523, 0x7c94acde, 0x7c3e7073, 
-0x7be86fb9, 0x7b92aa88, 0x7b3d20b6, 0x7ae7d21a, 
-0x7a92be8b, 0x7a3de5df, 0x79e947ef, 0x7994e492, 
-0x7940bb9e, 0x78ecccec, 0x78991854, 0x78459dac, 
-0x77f25cce, 0x779f5591, 0x774c87cc, 0x76f9f359, 
-0x76a7980f, 0x765575c8, 0x76038c5b, 0x75b1dba2, 
-0x75606374, 0x750f23ab, 0x74be1c20, 0x746d4cac, 
-0x741cb528, 0x73cc556d, 0x737c2d55, 0x732c3cba, 
-0x72dc8374, 0x728d015d, 0x723db650, 0x71eea226, 
-0x719fc4b9, 0x71511de4, 0x7102ad80, 0x70b47368, 
-0x70666f76, 0x7018a185, 0x6fcb096f, 0x6f7da710, 
-0x6f307a41, 0x6ee382de, 0x6e96c0c3, 0x6e4a33c9, 
-0x6dfddbcc, 0x6db1b8a8, 0x6d65ca38, 0x6d1a1057, 
-0x6cce8ae1, 0x6c8339b2, 0x6c381ca6, 0x6bed3398, 
-0x6ba27e66, 0x6b57fce9, 0x6b0daeff, 0x6ac39485, 
-0x6a79ad56, 0x6a2ff94f, 0x69e6784d, 0x699d2a2c, 
-0x69540ec9, 0x690b2601, 0x68c26fb1, 0x6879ebb6, 
-0x683199ed, 0x67e97a34, 0x67a18c68, 0x6759d065, 
-0x6712460b, 0x66caed35, 0x6683c5c3, 0x663ccf92, 
-0x65f60a80, 0x65af766a, 0x6569132f, 0x6522e0ad, 
-0x64dcdec3, 0x64970d4f, 0x64516c2e, 0x640bfb41, 
-0x63c6ba64, 0x6381a978, 0x633cc85b, 0x62f816eb, 
-0x62b39509, 0x626f4292, 0x622b1f66, 0x61e72b65, 
-0x61a3666d, 0x615fd05f, 0x611c6919, 0x60d9307b, 
-0x60962665, 0x60534ab7, 0x60109d51, 0x5fce1e12, 
-0x5f8bccdb, 0x5f49a98c, 0x5f07b405, 0x5ec5ec26, 
-0x5e8451d0, 0x5e42e4e3, 0x5e01a540, 0x5dc092c7, 
-0x5d7fad59, 0x5d3ef4d7, 0x5cfe6923, 0x5cbe0a1c, 
-0x5c7dd7a4, 0x5c3dd19c, 0x5bfdf7e5, 0x5bbe4a61, 
-0x5b7ec8f2, 0x5b3f7377, 0x5b0049d4, 0x5ac14bea, 
-0x5a82799a, 0x5a43d2c6, 0x5a055751, 0x59c7071c, 
-0x5988e209, 0x594ae7fb, 0x590d18d3, 0x58cf7474, 
-0x5891fac1, 0x5854ab9b, 0x581786e6, 0x57da8c83, 
-0x579dbc57, 0x57611642, 0x57249a29, 0x56e847ef, 
-0x56ac1f75, 0x567020a0, 0x56344b52, 0x55f89f70, 
-0x55bd1cdb, 0x5581c378, 0x55469329, 0x550b8bd4, 
-0x54d0ad5b, 0x5495f7a1, 0x545b6a8b, 0x542105fd, 
-0x53e6c9db, 0x53acb607, 0x5372ca68, 0x533906e0, 
-0x52ff6b55, 0x52c5f7aa, 0x528cabc3, 0x52538786, 
-0x521a8ad7, 0x51e1b59a, 0x51a907b4, 0x5170810b, 
-0x51382182, 0x50ffe8fe, 0x50c7d765, 0x508fec9c, 
-0x50582888, 0x50208b0e, 0x4fe91413, 0x4fb1c37c, 
-0x4f7a9930, 0x4f439514, 0x4f0cb70c, 0x4ed5ff00, 
-0x4e9f6cd4, 0x4e69006e, 0x4e32b9b4, 0x4dfc988c, 
-0x4dc69cdd, 0x4d90c68b, 0x4d5b157e, 0x4d25899c, 
-0x4cf022ca, 0x4cbae0ef, 0x4c85c3f1, 0x4c50cbb8, 
-0x4c1bf829, 0x4be7492b, 0x4bb2bea5, 0x4b7e587d, 
-0x4b4a169c, 0x4b15f8e6, 0x4ae1ff43, 0x4aae299b, 
-0x4a7a77d5, 0x4a46e9d6, 0x4a137f88, 0x49e038d0, 
-0x49ad1598, 0x497a15c4, 0x4947393f, 0x49147fee, 
-0x48e1e9ba, 0x48af768a, 0x487d2646, 0x484af8d6, 
-0x4818ee22, 0x47e70611, 0x47b5408c, 0x47839d7b, 
-0x47521cc6, 0x4720be55, 0x46ef8210, 0x46be67e0, 
-0x468d6fae, 0x465c9961, 0x462be4e2, 0x45fb521a, 
-0x45cae0f2, 0x459a9152, 0x456a6323, 0x453a564d, 
-0x450a6abb, 0x44daa054, 0x44aaf702, 0x447b6ead, 
-0x444c0740, 0x441cc0a3, 0x43ed9ac0, 0x43be9580, 
-0x438fb0cb, 0x4360ec8d, 0x433248ae, 0x4303c517, 
-0x42d561b4, 0x42a71e6c, 0x4278fb2b, 0x424af7da, 
-0x421d1462, 0x41ef50ae, 0x41c1aca8, 0x41942839, 
-0x4166c34c, 0x41397dcc, 0x410c57a2, 0x40df50b8, 
-0x40b268fa, 0x4085a051, 0x4058f6a8, 0x402c6be9 
+0x7fffffff, 0x7fa765ad, 0x7f4f08ae, 0x7ef6e8da,
+0x7e9f0606, 0x7e476009, 0x7deff6b6, 0x7d98c9e6,
+0x7d41d96e, 0x7ceb2523, 0x7c94acde, 0x7c3e7073,
+0x7be86fb9, 0x7b92aa88, 0x7b3d20b6, 0x7ae7d21a,
+0x7a92be8b, 0x7a3de5df, 0x79e947ef, 0x7994e492,
+0x7940bb9e, 0x78ecccec, 0x78991854, 0x78459dac,
+0x77f25cce, 0x779f5591, 0x774c87cc, 0x76f9f359,
+0x76a7980f, 0x765575c8, 0x76038c5b, 0x75b1dba2,
+0x75606374, 0x750f23ab, 0x74be1c20, 0x746d4cac,
+0x741cb528, 0x73cc556d, 0x737c2d55, 0x732c3cba,
+0x72dc8374, 0x728d015d, 0x723db650, 0x71eea226,
+0x719fc4b9, 0x71511de4, 0x7102ad80, 0x70b47368,
+0x70666f76, 0x7018a185, 0x6fcb096f, 0x6f7da710,
+0x6f307a41, 0x6ee382de, 0x6e96c0c3, 0x6e4a33c9,
+0x6dfddbcc, 0x6db1b8a8, 0x6d65ca38, 0x6d1a1057,
+0x6cce8ae1, 0x6c8339b2, 0x6c381ca6, 0x6bed3398,
+0x6ba27e66, 0x6b57fce9, 0x6b0daeff, 0x6ac39485,
+0x6a79ad56, 0x6a2ff94f, 0x69e6784d, 0x699d2a2c,
+0x69540ec9, 0x690b2601, 0x68c26fb1, 0x6879ebb6,
+0x683199ed, 0x67e97a34, 0x67a18c68, 0x6759d065,
+0x6712460b, 0x66caed35, 0x6683c5c3, 0x663ccf92,
+0x65f60a80, 0x65af766a, 0x6569132f, 0x6522e0ad,
+0x64dcdec3, 0x64970d4f, 0x64516c2e, 0x640bfb41,
+0x63c6ba64, 0x6381a978, 0x633cc85b, 0x62f816eb,
+0x62b39509, 0x626f4292, 0x622b1f66, 0x61e72b65,
+0x61a3666d, 0x615fd05f, 0x611c6919, 0x60d9307b,
+0x60962665, 0x60534ab7, 0x60109d51, 0x5fce1e12,
+0x5f8bccdb, 0x5f49a98c, 0x5f07b405, 0x5ec5ec26,
+0x5e8451d0, 0x5e42e4e3, 0x5e01a540, 0x5dc092c7,
+0x5d7fad59, 0x5d3ef4d7, 0x5cfe6923, 0x5cbe0a1c,
+0x5c7dd7a4, 0x5c3dd19c, 0x5bfdf7e5, 0x5bbe4a61,
+0x5b7ec8f2, 0x5b3f7377, 0x5b0049d4, 0x5ac14bea,
+0x5a82799a, 0x5a43d2c6, 0x5a055751, 0x59c7071c,
+0x5988e209, 0x594ae7fb, 0x590d18d3, 0x58cf7474,
+0x5891fac1, 0x5854ab9b, 0x581786e6, 0x57da8c83,
+0x579dbc57, 0x57611642, 0x57249a29, 0x56e847ef,
+0x56ac1f75, 0x567020a0, 0x56344b52, 0x55f89f70,
+0x55bd1cdb, 0x5581c378, 0x55469329, 0x550b8bd4,
+0x54d0ad5b, 0x5495f7a1, 0x545b6a8b, 0x542105fd,
+0x53e6c9db, 0x53acb607, 0x5372ca68, 0x533906e0,
+0x52ff6b55, 0x52c5f7aa, 0x528cabc3, 0x52538786,
+0x521a8ad7, 0x51e1b59a, 0x51a907b4, 0x5170810b,
+0x51382182, 0x50ffe8fe, 0x50c7d765, 0x508fec9c,
+0x50582888, 0x50208b0e, 0x4fe91413, 0x4fb1c37c,
+0x4f7a9930, 0x4f439514, 0x4f0cb70c, 0x4ed5ff00,
+0x4e9f6cd4, 0x4e69006e, 0x4e32b9b4, 0x4dfc988c,
+0x4dc69cdd, 0x4d90c68b, 0x4d5b157e, 0x4d25899c,
+0x4cf022ca, 0x4cbae0ef, 0x4c85c3f1, 0x4c50cbb8,
+0x4c1bf829, 0x4be7492b, 0x4bb2bea5, 0x4b7e587d,
+0x4b4a169c, 0x4b15f8e6, 0x4ae1ff43, 0x4aae299b,
+0x4a7a77d5, 0x4a46e9d6, 0x4a137f88, 0x49e038d0,
+0x49ad1598, 0x497a15c4, 0x4947393f, 0x49147fee,
+0x48e1e9ba, 0x48af768a, 0x487d2646, 0x484af8d6,
+0x4818ee22, 0x47e70611, 0x47b5408c, 0x47839d7b,
+0x47521cc6, 0x4720be55, 0x46ef8210, 0x46be67e0,
+0x468d6fae, 0x465c9961, 0x462be4e2, 0x45fb521a,
+0x45cae0f2, 0x459a9152, 0x456a6323, 0x453a564d,
+0x450a6abb, 0x44daa054, 0x44aaf702, 0x447b6ead,
+0x444c0740, 0x441cc0a3, 0x43ed9ac0, 0x43be9580,
+0x438fb0cb, 0x4360ec8d, 0x433248ae, 0x4303c517,
+0x42d561b4, 0x42a71e6c, 0x4278fb2b, 0x424af7da,
+0x421d1462, 0x41ef50ae, 0x41c1aca8, 0x41942839,
+0x4166c34c, 0x41397dcc, 0x410c57a2, 0x40df50b8,
+0x40b268fa, 0x4085a051, 0x4058f6a8, 0x402c6be9
 };
 
 /*!
- 
-  \brief calculates 2 ^ (x/y) for x<=0, y > 0, x <= 32768 * y 
-  
+
+  \brief calculates 2 ^ (x/y) for x<=0, y > 0, x <= 32768 * y
+
   avoids integer division
-  
-  \return 
+
+  \return
 */
 Word32 pow2_xy(Word32 x, Word32 y)
 {
@@ -355,7 +355,7 @@
   fPart = tmp2 - iPart*y;
   iPart = min(iPart,INT_BITS-1);
 
-  res = pow2Table[(POW2_TABLE_SIZE*fPart)/y] >> iPart; 
- 
+  res = pow2Table[(POW2_TABLE_SIZE*fPart)/y] >> iPart;
+
   return(res);
-}
\ No newline at end of file
+}
diff --git a/media/libstagefright/codecs/aacenc/basic_op/oper_32b.h b/media/libstagefright/codecs/aacenc/basic_op/oper_32b.h
index 1d35e5e..6e5844f 100644
--- a/media/libstagefright/codecs/aacenc/basic_op/oper_32b.h
+++ b/media/libstagefright/codecs/aacenc/basic_op/oper_32b.h
@@ -51,21 +51,21 @@
     swHigh1 = (Word16)(L_var2 >> 16);
 
     l_var_out = (long)swLow1 * (long)var1 >> 15;
-    
+
     l_var_out += swHigh1 * var1 << 1;
-    
+
     return(l_var_out);
 }
 
 __inline Word32 L_mpy_wx(Word32 L_var2, Word16 var1)
 {
 #if ARMV5TE_L_MPY_LS
-	Word32 result; 
-	asm volatile( 
-		"SMULWB  %[result], %[L_var2], %[var1] \n" 
-		:[result]"+r"(result)
+	Word32 result;
+	asm volatile(
+		"SMULWB  %[result], %[L_var2], %[var1] \n"
+		:[result]"=r"(result)
 		:[L_var2]"r"(L_var2), [var1]"r"(var1)
-		); 
+		);
 	return result;
 #else
     unsigned short swLow1;
@@ -75,9 +75,9 @@
     swLow1 = (unsigned short)(L_var2);
     swHigh1 = (Word16)(L_var2 >> 16);
 
-    l_var_out = (long)swLow1 * (long)var1 >> 16;    
+    l_var_out = (long)swLow1 * (long)var1 >> 16;
     l_var_out += swHigh1 * var1;
-    
+
     return(l_var_out);
 #endif
 }
diff --git a/media/libstagefright/codecs/aacenc/basic_op/typedef.h b/media/libstagefright/codecs/aacenc/basic_op/typedef.h
index 1030803..b1f8225 100644
--- a/media/libstagefright/codecs/aacenc/basic_op/typedef.h
+++ b/media/libstagefright/codecs/aacenc/basic_op/typedef.h
@@ -30,7 +30,7 @@
 /*
  * this is the original code from the ETSI file typedef.h
  */
-   
+
 #if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__ZTC__)
 typedef signed char Word8;
 typedef short Word16;
diff --git a/media/libstagefright/codecs/aacenc/basic_op/typedefs.h b/media/libstagefright/codecs/aacenc/basic_op/typedefs.h
index c7e774b..6059237 100644
--- a/media/libstagefright/codecs/aacenc/basic_op/typedefs.h
+++ b/media/libstagefright/codecs/aacenc/basic_op/typedefs.h
@@ -48,14 +48,12 @@
 #define assert(_Expression)     ((void)0)
 #endif
 
-#ifdef LINUX
-#define __inline static __inline__
-#endif
+#define __inline static __inline
 
 #define INT_BITS   32
 /*
 ********************************************************************************
-*                         DEFINITION OF CONSTANTS 
+*                         DEFINITION OF CONSTANTS
 ********************************************************************************
 */
 /*
@@ -77,12 +75,12 @@
 /*
  ********* define 32 bit signed/unsigned types & constants
  */
-typedef long Word32;
-typedef unsigned long UWord32;
+typedef int Word32;
+typedef unsigned int UWord32;
 
 
 
-#ifdef LINUX
+#ifndef _MSC_VER
 typedef long long Word64;
 typedef unsigned long long UWord64;
 #else
@@ -120,16 +118,23 @@
     #define ARMV5TE_L_MULT        1
     #define ARMV5TE_L_MAC         1
     #define ARMV5TE_L_MSU         1
-   
-    
+
+
     #define ARMV5TE_DIV_S         1
     #define ARMV5TE_ROUND         1
     #define ARMV5TE_MULT          1
-    
+
     #define ARMV5TE_NORM_S        1
     #define ARMV5TE_NORM_L        1
 	#define ARMV5TE_L_MPY_LS	  1
 #endif
+#if ARMV6_INASM
+    #undef  ARMV5TE_ADD
+    #define ARMV5TE_ADD           0
+    #undef  ARMV5TE_SUB
+    #define ARMV5TE_SUB           0
+    #define ARMV6_SAT             1
+#endif
 
 //basic operation functions optimization flags
 #define SATRUATE_IS_INLINE              1   //define saturate as inline function
@@ -149,7 +154,7 @@
 #define ROUND_IS_INLINE                 1   //define round as inline function
 #define L_MAC_IS_INLINE                 1   //define L_mac as inline function
 #define L_ADD_IS_INLINE                 1   //define L_add as inline function
-#define EXTRACT_H_IS_INLINE             1   //define extract_h as inline function 
+#define EXTRACT_H_IS_INLINE             1   //define extract_h as inline function
 #define EXTRACT_L_IS_INLINE             1   //define extract_l as inline function        //???
 #define MULT_R_IS_INLINE                1   //define mult_r as inline function
 #define SHR_R_IS_INLINE                 1   //define shr_r as inline function
diff --git a/media/libstagefright/codecs/aacenc/inc/aac_rom.h b/media/libstagefright/codecs/aacenc/inc/aac_rom.h
index 784bb70..8e206b7 100644
--- a/media/libstagefright/codecs/aacenc/inc/aac_rom.h
+++ b/media/libstagefright/codecs/aacenc/inc/aac_rom.h
@@ -16,7 +16,7 @@
 /*******************************************************************************
 	File:		aac_rom.h
 
-	Content:	constant tables 
+	Content:	constant tables
 
 *******************************************************************************/
 
diff --git a/media/libstagefright/codecs/aacenc/inc/aacenc_core.h b/media/libstagefright/codecs/aacenc/inc/aacenc_core.h
index 41ba756..bb75b6d 100644
--- a/media/libstagefright/codecs/aacenc/inc/aacenc_core.h
+++ b/media/libstagefright/codecs/aacenc/inc/aacenc_core.h
@@ -47,7 +47,7 @@
 
 
 typedef struct {
-	
+
   AACENC_CONFIG config;     /* Word16 size: 8 */
 
   ELEMENT_INFO elInfo;      /* Word16 size: 4 */
@@ -102,7 +102,7 @@
                     const UWord8       *ancBytes,      /*!< pointer to ancillary data bytes */
                     Word16             *numAncBytes,   /*!< number of ancillary Data Bytes, send as fill element  */
                     UWord8             *outBytes,      /*!< pointer to output buffer            */
-                    Word32             *numOutBytes    /*!< number of bytes in output buffer */
+                    VO_U32             *numOutBytes    /*!< number of bytes in output buffer */
                     );
 
 /*---------------------------------------------------------------------------
diff --git a/media/libstagefright/codecs/aacenc/inc/adj_thr.h b/media/libstagefright/codecs/aacenc/inc/adj_thr.h
index f7cb888..0f4bb5e 100644
--- a/media/libstagefright/codecs/aacenc/inc/adj_thr.h
+++ b/media/libstagefright/codecs/aacenc/inc/adj_thr.h
@@ -16,7 +16,7 @@
 /*******************************************************************************
 	File:		adj_thr.h
 
-	Content:	Threshold compensation function 
+	Content:	Threshold compensation function
 
 *******************************************************************************/
 
@@ -44,7 +44,7 @@
                       PSY_OUT_ELEMENT *psyOutElement,
                       Word16 *chBitDistribution,
                       Word16 logSfbEnergy[MAX_CHANNELS][MAX_GROUPED_SFB],
-                      Word16 sfbNRelevantLines[MAX_CHANNELS][MAX_GROUPED_SFB],                      
+                      Word16 sfbNRelevantLines[MAX_CHANNELS][MAX_GROUPED_SFB],
                       QC_OUT_ELEMENT* qcOE,
 					  ELEMENT_BITS* elBits,
 					  const Word16 nChannels,
diff --git a/media/libstagefright/codecs/aacenc/inc/adj_thr_data.h b/media/libstagefright/codecs/aacenc/inc/adj_thr_data.h
index 9ac4664..30132d8 100644
--- a/media/libstagefright/codecs/aacenc/inc/adj_thr_data.h
+++ b/media/libstagefright/codecs/aacenc/inc/adj_thr_data.h
@@ -16,7 +16,7 @@
 /*******************************************************************************
 	File:		adj_thr_data.h
 
-	Content:	Threshold compensation parameter 
+	Content:	Threshold compensation parameter
 
 *******************************************************************************/
 
diff --git a/media/libstagefright/codecs/aacenc/inc/bitbuffer.h b/media/libstagefright/codecs/aacenc/inc/bitbuffer.h
index e538064..7c79f07 100644
--- a/media/libstagefright/codecs/aacenc/inc/bitbuffer.h
+++ b/media/libstagefright/codecs/aacenc/inc/bitbuffer.h
@@ -76,7 +76,7 @@
 
 
 Word16 WriteBits(HANDLE_BIT_BUF hBitBuf,
-                 Word32 writeValue,
+                 UWord32 writeValue,
                  Word16 noBitsToWrite);
 
 void ResetBitBuf(HANDLE_BIT_BUF hBitBuf,
diff --git a/media/libstagefright/codecs/aacenc/inc/bitenc.h b/media/libstagefright/codecs/aacenc/inc/bitenc.h
index 6ded3c6..6a58aeb 100644
--- a/media/libstagefright/codecs/aacenc/inc/bitenc.h
+++ b/media/libstagefright/codecs/aacenc/inc/bitenc.h
@@ -26,7 +26,7 @@
 #include "qc_data.h"
 #include "tns.h"
 #include "channel_map.h"
-#include "interface.h"  
+#include "interface.h"
 
 struct BITSTREAMENCODER_INIT
 {
diff --git a/media/libstagefright/codecs/aacenc/inc/config.h b/media/libstagefright/codecs/aacenc/inc/config.h
index 3b29cef..b0b4c26 100644
--- a/media/libstagefright/codecs/aacenc/inc/config.h
+++ b/media/libstagefright/codecs/aacenc/inc/config.h
@@ -33,4 +33,4 @@
 #define MINBITS_COEF		744
 
 
-#endif
\ No newline at end of file
+#endif
diff --git a/media/libstagefright/codecs/aacenc/inc/interface.h b/media/libstagefright/codecs/aacenc/inc/interface.h
index 966ac99..a42e6a9 100644
--- a/media/libstagefright/codecs/aacenc/inc/interface.h
+++ b/media/libstagefright/codecs/aacenc/inc/interface.h
@@ -55,11 +55,11 @@
   Word16  windowShape;
   Word16  groupingMask;
   Word16  sfbOffsets[MAX_GROUPED_SFB+1];
-  Word16  mdctScale; 
-  Word32 *sfbEnergy; 
+  Word16  mdctScale;
+  Word32 *sfbEnergy;
   Word32 *sfbSpreadedEnergy;
-  Word32 *sfbThreshold;       
-  Word32 *mdctSpectrum;        
+  Word32 *sfbThreshold;
+  Word32 *mdctSpectrum;
   Word32  sfbEnSumLR;
   Word32  sfbEnSumMS;
   Word32 sfbDist[MAX_GROUPED_SFB];
diff --git a/media/libstagefright/codecs/aacenc/inc/line_pe.h b/media/libstagefright/codecs/aacenc/inc/line_pe.h
index 038d5a3..116d5a8 100644
--- a/media/libstagefright/codecs/aacenc/inc/line_pe.h
+++ b/media/libstagefright/codecs/aacenc/inc/line_pe.h
@@ -24,8 +24,8 @@
 #define __LINE_PE_H
 
 
-#include "psy_const.h" 
-#include "interface.h" 
+#include "psy_const.h"
+#include "interface.h"
 
 
 typedef struct {
@@ -72,4 +72,4 @@
 
 
 
-#endif 
+#endif
diff --git a/media/libstagefright/codecs/aacenc/inc/psy_configuration.h b/media/libstagefright/codecs/aacenc/inc/psy_configuration.h
index 9abfc99..f6981fa 100644
--- a/media/libstagefright/codecs/aacenc/inc/psy_configuration.h
+++ b/media/libstagefright/codecs/aacenc/inc/psy_configuration.h
@@ -31,7 +31,7 @@
 
   Word16 sfbCnt;
   Word16 sfbActive;   /* number of sf bands containing energy after lowpass */
-  Word16 *sfbOffset;
+  const Word16 *sfbOffset;
 
   Word32 sfbThresholdQuiet[MAX_SFB_LONG];
 
@@ -61,7 +61,7 @@
 
   Word16 sfbCnt;
   Word16 sfbActive;   /* number of sf bands containing energy after lowpass */
-  Word16 *sfbOffset;
+  const Word16 *sfbOffset;
 
   Word32 sfbThresholdQuiet[MAX_SFB_SHORT];
 
diff --git a/media/libstagefright/codecs/aacenc/inc/psy_const.h b/media/libstagefright/codecs/aacenc/inc/psy_const.h
index b05d683..19fb9b2 100644
--- a/media/libstagefright/codecs/aacenc/inc/psy_const.h
+++ b/media/libstagefright/codecs/aacenc/inc/psy_const.h
@@ -69,7 +69,7 @@
 
 #define BLOCK_SWITCHING_OFFSET		   (1*1024+3*128+64+128)
 #define BLOCK_SWITCHING_DATA_SIZE          FRAME_LEN_LONG
-										    
+
 #define TRANSFORM_OFFSET_LONG    0
 #define TRANSFORM_OFFSET_SHORT   448
 
diff --git a/media/libstagefright/codecs/aacenc/inc/psy_main.h b/media/libstagefright/codecs/aacenc/inc/psy_main.h
index 5fcbe13..2ccac60 100644
--- a/media/libstagefright/codecs/aacenc/inc/psy_main.h
+++ b/media/libstagefright/codecs/aacenc/inc/psy_main.h
@@ -54,9 +54,9 @@
                     Word16 bandwidth);
 
 
-Word16 psyMain(Word16                   nChannels,   /*!< total number of channels */              
+Word16 psyMain(Word16                   nChannels,   /*!< total number of channels */
                ELEMENT_INFO             *elemInfo,
-               Word16                   *timeSignal, /*!< interleaved time signal */ 
+               Word16                   *timeSignal, /*!< interleaved time signal */
                PSY_DATA                 psyData[MAX_CHANNELS],
                TNS_DATA                 tnsData[MAX_CHANNELS],
                PSY_CONFIGURATION_LONG*  psyConfLong,
diff --git a/media/libstagefright/codecs/aacenc/inc/qc_main.h b/media/libstagefright/codecs/aacenc/inc/qc_main.h
index 924a06d..8f83973 100644
--- a/media/libstagefright/codecs/aacenc/inc/qc_main.h
+++ b/media/libstagefright/codecs/aacenc/inc/qc_main.h
@@ -35,7 +35,7 @@
 
 Word16 QCNew(QC_STATE *hQC, VO_MEM_OPERATOR *pMemOP);
 
-Word16 QCInit(QC_STATE *hQC, 
+Word16 QCInit(QC_STATE *hQC,
               struct QC_INIT *init);
 
 void QCDelete(QC_STATE *hQC, VO_MEM_OPERATOR *pMemOP);
diff --git a/media/libstagefright/codecs/aacenc/inc/quantize.h b/media/libstagefright/codecs/aacenc/inc/quantize.h
index 7dac2bf..1cafef6 100644
--- a/media/libstagefright/codecs/aacenc/inc/quantize.h
+++ b/media/libstagefright/codecs/aacenc/inc/quantize.h
@@ -28,7 +28,7 @@
 
 #define MAX_QUANT 8191
 
-void QuantizeSpectrum(Word16 sfbCnt, 
+void QuantizeSpectrum(Word16 sfbCnt,
                       Word16 maxSfbPerGroup,
                       Word16 sfbPerGroup,
                       Word16 *sfbOffset, Word32 *mdctSpectrum,
diff --git a/media/libstagefright/codecs/aacenc/inc/sf_estim.h b/media/libstagefright/codecs/aacenc/inc/sf_estim.h
index 11436a2..997eba5 100644
--- a/media/libstagefright/codecs/aacenc/inc/sf_estim.h
+++ b/media/libstagefright/codecs/aacenc/inc/sf_estim.h
@@ -23,7 +23,7 @@
 #ifndef __SF_ESTIM_H__
 #define __SF_ESTIM_H__
 /*
-   Scale factor estimation 
+   Scale factor estimation
  */
 #include "psy_const.h"
 #include "interface.h"
@@ -43,4 +43,4 @@
                      Word16          logSfbFormFactor[MAX_CHANNELS][MAX_GROUPED_SFB],
                      Word16          sfbNRelevantLines[MAX_CHANNELS][MAX_GROUPED_SFB],
                      const Word16    nChannels);
-#endif
\ No newline at end of file
+#endif
diff --git a/media/libstagefright/codecs/aacenc/inc/stat_bits.h b/media/libstagefright/codecs/aacenc/inc/stat_bits.h
index fff3d14..9cddc1d 100644
--- a/media/libstagefright/codecs/aacenc/inc/stat_bits.h
+++ b/media/libstagefright/codecs/aacenc/inc/stat_bits.h
@@ -28,7 +28,7 @@
 
 Word16 countStaticBitdemand(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
                             PSY_OUT_ELEMENT *psyOutElement,
-                            Word16 nChannels, 
+                            Word16 nChannels,
 							Word16 adtsUsed);
 
 #endif /* __STAT_BITS_H */
diff --git a/media/libstagefright/codecs/aacenc/inc/tns_param.h b/media/libstagefright/codecs/aacenc/inc/tns_param.h
index 78265bb..0aa33c3 100644
--- a/media/libstagefright/codecs/aacenc/inc/tns_param.h
+++ b/media/libstagefright/codecs/aacenc/inc/tns_param.h
@@ -44,7 +44,7 @@
 }TNS_INFO_TAB;
 
 
-void GetTnsParam(TNS_CONFIG_TABULATED *tnsConfigTab, 
+void GetTnsParam(TNS_CONFIG_TABULATED *tnsConfigTab,
                  Word32 bitRate, Word16 channels, Word16 blockType);
 
 void GetTnsMaxBands(Word32 samplingRate, Word16 blockType, Word16* tnsMaxSfb);
diff --git a/media/libstagefright/codecs/aacenc/inc/transform.h b/media/libstagefright/codecs/aacenc/inc/transform.h
index 93d5ffe..311cef5 100644
--- a/media/libstagefright/codecs/aacenc/inc/transform.h
+++ b/media/libstagefright/codecs/aacenc/inc/transform.h
@@ -24,7 +24,7 @@
 #define __TRANSFORM_H__
 
 #include "typedef.h"
-                  
+
 void Transform_Real(Word16 *mdctDelayBuffer,
                     Word16 *timeSignal,
                     Word16 chIncrement,     /*! channel increment */
@@ -33,4 +33,4 @@
                     Word16 windowSequence
                     );
 
-#endif
\ No newline at end of file
+#endif
diff --git a/media/libstagefright/codecs/aacenc/src/aac_rom.c b/media/libstagefright/codecs/aacenc/src/aac_rom.c
index 16b44e0..127322d 100644
--- a/media/libstagefright/codecs/aacenc/src/aac_rom.c
+++ b/media/libstagefright/codecs/aacenc/src/aac_rom.c
@@ -24,14 +24,14 @@
 
 #if defined (ARMV5E) && !defined (ARMV7Neon)
 
-/* 
- *  Q30 for 128 and 1024 
+/*
+ *  Q30 for 128 and 1024
  *
  * for (i = 0; i < num/4; i++) {
  *   angle = (i + 0.125) * M_PI / num;
  *   x = cos(angle) * (1 << 30);
  *   x = sin(angle) * (1 << 30);
- * 
+ *
  *   angle = (num/2 - 1 - i + 0.125) * M_PI / num;
  *   x = cos(angle) * (1 << 30);
  *   x = sin(angle) * (1 << 30);
@@ -39,313 +39,313 @@
  */
 const int cossintab[128 + 1024] = {
 	/* 128 */
-	0x3fffec43, 0x003243f1, 0x015fd4d2, 0x3ffc38d1, 0x3ff9c13a, 0x01c454f5, 0x02f1b755, 0x3feea776, 
-	0x3fe9b8a9, 0x03562038, 0x0483259d, 0x3fd73a4a, 0x3fcfd50b, 0x04e767c5, 0x0613e1c5, 0x3fb5f4ea, 
-	0x3fac1a5b, 0x0677edbb, 0x07a3adff, 0x3f8adc77, 0x3f7e8e1e, 0x08077457, 0x09324ca7, 0x3f55f796, 
-	0x3f473759, 0x0995bdfd, 0x0abf8043, 0x3f174e70, 0x3f061e95, 0x0b228d42, 0x0c4b0b94, 0x3eceeaad, 
-	0x3ebb4ddb, 0x0cada4f5, 0x0dd4b19a, 0x3e7cd778, 0x3e66d0b4, 0x0e36c82a, 0x0f5c35a3, 0x3e212179, 
-	0x3e08b42a, 0x0fbdba40, 0x10e15b4e, 0x3dbbd6d4, 0x3da106bd, 0x11423ef0, 0x1263e699, 0x3d4d0728, 
-	0x3d2fd86c, 0x12c41a4f, 0x13e39be9, 0x3cd4c38b, 0x3cb53aaa, 0x144310dd, 0x15604013, 0x3c531e88, 
-	0x3c314060, 0x15bee78c, 0x16d99864, 0x3bc82c1f, 0x3ba3fde7, 0x173763c9, 0x184f6aab, 0x3b3401bb, 
-	0x3b0d8909, 0x18ac4b87, 0x19c17d44, 0x3a96b636, 0x3a6df8f8, 0x1a1d6544, 0x1b2f971e, 0x39f061d2, 
-	0x39c5664f, 0x1b8a7815, 0x1c997fc4, 0x39411e33, 0x3913eb0e, 0x1cf34baf, 0x1dfeff67, 0x38890663, 
-	0x3859a292, 0x1e57a86d, 0x1f5fdee6, 0x37c836c2, 0x3796a996, 0x1fb7575c, 0x20bbe7d8, 0x36fecd0e, 
-	0x36cb1e2a, 0x21122240, 0x2212e492, 0x362ce855, 0x35f71fb1, 0x2267d3a0, 0x2364a02e, 0x3552a8f4, 
-	0x351acedd, 0x23b836ca, 0x24b0e699, 0x34703095, 0x34364da6, 0x250317df, 0x25f78497, 0x3385a222, 
-	0x3349bf48, 0x264843d9, 0x273847c8, 0x329321c7, 0x32554840, 0x27878893, 0x2872feb6, 0x3198d4ea, 
-	0x31590e3e, 0x28c0b4d2, 0x29a778db, 0x3096e223, 0x30553828, 0x29f3984c, 0x2ad586a3, 0x2f8d713a, 
-	0x2f49ee0f, 0x2b2003ac, 0x2bfcf97c, 0x2e7cab1c, 0x2e37592c, 0x2c45c8a0, 0x2d1da3d5, 0x2d64b9da, 
+	0x3fffec43, 0x003243f1, 0x015fd4d2, 0x3ffc38d1, 0x3ff9c13a, 0x01c454f5, 0x02f1b755, 0x3feea776,
+	0x3fe9b8a9, 0x03562038, 0x0483259d, 0x3fd73a4a, 0x3fcfd50b, 0x04e767c5, 0x0613e1c5, 0x3fb5f4ea,
+	0x3fac1a5b, 0x0677edbb, 0x07a3adff, 0x3f8adc77, 0x3f7e8e1e, 0x08077457, 0x09324ca7, 0x3f55f796,
+	0x3f473759, 0x0995bdfd, 0x0abf8043, 0x3f174e70, 0x3f061e95, 0x0b228d42, 0x0c4b0b94, 0x3eceeaad,
+	0x3ebb4ddb, 0x0cada4f5, 0x0dd4b19a, 0x3e7cd778, 0x3e66d0b4, 0x0e36c82a, 0x0f5c35a3, 0x3e212179,
+	0x3e08b42a, 0x0fbdba40, 0x10e15b4e, 0x3dbbd6d4, 0x3da106bd, 0x11423ef0, 0x1263e699, 0x3d4d0728,
+	0x3d2fd86c, 0x12c41a4f, 0x13e39be9, 0x3cd4c38b, 0x3cb53aaa, 0x144310dd, 0x15604013, 0x3c531e88,
+	0x3c314060, 0x15bee78c, 0x16d99864, 0x3bc82c1f, 0x3ba3fde7, 0x173763c9, 0x184f6aab, 0x3b3401bb,
+	0x3b0d8909, 0x18ac4b87, 0x19c17d44, 0x3a96b636, 0x3a6df8f8, 0x1a1d6544, 0x1b2f971e, 0x39f061d2,
+	0x39c5664f, 0x1b8a7815, 0x1c997fc4, 0x39411e33, 0x3913eb0e, 0x1cf34baf, 0x1dfeff67, 0x38890663,
+	0x3859a292, 0x1e57a86d, 0x1f5fdee6, 0x37c836c2, 0x3796a996, 0x1fb7575c, 0x20bbe7d8, 0x36fecd0e,
+	0x36cb1e2a, 0x21122240, 0x2212e492, 0x362ce855, 0x35f71fb1, 0x2267d3a0, 0x2364a02e, 0x3552a8f4,
+	0x351acedd, 0x23b836ca, 0x24b0e699, 0x34703095, 0x34364da6, 0x250317df, 0x25f78497, 0x3385a222,
+	0x3349bf48, 0x264843d9, 0x273847c8, 0x329321c7, 0x32554840, 0x27878893, 0x2872feb6, 0x3198d4ea,
+	0x31590e3e, 0x28c0b4d2, 0x29a778db, 0x3096e223, 0x30553828, 0x29f3984c, 0x2ad586a3, 0x2f8d713a,
+	0x2f49ee0f, 0x2b2003ac, 0x2bfcf97c, 0x2e7cab1c, 0x2e37592c, 0x2c45c8a0, 0x2d1da3d5, 0x2d64b9da,
 	/* 1024 */
-	0x3fffffb1, 0x0006487f, 0x002bfb74, 0x3ffff0e3, 0x3fffe705, 0x00388c6e, 0x005e3f4c, 0x3fffba9b, 
-	0x3fffa6de, 0x006ad03b, 0x009082ea, 0x3fff5cd8, 0x3fff3f3c, 0x009d13c5, 0x00c2c62f, 0x3ffed79b, 
-	0x3ffeb021, 0x00cf56ef, 0x00f508fc, 0x3ffe2ae5, 0x3ffdf98c, 0x01019998, 0x01274b31, 0x3ffd56b5, 
-	0x3ffd1b7e, 0x0133dba3, 0x01598cb1, 0x3ffc5b0c, 0x3ffc15f7, 0x01661cf0, 0x018bcd5b, 0x3ffb37ec, 
-	0x3ffae8f9, 0x01985d60, 0x01be0d11, 0x3ff9ed53, 0x3ff99483, 0x01ca9cd4, 0x01f04bb4, 0x3ff87b44, 
-	0x3ff81896, 0x01fcdb2e, 0x02228924, 0x3ff6e1bf, 0x3ff67534, 0x022f184d, 0x0254c544, 0x3ff520c5, 
-	0x3ff4aa5d, 0x02615414, 0x0286fff3, 0x3ff33858, 0x3ff2b813, 0x02938e62, 0x02b93914, 0x3ff12878, 
-	0x3ff09e56, 0x02c5c71a, 0x02eb7086, 0x3feef126, 0x3fee5d28, 0x02f7fe1c, 0x031da62b, 0x3fec9265, 
-	0x3febf48b, 0x032a3349, 0x034fd9e5, 0x3fea0c35, 0x3fe96480, 0x035c6682, 0x03820b93, 0x3fe75e98, 
-	0x3fe6ad08, 0x038e97a9, 0x03b43b17, 0x3fe48990, 0x3fe3ce26, 0x03c0c69e, 0x03e66852, 0x3fe18d1f, 
-	0x3fe0c7da, 0x03f2f342, 0x04189326, 0x3fde6945, 0x3fdd9a27, 0x04251d77, 0x044abb73, 0x3fdb1e06, 
-	0x3fda450f, 0x0457451d, 0x047ce11a, 0x3fd7ab64, 0x3fd6c894, 0x04896a16, 0x04af03fc, 0x3fd4115f, 
-	0x3fd324b7, 0x04bb8c42, 0x04e123fa, 0x3fd04ffc, 0x3fcf597c, 0x04edab83, 0x051340f6, 0x3fcc673b, 
-	0x3fcb66e4, 0x051fc7b9, 0x05455ad1, 0x3fc8571f, 0x3fc74cf3, 0x0551e0c7, 0x0577716b, 0x3fc41fac, 
-	0x3fc30baa, 0x0583f68c, 0x05a984a6, 0x3fbfc0e3, 0x3fbea30c, 0x05b608eb, 0x05db9463, 0x3fbb3ac7, 
-	0x3fba131b, 0x05e817c3, 0x060da083, 0x3fb68d5b, 0x3fb55bdc, 0x061a22f7, 0x063fa8e7, 0x3fb1b8a2, 
-	0x3fb07d50, 0x064c2a67, 0x0671ad71, 0x3facbc9f, 0x3fab777b, 0x067e2df5, 0x06a3ae00, 0x3fa79954, 
-	0x3fa64a5f, 0x06b02d81, 0x06d5aa77, 0x3fa24ec6, 0x3fa0f600, 0x06e228ee, 0x0707a2b7, 0x3f9cdcf7, 
-	0x3f9b7a62, 0x0714201b, 0x073996a1, 0x3f9743eb, 0x3f95d787, 0x074612eb, 0x076b8616, 0x3f9183a5, 
-	0x3f900d72, 0x0778013d, 0x079d70f7, 0x3f8b9c28, 0x3f8a1c29, 0x07a9eaf5, 0x07cf5726, 0x3f858d79, 
-	0x3f8403ae, 0x07dbcff2, 0x08013883, 0x3f7f579b, 0x3f7dc405, 0x080db016, 0x083314f1, 0x3f78fa92, 
-	0x3f775d31, 0x083f8b43, 0x0864ec4f, 0x3f727661, 0x3f70cf38, 0x08716159, 0x0896be80, 0x3f6bcb0e, 
-	0x3f6a1a1c, 0x08a3323a, 0x08c88b65, 0x3f64f89b, 0x3f633de2, 0x08d4fdc6, 0x08fa52de, 0x3f5dff0e, 
-	0x3f5c3a8f, 0x0906c3e0, 0x092c14ce, 0x3f56de6a, 0x3f551026, 0x09388469, 0x095dd116, 0x3f4f96b4, 
-	0x3f4dbeac, 0x096a3f42, 0x098f8796, 0x3f4827f0, 0x3f464626, 0x099bf44c, 0x09c13831, 0x3f409223, 
-	0x3f3ea697, 0x09cda368, 0x09f2e2c7, 0x3f38d552, 0x3f36e006, 0x09ff4c78, 0x0a24873a, 0x3f30f181, 
-	0x3f2ef276, 0x0a30ef5e, 0x0a56256c, 0x3f28e6b6, 0x3f26ddec, 0x0a628bfa, 0x0a87bd3d, 0x3f20b4f5, 
-	0x3f1ea26e, 0x0a94222f, 0x0ab94e8f, 0x3f185c43, 0x3f164001, 0x0ac5b1dc, 0x0aead944, 0x3f0fdca5, 
-	0x3f0db6a9, 0x0af73ae5, 0x0b1c5d3d, 0x3f073621, 0x3f05066d, 0x0b28bd2a, 0x0b4dda5c, 0x3efe68bc, 
-	0x3efc2f50, 0x0b5a388d, 0x0b7f5081, 0x3ef5747b, 0x3ef3315a, 0x0b8bacf0, 0x0bb0bf8f, 0x3eec5965, 
-	0x3eea0c8e, 0x0bbd1a33, 0x0be22766, 0x3ee3177e, 0x3ee0c0f4, 0x0bee8038, 0x0c1387e9, 0x3ed9aecc, 
-	0x3ed74e91, 0x0c1fdee1, 0x0c44e0f9, 0x3ed01f55, 0x3ecdb56a, 0x0c513610, 0x0c763278, 0x3ec66920, 
-	0x3ec3f585, 0x0c8285a5, 0x0ca77c47, 0x3ebc8c31, 0x3eba0ee9, 0x0cb3cd84, 0x0cd8be47, 0x3eb2888f, 
-	0x3eb0019c, 0x0ce50d8c, 0x0d09f85b, 0x3ea85e41, 0x3ea5cda3, 0x0d1645a0, 0x0d3b2a64, 0x3e9e0d4c, 
-	0x3e9b7306, 0x0d4775a1, 0x0d6c5443, 0x3e9395b7, 0x3e90f1ca, 0x0d789d71, 0x0d9d75db, 0x3e88f788, 
-	0x3e8649f5, 0x0da9bcf2, 0x0dce8f0d, 0x3e7e32c6, 0x3e7b7b90, 0x0ddad406, 0x0dff9fba, 0x3e734778, 
-	0x3e70869f, 0x0e0be28e, 0x0e30a7c5, 0x3e6835a4, 0x3e656b2b, 0x0e3ce86b, 0x0e61a70f, 0x3e5cfd51, 
-	0x3e5a2939, 0x0e6de580, 0x0e929d7a, 0x3e519e86, 0x3e4ec0d1, 0x0e9ed9af, 0x0ec38ae8, 0x3e46194a, 
-	0x3e4331fa, 0x0ecfc4d9, 0x0ef46f3b, 0x3e3a6da4, 0x3e377cbb, 0x0f00a6df, 0x0f254a53, 0x3e2e9b9c, 
-	0x3e2ba11b, 0x0f317fa5, 0x0f561c15, 0x3e22a338, 0x3e1f9f21, 0x0f624f0c, 0x0f86e460, 0x3e168480, 
-	0x3e1376d5, 0x0f9314f5, 0x0fb7a317, 0x3e0a3f7b, 0x3e07283f, 0x0fc3d143, 0x0fe8581d, 0x3dfdd432, 
-	0x3dfab365, 0x0ff483d7, 0x10190352, 0x3df142ab, 0x3dee1851, 0x10252c94, 0x1049a49a, 0x3de48aef, 
-	0x3de15708, 0x1055cb5b, 0x107a3bd5, 0x3dd7ad05, 0x3dd46f94, 0x1086600e, 0x10aac8e6, 0x3dcaa8f5, 
-	0x3dc761fc, 0x10b6ea90, 0x10db4baf, 0x3dbd7ec7, 0x3dba2e48, 0x10e76ac3, 0x110bc413, 0x3db02e84, 
-	0x3dacd481, 0x1117e088, 0x113c31f3, 0x3da2b834, 0x3d9f54af, 0x11484bc2, 0x116c9531, 0x3d951bde, 
-	0x3d91aed9, 0x1178ac53, 0x119cedaf, 0x3d87598c, 0x3d83e309, 0x11a9021d, 0x11cd3b50, 0x3d797145, 
-	0x3d75f147, 0x11d94d02, 0x11fd7df6, 0x3d6b6313, 0x3d67d99b, 0x12098ce5, 0x122db583, 0x3d5d2efe, 
-	0x3d599c0e, 0x1239c1a7, 0x125de1da, 0x3d4ed50f, 0x3d4b38aa, 0x1269eb2b, 0x128e02dc, 0x3d40554e, 
-	0x3d3caf76, 0x129a0954, 0x12be186c, 0x3d31afc5, 0x3d2e007c, 0x12ca1c03, 0x12ee226c, 0x3d22e47c, 
-	0x3d1f2bc5, 0x12fa231b, 0x131e20c0, 0x3d13f37e, 0x3d10315a, 0x132a1e7e, 0x134e1348, 0x3d04dcd2, 
-	0x3d011145, 0x135a0e0e, 0x137df9e7, 0x3cf5a082, 0x3cf1cb8e, 0x1389f1af, 0x13add481, 0x3ce63e98, 
-	0x3ce2603f, 0x13b9c943, 0x13dda2f7, 0x3cd6b71e, 0x3cd2cf62, 0x13e994ab, 0x140d652c, 0x3cc70a1c, 
-	0x3cc318ff, 0x141953cb, 0x143d1b02, 0x3cb7379c, 0x3cb33d22, 0x14490685, 0x146cc45c, 0x3ca73fa9, 
-	0x3ca33bd3, 0x1478acbc, 0x149c611d, 0x3c97224c, 0x3c93151d, 0x14a84652, 0x14cbf127, 0x3c86df8e, 
-	0x3c82c909, 0x14d7d32a, 0x14fb745e, 0x3c76777b, 0x3c7257a2, 0x15075327, 0x152aeaa3, 0x3c65ea1c, 
-	0x3c61c0f1, 0x1536c62b, 0x155a53d9, 0x3c55377b, 0x3c510501, 0x15662c18, 0x1589afe3, 0x3c445fa2, 
-	0x3c4023dd, 0x159584d3, 0x15b8fea4, 0x3c33629d, 0x3c2f1d8e, 0x15c4d03e, 0x15e83fff, 0x3c224075, 
-	0x3c1df21f, 0x15f40e3a, 0x161773d6, 0x3c10f935, 0x3c0ca19b, 0x16233eac, 0x16469a0d, 0x3bff8ce8, 
-	0x3bfb2c0c, 0x16526176, 0x1675b286, 0x3bedfb99, 0x3be9917e, 0x1681767c, 0x16a4bd25, 0x3bdc4552, 
-	0x3bd7d1fa, 0x16b07d9f, 0x16d3b9cc, 0x3bca6a1d, 0x3bc5ed8d, 0x16df76c3, 0x1702a85e, 0x3bb86a08, 
-	0x3bb3e440, 0x170e61cc, 0x173188be, 0x3ba6451b, 0x3ba1b620, 0x173d3e9b, 0x17605ad0, 0x3b93fb63, 
-	0x3b8f6337, 0x176c0d15, 0x178f1e76, 0x3b818ceb, 0x3b7ceb90, 0x179acd1c, 0x17bdd394, 0x3b6ef9be, 
-	0x3b6a4f38, 0x17c97e93, 0x17ec7a0d, 0x3b5c41e8, 0x3b578e39, 0x17f8215e, 0x181b11c4, 0x3b496574, 
-	0x3b44a8a0, 0x1826b561, 0x18499a9d, 0x3b36646e, 0x3b319e77, 0x18553a7d, 0x1878147a, 0x3b233ee1, 
-	0x3b1e6fca, 0x1883b097, 0x18a67f3f, 0x3b0ff4d9, 0x3b0b1ca6, 0x18b21791, 0x18d4dad0, 0x3afc8663, 
-	0x3af7a516, 0x18e06f50, 0x1903270f, 0x3ae8f38b, 0x3ae40926, 0x190eb7b7, 0x193163e1, 0x3ad53c5b, 
-	0x3ad048e3, 0x193cf0a9, 0x195f9128, 0x3ac160e1, 0x3abc6458, 0x196b1a09, 0x198daec8, 0x3aad6129, 
-	0x3aa85b92, 0x199933bb, 0x19bbbca6, 0x3a993d3e, 0x3a942e9d, 0x19c73da3, 0x19e9baa3, 0x3a84f52f, 
-	0x3a7fdd86, 0x19f537a4, 0x1a17a8a5, 0x3a708906, 0x3a6b6859, 0x1a2321a2, 0x1a45868e, 0x3a5bf8d1, 
-	0x3a56cf23, 0x1a50fb81, 0x1a735442, 0x3a47449c, 0x3a4211f0, 0x1a7ec524, 0x1aa111a6, 0x3a326c74, 
-	0x3a2d30cd, 0x1aac7e6f, 0x1acebe9d, 0x3a1d7066, 0x3a182bc8, 0x1ada2746, 0x1afc5b0a, 0x3a08507f, 
-	0x3a0302ed, 0x1b07bf8c, 0x1b29e6d2, 0x39f30ccc, 0x39edb649, 0x1b354727, 0x1b5761d8, 0x39dda55a, 
-	0x39d845e9, 0x1b62bdf8, 0x1b84cc01, 0x39c81a36, 0x39c2b1da, 0x1b9023e5, 0x1bb22530, 0x39b26b6d, 
-	0x39acfa2b, 0x1bbd78d2, 0x1bdf6d4a, 0x399c990d, 0x39971ee7, 0x1beabca1, 0x1c0ca432, 0x3986a324, 
-	0x3981201e, 0x1c17ef39, 0x1c39c9cd, 0x397089bf, 0x396afddc, 0x1c45107c, 0x1c66ddfe, 0x395a4ceb, 
-	0x3954b82e, 0x1c72204f, 0x1c93e0ab, 0x3943ecb6, 0x393e4f23, 0x1c9f1e96, 0x1cc0d1b6, 0x392d692f, 
-	0x3927c2c9, 0x1ccc0b35, 0x1cedb106, 0x3916c262, 0x3911132d, 0x1cf8e611, 0x1d1a7e7d, 0x38fff85e, 
-	0x38fa405e, 0x1d25af0d, 0x1d473a00, 0x38e90b31, 0x38e34a69, 0x1d52660f, 0x1d73e374, 0x38d1fae9, 
-	0x38cc315d, 0x1d7f0afb, 0x1da07abc, 0x38bac795, 0x38b4f547, 0x1dab9db5, 0x1dccffbf, 0x38a37142, 
-	0x389d9637, 0x1dd81e21, 0x1df9725f, 0x388bf7ff, 0x3886143b, 0x1e048c24, 0x1e25d282, 0x38745bdb, 
-	0x386e6f60, 0x1e30e7a4, 0x1e52200c, 0x385c9ce3, 0x3856a7b6, 0x1e5d3084, 0x1e7e5ae2, 0x3844bb28, 
-	0x383ebd4c, 0x1e8966a8, 0x1eaa82e9, 0x382cb6b7, 0x3826b030, 0x1eb589f7, 0x1ed69805, 0x38148f9f, 
-	0x380e8071, 0x1ee19a54, 0x1f029a1c, 0x37fc45ef, 0x37f62e1d, 0x1f0d97a5, 0x1f2e8911, 0x37e3d9b7, 
-	0x37ddb945, 0x1f3981ce, 0x1f5a64cb, 0x37cb4b04, 0x37c521f6, 0x1f6558b5, 0x1f862d2d, 0x37b299e7, 
-	0x37ac6841, 0x1f911c3d, 0x1fb1e21d, 0x3799c66f, 0x37938c34, 0x1fbccc4d, 0x1fdd8381, 0x3780d0aa, 
-	0x377a8ddf, 0x1fe868c8, 0x2009113c, 0x3767b8a9, 0x37616d51, 0x2013f196, 0x20348b35, 0x374e7e7b, 
-	0x37482a9a, 0x203f6699, 0x205ff14f, 0x3735222f, 0x372ec5c9, 0x206ac7b8, 0x208b4372, 0x371ba3d4, 
-	0x37153eee, 0x209614d9, 0x20b68181, 0x3702037c, 0x36fb9618, 0x20c14ddf, 0x20e1ab63, 0x36e84135, 
-	0x36e1cb58, 0x20ec72b1, 0x210cc0fc, 0x36ce5d10, 0x36c7debd, 0x21178334, 0x2137c232, 0x36b4571b, 
-	0x36add058, 0x21427f4d, 0x2162aeea, 0x369a2f69, 0x3693a038, 0x216d66e2, 0x218d870b, 0x367fe608, 
-	0x36794e6e, 0x219839d8, 0x21b84a79, 0x36657b08, 0x365edb09, 0x21c2f815, 0x21e2f91a, 0x364aee7b, 
-	0x3644461b, 0x21eda17f, 0x220d92d4, 0x36304070, 0x36298fb4, 0x221835fb, 0x2238178d, 0x361570f8, 
-	0x360eb7e3, 0x2242b56f, 0x22628729, 0x35fa8023, 0x35f3beba, 0x226d1fc1, 0x228ce191, 0x35df6e03, 
-	0x35d8a449, 0x229774d7, 0x22b726a8, 0x35c43aa7, 0x35bd68a1, 0x22c1b496, 0x22e15655, 0x35a8e621, 
-	0x35a20bd3, 0x22ebdee5, 0x230b707e, 0x358d7081, 0x35868def, 0x2315f3a8, 0x23357509, 0x3571d9d9, 
-	0x356aef08, 0x233ff2c8, 0x235f63dc, 0x35562239, 0x354f2f2c, 0x2369dc29, 0x23893cdd, 0x353a49b2, 
-	0x35334e6f, 0x2393afb2, 0x23b2fff3, 0x351e5056, 0x35174ce0, 0x23bd6d48, 0x23dcad03, 0x35023636, 
-	0x34fb2a92, 0x23e714d3, 0x240643f4, 0x34e5fb63, 0x34dee795, 0x2410a639, 0x242fc4ad, 0x34c99fef, 
-	0x34c283fb, 0x243a215f, 0x24592f13, 0x34ad23eb, 0x34a5ffd5, 0x2463862c, 0x2482830d, 0x34908768, 
-	0x34895b36, 0x248cd487, 0x24abc082, 0x3473ca79, 0x346c962f, 0x24b60c57, 0x24d4e757, 0x3456ed2f, 
-	0x344fb0d1, 0x24df2d81, 0x24fdf775, 0x3439ef9c, 0x3432ab2e, 0x250837ed, 0x2526f0c1, 0x341cd1d2, 
-	0x34158559, 0x25312b81, 0x254fd323, 0x33ff93e2, 0x33f83f62, 0x255a0823, 0x25789e80, 0x33e235df, 
-	0x33dad95e, 0x2582cdbc, 0x25a152c0, 0x33c4b7db, 0x33bd535c, 0x25ab7c30, 0x25c9efca, 0x33a719e8, 
-	0x339fad70, 0x25d41369, 0x25f27584, 0x33895c18, 0x3381e7ac, 0x25fc934b, 0x261ae3d6, 0x336b7e7e, 
-	0x33640223, 0x2624fbbf, 0x26433aa7, 0x334d812d, 0x3345fce6, 0x264d4cac, 0x266b79dd, 0x332f6435, 
-	0x3327d808, 0x267585f8, 0x2693a161, 0x331127ab, 0x3309939c, 0x269da78b, 0x26bbb119, 0x32f2cba1, 
-	0x32eb2fb5, 0x26c5b14c, 0x26e3a8ec, 0x32d45029, 0x32ccac64, 0x26eda322, 0x270b88c2, 0x32b5b557, 
-	0x32ae09be, 0x27157cf5, 0x27335082, 0x3296fb3d, 0x328f47d5, 0x273d3eac, 0x275b0014, 0x327821ee, 
-	0x327066bc, 0x2764e82f, 0x27829760, 0x3259297d, 0x32516686, 0x278c7965, 0x27aa164c, 0x323a11fe, 
-	0x32324746, 0x27b3f235, 0x27d17cc1, 0x321adb83, 0x3213090f, 0x27db5288, 0x27f8caa5, 0x31fb8620, 
-	0x31f3abf5, 0x28029a45, 0x281fffe2, 0x31dc11e8, 0x31d4300b, 0x2829c954, 0x28471c5e, 0x31bc7eee, 
-	0x31b49564, 0x2850df9d, 0x286e2002, 0x319ccd46, 0x3194dc14, 0x2877dd07, 0x28950ab6, 0x317cfd04, 
-	0x3175042e, 0x289ec17a, 0x28bbdc61, 0x315d0e3b, 0x31550dc6, 0x28c58cdf, 0x28e294eb, 0x313d00ff, 
-	0x3134f8f1, 0x28ec3f1e, 0x2909343e, 0x311cd564, 0x3114c5c0, 0x2912d81f, 0x292fba40, 0x30fc8b7d, 
-	0x30f47449, 0x293957c9, 0x295626da, 0x30dc235e, 0x30d404a0, 0x295fbe06, 0x297c79f5, 0x30bb9d1c, 
-	0x30b376d8, 0x29860abd, 0x29a2b378, 0x309af8ca, 0x3092cb05, 0x29ac3dd7, 0x29c8d34d, 0x307a367c, 
-	0x3072013c, 0x29d2573c, 0x29eed95b, 0x30595648, 0x30511991, 0x29f856d5, 0x2a14c58b, 0x30385840, 
-	0x30301418, 0x2a1e3c8a, 0x2a3a97c7, 0x30173c7a, 0x300ef0e5, 0x2a440844, 0x2a604ff5, 0x2ff6030a, 
-	0x2fedb00d, 0x2a69b9ec, 0x2a85ee00, 0x2fd4ac04, 0x2fcc51a5, 0x2a8f516b, 0x2aab71d0, 0x2fb3377c, 
-	0x2faad5c1, 0x2ab4cea9, 0x2ad0db4e, 0x2f91a589, 0x2f893c75, 0x2ada318e, 0x2af62a63, 0x2f6ff63d, 
-	0x2f6785d7, 0x2aff7a05, 0x2b1b5ef8, 0x2f4e29af, 0x2f45b1fb, 0x2b24a7f6, 0x2b4078f5, 0x2f2c3ff2, 
-	0x2f23c0f6, 0x2b49bb4a, 0x2b657844, 0x2f0a391d, 0x2f01b2de, 0x2b6eb3ea, 0x2b8a5cce, 0x2ee81543, 
-	0x2edf87c6, 0x2b9391c0, 0x2baf267d, 0x2ec5d479, 0x2ebd3fc4, 0x2bb854b4, 0x2bd3d53a, 0x2ea376d6, 
-	0x2e9adaee, 0x2bdcfcb0, 0x2bf868ed, 0x2e80fc6e, 0x2e785958, 0x2c01899e, 0x2c1ce181, 0x2e5e6556, 
-	0x2e55bb17, 0x2c25fb66, 0x2c413edf, 0x2e3bb1a4, 0x2e330042, 0x2c4a51f3, 0x2c6580f1, 0x2e18e16d, 
-	0x2e1028ed, 0x2c6e8d2e, 0x2c89a79f, 0x2df5f4c7, 0x2ded352f, 0x2c92ad01, 0x2cadb2d5, 0x2dd2ebc7, 
-	0x2dca251c, 0x2cb6b155, 0x2cd1a27b, 0x2dafc683, 0x2da6f8ca, 0x2cda9a14, 0x2cf5767c, 0x2d8c8510, 
+	0x3fffffb1, 0x0006487f, 0x002bfb74, 0x3ffff0e3, 0x3fffe705, 0x00388c6e, 0x005e3f4c, 0x3fffba9b,
+	0x3fffa6de, 0x006ad03b, 0x009082ea, 0x3fff5cd8, 0x3fff3f3c, 0x009d13c5, 0x00c2c62f, 0x3ffed79b,
+	0x3ffeb021, 0x00cf56ef, 0x00f508fc, 0x3ffe2ae5, 0x3ffdf98c, 0x01019998, 0x01274b31, 0x3ffd56b5,
+	0x3ffd1b7e, 0x0133dba3, 0x01598cb1, 0x3ffc5b0c, 0x3ffc15f7, 0x01661cf0, 0x018bcd5b, 0x3ffb37ec,
+	0x3ffae8f9, 0x01985d60, 0x01be0d11, 0x3ff9ed53, 0x3ff99483, 0x01ca9cd4, 0x01f04bb4, 0x3ff87b44,
+	0x3ff81896, 0x01fcdb2e, 0x02228924, 0x3ff6e1bf, 0x3ff67534, 0x022f184d, 0x0254c544, 0x3ff520c5,
+	0x3ff4aa5d, 0x02615414, 0x0286fff3, 0x3ff33858, 0x3ff2b813, 0x02938e62, 0x02b93914, 0x3ff12878,
+	0x3ff09e56, 0x02c5c71a, 0x02eb7086, 0x3feef126, 0x3fee5d28, 0x02f7fe1c, 0x031da62b, 0x3fec9265,
+	0x3febf48b, 0x032a3349, 0x034fd9e5, 0x3fea0c35, 0x3fe96480, 0x035c6682, 0x03820b93, 0x3fe75e98,
+	0x3fe6ad08, 0x038e97a9, 0x03b43b17, 0x3fe48990, 0x3fe3ce26, 0x03c0c69e, 0x03e66852, 0x3fe18d1f,
+	0x3fe0c7da, 0x03f2f342, 0x04189326, 0x3fde6945, 0x3fdd9a27, 0x04251d77, 0x044abb73, 0x3fdb1e06,
+	0x3fda450f, 0x0457451d, 0x047ce11a, 0x3fd7ab64, 0x3fd6c894, 0x04896a16, 0x04af03fc, 0x3fd4115f,
+	0x3fd324b7, 0x04bb8c42, 0x04e123fa, 0x3fd04ffc, 0x3fcf597c, 0x04edab83, 0x051340f6, 0x3fcc673b,
+	0x3fcb66e4, 0x051fc7b9, 0x05455ad1, 0x3fc8571f, 0x3fc74cf3, 0x0551e0c7, 0x0577716b, 0x3fc41fac,
+	0x3fc30baa, 0x0583f68c, 0x05a984a6, 0x3fbfc0e3, 0x3fbea30c, 0x05b608eb, 0x05db9463, 0x3fbb3ac7,
+	0x3fba131b, 0x05e817c3, 0x060da083, 0x3fb68d5b, 0x3fb55bdc, 0x061a22f7, 0x063fa8e7, 0x3fb1b8a2,
+	0x3fb07d50, 0x064c2a67, 0x0671ad71, 0x3facbc9f, 0x3fab777b, 0x067e2df5, 0x06a3ae00, 0x3fa79954,
+	0x3fa64a5f, 0x06b02d81, 0x06d5aa77, 0x3fa24ec6, 0x3fa0f600, 0x06e228ee, 0x0707a2b7, 0x3f9cdcf7,
+	0x3f9b7a62, 0x0714201b, 0x073996a1, 0x3f9743eb, 0x3f95d787, 0x074612eb, 0x076b8616, 0x3f9183a5,
+	0x3f900d72, 0x0778013d, 0x079d70f7, 0x3f8b9c28, 0x3f8a1c29, 0x07a9eaf5, 0x07cf5726, 0x3f858d79,
+	0x3f8403ae, 0x07dbcff2, 0x08013883, 0x3f7f579b, 0x3f7dc405, 0x080db016, 0x083314f1, 0x3f78fa92,
+	0x3f775d31, 0x083f8b43, 0x0864ec4f, 0x3f727661, 0x3f70cf38, 0x08716159, 0x0896be80, 0x3f6bcb0e,
+	0x3f6a1a1c, 0x08a3323a, 0x08c88b65, 0x3f64f89b, 0x3f633de2, 0x08d4fdc6, 0x08fa52de, 0x3f5dff0e,
+	0x3f5c3a8f, 0x0906c3e0, 0x092c14ce, 0x3f56de6a, 0x3f551026, 0x09388469, 0x095dd116, 0x3f4f96b4,
+	0x3f4dbeac, 0x096a3f42, 0x098f8796, 0x3f4827f0, 0x3f464626, 0x099bf44c, 0x09c13831, 0x3f409223,
+	0x3f3ea697, 0x09cda368, 0x09f2e2c7, 0x3f38d552, 0x3f36e006, 0x09ff4c78, 0x0a24873a, 0x3f30f181,
+	0x3f2ef276, 0x0a30ef5e, 0x0a56256c, 0x3f28e6b6, 0x3f26ddec, 0x0a628bfa, 0x0a87bd3d, 0x3f20b4f5,
+	0x3f1ea26e, 0x0a94222f, 0x0ab94e8f, 0x3f185c43, 0x3f164001, 0x0ac5b1dc, 0x0aead944, 0x3f0fdca5,
+	0x3f0db6a9, 0x0af73ae5, 0x0b1c5d3d, 0x3f073621, 0x3f05066d, 0x0b28bd2a, 0x0b4dda5c, 0x3efe68bc,
+	0x3efc2f50, 0x0b5a388d, 0x0b7f5081, 0x3ef5747b, 0x3ef3315a, 0x0b8bacf0, 0x0bb0bf8f, 0x3eec5965,
+	0x3eea0c8e, 0x0bbd1a33, 0x0be22766, 0x3ee3177e, 0x3ee0c0f4, 0x0bee8038, 0x0c1387e9, 0x3ed9aecc,
+	0x3ed74e91, 0x0c1fdee1, 0x0c44e0f9, 0x3ed01f55, 0x3ecdb56a, 0x0c513610, 0x0c763278, 0x3ec66920,
+	0x3ec3f585, 0x0c8285a5, 0x0ca77c47, 0x3ebc8c31, 0x3eba0ee9, 0x0cb3cd84, 0x0cd8be47, 0x3eb2888f,
+	0x3eb0019c, 0x0ce50d8c, 0x0d09f85b, 0x3ea85e41, 0x3ea5cda3, 0x0d1645a0, 0x0d3b2a64, 0x3e9e0d4c,
+	0x3e9b7306, 0x0d4775a1, 0x0d6c5443, 0x3e9395b7, 0x3e90f1ca, 0x0d789d71, 0x0d9d75db, 0x3e88f788,
+	0x3e8649f5, 0x0da9bcf2, 0x0dce8f0d, 0x3e7e32c6, 0x3e7b7b90, 0x0ddad406, 0x0dff9fba, 0x3e734778,
+	0x3e70869f, 0x0e0be28e, 0x0e30a7c5, 0x3e6835a4, 0x3e656b2b, 0x0e3ce86b, 0x0e61a70f, 0x3e5cfd51,
+	0x3e5a2939, 0x0e6de580, 0x0e929d7a, 0x3e519e86, 0x3e4ec0d1, 0x0e9ed9af, 0x0ec38ae8, 0x3e46194a,
+	0x3e4331fa, 0x0ecfc4d9, 0x0ef46f3b, 0x3e3a6da4, 0x3e377cbb, 0x0f00a6df, 0x0f254a53, 0x3e2e9b9c,
+	0x3e2ba11b, 0x0f317fa5, 0x0f561c15, 0x3e22a338, 0x3e1f9f21, 0x0f624f0c, 0x0f86e460, 0x3e168480,
+	0x3e1376d5, 0x0f9314f5, 0x0fb7a317, 0x3e0a3f7b, 0x3e07283f, 0x0fc3d143, 0x0fe8581d, 0x3dfdd432,
+	0x3dfab365, 0x0ff483d7, 0x10190352, 0x3df142ab, 0x3dee1851, 0x10252c94, 0x1049a49a, 0x3de48aef,
+	0x3de15708, 0x1055cb5b, 0x107a3bd5, 0x3dd7ad05, 0x3dd46f94, 0x1086600e, 0x10aac8e6, 0x3dcaa8f5,
+	0x3dc761fc, 0x10b6ea90, 0x10db4baf, 0x3dbd7ec7, 0x3dba2e48, 0x10e76ac3, 0x110bc413, 0x3db02e84,
+	0x3dacd481, 0x1117e088, 0x113c31f3, 0x3da2b834, 0x3d9f54af, 0x11484bc2, 0x116c9531, 0x3d951bde,
+	0x3d91aed9, 0x1178ac53, 0x119cedaf, 0x3d87598c, 0x3d83e309, 0x11a9021d, 0x11cd3b50, 0x3d797145,
+	0x3d75f147, 0x11d94d02, 0x11fd7df6, 0x3d6b6313, 0x3d67d99b, 0x12098ce5, 0x122db583, 0x3d5d2efe,
+	0x3d599c0e, 0x1239c1a7, 0x125de1da, 0x3d4ed50f, 0x3d4b38aa, 0x1269eb2b, 0x128e02dc, 0x3d40554e,
+	0x3d3caf76, 0x129a0954, 0x12be186c, 0x3d31afc5, 0x3d2e007c, 0x12ca1c03, 0x12ee226c, 0x3d22e47c,
+	0x3d1f2bc5, 0x12fa231b, 0x131e20c0, 0x3d13f37e, 0x3d10315a, 0x132a1e7e, 0x134e1348, 0x3d04dcd2,
+	0x3d011145, 0x135a0e0e, 0x137df9e7, 0x3cf5a082, 0x3cf1cb8e, 0x1389f1af, 0x13add481, 0x3ce63e98,
+	0x3ce2603f, 0x13b9c943, 0x13dda2f7, 0x3cd6b71e, 0x3cd2cf62, 0x13e994ab, 0x140d652c, 0x3cc70a1c,
+	0x3cc318ff, 0x141953cb, 0x143d1b02, 0x3cb7379c, 0x3cb33d22, 0x14490685, 0x146cc45c, 0x3ca73fa9,
+	0x3ca33bd3, 0x1478acbc, 0x149c611d, 0x3c97224c, 0x3c93151d, 0x14a84652, 0x14cbf127, 0x3c86df8e,
+	0x3c82c909, 0x14d7d32a, 0x14fb745e, 0x3c76777b, 0x3c7257a2, 0x15075327, 0x152aeaa3, 0x3c65ea1c,
+	0x3c61c0f1, 0x1536c62b, 0x155a53d9, 0x3c55377b, 0x3c510501, 0x15662c18, 0x1589afe3, 0x3c445fa2,
+	0x3c4023dd, 0x159584d3, 0x15b8fea4, 0x3c33629d, 0x3c2f1d8e, 0x15c4d03e, 0x15e83fff, 0x3c224075,
+	0x3c1df21f, 0x15f40e3a, 0x161773d6, 0x3c10f935, 0x3c0ca19b, 0x16233eac, 0x16469a0d, 0x3bff8ce8,
+	0x3bfb2c0c, 0x16526176, 0x1675b286, 0x3bedfb99, 0x3be9917e, 0x1681767c, 0x16a4bd25, 0x3bdc4552,
+	0x3bd7d1fa, 0x16b07d9f, 0x16d3b9cc, 0x3bca6a1d, 0x3bc5ed8d, 0x16df76c3, 0x1702a85e, 0x3bb86a08,
+	0x3bb3e440, 0x170e61cc, 0x173188be, 0x3ba6451b, 0x3ba1b620, 0x173d3e9b, 0x17605ad0, 0x3b93fb63,
+	0x3b8f6337, 0x176c0d15, 0x178f1e76, 0x3b818ceb, 0x3b7ceb90, 0x179acd1c, 0x17bdd394, 0x3b6ef9be,
+	0x3b6a4f38, 0x17c97e93, 0x17ec7a0d, 0x3b5c41e8, 0x3b578e39, 0x17f8215e, 0x181b11c4, 0x3b496574,
+	0x3b44a8a0, 0x1826b561, 0x18499a9d, 0x3b36646e, 0x3b319e77, 0x18553a7d, 0x1878147a, 0x3b233ee1,
+	0x3b1e6fca, 0x1883b097, 0x18a67f3f, 0x3b0ff4d9, 0x3b0b1ca6, 0x18b21791, 0x18d4dad0, 0x3afc8663,
+	0x3af7a516, 0x18e06f50, 0x1903270f, 0x3ae8f38b, 0x3ae40926, 0x190eb7b7, 0x193163e1, 0x3ad53c5b,
+	0x3ad048e3, 0x193cf0a9, 0x195f9128, 0x3ac160e1, 0x3abc6458, 0x196b1a09, 0x198daec8, 0x3aad6129,
+	0x3aa85b92, 0x199933bb, 0x19bbbca6, 0x3a993d3e, 0x3a942e9d, 0x19c73da3, 0x19e9baa3, 0x3a84f52f,
+	0x3a7fdd86, 0x19f537a4, 0x1a17a8a5, 0x3a708906, 0x3a6b6859, 0x1a2321a2, 0x1a45868e, 0x3a5bf8d1,
+	0x3a56cf23, 0x1a50fb81, 0x1a735442, 0x3a47449c, 0x3a4211f0, 0x1a7ec524, 0x1aa111a6, 0x3a326c74,
+	0x3a2d30cd, 0x1aac7e6f, 0x1acebe9d, 0x3a1d7066, 0x3a182bc8, 0x1ada2746, 0x1afc5b0a, 0x3a08507f,
+	0x3a0302ed, 0x1b07bf8c, 0x1b29e6d2, 0x39f30ccc, 0x39edb649, 0x1b354727, 0x1b5761d8, 0x39dda55a,
+	0x39d845e9, 0x1b62bdf8, 0x1b84cc01, 0x39c81a36, 0x39c2b1da, 0x1b9023e5, 0x1bb22530, 0x39b26b6d,
+	0x39acfa2b, 0x1bbd78d2, 0x1bdf6d4a, 0x399c990d, 0x39971ee7, 0x1beabca1, 0x1c0ca432, 0x3986a324,
+	0x3981201e, 0x1c17ef39, 0x1c39c9cd, 0x397089bf, 0x396afddc, 0x1c45107c, 0x1c66ddfe, 0x395a4ceb,
+	0x3954b82e, 0x1c72204f, 0x1c93e0ab, 0x3943ecb6, 0x393e4f23, 0x1c9f1e96, 0x1cc0d1b6, 0x392d692f,
+	0x3927c2c9, 0x1ccc0b35, 0x1cedb106, 0x3916c262, 0x3911132d, 0x1cf8e611, 0x1d1a7e7d, 0x38fff85e,
+	0x38fa405e, 0x1d25af0d, 0x1d473a00, 0x38e90b31, 0x38e34a69, 0x1d52660f, 0x1d73e374, 0x38d1fae9,
+	0x38cc315d, 0x1d7f0afb, 0x1da07abc, 0x38bac795, 0x38b4f547, 0x1dab9db5, 0x1dccffbf, 0x38a37142,
+	0x389d9637, 0x1dd81e21, 0x1df9725f, 0x388bf7ff, 0x3886143b, 0x1e048c24, 0x1e25d282, 0x38745bdb,
+	0x386e6f60, 0x1e30e7a4, 0x1e52200c, 0x385c9ce3, 0x3856a7b6, 0x1e5d3084, 0x1e7e5ae2, 0x3844bb28,
+	0x383ebd4c, 0x1e8966a8, 0x1eaa82e9, 0x382cb6b7, 0x3826b030, 0x1eb589f7, 0x1ed69805, 0x38148f9f,
+	0x380e8071, 0x1ee19a54, 0x1f029a1c, 0x37fc45ef, 0x37f62e1d, 0x1f0d97a5, 0x1f2e8911, 0x37e3d9b7,
+	0x37ddb945, 0x1f3981ce, 0x1f5a64cb, 0x37cb4b04, 0x37c521f6, 0x1f6558b5, 0x1f862d2d, 0x37b299e7,
+	0x37ac6841, 0x1f911c3d, 0x1fb1e21d, 0x3799c66f, 0x37938c34, 0x1fbccc4d, 0x1fdd8381, 0x3780d0aa,
+	0x377a8ddf, 0x1fe868c8, 0x2009113c, 0x3767b8a9, 0x37616d51, 0x2013f196, 0x20348b35, 0x374e7e7b,
+	0x37482a9a, 0x203f6699, 0x205ff14f, 0x3735222f, 0x372ec5c9, 0x206ac7b8, 0x208b4372, 0x371ba3d4,
+	0x37153eee, 0x209614d9, 0x20b68181, 0x3702037c, 0x36fb9618, 0x20c14ddf, 0x20e1ab63, 0x36e84135,
+	0x36e1cb58, 0x20ec72b1, 0x210cc0fc, 0x36ce5d10, 0x36c7debd, 0x21178334, 0x2137c232, 0x36b4571b,
+	0x36add058, 0x21427f4d, 0x2162aeea, 0x369a2f69, 0x3693a038, 0x216d66e2, 0x218d870b, 0x367fe608,
+	0x36794e6e, 0x219839d8, 0x21b84a79, 0x36657b08, 0x365edb09, 0x21c2f815, 0x21e2f91a, 0x364aee7b,
+	0x3644461b, 0x21eda17f, 0x220d92d4, 0x36304070, 0x36298fb4, 0x221835fb, 0x2238178d, 0x361570f8,
+	0x360eb7e3, 0x2242b56f, 0x22628729, 0x35fa8023, 0x35f3beba, 0x226d1fc1, 0x228ce191, 0x35df6e03,
+	0x35d8a449, 0x229774d7, 0x22b726a8, 0x35c43aa7, 0x35bd68a1, 0x22c1b496, 0x22e15655, 0x35a8e621,
+	0x35a20bd3, 0x22ebdee5, 0x230b707e, 0x358d7081, 0x35868def, 0x2315f3a8, 0x23357509, 0x3571d9d9,
+	0x356aef08, 0x233ff2c8, 0x235f63dc, 0x35562239, 0x354f2f2c, 0x2369dc29, 0x23893cdd, 0x353a49b2,
+	0x35334e6f, 0x2393afb2, 0x23b2fff3, 0x351e5056, 0x35174ce0, 0x23bd6d48, 0x23dcad03, 0x35023636,
+	0x34fb2a92, 0x23e714d3, 0x240643f4, 0x34e5fb63, 0x34dee795, 0x2410a639, 0x242fc4ad, 0x34c99fef,
+	0x34c283fb, 0x243a215f, 0x24592f13, 0x34ad23eb, 0x34a5ffd5, 0x2463862c, 0x2482830d, 0x34908768,
+	0x34895b36, 0x248cd487, 0x24abc082, 0x3473ca79, 0x346c962f, 0x24b60c57, 0x24d4e757, 0x3456ed2f,
+	0x344fb0d1, 0x24df2d81, 0x24fdf775, 0x3439ef9c, 0x3432ab2e, 0x250837ed, 0x2526f0c1, 0x341cd1d2,
+	0x34158559, 0x25312b81, 0x254fd323, 0x33ff93e2, 0x33f83f62, 0x255a0823, 0x25789e80, 0x33e235df,
+	0x33dad95e, 0x2582cdbc, 0x25a152c0, 0x33c4b7db, 0x33bd535c, 0x25ab7c30, 0x25c9efca, 0x33a719e8,
+	0x339fad70, 0x25d41369, 0x25f27584, 0x33895c18, 0x3381e7ac, 0x25fc934b, 0x261ae3d6, 0x336b7e7e,
+	0x33640223, 0x2624fbbf, 0x26433aa7, 0x334d812d, 0x3345fce6, 0x264d4cac, 0x266b79dd, 0x332f6435,
+	0x3327d808, 0x267585f8, 0x2693a161, 0x331127ab, 0x3309939c, 0x269da78b, 0x26bbb119, 0x32f2cba1,
+	0x32eb2fb5, 0x26c5b14c, 0x26e3a8ec, 0x32d45029, 0x32ccac64, 0x26eda322, 0x270b88c2, 0x32b5b557,
+	0x32ae09be, 0x27157cf5, 0x27335082, 0x3296fb3d, 0x328f47d5, 0x273d3eac, 0x275b0014, 0x327821ee,
+	0x327066bc, 0x2764e82f, 0x27829760, 0x3259297d, 0x32516686, 0x278c7965, 0x27aa164c, 0x323a11fe,
+	0x32324746, 0x27b3f235, 0x27d17cc1, 0x321adb83, 0x3213090f, 0x27db5288, 0x27f8caa5, 0x31fb8620,
+	0x31f3abf5, 0x28029a45, 0x281fffe2, 0x31dc11e8, 0x31d4300b, 0x2829c954, 0x28471c5e, 0x31bc7eee,
+	0x31b49564, 0x2850df9d, 0x286e2002, 0x319ccd46, 0x3194dc14, 0x2877dd07, 0x28950ab6, 0x317cfd04,
+	0x3175042e, 0x289ec17a, 0x28bbdc61, 0x315d0e3b, 0x31550dc6, 0x28c58cdf, 0x28e294eb, 0x313d00ff,
+	0x3134f8f1, 0x28ec3f1e, 0x2909343e, 0x311cd564, 0x3114c5c0, 0x2912d81f, 0x292fba40, 0x30fc8b7d,
+	0x30f47449, 0x293957c9, 0x295626da, 0x30dc235e, 0x30d404a0, 0x295fbe06, 0x297c79f5, 0x30bb9d1c,
+	0x30b376d8, 0x29860abd, 0x29a2b378, 0x309af8ca, 0x3092cb05, 0x29ac3dd7, 0x29c8d34d, 0x307a367c,
+	0x3072013c, 0x29d2573c, 0x29eed95b, 0x30595648, 0x30511991, 0x29f856d5, 0x2a14c58b, 0x30385840,
+	0x30301418, 0x2a1e3c8a, 0x2a3a97c7, 0x30173c7a, 0x300ef0e5, 0x2a440844, 0x2a604ff5, 0x2ff6030a,
+	0x2fedb00d, 0x2a69b9ec, 0x2a85ee00, 0x2fd4ac04, 0x2fcc51a5, 0x2a8f516b, 0x2aab71d0, 0x2fb3377c,
+	0x2faad5c1, 0x2ab4cea9, 0x2ad0db4e, 0x2f91a589, 0x2f893c75, 0x2ada318e, 0x2af62a63, 0x2f6ff63d,
+	0x2f6785d7, 0x2aff7a05, 0x2b1b5ef8, 0x2f4e29af, 0x2f45b1fb, 0x2b24a7f6, 0x2b4078f5, 0x2f2c3ff2,
+	0x2f23c0f6, 0x2b49bb4a, 0x2b657844, 0x2f0a391d, 0x2f01b2de, 0x2b6eb3ea, 0x2b8a5cce, 0x2ee81543,
+	0x2edf87c6, 0x2b9391c0, 0x2baf267d, 0x2ec5d479, 0x2ebd3fc4, 0x2bb854b4, 0x2bd3d53a, 0x2ea376d6,
+	0x2e9adaee, 0x2bdcfcb0, 0x2bf868ed, 0x2e80fc6e, 0x2e785958, 0x2c01899e, 0x2c1ce181, 0x2e5e6556,
+	0x2e55bb17, 0x2c25fb66, 0x2c413edf, 0x2e3bb1a4, 0x2e330042, 0x2c4a51f3, 0x2c6580f1, 0x2e18e16d,
+	0x2e1028ed, 0x2c6e8d2e, 0x2c89a79f, 0x2df5f4c7, 0x2ded352f, 0x2c92ad01, 0x2cadb2d5, 0x2dd2ebc7,
+	0x2dca251c, 0x2cb6b155, 0x2cd1a27b, 0x2dafc683, 0x2da6f8ca, 0x2cda9a14, 0x2cf5767c, 0x2d8c8510,
 	0x2d83b04f, 0x2cfe6728, 0x2d192ec1, 0x2d692784, 0x2d604bc0, 0x2d22187a, 0x2d3ccb34, 0x2d45adf6
 };
 
 
 const int twidTab512[(8*6 + 32*6 + 128*6)/2] = {
-	0x40000000, 0x40000000, 0x40000000, 0x3b20187d, 
-	0x3ec50c7c, 0x3536238e, 0x2d412d41, 0x3b20187d, 
-	0x187d3b20, 0x187d3b20, 0x3536238e, 0xf3843ec5, 
-	0x00004000, 0x2d412d41, 0xd2bf2d41, 0xe7833b20, 
-	0x238e3536, 0xc13b0c7c, 0xd2bf2d41, 0x187d3b20, 
-	0xc4e0e783, 0xc4e0187d, 0x0c7c3ec5, 0xdc72caca, 
+	0x40000000, 0x40000000, 0x40000000, 0x3b20187d,
+	0x3ec50c7c, 0x3536238e, 0x2d412d41, 0x3b20187d,
+	0x187d3b20, 0x187d3b20, 0x3536238e, 0xf3843ec5,
+	0x00004000, 0x2d412d41, 0xd2bf2d41, 0xe7833b20,
+	0x238e3536, 0xc13b0c7c, 0xd2bf2d41, 0x187d3b20,
+	0xc4e0e783, 0xc4e0187d, 0x0c7c3ec5, 0xdc72caca,
 
-	0x40000000, 0x40000000, 0x40000000, 0x3fb10645, 
-	0x3fec0323, 0x3f4e0964, 0x3ec50c7c, 0x3fb10645, 
-	0x3d3e1294, 0x3d3e1294, 0x3f4e0964, 0x39da1b5d, 
-	0x3b20187d, 0x3ec50c7c, 0x3536238e, 0x38711e2b, 
-	0x3e140f8c, 0x2f6b2afa, 0x3536238e, 0x3d3e1294, 
-	0x28993179, 0x31792899, 0x3c42158f, 0x20e736e5, 
-	0x2d412d41, 0x3b20187d, 0x187d3b20, 0x28993179, 
-	0x39da1b5d, 0x0f8c3e14, 0x238e3536, 0x38711e2b, 
-	0x06453fb1, 0x1e2b3871, 0x36e520e7, 0xfcdd3fec, 
-	0x187d3b20, 0x3536238e, 0xf3843ec5, 0x12943d3e, 
-	0x3367261f, 0xea713c42, 0x0c7c3ec5, 0x31792899, 
-	0xe1d53871, 0x06453fb1, 0x2f6b2afa, 0xd9e13367, 
-	0x00004000, 0x2d412d41, 0xd2bf2d41, 0xf9bb3fb1, 
-	0x2afa2f6b, 0xcc99261f, 0xf3843ec5, 0x28993179, 
-	0xc78f1e2b, 0xed6c3d3e, 0x261f3367, 0xc3be158f, 
-	0xe7833b20, 0x238e3536, 0xc13b0c7c, 0xe1d53871, 
-	0x20e736e5, 0xc0140323, 0xdc723536, 0x1e2b3871, 
-	0xc04ff9bb, 0xd7673179, 0x1b5d39da, 0xc1ecf074, 
-	0xd2bf2d41, 0x187d3b20, 0xc4e0e783, 0xce872899, 
-	0x158f3c42, 0xc91bdf19, 0xcaca238e, 0x12943d3e, 
-	0xce87d767, 0xc78f1e2b, 0x0f8c3e14, 0xd506d095, 
-	0xc4e0187d, 0x0c7c3ec5, 0xdc72caca, 0xc2c21294, 
-	0x09643f4e, 0xe4a3c626, 0xc13b0c7c, 0x06453fb1, 
-	0xed6cc2c2, 0xc04f0645, 0x03233fec, 0xf69cc0b2, 
+	0x40000000, 0x40000000, 0x40000000, 0x3fb10645,
+	0x3fec0323, 0x3f4e0964, 0x3ec50c7c, 0x3fb10645,
+	0x3d3e1294, 0x3d3e1294, 0x3f4e0964, 0x39da1b5d,
+	0x3b20187d, 0x3ec50c7c, 0x3536238e, 0x38711e2b,
+	0x3e140f8c, 0x2f6b2afa, 0x3536238e, 0x3d3e1294,
+	0x28993179, 0x31792899, 0x3c42158f, 0x20e736e5,
+	0x2d412d41, 0x3b20187d, 0x187d3b20, 0x28993179,
+	0x39da1b5d, 0x0f8c3e14, 0x238e3536, 0x38711e2b,
+	0x06453fb1, 0x1e2b3871, 0x36e520e7, 0xfcdd3fec,
+	0x187d3b20, 0x3536238e, 0xf3843ec5, 0x12943d3e,
+	0x3367261f, 0xea713c42, 0x0c7c3ec5, 0x31792899,
+	0xe1d53871, 0x06453fb1, 0x2f6b2afa, 0xd9e13367,
+	0x00004000, 0x2d412d41, 0xd2bf2d41, 0xf9bb3fb1,
+	0x2afa2f6b, 0xcc99261f, 0xf3843ec5, 0x28993179,
+	0xc78f1e2b, 0xed6c3d3e, 0x261f3367, 0xc3be158f,
+	0xe7833b20, 0x238e3536, 0xc13b0c7c, 0xe1d53871,
+	0x20e736e5, 0xc0140323, 0xdc723536, 0x1e2b3871,
+	0xc04ff9bb, 0xd7673179, 0x1b5d39da, 0xc1ecf074,
+	0xd2bf2d41, 0x187d3b20, 0xc4e0e783, 0xce872899,
+	0x158f3c42, 0xc91bdf19, 0xcaca238e, 0x12943d3e,
+	0xce87d767, 0xc78f1e2b, 0x0f8c3e14, 0xd506d095,
+	0xc4e0187d, 0x0c7c3ec5, 0xdc72caca, 0xc2c21294,
+	0x09643f4e, 0xe4a3c626, 0xc13b0c7c, 0x06453fb1,
+	0xed6cc2c2, 0xc04f0645, 0x03233fec, 0xf69cc0b2,
 
-	0x40000000, 0x40000000, 0x40000000, 0x3ffb0192, 
-	0x3ffe00c9, 0x3ff4025b, 0x3fec0323, 0x3ffb0192, 
-	0x3fd304b5, 0x3fd304b5, 0x3ff4025b, 0x3f9c070d, 
-	0x3fb10645, 0x3fec0323, 0x3f4e0964, 0x3f8407d5, 
-	0x3fe103ec, 0x3eeb0bb6, 0x3f4e0964, 0x3fd304b5, 
-	0x3e710e05, 0x3f0e0af1, 0x3fc3057d, 0x3de2104f, 
-	0x3ec50c7c, 0x3fb10645, 0x3d3e1294, 0x3e710e05, 
-	0x3f9c070d, 0x3c8414d1, 0x3e140f8c, 0x3f8407d5, 
-	0x3bb61708, 0x3dae1111, 0x3f6a089c, 0x3ad21937, 
-	0x3d3e1294, 0x3f4e0964, 0x39da1b5d, 0x3cc51413, 
-	0x3f2f0a2a, 0x38cf1d79, 0x3c42158f, 0x3f0e0af1, 
-	0x37af1f8b, 0x3bb61708, 0x3eeb0bb6, 0x367c2192, 
-	0x3b20187d, 0x3ec50c7c, 0x3536238e, 0x3a8219ef, 
-	0x3e9c0d41, 0x33de257d, 0x39da1b5d, 0x3e710e05, 
-	0x3274275f, 0x392a1cc6, 0x3e440ec9, 0x30f82934, 
-	0x38711e2b, 0x3e140f8c, 0x2f6b2afa, 0x37af1f8b, 
-	0x3de2104f, 0x2dce2cb2, 0x36e520e7, 0x3dae1111, 
-	0x2c212e5a, 0x3612223d, 0x3d7711d3, 0x2a652ff1, 
-	0x3536238e, 0x3d3e1294, 0x28993179, 0x345324da, 
-	0x3d021354, 0x26c032ee, 0x3367261f, 0x3cc51413, 
-	0x24da3453, 0x3274275f, 0x3c8414d1, 0x22e635a5, 
-	0x31792899, 0x3c42158f, 0x20e736e5, 0x307629cd, 
-	0x3bfd164c, 0x1edc3811, 0x2f6b2afa, 0x3bb61708, 
-	0x1cc6392a, 0x2e5a2c21, 0x3b6c17c3, 0x1aa63a2f, 
-	0x2d412d41, 0x3b20187d, 0x187d3b20, 0x2c212e5a, 
-	0x3ad21937, 0x164c3bfd, 0x2afa2f6b, 0x3a8219ef, 
-	0x14133cc5, 0x29cd3076, 0x3a2f1aa6, 0x11d33d77, 
-	0x28993179, 0x39da1b5d, 0x0f8c3e14, 0x275f3274, 
-	0x39831c12, 0x0d413e9c, 0x261f3367, 0x392a1cc6, 
-	0x0af13f0e, 0x24da3453, 0x38cf1d79, 0x089c3f6a, 
-	0x238e3536, 0x38711e2b, 0x06453fb1, 0x223d3612, 
-	0x38111edc, 0x03ec3fe1, 0x20e736e5, 0x37af1f8b, 
-	0x01923ffb, 0x1f8b37af, 0x374b2039, 0xff373ffe, 
-	0x1e2b3871, 0x36e520e7, 0xfcdd3fec, 0x1cc6392a, 
-	0x367c2192, 0xfa833fc3, 0x1b5d39da, 0x3612223d, 
-	0xf82b3f84, 0x19ef3a82, 0x35a522e6, 0xf5d63f2f, 
-	0x187d3b20, 0x3536238e, 0xf3843ec5, 0x17083bb6, 
-	0x34c62434, 0xf1373e44, 0x158f3c42, 0x345324da, 
-	0xeeef3dae, 0x14133cc5, 0x33de257d, 0xecac3d02, 
-	0x12943d3e, 0x3367261f, 0xea713c42, 0x11113dae, 
-	0x32ee26c0, 0xe83d3b6c, 0x0f8c3e14, 0x3274275f, 
-	0xe6113a82, 0x0e053e71, 0x31f727fd, 0xe3ee3983, 
-	0x0c7c3ec5, 0x31792899, 0xe1d53871, 0x0af13f0e, 
-	0x30f82934, 0xdfc7374b, 0x09643f4e, 0x307629cd, 
-	0xddc33612, 0x07d53f84, 0x2ff12a65, 0xdbcc34c6, 
-	0x06453fb1, 0x2f6b2afa, 0xd9e13367, 0x04b53fd3, 
-	0x2ee32b8e, 0xd80331f7, 0x03233fec, 0x2e5a2c21, 
-	0xd6333076, 0x01923ffb, 0x2dce2cb2, 0xd4722ee3, 
-	0x00004000, 0x2d412d41, 0xd2bf2d41, 0xfe6e3ffb, 
-	0x2cb22dce, 0xd11d2b8e, 0xfcdd3fec, 0x2c212e5a, 
-	0xcf8a29cd, 0xfb4b3fd3, 0x2b8e2ee3, 0xce0927fd, 
-	0xf9bb3fb1, 0x2afa2f6b, 0xcc99261f, 0xf82b3f84, 
-	0x2a652ff1, 0xcb3a2434, 0xf69c3f4e, 0x29cd3076, 
-	0xc9ee223d, 0xf50f3f0e, 0x293430f8, 0xc8b52039, 
-	0xf3843ec5, 0x28993179, 0xc78f1e2b, 0xf1fb3e71, 
-	0x27fd31f7, 0xc67d1c12, 0xf0743e14, 0x275f3274, 
-	0xc57e19ef, 0xeeef3dae, 0x26c032ee, 0xc49417c3, 
-	0xed6c3d3e, 0x261f3367, 0xc3be158f, 0xebed3cc5, 
-	0x257d33de, 0xc2fe1354, 0xea713c42, 0x24da3453, 
-	0xc2521111, 0xe8f83bb6, 0x243434c6, 0xc1bc0ec9, 
-	0xe7833b20, 0x238e3536, 0xc13b0c7c, 0xe6113a82, 
-	0x22e635a5, 0xc0d10a2a, 0xe4a339da, 0x223d3612, 
-	0xc07c07d5, 0xe33a392a, 0x2192367c, 0xc03d057d, 
-	0xe1d53871, 0x20e736e5, 0xc0140323, 0xe07537af, 
-	0x2039374b, 0xc00200c9, 0xdf1936e5, 0x1f8b37af, 
-	0xc005fe6e, 0xddc33612, 0x1edc3811, 0xc01ffc14, 
-	0xdc723536, 0x1e2b3871, 0xc04ff9bb, 0xdb263453, 
-	0x1d7938cf, 0xc096f764, 0xd9e13367, 0x1cc6392a, 
-	0xc0f2f50f, 0xd8a13274, 0x1c123983, 0xc164f2bf, 
-	0xd7673179, 0x1b5d39da, 0xc1ecf074, 0xd6333076, 
-	0x1aa63a2f, 0xc289ee2d, 0xd5062f6b, 0x19ef3a82, 
-	0xc33bebed, 0xd3df2e5a, 0x19373ad2, 0xc403e9b4, 
-	0xd2bf2d41, 0x187d3b20, 0xc4e0e783, 0xd1a62c21, 
-	0x17c33b6c, 0xc5d1e55a, 0xd0952afa, 0x17083bb6, 
-	0xc6d6e33a, 0xcf8a29cd, 0x164c3bfd, 0xc7efe124, 
-	0xce872899, 0x158f3c42, 0xc91bdf19, 0xcd8c275f, 
-	0x14d13c84, 0xca5bdd1a, 0xcc99261f, 0x14133cc5, 
-	0xcbaddb26, 0xcbad24da, 0x13543d02, 0xcd12d940, 
-	0xcaca238e, 0x12943d3e, 0xce87d767, 0xc9ee223d, 
-	0x11d33d77, 0xd00fd59b, 0xc91b20e7, 0x11113dae, 
-	0xd1a6d3df, 0xc8511f8b, 0x104f3de2, 0xd34ed232, 
-	0xc78f1e2b, 0x0f8c3e14, 0xd506d095, 0xc6d61cc6, 
-	0x0ec93e44, 0xd6cccf08, 0xc6261b5d, 0x0e053e71, 
-	0xd8a1cd8c, 0xc57e19ef, 0x0d413e9c, 0xda83cc22, 
-	0xc4e0187d, 0x0c7c3ec5, 0xdc72caca, 0xc44a1708, 
-	0x0bb63eeb, 0xde6ec984, 0xc3be158f, 0x0af13f0e, 
-	0xe075c851, 0xc33b1413, 0x0a2a3f2f, 0xe287c731, 
-	0xc2c21294, 0x09643f4e, 0xe4a3c626, 0xc2521111, 
-	0x089c3f6a, 0xe6c9c52e, 0xc1ec0f8c, 0x07d53f84, 
-	0xe8f8c44a, 0xc18f0e05, 0x070d3f9c, 0xeb2fc37c, 
-	0xc13b0c7c, 0x06453fb1, 0xed6cc2c2, 0xc0f20af1, 
-	0x057d3fc3, 0xefb1c21e, 0xc0b20964, 0x04b53fd3, 
-	0xf1fbc18f, 0xc07c07d5, 0x03ec3fe1, 0xf44ac115, 
-	0xc04f0645, 0x03233fec, 0xf69cc0b2, 0xc02d04b5, 
-	0x025b3ff4, 0xf8f3c064, 0xc0140323, 0x01923ffb, 
-	0xfb4bc02d, 0xc0050192, 0x00c93ffe, 0xfda5c00c	
+	0x40000000, 0x40000000, 0x40000000, 0x3ffb0192,
+	0x3ffe00c9, 0x3ff4025b, 0x3fec0323, 0x3ffb0192,
+	0x3fd304b5, 0x3fd304b5, 0x3ff4025b, 0x3f9c070d,
+	0x3fb10645, 0x3fec0323, 0x3f4e0964, 0x3f8407d5,
+	0x3fe103ec, 0x3eeb0bb6, 0x3f4e0964, 0x3fd304b5,
+	0x3e710e05, 0x3f0e0af1, 0x3fc3057d, 0x3de2104f,
+	0x3ec50c7c, 0x3fb10645, 0x3d3e1294, 0x3e710e05,
+	0x3f9c070d, 0x3c8414d1, 0x3e140f8c, 0x3f8407d5,
+	0x3bb61708, 0x3dae1111, 0x3f6a089c, 0x3ad21937,
+	0x3d3e1294, 0x3f4e0964, 0x39da1b5d, 0x3cc51413,
+	0x3f2f0a2a, 0x38cf1d79, 0x3c42158f, 0x3f0e0af1,
+	0x37af1f8b, 0x3bb61708, 0x3eeb0bb6, 0x367c2192,
+	0x3b20187d, 0x3ec50c7c, 0x3536238e, 0x3a8219ef,
+	0x3e9c0d41, 0x33de257d, 0x39da1b5d, 0x3e710e05,
+	0x3274275f, 0x392a1cc6, 0x3e440ec9, 0x30f82934,
+	0x38711e2b, 0x3e140f8c, 0x2f6b2afa, 0x37af1f8b,
+	0x3de2104f, 0x2dce2cb2, 0x36e520e7, 0x3dae1111,
+	0x2c212e5a, 0x3612223d, 0x3d7711d3, 0x2a652ff1,
+	0x3536238e, 0x3d3e1294, 0x28993179, 0x345324da,
+	0x3d021354, 0x26c032ee, 0x3367261f, 0x3cc51413,
+	0x24da3453, 0x3274275f, 0x3c8414d1, 0x22e635a5,
+	0x31792899, 0x3c42158f, 0x20e736e5, 0x307629cd,
+	0x3bfd164c, 0x1edc3811, 0x2f6b2afa, 0x3bb61708,
+	0x1cc6392a, 0x2e5a2c21, 0x3b6c17c3, 0x1aa63a2f,
+	0x2d412d41, 0x3b20187d, 0x187d3b20, 0x2c212e5a,
+	0x3ad21937, 0x164c3bfd, 0x2afa2f6b, 0x3a8219ef,
+	0x14133cc5, 0x29cd3076, 0x3a2f1aa6, 0x11d33d77,
+	0x28993179, 0x39da1b5d, 0x0f8c3e14, 0x275f3274,
+	0x39831c12, 0x0d413e9c, 0x261f3367, 0x392a1cc6,
+	0x0af13f0e, 0x24da3453, 0x38cf1d79, 0x089c3f6a,
+	0x238e3536, 0x38711e2b, 0x06453fb1, 0x223d3612,
+	0x38111edc, 0x03ec3fe1, 0x20e736e5, 0x37af1f8b,
+	0x01923ffb, 0x1f8b37af, 0x374b2039, 0xff373ffe,
+	0x1e2b3871, 0x36e520e7, 0xfcdd3fec, 0x1cc6392a,
+	0x367c2192, 0xfa833fc3, 0x1b5d39da, 0x3612223d,
+	0xf82b3f84, 0x19ef3a82, 0x35a522e6, 0xf5d63f2f,
+	0x187d3b20, 0x3536238e, 0xf3843ec5, 0x17083bb6,
+	0x34c62434, 0xf1373e44, 0x158f3c42, 0x345324da,
+	0xeeef3dae, 0x14133cc5, 0x33de257d, 0xecac3d02,
+	0x12943d3e, 0x3367261f, 0xea713c42, 0x11113dae,
+	0x32ee26c0, 0xe83d3b6c, 0x0f8c3e14, 0x3274275f,
+	0xe6113a82, 0x0e053e71, 0x31f727fd, 0xe3ee3983,
+	0x0c7c3ec5, 0x31792899, 0xe1d53871, 0x0af13f0e,
+	0x30f82934, 0xdfc7374b, 0x09643f4e, 0x307629cd,
+	0xddc33612, 0x07d53f84, 0x2ff12a65, 0xdbcc34c6,
+	0x06453fb1, 0x2f6b2afa, 0xd9e13367, 0x04b53fd3,
+	0x2ee32b8e, 0xd80331f7, 0x03233fec, 0x2e5a2c21,
+	0xd6333076, 0x01923ffb, 0x2dce2cb2, 0xd4722ee3,
+	0x00004000, 0x2d412d41, 0xd2bf2d41, 0xfe6e3ffb,
+	0x2cb22dce, 0xd11d2b8e, 0xfcdd3fec, 0x2c212e5a,
+	0xcf8a29cd, 0xfb4b3fd3, 0x2b8e2ee3, 0xce0927fd,
+	0xf9bb3fb1, 0x2afa2f6b, 0xcc99261f, 0xf82b3f84,
+	0x2a652ff1, 0xcb3a2434, 0xf69c3f4e, 0x29cd3076,
+	0xc9ee223d, 0xf50f3f0e, 0x293430f8, 0xc8b52039,
+	0xf3843ec5, 0x28993179, 0xc78f1e2b, 0xf1fb3e71,
+	0x27fd31f7, 0xc67d1c12, 0xf0743e14, 0x275f3274,
+	0xc57e19ef, 0xeeef3dae, 0x26c032ee, 0xc49417c3,
+	0xed6c3d3e, 0x261f3367, 0xc3be158f, 0xebed3cc5,
+	0x257d33de, 0xc2fe1354, 0xea713c42, 0x24da3453,
+	0xc2521111, 0xe8f83bb6, 0x243434c6, 0xc1bc0ec9,
+	0xe7833b20, 0x238e3536, 0xc13b0c7c, 0xe6113a82,
+	0x22e635a5, 0xc0d10a2a, 0xe4a339da, 0x223d3612,
+	0xc07c07d5, 0xe33a392a, 0x2192367c, 0xc03d057d,
+	0xe1d53871, 0x20e736e5, 0xc0140323, 0xe07537af,
+	0x2039374b, 0xc00200c9, 0xdf1936e5, 0x1f8b37af,
+	0xc005fe6e, 0xddc33612, 0x1edc3811, 0xc01ffc14,
+	0xdc723536, 0x1e2b3871, 0xc04ff9bb, 0xdb263453,
+	0x1d7938cf, 0xc096f764, 0xd9e13367, 0x1cc6392a,
+	0xc0f2f50f, 0xd8a13274, 0x1c123983, 0xc164f2bf,
+	0xd7673179, 0x1b5d39da, 0xc1ecf074, 0xd6333076,
+	0x1aa63a2f, 0xc289ee2d, 0xd5062f6b, 0x19ef3a82,
+	0xc33bebed, 0xd3df2e5a, 0x19373ad2, 0xc403e9b4,
+	0xd2bf2d41, 0x187d3b20, 0xc4e0e783, 0xd1a62c21,
+	0x17c33b6c, 0xc5d1e55a, 0xd0952afa, 0x17083bb6,
+	0xc6d6e33a, 0xcf8a29cd, 0x164c3bfd, 0xc7efe124,
+	0xce872899, 0x158f3c42, 0xc91bdf19, 0xcd8c275f,
+	0x14d13c84, 0xca5bdd1a, 0xcc99261f, 0x14133cc5,
+	0xcbaddb26, 0xcbad24da, 0x13543d02, 0xcd12d940,
+	0xcaca238e, 0x12943d3e, 0xce87d767, 0xc9ee223d,
+	0x11d33d77, 0xd00fd59b, 0xc91b20e7, 0x11113dae,
+	0xd1a6d3df, 0xc8511f8b, 0x104f3de2, 0xd34ed232,
+	0xc78f1e2b, 0x0f8c3e14, 0xd506d095, 0xc6d61cc6,
+	0x0ec93e44, 0xd6cccf08, 0xc6261b5d, 0x0e053e71,
+	0xd8a1cd8c, 0xc57e19ef, 0x0d413e9c, 0xda83cc22,
+	0xc4e0187d, 0x0c7c3ec5, 0xdc72caca, 0xc44a1708,
+	0x0bb63eeb, 0xde6ec984, 0xc3be158f, 0x0af13f0e,
+	0xe075c851, 0xc33b1413, 0x0a2a3f2f, 0xe287c731,
+	0xc2c21294, 0x09643f4e, 0xe4a3c626, 0xc2521111,
+	0x089c3f6a, 0xe6c9c52e, 0xc1ec0f8c, 0x07d53f84,
+	0xe8f8c44a, 0xc18f0e05, 0x070d3f9c, 0xeb2fc37c,
+	0xc13b0c7c, 0x06453fb1, 0xed6cc2c2, 0xc0f20af1,
+	0x057d3fc3, 0xefb1c21e, 0xc0b20964, 0x04b53fd3,
+	0xf1fbc18f, 0xc07c07d5, 0x03ec3fe1, 0xf44ac115,
+	0xc04f0645, 0x03233fec, 0xf69cc0b2, 0xc02d04b5,
+	0x025b3ff4, 0xf8f3c064, 0xc0140323, 0x01923ffb,
+	0xfb4bc02d, 0xc0050192, 0x00c93ffe, 0xfda5c00c
 };
 
 const int twidTab64[(4*6 + 16*6)/2] = {
-	0x40000000, 0x40000000, 0x40000000, 0x2d412d41, 
-	0x3b20187d, 0x187d3b20, 0x00004000, 0x2d412d41, 
-	0xd2bf2d41, 0xd2bf2d41, 0x187d3b20, 0xc4e0e783, 
+	0x40000000, 0x40000000, 0x40000000, 0x2d412d41,
+	0x3b20187d, 0x187d3b20, 0x00004000, 0x2d412d41,
+	0xd2bf2d41, 0xd2bf2d41, 0x187d3b20, 0xc4e0e783,
 
-	0x40000000, 0x40000000, 0x40000000, 0x3ec50c7c, 
-	0x3fb10645, 0x3d3e1294, 0x3b20187d, 0x3ec50c7c, 
-	0x3536238e, 0x3536238e, 0x3d3e1294, 0x28993179, 
-	0x2d412d41, 0x3b20187d, 0x187d3b20, 0x238e3536, 
-	0x38711e2b, 0x06453fb1, 0x187d3b20, 0x3536238e, 
-	0xf3843ec5, 0x0c7c3ec5, 0x31792899, 0xe1d53871, 
-	0x00004000, 0x2d412d41, 0xd2bf2d41, 0xf3843ec5, 
-	0x28993179, 0xc78f1e2b, 0xe7833b20, 0x238e3536, 
-	0xc13b0c7c, 0xdc723536, 0x1e2b3871, 0xc04ff9bb, 
-	0xd2bf2d41, 0x187d3b20, 0xc4e0e783, 0xcaca238e, 
-	0x12943d3e, 0xce87d767, 0xc4e0187d, 0x0c7c3ec5, 
-	0xdc72caca, 0xc13b0c7c, 0x06453fb1, 0xed6cc2c2 
+	0x40000000, 0x40000000, 0x40000000, 0x3ec50c7c,
+	0x3fb10645, 0x3d3e1294, 0x3b20187d, 0x3ec50c7c,
+	0x3536238e, 0x3536238e, 0x3d3e1294, 0x28993179,
+	0x2d412d41, 0x3b20187d, 0x187d3b20, 0x238e3536,
+	0x38711e2b, 0x06453fb1, 0x187d3b20, 0x3536238e,
+	0xf3843ec5, 0x0c7c3ec5, 0x31792899, 0xe1d53871,
+	0x00004000, 0x2d412d41, 0xd2bf2d41, 0xf3843ec5,
+	0x28993179, 0xc78f1e2b, 0xe7833b20, 0x238e3536,
+	0xc13b0c7c, 0xdc723536, 0x1e2b3871, 0xc04ff9bb,
+	0xd2bf2d41, 0x187d3b20, 0xc4e0e783, 0xcaca238e,
+	0x12943d3e, 0xce87d767, 0xc4e0187d, 0x0c7c3ec5,
+	0xdc72caca, 0xc13b0c7c, 0x06453fb1, 0xed6cc2c2
 };
 
 #elif defined ARMV7Neon
-/* 
- *  Q29 for 128 and 1024 
+/*
+ *  Q29 for 128 and 1024
  *
  * for (i = 0; i < num/4; i++) {
  *   angle = (i + 0.125) * M_PI / num;
  *   x = cos(angle) * (1 << 29);
  *   x = sin(angle) * (1 << 29);
- * 
+ *
  *   angle = (num/2 - 1 - i + 0.125) * M_PI / num;
  *   x = cos(angle) * (1 << 29);
  *   x = sin(angle) * (1 << 29);
@@ -353,313 +353,313 @@
  */
 const int cossintab[128 + 1024] = {
 	/* 128 */
-	0x1ffff621, 0x001921f9, 0x00afea69, 0x1ffe1c68, 0x1ffce09d, 0x00e22a7a, 0x0178dbaa, 0x1ff753bb, 
-	0x1ff4dc55, 0x01ab101c, 0x024192cf, 0x1feb9d25, 0x1fe7ea85, 0x0273b3e2, 0x0309f0e2, 0x1fdafa75, 
-	0x1fd60d2e, 0x033bf6dd, 0x03d1d700, 0x1fc56e3b, 0x1fbf470f, 0x0403ba2b, 0x04992653, 0x1faafbcb, 
-	0x1fa39bac, 0x04cadefe, 0x055fc022, 0x1f8ba738, 0x1f830f4a, 0x059146a1, 0x062585ca, 0x1f677557, 
-	0x1f5da6ed, 0x0656d27a, 0x06ea58cd, 0x1f3e6bbc, 0x1f33685a, 0x071b6415, 0x07ae1ad2, 0x1f1090bd, 
-	0x1f045a15, 0x07dedd20, 0x0870ada7, 0x1eddeb6a, 0x1ed0835f, 0x08a11f78, 0x0931f34d, 0x1ea68394, 
-	0x1e97ec36, 0x09620d27, 0x09f1cdf5, 0x1e6a61c5, 0x1e5a9d55, 0x0a21886e, 0x0ab02009, 0x1e298f44, 
-	0x1e18a030, 0x0adf73c6, 0x0b6ccc32, 0x1de4160f, 0x1dd1fef4, 0x0b9bb1e5, 0x0c27b555, 0x1d9a00de, 
-	0x1d86c484, 0x0c5625c3, 0x0ce0bea2, 0x1d4b5b1b, 0x1d36fc7c, 0x0d0eb2a2, 0x0d97cb8f, 0x1cf830e9, 
-	0x1ce2b328, 0x0dc53c0a, 0x0e4cbfe2, 0x1ca08f1a, 0x1c89f587, 0x0e79a5d7, 0x0eff7fb3, 0x1c448331, 
-	0x1c2cd149, 0x0f2bd437, 0x0fafef73, 0x1be41b61, 0x1bcb54cb, 0x0fdbabae, 0x105df3ec, 0x1b7f6687, 
-	0x1b658f15, 0x10891120, 0x11097249, 0x1b16742a, 0x1afb8fd9, 0x1133e9d0, 0x11b25017, 0x1aa9547a, 
-	0x1a8d676e, 0x11dc1b65, 0x1258734d, 0x1a38184a, 0x1a1b26d3, 0x12818bef, 0x12fbc24b, 0x19c2d111, 
-	0x19a4dfa4, 0x132421ec, 0x139c23e4, 0x194990e4, 0x192aa420, 0x13c3c44a, 0x14397f5b, 0x18cc6a75, 
-	0x18ac871f, 0x14605a69, 0x14d3bc6d, 0x184b7112, 0x182a9c14, 0x14f9cc26, 0x156ac352, 0x17c6b89d, 
+	0x1ffff621, 0x001921f9, 0x00afea69, 0x1ffe1c68, 0x1ffce09d, 0x00e22a7a, 0x0178dbaa, 0x1ff753bb,
+	0x1ff4dc55, 0x01ab101c, 0x024192cf, 0x1feb9d25, 0x1fe7ea85, 0x0273b3e2, 0x0309f0e2, 0x1fdafa75,
+	0x1fd60d2e, 0x033bf6dd, 0x03d1d700, 0x1fc56e3b, 0x1fbf470f, 0x0403ba2b, 0x04992653, 0x1faafbcb,
+	0x1fa39bac, 0x04cadefe, 0x055fc022, 0x1f8ba738, 0x1f830f4a, 0x059146a1, 0x062585ca, 0x1f677557,
+	0x1f5da6ed, 0x0656d27a, 0x06ea58cd, 0x1f3e6bbc, 0x1f33685a, 0x071b6415, 0x07ae1ad2, 0x1f1090bd,
+	0x1f045a15, 0x07dedd20, 0x0870ada7, 0x1eddeb6a, 0x1ed0835f, 0x08a11f78, 0x0931f34d, 0x1ea68394,
+	0x1e97ec36, 0x09620d27, 0x09f1cdf5, 0x1e6a61c5, 0x1e5a9d55, 0x0a21886e, 0x0ab02009, 0x1e298f44,
+	0x1e18a030, 0x0adf73c6, 0x0b6ccc32, 0x1de4160f, 0x1dd1fef4, 0x0b9bb1e5, 0x0c27b555, 0x1d9a00de,
+	0x1d86c484, 0x0c5625c3, 0x0ce0bea2, 0x1d4b5b1b, 0x1d36fc7c, 0x0d0eb2a2, 0x0d97cb8f, 0x1cf830e9,
+	0x1ce2b328, 0x0dc53c0a, 0x0e4cbfe2, 0x1ca08f1a, 0x1c89f587, 0x0e79a5d7, 0x0eff7fb3, 0x1c448331,
+	0x1c2cd149, 0x0f2bd437, 0x0fafef73, 0x1be41b61, 0x1bcb54cb, 0x0fdbabae, 0x105df3ec, 0x1b7f6687,
+	0x1b658f15, 0x10891120, 0x11097249, 0x1b16742a, 0x1afb8fd9, 0x1133e9d0, 0x11b25017, 0x1aa9547a,
+	0x1a8d676e, 0x11dc1b65, 0x1258734d, 0x1a38184a, 0x1a1b26d3, 0x12818bef, 0x12fbc24b, 0x19c2d111,
+	0x19a4dfa4, 0x132421ec, 0x139c23e4, 0x194990e4, 0x192aa420, 0x13c3c44a, 0x14397f5b, 0x18cc6a75,
+	0x18ac871f, 0x14605a69, 0x14d3bc6d, 0x184b7112, 0x182a9c14, 0x14f9cc26, 0x156ac352, 0x17c6b89d,
 	0x17a4f708, 0x159001d6, 0x15fe7cbe, 0x173e558e, 0x171bac96, 0x1622e450, 0x168ed1eb, 0x16b25ced,
 	/* 1024 */
-	0x1fffffd9, 0x0003243f, 0x0015fdba, 0x1ffff872, 0x1ffff382, 0x001c4637, 0x002f1fa6, 0x1fffdd4d, 
-	0x1fffd36f, 0x0035681d, 0x00484175, 0x1fffae6c, 0x1fff9f9e, 0x004e89e3, 0x00616318, 0x1fff6bce, 
-	0x1fff5811, 0x0067ab77, 0x007a847e, 0x1fff1572, 0x1ffefcc6, 0x0080cccc, 0x0093a599, 0x1ffeab5b, 
-	0x1ffe8dbf, 0x0099edd2, 0x00acc658, 0x1ffe2d86, 0x1ffe0afc, 0x00b30e78, 0x00c5e6ad, 0x1ffd9bf6, 
-	0x1ffd747c, 0x00cc2eb0, 0x00df0688, 0x1ffcf6aa, 0x1ffcca41, 0x00e54e6a, 0x00f825da, 0x1ffc3da2, 
-	0x1ffc0c4b, 0x00fe6d97, 0x01114492, 0x1ffb70e0, 0x1ffb3a9a, 0x01178c27, 0x012a62a2, 0x1ffa9063, 
-	0x1ffa552e, 0x0130aa0a, 0x01437ffa, 0x1ff99c2c, 0x1ff95c09, 0x0149c731, 0x015c9c8a, 0x1ff8943c, 
-	0x1ff84f2b, 0x0162e38d, 0x0175b843, 0x1ff77893, 0x1ff72e94, 0x017bff0e, 0x018ed316, 0x1ff64932, 
-	0x1ff5fa46, 0x019519a5, 0x01a7ecf2, 0x1ff5061b, 0x1ff4b240, 0x01ae3341, 0x01c105c9, 0x1ff3af4c, 
-	0x1ff35684, 0x01c74bd5, 0x01da1d8c, 0x1ff244c8, 0x1ff1e713, 0x01e0634f, 0x01f33429, 0x1ff0c68f, 
-	0x1ff063ed, 0x01f979a1, 0x020c4993, 0x1fef34a3, 0x1feecd14, 0x02128ebb, 0x02255db9, 0x1fed8f03, 
-	0x1fed2287, 0x022ba28f, 0x023e708d, 0x1febd5b2, 0x1feb644a, 0x0244b50b, 0x025781fe, 0x1fea08b0, 
-	0x1fe9925c, 0x025dc621, 0x027091fd, 0x1fe827fe, 0x1fe7acbe, 0x0276d5c1, 0x0289a07b, 0x1fe6339d, 
-	0x1fe5b372, 0x028fe3dd, 0x02a2ad69, 0x1fe42b90, 0x1fe3a679, 0x02a8f063, 0x02bbb8b6, 0x1fe20fd6, 
-	0x1fe185d5, 0x02c1fb46, 0x02d4c253, 0x1fdfe071, 0x1fdf5186, 0x02db0475, 0x02edca32, 0x1fdd9d64, 
-	0x1fdd098e, 0x02f40be2, 0x0306d042, 0x1fdb46ae, 0x1fdaadee, 0x030d117c, 0x031fd474, 0x1fd8dc51, 
-	0x1fd83ea8, 0x03261534, 0x0338d6b8, 0x1fd65e4f, 0x1fd5bbbd, 0x033f16fb, 0x0351d700, 0x1fd3ccaa, 
-	0x1fd32530, 0x035816c1, 0x036ad53c, 0x1fd12763, 0x1fd07b00, 0x03711477, 0x0383d15c, 0x1fce6e7c, 
-	0x1fcdbd31, 0x038a100e, 0x039ccb51, 0x1fcba1f5, 0x1fcaebc3, 0x03a30975, 0x03b5c30b, 0x1fc8c1d2, 
-	0x1fc806b9, 0x03bc009f, 0x03ceb87c, 0x1fc5ce14, 0x1fc50e14, 0x03d4f57a, 0x03e7ab93, 0x1fc2c6bd, 
-	0x1fc201d7, 0x03ede7f9, 0x04009c42, 0x1fbfabcd, 0x1fbee202, 0x0406d80b, 0x04198a78, 0x1fbc7d49, 
-	0x1fbbae99, 0x041fc5a1, 0x04327628, 0x1fb93b31, 0x1fb8679c, 0x0438b0ac, 0x044b5f40, 0x1fb5e587, 
-	0x1fb50d0e, 0x0451991d, 0x046445b2, 0x1fb27c4e, 0x1fb19ef1, 0x046a7ee3, 0x047d296f, 0x1faeff87, 
-	0x1fae1d47, 0x048361f0, 0x04960a67, 0x1fab6f35, 0x1faa8813, 0x049c4235, 0x04aee88b, 0x1fa7cb5a, 
-	0x1fa6df56, 0x04b51fa1, 0x04c7c3cb, 0x1fa413f8, 0x1fa32313, 0x04cdfa26, 0x04e09c18, 0x1fa04912, 
-	0x1f9f534c, 0x04e6d1b4, 0x04f97163, 0x1f9c6aa9, 0x1f9b7003, 0x04ffa63c, 0x0512439d, 0x1f9878c1, 
-	0x1f97793b, 0x051877af, 0x052b12b6, 0x1f94735b, 0x1f936ef6, 0x053145fd, 0x0543de9e, 0x1f905a7a, 
-	0x1f8f5137, 0x054a1117, 0x055ca748, 0x1f8c2e21, 0x1f8b2000, 0x0562d8ee, 0x05756ca2, 0x1f87ee52, 
-	0x1f86db55, 0x057b9d73, 0x058e2e9f, 0x1f839b10, 0x1f828336, 0x05945e95, 0x05a6ed2e, 0x1f7f345e, 
-	0x1f7e17a8, 0x05ad1c47, 0x05bfa840, 0x1f7aba3e, 0x1f7998ad, 0x05c5d678, 0x05d85fc7, 0x1f762cb2, 
-	0x1f750647, 0x05de8d19, 0x05f113b3, 0x1f718bbf, 0x1f70607a, 0x05f7401c, 0x0609c3f5, 0x1f6cd766, 
-	0x1f6ba748, 0x060fef71, 0x0622707d, 0x1f680fab, 0x1f66dab5, 0x06289b08, 0x063b193c, 0x1f633490, 
-	0x1f61fac3, 0x064142d3, 0x0653be23, 0x1f5e4619, 0x1f5d0775, 0x0659e6c2, 0x066c5f24, 0x1f594448, 
-	0x1f5800ce, 0x067286c6, 0x0684fc2e, 0x1f542f21, 0x1f52e6d2, 0x068b22d0, 0x069d9532, 0x1f4f06a6, 
-	0x1f4db983, 0x06a3bad0, 0x06b62a22, 0x1f49cadc, 0x1f4878e5, 0x06bc4eb9, 0x06cebaee, 0x1f447bc4, 
-	0x1f4324fb, 0x06d4de79, 0x06e74786, 0x1f3f1963, 0x1f3dbdc8, 0x06ed6a03, 0x06ffcfdd, 0x1f39a3bc, 
-	0x1f384350, 0x0705f147, 0x071853e3, 0x1f341ad2, 0x1f32b595, 0x071e7436, 0x0730d388, 0x1f2e7ea9, 
-	0x1f2d149d, 0x0736f2c0, 0x07494ebd, 0x1f28cf43, 0x1f276069, 0x074f6cd7, 0x0761c574, 0x1f230ca5, 
-	0x1f2198fd, 0x0767e26c, 0x077a379d, 0x1f1d36d2, 0x1f1bbe5d, 0x07805370, 0x0792a52a, 0x1f174dce, 
-	0x1f15d08d, 0x0798bfd3, 0x07ab0e0a, 0x1f11519c, 0x1f0fcf91, 0x07b12786, 0x07c37230, 0x1f0b4240, 
-	0x1f09bb6b, 0x07c98a7a, 0x07dbd18c, 0x1f051fbe, 0x1f03941f, 0x07e1e8a1, 0x07f42c0e, 0x1efeea19, 
-	0x1efd59b3, 0x07fa41eb, 0x080c81a9, 0x1ef8a155, 0x1ef70c28, 0x0812964a, 0x0824d24d, 0x1ef24577, 
-	0x1ef0ab84, 0x082ae5ad, 0x083d1dea, 0x1eebd682, 0x1eea37ca, 0x08433007, 0x08556473, 0x1ee5547a, 
-	0x1ee3b0fe, 0x085b7548, 0x086da5d8, 0x1edebf64, 0x1edd1724, 0x0873b562, 0x0885e209, 0x1ed81742, 
-	0x1ed66a41, 0x088bf044, 0x089e18f9, 0x1ed15c1a, 0x1ecfaa57, 0x08a425e1, 0x08b64a98, 0x1eca8def, 
-	0x1ec8d76c, 0x08bc562a, 0x08ce76d8, 0x1ec3acc6, 0x1ec1f184, 0x08d4810f, 0x08e69da8, 0x1ebcb8a3, 
-	0x1ebaf8a3, 0x08eca681, 0x08febefb, 0x1eb5b18a, 0x1eb3eccd, 0x0904c673, 0x0916dac2, 0x1eae977f, 
-	0x1eacce07, 0x091ce0d4, 0x092ef0ed, 0x1ea76a87, 0x1ea59c55, 0x0934f596, 0x0947016e, 0x1ea02aa7, 
-	0x1e9e57bb, 0x094d04aa, 0x095f0c36, 0x1e98d7e2, 0x1e97003e, 0x09650e01, 0x09771136, 0x1e91723e, 
-	0x1e8f95e3, 0x097d118d, 0x098f1060, 0x1e89f9bf, 0x1e8818ad, 0x09950f3f, 0x09a709a4, 0x1e826e69, 
-	0x1e8088a2, 0x09ad0707, 0x09befcf4, 0x1e7ad041, 0x1e78e5c7, 0x09c4f8d8, 0x09d6ea40, 0x1e731f4c, 
-	0x1e71301f, 0x09dce4a1, 0x09eed17b, 0x1e6b5b8f, 0x1e6967b1, 0x09f4ca56, 0x0a06b296, 0x1e63850e, 
-	0x1e618c80, 0x0a0ca9e6, 0x0a1e8d81, 0x1e5b9bce, 0x1e599e91, 0x0a248343, 0x0a36622e, 0x1e539fd4, 
-	0x1e519dea, 0x0a3c565e, 0x0a4e308f, 0x1e4b9126, 0x1e498a8e, 0x0a542329, 0x0a65f894, 0x1e436fc7, 
-	0x1e416485, 0x0a6be995, 0x0a7dba2f, 0x1e3b3bbd, 0x1e392bd1, 0x0a83a993, 0x0a957551, 0x1e32f50e, 
-	0x1e30e079, 0x0a9b6315, 0x0aad29ec, 0x1e2a9bbd, 0x1e288281, 0x0ab3160c, 0x0ac4d7f1, 0x1e222fd1, 
-	0x1e2011ee, 0x0acac26a, 0x0adc7f52, 0x1e19b14f, 0x1e178ec7, 0x0ae2681f, 0x0af41fff, 0x1e11203b, 
-	0x1e0ef910, 0x0afa071d, 0x0b0bb9eb, 0x1e087c9b, 0x1e0650ce, 0x0b119f56, 0x0b234d07, 0x1dffc674, 
-	0x1dfd9606, 0x0b2930bb, 0x0b3ad943, 0x1df6fdcc, 0x1df4c8bf, 0x0b40bb3e, 0x0b525e92, 0x1dee22a9, 
-	0x1debe8fd, 0x0b583ecf, 0x0b69dce6, 0x1de5350f, 0x1de2f6c6, 0x0b6fbb62, 0x0b81542f, 0x1ddc3504, 
-	0x1dd9f220, 0x0b8730e6, 0x0b98c45f, 0x1dd3228e, 0x1dd0db10, 0x0b9e9f4d, 0x0bb02d68, 0x1dc9fdb2, 
-	0x1dc7b19b, 0x0bb6068a, 0x0bc78f3b, 0x1dc0c676, 0x1dbe75c8, 0x0bcd668e, 0x0bdee9ca, 0x1db77cdf, 
-	0x1db5279c, 0x0be4bf4a, 0x0bf63d07, 0x1dae20f4, 0x1dabc71d, 0x0bfc10af, 0x0c0d88e2, 0x1da4b2ba, 
-	0x1da25450, 0x0c135ab0, 0x0c24cd4e, 0x1d9b3237, 0x1d98cf3b, 0x0c2a9d3e, 0x0c3c0a3d, 0x1d919f70, 
-	0x1d8f37e5, 0x0c41d84b, 0x0c533fa0, 0x1d87fa6d, 0x1d858e53, 0x0c590bc9, 0x0c6a6d68, 0x1d7e4332, 
-	0x1d7bd28b, 0x0c7037a8, 0x0c819388, 0x1d7479c5, 0x1d720493, 0x0c875bdb, 0x0c98b1f0, 0x1d6a9e2e, 
-	0x1d682472, 0x0c9e7854, 0x0cafc894, 0x1d60b070, 0x1d5e322c, 0x0cb58d04, 0x0cc6d764, 0x1d56b094, 
-	0x1d542dc9, 0x0ccc99de, 0x0cddde53, 0x1d4c9e9f, 0x1d4a174f, 0x0ce39ed2, 0x0cf4dd52, 0x1d427a97, 
-	0x1d3feec3, 0x0cfa9bd2, 0x0d0bd452, 0x1d384483, 0x1d35b42d, 0x0d1190d1, 0x0d22c347, 0x1d2dfc68, 
-	0x1d2b6791, 0x0d287dc1, 0x0d39aa21, 0x1d23a24e, 0x1d2108f8, 0x0d3f6292, 0x0d5088d3, 0x1d19363a, 
-	0x1d169867, 0x0d563f38, 0x0d675f4e, 0x1d0eb833, 0x1d0c15e4, 0x0d6d13a3, 0x0d7e2d85, 0x1d04283f, 
-	0x1d018176, 0x0d83dfc6, 0x0d94f369, 0x1cf98666, 0x1cf6db24, 0x0d9aa393, 0x0dabb0ec, 0x1ceed2ad, 
-	0x1cec22f4, 0x0db15efc, 0x0dc26600, 0x1ce40d1b, 0x1ce158ed, 0x0dc811f3, 0x0dd91298, 0x1cd935b7, 
-	0x1cd67d15, 0x0ddebc69, 0x0defb6a5, 0x1cce4c87, 0x1ccb8f74, 0x0df55e51, 0x0e065219, 0x1cc35192, 
-	0x1cc0900f, 0x0e0bf79c, 0x0e1ce4e6, 0x1cb844df, 0x1cb57eee, 0x0e22883e, 0x0e336eff, 0x1cad2675, 
-	0x1caa5c17, 0x0e391027, 0x0e49f055, 0x1ca1f65b, 0x1c9f2792, 0x0e4f8f4b, 0x0e6068db, 0x1c96b497, 
-	0x1c93e165, 0x0e66059a, 0x0e76d883, 0x1c8b6131, 0x1c888997, 0x0e7c7308, 0x0e8d3f3e, 0x1c7ffc2f, 
-	0x1c7d202f, 0x0e92d787, 0x0ea39d00, 0x1c748599, 0x1c71a535, 0x0ea93308, 0x0eb9f1ba, 0x1c68fd75, 
-	0x1c6618ae, 0x0ebf857d, 0x0ed03d5e, 0x1c5d63ca, 0x1c5a7aa4, 0x0ed5ceda, 0x0ee67fdf, 0x1c51b8a1, 
-	0x1c4ecb1c, 0x0eec0f10, 0x0efcb92f, 0x1c45fc00, 0x1c430a1d, 0x0f024612, 0x0f12e941, 0x1c3a2ded, 
-	0x1c3737b0, 0x0f1873d2, 0x0f291006, 0x1c2e4e72, 0x1c2b53db, 0x0f2e9842, 0x0f3f2d71, 0x1c225d94, 
-	0x1c1f5ea6, 0x0f44b354, 0x0f554175, 0x1c165b5b, 0x1c135818, 0x0f5ac4fc, 0x0f6b4c03, 0x1c0a47cf, 
-	0x1c074038, 0x0f70cd2a, 0x0f814d0e, 0x1bfe22f8, 0x1bfb170f, 0x0f86cbd3, 0x0f974489, 0x1bf1ecdb, 
-	0x1beedca2, 0x0f9cc0e7, 0x0fad3265, 0x1be5a582, 0x1be290fb, 0x0fb2ac5a, 0x0fc31697, 0x1bd94cf4, 
-	0x1bd63421, 0x0fc88e1e, 0x0fd8f10f, 0x1bcce337, 0x1bc9c61a, 0x0fde6626, 0x0feec1c0, 0x1bc06855, 
-	0x1bbd46f0, 0x0ff43464, 0x1004889e, 0x1bb3dc55, 0x1bb0b6a9, 0x1009f8cb, 0x101a459a, 0x1ba73f3d, 
-	0x1ba4154d, 0x101fb34d, 0x102ff8a8, 0x1b9a9117, 0x1b9762e4, 0x103563dc, 0x1045a1b9, 0x1b8dd1ea, 
-	0x1b8a9f77, 0x104b0a6c, 0x105b40c1, 0x1b8101be, 0x1b7dcb0c, 0x1060a6ef, 0x1070d5b1, 0x1b74209b, 
-	0x1b70e5ac, 0x10763958, 0x1086607e, 0x1b672e88, 0x1b63ef5f, 0x108bc19a, 0x109be119, 0x1b5a2b8e, 
-	0x1b56e82c, 0x10a13fa6, 0x10b15775, 0x1b4d17b4, 0x1b49d01c, 0x10b6b371, 0x10c6c385, 0x1b3ff304, 
-	0x1b3ca737, 0x10cc1cec, 0x10dc253c, 0x1b32bd84, 0x1b2f6d85, 0x10e17c0b, 0x10f17c8d, 0x1b25773d, 
-	0x1b22230e, 0x10f6d0c0, 0x1106c96a, 0x1b182038, 0x1b14c7da, 0x110c1afe, 0x111c0bc6, 0x1b0ab87c, 
-	0x1b075bf1, 0x11215ab8, 0x11314395, 0x1afd4012, 0x1af9df5d, 0x11368fe1, 0x114670c8, 0x1aefb702, 
-	0x1aec5225, 0x114bba6b, 0x115b9354, 0x1ae21d54, 0x1adeb451, 0x1160da4b, 0x1170ab2a, 0x1ad47311, 
-	0x1ad105e9, 0x1175ef72, 0x1185b83f, 0x1ac6b841, 0x1ac346f8, 0x118af9d4, 0x119aba84, 0x1ab8ecec, 
-	0x1ab57784, 0x119ff964, 0x11afb1ee, 0x1aab111c, 0x1aa79796, 0x11b4ee14, 0x11c49e6f, 0x1a9d24d9, 
-	0x1a99a737, 0x11c9d7d9, 0x11d97ff9, 0x1a8f282b, 0x1a8ba670, 0x11deb6a4, 0x11ee5682, 0x1a811b1b, 
-	0x1a7d9549, 0x11f38a6a, 0x120321fa, 0x1a72fdb2, 0x1a6f73ca, 0x1208531c, 0x1217e256, 0x1a64cff8, 
-	0x1a6141fd, 0x121d10af, 0x122c9789, 0x1a5691f5, 0x1a52ffeb, 0x1231c316, 0x12414186, 0x1a4843b4, 
-	0x1a44ad9b, 0x12466a44, 0x1255e041, 0x1a39e53d, 0x1a364b17, 0x125b062b, 0x126a73ac, 0x1a2b7698, 
-	0x1a27d868, 0x126f96c1, 0x127efbbb, 0x1a1cf7ce, 0x1a195597, 0x12841bf6, 0x12937861, 0x1a0e68e9, 
-	0x1a0ac2ac, 0x129895c0, 0x12a7e991, 0x19ffc9f1, 0x19fc1fb1, 0x12ad0412, 0x12bc4f40, 0x19f11af0, 
-	0x19ed6caf, 0x12c166de, 0x12d0a960, 0x19e25bee, 0x19dea9ae, 0x12d5be18, 0x12e4f7e5, 0x19d38cf4, 
-	0x19cfd6b8, 0x12ea09b4, 0x12f93ac2, 0x19c4ae0c, 0x19c0f3d6, 0x12fe49a6, 0x130d71eb, 0x19b5bf3f, 
-	0x19b20111, 0x13127de0, 0x13219d53, 0x19a6c096, 0x19a2fe73, 0x1326a656, 0x1335bcef, 0x1997b21b, 
-	0x1993ec04, 0x133ac2fc, 0x1349d0b0, 0x198893d6, 0x1984c9ce, 0x134ed3c5, 0x135dd88c, 0x197965d0, 
-	0x197597da, 0x1362d8a6, 0x1371d476, 0x196a2815, 0x19665632, 0x1376d191, 0x1385c461, 0x195adaab, 
-	0x195704df, 0x138abe7b, 0x1399a841, 0x194b7d9e, 0x1947a3eb, 0x139e9f56, 0x13ad800a, 0x193c10f7, 
-	0x1938335e, 0x13b27417, 0x13c14bb0, 0x192c94bf, 0x1928b343, 0x13c63cb2, 0x13d50b26, 0x191d08ff, 
-	0x191923a3, 0x13d9f91b, 0x13e8be60, 0x190d6dc1, 0x19098488, 0x13eda944, 0x13fc6553, 0x18fdc310, 
-	0x18f9d5fa, 0x14014d23, 0x140ffff1, 0x18ee08f4, 0x18ea1805, 0x1414e4aa, 0x14238e2f, 0x18de3f77, 
-	0x18da4ab2, 0x14286fce, 0x14371001, 0x18ce66a3, 0x18ca6e0a, 0x143bee83, 0x144a855b, 0x18be7e82, 
-	0x18ba8217, 0x144f60bd, 0x145dee30, 0x18ae871e, 0x18aa86e3, 0x1462c670, 0x14714a76, 0x189e8080, 
-	0x189a7c78, 0x14761f8f, 0x14849a1f, 0x188e6ab2, 0x188a62e0, 0x14896c0f, 0x1497dd20, 0x187e45be, 
-	0x187a3a25, 0x149cabe4, 0x14ab136d, 0x186e11af, 0x186a0250, 0x14afdf03, 0x14be3cfa, 0x185dce8e, 
-	0x1859bb6c, 0x14c3055e, 0x14d159bc, 0x184d7c65, 0x18496583, 0x14d61eeb, 0x14e469a6, 0x183d1b3e, 
-	0x1839009e, 0x14e92b9e, 0x14f76cad, 0x182cab24, 0x18288cc8, 0x14fc2b6a, 0x150a62c6, 0x181c2c20, 
-	0x18180a0c, 0x150f1e45, 0x151d4be3, 0x180b9e3d, 0x18077873, 0x15220422, 0x153027fb, 0x17fb0185, 
-	0x17f6d807, 0x1534dcf6, 0x1542f700, 0x17ea5602, 0x17e628d3, 0x1547a8b5, 0x1555b8e8, 0x17d99bbe, 
-	0x17d56ae0, 0x155a6754, 0x15686da7, 0x17c8d2c4, 0x17c49e3b, 0x156d18c7, 0x157b1532, 0x17b7fb1f, 
-	0x17b3c2ec, 0x157fbd03, 0x158daf7c, 0x17a714d7, 0x17a2d8fe, 0x159253fb, 0x15a03c7a, 0x17961ff9, 
-	0x1791e07b, 0x15a4dda5, 0x15b2bc22, 0x17851c8e, 0x1780d96f, 0x15b759f5, 0x15c52e67, 0x17740aa1, 
-	0x176fc3e3, 0x15c9c8e0, 0x15d7933f, 0x1762ea3d, 0x175e9fe2, 0x15dc2a5a, 0x15e9ea9d, 0x1751bb6b, 
-	0x174d6d77, 0x15ee7e58, 0x15fc3477, 0x17407e37, 0x173c2cac, 0x1600c4cf, 0x160e70c1, 0x172f32ab, 
-	0x172add8c, 0x1612fdb3, 0x16209f70, 0x171dd8d2, 0x17198021, 0x162528fa, 0x1632c078, 0x170c70b7, 
-	0x17081477, 0x16374697, 0x1644d3d0, 0x16fafa64, 0x16f69a97, 0x16495680, 0x1656d96a, 0x16e975e4, 
-	0x16e5128e, 0x165b58aa, 0x1668d13e, 0x16d7e341, 0x16d37c65, 0x166d4d0a, 0x167abb3e, 0x16c64288, 
+	0x1fffffd9, 0x0003243f, 0x0015fdba, 0x1ffff872, 0x1ffff382, 0x001c4637, 0x002f1fa6, 0x1fffdd4d,
+	0x1fffd36f, 0x0035681d, 0x00484175, 0x1fffae6c, 0x1fff9f9e, 0x004e89e3, 0x00616318, 0x1fff6bce,
+	0x1fff5811, 0x0067ab77, 0x007a847e, 0x1fff1572, 0x1ffefcc6, 0x0080cccc, 0x0093a599, 0x1ffeab5b,
+	0x1ffe8dbf, 0x0099edd2, 0x00acc658, 0x1ffe2d86, 0x1ffe0afc, 0x00b30e78, 0x00c5e6ad, 0x1ffd9bf6,
+	0x1ffd747c, 0x00cc2eb0, 0x00df0688, 0x1ffcf6aa, 0x1ffcca41, 0x00e54e6a, 0x00f825da, 0x1ffc3da2,
+	0x1ffc0c4b, 0x00fe6d97, 0x01114492, 0x1ffb70e0, 0x1ffb3a9a, 0x01178c27, 0x012a62a2, 0x1ffa9063,
+	0x1ffa552e, 0x0130aa0a, 0x01437ffa, 0x1ff99c2c, 0x1ff95c09, 0x0149c731, 0x015c9c8a, 0x1ff8943c,
+	0x1ff84f2b, 0x0162e38d, 0x0175b843, 0x1ff77893, 0x1ff72e94, 0x017bff0e, 0x018ed316, 0x1ff64932,
+	0x1ff5fa46, 0x019519a5, 0x01a7ecf2, 0x1ff5061b, 0x1ff4b240, 0x01ae3341, 0x01c105c9, 0x1ff3af4c,
+	0x1ff35684, 0x01c74bd5, 0x01da1d8c, 0x1ff244c8, 0x1ff1e713, 0x01e0634f, 0x01f33429, 0x1ff0c68f,
+	0x1ff063ed, 0x01f979a1, 0x020c4993, 0x1fef34a3, 0x1feecd14, 0x02128ebb, 0x02255db9, 0x1fed8f03,
+	0x1fed2287, 0x022ba28f, 0x023e708d, 0x1febd5b2, 0x1feb644a, 0x0244b50b, 0x025781fe, 0x1fea08b0,
+	0x1fe9925c, 0x025dc621, 0x027091fd, 0x1fe827fe, 0x1fe7acbe, 0x0276d5c1, 0x0289a07b, 0x1fe6339d,
+	0x1fe5b372, 0x028fe3dd, 0x02a2ad69, 0x1fe42b90, 0x1fe3a679, 0x02a8f063, 0x02bbb8b6, 0x1fe20fd6,
+	0x1fe185d5, 0x02c1fb46, 0x02d4c253, 0x1fdfe071, 0x1fdf5186, 0x02db0475, 0x02edca32, 0x1fdd9d64,
+	0x1fdd098e, 0x02f40be2, 0x0306d042, 0x1fdb46ae, 0x1fdaadee, 0x030d117c, 0x031fd474, 0x1fd8dc51,
+	0x1fd83ea8, 0x03261534, 0x0338d6b8, 0x1fd65e4f, 0x1fd5bbbd, 0x033f16fb, 0x0351d700, 0x1fd3ccaa,
+	0x1fd32530, 0x035816c1, 0x036ad53c, 0x1fd12763, 0x1fd07b00, 0x03711477, 0x0383d15c, 0x1fce6e7c,
+	0x1fcdbd31, 0x038a100e, 0x039ccb51, 0x1fcba1f5, 0x1fcaebc3, 0x03a30975, 0x03b5c30b, 0x1fc8c1d2,
+	0x1fc806b9, 0x03bc009f, 0x03ceb87c, 0x1fc5ce14, 0x1fc50e14, 0x03d4f57a, 0x03e7ab93, 0x1fc2c6bd,
+	0x1fc201d7, 0x03ede7f9, 0x04009c42, 0x1fbfabcd, 0x1fbee202, 0x0406d80b, 0x04198a78, 0x1fbc7d49,
+	0x1fbbae99, 0x041fc5a1, 0x04327628, 0x1fb93b31, 0x1fb8679c, 0x0438b0ac, 0x044b5f40, 0x1fb5e587,
+	0x1fb50d0e, 0x0451991d, 0x046445b2, 0x1fb27c4e, 0x1fb19ef1, 0x046a7ee3, 0x047d296f, 0x1faeff87,
+	0x1fae1d47, 0x048361f0, 0x04960a67, 0x1fab6f35, 0x1faa8813, 0x049c4235, 0x04aee88b, 0x1fa7cb5a,
+	0x1fa6df56, 0x04b51fa1, 0x04c7c3cb, 0x1fa413f8, 0x1fa32313, 0x04cdfa26, 0x04e09c18, 0x1fa04912,
+	0x1f9f534c, 0x04e6d1b4, 0x04f97163, 0x1f9c6aa9, 0x1f9b7003, 0x04ffa63c, 0x0512439d, 0x1f9878c1,
+	0x1f97793b, 0x051877af, 0x052b12b6, 0x1f94735b, 0x1f936ef6, 0x053145fd, 0x0543de9e, 0x1f905a7a,
+	0x1f8f5137, 0x054a1117, 0x055ca748, 0x1f8c2e21, 0x1f8b2000, 0x0562d8ee, 0x05756ca2, 0x1f87ee52,
+	0x1f86db55, 0x057b9d73, 0x058e2e9f, 0x1f839b10, 0x1f828336, 0x05945e95, 0x05a6ed2e, 0x1f7f345e,
+	0x1f7e17a8, 0x05ad1c47, 0x05bfa840, 0x1f7aba3e, 0x1f7998ad, 0x05c5d678, 0x05d85fc7, 0x1f762cb2,
+	0x1f750647, 0x05de8d19, 0x05f113b3, 0x1f718bbf, 0x1f70607a, 0x05f7401c, 0x0609c3f5, 0x1f6cd766,
+	0x1f6ba748, 0x060fef71, 0x0622707d, 0x1f680fab, 0x1f66dab5, 0x06289b08, 0x063b193c, 0x1f633490,
+	0x1f61fac3, 0x064142d3, 0x0653be23, 0x1f5e4619, 0x1f5d0775, 0x0659e6c2, 0x066c5f24, 0x1f594448,
+	0x1f5800ce, 0x067286c6, 0x0684fc2e, 0x1f542f21, 0x1f52e6d2, 0x068b22d0, 0x069d9532, 0x1f4f06a6,
+	0x1f4db983, 0x06a3bad0, 0x06b62a22, 0x1f49cadc, 0x1f4878e5, 0x06bc4eb9, 0x06cebaee, 0x1f447bc4,
+	0x1f4324fb, 0x06d4de79, 0x06e74786, 0x1f3f1963, 0x1f3dbdc8, 0x06ed6a03, 0x06ffcfdd, 0x1f39a3bc,
+	0x1f384350, 0x0705f147, 0x071853e3, 0x1f341ad2, 0x1f32b595, 0x071e7436, 0x0730d388, 0x1f2e7ea9,
+	0x1f2d149d, 0x0736f2c0, 0x07494ebd, 0x1f28cf43, 0x1f276069, 0x074f6cd7, 0x0761c574, 0x1f230ca5,
+	0x1f2198fd, 0x0767e26c, 0x077a379d, 0x1f1d36d2, 0x1f1bbe5d, 0x07805370, 0x0792a52a, 0x1f174dce,
+	0x1f15d08d, 0x0798bfd3, 0x07ab0e0a, 0x1f11519c, 0x1f0fcf91, 0x07b12786, 0x07c37230, 0x1f0b4240,
+	0x1f09bb6b, 0x07c98a7a, 0x07dbd18c, 0x1f051fbe, 0x1f03941f, 0x07e1e8a1, 0x07f42c0e, 0x1efeea19,
+	0x1efd59b3, 0x07fa41eb, 0x080c81a9, 0x1ef8a155, 0x1ef70c28, 0x0812964a, 0x0824d24d, 0x1ef24577,
+	0x1ef0ab84, 0x082ae5ad, 0x083d1dea, 0x1eebd682, 0x1eea37ca, 0x08433007, 0x08556473, 0x1ee5547a,
+	0x1ee3b0fe, 0x085b7548, 0x086da5d8, 0x1edebf64, 0x1edd1724, 0x0873b562, 0x0885e209, 0x1ed81742,
+	0x1ed66a41, 0x088bf044, 0x089e18f9, 0x1ed15c1a, 0x1ecfaa57, 0x08a425e1, 0x08b64a98, 0x1eca8def,
+	0x1ec8d76c, 0x08bc562a, 0x08ce76d8, 0x1ec3acc6, 0x1ec1f184, 0x08d4810f, 0x08e69da8, 0x1ebcb8a3,
+	0x1ebaf8a3, 0x08eca681, 0x08febefb, 0x1eb5b18a, 0x1eb3eccd, 0x0904c673, 0x0916dac2, 0x1eae977f,
+	0x1eacce07, 0x091ce0d4, 0x092ef0ed, 0x1ea76a87, 0x1ea59c55, 0x0934f596, 0x0947016e, 0x1ea02aa7,
+	0x1e9e57bb, 0x094d04aa, 0x095f0c36, 0x1e98d7e2, 0x1e97003e, 0x09650e01, 0x09771136, 0x1e91723e,
+	0x1e8f95e3, 0x097d118d, 0x098f1060, 0x1e89f9bf, 0x1e8818ad, 0x09950f3f, 0x09a709a4, 0x1e826e69,
+	0x1e8088a2, 0x09ad0707, 0x09befcf4, 0x1e7ad041, 0x1e78e5c7, 0x09c4f8d8, 0x09d6ea40, 0x1e731f4c,
+	0x1e71301f, 0x09dce4a1, 0x09eed17b, 0x1e6b5b8f, 0x1e6967b1, 0x09f4ca56, 0x0a06b296, 0x1e63850e,
+	0x1e618c80, 0x0a0ca9e6, 0x0a1e8d81, 0x1e5b9bce, 0x1e599e91, 0x0a248343, 0x0a36622e, 0x1e539fd4,
+	0x1e519dea, 0x0a3c565e, 0x0a4e308f, 0x1e4b9126, 0x1e498a8e, 0x0a542329, 0x0a65f894, 0x1e436fc7,
+	0x1e416485, 0x0a6be995, 0x0a7dba2f, 0x1e3b3bbd, 0x1e392bd1, 0x0a83a993, 0x0a957551, 0x1e32f50e,
+	0x1e30e079, 0x0a9b6315, 0x0aad29ec, 0x1e2a9bbd, 0x1e288281, 0x0ab3160c, 0x0ac4d7f1, 0x1e222fd1,
+	0x1e2011ee, 0x0acac26a, 0x0adc7f52, 0x1e19b14f, 0x1e178ec7, 0x0ae2681f, 0x0af41fff, 0x1e11203b,
+	0x1e0ef910, 0x0afa071d, 0x0b0bb9eb, 0x1e087c9b, 0x1e0650ce, 0x0b119f56, 0x0b234d07, 0x1dffc674,
+	0x1dfd9606, 0x0b2930bb, 0x0b3ad943, 0x1df6fdcc, 0x1df4c8bf, 0x0b40bb3e, 0x0b525e92, 0x1dee22a9,
+	0x1debe8fd, 0x0b583ecf, 0x0b69dce6, 0x1de5350f, 0x1de2f6c6, 0x0b6fbb62, 0x0b81542f, 0x1ddc3504,
+	0x1dd9f220, 0x0b8730e6, 0x0b98c45f, 0x1dd3228e, 0x1dd0db10, 0x0b9e9f4d, 0x0bb02d68, 0x1dc9fdb2,
+	0x1dc7b19b, 0x0bb6068a, 0x0bc78f3b, 0x1dc0c676, 0x1dbe75c8, 0x0bcd668e, 0x0bdee9ca, 0x1db77cdf,
+	0x1db5279c, 0x0be4bf4a, 0x0bf63d07, 0x1dae20f4, 0x1dabc71d, 0x0bfc10af, 0x0c0d88e2, 0x1da4b2ba,
+	0x1da25450, 0x0c135ab0, 0x0c24cd4e, 0x1d9b3237, 0x1d98cf3b, 0x0c2a9d3e, 0x0c3c0a3d, 0x1d919f70,
+	0x1d8f37e5, 0x0c41d84b, 0x0c533fa0, 0x1d87fa6d, 0x1d858e53, 0x0c590bc9, 0x0c6a6d68, 0x1d7e4332,
+	0x1d7bd28b, 0x0c7037a8, 0x0c819388, 0x1d7479c5, 0x1d720493, 0x0c875bdb, 0x0c98b1f0, 0x1d6a9e2e,
+	0x1d682472, 0x0c9e7854, 0x0cafc894, 0x1d60b070, 0x1d5e322c, 0x0cb58d04, 0x0cc6d764, 0x1d56b094,
+	0x1d542dc9, 0x0ccc99de, 0x0cddde53, 0x1d4c9e9f, 0x1d4a174f, 0x0ce39ed2, 0x0cf4dd52, 0x1d427a97,
+	0x1d3feec3, 0x0cfa9bd2, 0x0d0bd452, 0x1d384483, 0x1d35b42d, 0x0d1190d1, 0x0d22c347, 0x1d2dfc68,
+	0x1d2b6791, 0x0d287dc1, 0x0d39aa21, 0x1d23a24e, 0x1d2108f8, 0x0d3f6292, 0x0d5088d3, 0x1d19363a,
+	0x1d169867, 0x0d563f38, 0x0d675f4e, 0x1d0eb833, 0x1d0c15e4, 0x0d6d13a3, 0x0d7e2d85, 0x1d04283f,
+	0x1d018176, 0x0d83dfc6, 0x0d94f369, 0x1cf98666, 0x1cf6db24, 0x0d9aa393, 0x0dabb0ec, 0x1ceed2ad,
+	0x1cec22f4, 0x0db15efc, 0x0dc26600, 0x1ce40d1b, 0x1ce158ed, 0x0dc811f3, 0x0dd91298, 0x1cd935b7,
+	0x1cd67d15, 0x0ddebc69, 0x0defb6a5, 0x1cce4c87, 0x1ccb8f74, 0x0df55e51, 0x0e065219, 0x1cc35192,
+	0x1cc0900f, 0x0e0bf79c, 0x0e1ce4e6, 0x1cb844df, 0x1cb57eee, 0x0e22883e, 0x0e336eff, 0x1cad2675,
+	0x1caa5c17, 0x0e391027, 0x0e49f055, 0x1ca1f65b, 0x1c9f2792, 0x0e4f8f4b, 0x0e6068db, 0x1c96b497,
+	0x1c93e165, 0x0e66059a, 0x0e76d883, 0x1c8b6131, 0x1c888997, 0x0e7c7308, 0x0e8d3f3e, 0x1c7ffc2f,
+	0x1c7d202f, 0x0e92d787, 0x0ea39d00, 0x1c748599, 0x1c71a535, 0x0ea93308, 0x0eb9f1ba, 0x1c68fd75,
+	0x1c6618ae, 0x0ebf857d, 0x0ed03d5e, 0x1c5d63ca, 0x1c5a7aa4, 0x0ed5ceda, 0x0ee67fdf, 0x1c51b8a1,
+	0x1c4ecb1c, 0x0eec0f10, 0x0efcb92f, 0x1c45fc00, 0x1c430a1d, 0x0f024612, 0x0f12e941, 0x1c3a2ded,
+	0x1c3737b0, 0x0f1873d2, 0x0f291006, 0x1c2e4e72, 0x1c2b53db, 0x0f2e9842, 0x0f3f2d71, 0x1c225d94,
+	0x1c1f5ea6, 0x0f44b354, 0x0f554175, 0x1c165b5b, 0x1c135818, 0x0f5ac4fc, 0x0f6b4c03, 0x1c0a47cf,
+	0x1c074038, 0x0f70cd2a, 0x0f814d0e, 0x1bfe22f8, 0x1bfb170f, 0x0f86cbd3, 0x0f974489, 0x1bf1ecdb,
+	0x1beedca2, 0x0f9cc0e7, 0x0fad3265, 0x1be5a582, 0x1be290fb, 0x0fb2ac5a, 0x0fc31697, 0x1bd94cf4,
+	0x1bd63421, 0x0fc88e1e, 0x0fd8f10f, 0x1bcce337, 0x1bc9c61a, 0x0fde6626, 0x0feec1c0, 0x1bc06855,
+	0x1bbd46f0, 0x0ff43464, 0x1004889e, 0x1bb3dc55, 0x1bb0b6a9, 0x1009f8cb, 0x101a459a, 0x1ba73f3d,
+	0x1ba4154d, 0x101fb34d, 0x102ff8a8, 0x1b9a9117, 0x1b9762e4, 0x103563dc, 0x1045a1b9, 0x1b8dd1ea,
+	0x1b8a9f77, 0x104b0a6c, 0x105b40c1, 0x1b8101be, 0x1b7dcb0c, 0x1060a6ef, 0x1070d5b1, 0x1b74209b,
+	0x1b70e5ac, 0x10763958, 0x1086607e, 0x1b672e88, 0x1b63ef5f, 0x108bc19a, 0x109be119, 0x1b5a2b8e,
+	0x1b56e82c, 0x10a13fa6, 0x10b15775, 0x1b4d17b4, 0x1b49d01c, 0x10b6b371, 0x10c6c385, 0x1b3ff304,
+	0x1b3ca737, 0x10cc1cec, 0x10dc253c, 0x1b32bd84, 0x1b2f6d85, 0x10e17c0b, 0x10f17c8d, 0x1b25773d,
+	0x1b22230e, 0x10f6d0c0, 0x1106c96a, 0x1b182038, 0x1b14c7da, 0x110c1afe, 0x111c0bc6, 0x1b0ab87c,
+	0x1b075bf1, 0x11215ab8, 0x11314395, 0x1afd4012, 0x1af9df5d, 0x11368fe1, 0x114670c8, 0x1aefb702,
+	0x1aec5225, 0x114bba6b, 0x115b9354, 0x1ae21d54, 0x1adeb451, 0x1160da4b, 0x1170ab2a, 0x1ad47311,
+	0x1ad105e9, 0x1175ef72, 0x1185b83f, 0x1ac6b841, 0x1ac346f8, 0x118af9d4, 0x119aba84, 0x1ab8ecec,
+	0x1ab57784, 0x119ff964, 0x11afb1ee, 0x1aab111c, 0x1aa79796, 0x11b4ee14, 0x11c49e6f, 0x1a9d24d9,
+	0x1a99a737, 0x11c9d7d9, 0x11d97ff9, 0x1a8f282b, 0x1a8ba670, 0x11deb6a4, 0x11ee5682, 0x1a811b1b,
+	0x1a7d9549, 0x11f38a6a, 0x120321fa, 0x1a72fdb2, 0x1a6f73ca, 0x1208531c, 0x1217e256, 0x1a64cff8,
+	0x1a6141fd, 0x121d10af, 0x122c9789, 0x1a5691f5, 0x1a52ffeb, 0x1231c316, 0x12414186, 0x1a4843b4,
+	0x1a44ad9b, 0x12466a44, 0x1255e041, 0x1a39e53d, 0x1a364b17, 0x125b062b, 0x126a73ac, 0x1a2b7698,
+	0x1a27d868, 0x126f96c1, 0x127efbbb, 0x1a1cf7ce, 0x1a195597, 0x12841bf6, 0x12937861, 0x1a0e68e9,
+	0x1a0ac2ac, 0x129895c0, 0x12a7e991, 0x19ffc9f1, 0x19fc1fb1, 0x12ad0412, 0x12bc4f40, 0x19f11af0,
+	0x19ed6caf, 0x12c166de, 0x12d0a960, 0x19e25bee, 0x19dea9ae, 0x12d5be18, 0x12e4f7e5, 0x19d38cf4,
+	0x19cfd6b8, 0x12ea09b4, 0x12f93ac2, 0x19c4ae0c, 0x19c0f3d6, 0x12fe49a6, 0x130d71eb, 0x19b5bf3f,
+	0x19b20111, 0x13127de0, 0x13219d53, 0x19a6c096, 0x19a2fe73, 0x1326a656, 0x1335bcef, 0x1997b21b,
+	0x1993ec04, 0x133ac2fc, 0x1349d0b0, 0x198893d6, 0x1984c9ce, 0x134ed3c5, 0x135dd88c, 0x197965d0,
+	0x197597da, 0x1362d8a6, 0x1371d476, 0x196a2815, 0x19665632, 0x1376d191, 0x1385c461, 0x195adaab,
+	0x195704df, 0x138abe7b, 0x1399a841, 0x194b7d9e, 0x1947a3eb, 0x139e9f56, 0x13ad800a, 0x193c10f7,
+	0x1938335e, 0x13b27417, 0x13c14bb0, 0x192c94bf, 0x1928b343, 0x13c63cb2, 0x13d50b26, 0x191d08ff,
+	0x191923a3, 0x13d9f91b, 0x13e8be60, 0x190d6dc1, 0x19098488, 0x13eda944, 0x13fc6553, 0x18fdc310,
+	0x18f9d5fa, 0x14014d23, 0x140ffff1, 0x18ee08f4, 0x18ea1805, 0x1414e4aa, 0x14238e2f, 0x18de3f77,
+	0x18da4ab2, 0x14286fce, 0x14371001, 0x18ce66a3, 0x18ca6e0a, 0x143bee83, 0x144a855b, 0x18be7e82,
+	0x18ba8217, 0x144f60bd, 0x145dee30, 0x18ae871e, 0x18aa86e3, 0x1462c670, 0x14714a76, 0x189e8080,
+	0x189a7c78, 0x14761f8f, 0x14849a1f, 0x188e6ab2, 0x188a62e0, 0x14896c0f, 0x1497dd20, 0x187e45be,
+	0x187a3a25, 0x149cabe4, 0x14ab136d, 0x186e11af, 0x186a0250, 0x14afdf03, 0x14be3cfa, 0x185dce8e,
+	0x1859bb6c, 0x14c3055e, 0x14d159bc, 0x184d7c65, 0x18496583, 0x14d61eeb, 0x14e469a6, 0x183d1b3e,
+	0x1839009e, 0x14e92b9e, 0x14f76cad, 0x182cab24, 0x18288cc8, 0x14fc2b6a, 0x150a62c6, 0x181c2c20,
+	0x18180a0c, 0x150f1e45, 0x151d4be3, 0x180b9e3d, 0x18077873, 0x15220422, 0x153027fb, 0x17fb0185,
+	0x17f6d807, 0x1534dcf6, 0x1542f700, 0x17ea5602, 0x17e628d3, 0x1547a8b5, 0x1555b8e8, 0x17d99bbe,
+	0x17d56ae0, 0x155a6754, 0x15686da7, 0x17c8d2c4, 0x17c49e3b, 0x156d18c7, 0x157b1532, 0x17b7fb1f,
+	0x17b3c2ec, 0x157fbd03, 0x158daf7c, 0x17a714d7, 0x17a2d8fe, 0x159253fb, 0x15a03c7a, 0x17961ff9,
+	0x1791e07b, 0x15a4dda5, 0x15b2bc22, 0x17851c8e, 0x1780d96f, 0x15b759f5, 0x15c52e67, 0x17740aa1,
+	0x176fc3e3, 0x15c9c8e0, 0x15d7933f, 0x1762ea3d, 0x175e9fe2, 0x15dc2a5a, 0x15e9ea9d, 0x1751bb6b,
+	0x174d6d77, 0x15ee7e58, 0x15fc3477, 0x17407e37, 0x173c2cac, 0x1600c4cf, 0x160e70c1, 0x172f32ab,
+	0x172add8c, 0x1612fdb3, 0x16209f70, 0x171dd8d2, 0x17198021, 0x162528fa, 0x1632c078, 0x170c70b7,
+	0x17081477, 0x16374697, 0x1644d3d0, 0x16fafa64, 0x16f69a97, 0x16495680, 0x1656d96a, 0x16e975e4,
+	0x16e5128e, 0x165b58aa, 0x1668d13e, 0x16d7e341, 0x16d37c65, 0x166d4d0a, 0x167abb3e, 0x16c64288,
 	0x16c1d827, 0x167f3394, 0x168c9760, 0x16b493c2, 0x16b025e0, 0x16910c3d, 0x169e659a, 0x16a2d6fb
 };
 
 const int twidTab512[8*6 + 32*6 + 128*6] = {
-	0x20000000, 0x00000000, 0x1d906bcf, 0x0c3ef153, 0x16a09e66, 0x16a09e66, 0x0c3ef153, 0x1d906bcf, 
-	0x20000000, 0x00000000, 0x1f6297d0, 0x063e2e0f, 0x1d906bcf, 0x0c3ef153, 0x1a9b6629, 0x11c73b3a, 
-	0x20000000, 0x00000000, 0x1a9b6629, 0x11c73b3a, 0x0c3ef153, 0x1d906bcf, 0xf9c1d1f1, 0x1f6297d0, 
-	0x00000000, 0x20000000, 0xf3c10ead, 0x1d906bcf, 0xe95f619a, 0x16a09e66, 0xe26f9431, 0x0c3ef153, 
-	0x16a09e66, 0x16a09e66, 0x11c73b3a, 0x1a9b6629, 0x0c3ef153, 0x1d906bcf, 0x063e2e0f, 0x1f6297d0, 
-	0xe95f619a, 0x16a09e66, 0xe09d6830, 0x063e2e0f, 0xe26f9431, 0xf3c10ead, 0xee38c4c6, 0xe56499d7, 
+	0x20000000, 0x00000000, 0x1d906bcf, 0x0c3ef153, 0x16a09e66, 0x16a09e66, 0x0c3ef153, 0x1d906bcf,
+	0x20000000, 0x00000000, 0x1f6297d0, 0x063e2e0f, 0x1d906bcf, 0x0c3ef153, 0x1a9b6629, 0x11c73b3a,
+	0x20000000, 0x00000000, 0x1a9b6629, 0x11c73b3a, 0x0c3ef153, 0x1d906bcf, 0xf9c1d1f1, 0x1f6297d0,
+	0x00000000, 0x20000000, 0xf3c10ead, 0x1d906bcf, 0xe95f619a, 0x16a09e66, 0xe26f9431, 0x0c3ef153,
+	0x16a09e66, 0x16a09e66, 0x11c73b3a, 0x1a9b6629, 0x0c3ef153, 0x1d906bcf, 0x063e2e0f, 0x1f6297d0,
+	0xe95f619a, 0x16a09e66, 0xe09d6830, 0x063e2e0f, 0xe26f9431, 0xf3c10ead, 0xee38c4c6, 0xe56499d7,
 
-	0x20000000, 0x00000000, 0x1fd88da4, 0x0322f4d8, 0x1f6297d0, 0x063e2e0f, 0x1e9f4157, 0x094a0317, 
-	0x20000000, 0x00000000, 0x1ff621e3, 0x0191f65f, 0x1fd88da4, 0x0322f4d8, 0x1fa7557f, 0x04b2041c, 
-	0x20000000, 0x00000000, 0x1fa7557f, 0x04b2041c, 0x1e9f4157, 0x094a0317, 0x1ced7af4, 0x0dae8805, 
-	0x1d906bcf, 0x0c3ef153, 0x1c38b2f2, 0x0f15ae9c, 0x1a9b6629, 0x11c73b3a, 0x18bc806b, 0x144cf325, 
-	0x1f6297d0, 0x063e2e0f, 0x1f0a7efc, 0x07c67e5f, 0x1e9f4157, 0x094a0317, 0x1e212105, 0x0ac7cd3b, 
-	0x1a9b6629, 0x11c73b3a, 0x17b5df22, 0x157d6935, 0x144cf325, 0x18bc806b, 0x10738799, 0x1b728345, 
-	0x16a09e66, 0x16a09e66, 0x144cf325, 0x18bc806b, 0x11c73b3a, 0x1a9b6629, 0x0f15ae9c, 0x1c38b2f2, 
-	0x1d906bcf, 0x0c3ef153, 0x1ced7af4, 0x0dae8805, 0x1c38b2f2, 0x0f15ae9c, 0x1b728345, 0x10738799, 
-	0x0c3ef153, 0x1d906bcf, 0x07c67e5f, 0x1f0a7efc, 0x0322f4d8, 0x1fd88da4, 0xfe6e09a1, 0x1ff621e3, 
-	0x0c3ef153, 0x1d906bcf, 0x094a0317, 0x1e9f4157, 0x063e2e0f, 0x1f6297d0, 0x0322f4d8, 0x1fd88da4, 
-	0x1a9b6629, 0x11c73b3a, 0x19b3e048, 0x130ff7fd, 0x18bc806b, 0x144cf325, 0x17b5df22, 0x157d6935, 
-	0xf9c1d1f1, 0x1f6297d0, 0xf53832c5, 0x1e212105, 0xf0ea5164, 0x1c38b2f2, 0xecf00803, 0x19b3e048, 
-	0x00000000, 0x20000000, 0xfcdd0b28, 0x1fd88da4, 0xf9c1d1f1, 0x1f6297d0, 0xf6b5fce9, 0x1e9f4157, 
-	0x16a09e66, 0x16a09e66, 0x157d6935, 0x17b5df22, 0x144cf325, 0x18bc806b, 0x130ff7fd, 0x19b3e048, 
-	0xe95f619a, 0x16a09e66, 0xe64c1fb8, 0x130ff7fd, 0xe3c74d0e, 0x0f15ae9c, 0xe1dedefb, 0x0ac7cd3b, 
-	0xf3c10ead, 0x1d906bcf, 0xf0ea5164, 0x1c38b2f2, 0xee38c4c6, 0x1a9b6629, 0xebb30cdb, 0x18bc806b, 
-	0x11c73b3a, 0x1a9b6629, 0x10738799, 0x1b728345, 0x0f15ae9c, 0x1c38b2f2, 0x0dae8805, 0x1ced7af4, 
-	0xe09d6830, 0x063e2e0f, 0xe009de1d, 0x0191f65f, 0xe027725c, 0xfcdd0b28, 0xe0f58104, 0xf83981a1, 
-	0xe95f619a, 0x16a09e66, 0xe7437f95, 0x144cf325, 0xe56499d7, 0x11c73b3a, 0xe3c74d0e, 0x0f15ae9c, 
-	0x0c3ef153, 0x1d906bcf, 0x0ac7cd3b, 0x1e212105, 0x094a0317, 0x1e9f4157, 0x07c67e5f, 0x1f0a7efc, 
-	0xe26f9431, 0xf3c10ead, 0xe48d7cbb, 0xef8c7867, 0xe7437f95, 0xebb30cdb, 0xea8296cb, 0xe84a20de, 
-	0xe26f9431, 0x0c3ef153, 0xe160bea9, 0x094a0317, 0xe09d6830, 0x063e2e0f, 0xe027725c, 0x0322f4d8, 
-	0x063e2e0f, 0x1f6297d0, 0x04b2041c, 0x1fa7557f, 0x0322f4d8, 0x1fd88da4, 0x0191f65f, 0x1ff621e3, 
-	0xee38c4c6, 0xe56499d7, 0xf25177fb, 0xe312850c, 0xf6b5fce9, 0xe160bea9, 0xfb4dfbe4, 0xe058aa81, 
+	0x20000000, 0x00000000, 0x1fd88da4, 0x0322f4d8, 0x1f6297d0, 0x063e2e0f, 0x1e9f4157, 0x094a0317,
+	0x20000000, 0x00000000, 0x1ff621e3, 0x0191f65f, 0x1fd88da4, 0x0322f4d8, 0x1fa7557f, 0x04b2041c,
+	0x20000000, 0x00000000, 0x1fa7557f, 0x04b2041c, 0x1e9f4157, 0x094a0317, 0x1ced7af4, 0x0dae8805,
+	0x1d906bcf, 0x0c3ef153, 0x1c38b2f2, 0x0f15ae9c, 0x1a9b6629, 0x11c73b3a, 0x18bc806b, 0x144cf325,
+	0x1f6297d0, 0x063e2e0f, 0x1f0a7efc, 0x07c67e5f, 0x1e9f4157, 0x094a0317, 0x1e212105, 0x0ac7cd3b,
+	0x1a9b6629, 0x11c73b3a, 0x17b5df22, 0x157d6935, 0x144cf325, 0x18bc806b, 0x10738799, 0x1b728345,
+	0x16a09e66, 0x16a09e66, 0x144cf325, 0x18bc806b, 0x11c73b3a, 0x1a9b6629, 0x0f15ae9c, 0x1c38b2f2,
+	0x1d906bcf, 0x0c3ef153, 0x1ced7af4, 0x0dae8805, 0x1c38b2f2, 0x0f15ae9c, 0x1b728345, 0x10738799,
+	0x0c3ef153, 0x1d906bcf, 0x07c67e5f, 0x1f0a7efc, 0x0322f4d8, 0x1fd88da4, 0xfe6e09a1, 0x1ff621e3,
+	0x0c3ef153, 0x1d906bcf, 0x094a0317, 0x1e9f4157, 0x063e2e0f, 0x1f6297d0, 0x0322f4d8, 0x1fd88da4,
+	0x1a9b6629, 0x11c73b3a, 0x19b3e048, 0x130ff7fd, 0x18bc806b, 0x144cf325, 0x17b5df22, 0x157d6935,
+	0xf9c1d1f1, 0x1f6297d0, 0xf53832c5, 0x1e212105, 0xf0ea5164, 0x1c38b2f2, 0xecf00803, 0x19b3e048,
+	0x00000000, 0x20000000, 0xfcdd0b28, 0x1fd88da4, 0xf9c1d1f1, 0x1f6297d0, 0xf6b5fce9, 0x1e9f4157,
+	0x16a09e66, 0x16a09e66, 0x157d6935, 0x17b5df22, 0x144cf325, 0x18bc806b, 0x130ff7fd, 0x19b3e048,
+	0xe95f619a, 0x16a09e66, 0xe64c1fb8, 0x130ff7fd, 0xe3c74d0e, 0x0f15ae9c, 0xe1dedefb, 0x0ac7cd3b,
+	0xf3c10ead, 0x1d906bcf, 0xf0ea5164, 0x1c38b2f2, 0xee38c4c6, 0x1a9b6629, 0xebb30cdb, 0x18bc806b,
+	0x11c73b3a, 0x1a9b6629, 0x10738799, 0x1b728345, 0x0f15ae9c, 0x1c38b2f2, 0x0dae8805, 0x1ced7af4,
+	0xe09d6830, 0x063e2e0f, 0xe009de1d, 0x0191f65f, 0xe027725c, 0xfcdd0b28, 0xe0f58104, 0xf83981a1,
+	0xe95f619a, 0x16a09e66, 0xe7437f95, 0x144cf325, 0xe56499d7, 0x11c73b3a, 0xe3c74d0e, 0x0f15ae9c,
+	0x0c3ef153, 0x1d906bcf, 0x0ac7cd3b, 0x1e212105, 0x094a0317, 0x1e9f4157, 0x07c67e5f, 0x1f0a7efc,
+	0xe26f9431, 0xf3c10ead, 0xe48d7cbb, 0xef8c7867, 0xe7437f95, 0xebb30cdb, 0xea8296cb, 0xe84a20de,
+	0xe26f9431, 0x0c3ef153, 0xe160bea9, 0x094a0317, 0xe09d6830, 0x063e2e0f, 0xe027725c, 0x0322f4d8,
+	0x063e2e0f, 0x1f6297d0, 0x04b2041c, 0x1fa7557f, 0x0322f4d8, 0x1fd88da4, 0x0191f65f, 0x1ff621e3,
+	0xee38c4c6, 0xe56499d7, 0xf25177fb, 0xe312850c, 0xf6b5fce9, 0xe160bea9, 0xfb4dfbe4, 0xe058aa81,
 
-	0x20000000, 0x00000000, 0x1ffd8861, 0x00c90ab0, 0x1ff621e3, 0x0191f65f, 0x1fe9cdad, 0x025aa412, 
-	0x20000000, 0x00000000, 0x1fff6217, 0x00648748, 0x1ffd8861, 0x00c90ab0, 0x1ffa72f0, 0x012d8657, 
-	0x20000000, 0x00000000, 0x1ffa72f0, 0x012d8657, 0x1fe9cdad, 0x025aa412, 0x1fce15fd, 0x0386f0b9, 
-	0x1fd88da4, 0x0322f4d8, 0x1fc26471, 0x03eac9cb, 0x1fa7557f, 0x04b2041c, 0x1f8764fa, 0x05788511, 
-	0x1ff621e3, 0x0191f65f, 0x1ff09566, 0x01f656e8, 0x1fe9cdad, 0x025aa412, 0x1fe1cafd, 0x02beda01, 
-	0x1fa7557f, 0x04b2041c, 0x1f7599a4, 0x05db7678, 0x1f38f3ac, 0x0702e09b, 0x1ef178a4, 0x0827dc07, 
-	0x1f6297d0, 0x063e2e0f, 0x1f38f3ac, 0x0702e09b, 0x1f0a7efc, 0x07c67e5f, 0x1ed740e7, 0x0888e931, 
-	0x1fd88da4, 0x0322f4d8, 0x1fce15fd, 0x0386f0b9, 0x1fc26471, 0x03eac9cb, 0x1fb57972, 0x044e7c34, 
-	0x1e9f4157, 0x094a0317, 0x1e426a4b, 0x0a68f121, 0x1ddb13b7, 0x0b844298, 0x1d696174, 0x0c9b9532, 
-	0x1e9f4157, 0x094a0317, 0x1e6288ec, 0x0a09ae4a, 0x1e212105, 0x0ac7cd3b, 0x1ddb13b7, 0x0b844298, 
-	0x1fa7557f, 0x04b2041c, 0x1f97f925, 0x05155dac, 0x1f8764fa, 0x05788511, 0x1f7599a4, 0x05db7678, 
-	0x1ced7af4, 0x0dae8805, 0x1c678b35, 0x0ebcbbae, 0x1bd7c0ac, 0x0fc5d26e, 0x1b3e4d3f, 0x10c9704d, 
-	0x1d906bcf, 0x0c3ef153, 0x1d4134d1, 0x0cf7bca2, 0x1ced7af4, 0x0dae8805, 0x1c954b21, 0x0e63374d, 
-	0x1f6297d0, 0x063e2e0f, 0x1f4e603b, 0x06a0a809, 0x1f38f3ac, 0x0702e09b, 0x1f2252f7, 0x0764d3f9, 
-	0x1a9b6629, 0x11c73b3a, 0x19ef43ef, 0x12bedb26, 0x193a224a, 0x13affa29, 0x187c4010, 0x149a449c, 
-	0x1c38b2f2, 0x0f15ae9c, 0x1bd7c0ac, 0x0fc5d26e, 0x1b728345, 0x10738799, 0x1b090a58, 0x111eb354, 
-	0x1f0a7efc, 0x07c67e5f, 0x1ef178a4, 0x0827dc07, 0x1ed740e7, 0x0888e931, 0x1ebbd8c9, 0x08e9a220, 
-	0x17b5df22, 0x157d6935, 0x16e74455, 0x16591926, 0x1610b755, 0x172d0838, 0x15328293, 0x17f8ece3, 
-	0x1a9b6629, 0x11c73b3a, 0x1a29a7a0, 0x126d054d, 0x19b3e048, 0x130ff7fd, 0x193a224a, 0x13affa29, 
-	0x1e9f4157, 0x094a0317, 0x1e817bab, 0x09aa0861, 0x1e6288ec, 0x0a09ae4a, 0x1e426a4b, 0x0a68f121, 
-	0x144cf325, 0x18bc806b, 0x136058b1, 0x19777ef5, 0x126d054d, 0x1a29a7a0, 0x11734d64, 0x1ad2bc9e, 
-	0x18bc806b, 0x144cf325, 0x183b0e0c, 0x14e6cabc, 0x17b5df22, 0x157d6935, 0x172d0838, 0x1610b755, 
-	0x1e212105, 0x0ac7cd3b, 0x1dfeae62, 0x0b263eef, 0x1ddb13b7, 0x0b844298, 0x1db65262, 0x0be1d499, 
-	0x10738799, 0x1b728345, 0x0f6e0ca9, 0x1c08c426, 0x0e63374d, 0x1c954b21, 0x0d536416, 0x1d17e774, 
-	0x16a09e66, 0x16a09e66, 0x1610b755, 0x172d0838, 0x157d6935, 0x17b5df22, 0x14e6cabc, 0x183b0e0c, 
-	0x1d906bcf, 0x0c3ef153, 0x1d696174, 0x0c9b9532, 0x1d4134d1, 0x0cf7bca2, 0x1d17e774, 0x0d536416, 
-	0x0c3ef153, 0x1d906bcf, 0x0b263eef, 0x1dfeae62, 0x0a09ae4a, 0x1e6288ec, 0x08e9a220, 0x1ebbd8c9, 
-	0x144cf325, 0x18bc806b, 0x13affa29, 0x193a224a, 0x130ff7fd, 0x19b3e048, 0x126d054d, 0x1a29a7a0, 
-	0x1ced7af4, 0x0dae8805, 0x1cc1f0f4, 0x0e0924ec, 0x1c954b21, 0x0e63374d, 0x1c678b35, 0x0ebcbbae, 
-	0x07c67e5f, 0x1f0a7efc, 0x06a0a809, 0x1f4e603b, 0x05788511, 0x1f8764fa, 0x044e7c34, 0x1fb57972, 
-	0x11c73b3a, 0x1a9b6629, 0x111eb354, 0x1b090a58, 0x10738799, 0x1b728345, 0x0fc5d26e, 0x1bd7c0ac, 
-	0x1c38b2f2, 0x0f15ae9c, 0x1c08c426, 0x0f6e0ca9, 0x1bd7c0ac, 0x0fc5d26e, 0x1ba5aa67, 0x101cfc87, 
-	0x0322f4d8, 0x1fd88da4, 0x01f656e8, 0x1ff09566, 0x00c90ab0, 0x1ffd8861, 0xff9b78b8, 0x1fff6217, 
-	0x0f15ae9c, 0x1c38b2f2, 0x0e63374d, 0x1c954b21, 0x0dae8805, 0x1ced7af4, 0x0cf7bca2, 0x1d4134d1, 
-	0x1b728345, 0x10738799, 0x1b3e4d3f, 0x10c9704d, 0x1b090a58, 0x111eb354, 0x1ad2bc9e, 0x11734d64, 
-	0xfe6e09a1, 0x1ff621e3, 0xfd4125ff, 0x1fe1cafd, 0xfc153635, 0x1fc26471, 0xfaeaa254, 0x1f97f925, 
-	0x0c3ef153, 0x1d906bcf, 0x0b844298, 0x1ddb13b7, 0x0ac7cd3b, 0x1e212105, 0x0a09ae4a, 0x1e6288ec, 
-	0x1a9b6629, 0x11c73b3a, 0x1a63091b, 0x121a7999, 0x1a29a7a0, 0x126d054d, 0x19ef43ef, 0x12bedb26, 
-	0xf9c1d1f1, 0x1f6297d0, 0xf89b2c07, 0x1f2252f7, 0xf77716cf, 0x1ed740e7, 0xf655f79f, 0x1e817bab, 
-	0x094a0317, 0x1e9f4157, 0x0888e931, 0x1ed740e7, 0x07c67e5f, 0x1f0a7efc, 0x0702e09b, 0x1f38f3ac, 
-	0x19b3e048, 0x130ff7fd, 0x19777ef5, 0x136058b1, 0x193a224a, 0x13affa29, 0x18fbcca4, 0x13fed953, 
-	0xf53832c5, 0x1e212105, 0xf41e2b67, 0x1db65262, 0xf308435e, 0x1d4134d1, 0xf1f6db14, 0x1cc1f0f4, 
-	0x063e2e0f, 0x1f6297d0, 0x05788511, 0x1f8764fa, 0x04b2041c, 0x1fa7557f, 0x03eac9cb, 0x1fc26471, 
-	0x18bc806b, 0x144cf325, 0x187c4010, 0x149a449c, 0x183b0e0c, 0x14e6cabc, 0x17f8ece3, 0x15328293, 
-	0xf0ea5164, 0x1c38b2f2, 0xefe30379, 0x1ba5aa67, 0xeee14cac, 0x1b090a58, 0xede58667, 0x1a63091b, 
-	0x0322f4d8, 0x1fd88da4, 0x025aa412, 0x1fe9cdad, 0x0191f65f, 0x1ff621e3, 0x00c90ab0, 0x1ffd8861, 
-	0x17b5df22, 0x157d6935, 0x1771e75f, 0x15c77bbe, 0x172d0838, 0x1610b755, 0x16e74455, 0x16591926, 
-	0xecf00803, 0x19b3e048, 0xec0126ad, 0x18fbcca4, 0xeb193544, 0x183b0e0c, 0xea388442, 0x1771e75f, 
-	0x00000000, 0x20000000, 0xff36f550, 0x1ffd8861, 0xfe6e09a1, 0x1ff621e3, 0xfda55bee, 0x1fe9cdad, 
-	0x16a09e66, 0x16a09e66, 0x16591926, 0x16e74455, 0x1610b755, 0x172d0838, 0x15c77bbe, 0x1771e75f, 
-	0xe95f619a, 0x16a09e66, 0xe88e18a1, 0x15c77bbe, 0xe7c4f1f4, 0x14e6cabc, 0xe704335c, 0x13fed953, 
-	0xfcdd0b28, 0x1fd88da4, 0xfc153635, 0x1fc26471, 0xfb4dfbe4, 0x1fa7557f, 0xfa877aef, 0x1f8764fa, 
-	0x157d6935, 0x17b5df22, 0x15328293, 0x17f8ece3, 0x14e6cabc, 0x183b0e0c, 0x149a449c, 0x187c4010, 
-	0xe64c1fb8, 0x130ff7fd, 0xe59cf6e5, 0x121a7999, 0xe4f6f5a8, 0x111eb354, 0xe45a5599, 0x101cfc87, 
-	0xf9c1d1f1, 0x1f6297d0, 0xf8fd1f65, 0x1f38f3ac, 0xf83981a1, 0x1f0a7efc, 0xf77716cf, 0x1ed740e7, 
-	0x144cf325, 0x18bc806b, 0x13fed953, 0x18fbcca4, 0x13affa29, 0x193a224a, 0x136058b1, 0x19777ef5, 
-	0xe3c74d0e, 0x0f15ae9c, 0xe33e0f0c, 0x0e0924ec, 0xe2becb2f, 0x0cf7bca2, 0xe249ad9e, 0x0be1d499, 
-	0xf6b5fce9, 0x1e9f4157, 0xf5f651b6, 0x1e6288ec, 0xf53832c5, 0x1e212105, 0xf47bbd68, 0x1ddb13b7, 
-	0x130ff7fd, 0x19b3e048, 0x12bedb26, 0x19ef43ef, 0x126d054d, 0x1a29a7a0, 0x121a7999, 0x1a63091b, 
-	0xe1dedefb, 0x0ac7cd3b, 0xe17e8455, 0x09aa0861, 0xe128bf19, 0x0888e931, 0xe0ddad09, 0x0764d3f9, 
-	0xf3c10ead, 0x1d906bcf, 0xf308435e, 0x1d4134d1, 0xf25177fb, 0x1ced7af4, 0xf19cc8b3, 0x1c954b21, 
-	0x11c73b3a, 0x1a9b6629, 0x11734d64, 0x1ad2bc9e, 0x111eb354, 0x1b090a58, 0x10c9704d, 0x1b3e4d3f, 
-	0xe09d6830, 0x063e2e0f, 0xe06806db, 0x05155dac, 0xe03d9b8f, 0x03eac9cb, 0xe01e3503, 0x02beda01, 
-	0xf0ea5164, 0x1c38b2f2, 0xf03a2d92, 0x1bd7c0ac, 0xef8c7867, 0x1b728345, 0xeee14cac, 0x1b090a58, 
-	0x10738799, 0x1b728345, 0x101cfc87, 0x1ba5aa67, 0x0fc5d26e, 0x1bd7c0ac, 0x0f6e0ca9, 0x1c08c426, 
-	0xe009de1d, 0x0191f65f, 0xe0009de9, 0x00648748, 0xe002779f, 0xff36f550, 0xe00f6a9a, 0xfe09a918, 
-	0xee38c4c6, 0x1a9b6629, 0xed92fab3, 0x1a29a7a0, 0xecf00803, 0x19b3e048, 0xec5005d7, 0x193a224a, 
-	0x0f15ae9c, 0x1c38b2f2, 0x0ebcbbae, 0x1c678b35, 0x0e63374d, 0x1c954b21, 0x0e0924ec, 0x1cc1f0f4, 
-	0xe027725c, 0xfcdd0b28, 0xe04a868e, 0xfbb183cc, 0xe0789b06, 0xfa877aef, 0xe0b19fc5, 0xf95f57f7, 
-	0xebb30cdb, 0x18bc806b, 0xeb193544, 0x183b0e0c, 0xea8296cb, 0x17b5df22, 0xe9ef48ab, 0x172d0838, 
-	0x0dae8805, 0x1ced7af4, 0x0d536416, 0x1d17e774, 0x0cf7bca2, 0x1d4134d1, 0x0c9b9532, 0x1d696174, 
-	0xe0f58104, 0xf83981a1, 0xe1442737, 0xf7165de0, 0xe19d7714, 0xf5f651b6, 0xe201519e, 0xf4d9c111, 
-	0xe95f619a, 0x16a09e66, 0xe8d2f7c8, 0x1610b755, 0xe84a20de, 0x157d6935, 0xe7c4f1f4, 0x14e6cabc, 
-	0x0c3ef153, 0x1d906bcf, 0x0be1d499, 0x1db65262, 0x0b844298, 0x1ddb13b7, 0x0b263eef, 0x1dfeae62, 
-	0xe26f9431, 0xf3c10ead, 0xe2e8188c, 0xf2ac9bea, 0xe36ab4df, 0xf19cc8b3, 0xe3f73bda, 0xf091f357, 
-	0xe7437f95, 0x144cf325, 0xe6c5ddb6, 0x13affa29, 0xe64c1fb8, 0x130ff7fd, 0xe5d65860, 0x126d054d, 
-	0x0ac7cd3b, 0x1e212105, 0x0a68f121, 0x1e426a4b, 0x0a09ae4a, 0x1e6288ec, 0x09aa0861, 0x1e817bab, 
-	0xe48d7cbb, 0xef8c7867, 0xe52d4362, 0xee8cb29c, 0xe5d65860, 0xed92fab3, 0xe688810b, 0xec9fa74f, 
-	0xe56499d7, 0x11c73b3a, 0xe4f6f5a8, 0x111eb354, 0xe48d7cbb, 0x10738799, 0xe4283f54, 0x0fc5d26e, 
-	0x094a0317, 0x1e9f4157, 0x08e9a220, 0x1ebbd8c9, 0x0888e931, 0x1ed740e7, 0x0827dc07, 0x1ef178a4, 
-	0xe7437f95, 0xebb30cdb, 0xe807131d, 0xeacd7d6d, 0xe8d2f7c8, 0xe9ef48ab, 0xe9a6e6da, 0xe918bbab, 
-	0xe3c74d0e, 0x0f15ae9c, 0xe36ab4df, 0x0e63374d, 0xe312850c, 0x0dae8805, 0xe2becb2f, 0x0cf7bca2, 
-	0x07c67e5f, 0x1f0a7efc, 0x0764d3f9, 0x1f2252f7, 0x0702e09b, 0x1f38f3ac, 0x06a0a809, 0x1f4e603b, 
-	0xea8296cb, 0xe84a20de, 0xeb65bb64, 0xe783bff0, 0xec5005d7, 0xe6c5ddb6, 0xed4124da, 0xe610bc11, 
-	0xe26f9431, 0x0c3ef153, 0xe224ec49, 0x0b844298, 0xe1dedefb, 0x0ac7cd3b, 0xe19d7714, 0x0a09ae4a, 
-	0x063e2e0f, 0x1f6297d0, 0x05db7678, 0x1f7599a4, 0x05788511, 0x1f8764fa, 0x05155dac, 0x1f97f925, 
-	0xee38c4c6, 0xe56499d7, 0xef368fb3, 0xe4c1b2c1, 0xf03a2d92, 0xe4283f54, 0xf1434452, 0xe39874cb, 
-	0xe160bea9, 0x094a0317, 0xe128bf19, 0x0888e931, 0xe0f58104, 0x07c67e5f, 0xe0c70c54, 0x0702e09b, 
-	0x04b2041c, 0x1fa7557f, 0x044e7c34, 0x1fb57972, 0x03eac9cb, 0x1fc26471, 0x0386f0b9, 0x1fce15fd, 
-	0xf25177fb, 0xe312850c, 0xf3646ace, 0xe2969e8c, 0xf47bbd68, 0xe224ec49, 0xf5970edf, 0xe1bd95b5, 
-	0xe09d6830, 0x063e2e0f, 0xe0789b06, 0x05788511, 0xe058aa81, 0x04b2041c, 0xe03d9b8f, 0x03eac9cb, 
-	0x0322f4d8, 0x1fd88da4, 0x02beda01, 0x1fe1cafd, 0x025aa412, 0x1fe9cdad, 0x01f656e8, 0x1ff09566, 
-	0xf6b5fce9, 0xe160bea9, 0xf7d823f9, 0xe10e875c, 0xf8fd1f65, 0xe0c70c54, 0xfa248988, 0xe08a665c, 
-	0xe027725c, 0x0322f4d8, 0xe0163253, 0x025aa412, 0xe009de1d, 0x0191f65f, 0xe002779f, 0x00c90ab0, 
-	0x0191f65f, 0x1ff621e3, 0x012d8657, 0x1ffa72f0, 0x00c90ab0, 0x1ffd8861, 0x00648748, 0x1fff6217, 
+	0x20000000, 0x00000000, 0x1ffd8861, 0x00c90ab0, 0x1ff621e3, 0x0191f65f, 0x1fe9cdad, 0x025aa412,
+	0x20000000, 0x00000000, 0x1fff6217, 0x00648748, 0x1ffd8861, 0x00c90ab0, 0x1ffa72f0, 0x012d8657,
+	0x20000000, 0x00000000, 0x1ffa72f0, 0x012d8657, 0x1fe9cdad, 0x025aa412, 0x1fce15fd, 0x0386f0b9,
+	0x1fd88da4, 0x0322f4d8, 0x1fc26471, 0x03eac9cb, 0x1fa7557f, 0x04b2041c, 0x1f8764fa, 0x05788511,
+	0x1ff621e3, 0x0191f65f, 0x1ff09566, 0x01f656e8, 0x1fe9cdad, 0x025aa412, 0x1fe1cafd, 0x02beda01,
+	0x1fa7557f, 0x04b2041c, 0x1f7599a4, 0x05db7678, 0x1f38f3ac, 0x0702e09b, 0x1ef178a4, 0x0827dc07,
+	0x1f6297d0, 0x063e2e0f, 0x1f38f3ac, 0x0702e09b, 0x1f0a7efc, 0x07c67e5f, 0x1ed740e7, 0x0888e931,
+	0x1fd88da4, 0x0322f4d8, 0x1fce15fd, 0x0386f0b9, 0x1fc26471, 0x03eac9cb, 0x1fb57972, 0x044e7c34,
+	0x1e9f4157, 0x094a0317, 0x1e426a4b, 0x0a68f121, 0x1ddb13b7, 0x0b844298, 0x1d696174, 0x0c9b9532,
+	0x1e9f4157, 0x094a0317, 0x1e6288ec, 0x0a09ae4a, 0x1e212105, 0x0ac7cd3b, 0x1ddb13b7, 0x0b844298,
+	0x1fa7557f, 0x04b2041c, 0x1f97f925, 0x05155dac, 0x1f8764fa, 0x05788511, 0x1f7599a4, 0x05db7678,
+	0x1ced7af4, 0x0dae8805, 0x1c678b35, 0x0ebcbbae, 0x1bd7c0ac, 0x0fc5d26e, 0x1b3e4d3f, 0x10c9704d,
+	0x1d906bcf, 0x0c3ef153, 0x1d4134d1, 0x0cf7bca2, 0x1ced7af4, 0x0dae8805, 0x1c954b21, 0x0e63374d,
+	0x1f6297d0, 0x063e2e0f, 0x1f4e603b, 0x06a0a809, 0x1f38f3ac, 0x0702e09b, 0x1f2252f7, 0x0764d3f9,
+	0x1a9b6629, 0x11c73b3a, 0x19ef43ef, 0x12bedb26, 0x193a224a, 0x13affa29, 0x187c4010, 0x149a449c,
+	0x1c38b2f2, 0x0f15ae9c, 0x1bd7c0ac, 0x0fc5d26e, 0x1b728345, 0x10738799, 0x1b090a58, 0x111eb354,
+	0x1f0a7efc, 0x07c67e5f, 0x1ef178a4, 0x0827dc07, 0x1ed740e7, 0x0888e931, 0x1ebbd8c9, 0x08e9a220,
+	0x17b5df22, 0x157d6935, 0x16e74455, 0x16591926, 0x1610b755, 0x172d0838, 0x15328293, 0x17f8ece3,
+	0x1a9b6629, 0x11c73b3a, 0x1a29a7a0, 0x126d054d, 0x19b3e048, 0x130ff7fd, 0x193a224a, 0x13affa29,
+	0x1e9f4157, 0x094a0317, 0x1e817bab, 0x09aa0861, 0x1e6288ec, 0x0a09ae4a, 0x1e426a4b, 0x0a68f121,
+	0x144cf325, 0x18bc806b, 0x136058b1, 0x19777ef5, 0x126d054d, 0x1a29a7a0, 0x11734d64, 0x1ad2bc9e,
+	0x18bc806b, 0x144cf325, 0x183b0e0c, 0x14e6cabc, 0x17b5df22, 0x157d6935, 0x172d0838, 0x1610b755,
+	0x1e212105, 0x0ac7cd3b, 0x1dfeae62, 0x0b263eef, 0x1ddb13b7, 0x0b844298, 0x1db65262, 0x0be1d499,
+	0x10738799, 0x1b728345, 0x0f6e0ca9, 0x1c08c426, 0x0e63374d, 0x1c954b21, 0x0d536416, 0x1d17e774,
+	0x16a09e66, 0x16a09e66, 0x1610b755, 0x172d0838, 0x157d6935, 0x17b5df22, 0x14e6cabc, 0x183b0e0c,
+	0x1d906bcf, 0x0c3ef153, 0x1d696174, 0x0c9b9532, 0x1d4134d1, 0x0cf7bca2, 0x1d17e774, 0x0d536416,
+	0x0c3ef153, 0x1d906bcf, 0x0b263eef, 0x1dfeae62, 0x0a09ae4a, 0x1e6288ec, 0x08e9a220, 0x1ebbd8c9,
+	0x144cf325, 0x18bc806b, 0x13affa29, 0x193a224a, 0x130ff7fd, 0x19b3e048, 0x126d054d, 0x1a29a7a0,
+	0x1ced7af4, 0x0dae8805, 0x1cc1f0f4, 0x0e0924ec, 0x1c954b21, 0x0e63374d, 0x1c678b35, 0x0ebcbbae,
+	0x07c67e5f, 0x1f0a7efc, 0x06a0a809, 0x1f4e603b, 0x05788511, 0x1f8764fa, 0x044e7c34, 0x1fb57972,
+	0x11c73b3a, 0x1a9b6629, 0x111eb354, 0x1b090a58, 0x10738799, 0x1b728345, 0x0fc5d26e, 0x1bd7c0ac,
+	0x1c38b2f2, 0x0f15ae9c, 0x1c08c426, 0x0f6e0ca9, 0x1bd7c0ac, 0x0fc5d26e, 0x1ba5aa67, 0x101cfc87,
+	0x0322f4d8, 0x1fd88da4, 0x01f656e8, 0x1ff09566, 0x00c90ab0, 0x1ffd8861, 0xff9b78b8, 0x1fff6217,
+	0x0f15ae9c, 0x1c38b2f2, 0x0e63374d, 0x1c954b21, 0x0dae8805, 0x1ced7af4, 0x0cf7bca2, 0x1d4134d1,
+	0x1b728345, 0x10738799, 0x1b3e4d3f, 0x10c9704d, 0x1b090a58, 0x111eb354, 0x1ad2bc9e, 0x11734d64,
+	0xfe6e09a1, 0x1ff621e3, 0xfd4125ff, 0x1fe1cafd, 0xfc153635, 0x1fc26471, 0xfaeaa254, 0x1f97f925,
+	0x0c3ef153, 0x1d906bcf, 0x0b844298, 0x1ddb13b7, 0x0ac7cd3b, 0x1e212105, 0x0a09ae4a, 0x1e6288ec,
+	0x1a9b6629, 0x11c73b3a, 0x1a63091b, 0x121a7999, 0x1a29a7a0, 0x126d054d, 0x19ef43ef, 0x12bedb26,
+	0xf9c1d1f1, 0x1f6297d0, 0xf89b2c07, 0x1f2252f7, 0xf77716cf, 0x1ed740e7, 0xf655f79f, 0x1e817bab,
+	0x094a0317, 0x1e9f4157, 0x0888e931, 0x1ed740e7, 0x07c67e5f, 0x1f0a7efc, 0x0702e09b, 0x1f38f3ac,
+	0x19b3e048, 0x130ff7fd, 0x19777ef5, 0x136058b1, 0x193a224a, 0x13affa29, 0x18fbcca4, 0x13fed953,
+	0xf53832c5, 0x1e212105, 0xf41e2b67, 0x1db65262, 0xf308435e, 0x1d4134d1, 0xf1f6db14, 0x1cc1f0f4,
+	0x063e2e0f, 0x1f6297d0, 0x05788511, 0x1f8764fa, 0x04b2041c, 0x1fa7557f, 0x03eac9cb, 0x1fc26471,
+	0x18bc806b, 0x144cf325, 0x187c4010, 0x149a449c, 0x183b0e0c, 0x14e6cabc, 0x17f8ece3, 0x15328293,
+	0xf0ea5164, 0x1c38b2f2, 0xefe30379, 0x1ba5aa67, 0xeee14cac, 0x1b090a58, 0xede58667, 0x1a63091b,
+	0x0322f4d8, 0x1fd88da4, 0x025aa412, 0x1fe9cdad, 0x0191f65f, 0x1ff621e3, 0x00c90ab0, 0x1ffd8861,
+	0x17b5df22, 0x157d6935, 0x1771e75f, 0x15c77bbe, 0x172d0838, 0x1610b755, 0x16e74455, 0x16591926,
+	0xecf00803, 0x19b3e048, 0xec0126ad, 0x18fbcca4, 0xeb193544, 0x183b0e0c, 0xea388442, 0x1771e75f,
+	0x00000000, 0x20000000, 0xff36f550, 0x1ffd8861, 0xfe6e09a1, 0x1ff621e3, 0xfda55bee, 0x1fe9cdad,
+	0x16a09e66, 0x16a09e66, 0x16591926, 0x16e74455, 0x1610b755, 0x172d0838, 0x15c77bbe, 0x1771e75f,
+	0xe95f619a, 0x16a09e66, 0xe88e18a1, 0x15c77bbe, 0xe7c4f1f4, 0x14e6cabc, 0xe704335c, 0x13fed953,
+	0xfcdd0b28, 0x1fd88da4, 0xfc153635, 0x1fc26471, 0xfb4dfbe4, 0x1fa7557f, 0xfa877aef, 0x1f8764fa,
+	0x157d6935, 0x17b5df22, 0x15328293, 0x17f8ece3, 0x14e6cabc, 0x183b0e0c, 0x149a449c, 0x187c4010,
+	0xe64c1fb8, 0x130ff7fd, 0xe59cf6e5, 0x121a7999, 0xe4f6f5a8, 0x111eb354, 0xe45a5599, 0x101cfc87,
+	0xf9c1d1f1, 0x1f6297d0, 0xf8fd1f65, 0x1f38f3ac, 0xf83981a1, 0x1f0a7efc, 0xf77716cf, 0x1ed740e7,
+	0x144cf325, 0x18bc806b, 0x13fed953, 0x18fbcca4, 0x13affa29, 0x193a224a, 0x136058b1, 0x19777ef5,
+	0xe3c74d0e, 0x0f15ae9c, 0xe33e0f0c, 0x0e0924ec, 0xe2becb2f, 0x0cf7bca2, 0xe249ad9e, 0x0be1d499,
+	0xf6b5fce9, 0x1e9f4157, 0xf5f651b6, 0x1e6288ec, 0xf53832c5, 0x1e212105, 0xf47bbd68, 0x1ddb13b7,
+	0x130ff7fd, 0x19b3e048, 0x12bedb26, 0x19ef43ef, 0x126d054d, 0x1a29a7a0, 0x121a7999, 0x1a63091b,
+	0xe1dedefb, 0x0ac7cd3b, 0xe17e8455, 0x09aa0861, 0xe128bf19, 0x0888e931, 0xe0ddad09, 0x0764d3f9,
+	0xf3c10ead, 0x1d906bcf, 0xf308435e, 0x1d4134d1, 0xf25177fb, 0x1ced7af4, 0xf19cc8b3, 0x1c954b21,
+	0x11c73b3a, 0x1a9b6629, 0x11734d64, 0x1ad2bc9e, 0x111eb354, 0x1b090a58, 0x10c9704d, 0x1b3e4d3f,
+	0xe09d6830, 0x063e2e0f, 0xe06806db, 0x05155dac, 0xe03d9b8f, 0x03eac9cb, 0xe01e3503, 0x02beda01,
+	0xf0ea5164, 0x1c38b2f2, 0xf03a2d92, 0x1bd7c0ac, 0xef8c7867, 0x1b728345, 0xeee14cac, 0x1b090a58,
+	0x10738799, 0x1b728345, 0x101cfc87, 0x1ba5aa67, 0x0fc5d26e, 0x1bd7c0ac, 0x0f6e0ca9, 0x1c08c426,
+	0xe009de1d, 0x0191f65f, 0xe0009de9, 0x00648748, 0xe002779f, 0xff36f550, 0xe00f6a9a, 0xfe09a918,
+	0xee38c4c6, 0x1a9b6629, 0xed92fab3, 0x1a29a7a0, 0xecf00803, 0x19b3e048, 0xec5005d7, 0x193a224a,
+	0x0f15ae9c, 0x1c38b2f2, 0x0ebcbbae, 0x1c678b35, 0x0e63374d, 0x1c954b21, 0x0e0924ec, 0x1cc1f0f4,
+	0xe027725c, 0xfcdd0b28, 0xe04a868e, 0xfbb183cc, 0xe0789b06, 0xfa877aef, 0xe0b19fc5, 0xf95f57f7,
+	0xebb30cdb, 0x18bc806b, 0xeb193544, 0x183b0e0c, 0xea8296cb, 0x17b5df22, 0xe9ef48ab, 0x172d0838,
+	0x0dae8805, 0x1ced7af4, 0x0d536416, 0x1d17e774, 0x0cf7bca2, 0x1d4134d1, 0x0c9b9532, 0x1d696174,
+	0xe0f58104, 0xf83981a1, 0xe1442737, 0xf7165de0, 0xe19d7714, 0xf5f651b6, 0xe201519e, 0xf4d9c111,
+	0xe95f619a, 0x16a09e66, 0xe8d2f7c8, 0x1610b755, 0xe84a20de, 0x157d6935, 0xe7c4f1f4, 0x14e6cabc,
+	0x0c3ef153, 0x1d906bcf, 0x0be1d499, 0x1db65262, 0x0b844298, 0x1ddb13b7, 0x0b263eef, 0x1dfeae62,
+	0xe26f9431, 0xf3c10ead, 0xe2e8188c, 0xf2ac9bea, 0xe36ab4df, 0xf19cc8b3, 0xe3f73bda, 0xf091f357,
+	0xe7437f95, 0x144cf325, 0xe6c5ddb6, 0x13affa29, 0xe64c1fb8, 0x130ff7fd, 0xe5d65860, 0x126d054d,
+	0x0ac7cd3b, 0x1e212105, 0x0a68f121, 0x1e426a4b, 0x0a09ae4a, 0x1e6288ec, 0x09aa0861, 0x1e817bab,
+	0xe48d7cbb, 0xef8c7867, 0xe52d4362, 0xee8cb29c, 0xe5d65860, 0xed92fab3, 0xe688810b, 0xec9fa74f,
+	0xe56499d7, 0x11c73b3a, 0xe4f6f5a8, 0x111eb354, 0xe48d7cbb, 0x10738799, 0xe4283f54, 0x0fc5d26e,
+	0x094a0317, 0x1e9f4157, 0x08e9a220, 0x1ebbd8c9, 0x0888e931, 0x1ed740e7, 0x0827dc07, 0x1ef178a4,
+	0xe7437f95, 0xebb30cdb, 0xe807131d, 0xeacd7d6d, 0xe8d2f7c8, 0xe9ef48ab, 0xe9a6e6da, 0xe918bbab,
+	0xe3c74d0e, 0x0f15ae9c, 0xe36ab4df, 0x0e63374d, 0xe312850c, 0x0dae8805, 0xe2becb2f, 0x0cf7bca2,
+	0x07c67e5f, 0x1f0a7efc, 0x0764d3f9, 0x1f2252f7, 0x0702e09b, 0x1f38f3ac, 0x06a0a809, 0x1f4e603b,
+	0xea8296cb, 0xe84a20de, 0xeb65bb64, 0xe783bff0, 0xec5005d7, 0xe6c5ddb6, 0xed4124da, 0xe610bc11,
+	0xe26f9431, 0x0c3ef153, 0xe224ec49, 0x0b844298, 0xe1dedefb, 0x0ac7cd3b, 0xe19d7714, 0x0a09ae4a,
+	0x063e2e0f, 0x1f6297d0, 0x05db7678, 0x1f7599a4, 0x05788511, 0x1f8764fa, 0x05155dac, 0x1f97f925,
+	0xee38c4c6, 0xe56499d7, 0xef368fb3, 0xe4c1b2c1, 0xf03a2d92, 0xe4283f54, 0xf1434452, 0xe39874cb,
+	0xe160bea9, 0x094a0317, 0xe128bf19, 0x0888e931, 0xe0f58104, 0x07c67e5f, 0xe0c70c54, 0x0702e09b,
+	0x04b2041c, 0x1fa7557f, 0x044e7c34, 0x1fb57972, 0x03eac9cb, 0x1fc26471, 0x0386f0b9, 0x1fce15fd,
+	0xf25177fb, 0xe312850c, 0xf3646ace, 0xe2969e8c, 0xf47bbd68, 0xe224ec49, 0xf5970edf, 0xe1bd95b5,
+	0xe09d6830, 0x063e2e0f, 0xe0789b06, 0x05788511, 0xe058aa81, 0x04b2041c, 0xe03d9b8f, 0x03eac9cb,
+	0x0322f4d8, 0x1fd88da4, 0x02beda01, 0x1fe1cafd, 0x025aa412, 0x1fe9cdad, 0x01f656e8, 0x1ff09566,
+	0xf6b5fce9, 0xe160bea9, 0xf7d823f9, 0xe10e875c, 0xf8fd1f65, 0xe0c70c54, 0xfa248988, 0xe08a665c,
+	0xe027725c, 0x0322f4d8, 0xe0163253, 0x025aa412, 0xe009de1d, 0x0191f65f, 0xe002779f, 0x00c90ab0,
+	0x0191f65f, 0x1ff621e3, 0x012d8657, 0x1ffa72f0, 0x00c90ab0, 0x1ffd8861, 0x00648748, 0x1fff6217,
 	0xfb4dfbe4, 0xe058aa81, 0xfc790f47, 0xe031ea03, 0xfda55bee, 0xe0163253, 0xfed279a9, 0xe0058d10
 };
 
 const int twidTab64[4*6 + 16*6] = {
-	0x20000000, 0x00000000, 0x16a09e66, 0x16a09e66, 0x00000000, 0x20000000, 0xe95f619a, 0x16a09e66, 
-	0x20000000, 0x00000000, 0x1d906bcf, 0x0c3ef153, 0x16a09e66, 0x16a09e66, 0x0c3ef153, 0x1d906bcf, 
-	0x20000000, 0x00000000, 0x0c3ef153, 0x1d906bcf, 0xe95f619a, 0x16a09e66, 0xe26f9431, 0xf3c10ead, 
+	0x20000000, 0x00000000, 0x16a09e66, 0x16a09e66, 0x00000000, 0x20000000, 0xe95f619a, 0x16a09e66,
+	0x20000000, 0x00000000, 0x1d906bcf, 0x0c3ef153, 0x16a09e66, 0x16a09e66, 0x0c3ef153, 0x1d906bcf,
+	0x20000000, 0x00000000, 0x0c3ef153, 0x1d906bcf, 0xe95f619a, 0x16a09e66, 0xe26f9431, 0xf3c10ead,
 
-	0x20000000, 0x00000000, 0x1f6297d0, 0x063e2e0f, 0x1d906bcf, 0x0c3ef153, 0x1a9b6629, 0x11c73b3a, 
-	0x20000000, 0x00000000, 0x1fd88da4, 0x0322f4d8, 0x1f6297d0, 0x063e2e0f, 0x1e9f4157, 0x094a0317, 
-	0x20000000, 0x00000000, 0x1e9f4157, 0x094a0317, 0x1a9b6629, 0x11c73b3a, 0x144cf325, 0x18bc806b, 
-	0x16a09e66, 0x16a09e66, 0x11c73b3a, 0x1a9b6629, 0x0c3ef153, 0x1d906bcf, 0x063e2e0f, 0x1f6297d0, 
-	0x1d906bcf, 0x0c3ef153, 0x1c38b2f2, 0x0f15ae9c, 0x1a9b6629, 0x11c73b3a, 0x18bc806b, 0x144cf325, 
-	0x0c3ef153, 0x1d906bcf, 0x0322f4d8, 0x1fd88da4, 0xf9c1d1f1, 0x1f6297d0, 0xf0ea5164, 0x1c38b2f2, 
-	0x00000000, 0x20000000, 0xf9c1d1f1, 0x1f6297d0, 0xf3c10ead, 0x1d906bcf, 0xee38c4c6, 0x1a9b6629, 
-	0x16a09e66, 0x16a09e66, 0x144cf325, 0x18bc806b, 0x11c73b3a, 0x1a9b6629, 0x0f15ae9c, 0x1c38b2f2, 
-	0xe95f619a, 0x16a09e66, 0xe3c74d0e, 0x0f15ae9c, 0xe09d6830, 0x063e2e0f, 0xe027725c, 0xfcdd0b28, 
-	0xe95f619a, 0x16a09e66, 0xe56499d7, 0x11c73b3a, 0xe26f9431, 0x0c3ef153, 0xe09d6830, 0x063e2e0f, 
-	0x0c3ef153, 0x1d906bcf, 0x094a0317, 0x1e9f4157, 0x063e2e0f, 0x1f6297d0, 0x0322f4d8, 0x1fd88da4, 
+	0x20000000, 0x00000000, 0x1f6297d0, 0x063e2e0f, 0x1d906bcf, 0x0c3ef153, 0x1a9b6629, 0x11c73b3a,
+	0x20000000, 0x00000000, 0x1fd88da4, 0x0322f4d8, 0x1f6297d0, 0x063e2e0f, 0x1e9f4157, 0x094a0317,
+	0x20000000, 0x00000000, 0x1e9f4157, 0x094a0317, 0x1a9b6629, 0x11c73b3a, 0x144cf325, 0x18bc806b,
+	0x16a09e66, 0x16a09e66, 0x11c73b3a, 0x1a9b6629, 0x0c3ef153, 0x1d906bcf, 0x063e2e0f, 0x1f6297d0,
+	0x1d906bcf, 0x0c3ef153, 0x1c38b2f2, 0x0f15ae9c, 0x1a9b6629, 0x11c73b3a, 0x18bc806b, 0x144cf325,
+	0x0c3ef153, 0x1d906bcf, 0x0322f4d8, 0x1fd88da4, 0xf9c1d1f1, 0x1f6297d0, 0xf0ea5164, 0x1c38b2f2,
+	0x00000000, 0x20000000, 0xf9c1d1f1, 0x1f6297d0, 0xf3c10ead, 0x1d906bcf, 0xee38c4c6, 0x1a9b6629,
+	0x16a09e66, 0x16a09e66, 0x144cf325, 0x18bc806b, 0x11c73b3a, 0x1a9b6629, 0x0f15ae9c, 0x1c38b2f2,
+	0xe95f619a, 0x16a09e66, 0xe3c74d0e, 0x0f15ae9c, 0xe09d6830, 0x063e2e0f, 0xe027725c, 0xfcdd0b28,
+	0xe95f619a, 0x16a09e66, 0xe56499d7, 0x11c73b3a, 0xe26f9431, 0x0c3ef153, 0xe09d6830, 0x063e2e0f,
+	0x0c3ef153, 0x1d906bcf, 0x094a0317, 0x1e9f4157, 0x063e2e0f, 0x1f6297d0, 0x0322f4d8, 0x1fd88da4,
 	0xe26f9431, 0xf3c10ead, 0xe7437f95, 0xebb30cdb, 0xee38c4c6, 0xe56499d7, 0xf6b5fce9, 0xe160bea9
 };
 
 #else
 
-/* 
- *  Q30 for 128 and 1024 
+/*
+ *  Q30 for 128 and 1024
  *
  * for (i = 0; i < num/4; i++) {
  *   angle = (i + 0.125) * M_PI / num;
  *   x = cos(angle) * (1 << 30);
  *   x = sin(angle) * (1 << 30);
- * 
+ *
  *   angle = (num/2 - 1 - i + 0.125) * M_PI / num;
  *   x = cos(angle) * (1 << 30);
  *   x = sin(angle) * (1 << 30);
@@ -667,379 +667,379 @@
  */
 const int cossintab[128 + 1024] = {
 	/* 128 */
-	0x3fffec43, 0x003243f1, 0x015fd4d2, 0x3ffc38d1, 0x3ff9c13a, 0x01c454f5, 0x02f1b755, 0x3feea776, 
-	0x3fe9b8a9, 0x03562038, 0x0483259d, 0x3fd73a4a, 0x3fcfd50b, 0x04e767c5, 0x0613e1c5, 0x3fb5f4ea, 
-	0x3fac1a5b, 0x0677edbb, 0x07a3adff, 0x3f8adc77, 0x3f7e8e1e, 0x08077457, 0x09324ca7, 0x3f55f796, 
-	0x3f473759, 0x0995bdfd, 0x0abf8043, 0x3f174e70, 0x3f061e95, 0x0b228d42, 0x0c4b0b94, 0x3eceeaad, 
-	0x3ebb4ddb, 0x0cada4f5, 0x0dd4b19a, 0x3e7cd778, 0x3e66d0b4, 0x0e36c82a, 0x0f5c35a3, 0x3e212179, 
-	0x3e08b42a, 0x0fbdba40, 0x10e15b4e, 0x3dbbd6d4, 0x3da106bd, 0x11423ef0, 0x1263e699, 0x3d4d0728, 
-	0x3d2fd86c, 0x12c41a4f, 0x13e39be9, 0x3cd4c38b, 0x3cb53aaa, 0x144310dd, 0x15604013, 0x3c531e88, 
-	0x3c314060, 0x15bee78c, 0x16d99864, 0x3bc82c1f, 0x3ba3fde7, 0x173763c9, 0x184f6aab, 0x3b3401bb, 
-	0x3b0d8909, 0x18ac4b87, 0x19c17d44, 0x3a96b636, 0x3a6df8f8, 0x1a1d6544, 0x1b2f971e, 0x39f061d2, 
-	0x39c5664f, 0x1b8a7815, 0x1c997fc4, 0x39411e33, 0x3913eb0e, 0x1cf34baf, 0x1dfeff67, 0x38890663, 
-	0x3859a292, 0x1e57a86d, 0x1f5fdee6, 0x37c836c2, 0x3796a996, 0x1fb7575c, 0x20bbe7d8, 0x36fecd0e, 
-	0x36cb1e2a, 0x21122240, 0x2212e492, 0x362ce855, 0x35f71fb1, 0x2267d3a0, 0x2364a02e, 0x3552a8f4, 
-	0x351acedd, 0x23b836ca, 0x24b0e699, 0x34703095, 0x34364da6, 0x250317df, 0x25f78497, 0x3385a222, 
-	0x3349bf48, 0x264843d9, 0x273847c8, 0x329321c7, 0x32554840, 0x27878893, 0x2872feb6, 0x3198d4ea, 
-	0x31590e3e, 0x28c0b4d2, 0x29a778db, 0x3096e223, 0x30553828, 0x29f3984c, 0x2ad586a3, 0x2f8d713a, 
-	0x2f49ee0f, 0x2b2003ac, 0x2bfcf97c, 0x2e7cab1c, 0x2e37592c, 0x2c45c8a0, 0x2d1da3d5, 0x2d64b9da, 
+	0x3fffec43, 0x003243f1, 0x015fd4d2, 0x3ffc38d1, 0x3ff9c13a, 0x01c454f5, 0x02f1b755, 0x3feea776,
+	0x3fe9b8a9, 0x03562038, 0x0483259d, 0x3fd73a4a, 0x3fcfd50b, 0x04e767c5, 0x0613e1c5, 0x3fb5f4ea,
+	0x3fac1a5b, 0x0677edbb, 0x07a3adff, 0x3f8adc77, 0x3f7e8e1e, 0x08077457, 0x09324ca7, 0x3f55f796,
+	0x3f473759, 0x0995bdfd, 0x0abf8043, 0x3f174e70, 0x3f061e95, 0x0b228d42, 0x0c4b0b94, 0x3eceeaad,
+	0x3ebb4ddb, 0x0cada4f5, 0x0dd4b19a, 0x3e7cd778, 0x3e66d0b4, 0x0e36c82a, 0x0f5c35a3, 0x3e212179,
+	0x3e08b42a, 0x0fbdba40, 0x10e15b4e, 0x3dbbd6d4, 0x3da106bd, 0x11423ef0, 0x1263e699, 0x3d4d0728,
+	0x3d2fd86c, 0x12c41a4f, 0x13e39be9, 0x3cd4c38b, 0x3cb53aaa, 0x144310dd, 0x15604013, 0x3c531e88,
+	0x3c314060, 0x15bee78c, 0x16d99864, 0x3bc82c1f, 0x3ba3fde7, 0x173763c9, 0x184f6aab, 0x3b3401bb,
+	0x3b0d8909, 0x18ac4b87, 0x19c17d44, 0x3a96b636, 0x3a6df8f8, 0x1a1d6544, 0x1b2f971e, 0x39f061d2,
+	0x39c5664f, 0x1b8a7815, 0x1c997fc4, 0x39411e33, 0x3913eb0e, 0x1cf34baf, 0x1dfeff67, 0x38890663,
+	0x3859a292, 0x1e57a86d, 0x1f5fdee6, 0x37c836c2, 0x3796a996, 0x1fb7575c, 0x20bbe7d8, 0x36fecd0e,
+	0x36cb1e2a, 0x21122240, 0x2212e492, 0x362ce855, 0x35f71fb1, 0x2267d3a0, 0x2364a02e, 0x3552a8f4,
+	0x351acedd, 0x23b836ca, 0x24b0e699, 0x34703095, 0x34364da6, 0x250317df, 0x25f78497, 0x3385a222,
+	0x3349bf48, 0x264843d9, 0x273847c8, 0x329321c7, 0x32554840, 0x27878893, 0x2872feb6, 0x3198d4ea,
+	0x31590e3e, 0x28c0b4d2, 0x29a778db, 0x3096e223, 0x30553828, 0x29f3984c, 0x2ad586a3, 0x2f8d713a,
+	0x2f49ee0f, 0x2b2003ac, 0x2bfcf97c, 0x2e7cab1c, 0x2e37592c, 0x2c45c8a0, 0x2d1da3d5, 0x2d64b9da,
 	/* 1024 */
-	0x3fffffb1, 0x0006487f, 0x002bfb74, 0x3ffff0e3, 0x3fffe705, 0x00388c6e, 0x005e3f4c, 0x3fffba9b, 
-	0x3fffa6de, 0x006ad03b, 0x009082ea, 0x3fff5cd8, 0x3fff3f3c, 0x009d13c5, 0x00c2c62f, 0x3ffed79b, 
-	0x3ffeb021, 0x00cf56ef, 0x00f508fc, 0x3ffe2ae5, 0x3ffdf98c, 0x01019998, 0x01274b31, 0x3ffd56b5, 
-	0x3ffd1b7e, 0x0133dba3, 0x01598cb1, 0x3ffc5b0c, 0x3ffc15f7, 0x01661cf0, 0x018bcd5b, 0x3ffb37ec, 
-	0x3ffae8f9, 0x01985d60, 0x01be0d11, 0x3ff9ed53, 0x3ff99483, 0x01ca9cd4, 0x01f04bb4, 0x3ff87b44, 
-	0x3ff81896, 0x01fcdb2e, 0x02228924, 0x3ff6e1bf, 0x3ff67534, 0x022f184d, 0x0254c544, 0x3ff520c5, 
-	0x3ff4aa5d, 0x02615414, 0x0286fff3, 0x3ff33858, 0x3ff2b813, 0x02938e62, 0x02b93914, 0x3ff12878, 
-	0x3ff09e56, 0x02c5c71a, 0x02eb7086, 0x3feef126, 0x3fee5d28, 0x02f7fe1c, 0x031da62b, 0x3fec9265, 
-	0x3febf48b, 0x032a3349, 0x034fd9e5, 0x3fea0c35, 0x3fe96480, 0x035c6682, 0x03820b93, 0x3fe75e98, 
-	0x3fe6ad08, 0x038e97a9, 0x03b43b17, 0x3fe48990, 0x3fe3ce26, 0x03c0c69e, 0x03e66852, 0x3fe18d1f, 
-	0x3fe0c7da, 0x03f2f342, 0x04189326, 0x3fde6945, 0x3fdd9a27, 0x04251d77, 0x044abb73, 0x3fdb1e06, 
-	0x3fda450f, 0x0457451d, 0x047ce11a, 0x3fd7ab64, 0x3fd6c894, 0x04896a16, 0x04af03fc, 0x3fd4115f, 
-	0x3fd324b7, 0x04bb8c42, 0x04e123fa, 0x3fd04ffc, 0x3fcf597c, 0x04edab83, 0x051340f6, 0x3fcc673b, 
-	0x3fcb66e4, 0x051fc7b9, 0x05455ad1, 0x3fc8571f, 0x3fc74cf3, 0x0551e0c7, 0x0577716b, 0x3fc41fac, 
-	0x3fc30baa, 0x0583f68c, 0x05a984a6, 0x3fbfc0e3, 0x3fbea30c, 0x05b608eb, 0x05db9463, 0x3fbb3ac7, 
-	0x3fba131b, 0x05e817c3, 0x060da083, 0x3fb68d5b, 0x3fb55bdc, 0x061a22f7, 0x063fa8e7, 0x3fb1b8a2, 
-	0x3fb07d50, 0x064c2a67, 0x0671ad71, 0x3facbc9f, 0x3fab777b, 0x067e2df5, 0x06a3ae00, 0x3fa79954, 
-	0x3fa64a5f, 0x06b02d81, 0x06d5aa77, 0x3fa24ec6, 0x3fa0f600, 0x06e228ee, 0x0707a2b7, 0x3f9cdcf7, 
-	0x3f9b7a62, 0x0714201b, 0x073996a1, 0x3f9743eb, 0x3f95d787, 0x074612eb, 0x076b8616, 0x3f9183a5, 
-	0x3f900d72, 0x0778013d, 0x079d70f7, 0x3f8b9c28, 0x3f8a1c29, 0x07a9eaf5, 0x07cf5726, 0x3f858d79, 
-	0x3f8403ae, 0x07dbcff2, 0x08013883, 0x3f7f579b, 0x3f7dc405, 0x080db016, 0x083314f1, 0x3f78fa92, 
-	0x3f775d31, 0x083f8b43, 0x0864ec4f, 0x3f727661, 0x3f70cf38, 0x08716159, 0x0896be80, 0x3f6bcb0e, 
-	0x3f6a1a1c, 0x08a3323a, 0x08c88b65, 0x3f64f89b, 0x3f633de2, 0x08d4fdc6, 0x08fa52de, 0x3f5dff0e, 
-	0x3f5c3a8f, 0x0906c3e0, 0x092c14ce, 0x3f56de6a, 0x3f551026, 0x09388469, 0x095dd116, 0x3f4f96b4, 
-	0x3f4dbeac, 0x096a3f42, 0x098f8796, 0x3f4827f0, 0x3f464626, 0x099bf44c, 0x09c13831, 0x3f409223, 
-	0x3f3ea697, 0x09cda368, 0x09f2e2c7, 0x3f38d552, 0x3f36e006, 0x09ff4c78, 0x0a24873a, 0x3f30f181, 
-	0x3f2ef276, 0x0a30ef5e, 0x0a56256c, 0x3f28e6b6, 0x3f26ddec, 0x0a628bfa, 0x0a87bd3d, 0x3f20b4f5, 
-	0x3f1ea26e, 0x0a94222f, 0x0ab94e8f, 0x3f185c43, 0x3f164001, 0x0ac5b1dc, 0x0aead944, 0x3f0fdca5, 
-	0x3f0db6a9, 0x0af73ae5, 0x0b1c5d3d, 0x3f073621, 0x3f05066d, 0x0b28bd2a, 0x0b4dda5c, 0x3efe68bc, 
-	0x3efc2f50, 0x0b5a388d, 0x0b7f5081, 0x3ef5747b, 0x3ef3315a, 0x0b8bacf0, 0x0bb0bf8f, 0x3eec5965, 
-	0x3eea0c8e, 0x0bbd1a33, 0x0be22766, 0x3ee3177e, 0x3ee0c0f4, 0x0bee8038, 0x0c1387e9, 0x3ed9aecc, 
-	0x3ed74e91, 0x0c1fdee1, 0x0c44e0f9, 0x3ed01f55, 0x3ecdb56a, 0x0c513610, 0x0c763278, 0x3ec66920, 
-	0x3ec3f585, 0x0c8285a5, 0x0ca77c47, 0x3ebc8c31, 0x3eba0ee9, 0x0cb3cd84, 0x0cd8be47, 0x3eb2888f, 
-	0x3eb0019c, 0x0ce50d8c, 0x0d09f85b, 0x3ea85e41, 0x3ea5cda3, 0x0d1645a0, 0x0d3b2a64, 0x3e9e0d4c, 
-	0x3e9b7306, 0x0d4775a1, 0x0d6c5443, 0x3e9395b7, 0x3e90f1ca, 0x0d789d71, 0x0d9d75db, 0x3e88f788, 
-	0x3e8649f5, 0x0da9bcf2, 0x0dce8f0d, 0x3e7e32c6, 0x3e7b7b90, 0x0ddad406, 0x0dff9fba, 0x3e734778, 
-	0x3e70869f, 0x0e0be28e, 0x0e30a7c5, 0x3e6835a4, 0x3e656b2b, 0x0e3ce86b, 0x0e61a70f, 0x3e5cfd51, 
-	0x3e5a2939, 0x0e6de580, 0x0e929d7a, 0x3e519e86, 0x3e4ec0d1, 0x0e9ed9af, 0x0ec38ae8, 0x3e46194a, 
-	0x3e4331fa, 0x0ecfc4d9, 0x0ef46f3b, 0x3e3a6da4, 0x3e377cbb, 0x0f00a6df, 0x0f254a53, 0x3e2e9b9c, 
-	0x3e2ba11b, 0x0f317fa5, 0x0f561c15, 0x3e22a338, 0x3e1f9f21, 0x0f624f0c, 0x0f86e460, 0x3e168480, 
-	0x3e1376d5, 0x0f9314f5, 0x0fb7a317, 0x3e0a3f7b, 0x3e07283f, 0x0fc3d143, 0x0fe8581d, 0x3dfdd432, 
-	0x3dfab365, 0x0ff483d7, 0x10190352, 0x3df142ab, 0x3dee1851, 0x10252c94, 0x1049a49a, 0x3de48aef, 
-	0x3de15708, 0x1055cb5b, 0x107a3bd5, 0x3dd7ad05, 0x3dd46f94, 0x1086600e, 0x10aac8e6, 0x3dcaa8f5, 
-	0x3dc761fc, 0x10b6ea90, 0x10db4baf, 0x3dbd7ec7, 0x3dba2e48, 0x10e76ac3, 0x110bc413, 0x3db02e84, 
-	0x3dacd481, 0x1117e088, 0x113c31f3, 0x3da2b834, 0x3d9f54af, 0x11484bc2, 0x116c9531, 0x3d951bde, 
-	0x3d91aed9, 0x1178ac53, 0x119cedaf, 0x3d87598c, 0x3d83e309, 0x11a9021d, 0x11cd3b50, 0x3d797145, 
-	0x3d75f147, 0x11d94d02, 0x11fd7df6, 0x3d6b6313, 0x3d67d99b, 0x12098ce5, 0x122db583, 0x3d5d2efe, 
-	0x3d599c0e, 0x1239c1a7, 0x125de1da, 0x3d4ed50f, 0x3d4b38aa, 0x1269eb2b, 0x128e02dc, 0x3d40554e, 
-	0x3d3caf76, 0x129a0954, 0x12be186c, 0x3d31afc5, 0x3d2e007c, 0x12ca1c03, 0x12ee226c, 0x3d22e47c, 
-	0x3d1f2bc5, 0x12fa231b, 0x131e20c0, 0x3d13f37e, 0x3d10315a, 0x132a1e7e, 0x134e1348, 0x3d04dcd2, 
-	0x3d011145, 0x135a0e0e, 0x137df9e7, 0x3cf5a082, 0x3cf1cb8e, 0x1389f1af, 0x13add481, 0x3ce63e98, 
-	0x3ce2603f, 0x13b9c943, 0x13dda2f7, 0x3cd6b71e, 0x3cd2cf62, 0x13e994ab, 0x140d652c, 0x3cc70a1c, 
-	0x3cc318ff, 0x141953cb, 0x143d1b02, 0x3cb7379c, 0x3cb33d22, 0x14490685, 0x146cc45c, 0x3ca73fa9, 
-	0x3ca33bd3, 0x1478acbc, 0x149c611d, 0x3c97224c, 0x3c93151d, 0x14a84652, 0x14cbf127, 0x3c86df8e, 
-	0x3c82c909, 0x14d7d32a, 0x14fb745e, 0x3c76777b, 0x3c7257a2, 0x15075327, 0x152aeaa3, 0x3c65ea1c, 
-	0x3c61c0f1, 0x1536c62b, 0x155a53d9, 0x3c55377b, 0x3c510501, 0x15662c18, 0x1589afe3, 0x3c445fa2, 
-	0x3c4023dd, 0x159584d3, 0x15b8fea4, 0x3c33629d, 0x3c2f1d8e, 0x15c4d03e, 0x15e83fff, 0x3c224075, 
-	0x3c1df21f, 0x15f40e3a, 0x161773d6, 0x3c10f935, 0x3c0ca19b, 0x16233eac, 0x16469a0d, 0x3bff8ce8, 
-	0x3bfb2c0c, 0x16526176, 0x1675b286, 0x3bedfb99, 0x3be9917e, 0x1681767c, 0x16a4bd25, 0x3bdc4552, 
-	0x3bd7d1fa, 0x16b07d9f, 0x16d3b9cc, 0x3bca6a1d, 0x3bc5ed8d, 0x16df76c3, 0x1702a85e, 0x3bb86a08, 
-	0x3bb3e440, 0x170e61cc, 0x173188be, 0x3ba6451b, 0x3ba1b620, 0x173d3e9b, 0x17605ad0, 0x3b93fb63, 
-	0x3b8f6337, 0x176c0d15, 0x178f1e76, 0x3b818ceb, 0x3b7ceb90, 0x179acd1c, 0x17bdd394, 0x3b6ef9be, 
-	0x3b6a4f38, 0x17c97e93, 0x17ec7a0d, 0x3b5c41e8, 0x3b578e39, 0x17f8215e, 0x181b11c4, 0x3b496574, 
-	0x3b44a8a0, 0x1826b561, 0x18499a9d, 0x3b36646e, 0x3b319e77, 0x18553a7d, 0x1878147a, 0x3b233ee1, 
-	0x3b1e6fca, 0x1883b097, 0x18a67f3f, 0x3b0ff4d9, 0x3b0b1ca6, 0x18b21791, 0x18d4dad0, 0x3afc8663, 
-	0x3af7a516, 0x18e06f50, 0x1903270f, 0x3ae8f38b, 0x3ae40926, 0x190eb7b7, 0x193163e1, 0x3ad53c5b, 
-	0x3ad048e3, 0x193cf0a9, 0x195f9128, 0x3ac160e1, 0x3abc6458, 0x196b1a09, 0x198daec8, 0x3aad6129, 
-	0x3aa85b92, 0x199933bb, 0x19bbbca6, 0x3a993d3e, 0x3a942e9d, 0x19c73da3, 0x19e9baa3, 0x3a84f52f, 
-	0x3a7fdd86, 0x19f537a4, 0x1a17a8a5, 0x3a708906, 0x3a6b6859, 0x1a2321a2, 0x1a45868e, 0x3a5bf8d1, 
-	0x3a56cf23, 0x1a50fb81, 0x1a735442, 0x3a47449c, 0x3a4211f0, 0x1a7ec524, 0x1aa111a6, 0x3a326c74, 
-	0x3a2d30cd, 0x1aac7e6f, 0x1acebe9d, 0x3a1d7066, 0x3a182bc8, 0x1ada2746, 0x1afc5b0a, 0x3a08507f, 
-	0x3a0302ed, 0x1b07bf8c, 0x1b29e6d2, 0x39f30ccc, 0x39edb649, 0x1b354727, 0x1b5761d8, 0x39dda55a, 
-	0x39d845e9, 0x1b62bdf8, 0x1b84cc01, 0x39c81a36, 0x39c2b1da, 0x1b9023e5, 0x1bb22530, 0x39b26b6d, 
-	0x39acfa2b, 0x1bbd78d2, 0x1bdf6d4a, 0x399c990d, 0x39971ee7, 0x1beabca1, 0x1c0ca432, 0x3986a324, 
-	0x3981201e, 0x1c17ef39, 0x1c39c9cd, 0x397089bf, 0x396afddc, 0x1c45107c, 0x1c66ddfe, 0x395a4ceb, 
-	0x3954b82e, 0x1c72204f, 0x1c93e0ab, 0x3943ecb6, 0x393e4f23, 0x1c9f1e96, 0x1cc0d1b6, 0x392d692f, 
-	0x3927c2c9, 0x1ccc0b35, 0x1cedb106, 0x3916c262, 0x3911132d, 0x1cf8e611, 0x1d1a7e7d, 0x38fff85e, 
-	0x38fa405e, 0x1d25af0d, 0x1d473a00, 0x38e90b31, 0x38e34a69, 0x1d52660f, 0x1d73e374, 0x38d1fae9, 
-	0x38cc315d, 0x1d7f0afb, 0x1da07abc, 0x38bac795, 0x38b4f547, 0x1dab9db5, 0x1dccffbf, 0x38a37142, 
-	0x389d9637, 0x1dd81e21, 0x1df9725f, 0x388bf7ff, 0x3886143b, 0x1e048c24, 0x1e25d282, 0x38745bdb, 
-	0x386e6f60, 0x1e30e7a4, 0x1e52200c, 0x385c9ce3, 0x3856a7b6, 0x1e5d3084, 0x1e7e5ae2, 0x3844bb28, 
-	0x383ebd4c, 0x1e8966a8, 0x1eaa82e9, 0x382cb6b7, 0x3826b030, 0x1eb589f7, 0x1ed69805, 0x38148f9f, 
-	0x380e8071, 0x1ee19a54, 0x1f029a1c, 0x37fc45ef, 0x37f62e1d, 0x1f0d97a5, 0x1f2e8911, 0x37e3d9b7, 
-	0x37ddb945, 0x1f3981ce, 0x1f5a64cb, 0x37cb4b04, 0x37c521f6, 0x1f6558b5, 0x1f862d2d, 0x37b299e7, 
-	0x37ac6841, 0x1f911c3d, 0x1fb1e21d, 0x3799c66f, 0x37938c34, 0x1fbccc4d, 0x1fdd8381, 0x3780d0aa, 
-	0x377a8ddf, 0x1fe868c8, 0x2009113c, 0x3767b8a9, 0x37616d51, 0x2013f196, 0x20348b35, 0x374e7e7b, 
-	0x37482a9a, 0x203f6699, 0x205ff14f, 0x3735222f, 0x372ec5c9, 0x206ac7b8, 0x208b4372, 0x371ba3d4, 
-	0x37153eee, 0x209614d9, 0x20b68181, 0x3702037c, 0x36fb9618, 0x20c14ddf, 0x20e1ab63, 0x36e84135, 
-	0x36e1cb58, 0x20ec72b1, 0x210cc0fc, 0x36ce5d10, 0x36c7debd, 0x21178334, 0x2137c232, 0x36b4571b, 
-	0x36add058, 0x21427f4d, 0x2162aeea, 0x369a2f69, 0x3693a038, 0x216d66e2, 0x218d870b, 0x367fe608, 
-	0x36794e6e, 0x219839d8, 0x21b84a79, 0x36657b08, 0x365edb09, 0x21c2f815, 0x21e2f91a, 0x364aee7b, 
-	0x3644461b, 0x21eda17f, 0x220d92d4, 0x36304070, 0x36298fb4, 0x221835fb, 0x2238178d, 0x361570f8, 
-	0x360eb7e3, 0x2242b56f, 0x22628729, 0x35fa8023, 0x35f3beba, 0x226d1fc1, 0x228ce191, 0x35df6e03, 
-	0x35d8a449, 0x229774d7, 0x22b726a8, 0x35c43aa7, 0x35bd68a1, 0x22c1b496, 0x22e15655, 0x35a8e621, 
-	0x35a20bd3, 0x22ebdee5, 0x230b707e, 0x358d7081, 0x35868def, 0x2315f3a8, 0x23357509, 0x3571d9d9, 
-	0x356aef08, 0x233ff2c8, 0x235f63dc, 0x35562239, 0x354f2f2c, 0x2369dc29, 0x23893cdd, 0x353a49b2, 
-	0x35334e6f, 0x2393afb2, 0x23b2fff3, 0x351e5056, 0x35174ce0, 0x23bd6d48, 0x23dcad03, 0x35023636, 
-	0x34fb2a92, 0x23e714d3, 0x240643f4, 0x34e5fb63, 0x34dee795, 0x2410a639, 0x242fc4ad, 0x34c99fef, 
-	0x34c283fb, 0x243a215f, 0x24592f13, 0x34ad23eb, 0x34a5ffd5, 0x2463862c, 0x2482830d, 0x34908768, 
-	0x34895b36, 0x248cd487, 0x24abc082, 0x3473ca79, 0x346c962f, 0x24b60c57, 0x24d4e757, 0x3456ed2f, 
-	0x344fb0d1, 0x24df2d81, 0x24fdf775, 0x3439ef9c, 0x3432ab2e, 0x250837ed, 0x2526f0c1, 0x341cd1d2, 
-	0x34158559, 0x25312b81, 0x254fd323, 0x33ff93e2, 0x33f83f62, 0x255a0823, 0x25789e80, 0x33e235df, 
-	0x33dad95e, 0x2582cdbc, 0x25a152c0, 0x33c4b7db, 0x33bd535c, 0x25ab7c30, 0x25c9efca, 0x33a719e8, 
-	0x339fad70, 0x25d41369, 0x25f27584, 0x33895c18, 0x3381e7ac, 0x25fc934b, 0x261ae3d6, 0x336b7e7e, 
-	0x33640223, 0x2624fbbf, 0x26433aa7, 0x334d812d, 0x3345fce6, 0x264d4cac, 0x266b79dd, 0x332f6435, 
-	0x3327d808, 0x267585f8, 0x2693a161, 0x331127ab, 0x3309939c, 0x269da78b, 0x26bbb119, 0x32f2cba1, 
-	0x32eb2fb5, 0x26c5b14c, 0x26e3a8ec, 0x32d45029, 0x32ccac64, 0x26eda322, 0x270b88c2, 0x32b5b557, 
-	0x32ae09be, 0x27157cf5, 0x27335082, 0x3296fb3d, 0x328f47d5, 0x273d3eac, 0x275b0014, 0x327821ee, 
-	0x327066bc, 0x2764e82f, 0x27829760, 0x3259297d, 0x32516686, 0x278c7965, 0x27aa164c, 0x323a11fe, 
-	0x32324746, 0x27b3f235, 0x27d17cc1, 0x321adb83, 0x3213090f, 0x27db5288, 0x27f8caa5, 0x31fb8620, 
-	0x31f3abf5, 0x28029a45, 0x281fffe2, 0x31dc11e8, 0x31d4300b, 0x2829c954, 0x28471c5e, 0x31bc7eee, 
-	0x31b49564, 0x2850df9d, 0x286e2002, 0x319ccd46, 0x3194dc14, 0x2877dd07, 0x28950ab6, 0x317cfd04, 
-	0x3175042e, 0x289ec17a, 0x28bbdc61, 0x315d0e3b, 0x31550dc6, 0x28c58cdf, 0x28e294eb, 0x313d00ff, 
-	0x3134f8f1, 0x28ec3f1e, 0x2909343e, 0x311cd564, 0x3114c5c0, 0x2912d81f, 0x292fba40, 0x30fc8b7d, 
-	0x30f47449, 0x293957c9, 0x295626da, 0x30dc235e, 0x30d404a0, 0x295fbe06, 0x297c79f5, 0x30bb9d1c, 
-	0x30b376d8, 0x29860abd, 0x29a2b378, 0x309af8ca, 0x3092cb05, 0x29ac3dd7, 0x29c8d34d, 0x307a367c, 
-	0x3072013c, 0x29d2573c, 0x29eed95b, 0x30595648, 0x30511991, 0x29f856d5, 0x2a14c58b, 0x30385840, 
-	0x30301418, 0x2a1e3c8a, 0x2a3a97c7, 0x30173c7a, 0x300ef0e5, 0x2a440844, 0x2a604ff5, 0x2ff6030a, 
-	0x2fedb00d, 0x2a69b9ec, 0x2a85ee00, 0x2fd4ac04, 0x2fcc51a5, 0x2a8f516b, 0x2aab71d0, 0x2fb3377c, 
-	0x2faad5c1, 0x2ab4cea9, 0x2ad0db4e, 0x2f91a589, 0x2f893c75, 0x2ada318e, 0x2af62a63, 0x2f6ff63d, 
-	0x2f6785d7, 0x2aff7a05, 0x2b1b5ef8, 0x2f4e29af, 0x2f45b1fb, 0x2b24a7f6, 0x2b4078f5, 0x2f2c3ff2, 
-	0x2f23c0f6, 0x2b49bb4a, 0x2b657844, 0x2f0a391d, 0x2f01b2de, 0x2b6eb3ea, 0x2b8a5cce, 0x2ee81543, 
-	0x2edf87c6, 0x2b9391c0, 0x2baf267d, 0x2ec5d479, 0x2ebd3fc4, 0x2bb854b4, 0x2bd3d53a, 0x2ea376d6, 
-	0x2e9adaee, 0x2bdcfcb0, 0x2bf868ed, 0x2e80fc6e, 0x2e785958, 0x2c01899e, 0x2c1ce181, 0x2e5e6556, 
-	0x2e55bb17, 0x2c25fb66, 0x2c413edf, 0x2e3bb1a4, 0x2e330042, 0x2c4a51f3, 0x2c6580f1, 0x2e18e16d, 
-	0x2e1028ed, 0x2c6e8d2e, 0x2c89a79f, 0x2df5f4c7, 0x2ded352f, 0x2c92ad01, 0x2cadb2d5, 0x2dd2ebc7, 
-	0x2dca251c, 0x2cb6b155, 0x2cd1a27b, 0x2dafc683, 0x2da6f8ca, 0x2cda9a14, 0x2cf5767c, 0x2d8c8510, 
+	0x3fffffb1, 0x0006487f, 0x002bfb74, 0x3ffff0e3, 0x3fffe705, 0x00388c6e, 0x005e3f4c, 0x3fffba9b,
+	0x3fffa6de, 0x006ad03b, 0x009082ea, 0x3fff5cd8, 0x3fff3f3c, 0x009d13c5, 0x00c2c62f, 0x3ffed79b,
+	0x3ffeb021, 0x00cf56ef, 0x00f508fc, 0x3ffe2ae5, 0x3ffdf98c, 0x01019998, 0x01274b31, 0x3ffd56b5,
+	0x3ffd1b7e, 0x0133dba3, 0x01598cb1, 0x3ffc5b0c, 0x3ffc15f7, 0x01661cf0, 0x018bcd5b, 0x3ffb37ec,
+	0x3ffae8f9, 0x01985d60, 0x01be0d11, 0x3ff9ed53, 0x3ff99483, 0x01ca9cd4, 0x01f04bb4, 0x3ff87b44,
+	0x3ff81896, 0x01fcdb2e, 0x02228924, 0x3ff6e1bf, 0x3ff67534, 0x022f184d, 0x0254c544, 0x3ff520c5,
+	0x3ff4aa5d, 0x02615414, 0x0286fff3, 0x3ff33858, 0x3ff2b813, 0x02938e62, 0x02b93914, 0x3ff12878,
+	0x3ff09e56, 0x02c5c71a, 0x02eb7086, 0x3feef126, 0x3fee5d28, 0x02f7fe1c, 0x031da62b, 0x3fec9265,
+	0x3febf48b, 0x032a3349, 0x034fd9e5, 0x3fea0c35, 0x3fe96480, 0x035c6682, 0x03820b93, 0x3fe75e98,
+	0x3fe6ad08, 0x038e97a9, 0x03b43b17, 0x3fe48990, 0x3fe3ce26, 0x03c0c69e, 0x03e66852, 0x3fe18d1f,
+	0x3fe0c7da, 0x03f2f342, 0x04189326, 0x3fde6945, 0x3fdd9a27, 0x04251d77, 0x044abb73, 0x3fdb1e06,
+	0x3fda450f, 0x0457451d, 0x047ce11a, 0x3fd7ab64, 0x3fd6c894, 0x04896a16, 0x04af03fc, 0x3fd4115f,
+	0x3fd324b7, 0x04bb8c42, 0x04e123fa, 0x3fd04ffc, 0x3fcf597c, 0x04edab83, 0x051340f6, 0x3fcc673b,
+	0x3fcb66e4, 0x051fc7b9, 0x05455ad1, 0x3fc8571f, 0x3fc74cf3, 0x0551e0c7, 0x0577716b, 0x3fc41fac,
+	0x3fc30baa, 0x0583f68c, 0x05a984a6, 0x3fbfc0e3, 0x3fbea30c, 0x05b608eb, 0x05db9463, 0x3fbb3ac7,
+	0x3fba131b, 0x05e817c3, 0x060da083, 0x3fb68d5b, 0x3fb55bdc, 0x061a22f7, 0x063fa8e7, 0x3fb1b8a2,
+	0x3fb07d50, 0x064c2a67, 0x0671ad71, 0x3facbc9f, 0x3fab777b, 0x067e2df5, 0x06a3ae00, 0x3fa79954,
+	0x3fa64a5f, 0x06b02d81, 0x06d5aa77, 0x3fa24ec6, 0x3fa0f600, 0x06e228ee, 0x0707a2b7, 0x3f9cdcf7,
+	0x3f9b7a62, 0x0714201b, 0x073996a1, 0x3f9743eb, 0x3f95d787, 0x074612eb, 0x076b8616, 0x3f9183a5,
+	0x3f900d72, 0x0778013d, 0x079d70f7, 0x3f8b9c28, 0x3f8a1c29, 0x07a9eaf5, 0x07cf5726, 0x3f858d79,
+	0x3f8403ae, 0x07dbcff2, 0x08013883, 0x3f7f579b, 0x3f7dc405, 0x080db016, 0x083314f1, 0x3f78fa92,
+	0x3f775d31, 0x083f8b43, 0x0864ec4f, 0x3f727661, 0x3f70cf38, 0x08716159, 0x0896be80, 0x3f6bcb0e,
+	0x3f6a1a1c, 0x08a3323a, 0x08c88b65, 0x3f64f89b, 0x3f633de2, 0x08d4fdc6, 0x08fa52de, 0x3f5dff0e,
+	0x3f5c3a8f, 0x0906c3e0, 0x092c14ce, 0x3f56de6a, 0x3f551026, 0x09388469, 0x095dd116, 0x3f4f96b4,
+	0x3f4dbeac, 0x096a3f42, 0x098f8796, 0x3f4827f0, 0x3f464626, 0x099bf44c, 0x09c13831, 0x3f409223,
+	0x3f3ea697, 0x09cda368, 0x09f2e2c7, 0x3f38d552, 0x3f36e006, 0x09ff4c78, 0x0a24873a, 0x3f30f181,
+	0x3f2ef276, 0x0a30ef5e, 0x0a56256c, 0x3f28e6b6, 0x3f26ddec, 0x0a628bfa, 0x0a87bd3d, 0x3f20b4f5,
+	0x3f1ea26e, 0x0a94222f, 0x0ab94e8f, 0x3f185c43, 0x3f164001, 0x0ac5b1dc, 0x0aead944, 0x3f0fdca5,
+	0x3f0db6a9, 0x0af73ae5, 0x0b1c5d3d, 0x3f073621, 0x3f05066d, 0x0b28bd2a, 0x0b4dda5c, 0x3efe68bc,
+	0x3efc2f50, 0x0b5a388d, 0x0b7f5081, 0x3ef5747b, 0x3ef3315a, 0x0b8bacf0, 0x0bb0bf8f, 0x3eec5965,
+	0x3eea0c8e, 0x0bbd1a33, 0x0be22766, 0x3ee3177e, 0x3ee0c0f4, 0x0bee8038, 0x0c1387e9, 0x3ed9aecc,
+	0x3ed74e91, 0x0c1fdee1, 0x0c44e0f9, 0x3ed01f55, 0x3ecdb56a, 0x0c513610, 0x0c763278, 0x3ec66920,
+	0x3ec3f585, 0x0c8285a5, 0x0ca77c47, 0x3ebc8c31, 0x3eba0ee9, 0x0cb3cd84, 0x0cd8be47, 0x3eb2888f,
+	0x3eb0019c, 0x0ce50d8c, 0x0d09f85b, 0x3ea85e41, 0x3ea5cda3, 0x0d1645a0, 0x0d3b2a64, 0x3e9e0d4c,
+	0x3e9b7306, 0x0d4775a1, 0x0d6c5443, 0x3e9395b7, 0x3e90f1ca, 0x0d789d71, 0x0d9d75db, 0x3e88f788,
+	0x3e8649f5, 0x0da9bcf2, 0x0dce8f0d, 0x3e7e32c6, 0x3e7b7b90, 0x0ddad406, 0x0dff9fba, 0x3e734778,
+	0x3e70869f, 0x0e0be28e, 0x0e30a7c5, 0x3e6835a4, 0x3e656b2b, 0x0e3ce86b, 0x0e61a70f, 0x3e5cfd51,
+	0x3e5a2939, 0x0e6de580, 0x0e929d7a, 0x3e519e86, 0x3e4ec0d1, 0x0e9ed9af, 0x0ec38ae8, 0x3e46194a,
+	0x3e4331fa, 0x0ecfc4d9, 0x0ef46f3b, 0x3e3a6da4, 0x3e377cbb, 0x0f00a6df, 0x0f254a53, 0x3e2e9b9c,
+	0x3e2ba11b, 0x0f317fa5, 0x0f561c15, 0x3e22a338, 0x3e1f9f21, 0x0f624f0c, 0x0f86e460, 0x3e168480,
+	0x3e1376d5, 0x0f9314f5, 0x0fb7a317, 0x3e0a3f7b, 0x3e07283f, 0x0fc3d143, 0x0fe8581d, 0x3dfdd432,
+	0x3dfab365, 0x0ff483d7, 0x10190352, 0x3df142ab, 0x3dee1851, 0x10252c94, 0x1049a49a, 0x3de48aef,
+	0x3de15708, 0x1055cb5b, 0x107a3bd5, 0x3dd7ad05, 0x3dd46f94, 0x1086600e, 0x10aac8e6, 0x3dcaa8f5,
+	0x3dc761fc, 0x10b6ea90, 0x10db4baf, 0x3dbd7ec7, 0x3dba2e48, 0x10e76ac3, 0x110bc413, 0x3db02e84,
+	0x3dacd481, 0x1117e088, 0x113c31f3, 0x3da2b834, 0x3d9f54af, 0x11484bc2, 0x116c9531, 0x3d951bde,
+	0x3d91aed9, 0x1178ac53, 0x119cedaf, 0x3d87598c, 0x3d83e309, 0x11a9021d, 0x11cd3b50, 0x3d797145,
+	0x3d75f147, 0x11d94d02, 0x11fd7df6, 0x3d6b6313, 0x3d67d99b, 0x12098ce5, 0x122db583, 0x3d5d2efe,
+	0x3d599c0e, 0x1239c1a7, 0x125de1da, 0x3d4ed50f, 0x3d4b38aa, 0x1269eb2b, 0x128e02dc, 0x3d40554e,
+	0x3d3caf76, 0x129a0954, 0x12be186c, 0x3d31afc5, 0x3d2e007c, 0x12ca1c03, 0x12ee226c, 0x3d22e47c,
+	0x3d1f2bc5, 0x12fa231b, 0x131e20c0, 0x3d13f37e, 0x3d10315a, 0x132a1e7e, 0x134e1348, 0x3d04dcd2,
+	0x3d011145, 0x135a0e0e, 0x137df9e7, 0x3cf5a082, 0x3cf1cb8e, 0x1389f1af, 0x13add481, 0x3ce63e98,
+	0x3ce2603f, 0x13b9c943, 0x13dda2f7, 0x3cd6b71e, 0x3cd2cf62, 0x13e994ab, 0x140d652c, 0x3cc70a1c,
+	0x3cc318ff, 0x141953cb, 0x143d1b02, 0x3cb7379c, 0x3cb33d22, 0x14490685, 0x146cc45c, 0x3ca73fa9,
+	0x3ca33bd3, 0x1478acbc, 0x149c611d, 0x3c97224c, 0x3c93151d, 0x14a84652, 0x14cbf127, 0x3c86df8e,
+	0x3c82c909, 0x14d7d32a, 0x14fb745e, 0x3c76777b, 0x3c7257a2, 0x15075327, 0x152aeaa3, 0x3c65ea1c,
+	0x3c61c0f1, 0x1536c62b, 0x155a53d9, 0x3c55377b, 0x3c510501, 0x15662c18, 0x1589afe3, 0x3c445fa2,
+	0x3c4023dd, 0x159584d3, 0x15b8fea4, 0x3c33629d, 0x3c2f1d8e, 0x15c4d03e, 0x15e83fff, 0x3c224075,
+	0x3c1df21f, 0x15f40e3a, 0x161773d6, 0x3c10f935, 0x3c0ca19b, 0x16233eac, 0x16469a0d, 0x3bff8ce8,
+	0x3bfb2c0c, 0x16526176, 0x1675b286, 0x3bedfb99, 0x3be9917e, 0x1681767c, 0x16a4bd25, 0x3bdc4552,
+	0x3bd7d1fa, 0x16b07d9f, 0x16d3b9cc, 0x3bca6a1d, 0x3bc5ed8d, 0x16df76c3, 0x1702a85e, 0x3bb86a08,
+	0x3bb3e440, 0x170e61cc, 0x173188be, 0x3ba6451b, 0x3ba1b620, 0x173d3e9b, 0x17605ad0, 0x3b93fb63,
+	0x3b8f6337, 0x176c0d15, 0x178f1e76, 0x3b818ceb, 0x3b7ceb90, 0x179acd1c, 0x17bdd394, 0x3b6ef9be,
+	0x3b6a4f38, 0x17c97e93, 0x17ec7a0d, 0x3b5c41e8, 0x3b578e39, 0x17f8215e, 0x181b11c4, 0x3b496574,
+	0x3b44a8a0, 0x1826b561, 0x18499a9d, 0x3b36646e, 0x3b319e77, 0x18553a7d, 0x1878147a, 0x3b233ee1,
+	0x3b1e6fca, 0x1883b097, 0x18a67f3f, 0x3b0ff4d9, 0x3b0b1ca6, 0x18b21791, 0x18d4dad0, 0x3afc8663,
+	0x3af7a516, 0x18e06f50, 0x1903270f, 0x3ae8f38b, 0x3ae40926, 0x190eb7b7, 0x193163e1, 0x3ad53c5b,
+	0x3ad048e3, 0x193cf0a9, 0x195f9128, 0x3ac160e1, 0x3abc6458, 0x196b1a09, 0x198daec8, 0x3aad6129,
+	0x3aa85b92, 0x199933bb, 0x19bbbca6, 0x3a993d3e, 0x3a942e9d, 0x19c73da3, 0x19e9baa3, 0x3a84f52f,
+	0x3a7fdd86, 0x19f537a4, 0x1a17a8a5, 0x3a708906, 0x3a6b6859, 0x1a2321a2, 0x1a45868e, 0x3a5bf8d1,
+	0x3a56cf23, 0x1a50fb81, 0x1a735442, 0x3a47449c, 0x3a4211f0, 0x1a7ec524, 0x1aa111a6, 0x3a326c74,
+	0x3a2d30cd, 0x1aac7e6f, 0x1acebe9d, 0x3a1d7066, 0x3a182bc8, 0x1ada2746, 0x1afc5b0a, 0x3a08507f,
+	0x3a0302ed, 0x1b07bf8c, 0x1b29e6d2, 0x39f30ccc, 0x39edb649, 0x1b354727, 0x1b5761d8, 0x39dda55a,
+	0x39d845e9, 0x1b62bdf8, 0x1b84cc01, 0x39c81a36, 0x39c2b1da, 0x1b9023e5, 0x1bb22530, 0x39b26b6d,
+	0x39acfa2b, 0x1bbd78d2, 0x1bdf6d4a, 0x399c990d, 0x39971ee7, 0x1beabca1, 0x1c0ca432, 0x3986a324,
+	0x3981201e, 0x1c17ef39, 0x1c39c9cd, 0x397089bf, 0x396afddc, 0x1c45107c, 0x1c66ddfe, 0x395a4ceb,
+	0x3954b82e, 0x1c72204f, 0x1c93e0ab, 0x3943ecb6, 0x393e4f23, 0x1c9f1e96, 0x1cc0d1b6, 0x392d692f,
+	0x3927c2c9, 0x1ccc0b35, 0x1cedb106, 0x3916c262, 0x3911132d, 0x1cf8e611, 0x1d1a7e7d, 0x38fff85e,
+	0x38fa405e, 0x1d25af0d, 0x1d473a00, 0x38e90b31, 0x38e34a69, 0x1d52660f, 0x1d73e374, 0x38d1fae9,
+	0x38cc315d, 0x1d7f0afb, 0x1da07abc, 0x38bac795, 0x38b4f547, 0x1dab9db5, 0x1dccffbf, 0x38a37142,
+	0x389d9637, 0x1dd81e21, 0x1df9725f, 0x388bf7ff, 0x3886143b, 0x1e048c24, 0x1e25d282, 0x38745bdb,
+	0x386e6f60, 0x1e30e7a4, 0x1e52200c, 0x385c9ce3, 0x3856a7b6, 0x1e5d3084, 0x1e7e5ae2, 0x3844bb28,
+	0x383ebd4c, 0x1e8966a8, 0x1eaa82e9, 0x382cb6b7, 0x3826b030, 0x1eb589f7, 0x1ed69805, 0x38148f9f,
+	0x380e8071, 0x1ee19a54, 0x1f029a1c, 0x37fc45ef, 0x37f62e1d, 0x1f0d97a5, 0x1f2e8911, 0x37e3d9b7,
+	0x37ddb945, 0x1f3981ce, 0x1f5a64cb, 0x37cb4b04, 0x37c521f6, 0x1f6558b5, 0x1f862d2d, 0x37b299e7,
+	0x37ac6841, 0x1f911c3d, 0x1fb1e21d, 0x3799c66f, 0x37938c34, 0x1fbccc4d, 0x1fdd8381, 0x3780d0aa,
+	0x377a8ddf, 0x1fe868c8, 0x2009113c, 0x3767b8a9, 0x37616d51, 0x2013f196, 0x20348b35, 0x374e7e7b,
+	0x37482a9a, 0x203f6699, 0x205ff14f, 0x3735222f, 0x372ec5c9, 0x206ac7b8, 0x208b4372, 0x371ba3d4,
+	0x37153eee, 0x209614d9, 0x20b68181, 0x3702037c, 0x36fb9618, 0x20c14ddf, 0x20e1ab63, 0x36e84135,
+	0x36e1cb58, 0x20ec72b1, 0x210cc0fc, 0x36ce5d10, 0x36c7debd, 0x21178334, 0x2137c232, 0x36b4571b,
+	0x36add058, 0x21427f4d, 0x2162aeea, 0x369a2f69, 0x3693a038, 0x216d66e2, 0x218d870b, 0x367fe608,
+	0x36794e6e, 0x219839d8, 0x21b84a79, 0x36657b08, 0x365edb09, 0x21c2f815, 0x21e2f91a, 0x364aee7b,
+	0x3644461b, 0x21eda17f, 0x220d92d4, 0x36304070, 0x36298fb4, 0x221835fb, 0x2238178d, 0x361570f8,
+	0x360eb7e3, 0x2242b56f, 0x22628729, 0x35fa8023, 0x35f3beba, 0x226d1fc1, 0x228ce191, 0x35df6e03,
+	0x35d8a449, 0x229774d7, 0x22b726a8, 0x35c43aa7, 0x35bd68a1, 0x22c1b496, 0x22e15655, 0x35a8e621,
+	0x35a20bd3, 0x22ebdee5, 0x230b707e, 0x358d7081, 0x35868def, 0x2315f3a8, 0x23357509, 0x3571d9d9,
+	0x356aef08, 0x233ff2c8, 0x235f63dc, 0x35562239, 0x354f2f2c, 0x2369dc29, 0x23893cdd, 0x353a49b2,
+	0x35334e6f, 0x2393afb2, 0x23b2fff3, 0x351e5056, 0x35174ce0, 0x23bd6d48, 0x23dcad03, 0x35023636,
+	0x34fb2a92, 0x23e714d3, 0x240643f4, 0x34e5fb63, 0x34dee795, 0x2410a639, 0x242fc4ad, 0x34c99fef,
+	0x34c283fb, 0x243a215f, 0x24592f13, 0x34ad23eb, 0x34a5ffd5, 0x2463862c, 0x2482830d, 0x34908768,
+	0x34895b36, 0x248cd487, 0x24abc082, 0x3473ca79, 0x346c962f, 0x24b60c57, 0x24d4e757, 0x3456ed2f,
+	0x344fb0d1, 0x24df2d81, 0x24fdf775, 0x3439ef9c, 0x3432ab2e, 0x250837ed, 0x2526f0c1, 0x341cd1d2,
+	0x34158559, 0x25312b81, 0x254fd323, 0x33ff93e2, 0x33f83f62, 0x255a0823, 0x25789e80, 0x33e235df,
+	0x33dad95e, 0x2582cdbc, 0x25a152c0, 0x33c4b7db, 0x33bd535c, 0x25ab7c30, 0x25c9efca, 0x33a719e8,
+	0x339fad70, 0x25d41369, 0x25f27584, 0x33895c18, 0x3381e7ac, 0x25fc934b, 0x261ae3d6, 0x336b7e7e,
+	0x33640223, 0x2624fbbf, 0x26433aa7, 0x334d812d, 0x3345fce6, 0x264d4cac, 0x266b79dd, 0x332f6435,
+	0x3327d808, 0x267585f8, 0x2693a161, 0x331127ab, 0x3309939c, 0x269da78b, 0x26bbb119, 0x32f2cba1,
+	0x32eb2fb5, 0x26c5b14c, 0x26e3a8ec, 0x32d45029, 0x32ccac64, 0x26eda322, 0x270b88c2, 0x32b5b557,
+	0x32ae09be, 0x27157cf5, 0x27335082, 0x3296fb3d, 0x328f47d5, 0x273d3eac, 0x275b0014, 0x327821ee,
+	0x327066bc, 0x2764e82f, 0x27829760, 0x3259297d, 0x32516686, 0x278c7965, 0x27aa164c, 0x323a11fe,
+	0x32324746, 0x27b3f235, 0x27d17cc1, 0x321adb83, 0x3213090f, 0x27db5288, 0x27f8caa5, 0x31fb8620,
+	0x31f3abf5, 0x28029a45, 0x281fffe2, 0x31dc11e8, 0x31d4300b, 0x2829c954, 0x28471c5e, 0x31bc7eee,
+	0x31b49564, 0x2850df9d, 0x286e2002, 0x319ccd46, 0x3194dc14, 0x2877dd07, 0x28950ab6, 0x317cfd04,
+	0x3175042e, 0x289ec17a, 0x28bbdc61, 0x315d0e3b, 0x31550dc6, 0x28c58cdf, 0x28e294eb, 0x313d00ff,
+	0x3134f8f1, 0x28ec3f1e, 0x2909343e, 0x311cd564, 0x3114c5c0, 0x2912d81f, 0x292fba40, 0x30fc8b7d,
+	0x30f47449, 0x293957c9, 0x295626da, 0x30dc235e, 0x30d404a0, 0x295fbe06, 0x297c79f5, 0x30bb9d1c,
+	0x30b376d8, 0x29860abd, 0x29a2b378, 0x309af8ca, 0x3092cb05, 0x29ac3dd7, 0x29c8d34d, 0x307a367c,
+	0x3072013c, 0x29d2573c, 0x29eed95b, 0x30595648, 0x30511991, 0x29f856d5, 0x2a14c58b, 0x30385840,
+	0x30301418, 0x2a1e3c8a, 0x2a3a97c7, 0x30173c7a, 0x300ef0e5, 0x2a440844, 0x2a604ff5, 0x2ff6030a,
+	0x2fedb00d, 0x2a69b9ec, 0x2a85ee00, 0x2fd4ac04, 0x2fcc51a5, 0x2a8f516b, 0x2aab71d0, 0x2fb3377c,
+	0x2faad5c1, 0x2ab4cea9, 0x2ad0db4e, 0x2f91a589, 0x2f893c75, 0x2ada318e, 0x2af62a63, 0x2f6ff63d,
+	0x2f6785d7, 0x2aff7a05, 0x2b1b5ef8, 0x2f4e29af, 0x2f45b1fb, 0x2b24a7f6, 0x2b4078f5, 0x2f2c3ff2,
+	0x2f23c0f6, 0x2b49bb4a, 0x2b657844, 0x2f0a391d, 0x2f01b2de, 0x2b6eb3ea, 0x2b8a5cce, 0x2ee81543,
+	0x2edf87c6, 0x2b9391c0, 0x2baf267d, 0x2ec5d479, 0x2ebd3fc4, 0x2bb854b4, 0x2bd3d53a, 0x2ea376d6,
+	0x2e9adaee, 0x2bdcfcb0, 0x2bf868ed, 0x2e80fc6e, 0x2e785958, 0x2c01899e, 0x2c1ce181, 0x2e5e6556,
+	0x2e55bb17, 0x2c25fb66, 0x2c413edf, 0x2e3bb1a4, 0x2e330042, 0x2c4a51f3, 0x2c6580f1, 0x2e18e16d,
+	0x2e1028ed, 0x2c6e8d2e, 0x2c89a79f, 0x2df5f4c7, 0x2ded352f, 0x2c92ad01, 0x2cadb2d5, 0x2dd2ebc7,
+	0x2dca251c, 0x2cb6b155, 0x2cd1a27b, 0x2dafc683, 0x2da6f8ca, 0x2cda9a14, 0x2cf5767c, 0x2d8c8510,
 	0x2d83b04f, 0x2cfe6728, 0x2d192ec1, 0x2d692784, 0x2d604bc0, 0x2d22187a, 0x2d3ccb34, 0x2d45adf6
 };
 
 const int twidTab512[8*6 + 32*6 + 128*6] = {
-	0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x3b20d79e, 0x187de2a6, 
-	0x3ec52f9f, 0x0c7c5c1e, 0x3536cc52, 0x238e7673, 0x2d413ccc, 0x2d413ccc, 0x3b20d79e, 0x187de2a6, 
-	0x187de2a6, 0x3b20d79e, 0x187de2a6, 0x3b20d79e, 0x3536cc52, 0x238e7673, 0xf383a3e2, 0x3ec52f9f, 
-	0x00000000, 0x40000000, 0x2d413ccc, 0x2d413ccc, 0xd2bec334, 0x2d413ccc, 0xe7821d5a, 0x3b20d79e, 
-	0x238e7673, 0x3536cc52, 0xc13ad061, 0x0c7c5c1e, 0xd2bec334, 0x2d413ccc, 0x187de2a6, 0x3b20d79e, 
-	0xc4df2862, 0xe7821d5a, 0xc4df2862, 0x187de2a6, 0x0c7c5c1e, 0x3ec52f9f, 0xdc71898d, 0xcac933ae, 
+	0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x3b20d79e, 0x187de2a6,
+	0x3ec52f9f, 0x0c7c5c1e, 0x3536cc52, 0x238e7673, 0x2d413ccc, 0x2d413ccc, 0x3b20d79e, 0x187de2a6,
+	0x187de2a6, 0x3b20d79e, 0x187de2a6, 0x3b20d79e, 0x3536cc52, 0x238e7673, 0xf383a3e2, 0x3ec52f9f,
+	0x00000000, 0x40000000, 0x2d413ccc, 0x2d413ccc, 0xd2bec334, 0x2d413ccc, 0xe7821d5a, 0x3b20d79e,
+	0x238e7673, 0x3536cc52, 0xc13ad061, 0x0c7c5c1e, 0xd2bec334, 0x2d413ccc, 0x187de2a6, 0x3b20d79e,
+	0xc4df2862, 0xe7821d5a, 0xc4df2862, 0x187de2a6, 0x0c7c5c1e, 0x3ec52f9f, 0xdc71898d, 0xcac933ae,
 
-	0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x3fb11b47, 0x0645e9af, 
-	0x3fec43c6, 0x0323ecbe, 0x3f4eaafe, 0x09640837, 0x3ec52f9f, 0x0c7c5c1e, 0x3fb11b47, 0x0645e9af, 
-	0x3d3e82ad, 0x1294062e, 0x3d3e82ad, 0x1294062e, 0x3f4eaafe, 0x09640837, 0x39daf5e8, 0x1b5d1009, 
-	0x3b20d79e, 0x187de2a6, 0x3ec52f9f, 0x0c7c5c1e, 0x3536cc52, 0x238e7673, 0x387165e3, 0x1e2b5d38, 
-	0x3e14fdf7, 0x0f8cfcbd, 0x2f6bbe44, 0x2afad269, 0x3536cc52, 0x238e7673, 0x3d3e82ad, 0x1294062e, 
-	0x2899e64a, 0x317900d6, 0x317900d6, 0x2899e64a, 0x3c424209, 0x158f9a75, 0x20e70f32, 0x36e5068a, 
-	0x2d413ccc, 0x2d413ccc, 0x3b20d79e, 0x187de2a6, 0x187de2a6, 0x3b20d79e, 0x2899e64a, 0x317900d6, 
-	0x39daf5e8, 0x1b5d1009, 0x0f8cfcbd, 0x3e14fdf7, 0x238e7673, 0x3536cc52, 0x387165e3, 0x1e2b5d38, 
-	0x0645e9af, 0x3fb11b47, 0x1e2b5d38, 0x387165e3, 0x36e5068a, 0x20e70f32, 0xfcdc1342, 0x3fec43c6, 
-	0x187de2a6, 0x3b20d79e, 0x3536cc52, 0x238e7673, 0xf383a3e2, 0x3ec52f9f, 0x1294062e, 0x3d3e82ad, 
-	0x3367c08f, 0x261feff9, 0xea70658b, 0x3c424209, 0x0c7c5c1e, 0x3ec52f9f, 0x317900d6, 0x2899e64a, 
-	0xe1d4a2c8, 0x387165e3, 0x0645e9af, 0x3fb11b47, 0x2f6bbe44, 0x2afad269, 0xd9e01007, 0x3367c08f, 
-	0x00000000, 0x40000000, 0x2d413ccc, 0x2d413ccc, 0xd2bec334, 0x2d413ccc, 0xf9ba1651, 0x3fb11b47, 
-	0x2afad269, 0x2f6bbe44, 0xcc983f71, 0x261feff9, 0xf383a3e2, 0x3ec52f9f, 0x2899e64a, 0x317900d6, 
-	0xc78e9a1d, 0x1e2b5d38, 0xed6bf9d2, 0x3d3e82ad, 0x261feff9, 0x3367c08f, 0xc3bdbdf7, 0x158f9a75, 
-	0xe7821d5a, 0x3b20d79e, 0x238e7673, 0x3536cc52, 0xc13ad061, 0x0c7c5c1e, 0xe1d4a2c8, 0x387165e3, 
-	0x20e70f32, 0x36e5068a, 0xc013bc3a, 0x0323ecbe, 0xdc71898d, 0x3536cc52, 0x1e2b5d38, 0x387165e3, 
-	0xc04ee4b9, 0xf9ba1651, 0xd76619b6, 0x317900d6, 0x1b5d1009, 0x39daf5e8, 0xc1eb0209, 0xf0730343, 
-	0xd2bec334, 0x2d413ccc, 0x187de2a6, 0x3b20d79e, 0xc4df2862, 0xe7821d5a, 0xce86ff2a, 0x2899e64a, 
-	0x158f9a75, 0x3c424209, 0xc91af976, 0xdf18f0ce, 0xcac933ae, 0x238e7673, 0x1294062e, 0x3d3e82ad, 
-	0xce86ff2a, 0xd76619b6, 0xc78e9a1d, 0x1e2b5d38, 0x0f8cfcbd, 0x3e14fdf7, 0xd5052d97, 0xd09441bc, 
-	0xc4df2862, 0x187de2a6, 0x0c7c5c1e, 0x3ec52f9f, 0xdc71898d, 0xcac933ae, 0xc2c17d53, 0x1294062e, 
-	0x09640837, 0x3f4eaafe, 0xe4a2eff7, 0xc6250a18, 0xc13ad061, 0x0c7c5c1e, 0x0645e9af, 0x3fb11b47, 
-	0xed6bf9d2, 0xc2c17d53, 0xc04ee4b9, 0x0645e9af, 0x0323ecbe, 0x3fec43c6, 0xf69bf7c9, 0xc0b15502, 
+	0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x3fb11b47, 0x0645e9af,
+	0x3fec43c6, 0x0323ecbe, 0x3f4eaafe, 0x09640837, 0x3ec52f9f, 0x0c7c5c1e, 0x3fb11b47, 0x0645e9af,
+	0x3d3e82ad, 0x1294062e, 0x3d3e82ad, 0x1294062e, 0x3f4eaafe, 0x09640837, 0x39daf5e8, 0x1b5d1009,
+	0x3b20d79e, 0x187de2a6, 0x3ec52f9f, 0x0c7c5c1e, 0x3536cc52, 0x238e7673, 0x387165e3, 0x1e2b5d38,
+	0x3e14fdf7, 0x0f8cfcbd, 0x2f6bbe44, 0x2afad269, 0x3536cc52, 0x238e7673, 0x3d3e82ad, 0x1294062e,
+	0x2899e64a, 0x317900d6, 0x317900d6, 0x2899e64a, 0x3c424209, 0x158f9a75, 0x20e70f32, 0x36e5068a,
+	0x2d413ccc, 0x2d413ccc, 0x3b20d79e, 0x187de2a6, 0x187de2a6, 0x3b20d79e, 0x2899e64a, 0x317900d6,
+	0x39daf5e8, 0x1b5d1009, 0x0f8cfcbd, 0x3e14fdf7, 0x238e7673, 0x3536cc52, 0x387165e3, 0x1e2b5d38,
+	0x0645e9af, 0x3fb11b47, 0x1e2b5d38, 0x387165e3, 0x36e5068a, 0x20e70f32, 0xfcdc1342, 0x3fec43c6,
+	0x187de2a6, 0x3b20d79e, 0x3536cc52, 0x238e7673, 0xf383a3e2, 0x3ec52f9f, 0x1294062e, 0x3d3e82ad,
+	0x3367c08f, 0x261feff9, 0xea70658b, 0x3c424209, 0x0c7c5c1e, 0x3ec52f9f, 0x317900d6, 0x2899e64a,
+	0xe1d4a2c8, 0x387165e3, 0x0645e9af, 0x3fb11b47, 0x2f6bbe44, 0x2afad269, 0xd9e01007, 0x3367c08f,
+	0x00000000, 0x40000000, 0x2d413ccc, 0x2d413ccc, 0xd2bec334, 0x2d413ccc, 0xf9ba1651, 0x3fb11b47,
+	0x2afad269, 0x2f6bbe44, 0xcc983f71, 0x261feff9, 0xf383a3e2, 0x3ec52f9f, 0x2899e64a, 0x317900d6,
+	0xc78e9a1d, 0x1e2b5d38, 0xed6bf9d2, 0x3d3e82ad, 0x261feff9, 0x3367c08f, 0xc3bdbdf7, 0x158f9a75,
+	0xe7821d5a, 0x3b20d79e, 0x238e7673, 0x3536cc52, 0xc13ad061, 0x0c7c5c1e, 0xe1d4a2c8, 0x387165e3,
+	0x20e70f32, 0x36e5068a, 0xc013bc3a, 0x0323ecbe, 0xdc71898d, 0x3536cc52, 0x1e2b5d38, 0x387165e3,
+	0xc04ee4b9, 0xf9ba1651, 0xd76619b6, 0x317900d6, 0x1b5d1009, 0x39daf5e8, 0xc1eb0209, 0xf0730343,
+	0xd2bec334, 0x2d413ccc, 0x187de2a6, 0x3b20d79e, 0xc4df2862, 0xe7821d5a, 0xce86ff2a, 0x2899e64a,
+	0x158f9a75, 0x3c424209, 0xc91af976, 0xdf18f0ce, 0xcac933ae, 0x238e7673, 0x1294062e, 0x3d3e82ad,
+	0xce86ff2a, 0xd76619b6, 0xc78e9a1d, 0x1e2b5d38, 0x0f8cfcbd, 0x3e14fdf7, 0xd5052d97, 0xd09441bc,
+	0xc4df2862, 0x187de2a6, 0x0c7c5c1e, 0x3ec52f9f, 0xdc71898d, 0xcac933ae, 0xc2c17d53, 0x1294062e,
+	0x09640837, 0x3f4eaafe, 0xe4a2eff7, 0xc6250a18, 0xc13ad061, 0x0c7c5c1e, 0x0645e9af, 0x3fb11b47,
+	0xed6bf9d2, 0xc2c17d53, 0xc04ee4b9, 0x0645e9af, 0x0323ecbe, 0x3fec43c6, 0xf69bf7c9, 0xc0b15502,
 
-	0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x3ffb10c1, 0x0192155f, 
-	0x3ffec42d, 0x00c90e8f, 0x3ff4e5df, 0x025b0cae, 0x3fec43c6, 0x0323ecbe, 0x3ffb10c1, 0x0192155f, 
-	0x3fd39b5a, 0x04b54824, 0x3fd39b5a, 0x04b54824, 0x3ff4e5df, 0x025b0cae, 0x3f9c2bfa, 0x070de171, 
-	0x3fb11b47, 0x0645e9af, 0x3fec43c6, 0x0323ecbe, 0x3f4eaafe, 0x09640837, 0x3f84c8e1, 0x07d59395, 
-	0x3fe12acb, 0x03ecadcf, 0x3eeb3347, 0x0bb6ecef, 0x3f4eaafe, 0x09640837, 0x3fd39b5a, 0x04b54824, 
-	0x3e71e758, 0x0e05c135, 0x3f0ec9f4, 0x0af10a22, 0x3fc395f9, 0x057db402, 0x3de2f147, 0x104fb80e, 
-	0x3ec52f9f, 0x0c7c5c1e, 0x3fb11b47, 0x0645e9af, 0x3d3e82ad, 0x1294062e, 0x3e71e758, 0x0e05c135, 
-	0x3f9c2bfa, 0x070de171, 0x3c84d496, 0x14d1e242, 0x3e14fdf7, 0x0f8cfcbd, 0x3f84c8e1, 0x07d59395, 
-	0x3bb6276d, 0x17088530, 0x3dae81ce, 0x1111d262, 0x3f6af2e3, 0x089cf867, 0x3ad2c2e7, 0x19372a63, 
-	0x3d3e82ad, 0x1294062e, 0x3f4eaafe, 0x09640837, 0x39daf5e8, 0x1b5d1009, 0x3cc511d8, 0x14135c94, 
-	0x3f2ff249, 0x0a2abb58, 0x38cf1669, 0x1d79775b, 0x3c424209, 0x158f9a75, 0x3f0ec9f4, 0x0af10a22, 
-	0x37af8158, 0x1f8ba4db, 0x3bb6276d, 0x17088530, 0x3eeb3347, 0x0bb6ecef, 0x367c9a7d, 0x2192e09a, 
-	0x3b20d79e, 0x187de2a6, 0x3ec52f9f, 0x0c7c5c1e, 0x3536cc52, 0x238e7673, 0x3a8269a2, 0x19ef7943, 
-	0x3e9cc076, 0x0d415012, 0x33de87de, 0x257db64b, 0x39daf5e8, 0x1b5d1009, 0x3e71e758, 0x0e05c135, 
-	0x32744493, 0x275ff452, 0x392a9642, 0x1cc66e99, 0x3e44a5ee, 0x0ec9a7f2, 0x30f8801f, 0x29348937, 
-	0x387165e3, 0x1e2b5d38, 0x3e14fdf7, 0x0f8cfcbd, 0x2f6bbe44, 0x2afad269, 0x37af8158, 0x1f8ba4db, 
-	0x3de2f147, 0x104fb80e, 0x2dce88a9, 0x2cb2324b, 0x36e5068a, 0x20e70f32, 0x3dae81ce, 0x1111d262, 
-	0x2c216eaa, 0x2e5a106f, 0x361214b0, 0x223d66a8, 0x3d77b191, 0x11d3443f, 0x2a650525, 0x2ff1d9c6, 
-	0x3536cc52, 0x238e7673, 0x3d3e82ad, 0x1294062e, 0x2899e64a, 0x317900d6, 0x34534f40, 0x24da0a99, 
-	0x3d02f756, 0x135410c2, 0x26c0b162, 0x32eefde9, 0x3367c08f, 0x261feff9, 0x3cc511d8, 0x14135c94, 
-	0x24da0a99, 0x34534f40, 0x32744493, 0x275ff452, 0x3c84d496, 0x14d1e242, 0x22e69ac7, 0x35a5793c, 
-	0x317900d6, 0x2899e64a, 0x3c424209, 0x158f9a75, 0x20e70f32, 0x36e5068a, 0x30761c17, 0x29cd9577, 
-	0x3bfd5cc4, 0x164c7ddd, 0x1edc1952, 0x3811884c, 0x2f6bbe44, 0x2afad269, 0x3bb6276d, 0x17088530, 
-	0x1cc66e99, 0x392a9642, 0x2e5a106f, 0x2c216eaa, 0x3b6ca4c4, 0x17c3a931, 0x1aa6c82b, 0x3a2fcee8, 
-	0x2d413ccc, 0x2d413ccc, 0x3b20d79e, 0x187de2a6, 0x187de2a6, 0x3b20d79e, 0x2c216eaa, 0x2e5a106f, 
-	0x3ad2c2e7, 0x19372a63, 0x164c7ddd, 0x3bfd5cc4, 0x2afad269, 0x2f6bbe44, 0x3a8269a2, 0x19ef7943, 
-	0x14135c94, 0x3cc511d8, 0x29cd9577, 0x30761c17, 0x3a2fcee8, 0x1aa6c82b, 0x11d3443f, 0x3d77b191, 
-	0x2899e64a, 0x317900d6, 0x39daf5e8, 0x1b5d1009, 0x0f8cfcbd, 0x3e14fdf7, 0x275ff452, 0x32744493, 
-	0x3983e1e7, 0x1c1249d8, 0x0d415012, 0x3e9cc076, 0x261feff9, 0x3367c08f, 0x392a9642, 0x1cc66e99, 
-	0x0af10a22, 0x3f0ec9f4, 0x24da0a99, 0x34534f40, 0x38cf1669, 0x1d79775b, 0x089cf867, 0x3f6af2e3, 
-	0x238e7673, 0x3536cc52, 0x387165e3, 0x1e2b5d38, 0x0645e9af, 0x3fb11b47, 0x223d66a8, 0x361214b0, 
-	0x3811884c, 0x1edc1952, 0x03ecadcf, 0x3fe12acb, 0x20e70f32, 0x36e5068a, 0x37af8158, 0x1f8ba4db, 
-	0x0192155f, 0x3ffb10c1, 0x1f8ba4db, 0x37af8158, 0x374b54ce, 0x2039f90e, 0xff36f171, 0x3ffec42d, 
-	0x1e2b5d38, 0x387165e3, 0x36e5068a, 0x20e70f32, 0xfcdc1342, 0x3fec43c6, 0x1cc66e99, 0x392a9642, 
-	0x367c9a7d, 0x2192e09a, 0xfa824bfe, 0x3fc395f9, 0x1b5d1009, 0x39daf5e8, 0x361214b0, 0x223d66a8, 
-	0xf82a6c6b, 0x3f84c8e1, 0x19ef7943, 0x3a8269a2, 0x35a5793c, 0x22e69ac7, 0xf5d544a8, 0x3f2ff249, 
-	0x187de2a6, 0x3b20d79e, 0x3536cc52, 0x238e7673, 0xf383a3e2, 0x3ec52f9f, 0x17088530, 0x3bb6276d, 
-	0x34c61236, 0x2434f332, 0xf136580e, 0x3e44a5ee, 0x158f9a75, 0x3c424209, 0x34534f40, 0x24da0a99, 
-	0xeeee2d9e, 0x3dae81ce, 0x14135c94, 0x3cc511d8, 0x33de87de, 0x257db64b, 0xecabef3e, 0x3d02f756, 
-	0x1294062e, 0x3d3e82ad, 0x3367c08f, 0x261feff9, 0xea70658b, 0x3c424209, 0x1111d262, 0x3dae81ce, 
-	0x32eefde9, 0x26c0b162, 0xe83c56cf, 0x3b6ca4c4, 0x0f8cfcbd, 0x3e14fdf7, 0x32744493, 0x275ff452, 
-	0xe61086bd, 0x3a8269a2, 0x0e05c135, 0x3e71e758, 0x31f79947, 0x27fdb2a6, 0xe3edb628, 0x3983e1e7, 
-	0x0c7c5c1e, 0x3ec52f9f, 0x317900d6, 0x2899e64a, 0xe1d4a2c8, 0x387165e3, 0x0af10a22, 0x3f0ec9f4, 
-	0x30f8801f, 0x29348937, 0xdfc606f2, 0x374b54ce, 0x09640837, 0x3f4eaafe, 0x30761c17, 0x29cd9577, 
-	0xddc29958, 0x361214b0, 0x07d59395, 0x3f84c8e1, 0x2ff1d9c6, 0x2a650525, 0xdbcb0cce, 0x34c61236, 
-	0x0645e9af, 0x3fb11b47, 0x2f6bbe44, 0x2afad269, 0xd9e01007, 0x3367c08f, 0x04b54824, 0x3fd39b5a, 
-	0x2ee3cebe, 0x2b8ef77c, 0xd8024d5a, 0x31f79947, 0x0323ecbe, 0x3fec43c6, 0x2e5a106f, 0x2c216eaa, 
-	0xd6326a89, 0x30761c17, 0x0192155f, 0x3ffb10c1, 0x2dce88a9, 0x2cb2324b, 0xd4710884, 0x2ee3cebe, 
-	0x00000000, 0x40000000, 0x2d413ccc, 0x2d413ccc, 0xd2bec334, 0x2d413ccc, 0xfe6deaa1, 0x3ffb10c1, 
-	0x2cb2324b, 0x2dce88a9, 0xd11c3142, 0x2b8ef77c, 0xfcdc1342, 0x3fec43c6, 0x2c216eaa, 0x2e5a106f, 
-	0xcf89e3e9, 0x29cd9577, 0xfb4ab7dc, 0x3fd39b5a, 0x2b8ef77c, 0x2ee3cebe, 0xce0866b9, 0x27fdb2a6, 
-	0xf9ba1651, 0x3fb11b47, 0x2afad269, 0x2f6bbe44, 0xcc983f71, 0x261feff9, 0xf82a6c6b, 0x3f84c8e1, 
-	0x2a650525, 0x2ff1d9c6, 0xcb39edca, 0x2434f332, 0xf69bf7c9, 0x3f4eaafe, 0x29cd9577, 0x30761c17, 
-	0xc9edeb50, 0x223d66a8, 0xf50ef5de, 0x3f0ec9f4, 0x29348937, 0x30f8801f, 0xc8b4ab32, 0x2039f90e, 
-	0xf383a3e2, 0x3ec52f9f, 0x2899e64a, 0x317900d6, 0xc78e9a1d, 0x1e2b5d38, 0xf1fa3ecb, 0x3e71e758, 
-	0x27fdb2a6, 0x31f79947, 0xc67c1e19, 0x1c1249d8, 0xf0730343, 0x3e14fdf7, 0x275ff452, 0x32744493, 
-	0xc57d965e, 0x19ef7943, 0xeeee2d9e, 0x3dae81ce, 0x26c0b162, 0x32eefde9, 0xc4935b3c, 0x17c3a931, 
-	0xed6bf9d2, 0x3d3e82ad, 0x261feff9, 0x3367c08f, 0xc3bdbdf7, 0x158f9a75, 0xebeca36c, 0x3cc511d8, 
-	0x257db64b, 0x33de87de, 0xc2fd08aa, 0x135410c2, 0xea70658b, 0x3c424209, 0x24da0a99, 0x34534f40, 
-	0xc2517e32, 0x1111d262, 0xe8f77ad0, 0x3bb6276d, 0x2434f332, 0x34c61236, 0xc1bb5a12, 0x0ec9a7f2, 
-	0xe7821d5a, 0x3b20d79e, 0x238e7673, 0x3536cc52, 0xc13ad061, 0x0c7c5c1e, 0xe61086bd, 0x3a8269a2, 
-	0x22e69ac7, 0x35a5793c, 0xc0d00db7, 0x0a2abb58, 0xe4a2eff7, 0x39daf5e8, 0x223d66a8, 0x361214b0, 
-	0xc07b371f, 0x07d59395, 0xe3399167, 0x392a9642, 0x2192e09a, 0x367c9a7d, 0xc03c6a07, 0x057db402, 
-	0xe1d4a2c8, 0x387165e3, 0x20e70f32, 0x36e5068a, 0xc013bc3a, 0x0323ecbe, 0xe0745b25, 0x37af8158, 
-	0x2039f90e, 0x374b54ce, 0xc0013bd3, 0x00c90e8f, 0xdf18f0ce, 0x36e5068a, 0x1f8ba4db, 0x37af8158, 
-	0xc004ef3f, 0xfe6deaa1, 0xddc29958, 0x361214b0, 0x1edc1952, 0x3811884c, 0xc01ed535, 0xfc135231, 
-	0xdc71898d, 0x3536cc52, 0x1e2b5d38, 0x387165e3, 0xc04ee4b9, 0xf9ba1651, 0xdb25f567, 0x34534f40, 
-	0x1d79775b, 0x38cf1669, 0xc0950d1d, 0xf7630799, 0xd9e01007, 0x3367c08f, 0x1cc66e99, 0x392a9642, 
-	0xc0f1360c, 0xf50ef5de, 0xd8a00bae, 0x32744493, 0x1c1249d8, 0x3983e1e7, 0xc1633f8a, 0xf2beafee, 
-	0xd76619b6, 0x317900d6, 0x1b5d1009, 0x39daf5e8, 0xc1eb0209, 0xf0730343, 0xd6326a89, 0x30761c17, 
-	0x1aa6c82b, 0x3a2fcee8, 0xc2884e6f, 0xee2cbbc1, 0xd5052d97, 0x2f6bbe44, 0x19ef7943, 0x3a8269a2, 
-	0xc33aee28, 0xebeca36c, 0xd3de9156, 0x2e5a106f, 0x19372a63, 0x3ad2c2e7, 0xc402a33c, 0xe9b38223, 
-	0xd2bec334, 0x2d413ccc, 0x187de2a6, 0x3b20d79e, 0xc4df2862, 0xe7821d5a, 0xd1a5ef91, 0x2c216eaa, 
-	0x17c3a931, 0x3b6ca4c4, 0xc5d03118, 0xe55937d5, 0xd09441bc, 0x2afad269, 0x17088530, 0x3bb6276d, 
-	0xc6d569be, 0xe3399167, 0xcf89e3e9, 0x29cd9577, 0x164c7ddd, 0x3bfd5cc4, 0xc7ee77b4, 0xe123e6ae, 
-	0xce86ff2a, 0x2899e64a, 0x158f9a75, 0x3c424209, 0xc91af976, 0xdf18f0ce, 0xcd8bbb6d, 0x275ff452, 
-	0x14d1e242, 0x3c84d496, 0xca5a86c4, 0xdd196539, 0xcc983f71, 0x261feff9, 0x14135c94, 0x3cc511d8, 
-	0xcbacb0c0, 0xdb25f567, 0xcbacb0c0, 0x24da0a99, 0x135410c2, 0x3d02f756, 0xcd110217, 0xd93f4e9e, 
-	0xcac933ae, 0x238e7673, 0x1294062e, 0x3d3e82ad, 0xce86ff2a, 0xd76619b6, 0xc9edeb50, 0x223d66a8, 
-	0x11d3443f, 0x3d77b191, 0xd00e263a, 0xd59afadb, 0xc91af976, 0x20e70f32, 0x1111d262, 0x3dae81ce, 
-	0xd1a5ef91, 0xd3de9156, 0xc8507ea8, 0x1f8ba4db, 0x104fb80e, 0x3de2f147, 0xd34dcdb5, 0xd2317757, 
-	0xc78e9a1d, 0x1e2b5d38, 0x0f8cfcbd, 0x3e14fdf7, 0xd5052d97, 0xd09441bc, 0xc6d569be, 0x1cc66e99, 
-	0x0ec9a7f2, 0x3e44a5ee, 0xd6cb76c9, 0xcf077fe1, 0xc6250a18, 0x1b5d1009, 0x0e05c135, 0x3e71e758, 
-	0xd8a00bae, 0xcd8bbb6d, 0xc57d965e, 0x19ef7943, 0x0d415012, 0x3e9cc076, 0xda8249b5, 0xcc217822, 
-	0xc4df2862, 0x187de2a6, 0x0c7c5c1e, 0x3ec52f9f, 0xdc71898d, 0xcac933ae, 0xc449d893, 0x17088530, 
-	0x0bb6ecef, 0x3eeb3347, 0xde6d1f66, 0xc9836583, 0xc3bdbdf7, 0x158f9a75, 0x0af10a22, 0x3f0ec9f4, 
-	0xe0745b25, 0xc8507ea8, 0xc33aee28, 0x14135c94, 0x0a2abb58, 0x3f2ff249, 0xe28688a5, 0xc730e997, 
-	0xc2c17d53, 0x1294062e, 0x09640837, 0x3f4eaafe, 0xe4a2eff7, 0xc6250a18, 0xc2517e32, 0x1111d262, 
-	0x089cf867, 0x3f6af2e3, 0xe6c8d59d, 0xc52d3d19, 0xc1eb0209, 0x0f8cfcbd, 0x07d59395, 0x3f84c8e1, 
-	0xe8f77ad0, 0xc449d893, 0xc18e18a8, 0x0e05c135, 0x070de171, 0x3f9c2bfa, 0xeb2e1dbe, 0xc37b2b6a, 
-	0xc13ad061, 0x0c7c5c1e, 0x0645e9af, 0x3fb11b47, 0xed6bf9d2, 0xc2c17d53, 0xc0f1360c, 0x0af10a22, 
-	0x057db402, 0x3fc395f9, 0xefb047f2, 0xc21d0eb9, 0xc0b15502, 0x09640837, 0x04b54824, 0x3fd39b5a, 
-	0xf1fa3ecb, 0xc18e18a8, 0xc07b371f, 0x07d59395, 0x03ecadcf, 0x3fe12acb, 0xf4491311, 0xc114ccb9, 
-	0xc04ee4b9, 0x0645e9af, 0x0323ecbe, 0x3fec43c6, 0xf69bf7c9, 0xc0b15502, 0xc02c64a6, 0x04b54824, 
-	0x025b0cae, 0x3ff4e5df, 0xf8f21e8f, 0xc063d406, 0xc013bc3a, 0x0323ecbe, 0x0192155f, 0x3ffb10c1, 
+	0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x3ffb10c1, 0x0192155f,
+	0x3ffec42d, 0x00c90e8f, 0x3ff4e5df, 0x025b0cae, 0x3fec43c6, 0x0323ecbe, 0x3ffb10c1, 0x0192155f,
+	0x3fd39b5a, 0x04b54824, 0x3fd39b5a, 0x04b54824, 0x3ff4e5df, 0x025b0cae, 0x3f9c2bfa, 0x070de171,
+	0x3fb11b47, 0x0645e9af, 0x3fec43c6, 0x0323ecbe, 0x3f4eaafe, 0x09640837, 0x3f84c8e1, 0x07d59395,
+	0x3fe12acb, 0x03ecadcf, 0x3eeb3347, 0x0bb6ecef, 0x3f4eaafe, 0x09640837, 0x3fd39b5a, 0x04b54824,
+	0x3e71e758, 0x0e05c135, 0x3f0ec9f4, 0x0af10a22, 0x3fc395f9, 0x057db402, 0x3de2f147, 0x104fb80e,
+	0x3ec52f9f, 0x0c7c5c1e, 0x3fb11b47, 0x0645e9af, 0x3d3e82ad, 0x1294062e, 0x3e71e758, 0x0e05c135,
+	0x3f9c2bfa, 0x070de171, 0x3c84d496, 0x14d1e242, 0x3e14fdf7, 0x0f8cfcbd, 0x3f84c8e1, 0x07d59395,
+	0x3bb6276d, 0x17088530, 0x3dae81ce, 0x1111d262, 0x3f6af2e3, 0x089cf867, 0x3ad2c2e7, 0x19372a63,
+	0x3d3e82ad, 0x1294062e, 0x3f4eaafe, 0x09640837, 0x39daf5e8, 0x1b5d1009, 0x3cc511d8, 0x14135c94,
+	0x3f2ff249, 0x0a2abb58, 0x38cf1669, 0x1d79775b, 0x3c424209, 0x158f9a75, 0x3f0ec9f4, 0x0af10a22,
+	0x37af8158, 0x1f8ba4db, 0x3bb6276d, 0x17088530, 0x3eeb3347, 0x0bb6ecef, 0x367c9a7d, 0x2192e09a,
+	0x3b20d79e, 0x187de2a6, 0x3ec52f9f, 0x0c7c5c1e, 0x3536cc52, 0x238e7673, 0x3a8269a2, 0x19ef7943,
+	0x3e9cc076, 0x0d415012, 0x33de87de, 0x257db64b, 0x39daf5e8, 0x1b5d1009, 0x3e71e758, 0x0e05c135,
+	0x32744493, 0x275ff452, 0x392a9642, 0x1cc66e99, 0x3e44a5ee, 0x0ec9a7f2, 0x30f8801f, 0x29348937,
+	0x387165e3, 0x1e2b5d38, 0x3e14fdf7, 0x0f8cfcbd, 0x2f6bbe44, 0x2afad269, 0x37af8158, 0x1f8ba4db,
+	0x3de2f147, 0x104fb80e, 0x2dce88a9, 0x2cb2324b, 0x36e5068a, 0x20e70f32, 0x3dae81ce, 0x1111d262,
+	0x2c216eaa, 0x2e5a106f, 0x361214b0, 0x223d66a8, 0x3d77b191, 0x11d3443f, 0x2a650525, 0x2ff1d9c6,
+	0x3536cc52, 0x238e7673, 0x3d3e82ad, 0x1294062e, 0x2899e64a, 0x317900d6, 0x34534f40, 0x24da0a99,
+	0x3d02f756, 0x135410c2, 0x26c0b162, 0x32eefde9, 0x3367c08f, 0x261feff9, 0x3cc511d8, 0x14135c94,
+	0x24da0a99, 0x34534f40, 0x32744493, 0x275ff452, 0x3c84d496, 0x14d1e242, 0x22e69ac7, 0x35a5793c,
+	0x317900d6, 0x2899e64a, 0x3c424209, 0x158f9a75, 0x20e70f32, 0x36e5068a, 0x30761c17, 0x29cd9577,
+	0x3bfd5cc4, 0x164c7ddd, 0x1edc1952, 0x3811884c, 0x2f6bbe44, 0x2afad269, 0x3bb6276d, 0x17088530,
+	0x1cc66e99, 0x392a9642, 0x2e5a106f, 0x2c216eaa, 0x3b6ca4c4, 0x17c3a931, 0x1aa6c82b, 0x3a2fcee8,
+	0x2d413ccc, 0x2d413ccc, 0x3b20d79e, 0x187de2a6, 0x187de2a6, 0x3b20d79e, 0x2c216eaa, 0x2e5a106f,
+	0x3ad2c2e7, 0x19372a63, 0x164c7ddd, 0x3bfd5cc4, 0x2afad269, 0x2f6bbe44, 0x3a8269a2, 0x19ef7943,
+	0x14135c94, 0x3cc511d8, 0x29cd9577, 0x30761c17, 0x3a2fcee8, 0x1aa6c82b, 0x11d3443f, 0x3d77b191,
+	0x2899e64a, 0x317900d6, 0x39daf5e8, 0x1b5d1009, 0x0f8cfcbd, 0x3e14fdf7, 0x275ff452, 0x32744493,
+	0x3983e1e7, 0x1c1249d8, 0x0d415012, 0x3e9cc076, 0x261feff9, 0x3367c08f, 0x392a9642, 0x1cc66e99,
+	0x0af10a22, 0x3f0ec9f4, 0x24da0a99, 0x34534f40, 0x38cf1669, 0x1d79775b, 0x089cf867, 0x3f6af2e3,
+	0x238e7673, 0x3536cc52, 0x387165e3, 0x1e2b5d38, 0x0645e9af, 0x3fb11b47, 0x223d66a8, 0x361214b0,
+	0x3811884c, 0x1edc1952, 0x03ecadcf, 0x3fe12acb, 0x20e70f32, 0x36e5068a, 0x37af8158, 0x1f8ba4db,
+	0x0192155f, 0x3ffb10c1, 0x1f8ba4db, 0x37af8158, 0x374b54ce, 0x2039f90e, 0xff36f171, 0x3ffec42d,
+	0x1e2b5d38, 0x387165e3, 0x36e5068a, 0x20e70f32, 0xfcdc1342, 0x3fec43c6, 0x1cc66e99, 0x392a9642,
+	0x367c9a7d, 0x2192e09a, 0xfa824bfe, 0x3fc395f9, 0x1b5d1009, 0x39daf5e8, 0x361214b0, 0x223d66a8,
+	0xf82a6c6b, 0x3f84c8e1, 0x19ef7943, 0x3a8269a2, 0x35a5793c, 0x22e69ac7, 0xf5d544a8, 0x3f2ff249,
+	0x187de2a6, 0x3b20d79e, 0x3536cc52, 0x238e7673, 0xf383a3e2, 0x3ec52f9f, 0x17088530, 0x3bb6276d,
+	0x34c61236, 0x2434f332, 0xf136580e, 0x3e44a5ee, 0x158f9a75, 0x3c424209, 0x34534f40, 0x24da0a99,
+	0xeeee2d9e, 0x3dae81ce, 0x14135c94, 0x3cc511d8, 0x33de87de, 0x257db64b, 0xecabef3e, 0x3d02f756,
+	0x1294062e, 0x3d3e82ad, 0x3367c08f, 0x261feff9, 0xea70658b, 0x3c424209, 0x1111d262, 0x3dae81ce,
+	0x32eefde9, 0x26c0b162, 0xe83c56cf, 0x3b6ca4c4, 0x0f8cfcbd, 0x3e14fdf7, 0x32744493, 0x275ff452,
+	0xe61086bd, 0x3a8269a2, 0x0e05c135, 0x3e71e758, 0x31f79947, 0x27fdb2a6, 0xe3edb628, 0x3983e1e7,
+	0x0c7c5c1e, 0x3ec52f9f, 0x317900d6, 0x2899e64a, 0xe1d4a2c8, 0x387165e3, 0x0af10a22, 0x3f0ec9f4,
+	0x30f8801f, 0x29348937, 0xdfc606f2, 0x374b54ce, 0x09640837, 0x3f4eaafe, 0x30761c17, 0x29cd9577,
+	0xddc29958, 0x361214b0, 0x07d59395, 0x3f84c8e1, 0x2ff1d9c6, 0x2a650525, 0xdbcb0cce, 0x34c61236,
+	0x0645e9af, 0x3fb11b47, 0x2f6bbe44, 0x2afad269, 0xd9e01007, 0x3367c08f, 0x04b54824, 0x3fd39b5a,
+	0x2ee3cebe, 0x2b8ef77c, 0xd8024d5a, 0x31f79947, 0x0323ecbe, 0x3fec43c6, 0x2e5a106f, 0x2c216eaa,
+	0xd6326a89, 0x30761c17, 0x0192155f, 0x3ffb10c1, 0x2dce88a9, 0x2cb2324b, 0xd4710884, 0x2ee3cebe,
+	0x00000000, 0x40000000, 0x2d413ccc, 0x2d413ccc, 0xd2bec334, 0x2d413ccc, 0xfe6deaa1, 0x3ffb10c1,
+	0x2cb2324b, 0x2dce88a9, 0xd11c3142, 0x2b8ef77c, 0xfcdc1342, 0x3fec43c6, 0x2c216eaa, 0x2e5a106f,
+	0xcf89e3e9, 0x29cd9577, 0xfb4ab7dc, 0x3fd39b5a, 0x2b8ef77c, 0x2ee3cebe, 0xce0866b9, 0x27fdb2a6,
+	0xf9ba1651, 0x3fb11b47, 0x2afad269, 0x2f6bbe44, 0xcc983f71, 0x261feff9, 0xf82a6c6b, 0x3f84c8e1,
+	0x2a650525, 0x2ff1d9c6, 0xcb39edca, 0x2434f332, 0xf69bf7c9, 0x3f4eaafe, 0x29cd9577, 0x30761c17,
+	0xc9edeb50, 0x223d66a8, 0xf50ef5de, 0x3f0ec9f4, 0x29348937, 0x30f8801f, 0xc8b4ab32, 0x2039f90e,
+	0xf383a3e2, 0x3ec52f9f, 0x2899e64a, 0x317900d6, 0xc78e9a1d, 0x1e2b5d38, 0xf1fa3ecb, 0x3e71e758,
+	0x27fdb2a6, 0x31f79947, 0xc67c1e19, 0x1c1249d8, 0xf0730343, 0x3e14fdf7, 0x275ff452, 0x32744493,
+	0xc57d965e, 0x19ef7943, 0xeeee2d9e, 0x3dae81ce, 0x26c0b162, 0x32eefde9, 0xc4935b3c, 0x17c3a931,
+	0xed6bf9d2, 0x3d3e82ad, 0x261feff9, 0x3367c08f, 0xc3bdbdf7, 0x158f9a75, 0xebeca36c, 0x3cc511d8,
+	0x257db64b, 0x33de87de, 0xc2fd08aa, 0x135410c2, 0xea70658b, 0x3c424209, 0x24da0a99, 0x34534f40,
+	0xc2517e32, 0x1111d262, 0xe8f77ad0, 0x3bb6276d, 0x2434f332, 0x34c61236, 0xc1bb5a12, 0x0ec9a7f2,
+	0xe7821d5a, 0x3b20d79e, 0x238e7673, 0x3536cc52, 0xc13ad061, 0x0c7c5c1e, 0xe61086bd, 0x3a8269a2,
+	0x22e69ac7, 0x35a5793c, 0xc0d00db7, 0x0a2abb58, 0xe4a2eff7, 0x39daf5e8, 0x223d66a8, 0x361214b0,
+	0xc07b371f, 0x07d59395, 0xe3399167, 0x392a9642, 0x2192e09a, 0x367c9a7d, 0xc03c6a07, 0x057db402,
+	0xe1d4a2c8, 0x387165e3, 0x20e70f32, 0x36e5068a, 0xc013bc3a, 0x0323ecbe, 0xe0745b25, 0x37af8158,
+	0x2039f90e, 0x374b54ce, 0xc0013bd3, 0x00c90e8f, 0xdf18f0ce, 0x36e5068a, 0x1f8ba4db, 0x37af8158,
+	0xc004ef3f, 0xfe6deaa1, 0xddc29958, 0x361214b0, 0x1edc1952, 0x3811884c, 0xc01ed535, 0xfc135231,
+	0xdc71898d, 0x3536cc52, 0x1e2b5d38, 0x387165e3, 0xc04ee4b9, 0xf9ba1651, 0xdb25f567, 0x34534f40,
+	0x1d79775b, 0x38cf1669, 0xc0950d1d, 0xf7630799, 0xd9e01007, 0x3367c08f, 0x1cc66e99, 0x392a9642,
+	0xc0f1360c, 0xf50ef5de, 0xd8a00bae, 0x32744493, 0x1c1249d8, 0x3983e1e7, 0xc1633f8a, 0xf2beafee,
+	0xd76619b6, 0x317900d6, 0x1b5d1009, 0x39daf5e8, 0xc1eb0209, 0xf0730343, 0xd6326a89, 0x30761c17,
+	0x1aa6c82b, 0x3a2fcee8, 0xc2884e6f, 0xee2cbbc1, 0xd5052d97, 0x2f6bbe44, 0x19ef7943, 0x3a8269a2,
+	0xc33aee28, 0xebeca36c, 0xd3de9156, 0x2e5a106f, 0x19372a63, 0x3ad2c2e7, 0xc402a33c, 0xe9b38223,
+	0xd2bec334, 0x2d413ccc, 0x187de2a6, 0x3b20d79e, 0xc4df2862, 0xe7821d5a, 0xd1a5ef91, 0x2c216eaa,
+	0x17c3a931, 0x3b6ca4c4, 0xc5d03118, 0xe55937d5, 0xd09441bc, 0x2afad269, 0x17088530, 0x3bb6276d,
+	0xc6d569be, 0xe3399167, 0xcf89e3e9, 0x29cd9577, 0x164c7ddd, 0x3bfd5cc4, 0xc7ee77b4, 0xe123e6ae,
+	0xce86ff2a, 0x2899e64a, 0x158f9a75, 0x3c424209, 0xc91af976, 0xdf18f0ce, 0xcd8bbb6d, 0x275ff452,
+	0x14d1e242, 0x3c84d496, 0xca5a86c4, 0xdd196539, 0xcc983f71, 0x261feff9, 0x14135c94, 0x3cc511d8,
+	0xcbacb0c0, 0xdb25f567, 0xcbacb0c0, 0x24da0a99, 0x135410c2, 0x3d02f756, 0xcd110217, 0xd93f4e9e,
+	0xcac933ae, 0x238e7673, 0x1294062e, 0x3d3e82ad, 0xce86ff2a, 0xd76619b6, 0xc9edeb50, 0x223d66a8,
+	0x11d3443f, 0x3d77b191, 0xd00e263a, 0xd59afadb, 0xc91af976, 0x20e70f32, 0x1111d262, 0x3dae81ce,
+	0xd1a5ef91, 0xd3de9156, 0xc8507ea8, 0x1f8ba4db, 0x104fb80e, 0x3de2f147, 0xd34dcdb5, 0xd2317757,
+	0xc78e9a1d, 0x1e2b5d38, 0x0f8cfcbd, 0x3e14fdf7, 0xd5052d97, 0xd09441bc, 0xc6d569be, 0x1cc66e99,
+	0x0ec9a7f2, 0x3e44a5ee, 0xd6cb76c9, 0xcf077fe1, 0xc6250a18, 0x1b5d1009, 0x0e05c135, 0x3e71e758,
+	0xd8a00bae, 0xcd8bbb6d, 0xc57d965e, 0x19ef7943, 0x0d415012, 0x3e9cc076, 0xda8249b5, 0xcc217822,
+	0xc4df2862, 0x187de2a6, 0x0c7c5c1e, 0x3ec52f9f, 0xdc71898d, 0xcac933ae, 0xc449d893, 0x17088530,
+	0x0bb6ecef, 0x3eeb3347, 0xde6d1f66, 0xc9836583, 0xc3bdbdf7, 0x158f9a75, 0x0af10a22, 0x3f0ec9f4,
+	0xe0745b25, 0xc8507ea8, 0xc33aee28, 0x14135c94, 0x0a2abb58, 0x3f2ff249, 0xe28688a5, 0xc730e997,
+	0xc2c17d53, 0x1294062e, 0x09640837, 0x3f4eaafe, 0xe4a2eff7, 0xc6250a18, 0xc2517e32, 0x1111d262,
+	0x089cf867, 0x3f6af2e3, 0xe6c8d59d, 0xc52d3d19, 0xc1eb0209, 0x0f8cfcbd, 0x07d59395, 0x3f84c8e1,
+	0xe8f77ad0, 0xc449d893, 0xc18e18a8, 0x0e05c135, 0x070de171, 0x3f9c2bfa, 0xeb2e1dbe, 0xc37b2b6a,
+	0xc13ad061, 0x0c7c5c1e, 0x0645e9af, 0x3fb11b47, 0xed6bf9d2, 0xc2c17d53, 0xc0f1360c, 0x0af10a22,
+	0x057db402, 0x3fc395f9, 0xefb047f2, 0xc21d0eb9, 0xc0b15502, 0x09640837, 0x04b54824, 0x3fd39b5a,
+	0xf1fa3ecb, 0xc18e18a8, 0xc07b371f, 0x07d59395, 0x03ecadcf, 0x3fe12acb, 0xf4491311, 0xc114ccb9,
+	0xc04ee4b9, 0x0645e9af, 0x0323ecbe, 0x3fec43c6, 0xf69bf7c9, 0xc0b15502, 0xc02c64a6, 0x04b54824,
+	0x025b0cae, 0x3ff4e5df, 0xf8f21e8f, 0xc063d406, 0xc013bc3a, 0x0323ecbe, 0x0192155f, 0x3ffb10c1,
 	0xfb4ab7dc, 0xc02c64a6, 0xc004ef3f, 0x0192155f, 0x00c90e8f, 0x3ffec42d, 0xfda4f352, 0xc00b1a21
 };
 
 const int twidTab64[4*6 + 16*6] = {
-	0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x2d413ccc, 0x2d413ccc, 
-	0x3b20d79e, 0x187de2a6, 0x187de2a6, 0x3b20d79e, 0x00000000, 0x40000000, 0x2d413ccc, 0x2d413ccc, 
-	0xd2bec334, 0x2d413ccc, 0xd2bec334, 0x2d413ccc, 0x187de2a6, 0x3b20d79e, 0xc4df2862, 0xe7821d5a, 
+	0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x2d413ccc, 0x2d413ccc,
+	0x3b20d79e, 0x187de2a6, 0x187de2a6, 0x3b20d79e, 0x00000000, 0x40000000, 0x2d413ccc, 0x2d413ccc,
+	0xd2bec334, 0x2d413ccc, 0xd2bec334, 0x2d413ccc, 0x187de2a6, 0x3b20d79e, 0xc4df2862, 0xe7821d5a,
 
-	0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x3ec52f9f, 0x0c7c5c1e, 
-	0x3fb11b47, 0x0645e9af, 0x3d3e82ad, 0x1294062e, 0x3b20d79e, 0x187de2a6, 0x3ec52f9f, 0x0c7c5c1e, 
-	0x3536cc52, 0x238e7673, 0x3536cc52, 0x238e7673, 0x3d3e82ad, 0x1294062e, 0x2899e64a, 0x317900d6, 
-	0x2d413ccc, 0x2d413ccc, 0x3b20d79e, 0x187de2a6, 0x187de2a6, 0x3b20d79e, 0x238e7673, 0x3536cc52, 
-	0x387165e3, 0x1e2b5d38, 0x0645e9af, 0x3fb11b47, 0x187de2a6, 0x3b20d79e, 0x3536cc52, 0x238e7673, 
-	0xf383a3e2, 0x3ec52f9f, 0x0c7c5c1e, 0x3ec52f9f, 0x317900d6, 0x2899e64a, 0xe1d4a2c8, 0x387165e3, 
-	0x00000000, 0x40000000, 0x2d413ccc, 0x2d413ccc, 0xd2bec334, 0x2d413ccc, 0xf383a3e2, 0x3ec52f9f, 
-	0x2899e64a, 0x317900d6, 0xc78e9a1d, 0x1e2b5d38, 0xe7821d5a, 0x3b20d79e, 0x238e7673, 0x3536cc52, 
-	0xc13ad061, 0x0c7c5c1e, 0xdc71898d, 0x3536cc52, 0x1e2b5d38, 0x387165e3, 0xc04ee4b9, 0xf9ba1651, 
-	0xd2bec334, 0x2d413ccc, 0x187de2a6, 0x3b20d79e, 0xc4df2862, 0xe7821d5a, 0xcac933ae, 0x238e7673, 
-	0x1294062e, 0x3d3e82ad, 0xce86ff2a, 0xd76619b6, 0xc4df2862, 0x187de2a6, 0x0c7c5c1e, 0x3ec52f9f, 
-	0xdc71898d, 0xcac933ae, 0xc13ad061, 0x0c7c5c1e, 0x0645e9af, 0x3fb11b47, 0xed6bf9d2, 0xc2c17d53 
+	0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x40000000, 0x00000000, 0x3ec52f9f, 0x0c7c5c1e,
+	0x3fb11b47, 0x0645e9af, 0x3d3e82ad, 0x1294062e, 0x3b20d79e, 0x187de2a6, 0x3ec52f9f, 0x0c7c5c1e,
+	0x3536cc52, 0x238e7673, 0x3536cc52, 0x238e7673, 0x3d3e82ad, 0x1294062e, 0x2899e64a, 0x317900d6,
+	0x2d413ccc, 0x2d413ccc, 0x3b20d79e, 0x187de2a6, 0x187de2a6, 0x3b20d79e, 0x238e7673, 0x3536cc52,
+	0x387165e3, 0x1e2b5d38, 0x0645e9af, 0x3fb11b47, 0x187de2a6, 0x3b20d79e, 0x3536cc52, 0x238e7673,
+	0xf383a3e2, 0x3ec52f9f, 0x0c7c5c1e, 0x3ec52f9f, 0x317900d6, 0x2899e64a, 0xe1d4a2c8, 0x387165e3,
+	0x00000000, 0x40000000, 0x2d413ccc, 0x2d413ccc, 0xd2bec334, 0x2d413ccc, 0xf383a3e2, 0x3ec52f9f,
+	0x2899e64a, 0x317900d6, 0xc78e9a1d, 0x1e2b5d38, 0xe7821d5a, 0x3b20d79e, 0x238e7673, 0x3536cc52,
+	0xc13ad061, 0x0c7c5c1e, 0xdc71898d, 0x3536cc52, 0x1e2b5d38, 0x387165e3, 0xc04ee4b9, 0xf9ba1651,
+	0xd2bec334, 0x2d413ccc, 0x187de2a6, 0x3b20d79e, 0xc4df2862, 0xe7821d5a, 0xcac933ae, 0x238e7673,
+	0x1294062e, 0x3d3e82ad, 0xce86ff2a, 0xd76619b6, 0xc4df2862, 0x187de2a6, 0x0c7c5c1e, 0x3ec52f9f,
+	0xdc71898d, 0xcac933ae, 0xc13ad061, 0x0c7c5c1e, 0x0645e9af, 0x3fb11b47, 0xed6bf9d2, 0xc2c17d53
 };
 #endif  //ARMV5E
 
-const int ShortWindowSine[FRAME_LEN_SHORT/2] ={  
-	0x00c97fff, 0x025b7ffa, 0x03ed7ff1, 0x057f7fe2, 0x07117fce, 0x08a27fb5, 0x0a337f98, 0x0bc47f75, 
-	0x0d547f4e, 0x0ee47f22, 0x10737ef0, 0x12017eba, 0x138f7e7f, 0x151c7e3f, 0x16a87dfb, 0x18337db1, 
-	0x19be7d63, 0x1b477d0f, 0x1cd07cb7, 0x1e577c5a, 0x1fdd7bf9, 0x21627b92, 0x22e57b27, 0x24677ab7, 
-	0x25e87a42, 0x276879c9, 0x28e5794a, 0x2a6278c8, 0x2bdc7840, 0x2d5577b4, 0x2ecc7723, 0x3042768e, 
-	0x31b575f4, 0x33277556, 0x349774b3, 0x3604740b, 0x3770735f, 0x38d972af, 0x3a4071fa, 0x3ba57141, 
-	0x3d087083, 0x3e686fc2, 0x3fc66efb, 0x41216e31, 0x427a6d62, 0x43d16c8f, 0x45246bb8, 0x46756add, 
-	0x47c469fd, 0x490f691a, 0x4a586832, 0x4b9e6747, 0x4ce16657, 0x4e216564, 0x4f5e646c, 0x50986371, 
+const int ShortWindowSine[FRAME_LEN_SHORT/2] ={
+	0x00c97fff, 0x025b7ffa, 0x03ed7ff1, 0x057f7fe2, 0x07117fce, 0x08a27fb5, 0x0a337f98, 0x0bc47f75,
+	0x0d547f4e, 0x0ee47f22, 0x10737ef0, 0x12017eba, 0x138f7e7f, 0x151c7e3f, 0x16a87dfb, 0x18337db1,
+	0x19be7d63, 0x1b477d0f, 0x1cd07cb7, 0x1e577c5a, 0x1fdd7bf9, 0x21627b92, 0x22e57b27, 0x24677ab7,
+	0x25e87a42, 0x276879c9, 0x28e5794a, 0x2a6278c8, 0x2bdc7840, 0x2d5577b4, 0x2ecc7723, 0x3042768e,
+	0x31b575f4, 0x33277556, 0x349774b3, 0x3604740b, 0x3770735f, 0x38d972af, 0x3a4071fa, 0x3ba57141,
+	0x3d087083, 0x3e686fc2, 0x3fc66efb, 0x41216e31, 0x427a6d62, 0x43d16c8f, 0x45246bb8, 0x46756add,
+	0x47c469fd, 0x490f691a, 0x4a586832, 0x4b9e6747, 0x4ce16657, 0x4e216564, 0x4f5e646c, 0x50986371,
 	0x51cf6272, 0x5303616f, 0x54336068, 0x55605f5e, 0x568a5e50, 0x57b15d3e, 0x58d45c29, 0x59f45b10
 };
 
-const int LongWindowKBD[FRAME_LEN_LONG/2]={  
-	0x000a7fff, 0x000e7fff, 0x00127fff, 0x00157fff, 0x00197fff, 0x001c7fff, 0x00207fff, 0x00237fff, 
-	0x00267fff, 0x002a7fff, 0x002d7fff, 0x00307fff, 0x00347fff, 0x00387fff, 0x003b7fff, 0x003f7fff, 
-	0x00437fff, 0x00477fff, 0x004b7fff, 0x004f7fff, 0x00537fff, 0x00577fff, 0x005b7fff, 0x00607fff, 
-	0x00647fff, 0x00697fff, 0x006d7fff, 0x00727fff, 0x00777fff, 0x007c7fff, 0x00817fff, 0x00867fff, 
-	0x008b7fff, 0x00917fff, 0x00967fff, 0x009c7fff, 0x00a17fff, 0x00a77fff, 0x00ad7fff, 0x00b37fff, 
-	0x00b97fff, 0x00bf7fff, 0x00c67fff, 0x00cc7fff, 0x00d37fff, 0x00da7fff, 0x00e07fff, 0x00e77fff, 
-	0x00ee7fff, 0x00f57fff, 0x00fd7fff, 0x01047fff, 0x010c7fff, 0x01137fff, 0x011b7fff, 0x01237fff, 
-	0x012b7fff, 0x01337fff, 0x013c7ffe, 0x01447ffe, 0x014d7ffe, 0x01567ffe, 0x015f7ffe, 0x01687ffe, 
-	0x01717ffe, 0x017a7ffe, 0x01837ffe, 0x018d7ffe, 0x01977ffd, 0x01a17ffd, 0x01ab7ffd, 0x01b57ffd, 
-	0x01bf7ffd, 0x01ca7ffd, 0x01d47ffd, 0x01df7ffc, 0x01ea7ffc, 0x01f57ffc, 0x02007ffc, 0x020c7ffc, 
-	0x02177ffc, 0x02237ffb, 0x022f7ffb, 0x023b7ffb, 0x02477ffb, 0x02537ffb, 0x02607ffa, 0x026d7ffa, 
-	0x027a7ffa, 0x02877ffa, 0x02947ff9, 0x02a17ff9, 0x02af7ff9, 0x02bc7ff9, 0x02ca7ff8, 0x02d87ff8, 
-	0x02e77ff8, 0x02f57ff7, 0x03047ff7, 0x03127ff7, 0x03217ff6, 0x03317ff6, 0x03407ff5, 0x034f7ff5, 
-	0x035f7ff5, 0x036f7ff4, 0x037f7ff4, 0x038f7ff3, 0x03a07ff3, 0x03b07ff2, 0x03c17ff2, 0x03d27ff1, 
-	0x03e37ff1, 0x03f57ff0, 0x04067ff0, 0x04187fef, 0x042a7fef, 0x043c7fee, 0x044f7fed, 0x04617fed, 
-	0x04747fec, 0x04877feb, 0x049a7feb, 0x04ae7fea, 0x04c17fe9, 0x04d57fe9, 0x04e97fe8, 0x04fd7fe7, 
-	0x05127fe6, 0x05277fe5, 0x053b7fe5, 0x05507fe4, 0x05667fe3, 0x057b7fe2, 0x05917fe1, 0x05a77fe0, 
-	0x05bd7fdf, 0x05d37fde, 0x05ea7fdd, 0x06017fdc, 0x06187fdb, 0x062f7fda, 0x06467fd9, 0x065e7fd7, 
-	0x06767fd6, 0x068e7fd5, 0x06a67fd4, 0x06bf7fd2, 0x06d87fd1, 0x06f17fd0, 0x070a7fce, 0x07237fcd, 
-	0x073d7fcc, 0x07577fca, 0x07717fc9, 0x078c7fc7, 0x07a67fc5, 0x07c17fc4, 0x07dc7fc2, 0x07f77fc0, 
-	0x08137fbf, 0x082f7fbd, 0x084b7fbb, 0x08677fb9, 0x08847fb7, 0x08a07fb6, 0x08bd7fb4, 0x08da7fb2, 
-	0x08f87faf, 0x09167fad, 0x09347fab, 0x09527fa9, 0x09707fa7, 0x098f7fa5, 0x09ae7fa2, 0x09cd7fa0, 
-	0x09ec7f9d, 0x0a0c7f9b, 0x0a2c7f98, 0x0a4c7f96, 0x0a6c7f93, 0x0a8d7f91, 0x0aae7f8e, 0x0acf7f8b, 
-	0x0af07f88, 0x0b127f85, 0x0b337f82, 0x0b557f7f, 0x0b787f7c, 0x0b9a7f79, 0x0bbd7f76, 0x0be07f73, 
-	0x0c047f6f, 0x0c277f6c, 0x0c4b7f69, 0x0c6f7f65, 0x0c937f61, 0x0cb87f5e, 0x0cdd7f5a, 0x0d027f56, 
-	0x0d277f53, 0x0d4d7f4f, 0x0d737f4b, 0x0d997f47, 0x0dbf7f43, 0x0de67f3e, 0x0e0c7f3a, 0x0e347f36, 
-	0x0e5b7f31, 0x0e837f2d, 0x0eaa7f28, 0x0ed37f24, 0x0efb7f1f, 0x0f237f1a, 0x0f4c7f15, 0x0f757f10, 
-	0x0f9f7f0b, 0x0fc87f06, 0x0ff27f01, 0x101c7efb, 0x10477ef6, 0x10717ef0, 0x109c7eeb, 0x10c87ee5, 
-	0x10f37edf, 0x111f7eda, 0x114a7ed4, 0x11777ece, 0x11a37ec7, 0x11d07ec1, 0x11fd7ebb, 0x122a7eb4, 
-	0x12577eae, 0x12857ea7, 0x12b37ea0, 0x12e17e9a, 0x130f7e93, 0x133e7e8c, 0x136d7e84, 0x139c7e7d, 
-	0x13cc7e76, 0x13fb7e6e, 0x142b7e67, 0x145b7e5f, 0x148c7e57, 0x14bc7e4f, 0x14ed7e47, 0x151e7e3f, 
-	0x15507e37, 0x15817e2e, 0x15b37e26, 0x15e57e1d, 0x16187e14, 0x164a7e0b, 0x167d7e02, 0x16b07df9, 
-	0x16e47df0, 0x17177de6, 0x174b7ddd, 0x177f7dd3, 0x17b37dc9, 0x17e87dbf, 0x181d7db5, 0x18527dab, 
-	0x18877da1, 0x18bc7d96, 0x18f27d8c, 0x19287d81, 0x195e7d76, 0x19957d6b, 0x19cb7d60, 0x1a027d54, 
-	0x1a397d49, 0x1a717d3d, 0x1aa87d31, 0x1ae07d26, 0x1b187d19, 0x1b507d0d, 0x1b897d01, 0x1bc27cf4, 
-	0x1bfb7ce8, 0x1c347cdb, 0x1c6d7cce, 0x1ca77cc1, 0x1ce17cb3, 0x1d1b7ca6, 0x1d557c98, 0x1d8f7c8a, 
-	0x1dca7c7c, 0x1e057c6e, 0x1e407c60, 0x1e7b7c51, 0x1eb77c43, 0x1ef37c34, 0x1f2f7c25, 0x1f6b7c16, 
-	0x1fa77c06, 0x1fe47bf7, 0x20217be7, 0x205e7bd7, 0x209b7bc7, 0x20d87bb7, 0x21167ba6, 0x21547b96, 
-	0x21927b85, 0x21d07b74, 0x220e7b63, 0x224d7b52, 0x228c7b40, 0x22cb7b2e, 0x230a7b1c, 0x23497b0a, 
-	0x23897af8, 0x23c87ae6, 0x24087ad3, 0x24487ac0, 0x24897aad, 0x24c97a9a, 0x250a7a86, 0x254b7a73, 
-	0x258c7a5f, 0x25cd7a4b, 0x260e7a36, 0x26507a22, 0x26917a0d, 0x26d379f8, 0x271579e3, 0x275779ce, 
-	0x279a79b8, 0x27dc79a3, 0x281f798d, 0x28627977, 0x28a57960, 0x28e8794a, 0x292b7933, 0x296f791c, 
-	0x29b27905, 0x29f678ed, 0x2a3a78d6, 0x2a7e78be, 0x2ac278a6, 0x2b07788d, 0x2b4b7875, 0x2b90785c, 
-	0x2bd47843, 0x2c19782a, 0x2c5e7810, 0x2ca477f7, 0x2ce977dd, 0x2d2e77c3, 0x2d7477a8, 0x2dba778e, 
-	0x2dff7773, 0x2e457758, 0x2e8b773d, 0x2ed27721, 0x2f187706, 0x2f5e76ea, 0x2fa576cd, 0x2fec76b1, 
-	0x30327694, 0x30797677, 0x30c0765a, 0x3107763d, 0x314e761f, 0x31967601, 0x31dd75e3, 0x322575c5, 
-	0x326c75a6, 0x32b47588, 0x32fc7569, 0x33447549, 0x338c752a, 0x33d4750a, 0x341c74ea, 0x346474ca, 
-	0x34ac74a9, 0x34f57488, 0x353d7467, 0x35857446, 0x35ce7424, 0x36177403, 0x365f73e1, 0x36a873be, 
-	0x36f1739c, 0x373a7379, 0x37837356, 0x37cc7333, 0x3815730f, 0x385e72ec, 0x38a772c8, 0x38f172a3, 
-	0x393a727f, 0x3983725a, 0x39cd7235, 0x3a167210, 0x3a6071ea, 0x3aa971c4, 0x3af3719e, 0x3b3c7178, 
-	0x3b867151, 0x3bd0712b, 0x3c197104, 0x3c6370dc, 0x3cad70b5, 0x3cf7708d, 0x3d407065, 0x3d8a703c, 
-	0x3dd47014, 0x3e1e6feb, 0x3e686fc2, 0x3eb16f98, 0x3efb6f6f, 0x3f456f45, 0x3f8f6f1b, 0x3fd96ef0, 
-	0x40236ec6, 0x406d6e9b, 0x40b66e70, 0x41006e44, 0x414a6e19, 0x41946ded, 0x41de6dc1, 0x42286d94, 
-	0x42716d68, 0x42bb6d3b, 0x43056d0d, 0x434f6ce0, 0x43986cb2, 0x43e26c84, 0x442c6c56, 0x44756c28, 
-	0x44bf6bf9, 0x45086bca, 0x45526b9b, 0x459b6b6b, 0x45e56b3c, 0x462e6b0c, 0x46786adb, 0x46c16aab, 
-	0x470a6a7a, 0x47536a49, 0x479c6a18, 0x47e569e7, 0x482e69b5, 0x48776983, 0x48c06951, 0x4909691e, 
-	0x495268ec, 0x499b68b9, 0x49e36885, 0x4a2c6852, 0x4a74681e, 0x4abd67ea, 0x4b0567b6, 0x4b4d6782, 
-	0x4b95674d, 0x4bde6718, 0x4c2666e3, 0x4c6d66ae, 0x4cb56678, 0x4cfd6642, 0x4d45660c, 0x4d8c65d6, 
-	0x4dd4659f, 0x4e1b6568, 0x4e626531, 0x4ea964fa, 0x4ef064c3, 0x4f37648b, 0x4f7e6453, 0x4fc5641b, 
-	0x500b63e2, 0x505263aa, 0x50986371, 0x50df6338, 0x512562fe, 0x516b62c5, 0x51b1628b, 0x51f66251, 
-	0x523c6217, 0x528161dc, 0x52c761a2, 0x530c6167, 0x5351612c, 0x539660f1, 0x53db60b5, 0x54206079, 
-	0x5464603d, 0x54a96001, 0x54ed5fc5, 0x55315f88, 0x55755f4b, 0x55b95f0e, 0x55fc5ed1, 0x56405e94, 
-	0x56835e56, 0x56c75e18, 0x570a5dda, 0x574d5d9c, 0x578f5d5e, 0x57d25d1f, 0x58145ce0, 0x58565ca1, 
+const int LongWindowKBD[FRAME_LEN_LONG/2]={
+	0x000a7fff, 0x000e7fff, 0x00127fff, 0x00157fff, 0x00197fff, 0x001c7fff, 0x00207fff, 0x00237fff,
+	0x00267fff, 0x002a7fff, 0x002d7fff, 0x00307fff, 0x00347fff, 0x00387fff, 0x003b7fff, 0x003f7fff,
+	0x00437fff, 0x00477fff, 0x004b7fff, 0x004f7fff, 0x00537fff, 0x00577fff, 0x005b7fff, 0x00607fff,
+	0x00647fff, 0x00697fff, 0x006d7fff, 0x00727fff, 0x00777fff, 0x007c7fff, 0x00817fff, 0x00867fff,
+	0x008b7fff, 0x00917fff, 0x00967fff, 0x009c7fff, 0x00a17fff, 0x00a77fff, 0x00ad7fff, 0x00b37fff,
+	0x00b97fff, 0x00bf7fff, 0x00c67fff, 0x00cc7fff, 0x00d37fff, 0x00da7fff, 0x00e07fff, 0x00e77fff,
+	0x00ee7fff, 0x00f57fff, 0x00fd7fff, 0x01047fff, 0x010c7fff, 0x01137fff, 0x011b7fff, 0x01237fff,
+	0x012b7fff, 0x01337fff, 0x013c7ffe, 0x01447ffe, 0x014d7ffe, 0x01567ffe, 0x015f7ffe, 0x01687ffe,
+	0x01717ffe, 0x017a7ffe, 0x01837ffe, 0x018d7ffe, 0x01977ffd, 0x01a17ffd, 0x01ab7ffd, 0x01b57ffd,
+	0x01bf7ffd, 0x01ca7ffd, 0x01d47ffd, 0x01df7ffc, 0x01ea7ffc, 0x01f57ffc, 0x02007ffc, 0x020c7ffc,
+	0x02177ffc, 0x02237ffb, 0x022f7ffb, 0x023b7ffb, 0x02477ffb, 0x02537ffb, 0x02607ffa, 0x026d7ffa,
+	0x027a7ffa, 0x02877ffa, 0x02947ff9, 0x02a17ff9, 0x02af7ff9, 0x02bc7ff9, 0x02ca7ff8, 0x02d87ff8,
+	0x02e77ff8, 0x02f57ff7, 0x03047ff7, 0x03127ff7, 0x03217ff6, 0x03317ff6, 0x03407ff5, 0x034f7ff5,
+	0x035f7ff5, 0x036f7ff4, 0x037f7ff4, 0x038f7ff3, 0x03a07ff3, 0x03b07ff2, 0x03c17ff2, 0x03d27ff1,
+	0x03e37ff1, 0x03f57ff0, 0x04067ff0, 0x04187fef, 0x042a7fef, 0x043c7fee, 0x044f7fed, 0x04617fed,
+	0x04747fec, 0x04877feb, 0x049a7feb, 0x04ae7fea, 0x04c17fe9, 0x04d57fe9, 0x04e97fe8, 0x04fd7fe7,
+	0x05127fe6, 0x05277fe5, 0x053b7fe5, 0x05507fe4, 0x05667fe3, 0x057b7fe2, 0x05917fe1, 0x05a77fe0,
+	0x05bd7fdf, 0x05d37fde, 0x05ea7fdd, 0x06017fdc, 0x06187fdb, 0x062f7fda, 0x06467fd9, 0x065e7fd7,
+	0x06767fd6, 0x068e7fd5, 0x06a67fd4, 0x06bf7fd2, 0x06d87fd1, 0x06f17fd0, 0x070a7fce, 0x07237fcd,
+	0x073d7fcc, 0x07577fca, 0x07717fc9, 0x078c7fc7, 0x07a67fc5, 0x07c17fc4, 0x07dc7fc2, 0x07f77fc0,
+	0x08137fbf, 0x082f7fbd, 0x084b7fbb, 0x08677fb9, 0x08847fb7, 0x08a07fb6, 0x08bd7fb4, 0x08da7fb2,
+	0x08f87faf, 0x09167fad, 0x09347fab, 0x09527fa9, 0x09707fa7, 0x098f7fa5, 0x09ae7fa2, 0x09cd7fa0,
+	0x09ec7f9d, 0x0a0c7f9b, 0x0a2c7f98, 0x0a4c7f96, 0x0a6c7f93, 0x0a8d7f91, 0x0aae7f8e, 0x0acf7f8b,
+	0x0af07f88, 0x0b127f85, 0x0b337f82, 0x0b557f7f, 0x0b787f7c, 0x0b9a7f79, 0x0bbd7f76, 0x0be07f73,
+	0x0c047f6f, 0x0c277f6c, 0x0c4b7f69, 0x0c6f7f65, 0x0c937f61, 0x0cb87f5e, 0x0cdd7f5a, 0x0d027f56,
+	0x0d277f53, 0x0d4d7f4f, 0x0d737f4b, 0x0d997f47, 0x0dbf7f43, 0x0de67f3e, 0x0e0c7f3a, 0x0e347f36,
+	0x0e5b7f31, 0x0e837f2d, 0x0eaa7f28, 0x0ed37f24, 0x0efb7f1f, 0x0f237f1a, 0x0f4c7f15, 0x0f757f10,
+	0x0f9f7f0b, 0x0fc87f06, 0x0ff27f01, 0x101c7efb, 0x10477ef6, 0x10717ef0, 0x109c7eeb, 0x10c87ee5,
+	0x10f37edf, 0x111f7eda, 0x114a7ed4, 0x11777ece, 0x11a37ec7, 0x11d07ec1, 0x11fd7ebb, 0x122a7eb4,
+	0x12577eae, 0x12857ea7, 0x12b37ea0, 0x12e17e9a, 0x130f7e93, 0x133e7e8c, 0x136d7e84, 0x139c7e7d,
+	0x13cc7e76, 0x13fb7e6e, 0x142b7e67, 0x145b7e5f, 0x148c7e57, 0x14bc7e4f, 0x14ed7e47, 0x151e7e3f,
+	0x15507e37, 0x15817e2e, 0x15b37e26, 0x15e57e1d, 0x16187e14, 0x164a7e0b, 0x167d7e02, 0x16b07df9,
+	0x16e47df0, 0x17177de6, 0x174b7ddd, 0x177f7dd3, 0x17b37dc9, 0x17e87dbf, 0x181d7db5, 0x18527dab,
+	0x18877da1, 0x18bc7d96, 0x18f27d8c, 0x19287d81, 0x195e7d76, 0x19957d6b, 0x19cb7d60, 0x1a027d54,
+	0x1a397d49, 0x1a717d3d, 0x1aa87d31, 0x1ae07d26, 0x1b187d19, 0x1b507d0d, 0x1b897d01, 0x1bc27cf4,
+	0x1bfb7ce8, 0x1c347cdb, 0x1c6d7cce, 0x1ca77cc1, 0x1ce17cb3, 0x1d1b7ca6, 0x1d557c98, 0x1d8f7c8a,
+	0x1dca7c7c, 0x1e057c6e, 0x1e407c60, 0x1e7b7c51, 0x1eb77c43, 0x1ef37c34, 0x1f2f7c25, 0x1f6b7c16,
+	0x1fa77c06, 0x1fe47bf7, 0x20217be7, 0x205e7bd7, 0x209b7bc7, 0x20d87bb7, 0x21167ba6, 0x21547b96,
+	0x21927b85, 0x21d07b74, 0x220e7b63, 0x224d7b52, 0x228c7b40, 0x22cb7b2e, 0x230a7b1c, 0x23497b0a,
+	0x23897af8, 0x23c87ae6, 0x24087ad3, 0x24487ac0, 0x24897aad, 0x24c97a9a, 0x250a7a86, 0x254b7a73,
+	0x258c7a5f, 0x25cd7a4b, 0x260e7a36, 0x26507a22, 0x26917a0d, 0x26d379f8, 0x271579e3, 0x275779ce,
+	0x279a79b8, 0x27dc79a3, 0x281f798d, 0x28627977, 0x28a57960, 0x28e8794a, 0x292b7933, 0x296f791c,
+	0x29b27905, 0x29f678ed, 0x2a3a78d6, 0x2a7e78be, 0x2ac278a6, 0x2b07788d, 0x2b4b7875, 0x2b90785c,
+	0x2bd47843, 0x2c19782a, 0x2c5e7810, 0x2ca477f7, 0x2ce977dd, 0x2d2e77c3, 0x2d7477a8, 0x2dba778e,
+	0x2dff7773, 0x2e457758, 0x2e8b773d, 0x2ed27721, 0x2f187706, 0x2f5e76ea, 0x2fa576cd, 0x2fec76b1,
+	0x30327694, 0x30797677, 0x30c0765a, 0x3107763d, 0x314e761f, 0x31967601, 0x31dd75e3, 0x322575c5,
+	0x326c75a6, 0x32b47588, 0x32fc7569, 0x33447549, 0x338c752a, 0x33d4750a, 0x341c74ea, 0x346474ca,
+	0x34ac74a9, 0x34f57488, 0x353d7467, 0x35857446, 0x35ce7424, 0x36177403, 0x365f73e1, 0x36a873be,
+	0x36f1739c, 0x373a7379, 0x37837356, 0x37cc7333, 0x3815730f, 0x385e72ec, 0x38a772c8, 0x38f172a3,
+	0x393a727f, 0x3983725a, 0x39cd7235, 0x3a167210, 0x3a6071ea, 0x3aa971c4, 0x3af3719e, 0x3b3c7178,
+	0x3b867151, 0x3bd0712b, 0x3c197104, 0x3c6370dc, 0x3cad70b5, 0x3cf7708d, 0x3d407065, 0x3d8a703c,
+	0x3dd47014, 0x3e1e6feb, 0x3e686fc2, 0x3eb16f98, 0x3efb6f6f, 0x3f456f45, 0x3f8f6f1b, 0x3fd96ef0,
+	0x40236ec6, 0x406d6e9b, 0x40b66e70, 0x41006e44, 0x414a6e19, 0x41946ded, 0x41de6dc1, 0x42286d94,
+	0x42716d68, 0x42bb6d3b, 0x43056d0d, 0x434f6ce0, 0x43986cb2, 0x43e26c84, 0x442c6c56, 0x44756c28,
+	0x44bf6bf9, 0x45086bca, 0x45526b9b, 0x459b6b6b, 0x45e56b3c, 0x462e6b0c, 0x46786adb, 0x46c16aab,
+	0x470a6a7a, 0x47536a49, 0x479c6a18, 0x47e569e7, 0x482e69b5, 0x48776983, 0x48c06951, 0x4909691e,
+	0x495268ec, 0x499b68b9, 0x49e36885, 0x4a2c6852, 0x4a74681e, 0x4abd67ea, 0x4b0567b6, 0x4b4d6782,
+	0x4b95674d, 0x4bde6718, 0x4c2666e3, 0x4c6d66ae, 0x4cb56678, 0x4cfd6642, 0x4d45660c, 0x4d8c65d6,
+	0x4dd4659f, 0x4e1b6568, 0x4e626531, 0x4ea964fa, 0x4ef064c3, 0x4f37648b, 0x4f7e6453, 0x4fc5641b,
+	0x500b63e2, 0x505263aa, 0x50986371, 0x50df6338, 0x512562fe, 0x516b62c5, 0x51b1628b, 0x51f66251,
+	0x523c6217, 0x528161dc, 0x52c761a2, 0x530c6167, 0x5351612c, 0x539660f1, 0x53db60b5, 0x54206079,
+	0x5464603d, 0x54a96001, 0x54ed5fc5, 0x55315f88, 0x55755f4b, 0x55b95f0e, 0x55fc5ed1, 0x56405e94,
+	0x56835e56, 0x56c75e18, 0x570a5dda, 0x574d5d9c, 0x578f5d5e, 0x57d25d1f, 0x58145ce0, 0x58565ca1,
 	0x58995c62, 0x58da5c23, 0x591c5be3, 0x595e5ba4, 0x599f5b64, 0x59e05b24, 0x5a215ae3, 0x5a625aa3
 };
 
@@ -1070,277 +1070,277 @@
 
   \brief   these tables are used for the non
            linear quantizer and inverse quantizer
-           
+
 */
 const Word32 mTab_3_4[512] = {
-	0x4c1bf829, 0x4c3880de, 0x4c550603, 0x4c71879c, 
-	0x4c8e05aa, 0x4caa8030, 0x4cc6f72f, 0x4ce36aab, 
-	0x4cffdaa4, 0x4d1c471d, 0x4d38b019, 0x4d55159a, 
-	0x4d7177a1, 0x4d8dd631, 0x4daa314b, 0x4dc688f3, 
-	0x4de2dd2a, 0x4dff2df2, 0x4e1b7b4d, 0x4e37c53d, 
-	0x4e540bc5, 0x4e704ee6, 0x4e8c8ea3, 0x4ea8cafd, 
-	0x4ec503f7, 0x4ee13992, 0x4efd6bd0, 0x4f199ab4, 
-	0x4f35c640, 0x4f51ee75, 0x4f6e1356, 0x4f8a34e4, 
-	0x4fa65321, 0x4fc26e10, 0x4fde85b2, 0x4ffa9a0a, 
-	0x5016ab18, 0x5032b8e0, 0x504ec362, 0x506acaa1, 
-	0x5086cea0, 0x50a2cf5e, 0x50becce0, 0x50dac725, 
-	0x50f6be31, 0x5112b205, 0x512ea2a3, 0x514a900d, 
-	0x51667a45, 0x5182614c, 0x519e4524, 0x51ba25cf, 
-	0x51d60350, 0x51f1dda7, 0x520db4d6, 0x522988e0, 
-	0x524559c6, 0x52612789, 0x527cf22d, 0x5298b9b1, 
-	0x52b47e19, 0x52d03f65, 0x52ebfd98, 0x5307b8b4, 
-	0x532370b9, 0x533f25aa, 0x535ad789, 0x53768656, 
-	0x53923215, 0x53addac6, 0x53c9806b, 0x53e52306, 
-	0x5400c298, 0x541c5f24, 0x5437f8ab, 0x54538f2e, 
-	0x546f22af, 0x548ab330, 0x54a640b3, 0x54c1cb38, 
-	0x54dd52c2, 0x54f8d753, 0x551458eb, 0x552fd78d, 
-	0x554b5339, 0x5566cbf3, 0x558241bb, 0x559db492, 
-	0x55b9247b, 0x55d49177, 0x55effb87, 0x560b62ad, 
-	0x5626c6eb, 0x56422842, 0x565d86b4, 0x5678e242, 
-	0x56943aee, 0x56af90b9, 0x56cae3a4, 0x56e633b2, 
-	0x570180e4, 0x571ccb3b, 0x573812b8, 0x5753575e, 
-	0x576e992e, 0x5789d829, 0x57a51450, 0x57c04da6, 
-	0x57db842b, 0x57f6b7e1, 0x5811e8c9, 0x582d16e6, 
-	0x58484238, 0x58636ac0, 0x587e9081, 0x5899b37c, 
-	0x58b4d3b1, 0x58cff123, 0x58eb0bd3, 0x590623c2, 
-	0x592138f2, 0x593c4b63, 0x59575b19, 0x59726812, 
-	0x598d7253, 0x59a879da, 0x59c37eab, 0x59de80c6, 
-	0x59f9802d, 0x5a147ce0, 0x5a2f76e2, 0x5a4a6e34, 
-	0x5a6562d6, 0x5a8054cb, 0x5a9b4414, 0x5ab630b2, 
-	0x5ad11aa6, 0x5aec01f1, 0x5b06e696, 0x5b21c895, 
-	0x5b3ca7ef, 0x5b5784a6, 0x5b725ebc, 0x5b8d3631, 
-	0x5ba80b06, 0x5bc2dd3e, 0x5bddacd9, 0x5bf879d8, 
-	0x5c13443d, 0x5c2e0c09, 0x5c48d13e, 0x5c6393dc, 
-	0x5c7e53e5, 0x5c99115a, 0x5cb3cc3c, 0x5cce848d, 
-	0x5ce93a4e, 0x5d03ed80, 0x5d1e9e24, 0x5d394c3b, 
-	0x5d53f7c7, 0x5d6ea0c9, 0x5d894742, 0x5da3eb33, 
-	0x5dbe8c9e, 0x5dd92b84, 0x5df3c7e5, 0x5e0e61c3, 
-	0x5e28f920, 0x5e438dfc, 0x5e5e2059, 0x5e78b037, 
-	0x5e933d99, 0x5eadc87e, 0x5ec850e9, 0x5ee2d6da, 
-	0x5efd5a53, 0x5f17db54, 0x5f3259e0, 0x5f4cd5f6, 
-	0x5f674f99, 0x5f81c6c8, 0x5f9c3b87, 0x5fb6add4, 
-	0x5fd11db3, 0x5feb8b23, 0x6005f626, 0x60205ebd, 
-	0x603ac4e9, 0x605528ac, 0x606f8a05, 0x6089e8f7, 
-	0x60a44583, 0x60be9fa9, 0x60d8f76b, 0x60f34cca, 
-	0x610d9fc7, 0x6127f062, 0x61423e9e, 0x615c8a7a, 
-	0x6176d3f9, 0x61911b1b, 0x61ab5fe1, 0x61c5a24d, 
-	0x61dfe25f, 0x61fa2018, 0x62145b7a, 0x622e9485, 
-	0x6248cb3b, 0x6262ff9d, 0x627d31ab, 0x62976167, 
-	0x62b18ed1, 0x62cbb9eb, 0x62e5e2b6, 0x63000933, 
-	0x631a2d62, 0x63344f45, 0x634e6edd, 0x63688c2b, 
-	0x6382a730, 0x639cbfec, 0x63b6d661, 0x63d0ea90, 
-	0x63eafc7a, 0x64050c1f, 0x641f1982, 0x643924a2, 
-	0x64532d80, 0x646d341f, 0x6487387e, 0x64a13a9e, 
-	0x64bb3a81, 0x64d53828, 0x64ef3393, 0x65092cc4, 
-	0x652323bb, 0x653d1879, 0x65570b00, 0x6570fb50, 
-	0x658ae96b, 0x65a4d550, 0x65bebf01, 0x65d8a680, 
-	0x65f28bcc, 0x660c6ee8, 0x66264fd3, 0x66402e8f, 
-	0x665a0b1c, 0x6673e57d, 0x668dbdb0, 0x66a793b8, 
-	0x66c16795, 0x66db3949, 0x66f508d4, 0x670ed636, 
-	0x6728a172, 0x67426a87, 0x675c3177, 0x6775f643, 
-	0x678fb8eb, 0x67a97971, 0x67c337d5, 0x67dcf418, 
-	0x67f6ae3b, 0x6810663f, 0x682a1c25, 0x6843cfed, 
-	0x685d8199, 0x68773129, 0x6890de9f, 0x68aa89fa, 
-	0x68c4333d, 0x68ddda67, 0x68f77f7a, 0x69112277, 
-	0x692ac35e, 0x69446230, 0x695dfeee, 0x6977999a, 
-	0x69913232, 0x69aac8ba, 0x69c45d31, 0x69ddef98, 
-	0x69f77ff0, 0x6a110e3a, 0x6a2a9a77, 0x6a4424a8, 
-	0x6a5daccc, 0x6a7732e6, 0x6a90b6f6, 0x6aaa38fd, 
-	0x6ac3b8fb, 0x6add36f2, 0x6af6b2e2, 0x6b102ccd, 
-	0x6b29a4b2, 0x6b431a92, 0x6b5c8e6f, 0x6b76004a, 
-	0x6b8f7022, 0x6ba8ddf9, 0x6bc249d0, 0x6bdbb3a7, 
-	0x6bf51b80, 0x6c0e815a, 0x6c27e537, 0x6c414718, 
-	0x6c5aa6fd, 0x6c7404e7, 0x6c8d60d7, 0x6ca6bace, 
-	0x6cc012cc, 0x6cd968d2, 0x6cf2bce1, 0x6d0c0ef9, 
-	0x6d255f1d, 0x6d3ead4b, 0x6d57f985, 0x6d7143cc, 
-	0x6d8a8c21, 0x6da3d283, 0x6dbd16f5, 0x6dd65976, 
-	0x6def9a08, 0x6e08d8ab, 0x6e221560, 0x6e3b5027, 
-	0x6e548902, 0x6e6dbff1, 0x6e86f4f5, 0x6ea0280e, 
-	0x6eb9593e, 0x6ed28885, 0x6eebb5e3, 0x6f04e15a, 
-	0x6f1e0aea, 0x6f373294, 0x6f505859, 0x6f697c39, 
-	0x6f829e35, 0x6f9bbe4e, 0x6fb4dc85, 0x6fcdf8d9, 
-	0x6fe7134d, 0x70002be0, 0x70194293, 0x70325767, 
-	0x704b6a5d, 0x70647b76, 0x707d8ab1, 0x70969811, 
-	0x70afa394, 0x70c8ad3d, 0x70e1b50c, 0x70fabb01, 
-	0x7113bf1d, 0x712cc161, 0x7145c1ce, 0x715ec064, 
-	0x7177bd24, 0x7190b80f, 0x71a9b124, 0x71c2a866, 
-	0x71db9dd4, 0x71f49170, 0x720d8339, 0x72267331, 
-	0x723f6159, 0x72584db0, 0x72713838, 0x728a20f1, 
-	0x72a307db, 0x72bbecf9, 0x72d4d049, 0x72edb1ce, 
-	0x73069187, 0x731f6f75, 0x73384b98, 0x735125f3, 
-	0x7369fe84, 0x7382d54d, 0x739baa4e, 0x73b47d89, 
-	0x73cd4efd, 0x73e61eab, 0x73feec94, 0x7417b8b8, 
-	0x74308319, 0x74494bb6, 0x74621291, 0x747ad7aa, 
-	0x74939b02, 0x74ac5c98, 0x74c51c6f, 0x74ddda86, 
-	0x74f696de, 0x750f5178, 0x75280a54, 0x7540c174, 
-	0x755976d7, 0x75722a7e, 0x758adc69, 0x75a38c9b, 
-	0x75bc3b12, 0x75d4e7cf, 0x75ed92d4, 0x76063c21, 
-	0x761ee3b6, 0x76378994, 0x76502dbc, 0x7668d02e, 
-	0x768170eb, 0x769a0ff3, 0x76b2ad47, 0x76cb48e7, 
-	0x76e3e2d5, 0x76fc7b10, 0x7715119a, 0x772da673, 
-	0x7746399b, 0x775ecb13, 0x77775adc, 0x778fe8f6, 
-	0x77a87561, 0x77c1001f, 0x77d98930, 0x77f21095, 
-	0x780a964d, 0x78231a5b, 0x783b9cbd, 0x78541d75, 
-	0x786c9c84, 0x788519e9, 0x789d95a6, 0x78b60fbb, 
-	0x78ce8828, 0x78e6feef, 0x78ff740f, 0x7917e78a, 
-	0x7930595f, 0x7948c990, 0x7961381d, 0x7979a506, 
-	0x7992104c, 0x79aa79f0, 0x79c2e1f1, 0x79db4852, 
-	0x79f3ad11, 0x7a0c1031, 0x7a2471b0, 0x7a3cd191, 
-	0x7a552fd3, 0x7a6d8c76, 0x7a85e77d, 0x7a9e40e6, 
-	0x7ab698b2, 0x7aceeee3, 0x7ae74378, 0x7aff9673, 
-	0x7b17e7d2, 0x7b303799, 0x7b4885c5, 0x7b60d259, 
-	0x7b791d55, 0x7b9166b9, 0x7ba9ae86, 0x7bc1f4bc, 
-	0x7bda395c, 0x7bf27c66, 0x7c0abddb, 0x7c22fdbb, 
-	0x7c3b3c07, 0x7c5378c0, 0x7c6bb3e5, 0x7c83ed78, 
-	0x7c9c2579, 0x7cb45be9, 0x7ccc90c7, 0x7ce4c414, 
-	0x7cfcf5d2, 0x7d152600, 0x7d2d549f, 0x7d4581b0, 
-	0x7d5dad32, 0x7d75d727, 0x7d8dff8f, 0x7da6266a, 
-	0x7dbe4bba, 0x7dd66f7d, 0x7dee91b6, 0x7e06b264, 
-	0x7e1ed188, 0x7e36ef22, 0x7e4f0b34, 0x7e6725bd, 
-	0x7e7f3ebd, 0x7e975636, 0x7eaf6c28, 0x7ec78093, 
-	0x7edf9378, 0x7ef7a4d7, 0x7f0fb4b1, 0x7f27c307, 
-	0x7f3fcfd8, 0x7f57db25, 0x7f6fe4ef, 0x7f87ed36, 
+	0x4c1bf829, 0x4c3880de, 0x4c550603, 0x4c71879c,
+	0x4c8e05aa, 0x4caa8030, 0x4cc6f72f, 0x4ce36aab,
+	0x4cffdaa4, 0x4d1c471d, 0x4d38b019, 0x4d55159a,
+	0x4d7177a1, 0x4d8dd631, 0x4daa314b, 0x4dc688f3,
+	0x4de2dd2a, 0x4dff2df2, 0x4e1b7b4d, 0x4e37c53d,
+	0x4e540bc5, 0x4e704ee6, 0x4e8c8ea3, 0x4ea8cafd,
+	0x4ec503f7, 0x4ee13992, 0x4efd6bd0, 0x4f199ab4,
+	0x4f35c640, 0x4f51ee75, 0x4f6e1356, 0x4f8a34e4,
+	0x4fa65321, 0x4fc26e10, 0x4fde85b2, 0x4ffa9a0a,
+	0x5016ab18, 0x5032b8e0, 0x504ec362, 0x506acaa1,
+	0x5086cea0, 0x50a2cf5e, 0x50becce0, 0x50dac725,
+	0x50f6be31, 0x5112b205, 0x512ea2a3, 0x514a900d,
+	0x51667a45, 0x5182614c, 0x519e4524, 0x51ba25cf,
+	0x51d60350, 0x51f1dda7, 0x520db4d6, 0x522988e0,
+	0x524559c6, 0x52612789, 0x527cf22d, 0x5298b9b1,
+	0x52b47e19, 0x52d03f65, 0x52ebfd98, 0x5307b8b4,
+	0x532370b9, 0x533f25aa, 0x535ad789, 0x53768656,
+	0x53923215, 0x53addac6, 0x53c9806b, 0x53e52306,
+	0x5400c298, 0x541c5f24, 0x5437f8ab, 0x54538f2e,
+	0x546f22af, 0x548ab330, 0x54a640b3, 0x54c1cb38,
+	0x54dd52c2, 0x54f8d753, 0x551458eb, 0x552fd78d,
+	0x554b5339, 0x5566cbf3, 0x558241bb, 0x559db492,
+	0x55b9247b, 0x55d49177, 0x55effb87, 0x560b62ad,
+	0x5626c6eb, 0x56422842, 0x565d86b4, 0x5678e242,
+	0x56943aee, 0x56af90b9, 0x56cae3a4, 0x56e633b2,
+	0x570180e4, 0x571ccb3b, 0x573812b8, 0x5753575e,
+	0x576e992e, 0x5789d829, 0x57a51450, 0x57c04da6,
+	0x57db842b, 0x57f6b7e1, 0x5811e8c9, 0x582d16e6,
+	0x58484238, 0x58636ac0, 0x587e9081, 0x5899b37c,
+	0x58b4d3b1, 0x58cff123, 0x58eb0bd3, 0x590623c2,
+	0x592138f2, 0x593c4b63, 0x59575b19, 0x59726812,
+	0x598d7253, 0x59a879da, 0x59c37eab, 0x59de80c6,
+	0x59f9802d, 0x5a147ce0, 0x5a2f76e2, 0x5a4a6e34,
+	0x5a6562d6, 0x5a8054cb, 0x5a9b4414, 0x5ab630b2,
+	0x5ad11aa6, 0x5aec01f1, 0x5b06e696, 0x5b21c895,
+	0x5b3ca7ef, 0x5b5784a6, 0x5b725ebc, 0x5b8d3631,
+	0x5ba80b06, 0x5bc2dd3e, 0x5bddacd9, 0x5bf879d8,
+	0x5c13443d, 0x5c2e0c09, 0x5c48d13e, 0x5c6393dc,
+	0x5c7e53e5, 0x5c99115a, 0x5cb3cc3c, 0x5cce848d,
+	0x5ce93a4e, 0x5d03ed80, 0x5d1e9e24, 0x5d394c3b,
+	0x5d53f7c7, 0x5d6ea0c9, 0x5d894742, 0x5da3eb33,
+	0x5dbe8c9e, 0x5dd92b84, 0x5df3c7e5, 0x5e0e61c3,
+	0x5e28f920, 0x5e438dfc, 0x5e5e2059, 0x5e78b037,
+	0x5e933d99, 0x5eadc87e, 0x5ec850e9, 0x5ee2d6da,
+	0x5efd5a53, 0x5f17db54, 0x5f3259e0, 0x5f4cd5f6,
+	0x5f674f99, 0x5f81c6c8, 0x5f9c3b87, 0x5fb6add4,
+	0x5fd11db3, 0x5feb8b23, 0x6005f626, 0x60205ebd,
+	0x603ac4e9, 0x605528ac, 0x606f8a05, 0x6089e8f7,
+	0x60a44583, 0x60be9fa9, 0x60d8f76b, 0x60f34cca,
+	0x610d9fc7, 0x6127f062, 0x61423e9e, 0x615c8a7a,
+	0x6176d3f9, 0x61911b1b, 0x61ab5fe1, 0x61c5a24d,
+	0x61dfe25f, 0x61fa2018, 0x62145b7a, 0x622e9485,
+	0x6248cb3b, 0x6262ff9d, 0x627d31ab, 0x62976167,
+	0x62b18ed1, 0x62cbb9eb, 0x62e5e2b6, 0x63000933,
+	0x631a2d62, 0x63344f45, 0x634e6edd, 0x63688c2b,
+	0x6382a730, 0x639cbfec, 0x63b6d661, 0x63d0ea90,
+	0x63eafc7a, 0x64050c1f, 0x641f1982, 0x643924a2,
+	0x64532d80, 0x646d341f, 0x6487387e, 0x64a13a9e,
+	0x64bb3a81, 0x64d53828, 0x64ef3393, 0x65092cc4,
+	0x652323bb, 0x653d1879, 0x65570b00, 0x6570fb50,
+	0x658ae96b, 0x65a4d550, 0x65bebf01, 0x65d8a680,
+	0x65f28bcc, 0x660c6ee8, 0x66264fd3, 0x66402e8f,
+	0x665a0b1c, 0x6673e57d, 0x668dbdb0, 0x66a793b8,
+	0x66c16795, 0x66db3949, 0x66f508d4, 0x670ed636,
+	0x6728a172, 0x67426a87, 0x675c3177, 0x6775f643,
+	0x678fb8eb, 0x67a97971, 0x67c337d5, 0x67dcf418,
+	0x67f6ae3b, 0x6810663f, 0x682a1c25, 0x6843cfed,
+	0x685d8199, 0x68773129, 0x6890de9f, 0x68aa89fa,
+	0x68c4333d, 0x68ddda67, 0x68f77f7a, 0x69112277,
+	0x692ac35e, 0x69446230, 0x695dfeee, 0x6977999a,
+	0x69913232, 0x69aac8ba, 0x69c45d31, 0x69ddef98,
+	0x69f77ff0, 0x6a110e3a, 0x6a2a9a77, 0x6a4424a8,
+	0x6a5daccc, 0x6a7732e6, 0x6a90b6f6, 0x6aaa38fd,
+	0x6ac3b8fb, 0x6add36f2, 0x6af6b2e2, 0x6b102ccd,
+	0x6b29a4b2, 0x6b431a92, 0x6b5c8e6f, 0x6b76004a,
+	0x6b8f7022, 0x6ba8ddf9, 0x6bc249d0, 0x6bdbb3a7,
+	0x6bf51b80, 0x6c0e815a, 0x6c27e537, 0x6c414718,
+	0x6c5aa6fd, 0x6c7404e7, 0x6c8d60d7, 0x6ca6bace,
+	0x6cc012cc, 0x6cd968d2, 0x6cf2bce1, 0x6d0c0ef9,
+	0x6d255f1d, 0x6d3ead4b, 0x6d57f985, 0x6d7143cc,
+	0x6d8a8c21, 0x6da3d283, 0x6dbd16f5, 0x6dd65976,
+	0x6def9a08, 0x6e08d8ab, 0x6e221560, 0x6e3b5027,
+	0x6e548902, 0x6e6dbff1, 0x6e86f4f5, 0x6ea0280e,
+	0x6eb9593e, 0x6ed28885, 0x6eebb5e3, 0x6f04e15a,
+	0x6f1e0aea, 0x6f373294, 0x6f505859, 0x6f697c39,
+	0x6f829e35, 0x6f9bbe4e, 0x6fb4dc85, 0x6fcdf8d9,
+	0x6fe7134d, 0x70002be0, 0x70194293, 0x70325767,
+	0x704b6a5d, 0x70647b76, 0x707d8ab1, 0x70969811,
+	0x70afa394, 0x70c8ad3d, 0x70e1b50c, 0x70fabb01,
+	0x7113bf1d, 0x712cc161, 0x7145c1ce, 0x715ec064,
+	0x7177bd24, 0x7190b80f, 0x71a9b124, 0x71c2a866,
+	0x71db9dd4, 0x71f49170, 0x720d8339, 0x72267331,
+	0x723f6159, 0x72584db0, 0x72713838, 0x728a20f1,
+	0x72a307db, 0x72bbecf9, 0x72d4d049, 0x72edb1ce,
+	0x73069187, 0x731f6f75, 0x73384b98, 0x735125f3,
+	0x7369fe84, 0x7382d54d, 0x739baa4e, 0x73b47d89,
+	0x73cd4efd, 0x73e61eab, 0x73feec94, 0x7417b8b8,
+	0x74308319, 0x74494bb6, 0x74621291, 0x747ad7aa,
+	0x74939b02, 0x74ac5c98, 0x74c51c6f, 0x74ddda86,
+	0x74f696de, 0x750f5178, 0x75280a54, 0x7540c174,
+	0x755976d7, 0x75722a7e, 0x758adc69, 0x75a38c9b,
+	0x75bc3b12, 0x75d4e7cf, 0x75ed92d4, 0x76063c21,
+	0x761ee3b6, 0x76378994, 0x76502dbc, 0x7668d02e,
+	0x768170eb, 0x769a0ff3, 0x76b2ad47, 0x76cb48e7,
+	0x76e3e2d5, 0x76fc7b10, 0x7715119a, 0x772da673,
+	0x7746399b, 0x775ecb13, 0x77775adc, 0x778fe8f6,
+	0x77a87561, 0x77c1001f, 0x77d98930, 0x77f21095,
+	0x780a964d, 0x78231a5b, 0x783b9cbd, 0x78541d75,
+	0x786c9c84, 0x788519e9, 0x789d95a6, 0x78b60fbb,
+	0x78ce8828, 0x78e6feef, 0x78ff740f, 0x7917e78a,
+	0x7930595f, 0x7948c990, 0x7961381d, 0x7979a506,
+	0x7992104c, 0x79aa79f0, 0x79c2e1f1, 0x79db4852,
+	0x79f3ad11, 0x7a0c1031, 0x7a2471b0, 0x7a3cd191,
+	0x7a552fd3, 0x7a6d8c76, 0x7a85e77d, 0x7a9e40e6,
+	0x7ab698b2, 0x7aceeee3, 0x7ae74378, 0x7aff9673,
+	0x7b17e7d2, 0x7b303799, 0x7b4885c5, 0x7b60d259,
+	0x7b791d55, 0x7b9166b9, 0x7ba9ae86, 0x7bc1f4bc,
+	0x7bda395c, 0x7bf27c66, 0x7c0abddb, 0x7c22fdbb,
+	0x7c3b3c07, 0x7c5378c0, 0x7c6bb3e5, 0x7c83ed78,
+	0x7c9c2579, 0x7cb45be9, 0x7ccc90c7, 0x7ce4c414,
+	0x7cfcf5d2, 0x7d152600, 0x7d2d549f, 0x7d4581b0,
+	0x7d5dad32, 0x7d75d727, 0x7d8dff8f, 0x7da6266a,
+	0x7dbe4bba, 0x7dd66f7d, 0x7dee91b6, 0x7e06b264,
+	0x7e1ed188, 0x7e36ef22, 0x7e4f0b34, 0x7e6725bd,
+	0x7e7f3ebd, 0x7e975636, 0x7eaf6c28, 0x7ec78093,
+	0x7edf9378, 0x7ef7a4d7, 0x7f0fb4b1, 0x7f27c307,
+	0x7f3fcfd8, 0x7f57db25, 0x7f6fe4ef, 0x7f87ed36,
 	0x7f9ff3fb, 0x7fb7f93e, 0x7fcffcff, 0x7fe7ff40
 };
 
 const Word32 mTab_4_3[512]={
-	0x32cbfd4a, 0x32eddd70, 0x330fc339, 0x3331aea3, 
-	0x33539fac, 0x33759652, 0x33979294, 0x33b99470, 
-	0x33db9be4, 0x33fda8ed, 0x341fbb8b, 0x3441d3bb, 
-	0x3463f17c, 0x348614cc, 0x34a83da8, 0x34ca6c10, 
-	0x34eca001, 0x350ed979, 0x35311877, 0x35535cfa, 
-	0x3575a6fe, 0x3597f683, 0x35ba4b87, 0x35dca607, 
-	0x35ff0603, 0x36216b78, 0x3643d665, 0x366646c7, 
-	0x3688bc9e, 0x36ab37e8, 0x36cdb8a2, 0x36f03ecb, 
-	0x3712ca62, 0x37355b64, 0x3757f1d1, 0x377a8da5, 
-	0x379d2ee0, 0x37bfd580, 0x37e28184, 0x380532e8, 
-	0x3827e9ad, 0x384aa5d0, 0x386d674f, 0x38902e2a, 
-	0x38b2fa5d, 0x38d5cbe9, 0x38f8a2ca, 0x391b7eff, 
-	0x393e6088, 0x39614761, 0x3984338a, 0x39a72501, 
-	0x39ca1bc4, 0x39ed17d1, 0x3a101928, 0x3a331fc6, 
-	0x3a562baa, 0x3a793cd2, 0x3a9c533d, 0x3abf6ee9, 
-	0x3ae28fd5, 0x3b05b5ff, 0x3b28e165, 0x3b4c1206, 
-	0x3b6f47e0, 0x3b9282f2, 0x3bb5c33a, 0x3bd908b7, 
-	0x3bfc5368, 0x3c1fa349, 0x3c42f85b, 0x3c66529c, 
-	0x3c89b209, 0x3cad16a2, 0x3cd08065, 0x3cf3ef51, 
-	0x3d176364, 0x3d3adc9c, 0x3d5e5af8, 0x3d81de77, 
-	0x3da56717, 0x3dc8f4d6, 0x3dec87b4, 0x3e101fae, 
-	0x3e33bcc3, 0x3e575ef2, 0x3e7b063a, 0x3e9eb298, 
-	0x3ec2640c, 0x3ee61a93, 0x3f09d62d, 0x3f2d96d8, 
-	0x3f515c93, 0x3f75275b, 0x3f98f731, 0x3fbccc11, 
-	0x3fe0a5fc, 0x400484ef, 0x402868ea, 0x404c51e9, 
-	0x40703fee, 0x409432f5, 0x40b82afd, 0x40dc2806, 
-	0x41002a0d, 0x41243111, 0x41483d12, 0x416c4e0d, 
-	0x41906401, 0x41b47eed, 0x41d89ecf, 0x41fcc3a7, 
-	0x4220ed72, 0x42451c30, 0x42694fde, 0x428d887d, 
-	0x42b1c609, 0x42d60883, 0x42fa4fe8, 0x431e9c37, 
-	0x4342ed70, 0x43674390, 0x438b9e96, 0x43affe82, 
-	0x43d46351, 0x43f8cd03, 0x441d3b95, 0x4441af08, 
-	0x44662758, 0x448aa487, 0x44af2690, 0x44d3ad75, 
-	0x44f83933, 0x451cc9c8, 0x45415f35, 0x4565f977, 
-	0x458a988d, 0x45af3c76, 0x45d3e531, 0x45f892bc, 
-	0x461d4516, 0x4641fc3e, 0x4666b832, 0x468b78f2, 
-	0x46b03e7c, 0x46d508cf, 0x46f9d7e9, 0x471eabca, 
-	0x47438470, 0x476861d9, 0x478d4406, 0x47b22af3, 
-	0x47d716a1, 0x47fc070e, 0x4820fc39, 0x4845f620, 
-	0x486af4c3, 0x488ff820, 0x48b50035, 0x48da0d03, 
-	0x48ff1e87, 0x492434c0, 0x49494fad, 0x496e6f4d, 
-	0x4993939f, 0x49b8bca2, 0x49ddea54, 0x4a031cb4, 
-	0x4a2853c1, 0x4a4d8f7a, 0x4a72cfde, 0x4a9814eb, 
-	0x4abd5ea1, 0x4ae2acfd, 0x4b080000, 0x4b2d57a8, 
-	0x4b52b3f3, 0x4b7814e1, 0x4b9d7a70, 0x4bc2e49f, 
-	0x4be8536e, 0x4c0dc6db, 0x4c333ee4, 0x4c58bb89, 
-	0x4c7e3cc9, 0x4ca3c2a2, 0x4cc94d14, 0x4ceedc1c, 
-	0x4d146fbb, 0x4d3a07ef, 0x4d5fa4b6, 0x4d854611, 
-	0x4daaebfd, 0x4dd09679, 0x4df64585, 0x4e1bf91f, 
-	0x4e41b146, 0x4e676dfa, 0x4e8d2f38, 0x4eb2f501, 
-	0x4ed8bf52, 0x4efe8e2b, 0x4f24618a, 0x4f4a3970, 
-	0x4f7015d9, 0x4f95f6c6, 0x4fbbdc36, 0x4fe1c626, 
-	0x5007b497, 0x502da787, 0x50539ef5, 0x50799ae1, 
-	0x509f9b48, 0x50c5a02a, 0x50eba985, 0x5111b75a, 
-	0x5137c9a6, 0x515de069, 0x5183fba2, 0x51aa1b4f, 
-	0x51d03f70, 0x51f66803, 0x521c9508, 0x5242c67d, 
-	0x5268fc62, 0x528f36b5, 0x52b57575, 0x52dbb8a2, 
-	0x5302003a, 0x53284c3c, 0x534e9ca8, 0x5374f17c, 
-	0x539b4ab7, 0x53c1a858, 0x53e80a5f, 0x540e70ca, 
-	0x5434db98, 0x545b4ac8, 0x5481be5a, 0x54a8364b, 
-	0x54ceb29c, 0x54f5334c, 0x551bb858, 0x554241c1, 
-	0x5568cf85, 0x558f61a3, 0x55b5f81b, 0x55dc92eb, 
-	0x56033212, 0x5629d590, 0x56507d63, 0x5677298a, 
-	0x569dda05, 0x56c48ed3, 0x56eb47f2, 0x57120562, 
-	0x5738c721, 0x575f8d2f, 0x5786578a, 0x57ad2633, 
-	0x57d3f927, 0x57fad066, 0x5821abef, 0x58488bc0, 
-	0x586f6fda, 0x5896583b, 0x58bd44e2, 0x58e435ce, 
-	0x590b2aff, 0x59322473, 0x59592229, 0x59802420, 
-	0x59a72a59, 0x59ce34d0, 0x59f54387, 0x5a1c567b, 
-	0x5a436dac, 0x5a6a8919, 0x5a91a8c1, 0x5ab8cca3, 
-	0x5adff4be, 0x5b072111, 0x5b2e519c, 0x5b55865e, 
-	0x5b7cbf54, 0x5ba3fc80, 0x5bcb3ddf, 0x5bf28371, 
-	0x5c19cd35, 0x5c411b2a, 0x5c686d4f, 0x5c8fc3a4, 
-	0x5cb71e27, 0x5cde7cd7, 0x5d05dfb4, 0x5d2d46bd, 
-	0x5d54b1f0, 0x5d7c214e, 0x5da394d4, 0x5dcb0c83, 
-	0x5df28859, 0x5e1a0856, 0x5e418c78, 0x5e6914be, 
-	0x5e90a129, 0x5eb831b7, 0x5edfc667, 0x5f075f38, 
-	0x5f2efc29, 0x5f569d3a, 0x5f7e426a, 0x5fa5ebb7, 
-	0x5fcd9921, 0x5ff54aa8, 0x601d004a, 0x6044ba06, 
-	0x606c77dc, 0x609439ca, 0x60bbffd0, 0x60e3c9ee, 
-	0x610b9821, 0x61336a6a, 0x615b40c8, 0x61831b39, 
-	0x61aaf9bd, 0x61d2dc53, 0x61fac2fa, 0x6222adb2, 
-	0x624a9c79, 0x62728f4f, 0x629a8633, 0x62c28123, 
-	0x62ea8020, 0x63128329, 0x633a8a3c, 0x63629559, 
-	0x638aa47f, 0x63b2b7ad, 0x63dacee2, 0x6402ea1e, 
-	0x642b0960, 0x64532ca6, 0x647b53f1, 0x64a37f3f, 
-	0x64cbae8f, 0x64f3e1e2, 0x651c1935, 0x65445488, 
-	0x656c93db, 0x6594d72c, 0x65bd1e7b, 0x65e569c7, 
-	0x660db90f, 0x66360c53, 0x665e6391, 0x6686bec9, 
-	0x66af1dfa, 0x66d78123, 0x66ffe844, 0x6728535b, 
-	0x6750c268, 0x6779356b, 0x67a1ac62, 0x67ca274c, 
-	0x67f2a629, 0x681b28f9, 0x6843afb9, 0x686c3a6a, 
-	0x6894c90b, 0x68bd5b9b, 0x68e5f219, 0x690e8c84, 
-	0x69372add, 0x695fcd21, 0x69887350, 0x69b11d6a, 
-	0x69d9cb6d, 0x6a027d5a, 0x6a2b332f, 0x6a53eceb, 
-	0x6a7caa8d, 0x6aa56c16, 0x6ace3184, 0x6af6fad6, 
-	0x6b1fc80c, 0x6b489925, 0x6b716e20, 0x6b9a46fd, 
-	0x6bc323bb, 0x6bec0458, 0x6c14e8d5, 0x6c3dd130, 
-	0x6c66bd69, 0x6c8fad80, 0x6cb8a172, 0x6ce19940, 
-	0x6d0a94e9, 0x6d33946d, 0x6d5c97ca, 0x6d859eff, 
-	0x6daeaa0d, 0x6dd7b8f1, 0x6e00cbad, 0x6e29e23e, 
-	0x6e52fca4, 0x6e7c1adf, 0x6ea53cee, 0x6ece62cf, 
-	0x6ef78c83, 0x6f20ba09, 0x6f49eb5f, 0x6f732085, 
-	0x6f9c597b, 0x6fc59640, 0x6feed6d3, 0x70181b33, 
-	0x70416360, 0x706aaf59, 0x7093ff1d, 0x70bd52ab, 
-	0x70e6aa04, 0x71100525, 0x7139640f, 0x7162c6c1, 
-	0x718c2d3a, 0x71b5977a, 0x71df057f, 0x72087749, 
-	0x7231ecd8, 0x725b662a, 0x7284e33f, 0x72ae6417, 
-	0x72d7e8b0, 0x7301710a, 0x732afd24, 0x73548cfe, 
-	0x737e2097, 0x73a7b7ee, 0x73d15303, 0x73faf1d5, 
-	0x74249462, 0x744e3aac, 0x7477e4b0, 0x74a1926e, 
-	0x74cb43e6, 0x74f4f917, 0x751eb201, 0x75486ea1, 
-	0x75722ef9, 0x759bf307, 0x75c5baca, 0x75ef8642, 
-	0x7619556f, 0x7643284f, 0x766cfee2, 0x7696d928, 
-	0x76c0b71f, 0x76ea98c7, 0x77147e20, 0x773e6728, 
-	0x776853df, 0x77924445, 0x77bc3858, 0x77e63019, 
-	0x78102b85, 0x783a2a9e, 0x78642d62, 0x788e33d1, 
-	0x78b83de9, 0x78e24bab, 0x790c5d15, 0x79367228, 
-	0x79608ae1, 0x798aa742, 0x79b4c748, 0x79deeaf4, 
-	0x7a091245, 0x7a333d3a, 0x7a5d6bd2, 0x7a879e0e, 
-	0x7ab1d3ec, 0x7adc0d6b, 0x7b064a8c, 0x7b308b4d, 
-	0x7b5acfae, 0x7b8517ae, 0x7baf634c, 0x7bd9b289, 
-	0x7c040563, 0x7c2e5bda, 0x7c58b5ec, 0x7c83139b, 
-	0x7cad74e4, 0x7cd7d9c7, 0x7d024244, 0x7d2cae5a, 
-	0x7d571e09, 0x7d81914f, 0x7dac082d, 0x7dd682a1, 
-	0x7e0100ac, 0x7e2b824b, 0x7e560780, 0x7e809048, 
-	0x7eab1ca5, 0x7ed5ac94, 0x7f004015, 0x7f2ad729, 
+	0x32cbfd4a, 0x32eddd70, 0x330fc339, 0x3331aea3,
+	0x33539fac, 0x33759652, 0x33979294, 0x33b99470,
+	0x33db9be4, 0x33fda8ed, 0x341fbb8b, 0x3441d3bb,
+	0x3463f17c, 0x348614cc, 0x34a83da8, 0x34ca6c10,
+	0x34eca001, 0x350ed979, 0x35311877, 0x35535cfa,
+	0x3575a6fe, 0x3597f683, 0x35ba4b87, 0x35dca607,
+	0x35ff0603, 0x36216b78, 0x3643d665, 0x366646c7,
+	0x3688bc9e, 0x36ab37e8, 0x36cdb8a2, 0x36f03ecb,
+	0x3712ca62, 0x37355b64, 0x3757f1d1, 0x377a8da5,
+	0x379d2ee0, 0x37bfd580, 0x37e28184, 0x380532e8,
+	0x3827e9ad, 0x384aa5d0, 0x386d674f, 0x38902e2a,
+	0x38b2fa5d, 0x38d5cbe9, 0x38f8a2ca, 0x391b7eff,
+	0x393e6088, 0x39614761, 0x3984338a, 0x39a72501,
+	0x39ca1bc4, 0x39ed17d1, 0x3a101928, 0x3a331fc6,
+	0x3a562baa, 0x3a793cd2, 0x3a9c533d, 0x3abf6ee9,
+	0x3ae28fd5, 0x3b05b5ff, 0x3b28e165, 0x3b4c1206,
+	0x3b6f47e0, 0x3b9282f2, 0x3bb5c33a, 0x3bd908b7,
+	0x3bfc5368, 0x3c1fa349, 0x3c42f85b, 0x3c66529c,
+	0x3c89b209, 0x3cad16a2, 0x3cd08065, 0x3cf3ef51,
+	0x3d176364, 0x3d3adc9c, 0x3d5e5af8, 0x3d81de77,
+	0x3da56717, 0x3dc8f4d6, 0x3dec87b4, 0x3e101fae,
+	0x3e33bcc3, 0x3e575ef2, 0x3e7b063a, 0x3e9eb298,
+	0x3ec2640c, 0x3ee61a93, 0x3f09d62d, 0x3f2d96d8,
+	0x3f515c93, 0x3f75275b, 0x3f98f731, 0x3fbccc11,
+	0x3fe0a5fc, 0x400484ef, 0x402868ea, 0x404c51e9,
+	0x40703fee, 0x409432f5, 0x40b82afd, 0x40dc2806,
+	0x41002a0d, 0x41243111, 0x41483d12, 0x416c4e0d,
+	0x41906401, 0x41b47eed, 0x41d89ecf, 0x41fcc3a7,
+	0x4220ed72, 0x42451c30, 0x42694fde, 0x428d887d,
+	0x42b1c609, 0x42d60883, 0x42fa4fe8, 0x431e9c37,
+	0x4342ed70, 0x43674390, 0x438b9e96, 0x43affe82,
+	0x43d46351, 0x43f8cd03, 0x441d3b95, 0x4441af08,
+	0x44662758, 0x448aa487, 0x44af2690, 0x44d3ad75,
+	0x44f83933, 0x451cc9c8, 0x45415f35, 0x4565f977,
+	0x458a988d, 0x45af3c76, 0x45d3e531, 0x45f892bc,
+	0x461d4516, 0x4641fc3e, 0x4666b832, 0x468b78f2,
+	0x46b03e7c, 0x46d508cf, 0x46f9d7e9, 0x471eabca,
+	0x47438470, 0x476861d9, 0x478d4406, 0x47b22af3,
+	0x47d716a1, 0x47fc070e, 0x4820fc39, 0x4845f620,
+	0x486af4c3, 0x488ff820, 0x48b50035, 0x48da0d03,
+	0x48ff1e87, 0x492434c0, 0x49494fad, 0x496e6f4d,
+	0x4993939f, 0x49b8bca2, 0x49ddea54, 0x4a031cb4,
+	0x4a2853c1, 0x4a4d8f7a, 0x4a72cfde, 0x4a9814eb,
+	0x4abd5ea1, 0x4ae2acfd, 0x4b080000, 0x4b2d57a8,
+	0x4b52b3f3, 0x4b7814e1, 0x4b9d7a70, 0x4bc2e49f,
+	0x4be8536e, 0x4c0dc6db, 0x4c333ee4, 0x4c58bb89,
+	0x4c7e3cc9, 0x4ca3c2a2, 0x4cc94d14, 0x4ceedc1c,
+	0x4d146fbb, 0x4d3a07ef, 0x4d5fa4b6, 0x4d854611,
+	0x4daaebfd, 0x4dd09679, 0x4df64585, 0x4e1bf91f,
+	0x4e41b146, 0x4e676dfa, 0x4e8d2f38, 0x4eb2f501,
+	0x4ed8bf52, 0x4efe8e2b, 0x4f24618a, 0x4f4a3970,
+	0x4f7015d9, 0x4f95f6c6, 0x4fbbdc36, 0x4fe1c626,
+	0x5007b497, 0x502da787, 0x50539ef5, 0x50799ae1,
+	0x509f9b48, 0x50c5a02a, 0x50eba985, 0x5111b75a,
+	0x5137c9a6, 0x515de069, 0x5183fba2, 0x51aa1b4f,
+	0x51d03f70, 0x51f66803, 0x521c9508, 0x5242c67d,
+	0x5268fc62, 0x528f36b5, 0x52b57575, 0x52dbb8a2,
+	0x5302003a, 0x53284c3c, 0x534e9ca8, 0x5374f17c,
+	0x539b4ab7, 0x53c1a858, 0x53e80a5f, 0x540e70ca,
+	0x5434db98, 0x545b4ac8, 0x5481be5a, 0x54a8364b,
+	0x54ceb29c, 0x54f5334c, 0x551bb858, 0x554241c1,
+	0x5568cf85, 0x558f61a3, 0x55b5f81b, 0x55dc92eb,
+	0x56033212, 0x5629d590, 0x56507d63, 0x5677298a,
+	0x569dda05, 0x56c48ed3, 0x56eb47f2, 0x57120562,
+	0x5738c721, 0x575f8d2f, 0x5786578a, 0x57ad2633,
+	0x57d3f927, 0x57fad066, 0x5821abef, 0x58488bc0,
+	0x586f6fda, 0x5896583b, 0x58bd44e2, 0x58e435ce,
+	0x590b2aff, 0x59322473, 0x59592229, 0x59802420,
+	0x59a72a59, 0x59ce34d0, 0x59f54387, 0x5a1c567b,
+	0x5a436dac, 0x5a6a8919, 0x5a91a8c1, 0x5ab8cca3,
+	0x5adff4be, 0x5b072111, 0x5b2e519c, 0x5b55865e,
+	0x5b7cbf54, 0x5ba3fc80, 0x5bcb3ddf, 0x5bf28371,
+	0x5c19cd35, 0x5c411b2a, 0x5c686d4f, 0x5c8fc3a4,
+	0x5cb71e27, 0x5cde7cd7, 0x5d05dfb4, 0x5d2d46bd,
+	0x5d54b1f0, 0x5d7c214e, 0x5da394d4, 0x5dcb0c83,
+	0x5df28859, 0x5e1a0856, 0x5e418c78, 0x5e6914be,
+	0x5e90a129, 0x5eb831b7, 0x5edfc667, 0x5f075f38,
+	0x5f2efc29, 0x5f569d3a, 0x5f7e426a, 0x5fa5ebb7,
+	0x5fcd9921, 0x5ff54aa8, 0x601d004a, 0x6044ba06,
+	0x606c77dc, 0x609439ca, 0x60bbffd0, 0x60e3c9ee,
+	0x610b9821, 0x61336a6a, 0x615b40c8, 0x61831b39,
+	0x61aaf9bd, 0x61d2dc53, 0x61fac2fa, 0x6222adb2,
+	0x624a9c79, 0x62728f4f, 0x629a8633, 0x62c28123,
+	0x62ea8020, 0x63128329, 0x633a8a3c, 0x63629559,
+	0x638aa47f, 0x63b2b7ad, 0x63dacee2, 0x6402ea1e,
+	0x642b0960, 0x64532ca6, 0x647b53f1, 0x64a37f3f,
+	0x64cbae8f, 0x64f3e1e2, 0x651c1935, 0x65445488,
+	0x656c93db, 0x6594d72c, 0x65bd1e7b, 0x65e569c7,
+	0x660db90f, 0x66360c53, 0x665e6391, 0x6686bec9,
+	0x66af1dfa, 0x66d78123, 0x66ffe844, 0x6728535b,
+	0x6750c268, 0x6779356b, 0x67a1ac62, 0x67ca274c,
+	0x67f2a629, 0x681b28f9, 0x6843afb9, 0x686c3a6a,
+	0x6894c90b, 0x68bd5b9b, 0x68e5f219, 0x690e8c84,
+	0x69372add, 0x695fcd21, 0x69887350, 0x69b11d6a,
+	0x69d9cb6d, 0x6a027d5a, 0x6a2b332f, 0x6a53eceb,
+	0x6a7caa8d, 0x6aa56c16, 0x6ace3184, 0x6af6fad6,
+	0x6b1fc80c, 0x6b489925, 0x6b716e20, 0x6b9a46fd,
+	0x6bc323bb, 0x6bec0458, 0x6c14e8d5, 0x6c3dd130,
+	0x6c66bd69, 0x6c8fad80, 0x6cb8a172, 0x6ce19940,
+	0x6d0a94e9, 0x6d33946d, 0x6d5c97ca, 0x6d859eff,
+	0x6daeaa0d, 0x6dd7b8f1, 0x6e00cbad, 0x6e29e23e,
+	0x6e52fca4, 0x6e7c1adf, 0x6ea53cee, 0x6ece62cf,
+	0x6ef78c83, 0x6f20ba09, 0x6f49eb5f, 0x6f732085,
+	0x6f9c597b, 0x6fc59640, 0x6feed6d3, 0x70181b33,
+	0x70416360, 0x706aaf59, 0x7093ff1d, 0x70bd52ab,
+	0x70e6aa04, 0x71100525, 0x7139640f, 0x7162c6c1,
+	0x718c2d3a, 0x71b5977a, 0x71df057f, 0x72087749,
+	0x7231ecd8, 0x725b662a, 0x7284e33f, 0x72ae6417,
+	0x72d7e8b0, 0x7301710a, 0x732afd24, 0x73548cfe,
+	0x737e2097, 0x73a7b7ee, 0x73d15303, 0x73faf1d5,
+	0x74249462, 0x744e3aac, 0x7477e4b0, 0x74a1926e,
+	0x74cb43e6, 0x74f4f917, 0x751eb201, 0x75486ea1,
+	0x75722ef9, 0x759bf307, 0x75c5baca, 0x75ef8642,
+	0x7619556f, 0x7643284f, 0x766cfee2, 0x7696d928,
+	0x76c0b71f, 0x76ea98c7, 0x77147e20, 0x773e6728,
+	0x776853df, 0x77924445, 0x77bc3858, 0x77e63019,
+	0x78102b85, 0x783a2a9e, 0x78642d62, 0x788e33d1,
+	0x78b83de9, 0x78e24bab, 0x790c5d15, 0x79367228,
+	0x79608ae1, 0x798aa742, 0x79b4c748, 0x79deeaf4,
+	0x7a091245, 0x7a333d3a, 0x7a5d6bd2, 0x7a879e0e,
+	0x7ab1d3ec, 0x7adc0d6b, 0x7b064a8c, 0x7b308b4d,
+	0x7b5acfae, 0x7b8517ae, 0x7baf634c, 0x7bd9b289,
+	0x7c040563, 0x7c2e5bda, 0x7c58b5ec, 0x7c83139b,
+	0x7cad74e4, 0x7cd7d9c7, 0x7d024244, 0x7d2cae5a,
+	0x7d571e09, 0x7d81914f, 0x7dac082d, 0x7dd682a1,
+	0x7e0100ac, 0x7e2b824b, 0x7e560780, 0x7e809048,
+	0x7eab1ca5, 0x7ed5ac94, 0x7f004015, 0x7f2ad729,
 	0x7f5571cd, 0x7f801003, 0x7faab1c8, 0x7fd5571d
 };
 
 
 const Word32 invSBF[24] = {
-  0x3FFD34FC, 0x2D3F8000, 0x24F18C7E, 0x1FFE9A7E, 
-  0x1C9DF10C, 0x1A1F851A, 0x182FE994, 0x169FC000, 
-  0x15542AAA, 0x143C31C2, 0x134B1B6C, 0x127920BE, 
-  0x11BF2FCC, 0x111A749E, 0x1085FC42, 0x0FFFA7BE, 
-  0x0F855818, 0x0F14EE56, 0x0EAE6A78, 0x0E4EF886, 
+  0x3FFD34FC, 0x2D3F8000, 0x24F18C7E, 0x1FFE9A7E,
+  0x1C9DF10C, 0x1A1F851A, 0x182FE994, 0x169FC000,
+  0x15542AAA, 0x143C31C2, 0x134B1B6C, 0x127920BE,
+  0x11BF2FCC, 0x111A749E, 0x1085FC42, 0x0FFFA7BE,
+  0x0F855818, 0x0F14EE56, 0x0EAE6A78, 0x0E4EF886,
   0x0DF69880, 0x0DA49568, 0x0D578542, 0x0D101D0C
 };
 
@@ -1353,40 +1353,40 @@
 };
 
 const Word16 sideInfoTabLong[MAX_SFB_LONG + 1] = {
-  9, 9, 9, 9, 9, 9, 9, 9, 9, 
-  9, 9, 9, 9, 9, 9, 9, 9, 9, 
-  9, 9, 9, 9, 9, 9, 9, 9, 9, 
-  9, 9, 9, 9, 14, 14, 14, 14, 
-  14, 14, 14, 14, 14, 14, 14, 
-  14, 14, 14, 14, 14, 14, 14, 
+  9, 9, 9, 9, 9, 9, 9, 9, 9,
+  9, 9, 9, 9, 9, 9, 9, 9, 9,
+  9, 9, 9, 9, 9, 9, 9, 9, 9,
+  9, 9, 9, 9, 14, 14, 14, 14,
+  14, 14, 14, 14, 14, 14, 14,
+  14, 14, 14, 14, 14, 14, 14,
   14, 14, 14
 };
 
 const Word16 sideInfoTabShort[MAX_SFB_SHORT + 1] = {
-  7, 7, 7, 7, 7, 7, 7, 10, 10, 
+  7, 7, 7, 7, 7, 7, 7, 10, 10,
   10, 10, 10, 10, 10, 13, 13
 };
 
 Word32 specExpMantTableComb_enc[4][14] =
 {
-  {0x40000000,  0x50a28be6,  0x6597fa95,  0x40000000, 
-   0x50a28be6,  0x6597fa95,  0x40000000,  0x50a28be6, 
-   0x6597fa95,  0x40000000,  0x50a28be6,  0x6597fa95, 
-   0x40000000,  0x50a28be6}, 
+  {0x40000000,  0x50a28be6,  0x6597fa95,  0x40000000,
+   0x50a28be6,  0x6597fa95,  0x40000000,  0x50a28be6,
+   0x6597fa95,  0x40000000,  0x50a28be6,  0x6597fa95,
+   0x40000000,  0x50a28be6},
 
-  {0x4c1bf829,  0x5fe4435e,  0x78d0df9c,  0x4c1bf829, 
-   0x5fe4435e,  0x78d0df9c,  0x4c1bf829,  0x5fe4435e, 
-   0x78d0df9c,  0x4c1bf829,  0x5fe4435e,  0x78d0df9c, 
-   0x4c1bf829,  0x5fe4435e}, 
+  {0x4c1bf829,  0x5fe4435e,  0x78d0df9c,  0x4c1bf829,
+   0x5fe4435e,  0x78d0df9c,  0x4c1bf829,  0x5fe4435e,
+   0x78d0df9c,  0x4c1bf829,  0x5fe4435e,  0x78d0df9c,
+   0x4c1bf829,  0x5fe4435e},
 
-  {0x5a82799a,  0x7208f81d,  0x47d66b0f,  0x5a82799a, 
-   0x7208f81d,  0x47d66b0f,  0x5a82799a,  0x7208f81d, 
-   0x47d66b0f,  0x5a82799a,  0x7208f81d,  0x47d66b0f, 
-   0x5a82799a,  0x7208f81d}, 
+  {0x5a82799a,  0x7208f81d,  0x47d66b0f,  0x5a82799a,
+   0x7208f81d,  0x47d66b0f,  0x5a82799a,  0x7208f81d,
+   0x47d66b0f,  0x5a82799a,  0x7208f81d,  0x47d66b0f,
+   0x5a82799a,  0x7208f81d},
 
-  {0x6ba27e65,  0x43ce3e4b,  0x556e0424,  0x6ba27e65, 
-   0x43ce3e4b,  0x556e0424,  0x6ba27e65,  0x43ce3e4b, 
-   0x556e0424,  0x6ba27e65,  0x43ce3e4b,  0x556e0424, 
+  {0x6ba27e65,  0x43ce3e4b,  0x556e0424,  0x6ba27e65,
+   0x43ce3e4b,  0x556e0424,  0x6ba27e65,  0x43ce3e4b,
+   0x556e0424,  0x6ba27e65,  0x43ce3e4b,  0x556e0424,
    0x6ba27e65,  0x43ce3e4b}
 };
 
@@ -1417,12 +1417,12 @@
 };
 
 const int sampRateTab[NUM_SAMPLE_RATES] = {
-    96000, 88200, 64000, 48000, 44100, 32000, 
+    96000, 88200, 64000, 48000, 44100, 32000,
 	24000, 22050, 16000, 12000, 11025,  8000
 };
 
 
-const int	rates[8] = {		
+const int	rates[8] = {
 	160, 240, 320, 400, 480, 560, 640, 0
 };
 
@@ -1507,7 +1507,7 @@
 };
 
 /*
-  these tables are used only for counting and 
+  these tables are used only for counting and
   are stored in packed format
 */
 const UWord16 huff_ltab1_2[3][3][3][3]=
@@ -2260,12 +2260,12 @@
 };
 
 const Word32 m_log2_table[INT_BITS] = {
-  0x00000000,0x4ae00d00,0x2934f080,0x15c01a3f, 
-  0x0b31fb80,0x05aeb4e0,0x02dcf2d0,0x016fe50c, 
+  0x00000000,0x4ae00d00,0x2934f080,0x15c01a3f,
+  0x0b31fb80,0x05aeb4e0,0x02dcf2d0,0x016fe50c,
   0x00b84e23,0x005c3e10,0x002e24ca,0x001713d6,
   0x000b8a47,0x0005c53b,0x0002e2a3,0x00017153,
   0x0000b8aa,0x00005c55,0x00002e2b,0x00001715,
-  0x00000b8b,0x000005c5,0x000002e3,0x00000171, 
+  0x00000b8b,0x000005c5,0x000002e3,0x00000171,
   0x000000b9,0x0000005c,0x0000002e,0x00000017,
   0x0000000c,0x00000006,0x00000003,0x00000001
 };
@@ -2344,7 +2344,7 @@
 };
 
 
-const unsigned char bitrevTab[17 + 129] = 
+const unsigned char bitrevTab[17 + 129] =
 {
 /* 64 */
 0x01, 0x08, 0x02, 0x04, 0x03, 0x0c, 0x05, 0x0a, 0x07, 0x0e, 0x0b, 0x0d, 0x00, 0x06, 0x09, 0x0f,
@@ -2360,4 +2360,4 @@
 0x4d, 0x59, 0x4f, 0x79, 0x53, 0x65, 0x57, 0x75, 0x5b, 0x6d, 0x5f, 0x7d, 0x67, 0x73, 0x6f, 0x7b,
 0x00, 0x08, 0x14, 0x1c, 0x22, 0x2a, 0x36, 0x3e, 0x41, 0x49, 0x55, 0x5d, 0x63, 0x6b, 0x77, 0x7f,
 0x00,
-};
\ No newline at end of file
+};
diff --git a/media/libstagefright/codecs/aacenc/src/aacenc.c b/media/libstagefright/codecs/aacenc/src/aacenc.c
index 975f598..ad2f29a 100644
--- a/media/libstagefright/codecs/aacenc/src/aacenc.c
+++ b/media/libstagefright/codecs/aacenc/src/aacenc.c
@@ -48,7 +48,7 @@
 
 	interMem = 0;
 	error = 0;
-	
+
 	/* init the memory operator */
 	if(pUserData == NULL || pUserData->memflag != VO_IMF_USERMEMOPERATOR || pUserData->memData == NULL )
 	{
@@ -113,7 +113,7 @@
 		{
 			mem_free(pMemOP, hAacEnc, VO_INDEX_ENC_AAC);
 			hAacEnc = NULL;
-		}		
+		}
 		*phCodec = NULL;
 		return VO_ERR_OUTOF_MEMORY;
 	}
@@ -168,9 +168,9 @@
 	{
 		return VO_ERR_INVALID_ARG;
 	}
-	
+
 	hAacEnc = (AAC_ENCODER *)hCodec;
-	
+
 	/* init input pcm buffer and length*/
 	hAacEnc->inbuf = (short *)pInput->Buffer;
 	hAacEnc->inlen = pInput->Length / sizeof(short);
@@ -178,12 +178,12 @@
 
 	hAacEnc->encbuf = hAacEnc->inbuf;
 	hAacEnc->enclen = hAacEnc->inlen;
-	
+
 	/* rebuild intra pcm buffer and length*/
 	if(hAacEnc->intlen)
 	{
 		length = min(hAacEnc->config.nChannelsIn*AACENC_BLOCKSIZE - hAacEnc->intlen, hAacEnc->inlen);
-		hAacEnc->voMemop->Copy(VO_INDEX_ENC_AAC, hAacEnc->intbuf + hAacEnc->intlen, 
+		hAacEnc->voMemop->Copy(VO_INDEX_ENC_AAC, hAacEnc->intbuf + hAacEnc->intlen,
 			hAacEnc->inbuf, length*sizeof(short));
 
 		hAacEnc->encbuf = hAacEnc->intbuf;
@@ -192,7 +192,7 @@
 		hAacEnc->inbuf += length;
 		hAacEnc->inlen -= length;
 	}
-	
+
 	return VO_ERR_NONE;
 }
 
@@ -219,11 +219,11 @@
 	 /* check the input pcm buffer and length*/
 	 if(NULL == hAacEnc->encbuf || hAacEnc->enclen < inbuflen)
 	 {
-		length = hAacEnc->enclen;		
+		length = hAacEnc->enclen;
 		if(hAacEnc->intlen == 0)
-		{	
-			hAacEnc->voMemop->Copy(VO_INDEX_ENC_AAC, hAacEnc->intbuf, 
-				hAacEnc->encbuf, length*sizeof(short));		
+		{
+			hAacEnc->voMemop->Copy(VO_INDEX_ENC_AAC, hAacEnc->intbuf,
+				hAacEnc->encbuf, length*sizeof(short));
 			hAacEnc->uselength += length*sizeof(short);
 		}
 		else
@@ -236,7 +236,7 @@
 		pOutput->Length = 0;
 		if(pOutInfo)
 			pOutInfo->InputUsed = hAacEnc->uselength;
-		return VO_ERR_INPUT_BUFFER_SMALL;	
+		return VO_ERR_INPUT_BUFFER_SMALL;
 	 }
 
 	 /* check the output aac buffer and length*/
@@ -254,7 +254,7 @@
 	 /* update the input pcm buffer and length*/
 	 if(hAacEnc->intlen)
 	 {
-		length = inbuflen - hAacEnc->intlen;		
+		length = inbuflen - hAacEnc->intlen;
 		hAacEnc->encbuf = hAacEnc->inbuf;
 		hAacEnc->enclen = hAacEnc->inlen;
 		hAacEnc->uselength += length*sizeof(short);
@@ -265,7 +265,7 @@
 		 hAacEnc->encbuf = hAacEnc->encbuf + inbuflen;
 		 hAacEnc->enclen = hAacEnc->enclen - inbuflen;
 		 hAacEnc->uselength += inbuflen*sizeof(short);
-	 }	 
+	 }
 
 	 /* update the output aac information */
 	if(pOutInfo)
@@ -287,7 +287,7 @@
 VO_U32 VO_API voAACEncUninit(VO_HANDLE hCodec)
 {
 	AAC_ENCODER* hAacEnc = (AAC_ENCODER*)hCodec;
-	
+
 	if(NULL != hAacEnc)
 	{
 		/* close the aac encoder */
@@ -296,7 +296,7 @@
 		/* free the aac encoder handle*/
 		mem_free(hAacEnc->voMemop, hAacEnc, VO_INDEX_ENC_AAC);
 		hAacEnc = NULL;
-	}	
+	}
 
 	return VO_ERR_NONE;
 }
@@ -319,7 +319,7 @@
 
 	if(NULL == hAacEnc)
 		return VO_ERR_INVALID_ARG;
-	
+
 	switch(uParamID)
 	{
 	case VO_PID_AAC_ENCPARAM:  /* init aac encoder parameter*/
@@ -354,11 +354,11 @@
 		SampleRateIdx = i;
 
 		tmp = 441;
-		if(config.sampleRate%8000 == 0) 
+		if(config.sampleRate%8000 == 0)
 			tmp =480;
 		/* check the bitrate */
 		if(config.bitRate!=0 && (config.bitRate/config.nChannelsOut < 4000) ||
-           (config.bitRate/config.nChannelsOut > 160000) || 
+           (config.bitRate/config.nChannelsOut > 160000) ||
 		   (config.bitRate > config.sampleRate*6*config.nChannelsOut))
 		{
 			config.bitRate = 640*config.sampleRate/tmp*config.nChannelsOut;
@@ -385,7 +385,7 @@
 
 		/* init aac encoder core */
 		ret = AacEncOpen(hAacEnc, config);
-		if(ret) 
+		if(ret)
 			return VO_ERR_AUDIO_UNSFEATURE;
 		break;
 	case VO_PID_AUDIO_FORMAT:	/* init pcm channel and samplerate*/
@@ -426,7 +426,7 @@
 
 		/* update the bitrates */
 		tmp = 441;
-		if(config.sampleRate%8000 == 0) 
+		if(config.sampleRate%8000 == 0)
 			tmp =480;
 
 		config.bitRate = 640*config.sampleRate/tmp*config.nChannelsOut;
@@ -449,10 +449,10 @@
 		}
 
 		config.bandWidth = BandwithCoefTab[i][SampleRateIdx];
-		
+
 		/* init aac encoder core */
 		ret = AacEncOpen(hAacEnc, config);
-		if(ret) 
+		if(ret)
 			return VO_ERR_AUDIO_UNSFEATURE;
 		break;
 	default:
@@ -483,7 +483,7 @@
 {
 	if(pDecHandle == NULL)
 		return VO_ERR_INVALID_ARG;
-		
+
 	pDecHandle->Init = voAACEncInit;
 	pDecHandle->SetInputData = voAACEncSetInputData;
 	pDecHandle->GetOutputData = voAACEncGetOutputData;
@@ -492,4 +492,4 @@
 	pDecHandle->Uninit = voAACEncUninit;
 
 	return VO_ERR_NONE;
-}
\ No newline at end of file
+}
diff --git a/media/libstagefright/codecs/aacenc/src/aacenc_core.c b/media/libstagefright/codecs/aacenc/src/aacenc_core.c
index b69a017..cecbc8f 100644
--- a/media/libstagefright/codecs/aacenc/src/aacenc_core.c
+++ b/media/libstagefright/codecs/aacenc/src/aacenc_core.c
@@ -43,8 +43,8 @@
   config->adtsUsed        = 1;
   config->nChannelsIn     = 2;
   config->nChannelsOut    = 2;
-  config->bitRate         = 128000;                      
-  config->bandWidth       = 0;                           
+  config->bitRate         = 128000;
+  config->bandWidth       = 0;
 }
 
 /********************************************************************************
@@ -63,11 +63,11 @@
   Word16 profile = 1;
 
   ELEMENT_INFO *elInfo = NULL;
-   
+
   if (hAacEnc==0) {
-    error=1;                                  
+    error=1;
   }
-   
+
   if (!error) {
     hAacEnc->config = config;
   }
@@ -83,7 +83,7 @@
 
   if (!error) {
     /* use or not tns tool for long and short block */
-	 Word16 tnsMask=3;      
+	 Word16 tnsMask=3;
 
 	/* init encoder psychoacoustic */
     error = psyMainInit(&hAacEnc->psyKernel,
@@ -107,10 +107,10 @@
     qcInit.elInfo = &hAacEnc->elInfo;
 
     qcInit.maxBits = (Word16) (MAXBITS_COEF*elInfo->nChannelsInEl);
-    qcInit.bitRes = qcInit.maxBits;                                      
+    qcInit.bitRes = qcInit.maxBits;
     qcInit.averageBits = (Word16) ((config.bitRate * FRAME_LEN_LONG) / config.sampleRate);
 
-    qcInit.padding.paddingRest = config.sampleRate;                          
+    qcInit.padding.paddingRest = config.sampleRate;
 
     qcInit.meanPe = (Word16) ((10 * FRAME_LEN_LONG * hAacEnc->config.bandWidth) /
                                               (config.sampleRate>>1));
@@ -118,17 +118,17 @@
     qcInit.maxBitFac = (Word16) ((100 * (MAXBITS_COEF-MINBITS_COEF)* elInfo->nChannelsInEl)/
                                                  (qcInit.averageBits?qcInit.averageBits:1));
 
-    qcInit.bitrate = config.bitRate;                                     
+    qcInit.bitrate = config.bitRate;
 
     error = QCInit(&hAacEnc->qcKernel, &qcInit);
   }
 
   /* init bitstream encoder */
   if (!error) {
-    hAacEnc->bseInit.nChannels   = elInfo->nChannelsInEl;                
-    hAacEnc->bseInit.bitrate     = config.bitRate;                       
-    hAacEnc->bseInit.sampleRate  = config.sampleRate;                    
-    hAacEnc->bseInit.profile     = profile;                              
+    hAacEnc->bseInit.nChannels   = elInfo->nChannelsInEl;
+    hAacEnc->bseInit.bitrate     = config.bitRate;
+    hAacEnc->bseInit.sampleRate  = config.sampleRate;
+    hAacEnc->bseInit.profile     = profile;
   }
 
   return error;
@@ -146,20 +146,20 @@
                     const UWord8 *ancBytes,     /*!< pointer to ancillary data bytes */
                     Word16 *numAncBytes,		/*!< number of ancillary Data Bytes */
                     UWord8 *outBytes,           /*!< pointer to output buffer (must be large MINBITS_COEF/8*MAX_CHANNELS bytes) */
-                    Word32 *numOutBytes         /*!< number of bytes in output buffer after processing */
+                    VO_U32 *numOutBytes         /*!< number of bytes in output buffer after processing */
                     )
 {
   ELEMENT_INFO *elInfo = &aacEnc->elInfo;
   Word16 globUsedBits;
   Word16 ancDataBytes, ancDataBytesLeft;
-  
-  ancDataBytes = ancDataBytesLeft = *numAncBytes;                          
+
+  ancDataBytes = ancDataBytesLeft = *numAncBytes;
 
   /* init output aac data buffer and length */
   aacEnc->hBitStream = CreateBitBuffer(&aacEnc->bitStream, outBytes, *numOutBytes);
 
   /* psychoacoustic process */
-  psyMain(aacEnc->config.nChannelsOut,    
+  psyMain(aacEnc->config.nChannelsOut,
           elInfo,
           timeSignal,
           &aacEnc->psyKernel.psyData[elInfo->ChannelIndex[0]],
@@ -175,9 +175,9 @@
   AdjustBitrate(&aacEnc->qcKernel,
                 aacEnc->config.bitRate,
                 aacEnc->config.sampleRate);
-    
+
   /* quantization and coding process */
-  QCMain(&aacEnc->qcKernel,         
+  QCMain(&aacEnc->qcKernel,
          &aacEnc->qcKernel.elementBits,
          &aacEnc->qcKernel.adjThr.adjThrStateElem,
          &aacEnc->psyOut.psyOutChannel[elInfo->ChannelIndex[0]],
@@ -193,11 +193,11 @@
                          &aacEnc->qcOut);
 
   /* write bitstream process */
-  WriteBitstream(aacEnc->hBitStream,				 
+  WriteBitstream(aacEnc->hBitStream,
                  *elInfo,
                  &aacEnc->qcOut,
                  &aacEnc->psyOut,
-                 &globUsedBits,				 
+                 &globUsedBits,
                  ancBytes,
 				 aacEnc->psyKernel.sampleRateIdx);
 
@@ -219,7 +219,7 @@
 **********************************************************************************/
 void AacEncClose (AAC_ENCODER* hAacEnc, VO_MEM_OPERATOR *pMemOP)
 {
-  if (hAacEnc) {  
+  if (hAacEnc) {
     QCDelete(&hAacEnc->qcKernel, pMemOP);
 
     QCOutDelete(&hAacEnc->qcOut, pMemOP);
diff --git a/media/libstagefright/codecs/aacenc/src/adj_thr.c b/media/libstagefright/codecs/aacenc/src/adj_thr.c
index 83b43a1..07b33b7 100644
--- a/media/libstagefright/codecs/aacenc/src/adj_thr.c
+++ b/media/libstagefright/codecs/aacenc/src/adj_thr.c
@@ -26,6 +26,7 @@
 #include "adj_thr.h"
 #include "qc_data.h"
 #include "line_pe.h"
+#include <string.h>
 
 
 #define  minSnrLimit    0x6666 /* 1 dB */
@@ -71,7 +72,7 @@
   Word32 *pthrExp, *psfbThre;
   for (ch=0; ch<nChannels; ch++) {
     PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
-	 for(sfbGrp = 0; sfbGrp < psyOutChan->sfbCnt; sfbGrp+= psyOutChan->sfbPerGroup)	 
+	 for(sfbGrp = 0; sfbGrp < psyOutChan->sfbCnt; sfbGrp+= psyOutChan->sfbPerGroup)
 	  pthrExp = &(thrExp[ch][sfbGrp]);
 	  psfbThre = psyOutChan->sfbThreshold + sfbGrp;
 	  for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
@@ -96,21 +97,21 @@
   Word32 nSfb, avgEn;
   Word16 log_avgEn = 0;
   Word32 startRatio_x_avgEn = 0;
-                                                                           
+
 
   for (ch=0; ch<nChannels; ch++) {
     PSY_OUT_CHANNEL* psyOutChan = &psyOutChannel[ch];
 
     /* calc average energy per scalefactor band */
-    avgEn = 0;                                                           
-    nSfb = 0;                                                            
+    avgEn = 0;
+    nSfb = 0;
     for (sfbOffs=0; sfbOffs<psyOutChan->sfbCnt; sfbOffs+=psyOutChan->sfbPerGroup) {
       for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
         avgEn = L_add(avgEn, psyOutChan->sfbEnergy[sfbOffs+sfb]);
         nSfb = nSfb + 1;
       }
     }
-     
+
     if (nSfb > 0) {
 	  avgEn = avgEn / nSfb;
 
@@ -118,7 +119,7 @@
       startRatio_x_avgEn = fixmul(msaParam->startRatio, avgEn);
     }
 
-    
+
     /* reduce minSnr requirement by minSnr^minSnrRed dependent on avgEn/sfbEn */
     for (sfbOffs=0; sfbOffs<psyOutChan->sfbCnt; sfbOffs+=psyOutChan->sfbPerGroup) {
       for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
@@ -126,22 +127,22 @@
           Word16 dbRatio, minSnrRed;
           Word32 snrRed;
           Word16 newMinSnr;
-          
+
           dbRatio = log_avgEn - logSfbEnergy[ch][sfbOffs+sfb];
           dbRatio = dbRatio + (dbRatio << 1);
 
           minSnrRed = 110 - ((dbRatio + (dbRatio << 1)) >> 2);
-          minSnrRed = max(minSnrRed, 20); /* 110: (0.375(redOffs)+1)*80,  
+          minSnrRed = max(minSnrRed, 20); /* 110: (0.375(redOffs)+1)*80,
                                                3: 0.00375(redRatioFac)*80
                                                20: 0.25(maxRed) * 80 */
 
-          snrRed = minSnrRed * iLog4((psyOutChan->sfbMinSnr[sfbOffs+sfb] << 16)); 
-          /* 
+          snrRed = minSnrRed * iLog4((psyOutChan->sfbMinSnr[sfbOffs+sfb] << 16));
+          /*
              snrRedI si now scaled by 80 (minSnrRed) and 4 (ffr_iLog4)
           */
-        
+
           newMinSnr = round16(pow2_xy(snrRed,80*4));
-         
+
           psyOutChan->sfbMinSnr[sfbOffs+sfb] = min(newMinSnr, minSnrLimit);
         }
       }
@@ -169,7 +170,7 @@
 
   for (ch=0; ch<nChannels; ch++) {
     PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
-     
+
     if (psyOutChan->windowSequence != SHORT_WINDOW) {
       for(sfbGrp = 0;sfbGrp < psyOutChan->sfbCnt;sfbGrp+= psyOutChan->sfbPerGroup){
          psfbSpreadEn = psyOutChan->sfbSpreadedEnergy + sfbGrp;
@@ -194,7 +195,7 @@
   if (ahParam->modifyMinSnr) {
     for(ch=0; ch<nChannels; ch++) {
       PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
-         
+
       if (psyOutChan->windowSequence != SHORT_WINDOW)
         threshold = HOLE_THR_LONG;
       else
@@ -204,39 +205,39 @@
         Word16 *psfbMinSnr = psyOutChan->sfbMinSnr + sfbGrp;
 		for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
           Word32 sfbEn, sfbEnm1, sfbEnp1, avgEn;
-             
+
           if (sfb > 0)
             sfbEnm1 = psyOutChan->sfbEnergy[sfbGrp+sfb-1];
           else
             sfbEnm1 = psyOutChan->sfbEnergy[sfbGrp];
-             
+
           if (sfb < (psyOutChan->maxSfbPerGroup-1))
             sfbEnp1 = psyOutChan->sfbEnergy[sfbGrp+sfb+1];
           else
             sfbEnp1 = psyOutChan->sfbEnergy[sfbGrp+sfb];
           avgEn = (sfbEnm1 + sfbEnp1) >> 1;
-          sfbEn = psyOutChan->sfbEnergy[sfbGrp+sfb];                             
-             
+          sfbEn = psyOutChan->sfbEnergy[sfbGrp+sfb];
+
           if (sfbEn > avgEn && avgEn > 0) {
             Word32 tmpMinSnr;
             shift = norm_l(sfbEn);
 			tmpMinSnr = Div_32(L_mpy_ls(avgEn, minSnrLimit) << shift, sfbEn << shift );
-            tmpMinSnr = max(tmpMinSnr, HOLE_THR_LONG);                  
+            tmpMinSnr = max(tmpMinSnr, HOLE_THR_LONG);
             tmpMinSnr = max(tmpMinSnr, threshold);
             *psfbMinSnr = min(*psfbMinSnr, tmpMinSnr);
           }
           /* valley ? */
-             
+
           if ((sfbEn < (avgEn >> 1)) && (sfbEn > 0)) {
             Word32 tmpMinSnr;
-            Word32 minSnrEn = L_mpy_wx(avgEn, *psfbMinSnr);                 
-             
+            Word32 minSnrEn = L_mpy_wx(avgEn, *psfbMinSnr);
+
             if(minSnrEn < sfbEn) {
 			  shift = norm_l(sfbEn);
               tmpMinSnr = Div_32( minSnrEn << shift, sfbEn<<shift);
             }
             else {
-              tmpMinSnr = MAX_16;                                             
+              tmpMinSnr = MAX_16;
             }
             tmpMinSnr = min(minSnrLimit, tmpMinSnr);
 
@@ -251,7 +252,7 @@
 
   /* stereo: adapt the minimum requirements sfbMinSnr of mid and
      side channels */
-   
+
   if (nChannels == 2) {
     PSY_OUT_CHANNEL *psyOutChanM = &psyOutChannel[0];
     PSY_OUT_CHANNEL *psyOutChanS = &psyOutChannel[1];
@@ -260,30 +261,30 @@
         Word32 sfbEnM = psyOutChanM->sfbEnergy[sfb];
         Word32 sfbEnS = psyOutChanS->sfbEnergy[sfb];
         Word32 maxSfbEn = max(sfbEnM, sfbEnS);
-        Word32 maxThr = L_mpy_wx(maxSfbEn, psyOutChanM->sfbMinSnr[sfb]) >> 1;        
-         
+        Word32 maxThr = L_mpy_wx(maxSfbEn, psyOutChanM->sfbMinSnr[sfb]) >> 1;
+
         if(maxThr >= sfbEnM) {
-          psyOutChanM->sfbMinSnr[sfb] = MAX_16;                                          
+          psyOutChanM->sfbMinSnr[sfb] = MAX_16;
         }
         else {
-          shift = norm_l(sfbEnM); 
-		  psyOutChanM->sfbMinSnr[sfb] = min(max(psyOutChanM->sfbMinSnr[sfb], 
+          shift = norm_l(sfbEnM);
+		  psyOutChanM->sfbMinSnr[sfb] = min(max(psyOutChanM->sfbMinSnr[sfb],
 			  round16(Div_32(maxThr<<shift, sfbEnM << shift))), minSnrLimit);
         }
-         
+
         if(maxThr >= sfbEnS) {
           psyOutChanS->sfbMinSnr[sfb] = MAX_16;
         }
         else {
 		  shift = norm_l(sfbEnS);
-          psyOutChanS->sfbMinSnr[sfb] = min(max(psyOutChanS->sfbMinSnr[sfb], 
+          psyOutChanS->sfbMinSnr[sfb] = min(max(psyOutChanS->sfbMinSnr[sfb],
 			  round16(Div_32(maxThr << shift, sfbEnS << shift))), minSnrLimit);
         }
 
-         
+
         if (sfbEnM > psyOutChanM->sfbSpreadedEnergy[sfb])
           psyOutChanS->sfbSpreadedEnergy[sfb] = L_mpy_ls(sfbEnS, MS_THRSPREAD_COEF);
-         
+
         if (sfbEnS > psyOutChanS->sfbSpreadedEnergy[sfb])
           psyOutChanM->sfbSpreadedEnergy[sfb] = L_mpy_ls(sfbEnM, MS_THRSPREAD_COEF);
       }
@@ -297,7 +298,7 @@
     for(sfbGrp = 0;sfbGrp < psyOutChan->sfbCnt;sfbGrp+= psyOutChan->sfbPerGroup){
       Word16 *pahFlag = ahFlag[ch] + sfbGrp;
 	  for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
-               
+
         if ((psyOutChan->sfbSpreadedEnergy[sfbGrp+sfb] > psyOutChan->sfbEnergy[sfbGrp+sfb]) ||
             (psyOutChan->sfbEnergy[sfbGrp+sfb] <= psyOutChan->sfbThreshold[sfbGrp+sfb]) ||
             (psyOutChan->sfbMinSnr[sfbGrp+sfb] == MAX_16)) {
@@ -308,7 +309,7 @@
         }
       }
       for (sfb=psyOutChan->maxSfbPerGroup; sfb<psyOutChan->sfbPerGroup; sfb++) {
-        *pahFlag++ = NO_AH;                                                          
+        *pahFlag++ = NO_AH;
       }
     }
   }
@@ -331,15 +332,15 @@
   Word16 ch, sfb, sfbGrp;
   int ipe, iconstPart, inActiveLines;
 
-  ipe = 0;                                                       
-  iconstPart = 0;                                                
-  inActiveLines = 0;                                             
+  ipe = 0;
+  iconstPart = 0;
+  inActiveLines = 0;
   for(ch=0; ch<nChannels; ch++) {
     PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
     PE_CHANNEL_DATA *peChanData = &peData->peChannelData[ch];
     for(sfbGrp = 0;sfbGrp < psyOutChan->sfbCnt;sfbGrp+= psyOutChan->sfbPerGroup){
       for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
-         
+
         if (ahFlag[ch][sfbGrp+sfb] < AH_ACTIVE) {
           ipe = ipe + peChanData->sfbPe[sfbGrp+sfb];
           iconstPart = iconstPart + peChanData->sfbConstPart[sfbGrp+sfb];
@@ -349,9 +350,9 @@
     }
   }
 
-  *pe = saturate(ipe);                                                       
-  *constPart = saturate(iconstPart);                                                
-  *nActiveLines = saturate(inActiveLines);  
+  *pe = saturate(ipe);
+  *constPart = saturate(iconstPart);
+  *nActiveLines = saturate(inActiveLines);
 }
 
 /********************************************************************************
@@ -367,16 +368,16 @@
                              const Word32     redVal)
 {
   Word32 sfbThrReduced;
-  Word32 *psfbEn, *psfbThr;     
+  Word32 *psfbEn, *psfbThr;
   Word16 ch, sfb, sfbGrp;
 
   for(ch=0; ch<nChannels; ch++) {
     PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
     for(sfbGrp=0; sfbGrp<psyOutChan->sfbCnt; sfbGrp+=psyOutChan->sfbPerGroup) {
- 	  psfbEn  = psyOutChan->sfbEnergy + sfbGrp;                                      
+ 	  psfbEn  = psyOutChan->sfbEnergy + sfbGrp;
       psfbThr = psyOutChan->sfbThreshold + sfbGrp;
 	  for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
-         
+
         if (*psfbEn > *psfbThr) {
           /* threshold reduction formula */
           Word32 tmp = thrExp[ch][sfbGrp+sfb] + redVal;
@@ -384,11 +385,11 @@
           sfbThrReduced = fixmul(tmp, tmp);
           /* avoid holes */
           tmp = L_mpy_ls(*psfbEn, psyOutChan->sfbMinSnr[sfbGrp+sfb]);
-             
-          if ((sfbThrReduced > tmp) && 
+
+          if ((sfbThrReduced > tmp) &&
               (ahFlag[ch][sfbGrp+sfb] != NO_AH)){
             sfbThrReduced = max(tmp, *psfbThr);
-            ahFlag[ch][sfbGrp+sfb] = AH_ACTIVE;                                          
+            ahFlag[ch][sfbGrp+sfb] = AH_ACTIVE;
           }
 		  *psfbThr = sfbThrReduced;
         }
@@ -426,7 +427,7 @@
   Word32 sfbThrReduced;
 
   /* for each sfb calc relative factors for pe changes */
-  normFactor = 1;                                                                        
+  normFactor = 1;
   for(ch=0; ch<nChannels; ch++) {
     psyOutChan = &psyOutChannel[ch];
     peChanData = &peData->peChannelData[ch];
@@ -436,22 +437,22 @@
 	  pahFlag = ahFlag[ch] + sfbGrp;
 	  for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
         Word32 redThrExp = thrExp[ch][sfbGrp+sfb] + redVal;
-             
-        if (((*pahFlag < AH_ACTIVE) || (deltaPe > 0)) && (redThrExp > 0) ) {
-            
+
+        if (((*pahFlag < AH_ACTIVE) || (deltaPe > 0)) && (redThrExp > 0) && (redThrExp >= *psfbNActiveLines)) {
+
           *psfbPeFactors = (*psfbNActiveLines) * (0x7fffffff / redThrExp);
           normFactor = L_add(normFactor, *psfbPeFactors);
         }
         else {
-          *psfbPeFactors = 0;                                              
+          *psfbPeFactors = 0;
         }
-		psfbPeFactors++; 
+		psfbPeFactors++;
 		pahFlag++; psfbNActiveLines++;
       }
     }
   }
 
- 
+
   /* calculate new thresholds */
   for(ch=0; ch<nChannels; ch++) {
     psyOutChan = &psyOutChannel[ch];
@@ -464,8 +465,8 @@
         /* pe difference for this sfb */
         deltaSfbPe = *psfbPeFactors * deltaPe;
 
-		/* thr3(n) = thr2(n)*2^deltaSfbPe/b(n) */         
-        if (*psfbNActiveLines > 0) {
+		/* thr3(n) = thr2(n)*2^deltaSfbPe/b(n) */
+        if (*psfbNActiveLines > 0 && (normFactor* (*psfbNActiveLines)) != 0) {
           /* new threshold */
           Word32 thrFactor;
           sfbEn  = psyOutChan->sfbEnergy[sfbGrp+sfb];
@@ -476,7 +477,7 @@
               reduce threshold
             */
             thrFactor = pow2_xy(L_negate(deltaSfbPe), (normFactor* (*psfbNActiveLines)));
-              
+
             sfbThrReduced = L_mpy_ls(sfbThr, round16(thrFactor));
           }
           else {
@@ -484,28 +485,28 @@
               increase threshold
             */
             thrFactor = pow2_xy(deltaSfbPe, (normFactor * (*psfbNActiveLines)));
-              
-             
+
+
             if(thrFactor > sfbThr) {
               shift = norm_l(thrFactor);
 			  sfbThrReduced = Div_32( sfbThr << shift, thrFactor<<shift );
             }
             else {
-              sfbThrReduced = MAX_32;                                                                            
+              sfbThrReduced = MAX_32;
             }
 
           }
-            
+
           /* avoid hole */
           sfbEn = L_mpy_ls(sfbEn, psyOutChan->sfbMinSnr[sfbGrp+sfb]);
-             
+
           if ((sfbThrReduced > sfbEn) &&
               (*pahFlag == AH_INACTIVE)) {
             sfbThrReduced = max(sfbEn, sfbThr);
-            *pahFlag = AH_ACTIVE;                                                                  
+            *pahFlag = AH_ACTIVE;
           }
 
-          psyOutChan->sfbThreshold[sfbGrp+sfb] = sfbThrReduced;  
+          psyOutChan->sfbThreshold[sfbGrp+sfb] = sfbThrReduced;
         }
 
 		pahFlag++; psfbNActiveLines++; psfbPeFactors++;
@@ -521,8 +522,8 @@
 * description: if the desired pe can not be reached, reduce pe by reducing minSnr
 *
 **********************************************************************************/
-static void reduceMinSnr(PSY_OUT_CHANNEL  psyOutChannel[MAX_CHANNELS], 
-                         PE_DATA         *peData, 
+static void reduceMinSnr(PSY_OUT_CHANNEL  psyOutChannel[MAX_CHANNELS],
+                         PE_DATA         *peData,
                          Word16           ahFlag[MAX_CHANNELS][MAX_GROUPED_SFB],
                          const Word16     nChannels,
                          const Word16     desiredPe)
@@ -531,9 +532,9 @@
   Word16 deltaPe;
 
   /* start at highest freq down to 0 */
-  sfbSubWin = psyOutChannel[0].maxSfbPerGroup;                                                 
+  sfbSubWin = psyOutChannel[0].maxSfbPerGroup;
   while (peData->pe > desiredPe && sfbSubWin > 0) {
-       
+
     sfbSubWin = sfbSubWin - 1;
     /* loop over all subwindows */
     for (sfb=sfbSubWin; sfb<psyOutChannel[0].sfbCnt;
@@ -541,10 +542,10 @@
       /* loop over all channels */
 		PE_CHANNEL_DATA* peChan = peData->peChannelData;
 		PSY_OUT_CHANNEL* psyOutCh = psyOutChannel;
-		for (ch=0; ch<nChannels; ch++) {           
+		for (ch=0; ch<nChannels; ch++) {
         if (ahFlag[ch][sfb] != NO_AH &&
             psyOutCh->sfbMinSnr[sfb] < minSnrLimit) {
-          psyOutCh->sfbMinSnr[sfb] = minSnrLimit;                                      
+          psyOutCh->sfbMinSnr[sfb] = minSnrLimit;
           psyOutCh->sfbThreshold[sfb] =
             L_mpy_ls(psyOutCh->sfbEnergy[sfb], psyOutCh->sfbMinSnr[sfb]);
 
@@ -552,12 +553,12 @@
           deltaPe = ((peChan->sfbNLines4[sfb] + (peChan->sfbNLines4[sfb] >> 1)) >> 2) -
               peChan->sfbPe[sfb];
           peData->pe = peData->pe + deltaPe;
-          peChan->pe = peChan->pe + deltaPe;		  
+          peChan->pe = peChan->pe + deltaPe;
         }
 		peChan += 1; psyOutCh += 1;
       }
       /* stop if enough has been saved */
-       
+
       if (peData->pe <= desiredPe)
         break;
     }
@@ -567,13 +568,13 @@
 /********************************************************************************
 *
 * function name:allowMoreHoles
-* description: if the desired pe can not be reached, some more scalefactor bands  
+* description: if the desired pe can not be reached, some more scalefactor bands
 *              have to be quantized to zero
 *
 **********************************************************************************/
-static void allowMoreHoles(PSY_OUT_CHANNEL  psyOutChannel[MAX_CHANNELS], 
+static void allowMoreHoles(PSY_OUT_CHANNEL  psyOutChannel[MAX_CHANNELS],
                            PSY_OUT_ELEMENT *psyOutElement,
-                           PE_DATA         *peData, 
+                           PE_DATA         *peData,
                            Word16           ahFlag[MAX_CHANNELS][MAX_GROUPED_SFB],
                            const AH_PARAM  *ahParam,
                            const Word16     nChannels,
@@ -582,46 +583,46 @@
   Word16 ch, sfb;
   Word16 actPe, shift;
 
-  actPe = peData->pe;                                                                    
+  actPe = peData->pe;
 
   /* for MS allow hole in the channel with less energy */
-     
+
   if (nChannels==2 &&
       psyOutChannel[0].windowSequence==psyOutChannel[1].windowSequence) {
     PSY_OUT_CHANNEL *psyOutChanL = &psyOutChannel[0];
     PSY_OUT_CHANNEL *psyOutChanR = &psyOutChannel[1];
     for (sfb=0; sfb<psyOutChanL->sfbCnt; sfb++) {
       Word32 minEn;
-       
+
       if (psyOutElement->toolsInfo.msMask[sfb]) {
         /* allow hole in side channel ? */
         minEn = L_mpy_ls(psyOutChanL->sfbEnergy[sfb], (minSnrLimit * psyOutChanL->sfbMinSnr[sfb]) >> 16);
-           
+
         if (ahFlag[1][sfb] != NO_AH &&
             minEn > psyOutChanR->sfbEnergy[sfb]) {
-          ahFlag[1][sfb] = NO_AH;                                                                
+          ahFlag[1][sfb] = NO_AH;
           psyOutChanR->sfbThreshold[sfb] = L_add(psyOutChanR->sfbEnergy[sfb], psyOutChanR->sfbEnergy[sfb]);
           actPe = actPe - peData->peChannelData[1].sfbPe[sfb];
         }
         /* allow hole in mid channel ? */
         else {
         minEn = L_mpy_ls(psyOutChanR->sfbEnergy[sfb], (minSnrLimit * psyOutChanR->sfbMinSnr[sfb]) >> 16);
-             
+
           if (ahFlag[0][sfb]!= NO_AH &&
               minEn > psyOutChanL->sfbEnergy[sfb]) {
-            ahFlag[0][sfb] = NO_AH;                                                              
+            ahFlag[0][sfb] = NO_AH;
             psyOutChanL->sfbThreshold[sfb] = L_add(psyOutChanL->sfbEnergy[sfb], psyOutChanL->sfbEnergy[sfb]);
             actPe = actPe - peData->peChannelData[0].sfbPe[sfb];
           }
         }
-         
+
         if (actPe < desiredPe)
           break;
       }
     }
   }
 
-  /* subsequently erase bands */   
+  /* subsequently erase bands */
   if (actPe > desiredPe) {
     Word16 startSfb[2];
     Word32 avgEn, minEn;
@@ -634,20 +635,20 @@
 
     /* do not go below startSfb */
     for (ch=0; ch<nChannels; ch++) {
-         
+
       if (psyOutChannel[ch].windowSequence != SHORT_WINDOW)
         startSfb[ch] = ahParam->startSfbL;
       else
         startSfb[ch] = ahParam->startSfbS;
     }
 
-    avgEn = 0;                                                           
-    minEn = MAX_32;                                                      
-    ahCnt = 0;                                                           
+    avgEn = 0;
+    minEn = MAX_32;
+    ahCnt = 0;
     for (ch=0; ch<nChannels; ch++) {
       PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
       for (sfb=startSfb[ch]; sfb<psyOutChan->sfbCnt; sfb++) {
-           
+
         if ((ahFlag[ch][sfb] != NO_AH) &&
             (psyOutChan->sfbEnergy[sfb] > psyOutChan->sfbThreshold[sfb])) {
           minEn = min(minEn, psyOutChan->sfbEnergy[sfb]);
@@ -656,7 +657,7 @@
         }
       }
     }
-     
+
     if(ahCnt) {
       Word32 iahCnt;
       shift = norm_l(ahCnt);
@@ -674,46 +675,46 @@
 
     /* start with lowest energy border at highest sfb */
     maxSfb = psyOutChannel[0].sfbCnt - 1;
-    minSfb = startSfb[0];                                                                
-     
+    minSfb = startSfb[0];
+
     if (nChannels == 2) {
       maxSfb = max(maxSfb, (psyOutChannel[1].sfbCnt - 1));
       minSfb = min(minSfb, startSfb[1]);
     }
 
-    sfb = maxSfb;                                                                        
-    enIdx = 0;                                                                           
-    done = 0;                                                                            
+    sfb = maxSfb;
+    enIdx = 0;
+    done = 0;
     while (!done) {
-       
+
       for (ch=0; ch<nChannels; ch++) {
         PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
-           
+
         if (sfb>=startSfb[ch] && sfb<psyOutChan->sfbCnt) {
           /* sfb energy below border ? */
-             
+
           if (ahFlag[ch][sfb] != NO_AH && psyOutChan->sfbEnergy[sfb] < en[enIdx]){
             /* allow hole */
-            ahFlag[ch][sfb] = NO_AH;                                                     
+            ahFlag[ch][sfb] = NO_AH;
             psyOutChan->sfbThreshold[sfb] = L_add(psyOutChan->sfbEnergy[sfb], psyOutChan->sfbEnergy[sfb]);
             actPe = actPe - peData->peChannelData[ch].sfbPe[sfb];
           }
-           
+
           if (actPe < desiredPe) {
-            done = 1;                                                                    
+            done = 1;
             break;
           }
         }
       }
       sfb = sfb - 1;
-       
+
       if (sfb < minSfb) {
         /* restart with next energy border */
-        sfb = maxSfb;                                                                    
+        sfb = maxSfb;
         enIdx = enIdx + 1;
-         
+
         if (enIdx - 4 >= 0)
-          done = 1;                                                                      
+          done = 1;
       }
     }
   }
@@ -748,13 +749,13 @@
 
   initAvoidHoleFlag(peData->ahFlag, psyOutChannel, psyOutElement, nChannels, ahParam);
 
-  noRedPe = peData->pe;                                                          
-  constPart = peData->constPart;                                                 
-  nActiveLines = peData->nActiveLines;       
+  noRedPe = peData->pe;
+  constPart = peData->constPart;
+  nActiveLines = peData->nActiveLines;
 
   /* first guess of reduction value t^0.25 = 2^((a-pen)/4*b) */
   avgThrExp = pow2_xy((constPart - noRedPe), (nActiveLines << 2));
-  
+
   /* r1 = 2^((a-per)/4*b) - t^0.25 */
   redVal = pow2_xy((constPart - desiredPe), (nActiveLines << 2)) - avgThrExp;
 
@@ -763,40 +764,40 @@
 
   /* pe after first guess */
   calcSfbPe(peData, psyOutChannel, nChannels);
-  redPe = peData->pe;                                                            
+  redPe = peData->pe;
 
-  iter = 0;                                                                      
+  iter = 0;
   do {
     /* pe for bands where avoid hole is inactive */
     calcPeNoAH(&redPeNoAH, &constPartNoAH, &nActiveLinesNoAH,
                peData, peData->ahFlag, psyOutChannel, nChannels);
 
     desiredPeNoAH = desiredPe -(redPe - redPeNoAH);
-     
+
     if (desiredPeNoAH < 0) {
-      desiredPeNoAH = 0;                                                         
+      desiredPeNoAH = 0;
     }
 
     /* second guess */
-     
+
     if (nActiveLinesNoAH > 0) {
-		
+
 		avgThrExp = pow2_xy((constPartNoAH - redPeNoAH), (nActiveLinesNoAH << 2));
-		
+
 		redVal = (redVal + pow2_xy((constPartNoAH - desiredPeNoAH), (nActiveLinesNoAH << 2))) - avgThrExp;
-		
+
 		/* reduce thresholds */
 		reduceThresholds(psyOutChannel, peData->ahFlag, peData->thrExp, nChannels, redVal);
     }
 
     calcSfbPe(peData, psyOutChannel, nChannels);
-    redPe = peData->pe;                                                          
+    redPe = peData->pe;
 
     iter = iter+1;
-       
+
   } while ((20 * abs_s(redPe - desiredPe) > desiredPe) && (iter < 2));
 
-   
+
   if ((100 * redPe < 115 * desiredPe)) {
     correctThresh(psyOutChannel, peData->ahFlag, peData, peData->thrExp, redVal,
                   nChannels, desiredPe - redPe);
@@ -863,7 +864,7 @@
   if(clipHigh-clipLow)
   bitspend = (minBitSpend + ((maxBitSpend - minBitSpend)*(fillLevel - clipLow) /
                                 (clipHigh-clipLow)));
-                            
+
   return (bitspend);
 }
 
@@ -884,19 +885,19 @@
   Word16 minFacHi, maxFacHi, minFacLo, maxFacLo;
   Word16 diff;
   Word16 minDiff = extract_l(currPe / 6);
-  minFacHi = 30;                                                         
-  maxFacHi = 100;                                                        
-  minFacLo = 14;                                                         
-  maxFacLo = 7;                                                          
+  minFacHi = 30;
+  maxFacHi = 100;
+  minFacLo = 14;
+  maxFacLo = 7;
 
   diff = currPe - *peMax ;
-   
+
   if (diff > 0) {
     *peMin = *peMin + ((diff * minFacHi) / 100);
     *peMax = *peMax + ((diff * maxFacHi) / 100);
   } else {
     diff = *peMin - currPe;
-     
+
     if (diff > 0) {
       *peMin = *peMin - ((diff * minFacLo) / 100);
       *peMax = *peMax - ((diff * maxFacLo) / 100);
@@ -906,7 +907,7 @@
     }
   }
 
-   
+
   if ((*peMax - *peMin) < minDiff) {
     Word16 partLo, partHi;
 
@@ -969,7 +970,7 @@
                     (adjThrChan->peMax - adjThrChan->peMin));
   else
 	bitresFac = 0x7fff;
-               
+
   bitresFac = min(bitresFac,
                     (100-30 + extract_l((100 * bitresBits) / avgBits)));
 
@@ -995,23 +996,23 @@
 
   /* common for all elements: */
   /* parameters for bitres control */
-  hAdjThr->bresParamLong.clipSaveLow   =  20;                    
-  hAdjThr->bresParamLong.clipSaveHigh  =  95;                    
-  hAdjThr->bresParamLong.minBitSave    =  -5;                    
-  hAdjThr->bresParamLong.maxBitSave    =  30;                    
-  hAdjThr->bresParamLong.clipSpendLow  =  20;                    
-  hAdjThr->bresParamLong.clipSpendHigh =  95;                    
-  hAdjThr->bresParamLong.minBitSpend   = -10;                    
-  hAdjThr->bresParamLong.maxBitSpend   =  40;                    
+  hAdjThr->bresParamLong.clipSaveLow   =  20;
+  hAdjThr->bresParamLong.clipSaveHigh  =  95;
+  hAdjThr->bresParamLong.minBitSave    =  -5;
+  hAdjThr->bresParamLong.maxBitSave    =  30;
+  hAdjThr->bresParamLong.clipSpendLow  =  20;
+  hAdjThr->bresParamLong.clipSpendHigh =  95;
+  hAdjThr->bresParamLong.minBitSpend   = -10;
+  hAdjThr->bresParamLong.maxBitSpend   =  40;
 
-  hAdjThr->bresParamShort.clipSaveLow   =  20;                   
-  hAdjThr->bresParamShort.clipSaveHigh  =  75;                   
-  hAdjThr->bresParamShort.minBitSave    =   0;                   
-  hAdjThr->bresParamShort.maxBitSave    =  20;                   
-  hAdjThr->bresParamShort.clipSpendLow  =  20;                   
-  hAdjThr->bresParamShort.clipSpendHigh =  75;                   
-  hAdjThr->bresParamShort.minBitSpend   = -5;                    
-  hAdjThr->bresParamShort.maxBitSpend   =  50;                   
+  hAdjThr->bresParamShort.clipSaveLow   =  20;
+  hAdjThr->bresParamShort.clipSaveHigh  =  75;
+  hAdjThr->bresParamShort.minBitSave    =   0;
+  hAdjThr->bresParamShort.maxBitSave    =  20;
+  hAdjThr->bresParamShort.clipSpendLow  =  20;
+  hAdjThr->bresParamShort.clipSpendHigh =  75;
+  hAdjThr->bresParamShort.minBitSpend   = -5;
+  hAdjThr->bresParamShort.maxBitSpend   =  50;
 
   /* specific for each element: */
 
@@ -1020,7 +1021,7 @@
   atsElem->peMax = extract_l(((120*meanPe) / 100));
 
   /* additional pe offset to correct pe2bits for low bitrates */
-  atsElem->peOffset = 0;                             
+  atsElem->peOffset = 0;
   if (chBitrate < 32000) {
     atsElem->peOffset = max(50, (100 - extract_l((100 * chBitrate) / 32000)));
   }
@@ -1039,24 +1040,24 @@
 
   /* minSnr adaptation */
   /* maximum reduction of minSnr goes down to minSnr^maxRed */
-  msaParam->maxRed = 0x20000000;     /* *0.25f /                        
+  msaParam->maxRed = 0x20000000;     /* *0.25f */
   /* start adaptation of minSnr for avgEn/sfbEn > startRatio */
-  msaParam->startRatio = 0x0ccccccd; /* 10 */                        
+  msaParam->startRatio = 0x0ccccccd; /* 10 */
   /* maximum minSnr reduction to minSnr^maxRed is reached for
      avgEn/sfbEn >= maxRatio */
-  msaParam->maxRatio =  0x0020c49c; /* 1000 */                         
+  msaParam->maxRatio =  0x0020c49c; /* 1000 */
   /* helper variables to interpolate minSnr reduction for
      avgEn/sfbEn between startRatio and maxRatio */
 
-  msaParam->redRatioFac = 0xfb333333; /* -0.75/20 */         
+  msaParam->redRatioFac = 0xfb333333; /* -0.75/20 */
 
-  msaParam->redOffs = 0x30000000;  /* msaParam->redRatioFac * 10*log10(msaParam->startRatio) */  
+  msaParam->redOffs = 0x30000000;  /* msaParam->redRatioFac * 10*log10(msaParam->startRatio) */
 
-       
+
   /* pe correction */
-  atsElem->peLast = 0;                                                 
-  atsElem->dynBitsLast = 0;                                            
-  atsElem->peCorrectionFactor = 100; /* 1.0 */                         
+  atsElem->peLast = 0;
+  atsElem->dynBitsLast = 0;
+  atsElem->peCorrectionFactor = 100; /* 1.0 */
 
 }
 
@@ -1069,20 +1070,20 @@
 *****************************************************************************/
 static void calcPeCorrection(Word16 *correctionFac,
                              const Word16 peAct,
-                             const Word16 peLast, 
-                             const Word16 bitsLast) 
+                             const Word16 peLast,
+                             const Word16 bitsLast)
 {
   Word32 peAct100 = 100 * peAct;
   Word32 peLast100 = 100 * peLast;
   Word16 peBitsLast = bits2pe(bitsLast);
-           
+
   if ((bitsLast > 0) &&
       (peAct100 < (150 * peLast)) &&  (peAct100 > (70 * peLast)) &&
       ((120 * peBitsLast) > peLast100 ) && (( 65 * peBitsLast) < peLast100))
     {
       Word16 newFac = (100 * peLast) / peBitsLast;
       /* dead zone */
-       
+
       if (newFac < 100) {
         newFac = min(((110 * newFac) / 100), 100);
         newFac = max(newFac, 85);
@@ -1091,13 +1092,13 @@
         newFac = max(((90 * newFac) / 100), 100);
         newFac = min(newFac, 115);
       }
-         
+
       if ((newFac > 100 && *correctionFac < 100) ||
           (newFac < 100 && *correctionFac > 100)) {
-        *correctionFac = 100;                                                    
+        *correctionFac = 100;
       }
       /* faster adaptation towards 1.0, slower in the other direction */
-             
+
       if ((*correctionFac < 100 && newFac < *correctionFac) ||
           (*correctionFac > 100 && newFac > *correctionFac))
         *correctionFac = (85 * *correctionFac + 15 * newFac) / 100;
@@ -1107,7 +1108,7 @@
       *correctionFac = max(*correctionFac, 85);
     }
   else {
-    *correctionFac = 100;                                                        
+    *correctionFac = 100;
   }
 }
 
@@ -1123,40 +1124,41 @@
                       PSY_OUT_ELEMENT *psyOutElement,
                       Word16          *chBitDistribution,
                       Word16           logSfbEnergy[MAX_CHANNELS][MAX_GROUPED_SFB],
-                      Word16           sfbNRelevantLines[MAX_CHANNELS][MAX_GROUPED_SFB],                      
+                      Word16           sfbNRelevantLines[MAX_CHANNELS][MAX_GROUPED_SFB],
                       QC_OUT_ELEMENT  *qcOE,
 					  ELEMENT_BITS	  *elBits,
 					  const Word16     nChannels,
                       const Word16     maxBitFac)
 {
-  PE_DATA peData;  
+  PE_DATA peData;
   Word16 noRedPe, grantedPe, grantedPeCorr;
   Word16 curWindowSequence;
   Word16 bitFactor;
   Word16 avgBits = (elBits->averageBits - (qcOE->staticBitsUsed + qcOE->ancBitsUsed));
-  Word16 bitresBits = elBits->bitResLevel; 
+  Word16 bitresBits = elBits->bitResLevel;
   Word16 maxBitresBits = elBits->maxBits;
   Word16 sideInfoBits = (qcOE->staticBitsUsed + qcOE->ancBitsUsed);
   Word16 ch;
-   
+  memset(&peData, 0, sizeof(peData));
+
   prepareSfbPe(&peData, psyOutChannel, logSfbEnergy, sfbNRelevantLines, nChannels, AdjThrStateElement->peOffset);
-   
+
   /* pe without reduction */
   calcSfbPe(&peData, psyOutChannel, nChannels);
-  noRedPe = peData.pe;                                                   
+  noRedPe = peData.pe;
 
 
-  curWindowSequence = LONG_WINDOW;                                       
-   
+  curWindowSequence = LONG_WINDOW;
+
   if (nChannels == 2) {
-       
+
     if ((psyOutChannel[0].windowSequence == SHORT_WINDOW) ||
         (psyOutChannel[1].windowSequence == SHORT_WINDOW)) {
-      curWindowSequence = SHORT_WINDOW;                                  
+      curWindowSequence = SHORT_WINDOW;
     }
   }
   else {
-    curWindowSequence = psyOutChannel[0].windowSequence;                 
+    curWindowSequence = psyOutChannel[0].windowSequence;
   }
 
 
@@ -1170,13 +1172,13 @@
   grantedPe = ((bitFactor * bits2pe(avgBits)) / 100);
 
   /* correction of pe value */
-  calcPeCorrection(&(AdjThrStateElement->peCorrectionFactor), 
+  calcPeCorrection(&(AdjThrStateElement->peCorrectionFactor),
                    min(grantedPe, noRedPe),
-                   AdjThrStateElement->peLast, 
+                   AdjThrStateElement->peLast,
                    AdjThrStateElement->dynBitsLast);
   grantedPeCorr = (grantedPe * AdjThrStateElement->peCorrectionFactor) / 100;
 
-     
+
   if (grantedPeCorr < noRedPe && noRedPe > peData.offset) {
     /* calc threshold necessary for desired pe */
     adaptThresholdsToPe(psyOutChannel,
@@ -1192,8 +1194,8 @@
   /* calculate relative distribution */
   for (ch=0; ch<nChannels; ch++) {
     Word16 peOffsDiff = peData.pe - peData.offset;
-    chBitDistribution[ch] = 200;                                                 
-     
+    chBitDistribution[ch] = 200;
+
     if (peOffsDiff > 0) {
       Word32 temp = 1000 - (nChannels * 200);
       chBitDistribution[ch] = chBitDistribution[ch] +
@@ -1202,10 +1204,10 @@
   }
 
   /* store pe */
-  qcOE->pe = noRedPe;                                                            
+  qcOE->pe = noRedPe;
 
   /* update last pe */
-  AdjThrStateElement->peLast = grantedPe;                                        
+  AdjThrStateElement->peLast = grantedPe;
 }
 
 /********************************************************************************
@@ -1217,7 +1219,7 @@
 void AdjThrUpdate(ATS_ELEMENT *AdjThrStateElement,
                   const Word16 dynBitsUsed)
 {
-  AdjThrStateElement->dynBitsLast = dynBitsUsed;                                 
+  AdjThrStateElement->dynBitsLast = dynBitsUsed;
 }
 
 
diff --git a/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/AutoCorrelation_v5.s b/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/AutoCorrelation_v5.s
index e0885f1..e705197 100644
--- a/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/AutoCorrelation_v5.s
+++ b/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/AutoCorrelation_v5.s
@@ -22,34 +22,34 @@
 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
 
-	.section .text	
+	.section .text
 	.global	AutoCorrelation
 
 AutoCorrelation:
 	stmdb     sp!, {r4 - r11, lr}
 
-  sub     r13, r13, #20                     
+  sub     r13, r13, #20
 
-  mov     r5, r0                            
-  mov     r7, r1                            
-  mov     r9, r3                            
-  mov     r2, r2, lsl #16                      
-  mov     r0, #0          
-  mov     r4, r2, asr #16                   
-  mov     r8, #0                            
-  cmp     r4, #0                            
-  ble     L136        
-	
-	cmp     r4, #8 
-	mov		  r2, #0 
-  blt     L133   
+  mov     r5, r0
+  mov     r7, r1
+  mov     r9, r3
+  mov     r2, r2, lsl #16
+  mov     r0, #0
+  mov     r4, r2, asr #16
+  mov     r8, #0
+  cmp     r4, #0
+  ble     L136
 
-	sub     r12, r4, #8                
-L132:  
-  ldr     r6, [r5, r2]  
+	cmp     r4, #8
+	mov		  r2, #0
+  blt     L133
+
+	sub     r12, r4, #8
+L132:
+  ldr     r6, [r5, r2]
 	add		  r2, r2, #4
 	smulbb  r3, r6, r6
-	ldr     r1, [r5, r2] 
+	ldr     r1, [r5, r2]
 	smultt	r10, r6, r6
 	mov		  r3, r3, asr #9
 	smulbb	r6, r1, r1
@@ -72,95 +72,95 @@
 	add     r8, r8, #6
 
 	qadd	  r0, r0, r6
-	cmp     r8, r12                            
-  blt     L132	                  
-L133:                         
-  ldrsh   r6, [r5, r2]                      
-  mul     r10, r6, r6   
-	add     r2, r2, #2                     
-  mov     r1, r10, asr #9                    
+	cmp     r8, r12
+  blt     L132
+L133:
+  ldrsh   r6, [r5, r2]
+  mul     r10, r6, r6
+	add     r2, r2, #2
+  mov     r1, r10, asr #9
   qadd    r0, r0, r1
-L134:                         
-  add     r8, r8, #1                        
-  cmp     r8, r4                            
-  blt     L133                            
-L135:                        
-L136:                         
-  str     r0, [r7, #0]                      
-  cmp     r0, #0                            
-  beq     L1320                           
-L137:                         
-  mov     r2, r9, lsl #16                   
-	mov     r8, #1                                
-  mov     r2, r2, asr #16                   
-  cmp     r2, #1                            
-  ble     L1319                           
-L138:                        
-L139:                         
-  sub     r4, r4, #1                        
-  mov     r14, #0                           
-  mov     r3, #0                            
-  cmp     r4, #0                            
-  ble     L1317                           
-L1310:                       
-  cmp     r4, #6                            
-  addlt   r6, r5, r8, lsl #1                
-  blt     L1314                           
-L1311:                        
-  add     r6, r5, r8, lsl #1                
-  sub     r12, r4, #6                       
-  str     r8, [r13, #8]                     
-  str     r7, [r13, #4]                     
-L1312:                        
-  mov     r1, r3, lsl #1                    
-  ldrsh   r7, [r6, r1]                      
-  ldrsh   r10, [r5, r1]  
-  add     r8, r1, r6 
-	add     r9, r5, r1                       
+L134:
+  add     r8, r8, #1
+  cmp     r8, r4
+  blt     L133
+L135:
+L136:
+  str     r0, [r7, #0]
+  cmp     r0, #0
+  beq     L1320
+L137:
+  mov     r2, r9, lsl #16
+	mov     r8, #1
+  mov     r2, r2, asr #16
+  cmp     r2, #1
+  ble     L1319
+L138:
+L139:
+  sub     r4, r4, #1
+  mov     r14, #0
+  mov     r3, #0
+  cmp     r4, #0
+  ble     L1317
+L1310:
+  cmp     r4, #6
+  addlt   r6, r5, r8, lsl #1
+  blt     L1314
+L1311:
+  add     r6, r5, r8, lsl #1
+  sub     r12, r4, #6
+  str     r8, [r13, #8]
+  str     r7, [r13, #4]
+L1312:
+  mov     r1, r3, lsl #1
+  ldrsh   r7, [r6, r1]
+  ldrsh   r10, [r5, r1]
+  add     r8, r1, r6
+	add     r9, r5, r1
 	mul     r7, r10, r7
-  ldrsh   r1, [r8, #2] 
-	ldrsh   r10, [r8, #4]   
-  add     r7, r14, r7, asr #9  	                                             
-  ldrsh   r0, [r9, #2]                          
-  ldrsh   r11, [r9, #4]                   
-  mul     r1, r0, r1                        
-  ldrsh   r14, [r8, #6]                     
-  mul     r10, r11, r10          
-	add     r7, r7, r1, asr #9            
-  ldrsh   r8, [r8, #8] 
+  ldrsh   r1, [r8, #2]
+	ldrsh   r10, [r8, #4]
+  add     r7, r14, r7, asr #9
+  ldrsh   r0, [r9, #2]
+  ldrsh   r11, [r9, #4]
+  mul     r1, r0, r1
+  ldrsh   r14, [r8, #6]
+  mul     r10, r11, r10
+	add     r7, r7, r1, asr #9
+  ldrsh   r8, [r8, #8]
 	add     r3, r3, #5
-	ldrsh   r11, [r9, #6]                  
-  ldrsh   r1, [r9, #8]                      
-  mul     r14, r11, r14                     
-  add     r7, r7, r10, asr #9       
-  mul     r1, r1, r8                             
-  add     r14, r7, r14, asr #9              
-	cmp     r3, r12 
-  add     r14, r14, r1, asr #9              
-  ble     L1312                           
-L1313:                        
-  ldr     r8, [r13, #8]                     
-  ldr     r7, [r13, #4]                     
-L1314:                        
-L1315:                        
-  mov     r12, r3, lsl #1                   
-  ldrsh   r9, [r6, r12]                     
-  ldrsh   r12, [r5, r12]                    
-  add     r3, r3, #1                        
-  cmp     r3, r4                            
-  mul     r12, r12, r9                      
-  add     r14, r14, r12, asr #9             
-  blt     L1315                           
-L1316:                        
-L1317:                        
-  str     r14, [r7, +r8, lsl #2]            
-  add     r8, r8, #1                        
-  cmp     r8, r2                            
-  blt     L139   
-	                         
+	ldrsh   r11, [r9, #6]
+  ldrsh   r1, [r9, #8]
+  mul     r14, r11, r14
+  add     r7, r7, r10, asr #9
+  mul     r1, r1, r8
+  add     r14, r7, r14, asr #9
+	cmp     r3, r12
+  add     r14, r14, r1, asr #9
+  ble     L1312
+L1313:
+  ldr     r8, [r13, #8]
+  ldr     r7, [r13, #4]
+L1314:
+L1315:
+  mov     r12, r3, lsl #1
+  ldrsh   r9, [r6, r12]
+  ldrsh   r12, [r5, r12]
+  add     r3, r3, #1
+  cmp     r3, r4
+  mul     r12, r12, r9
+  add     r14, r14, r12, asr #9
+  blt     L1315
+L1316:
+L1317:
+  str     r14, [r7, +r8, lsl #2]
+  add     r8, r8, #1
+  cmp     r8, r2
+  blt     L139
+
 L1319:
 L1320:
-	add     r13, r13, #20                    
+	add     r13, r13, #20
 	ldmia   sp!, {r4 - r11, pc}
 
 	@ENDP  @ |AutoCorrelation|
diff --git a/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/CalcWindowEnergy_v5.s b/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/CalcWindowEnergy_v5.s
index 75b916c..b30e8cb 100644
--- a/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/CalcWindowEnergy_v5.s
+++ b/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/CalcWindowEnergy_v5.s
@@ -22,91 +22,91 @@
 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
 	.section .text
-	
+
 	.global	CalcWindowEnergy
 
 CalcWindowEnergy:
 	stmdb   sp!, {r4 - r11, lr}
-	sub     r13, r13, #20 
+	sub     r13, r13, #20
 
-  mov     r3, r3, lsl #16                         
+  mov     r3, r3, lsl #16
 	ldr     r10, [r0, #168]                    @ states0 = blockSwitchingControl->iirStates[0];
-  mov     r3, r3, asr #16 
+  mov     r3, r3, asr #16
 	ldr     r11, [r0, #172]                    @ states1 = blockSwitchingControl->iirStates[1];
 
 	mov     r2, r2, lsl #16
-	ldr     r12, hiPassCoeff                   @ Coeff0 = hiPassCoeff[0];      
+	ldr     r12, hiPassCoeff                   @ Coeff0 = hiPassCoeff[0];
   mov     r2, r2, asr #16
 	ldr     r14, hiPassCoeff + 4			         @ Coeff1 = hiPassCoeff[1];
-	
+
 	mov			r8, #0							               @ w=0
 	mov			r5, #0							               @ wOffset = 0;
-	
+
 BLOCK_BEGIN:
-	mov			r6, #0                             @ accuUE = 0; 
-	mov			r7, #0								             @ accuFE = 0; 
+	mov			r6, #0                             @ accuUE = 0;
+	mov			r7, #0								             @ accuFE = 0;
 	mov			r4, #0							               @ i=0
-		                   
-	str			r8, [r13, #4]	
-	str			r0, [r13, #8]	
+
+	str			r8, [r13, #4]
+	str			r0, [r13, #8]
 	str			r3, [r13, #12]
-	
-ENERGY_BEG:	
-	mov     r9, r5, lsl #1  
+
+ENERGY_BEG:
+	mov     r9, r5, lsl #1
 	ldrsh   r9, [r1, r9]											@ tempUnfiltered = timeSignal[tidx];
 
 	add			r5, r5, r2												@ tidx = tidx + chIncrement;
-	
-	smulwb	r3, r14, r9												@ accu1 = L_mpy_ls(Coeff1, tempUnfiltered);	
+
+	smulwb	r3, r14, r9												@ accu1 = L_mpy_ls(Coeff1, tempUnfiltered);
 	smull		r0, r8, r12, r11									@ accu2 = fixmul( Coeff0, states1 );
-	
+
 	mov			r3, r3, lsl #1
 	mov			r8, r8, lsl #1
 
-	sub			r0, r3, r10												@ accu3 = accu1 - states0;	
+	sub			r0, r3, r10												@ accu3 = accu1 - states0;
 	sub			r8,	r0, r8												@ out = accu3 - accu2;
 
 	mov		  r10, r3														@ states0 = accu1;
-	mov		  r11, r8														@ states1 = out;  
-	
-	mul		  r3, r9, r9	
+	mov		  r11, r8														@ states1 = out;
+
+	mul		  r3, r9, r9
 	mov     r8, r8, asr #16
-	
+
 	add		  r4, r4, #1
 	add     r6, r6, r3, asr #7
 
-	mul		  r9, r8, r8	
+	mul		  r9, r8, r8
 	ldr		  r3, [r13, #12]
 
 	add		  r7, r7, r9, asr #7
-		
-	cmp     r4, r3                            
-  blt     ENERGY_BEG       
-	
+
+	cmp     r4, r3
+  blt     ENERGY_BEG
+
 	ldr		  r0, [r13, #8]
 	ldr		  r8, [r13, #4]
-	
+
 ENERGY_END:
 	add		  r4, r0, r8, lsl #2
 
-	str     r6, [r4, #72]         
-	add		  r8, r8, #1	           
-  str     r7, [r4, #136]                   
+	str     r6, [r4, #72]
+	add		  r8, r8, #1
+  str     r7, [r4, #136]
 
 	cmp		  r8, #8
-	blt		  BLOCK_BEGIN                  	                        
+	blt		  BLOCK_BEGIN
 
 BLOCK_END:
-	str     r10, [r0, #168]                    
-  str     r11, [r0, #172]                    
-  mov     r0, #1            
-	                
-  add     r13, r13, #20   
-	ldmia   sp!, {r4 - r11, pc}                  
+	str     r10, [r0, #168]
+  str     r11, [r0, #172]
+  mov     r0, #1
+
+  add     r13, r13, #20
+	ldmia   sp!, {r4 - r11, pc}
 
 hiPassCoeff:
 	.word 0xbec8b439
 	.word	0x609d4952
-		
+
 	@ENDP
 	.end
diff --git a/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/PrePostMDCT_v5.s b/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/PrePostMDCT_v5.s
index 38fe092..da21d5f 100644
--- a/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/PrePostMDCT_v5.s
+++ b/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/PrePostMDCT_v5.s
@@ -26,46 +26,46 @@
 
 PreMDCT:
 	stmdb       sp!, {r4 - r11, lr}
-	
+
 	add         r9, r0, r1, lsl #2
 	sub         r3, r9, #8
 
 	movs        r1, r1, asr #2
 	beq         PreMDCT_END
-	
+
 PreMDCT_LOOP:
 	ldr					r8, [r2], #4
 	ldr					r9, [r2], #4
-	
+
 	ldrd				r4, [r0]
 	ldrd				r6, [r3]
-	
+
 	smull				r14, r11, r4, r8					@ MULHIGH(tr1, cosa)
 	smull    			r10, r12, r7, r8					@ MULHIGH(ti1, cosa)
-		
+
 	smull				r14, r8, r7, r9						@ MULHIGH(ti1, sina)
-	smull				r7, r10, r4, r9						@ MULHIGH(tr1, sina)	
-		
-	add					r11, r11, r8						@ MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@	
+	smull				r7, r10, r4, r9						@ MULHIGH(tr1, sina)
+
+	add					r11, r11, r8						@ MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@
 	sub					r7, r12, r10						@ MULHIGH(ti1, cosa) - MULHIGH(tr1, sina)
-	
+
 	ldr					r8, [r2], #4
 	ldr					r9, [r2], #4
-	
+
 	smull				r14, r4, r6, r8						@ MULHIGH(tr2, cosa)
 	smull    			r10, r12, r5, r8					@ MULHIGH(ti2, cosa)
-		
+
 	smull				r14, r8, r5, r9						@ MULHIGH(ti2, sina)
 	smull				r5, r10, r6, r9						@ MULHIGH(tr2, sina)
-	
+
 	add					r8, r8, r4
 	sub					r9, r12, r10
-	
-	mov					r6, r11		
 
-	strd				r6, [r0]	
+	mov					r6, r11
+
+	strd				r6, [r0]
 	strd				r8, [r3]
-	
+
 	subs				r1, r1, #1
 	sub					r3, r3, #8
 	add 				r0, r0, #8
@@ -74,52 +74,52 @@
 PreMDCT_END:
 	ldmia       sp!, {r4 - r11, pc}
 	@ENDP  @ |PreMDCT|
-	
+
 	.section .text
 	.global	PostMDCT
 
 PostMDCT:
 	stmdb       sp!, {r4 - r11, lr}
-	
+
 	add         r9, r0, r1, lsl #2
 	sub         r3, r9, #8
 
 	movs        r1, r1, asr #2
 	beq         PostMDCT_END
-	
+
 PostMDCT_LOOP:
-	ldr					r8, [r2], #4					
+	ldr					r8, [r2], #4
 	ldr					r9, [r2], #4
-	
+
 	ldrd				r4, [r0]
 	ldrd				r6, [r3]
-	
+
 	smull				r14, r11, r4, r8					@ MULHIGH(tr1, cosa)
 	smull    			r10, r12, r5, r8					@ MULHIGH(ti1, cosa)
-		
+
 	smull				r14, r8, r5, r9						@ MULHIGH(ti1, sina)
-	smull				r5, r10, r4, r9						@ MULHIGH(tr1, sina)	
-		
-	add					r4, r11, r8							@ MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@	
+	smull				r5, r10, r4, r9						@ MULHIGH(tr1, sina)
+
+	add					r4, r11, r8							@ MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@
 	sub					r11, r10, r12						@ MULHIGH(ti1, cosa) - MULHIGH(tr1, sina)@
-	
+
 	ldr					r8, [r2], #4						@
 	ldr					r9, [r2], #4
-	
+
 	smull				r14, r5, r6, r8						@ MULHIGH(tr2, cosa)
 	smull    			r10, r12, r7, r8					@ MULHIGH(ti2, cosa)
-		
+
 	smull				r14, r8, r7, r9						@ MULHIGH(ti2, sina)
 	smull				r7, r10, r6, r9						@ MULHIGH(tr2, sina)
-	
+
 	add					r6, r8, r5							@ MULHIGH(cosb, tr2) + MULHIGH(sinb, ti2)@
 	sub					r5, r10, r12						@ MULHIGH(sinb, tr2) - MULHIGH(cosb, ti2)@
-	
-	mov					r7, r11				
+
+	mov					r7, r11
 
 	strd				r4, [r0]
 	strd				r6, [r3]
-	
+
 	subs				r1, r1, #1
 	sub					r3, r3, #8
 	add 				r0, r0, #8
@@ -128,4 +128,4 @@
 PostMDCT_END:
 	ldmia       sp!, {r4 - r11, pc}
 	@ENDP  @ |PostMDCT|
-	.end
\ No newline at end of file
+	.end
diff --git a/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/R4R8First_v5.s b/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/R4R8First_v5.s
index b30881a..4ca4f31 100644
--- a/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/R4R8First_v5.s
+++ b/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/R4R8First_v5.s
@@ -26,46 +26,46 @@
 
 Radix4First:
 	stmdb       sp!, {r4 - r11, lr}
-	
+
 	movs				r10, r1
 	mov					r11, r0
 	beq					Radix4First_END
-		
+
 Radix4First_LOOP:
 	ldrd				r0, [r11]
 	ldrd				r2, [r11, #8]
 	ldrd				r4, [r11, #16]
 	ldrd				r6, [r11, #24]
-	
+
 	add					r8, r0, r2
 	add					r9, r1, r3
-	
+
 	sub					r0, r0, r2
 	sub					r1, r1, r3
-	
+
 	add					r2, r4, r6
 	add					r3, r5, r7
-	
+
 	sub					r4, r4, r6
 	sub					r5, r5, r7
-	
+
 	add					r6, r8, r2
 	add					r7, r9, r3
-	
+
 	sub					r8, r8, r2
 	sub					r9, r9, r3
-	
+
 	add					r2, r0, r5
 	sub					r3, r1, r4
-	
+
 	sub					r0, r0, r5
 	add					r1, r1, r4
-	
+
 	strd				r6, [r11]
 	strd				r2, [r11, #8]
 	strd				r8, [r11, #16]
 	strd				r0, [r11, #24]
-	
+
 	subs				r10, r10, #1
 	add					r11, r11, #32
 	bne					Radix4First_LOOP
@@ -73,180 +73,180 @@
 Radix4First_END:
 	ldmia       sp!, {r4 - r11, pc}
 	@ENDP  @ |Radix4First|
-	
+
 	.section .text
 	.global	Radix8First
 
 Radix8First:
 	stmdb       sp!, {r4 - r11, lr}
 	sub         sp, sp, #0x24
-	
+
 	mov				  r12, r1
 	mov					r14, r0
 	cmp					r12, #0
 	beq					Radix8First_END
-	
+
 Radix8First_LOOP:
-	ldrd				r0, [r14]		
+	ldrd				r0, [r14]
 	ldrd				r2, [r14, #8]
 	ldrd				r4, [r14, #16]
 	ldrd				r6, [r14, #24]
-	
+
 	add					r8, r0, r2					@ r0 = buf[0] + buf[2]@
 	add					r9, r1, r3					@ i0 = buf[1] + buf[3]@
-	
+
 	sub					r0, r0, r2					@ r1 = buf[0] - buf[2]@
 	sub					r1, r1, r3					@ i1 = buf[1] - buf[3]@
-	
+
 	add					r2, r4, r6					@	r2 = buf[4] + buf[6]@
 	add					r3, r5, r7					@ i2 = buf[5] + buf[7]@
-	
+
 	sub					r4, r4, r6					@	r3 = buf[4] - buf[6]@
 	sub					r5, r5, r7					@ i3 = buf[5] - buf[7]@
-	
+
 	add					r6, r8, r2					@ r4 = (r0 + r2) >> 1@
 	add					r7, r9, r3					@ i4 = (i0 + i2) >> 1@
-	
+
 	sub					r8, r8, r2					@	r5 = (r0 - r2) >> 1@
 	sub					r9, r9, r3					@ i5 = (i0 - i2) >> 1@
-	
+
 	sub					r2, r0, r5					@ r6 = (r1 - i3) >> 1@
 	add					r3, r1, r4					@ i6 = (i1 + r3) >> 1@
-	
+
 	add					r0, r0, r5					@ r7 = (r1 + i3) >> 1@
 	sub					r1, r1, r4					@ i7 = (i1 - r3) >> 1@
-	
+
 	mov					r6, r6, asr #1			@
 	mov					r7, r7, asr #1			@
-	
+
 	mov					r8, r8, asr #1
 	mov					r9, r9, asr #1
-	
+
 	mov					r2, r2, asr #1
 	mov					r3, r3, asr #1
-	
+
 	mov					r0, r0, asr #1
-	mov					r1, r1, asr #1	
-	
+	mov					r1, r1, asr #1
+
 	str					r6, [sp]
 	str					r7, [sp, #4]
-	
+
 	str					r8, [sp, #8]
 	str					r9, [sp, #12]
-	
+
 	str					r2, [sp, #16]
-	str					r3, [sp, #20]	
-	
+	str					r3, [sp, #20]
+
 	str					r0, [sp, #24]
-	str					r1, [sp, #28]	
-	
-	ldrd				r2, [r14, #32]		
+	str					r1, [sp, #28]
+
+	ldrd				r2, [r14, #32]
 	ldrd				r4, [r14, #40]
 	ldrd				r6, [r14, #48]
 	ldrd				r8, [r14, #56]
-	
+
 	add					r0, r2, r4					@ r0 = buf[ 8] + buf[10]@
 	add					r1, r3, r5					@ i0 = buf[ 9] + buf[11]@
-	
+
 	sub					r2, r2, r4					@ r1 = buf[ 8] - buf[10]@
 	sub					r3, r3, r5					@ i1 = buf[ 9] - buf[11]@
-	
+
 	add					r4, r6, r8					@ r2 = buf[12] + buf[14]@
 	add					r5, r7, r9					@ i2 = buf[13] + buf[15]@
-	
+
 	sub					r6, r6, r8					@ r3 = buf[12] - buf[14]@
 	sub					r7, r7, r9					@	i3 = buf[13] - buf[15]@
-	
+
 	add					r8, r0, r4					@ t0 = (r0 + r2)
 	add					r9, r1, r5					@ t1 = (i0 + i2)
-	
+
 	sub					r0, r0, r4					@ t2 = (r0 - r2)
 	sub					r1, r1, r5					@ t3 = (i0 - i2)
-	
+
 	mov					r8, r8, asr #1
 	ldr					r4, [sp]
-	
+
 	mov					r9, r9, asr #1
 	ldr					r5, [sp, #4]
-	
-	mov					r0, r0, asr #1		
+
+	mov					r0, r0, asr #1
 	mov					r1, r1, asr #1
-	
+
 	add					r10, r4, r8					@ buf[ 0] = r4 + t0@
 	add					r11, r5, r9					@ buf[ 1] = i4 + t1@
-	
+
 	sub					r4,  r4, r8					@ buf[ 8] = r4 - t0@
 	sub					r5,  r5, r9					@	buf[ 9] = i4 - t1@
-	
+
  	strd				r10, [r14]
  	strd				r4,  [r14, #32]
- 	
+
  	ldr					r10, [sp, #8]
  	ldr					r11, [sp, #12]
- 	
+
  	add					r4, r10, r1					@ buf[ 4] = r5 + t3@
  	sub					r5, r11, r0					@	buf[ 5] = i5 - t2@
- 	
+
  	sub					r10, r10, r1				@ buf[12] = r5 - t3@
  	add					r11, r11, r0				@ buf[13] = i5 + t2@
- 	
+
  	strd				r4,  [r14, #16]
  	strd				r10, [r14, #48]
- 	
+
  	sub					r0, r2, r7					@ r0 = r1 - i3@
  	add					r1, r3, r6					@ i0 = i1 + r3@
- 
+
   ldr					r11, DATATab
- 	
+
  	add					r2, r2, r7					@ r2 = r1 + i3@
  	sub					r3, r3, r6					@ i2 = i1 - r3@
- 	
+
 	sub					r4, r0, r1					@ r0 - i0
 	add					r5, r0, r1					@ r0 + i0
-	
+
 	sub					r0, r2, r3					@ r2 - i2
 	add					r1, r2, r3					@ r2 + i2
-	
-	smull				r8, r6, r4, r11								
-	smull				r9, r7, r5, r11								
-	
+
+	smull				r8, r6, r4, r11
+	smull				r9, r7, r5, r11
+
 	ldr					r2, [sp, #16]
 	ldr					r3, [sp, #20]
-	
-	smull				r8, r4, r0, r11								
-	smull				r9, r5, r1, r11								
-	
+
+	smull				r8, r4, r0, r11
+	smull				r9, r5, r1, r11
+
 	ldr					r10, [sp, #24]
 	ldr					r11, [sp, #28]
-	
+
 	sub					r8, r2, r6
 	sub					r9, r3, r7
-	
+
 	add					r2, r2, r6
 	add					r3, r3, r7
-	
+
 	add					r6, r10, r5
 	sub					r7, r11, r4
-	
+
 	sub					r0, r10, r5
 	add					r1, r11, r4
-	
+
 	strd				r6, [r14, #8]
 	strd				r8, [r14, #24]
 	strd				r0, [r14, #40]
 	strd				r2, [r14, #56]
-	
+
 	subs				r12, r12, #1
 	add					r14, r14, #64
-	
+
 	bne					Radix8First_LOOP
-	
+
 Radix8First_END:
 	add         sp, sp, #0x24
 	ldmia       sp!, {r4 - r11, pc}
-	
+
 DATATab:
 	.word       0x5a82799a
-	
+
 	@ENDP  @ |Radix8First|
-	.end
\ No newline at end of file
+	.end
diff --git a/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/Radix4FFT_v5.s b/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/Radix4FFT_v5.s
index bc069b4..b59b967 100644
--- a/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/Radix4FFT_v5.s
+++ b/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/Radix4FFT_v5.s
@@ -25,145 +25,145 @@
 
 Radix4FFT:
 	stmdb     sp!, {r4 - r11, lr}
-	sub       sp, sp, #32                     
+	sub       sp, sp, #32
 
 	mov			r1, r1, asr #2
-	cmp     r1, #0       
-	beq     Radix4FFT_END                            
-                       
-Radix4FFT_LOOP1:          
-	mov     r14, r0          							@ xptr = buf@          
+	cmp     r1, #0
+	beq     Radix4FFT_END
+
+Radix4FFT_LOOP1:
+	mov     r14, r0          							@ xptr = buf@
 	mov		r10, r1 												@ i = num@
 	mov     r9, r2, lsl #3  							@ step = 2*bgn@
-	cmp     r10, #0  
-	str		r0, [sp] 
-	str		r1, [sp, #4]      
+	cmp     r10, #0
+	str		r0, [sp]
+	str		r1, [sp, #4]
 	str		r2, [sp, #8]
-	str		r3, [sp, #12]  
-	beq     Radix4FFT_LOOP1_END                            	    
-     
-Radix4FFT_LOOP2:                       
+	str		r3, [sp, #12]
+	beq     Radix4FFT_LOOP1_END
+
+Radix4FFT_LOOP2:
 	mov     r12, r3				        				@ csptr = twidTab@
 	mov		r11, r2												@ j = bgn
-	cmp     r11, #0        
+	cmp     r11, #0
 	str		r10, [sp, #16]
-	beq     Radix4FFT_LOOP2_END                         
-	 
-Radix4FFT_LOOP3:                          
-	str			r11, [sp, #20]	 
-	
+	beq     Radix4FFT_LOOP2_END
+
+Radix4FFT_LOOP3:
+	str			r11, [sp, #20]
+
 	ldrd		r0, [r14, #0]									@ r0 = xptr[0]@ r1 = xptr[1]@
 	add			r14, r14, r9 	 								@ xptr += step@
-	
-	ldrd		r10,	[r14, #0]  					 			@ r2 = xptr[0]@ r3 = xptr[1]@	
+
+	ldrd		r10,	[r14, #0]  					 			@ r2 = xptr[0]@ r3 = xptr[1]@
 	ldr			r8, [r12], #4									@ cosxsinx = csptr[0]@
-	
+
 	smulwt	r4, r10, r8										@ L_mpy_wx(cosx, t0)
 	smulwt	r3, r11, r8										@ L_mpy_wx(cosx, t1)
-	
+
 	smlawb	r2, r11, r8, r4								@ r2 = L_mpy_wx(cosx, t0) + L_mpy_wx(sinx, t1)@
 	smulwb	r5, r10, r8										@ L_mpy_wx(sinx, t0)
-	
+
 	mov			r10, r0, asr #2								@ t0 = r0 >> 2@
 	mov			r11, r1, asr #2								@	t1 = r1 >> 2@
-		
+
 	sub			r3, r3, r5										@ r3 = L_mpy_wx(cosx, t1) - L_mpy_wx(sinx, t0)@
 	add     r14, r14, r9 	 								@ xptr += step@
-	
+
 	sub			r0, r10, r2										@ r0 = t0 - r2@
 	sub			r1, r11, r3									  @ r1 = t1 - r3@
-	
+
 	add			r2, r10, r2										@ r2 = t0 + r2@
 	add			r3, r11, r3										@ r3 = t1 + r3@
-	
+
 	str			r2, [sp, #24]
 	str			r3, [sp, #28]
-	
+
 	ldrd		r10, [r14, #0]								@ r4 = xptr[0]@ r5 = xptr[1]@
 	ldr			r8, [r12], #4									@ cosxsinx = csptr[1]@
-	
+
 	smulwt	r6, r10, r8										@ L_mpy_wx(cosx, t0)
 	smulwt	r5, r11, r8										@ L_mpy_wx(cosx, t1)
-	
+
 	smlawb	r4, r11, r8, r6								@ r4 = L_mpy_wx(cosx, t0) + L_mpy_wx(sinx, t1)@
 	smulwb	r7, r10, r8										@ L_mpy_wx(sinx, t0)
-	
+
 	add			r14, r14, r9									@ xptr += step@
 	sub			r5, r5, r7										@ r5 = L_mpy_wx(cosx, t1) - L_mpy_wx(sinx, t0)@
-		
+
 	ldrd		r10, [r14]										@ r6 = xptr[0]@ r7 = xptr[1]@
 	ldr			r8, [r12], #4									@ cosxsinx = csptr[1]@
-	
+
 	smulwt	r2, r10, r8										@ L_mpy_wx(cosx, t0)
 	smulwt	r7, r11, r8										@ L_mpy_wx(cosx, t1)
-	
+
 	smlawb	r6, r11, r8, r2								@ r4 = L_mpy_wx(cosx, t0) + L_mpy_wx(sinx, t1)@
 	smulwb	r3, r10, r8										@ L_mpy_wx(sinx, t0)
-	
-	mov			r10, r4												@ t0 = r4@
-	mov			r11, r5												@ t1 = r5@	
-	
-	sub			r7, r7, r3										@ r5 = L_mpy_wx(cosx, t1) - L_mpy_wx(sinx, t0)@
-	
 
-	add			r4,  r10, r6									@	r4 = t0 + r6@	
+	mov			r10, r4												@ t0 = r4@
+	mov			r11, r5												@ t1 = r5@
+
+	sub			r7, r7, r3										@ r5 = L_mpy_wx(cosx, t1) - L_mpy_wx(sinx, t0)@
+
+
+	add			r4,  r10, r6									@	r4 = t0 + r6@
 	sub			r5, r7, r11										@ r5 = r7 - t1@
-	
+
 	sub			r6, r10, r6										@ r6 = t0 - r6@
 	add			r7, r7, r11										@ r7 = r7 + t1@
-	
+
 	ldr			r2, [sp, #24]
 	ldr			r3, [sp, #28]
-	
+
 	add			r10, r0, r5										@ xptr[0] = r0 + r5@
 	add			r11, r1, r6										@ xptr[0] = r1 + r6
-	
-	strd		r10, [r14]										
+
+	strd		r10, [r14]
 	sub			r14, r14, r9									@ xptr -= step@
-	
+
 	sub			r10, r2, r4										@	xptr[0] = r2 - r4@
 	sub			r11, r3, r7										@ xptr[1] = r3 - r7@
-	
-	strd		r10, [r14]				
+
+	strd		r10, [r14]
 	sub			r14, r14, r9									@ xptr -= step@
-	
+
 	sub			r10, r0, r5										@ xptr[0] = r0 - r5@
 	sub			r11, r1, r6										@ xptr[0] = r1 - r6
-	
-	strd		r10, [r14]										
+
+	strd		r10, [r14]
 	sub			r14, r14, r9									@ xptr -= step@
-	
+
 	add			r10, r2, r4										@	xptr[0] = r2 - r4@
 	add			r11, r3, r7										@ xptr[1] = r3 - r7@
-	
-	strd		r10, [r14]				
+
+	strd		r10, [r14]
 	add			r14, r14, #8									@ xptr += 2@
-	
+
 	ldr			r11, [sp, #20]
 	subs		r11, r11, #1
-	bne			Radix4FFT_LOOP3	
-	 
-Radix4FFT_LOOP2_END:           
+	bne			Radix4FFT_LOOP3
+
+Radix4FFT_LOOP2_END:
 	ldr			r10, [sp, #16]
 	ldr			r3, [sp, #12]
 	ldr			r2, [sp, #8]
-	rsb			r8, r9, r9, lsl #2   
+	rsb			r8, r9, r9, lsl #2
 	sub			r10, r10, #1
-	add			r14, r14, r8		      
-	cmp			r10, #0  
-	bhi     Radix4FFT_LOOP2           
-                        
-Radix4FFT_LOOP1_END:               
-	ldr     r0, [sp]    
+	add			r14, r14, r8
+	cmp			r10, #0
+	bhi     Radix4FFT_LOOP2
+
+Radix4FFT_LOOP1_END:
+	ldr     r0, [sp]
 	ldr		r1, [sp, #4]
 	add     r3, r3, r8, asr #1
-	mov     r2, r2, lsl #2 
-	movs    r1, r1, asr #2 
-	bne     Radix4FFT_LOOP1          
-                        
-Radix4FFT_END:                        
-	add     sp, sp, #32                  
+	mov     r2, r2, lsl #2
+	movs    r1, r1, asr #2
+	bne     Radix4FFT_LOOP1
+
+Radix4FFT_END:
+	add     sp, sp, #32
 	ldmia   sp!, {r4 - r11, pc}
-		
+
 	@ENDP  @ |Radix4FFT|
-	.end
\ No newline at end of file
+	.end
diff --git a/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/band_nrg_v5.s b/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/band_nrg_v5.s
index 3b88810..4789f6d 100644
--- a/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/band_nrg_v5.s
+++ b/media/libstagefright/codecs/aacenc/src/asm/ARMV5E/band_nrg_v5.s
@@ -26,31 +26,31 @@
 	.global	CalcBandEnergy
 
 CalcBandEnergy:
-	stmdb   sp!, {r4 - r11, lr}	
-                   
-  mov     r2, r2, lsl #16                   
+	stmdb   sp!, {r4 - r11, lr}
+
+  mov     r2, r2, lsl #16
 	ldr     r12, [r13, #36]
 	mov			r9, #0
-  mov     r5, r2, asr #16    
-	mov			r4, #0               
-  cmp     r5, #0	
-	ble     L212 
+  mov     r5, r2, asr #16
+	mov			r4, #0
+  cmp     r5, #0
+	ble     L212
 
 L22:
-  mov     r2, r4, lsl #1                    
-  ldrsh   r10, [r1, r2]                     
-  add     r11, r1, r2                       
-  ldrsh   r2, [r11, #2]    
-	mov     r14, #0                 
-  cmp     r10, r2                           
-  bge     L28 
-	
+  mov     r2, r4, lsl #1
+  ldrsh   r10, [r1, r2]
+  add     r11, r1, r2
+  ldrsh   r2, [r11, #2]
+	mov     r14, #0
+  cmp     r10, r2
+  bge     L28
+
 L23:
-	ldr     r11, [r0, +r10, lsl #2]	
-  add     r10, r10, #1    
-	ldr     r6, [r0, +r10, lsl #2]	
+	ldr     r11, [r0, +r10, lsl #2]
+  add     r10, r10, #1
+	ldr     r6, [r0, +r10, lsl #2]
 	smull   r11, r7, r11, r11
-	add     r10, r10, #1 
+	add     r10, r10, #1
 	smull	  r6, r8, r6, r6
 	ldr     r11, [r0, +r10, lsl #2]
 	qadd	  r14, r14, r7
@@ -59,71 +59,71 @@
 	ldr     r6, [r0, +r10, lsl #2]
 	qadd	  r14, r14, r8
 	smull	  r6, r8, r6, r6
-  add     r10, r10, #1 
+  add     r10, r10, #1
 	qadd	  r14, r14, r7
 	cmp     r10, r2
 	qadd	  r14, r14, r8
-	blt     L23   
+	blt     L23
 
-L28:	
+L28:
 	qadd	  r14, r14, r14
 	str     r14, [r3, +r4, lsl #2]
-	add     r4, r4, #1 
+	add     r4, r4, #1
 	qadd	  r9, r9, r14
-	cmp     r4, r5                          
+	cmp     r4, r5
 
-  blt     L22       	
+  blt     L22
 
-L212:	
-	str     r9, [r12, #0]                     
+L212:
+	str     r9, [r12, #0]
 	ldmia   sp!, {r4 - r11, pc}
-	
+
 	@ENDP  ; |CalcBandEnergy|
-	
+
 	.global	CalcBandEnergyMS
 
 CalcBandEnergyMS:
 	stmdb   sp!, {r4 - r11, lr}
 	sub     r13, r13, #24
-	
-	mov     r12, #0 
-  mov     r3, r3, lsl #16  
-  mov     r14, #0 
-	mov     r3, r3, asr #16      
-	cmp     r3, #0          
-	mov		  r4, #0                  
-  ble     L315    
-	
-L32:	
+
+	mov     r12, #0
+  mov     r3, r3, lsl #16
+  mov     r14, #0
+	mov     r3, r3, asr #16
+	cmp     r3, #0
+	mov		  r4, #0
+  ble     L315
+
+L32:
 	mov		  r5, r4, lsl #1
 	mov		  r6, #0
 	ldrsh   r10, [r2, r5]
 	add     r5, r2, r5
 	mov		  r7, #0
-	ldrsh	  r11, [r5, #2]                        
-	cmp     r10, r11                          
-  bge     L39    
+	ldrsh	  r11, [r5, #2]
+	cmp     r10, r11
+  bge     L39
 
 	str		  r3, [r13, #4]
 	str		  r4, [r13, #8]
 	str		  r12, [r13, #12]
 	str		  r14, [r13, #16]
 
-L33:	
-	ldr     r8, [r0, +r10, lsl #2]                    
+L33:
+	ldr     r8, [r0, +r10, lsl #2]
 	ldr     r9, [r1, +r10, lsl #2]
 	mov		  r8, r8, asr #1
 	add		  r10, r10, #1
 	mov		  r9, r9, asr #1
 
-	ldr     r12, [r0, +r10, lsl #2]          
-	add		  r5, r8, r9	          
+	ldr     r12, [r0, +r10, lsl #2]
+	add		  r5, r8, r9
 	ldr     r14, [r1, +r10, lsl #2]
 	sub		  r8, r8, r9
 
-	smull   r5, r3, r5, r5 
+	smull   r5, r3, r5, r5
 	mov		  r12, r12, asr #1
-	smull   r8, r4, r8, r8 
+	smull   r8, r4, r8, r8
 	mov		  r14, r14, asr #1
 
 	qadd	  r6, r6, r3
@@ -131,27 +131,27 @@
 	qadd	  r7, r7, r4
 	sub		  r8, r12, r14
 
-	smull   r5, r3, r5, r5 
+	smull   r5, r3, r5, r5
 	add		  r10, r10, #1
-	smull   r8, r4, r8, r8 
-		
+	smull   r8, r4, r8, r8
+
 	qadd	  r6, r6, r3
 	qadd	  r7, r7, r4
 
-	ldr     r8, [r0, +r10, lsl #2]                    
+	ldr     r8, [r0, +r10, lsl #2]
 	ldr     r9, [r1, +r10, lsl #2]
 	mov		  r8, r8, asr #1
 	add		  r10, r10, #1
 	mov		  r9, r9, asr #1
 
-	ldr     r12, [r0, +r10, lsl #2]          
-	add		  r5, r8, r9	          
+	ldr     r12, [r0, +r10, lsl #2]
+	add		  r5, r8, r9
 	ldr     r14, [r1, +r10, lsl #2]
 	sub		  r8, r8, r9
 
-	smull   r5, r3, r5, r5 
+	smull   r5, r3, r5, r5
 	mov		  r12, r12, asr #1
-	smull   r8, r4, r8, r8 
+	smull   r8, r4, r8, r8
 	mov		  r14, r14, asr #1
 
 	qadd	  r6, r6, r3
@@ -159,37 +159,37 @@
 	qadd	  r7, r7, r4
 	sub		  r8, r12, r14
 
-	smull   r5, r3, r5, r5 
+	smull   r5, r3, r5, r5
 	add		  r10, r10, #1
-	smull   r8, r4, r8, r8 
-		
+	smull   r8, r4, r8, r8
+
 	qadd	  r6, r6, r3
 	qadd	  r7, r7, r4
 
 	cmp     r10, r11
-	
+
 	blt		  L33
 
 	ldr		  r3, [r13, #4]
-	ldr		  r4, [r13, #8]	
+	ldr		  r4, [r13, #8]
 	ldr		  r12, [r13, #12]
 	ldr		  r14, [r13, #16]
-L39:	
+L39:
 	qadd	  r6, r6, r6
-	qadd	  r7, r7, r7	
-	
+	qadd	  r7, r7, r7
+
 	ldr		  r8, [r13, #60]
 	ldr		  r9, [r13, #68]
 
 	qadd	  r12, r12, r6
 	qadd	  r14, r14, r7
-	
-	str		  r6, [r8, +r4, lsl #2]       
-	str     r7, [r9, +r4, lsl #2]    
-	
+
+	str		  r6, [r8, +r4, lsl #2]
+	str     r7, [r9, +r4, lsl #2]
+
 	add		  r4, r4, #1
 	cmp		  r4, r3
-	blt     L32            
+	blt     L32
 
 L315:
 	ldr		  r8, [r13, #64]
diff --git a/media/libstagefright/codecs/aacenc/src/asm/ARMV7/PrePostMDCT_v7.s b/media/libstagefright/codecs/aacenc/src/asm/ARMV7/PrePostMDCT_v7.s
index a04c105..b2bc9d9 100644
--- a/media/libstagefright/codecs/aacenc/src/asm/ARMV7/PrePostMDCT_v7.s
+++ b/media/libstagefright/codecs/aacenc/src/asm/ARMV7/PrePostMDCT_v7.s
@@ -26,53 +26,53 @@
 
 PreMDCT:
 	stmdb     sp!, {r4 - r11, lr}
-	
+
 	add         r9, r0, r1, lsl #2
 	sub         r3, r9, #32
 
 	movs        r1, r1, asr #2
-	beq         PreMDCT_END	
-	
+	beq         PreMDCT_END
+
 PreMDCT_LOOP:
 	VLD4.I32			{d0, d2, d4, d6}, [r2]!				@ cosa = *csptr++@ sina = *csptr++@
 	VLD4.I32			{d1, d3, d5, d7}, [r2]!				@ cosb = *csptr++@ sinb = *csptr++@
 	VLD2.I32			{d8, d9, d10, d11}, [r0]			@ tr1 = *(buf0 + 0)@ ti2 = *(buf0 + 1)@
 	VLD2.I32			{d13, d15}, [r3]!					@ tr2 = *(buf1 - 1)@ ti1 = *(buf1 + 0)@
 	VLD2.I32			{d12, d14}, [r3]!					@ tr2 = *(buf1 - 1)@ ti1 = *(buf1 + 0)@
-		
-	VREV64.32			Q8, Q7	
+
+	VREV64.32			Q8, Q7
 	VREV64.32			Q9, Q6
 
-	
+
 	VQDMULH.S32		Q10, Q0, Q4								@ MULHIGH(cosa, tr1)
 	VQDMULH.S32		Q11, Q1, Q8								@ MULHIGH(sina, ti1)
 	VQDMULH.S32		Q12, Q0, Q8								@ MULHIGH(cosa, ti1)
 	VQDMULH.S32		Q13, Q1, Q4								@ MULHIGH(sina, tr1)
-		
+
 	VADD.S32			Q0, Q10, Q11						@ *buf0++ = MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@
 	VSUB.S32			Q1, Q12, Q13						@ *buf0++ = MULHIGH(cosa, ti1) - MULHIGH(sina, tr1)@
-	
+
 	VST2.I32			{d0, d1, d2, d3}, [r0]!
 	sub						r3, r3, #32
-	
+
 	VQDMULH.S32		Q10, Q2, Q9										@ MULHIGH(cosb, tr2)
 	VQDMULH.S32		Q11, Q3, Q5										@ MULHIGH(sinb, ti2)
 	VQDMULH.S32		Q12, Q2, Q5										@ MULHIGH(cosb, ti2)
 	VQDMULH.S32		Q13, Q3, Q9										@ MULHIGH(sinb, tr2)
-		
+
 	VADD.S32			Q0, Q10, Q11									@ MULHIGH(cosa, tr2) + MULHIGH(sina, ti2)@
 	VSUB.S32			Q1, Q12, Q13									@ MULHIGH(cosa, ti2) - MULHIGH(sina, tr2)@
-	
+
 	VREV64.32			Q3, Q1
 	VREV64.32			Q2, Q0
-		
-	VST2.I32		{d5, d7}, [r3]!	
-	VST2.I32		{d4, d6}, [r3]! 
-	
+
+	VST2.I32		{d5, d7}, [r3]!
+	VST2.I32		{d4, d6}, [r3]!
+
 	subs     		r1, r1, #4
-	sub		  		r3, r3, #64	
+	sub		  		r3, r3, #64
 	bne       	PreMDCT_LOOP
-	
+
 PreMDCT_END:
 	ldmia     sp!, {r4 - r11, pc}
 	@ENDP  @ |PreMDCT|
@@ -82,54 +82,54 @@
 
 PostMDCT:
 	stmdb     sp!, {r4 - r11, lr}
-	
+
 	add         r9, r0, r1, lsl #2
 	sub         r3, r9, #32
 
 	movs        r1, r1, asr #2
 	beq         PostMDCT_END
-	
+
 PostMDCT_LOOP:
 	VLD4.I32			{d0, d2, d4, d6}, [r2]!				@ cosa = *csptr++@ sina = *csptr++@
 	VLD4.I32			{d1, d3, d5, d7}, [r2]!				@ cosb = *csptr++@ sinb = *csptr++@
 	VLD2.I32			{d8, d9, d10, d11}, [r0]			@ tr1 = *(zbuf1 + 0)@ ti1 = *(zbuf1 + 1)@
 	VLD2.I32			{d13, d15}, [r3]!							@ tr2 = *(zbuf2 - 1)@ ti2 = *(zbuf2 + 0)@
-	VLD2.I32			{d12, d14}, [r3]!							@ tr2 = *(zbuf2 - 1)@ ti2 = *(zbuf2 + 0)@	
+	VLD2.I32			{d12, d14}, [r3]!							@ tr2 = *(zbuf2 - 1)@ ti2 = *(zbuf2 + 0)@
 
-	VREV64.32			Q8, Q6	
-	VREV64.32			Q9, Q7			
-	
+	VREV64.32			Q8, Q6
+	VREV64.32			Q9, Q7
+
 	VQDMULH.S32		Q10, Q0, Q4										@ MULHIGH(cosa, tr1)
 	VQDMULH.S32		Q11, Q1, Q5										@ MULHIGH(sina, ti1)
 	VQDMULH.S32		Q12, Q0, Q5										@ MULHIGH(cosa, ti1)
 	VQDMULH.S32		Q13, Q1, Q4										@ MULHIGH(sina, tr1)
-		
+
 	VADD.S32			Q0, Q10, Q11									@ *buf0++ = MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@
 	VSUB.S32			Q5, Q13, Q12									@ *buf1-- = MULHIGH(sina, tr1) - MULHIGH(cosa, ti1)@
-	
+
 	VQDMULH.S32		Q10, Q2, Q8										@ MULHIGH(cosb, tr2)
 	VQDMULH.S32		Q11, Q3, Q9										@ MULHIGH(sinb, ti2)
 	VQDMULH.S32		Q12, Q2, Q9										@ MULHIGH(cosb, ti2)
 	VQDMULH.S32		Q13, Q3, Q8										@ MULHIGH(sinb, tr2)
-		
+
 	VADD.S32			Q4, Q10, Q11									@ *buf1-- = MULHIGH(cosa, tr2) + MULHIGH(sina, ti2)@
-	VSUB.S32			Q1, Q13, Q12									@ *buf0++ = MULHIGH(sina, tr2) - MULHIGH(cosa, ti2)@	
-	
+	VSUB.S32			Q1, Q13, Q12									@ *buf0++ = MULHIGH(sina, tr2) - MULHIGH(cosa, ti2)@
+
 	VREV64.32			Q2, Q4
-	VREV64.32			Q3, Q5	
-	
-	sub						r3, r3, #32	
+	VREV64.32			Q3, Q5
+
+	sub						r3, r3, #32
 	VST2.I32			{d0, d1, d2, d3}, [r0]!
-		
-	VST2.I32			{d5, d7}, [r3]!	
-	VST2.I32			{d4, d6}, [r3]! 
-	
+
+	VST2.I32			{d5, d7}, [r3]!
+	VST2.I32			{d4, d6}, [r3]!
+
 	subs     			r1, r1, #4
-	sub		  			r3, r3, #64		
+	sub		  			r3, r3, #64
 	bne       	PostMDCT_LOOP
 
 PostMDCT_END:
 	ldmia     sp!, {r4 - r11, pc}
 
 	@ENDP  		@ |PostMDCT|
-	.end
\ No newline at end of file
+	.end
diff --git a/media/libstagefright/codecs/aacenc/src/asm/ARMV7/R4R8First_v7.s b/media/libstagefright/codecs/aacenc/src/asm/ARMV7/R4R8First_v7.s
index defd45d..3033156 100644
--- a/media/libstagefright/codecs/aacenc/src/asm/ARMV7/R4R8First_v7.s
+++ b/media/libstagefright/codecs/aacenc/src/asm/ARMV7/R4R8First_v7.s
@@ -29,86 +29,86 @@
 
 	ldr       		r3, SQRT1_2
 	cmp       		r1, #0
-	
-	VDUP.I32  		Q15, r3	
+
+	VDUP.I32  		Q15, r3
 	beq       		Radix8First_END
-	
+
 Radix8First_LOOP:
 	VLD1.I32			{d0, d1, d2, d3},	[r0]!
 	VLD1.I32			{d8, d9, d10, d11},	[r0]!
-		
+
 	VADD.S32			d4, d0, d1		@ r0 = buf[0] + buf[2]@i0 = buf[1] + buf[3]@
-	VSUB.S32			d5, d0, d1		@ r1 = buf[0] - buf[2]@i1 = buf[1] - buf[3]@	
-	VSUB.S32			d7, d2, d3		@ r2 = buf[4] - buf[6]@i2 = buf[5] - buf[7]@	
+	VSUB.S32			d5, d0, d1		@ r1 = buf[0] - buf[2]@i1 = buf[1] - buf[3]@
+	VSUB.S32			d7, d2, d3		@ r2 = buf[4] - buf[6]@i2 = buf[5] - buf[7]@
 	VADD.S32			d6, d2, d3		@ r3 = buf[4] + buf[6]@i3 = buf[5] + buf[7]@
-	VREV64.I32			d7, d7	
-	
+	VREV64.I32			d7, d7
+
 	VADD.S32			Q0, Q2, Q3		@ r4 = (r0 + r2)@i4 = (i0 + i2)@i6 = (i1 + r3)@r7 = (r1 + i3)
 	VSUB.S32			Q1, Q2, Q3		@ r5 = (r0 - r2)@i5 = (i0 - i2)@r6 = (r1 - i3)@i7 = (i1 - r3)@
 
-	VREV64.I32			d3, d3	
+	VREV64.I32			d3, d3
 
 	VADD.S32			d4, d8, d9		@ r0 = buf[ 8] + buf[10]@i0 = buf[ 9] + buf[11]@
-	VSUB.S32			d7, d10, d11	@ r1 = buf[12] - buf[14]@i1 = buf[13] - buf[15]@	
+	VSUB.S32			d7, d10, d11	@ r1 = buf[12] - buf[14]@i1 = buf[13] - buf[15]@
 	VADD.S32			d6, d10, d11	@ r2 = buf[12] + buf[14]@i2 = buf[13] + buf[15]@
-	VREV64.I32			d7, d7	
+	VREV64.I32			d7, d7
 	VSUB.S32			d5, d8, d9		@ r3 = buf[ 8] - buf[10]@i3 = buf[ 9] - buf[11]@
-	
-	VTRN.32				d1, d3	
-	
+
+	VTRN.32				d1, d3
+
 	VADD.S32			Q4, Q2, Q3		@ t0 = (r0 + r2) >> 1@t1 = (i0 + i2) >> 1@i0 = i1 + r3@r2 = r1 + i3@
 	VSUB.S32			Q5, Q2, Q3		@ t2 = (r0 - r2) >> 1@t3 = (i0 - i2) >> 1@r0 = r1 - i3@i2 = i1 - r3@
-	
+
 	VREV64.I32			d3, d3
-	
-	VSHR.S32			d8, d8, #1		 
+
+	VSHR.S32			d8, d8, #1
 	VSHR.S32			Q0, Q0, #1
 	VREV64.I32			d10, d10
 	VTRN.32				d11, d9
 	VSHR.S32			Q1, Q1, #1
 	VSHR.S32			d10, d10, #1
 	VREV64.I32			d9, d9
-	
+
 	sub       			r0, r0, #0x40
-	
+
 	VADD.S32			d12, d0, d8
-	VSUB.S32			d16, d0, d8	
+	VSUB.S32			d16, d0, d8
 	VADD.S32			d14, d2, d10
 	VSUB.S32			d18, d2, d10
-	
+
 	VSUB.S32			d4, d11, d9
 	VADD.S32			d5, d11, d9
-	
+
 	VREV64.I32			d18, d18
-	
+
 	VQDMULH.S32			Q3, Q2, Q15
 	VTRN.32				d14, d18
 	VTRN.32				d6, d7
-	VREV64.I32			d18, d18	
-	
+	VREV64.I32			d18, d18
+
 	VSUB.S32			d15, d3, d6
 	VREV64.I32			d7, d7
 	VADD.S32			d19, d3, d6
 	VADD.S32			d13, d1, d7
 	VSUB.S32			d17, d1, d7
-	
+
 	VREV64.I32			d17, d17
 	VTRN.32				d13, d17
 	VREV64.I32			d17, d17
-	
-	subs       			r1, r1, #1	
-	
+
+	subs       			r1, r1, #1
+
 	VST1.I32			{d12, d13, d14, d15}, [r0]!
-	VST1.I32			{d16, d17, d18, d19}, [r0]!	
+	VST1.I32			{d16, d17, d18, d19}, [r0]!
 	bne       			Radix8First_LOOP
-	
+
 Radix8First_END:
-	ldmia     sp!, {r4 - r11, pc}	
+	ldmia     sp!, {r4 - r11, pc}
 SQRT1_2:
 	.word      0x2d413ccd
-	
+
 	@ENDP  @ |Radix8First|
-	
+
 	.section .text
 	.global	Radix4First
 
@@ -117,30 +117,30 @@
 
 	cmp       	r1, #0
 	beq       	Radix4First_END
-	
+
 Radix4First_LOOP:
-	VLD1.I32			{d0, d1, d2, d3}, [r0]					
-	
-	VADD.S32			d4, d0, d1							@ r0 = buf[0] + buf[2]@ r1 = buf[1] + buf[3]@		
+	VLD1.I32			{d0, d1, d2, d3}, [r0]
+
+	VADD.S32			d4, d0, d1							@ r0 = buf[0] + buf[2]@ r1 = buf[1] + buf[3]@
 	VSUB.S32			d5, d0, d1							@ r2 = buf[0] - buf[2]@ r3 = buf[1] - buf[3]@
 	VSUB.S32			d7, d2, d3							@ r4 = buf[4] + buf[6]@ r5 = buf[5] + buf[7]@
 	VADD.S32			d6, d2, d3							@ r6 = buf[4] - buf[6]@ r7 = buf[5] - buf[7]@
-	
-	VREV64.I32		d7, d7									@ 
-	
+
+	VREV64.I32		d7, d7									@
+
 	VADD.S32			Q4, Q2, Q3
 	VSUB.S32			Q5, Q2, Q3
-	
+
 	VREV64.I32		d11, d11
 	VTRN.32				d9, d11
-	subs       		r1, r1, #1	
+	subs       		r1, r1, #1
 	VREV64.I32		d11, d11
 	VST1.I32			{d8, d9, d10, d11}, [r0]!
 
 	bne       		Radix4First_LOOP
-	
+
 Radix4First_END:
 	ldmia    		sp!, {r4 - r11, pc}
 
 	@ENDP  @ |Radix4First|
-	.end
\ No newline at end of file
+	.end
diff --git a/media/libstagefright/codecs/aacenc/src/asm/ARMV7/Radix4FFT_v7.s b/media/libstagefright/codecs/aacenc/src/asm/ARMV7/Radix4FFT_v7.s
index 84a4a80..f874825 100644
--- a/media/libstagefright/codecs/aacenc/src/asm/ARMV7/Radix4FFT_v7.s
+++ b/media/libstagefright/codecs/aacenc/src/asm/ARMV7/Radix4FFT_v7.s
@@ -28,116 +28,116 @@
 	stmdb    sp!, {r4 - r11, lr}
 
 	mov			r1, r1, asr #2
-	cmp     	r1, #0                            
-	beq     	Radix4FFT_END                            
-                        
-Radix4FFT_LOOP1:                         
-	mov     	r5, r2, lsl #1  
-	mov     	r8, r0          
-	mov     	r7, r1  
-	mov     	r5, r5, lsl #2   
-	cmp     	r1, #0          
-	rsbeq   	r12, r5, r5, lsl #2 
-	beq     	Radix4FFT_LOOP1_END              
-                         
-	rsb     	r12, r5, r5, lsl #2   
-	 
-Radix4FFT_LOOP2:                        
-	mov     	r6, r3 
-	mov     	r4, r2  
-	cmp     	r2, #0        
-	beq     	Radix4FFT_LOOP2_END         
-  
-Radix4FFT_LOOP3:                          
+	cmp     	r1, #0
+	beq     	Radix4FFT_END
+
+Radix4FFT_LOOP1:
+	mov     	r5, r2, lsl #1
+	mov     	r8, r0
+	mov     	r7, r1
+	mov     	r5, r5, lsl #2
+	cmp     	r1, #0
+	rsbeq   	r12, r5, r5, lsl #2
+	beq     	Radix4FFT_LOOP1_END
+
+	rsb     	r12, r5, r5, lsl #2
+
+Radix4FFT_LOOP2:
+	mov     	r6, r3
+	mov     	r4, r2
+	cmp     	r2, #0
+	beq     	Radix4FFT_LOOP2_END
+
+Radix4FFT_LOOP3:
 	@r0 = xptr[0]@
 	@r1 = xptr[1]@
-	VLD2.I32			{D0, D1, D2, D3}, [r8]				
+	VLD2.I32			{D0, D1, D2, D3}, [r8]
 	VLD2.I32			{D28, D29, D30, D31}, [r6]!		@ cosx = csptr[0]@ sinx = csptr[1]@
-	
-	add					r8, r8, r5										@ xptr += step@	
+
+	add					r8, r8, r5										@ xptr += step@
 	VLD2.I32			{D4, D5, D6,D7}, [r8]					@ r2 = xptr[0]@ r3 = xptr[1]@
-	
+
 	VQDMULH.S32		Q10, Q2, Q14									@ MULHIGH(cosx, t0)
 	VQDMULH.S32		Q11, Q3, Q15									@ MULHIGH(sinx, t1)
 	VQDMULH.S32		Q12, Q3, Q14									@ MULHIGH(cosx, t1)
 	VQDMULH.S32		Q13, Q2, Q15									@ MULHIGH(sinx, t0)
-		
+
 	VADD.S32			Q2, Q10, Q11									@ MULHIGH(cosx, t0) + MULHIGH(sinx, t1)
 	VSUB.S32			Q3, Q12, Q13									@ MULHIGH(cosx, t1) - MULHIGH(sinx, t0)
-	
+
 	add					r8, r8, r5										@ xptr += step@
 	VSHR.S32			Q10, Q0, #2										@ t0 = r0 >> 2@
 	VSHR.S32			Q11, Q1, #2										@ t1 = r1 >> 2@
-	
+
 	VSUB.S32			Q0,	Q10, Q2										@ r0 = t0 - r2@
 	VSUB.S32			Q1,	Q11, Q3										@ r1 = t1 - r3@
 	VADD.S32			Q2, Q10, Q2										@ r2 = t0 + r2@
 	VADD.S32			Q3, Q11, Q3										@ r3 = t1 + r3@
-		
-	VLD2.I32			{D8, D9, D10, D11}, [r8]	
-	VLD2.I32			{D28, D29, D30, D31}, [r6]!	
+
+	VLD2.I32			{D8, D9, D10, D11}, [r8]
+	VLD2.I32			{D28, D29, D30, D31}, [r6]!
 	add						r8, r8, r5
 
 	VQDMULH.S32		Q10, Q4, Q14									@ MULHIGH(cosx, t0)
 	VQDMULH.S32		Q11, Q5, Q15									@ MULHIGH(sinx, t1)
 	VQDMULH.S32		Q12, Q5, Q14									@ MULHIGH(cosx, t1)
 	VQDMULH.S32		Q13, Q4, Q15									@ MULHIGH(sinx, t0)
-		
+
 	VADD.S32			Q8, Q10, Q11									@ MULHIGH(cosx, t0) + MULHIGH(sinx, t1)
-	VSUB.S32			Q9, Q12, Q13									@ MULHIGH(cosx, t1) - MULHIGH(sinx, t0)	
-	
-	VLD2.I32		{D12, D13, D14, D15}, [r8]	
+	VSUB.S32			Q9, Q12, Q13									@ MULHIGH(cosx, t1) - MULHIGH(sinx, t0)
+
+	VLD2.I32		{D12, D13, D14, D15}, [r8]
 	VLD2.I32		{D28, D29, D30, D31}, [r6]!
-	
+
 	VQDMULH.S32		Q10, Q6, Q14									@ MULHIGH(cosx, t0)
 	VQDMULH.S32		Q11, Q7, Q15									@ MULHIGH(sinx, t1)
 	VQDMULH.S32		Q12, Q7, Q14									@ MULHIGH(cosx, t1)
 	VQDMULH.S32		Q13, Q6, Q15									@ MULHIGH(sinx, t0)
-		
+
 	VADD.S32			Q6, Q10, Q11									@ MULHIGH(cosx, t0) + MULHIGH(sinx, t1)
-	VSUB.S32			Q7, Q12, Q13									@ MULHIGH(cosx, t1) - MULHIGH(sinx, t0)		
-	
+	VSUB.S32			Q7, Q12, Q13									@ MULHIGH(cosx, t1) - MULHIGH(sinx, t0)
+
 	VADD.S32			Q4, Q8, Q6										@ r4 = t0 + r6@
 	VSUB.S32			Q5, Q7, Q9										@ r5 = r7 - t1@
 	VSUB.S32			Q6, Q8, Q6										@ r6 = t0 - r6@
 	VADD.S32			Q7, Q7, Q9										@ r7 = r7 + t1@
-	
+
 	VADD.S32			Q8, Q0, Q5										@ xptr[0] = r0 + r5@
 	VADD.S32			Q9, Q1, Q6										@ xptr[1] = r1 + r6@
 	VST2.I32			{D16, D17, D18, D19}, [r8]
-	
+
 	VSUB.S32			Q10, Q2, Q4										@ xptr[0] = r2 - r4@
 	sub					r8, r8, r5										@ xptr -= step@
 	VSUB.S32			Q11, Q3, Q7										@ xptr[1] = r3 - r7@
 	VST2.I32			{D20, D21, D22, D23}, [r8]
-		
+
 	VSUB.S32			Q8, Q0, Q5										@ xptr[0] = r0 - r5@
 	sub					r8, r8, r5										@ xptr -= step@
 	VSUB.S32			Q9, Q1, Q6										@ xptr[1] = r1 - r6@
 	VST2.I32			{D16, D17, D18, D19}, [r8]
-		
+
 	VADD.S32			Q10, Q2, Q4										@ xptr[0] = r2 + r4@
 	sub					r8, r8, r5										@ xptr -= step@
 	VADD.S32			Q11, Q3, Q7										@ xptr[1] = r3 + r7@
 	VST2.I32			{D20, D21, D22, D23}, [r8]!
-		
-	subs    			r4, r4, #4 
-	bne     			Radix4FFT_LOOP3 
-	                         
-Radix4FFT_LOOP2_END:                         
-	add     			r8, r8, r12    
-	sub    				r7, r7, #1     
+
+	subs    			r4, r4, #4
+	bne     			Radix4FFT_LOOP3
+
+Radix4FFT_LOOP2_END:
+	add     			r8, r8, r12
+	sub    				r7, r7, #1
 	cmp					r7, #0
-	bhi     			Radix4FFT_LOOP2           
-                        
-Radix4FFT_LOOP1_END:                        
-	add     			r3, r12, r3    
-	mov     			r2, r2, lsl #2 
-	movs    			r1, r1, asr #2 
-	bne     			Radix4FFT_LOOP1          
-                        
-Radix4FFT_END:        
+	bhi     			Radix4FFT_LOOP2
+
+Radix4FFT_LOOP1_END:
+	add     			r3, r12, r3
+	mov     			r2, r2, lsl #2
+	movs    			r1, r1, asr #2
+	bne     			Radix4FFT_LOOP1
+
+Radix4FFT_END:
 	ldmia   			sp!, {r4 - r11, pc}
-		
+
 	@ENDP  @ |Radix4FFT|
-	.end
\ No newline at end of file
+	.end
diff --git a/media/libstagefright/codecs/aacenc/src/band_nrg.c b/media/libstagefright/codecs/aacenc/src/band_nrg.c
index 89c39b6..e4034b8 100644
--- a/media/libstagefright/codecs/aacenc/src/band_nrg.c
+++ b/media/libstagefright/codecs/aacenc/src/band_nrg.c
@@ -37,18 +37,18 @@
                     Word32       *bandEnergySum)
 {
   Word32 i, j;
-  Word32 accuSum = 0;                                            
+  Word32 accuSum = 0;
 
   for (i=0; i<numBands; i++) {
-    Word32 accu = 0;                                             
+    Word32 accu = 0;
     for (j=bandOffset[i]; j<bandOffset[i+1]; j++)
       accu = L_add(accu, MULHIGH(mdctSpectrum[j], mdctSpectrum[j]));
 
 	accu = L_add(accu, accu);
     accuSum = L_add(accuSum, accu);
-    bandEnergy[i] = accu;                                        
+    bandEnergy[i] = accu;
   }
-  *bandEnergySum = accuSum;                                      
+  *bandEnergySum = accuSum;
 }
 
 /********************************************************************************
@@ -68,15 +68,15 @@
 {
 
   Word32 i, j;
-  Word32 accuMidSum = 0;        
-  Word32 accuSideSum = 0;                                          
- 
+  Word32 accuMidSum = 0;
+  Word32 accuSideSum = 0;
+
 
   for(i=0; i<numBands; i++) {
     Word32 accuMid = 0;
-    Word32 accuSide = 0;                                           
+    Word32 accuSide = 0;
     for (j=bandOffset[i]; j<bandOffset[i+1]; j++) {
-      Word32 specm, specs; 
+      Word32 specm, specs;
       Word32 l, r;
 
       l = mdctSpectrumLeft[j] >> 1;
@@ -86,17 +86,17 @@
       accuMid = L_add(accuMid, MULHIGH(specm, specm));
       accuSide = L_add(accuSide, MULHIGH(specs, specs));
     }
-    
+
 	accuMid = L_add(accuMid, accuMid);
 	accuSide = L_add(accuSide, accuSide);
-	bandEnergyMid[i] = accuMid;                                  
+	bandEnergyMid[i] = accuMid;
     accuMidSum = L_add(accuMidSum, accuMid);
-    bandEnergySide[i] = accuSide;                                
+    bandEnergySide[i] = accuSide;
     accuSideSum = L_add(accuSideSum, accuSide);
-    
+
   }
-  *bandEnergyMidSum = accuMidSum;                                
-  *bandEnergySideSum = accuSideSum;                              
+  *bandEnergyMidSum = accuMidSum;
+  *bandEnergySideSum = accuSideSum;
 }
 
-#endif
\ No newline at end of file
+#endif
diff --git a/media/libstagefright/codecs/aacenc/src/bit_cnt.c b/media/libstagefright/codecs/aacenc/src/bit_cnt.c
index 8853efc..9fe511cd 100644
--- a/media/libstagefright/codecs/aacenc/src/bit_cnt.c
+++ b/media/libstagefright/codecs/aacenc/src/bit_cnt.c
@@ -26,14 +26,14 @@
 #define HI_LTAB(a) (a>>8)
 #define LO_LTAB(a) (a & 0xff)
 
-#define EXPAND(a)  ((((Word32)(a&0xff00)) << 8)|(Word32)(a&0xff)) 
+#define EXPAND(a)  ((((Word32)(a&0xff00)) << 8)|(Word32)(a&0xff))
 
 
 /*****************************************************************************
 *
 * function name: count1_2_3_4_5_6_7_8_9_10_11
-* description:  counts tables 1-11 
-* returns:      
+* description:  counts tables 1-11
+* returns:
 * input:        quantized spectrum
 * output:       bitCount for tables 1-11
 *
@@ -46,51 +46,51 @@
   Word32 t0,t1,t2,t3,i;
   Word32 bc1_2,bc3_4,bc5_6,bc7_8,bc9_10;
   Word16 bc11,sc;
-  
-  bc1_2=0;                               
-  bc3_4=0;                               
-  bc5_6=0;                               
-  bc7_8=0;                               
-  bc9_10=0;                              
-  bc11=0;                                
-  sc=0;                                  
+
+  bc1_2=0;
+  bc3_4=0;
+  bc5_6=0;
+  bc7_8=0;
+  bc9_10=0;
+  bc11=0;
+  sc=0;
 
   for(i=0;i<width;i+=4){
-    
-    t0= values[i+0];                     
-    t1= values[i+1];                     
-    t2= values[i+2];                     
-    t3= values[i+3];                     
-  
+
+    t0= values[i+0];
+    t1= values[i+1];
+    t2= values[i+2];
+    t3= values[i+3];
+
     /* 1,2 */
 
-    bc1_2 = bc1_2 + EXPAND(huff_ltab1_2[t0+1][t1+1][t2+1][t3+1]);              
+    bc1_2 = bc1_2 + EXPAND(huff_ltab1_2[t0+1][t1+1][t2+1][t3+1]);
 
     /* 5,6 */
-    bc5_6 = bc5_6 + EXPAND(huff_ltab5_6[t0+4][t1+4]);                          
-    bc5_6 = bc5_6 + EXPAND(huff_ltab5_6[t2+4][t3+4]);                          
+    bc5_6 = bc5_6 + EXPAND(huff_ltab5_6[t0+4][t1+4]);
+    bc5_6 = bc5_6 + EXPAND(huff_ltab5_6[t2+4][t3+4]);
 
     t0=ABS(t0);
     t1=ABS(t1);
     t2=ABS(t2);
     t3=ABS(t3);
 
-    
-    bc3_4 = bc3_4 + EXPAND(huff_ltab3_4[t0][t1][t2][t3]);                      
-    
-    bc7_8 = bc7_8 + EXPAND(huff_ltab7_8[t0][t1]);                              
-    bc7_8 = bc7_8 + EXPAND(huff_ltab7_8[t2][t3]);                              
-    
-    bc9_10 = bc9_10 + EXPAND(huff_ltab9_10[t0][t1]);                           
-    bc9_10 = bc9_10 + EXPAND(huff_ltab9_10[t2][t3]);                           
-    
+
+    bc3_4 = bc3_4 + EXPAND(huff_ltab3_4[t0][t1][t2][t3]);
+
+    bc7_8 = bc7_8 + EXPAND(huff_ltab7_8[t0][t1]);
+    bc7_8 = bc7_8 + EXPAND(huff_ltab7_8[t2][t3]);
+
+    bc9_10 = bc9_10 + EXPAND(huff_ltab9_10[t0][t1]);
+    bc9_10 = bc9_10 + EXPAND(huff_ltab9_10[t2][t3]);
+
     bc11 = bc11 + huff_ltab11[t0][t1];
     bc11 = bc11 + huff_ltab11[t2][t3];
-   
-           
+
+
     sc = sc + (t0>0) + (t1>0) + (t2>0) + (t3>0);
   }
-  
+
   bitCount[1]=extract_h(bc1_2);
   bitCount[2]=extract_l(bc1_2);
   bitCount[3]=extract_h(bc3_4) + sc;
@@ -108,8 +108,8 @@
 /*****************************************************************************
 *
 * function name: count3_4_5_6_7_8_9_10_11
-* description:  counts tables 3-11 
-* returns:      
+* description:  counts tables 3-11
+* returns:
 * input:        quantized spectrum
 * output:       bitCount for tables 3-11
 *
@@ -122,26 +122,26 @@
   Word32 t0,t1,t2,t3, i;
   Word32 bc3_4,bc5_6,bc7_8,bc9_10;
   Word16 bc11,sc;
-    
-  bc3_4=0;                               
-  bc5_6=0;                               
-  bc7_8=0;                               
-  bc9_10=0;                              
-  bc11=0;                                
-  sc=0;                                  
+
+  bc3_4=0;
+  bc5_6=0;
+  bc7_8=0;
+  bc9_10=0;
+  bc11=0;
+  sc=0;
 
   for(i=0;i<width;i+=4){
 
-    t0= values[i+0];                     
-    t1= values[i+1];                     
-    t2= values[i+2];                     
-    t3= values[i+3];                     
-    
+    t0= values[i+0];
+    t1= values[i+1];
+    t2= values[i+2];
+    t3= values[i+3];
+
     /*
       5,6
     */
-    bc5_6 = bc5_6 + EXPAND(huff_ltab5_6[t0+4][t1+4]);                          
-    bc5_6 = bc5_6 + EXPAND(huff_ltab5_6[t2+4][t3+4]);                          
+    bc5_6 = bc5_6 + EXPAND(huff_ltab5_6[t0+4][t1+4]);
+    bc5_6 = bc5_6 + EXPAND(huff_ltab5_6[t2+4][t3+4]);
 
     t0=ABS(t0);
     t1=ABS(t1);
@@ -149,23 +149,23 @@
     t3=ABS(t3);
 
 
-    bc3_4 = bc3_4 + EXPAND(huff_ltab3_4[t0][t1][t2][t3]);                      
-                                                                                                                
-    bc7_8 = bc7_8 + EXPAND(huff_ltab7_8[t0][t1]);                              
-    bc7_8 = bc7_8 + EXPAND(huff_ltab7_8[t2][t3]);                              
-    
-    bc9_10 = bc9_10 + EXPAND(huff_ltab9_10[t0][t1]);                           
-    bc9_10 = bc9_10 + EXPAND(huff_ltab9_10[t2][t3]);                           
-                                                                                                                
+    bc3_4 = bc3_4 + EXPAND(huff_ltab3_4[t0][t1][t2][t3]);
+
+    bc7_8 = bc7_8 + EXPAND(huff_ltab7_8[t0][t1]);
+    bc7_8 = bc7_8 + EXPAND(huff_ltab7_8[t2][t3]);
+
+    bc9_10 = bc9_10 + EXPAND(huff_ltab9_10[t0][t1]);
+    bc9_10 = bc9_10 + EXPAND(huff_ltab9_10[t2][t3]);
+
     bc11 = bc11 + huff_ltab11[t0][t1];
     bc11 = bc11 + huff_ltab11[t2][t3];
 
-           
-    sc = sc + (t0>0) + (t1>0) + (t2>0) + (t3>0);   
+
+    sc = sc + (t0>0) + (t1>0) + (t2>0) + (t3>0);
   }
-  
-  bitCount[1]=INVALID_BITCOUNT;                          
-  bitCount[2]=INVALID_BITCOUNT;                          
+
+  bitCount[1]=INVALID_BITCOUNT;
+  bitCount[2]=INVALID_BITCOUNT;
   bitCount[3]=extract_h(bc3_4) + sc;
   bitCount[4]=extract_l(bc3_4) + sc;
   bitCount[5]=extract_h(bc5_6);
@@ -175,7 +175,7 @@
   bitCount[9]=extract_h(bc9_10) + sc;
   bitCount[10]=extract_l(bc9_10) + sc;
   bitCount[11]=bc11 + sc;
-  
+
 }
 
 
@@ -183,8 +183,8 @@
 /*****************************************************************************
 *
 * function name: count5_6_7_8_9_10_11
-* description:  counts tables 5-11 
-* returns:      
+* description:  counts tables 5-11
+* returns:
 * input:        quantized spectrum
 * output:       bitCount for tables 5-11
 *
@@ -198,33 +198,33 @@
   Word32 bc5_6,bc7_8,bc9_10;
   Word16 bc11,sc;
 
-  bc5_6=0;                               
-  bc7_8=0;                               
-  bc9_10=0;                              
-  bc11=0;                                
-  sc=0;                                  
+  bc5_6=0;
+  bc7_8=0;
+  bc9_10=0;
+  bc11=0;
+  sc=0;
 
   for(i=0;i<width;i+=2){
 
-    t0 = values[i+0];                    
-    t1 = values[i+1];                    
+    t0 = values[i+0];
+    t1 = values[i+1];
 
-    bc5_6 = bc5_6 + EXPAND(huff_ltab5_6[t0+4][t1+4]);                  
+    bc5_6 = bc5_6 + EXPAND(huff_ltab5_6[t0+4][t1+4]);
 
     t0=ABS(t0);
     t1=ABS(t1);
-     
-    bc7_8 = bc7_8 + EXPAND(huff_ltab7_8[t0][t1]);                      
-    bc9_10 = bc9_10 + EXPAND(huff_ltab9_10[t0][t1]);                   
+
+    bc7_8 = bc7_8 + EXPAND(huff_ltab7_8[t0][t1]);
+    bc9_10 = bc9_10 + EXPAND(huff_ltab9_10[t0][t1]);
     bc11 = bc11 + huff_ltab11[t0][t1];
-    
-       
+
+
     sc = sc + (t0>0) + (t1>0);
   }
-  bitCount[1]=INVALID_BITCOUNT;                          
-  bitCount[2]=INVALID_BITCOUNT;                          
-  bitCount[3]=INVALID_BITCOUNT;                          
-  bitCount[4]=INVALID_BITCOUNT;                          
+  bitCount[1]=INVALID_BITCOUNT;
+  bitCount[2]=INVALID_BITCOUNT;
+  bitCount[3]=INVALID_BITCOUNT;
+  bitCount[4]=INVALID_BITCOUNT;
   bitCount[5]=extract_h(bc5_6);
   bitCount[6]=extract_l(bc5_6);
   bitCount[7]=extract_h(bc7_8) + sc;
@@ -232,15 +232,15 @@
   bitCount[9]=extract_h(bc9_10) + sc;
   bitCount[10]=extract_l(bc9_10) + sc;
   bitCount[11]=bc11 + sc;
-  
+
 }
 
 
 /*****************************************************************************
 *
 * function name: count7_8_9_10_11
-* description:  counts tables 7-11 
-* returns:      
+* description:  counts tables 7-11
+* returns:
 * input:        quantized spectrum
 * output:       bitCount for tables 7-11
 *
@@ -253,43 +253,43 @@
   Word32 t0,t1, i;
   Word32 bc7_8,bc9_10;
   Word16 bc11,sc;
-    
-  bc7_8=0;                       
-  bc9_10=0;                      
-  bc11=0;                        
-  sc=0;                          
+
+  bc7_8=0;
+  bc9_10=0;
+  bc11=0;
+  sc=0;
 
   for(i=0;i<width;i+=2){
 
     t0=ABS(values[i+0]);
     t1=ABS(values[i+1]);
 
-    bc7_8 = bc7_8 + EXPAND(huff_ltab7_8[t0][t1]);                      
-    bc9_10 = bc9_10 + EXPAND(huff_ltab9_10[t0][t1]);                   
+    bc7_8 = bc7_8 + EXPAND(huff_ltab7_8[t0][t1]);
+    bc9_10 = bc9_10 + EXPAND(huff_ltab9_10[t0][t1]);
     bc11 = bc11 + huff_ltab11[t0][t1];
-   
-       
+
+
     sc = sc + (t0>0) + (t1>0);
   }
-  bitCount[1]=INVALID_BITCOUNT;                  
-  bitCount[2]=INVALID_BITCOUNT;                  
-  bitCount[3]=INVALID_BITCOUNT;                  
-  bitCount[4]=INVALID_BITCOUNT;                  
-  bitCount[5]=INVALID_BITCOUNT;                  
-  bitCount[6]=INVALID_BITCOUNT;                  
+  bitCount[1]=INVALID_BITCOUNT;
+  bitCount[2]=INVALID_BITCOUNT;
+  bitCount[3]=INVALID_BITCOUNT;
+  bitCount[4]=INVALID_BITCOUNT;
+  bitCount[5]=INVALID_BITCOUNT;
+  bitCount[6]=INVALID_BITCOUNT;
   bitCount[7]=extract_h(bc7_8) + sc;
   bitCount[8]=extract_l(bc7_8) + sc;
   bitCount[9]=extract_h(bc9_10) + sc;
   bitCount[10]=extract_l(bc9_10) + sc;
   bitCount[11]=bc11 + sc;
-  
+
 }
 
 /*****************************************************************************
 *
 * function name: count9_10_11
-* description:  counts tables 9-11 
-* returns:      
+* description:  counts tables 9-11
+* returns:
 * input:        quantized spectrum
 * output:       bitCount for tables 9-11
 *
@@ -299,45 +299,45 @@
                          Word16       *bitCount)
 {
 
-  Word32 t0,t1,i;  
+  Word32 t0,t1,i;
   Word32 bc9_10;
   Word16 bc11,sc;
 
-  bc9_10=0;                              
-  bc11=0;                                
-  sc=0;                                  
+  bc9_10=0;
+  bc11=0;
+  sc=0;
 
   for(i=0;i<width;i+=2){
 
     t0=ABS(values[i+0]);
     t1=ABS(values[i+1]);
-    
 
-    bc9_10 += EXPAND(huff_ltab9_10[t0][t1]);           
+
+    bc9_10 += EXPAND(huff_ltab9_10[t0][t1]);
     bc11 = bc11 + huff_ltab11[t0][t1];
 
-       
+
     sc = sc + (t0>0) + (t1>0);
   }
-  bitCount[1]=INVALID_BITCOUNT;          
-  bitCount[2]=INVALID_BITCOUNT;          
-  bitCount[3]=INVALID_BITCOUNT;          
-  bitCount[4]=INVALID_BITCOUNT;          
-  bitCount[5]=INVALID_BITCOUNT;          
-  bitCount[6]=INVALID_BITCOUNT;          
-  bitCount[7]=INVALID_BITCOUNT;          
-  bitCount[8]=INVALID_BITCOUNT;          
+  bitCount[1]=INVALID_BITCOUNT;
+  bitCount[2]=INVALID_BITCOUNT;
+  bitCount[3]=INVALID_BITCOUNT;
+  bitCount[4]=INVALID_BITCOUNT;
+  bitCount[5]=INVALID_BITCOUNT;
+  bitCount[6]=INVALID_BITCOUNT;
+  bitCount[7]=INVALID_BITCOUNT;
+  bitCount[8]=INVALID_BITCOUNT;
   bitCount[9]=extract_h(bc9_10) + sc;
   bitCount[10]=extract_l(bc9_10) + sc;
   bitCount[11]=bc11 + sc;
-  
+
 }
- 
+
 /*****************************************************************************
 *
 * function name: count11
-* description:  counts table 11 
-* returns:      
+* description:  counts table 11
+* returns:
 * input:        quantized spectrum
 * output:       bitCount for table 11
 *
@@ -347,37 +347,37 @@
                     Word16        *bitCount)
 {
   Word32 t0,t1,i;
-  Word16 bc11,sc;  
+  Word16 bc11,sc;
 
-  bc11=0;                        
-  sc=0;                          
+  bc11=0;
+  sc=0;
   for(i=0;i<width;i+=2){
     t0=ABS(values[i+0]);
     t1=ABS(values[i+1]);
     bc11 = bc11 + huff_ltab11[t0][t1];
 
-       
+
     sc = sc + (t0>0) + (t1>0);
   }
 
-  bitCount[1]=INVALID_BITCOUNT;                  
-  bitCount[2]=INVALID_BITCOUNT;                  
-  bitCount[3]=INVALID_BITCOUNT;                  
-  bitCount[4]=INVALID_BITCOUNT;                  
-  bitCount[5]=INVALID_BITCOUNT;                  
-  bitCount[6]=INVALID_BITCOUNT;                  
-  bitCount[7]=INVALID_BITCOUNT;                  
-  bitCount[8]=INVALID_BITCOUNT;                  
-  bitCount[9]=INVALID_BITCOUNT;                  
-  bitCount[10]=INVALID_BITCOUNT;                 
+  bitCount[1]=INVALID_BITCOUNT;
+  bitCount[2]=INVALID_BITCOUNT;
+  bitCount[3]=INVALID_BITCOUNT;
+  bitCount[4]=INVALID_BITCOUNT;
+  bitCount[5]=INVALID_BITCOUNT;
+  bitCount[6]=INVALID_BITCOUNT;
+  bitCount[7]=INVALID_BITCOUNT;
+  bitCount[8]=INVALID_BITCOUNT;
+  bitCount[9]=INVALID_BITCOUNT;
+  bitCount[10]=INVALID_BITCOUNT;
   bitCount[11]=bc11 + sc;
 }
 
 /*****************************************************************************
 *
 * function name: countEsc
-* description:  counts table 11 (with Esc) 
-* returns:      
+* description:  counts table 11 (with Esc)
+* returns:
 * input:        quantized spectrum
 * output:       bitCount for tables 11 (with Esc)
 *
@@ -388,31 +388,31 @@
                      Word16       *bitCount)
 {
   Word32 t0,t1,t00,t01,i;
-  Word16 bc11,ec,sc;  
+  Word16 bc11,ec,sc;
 
-  bc11=0;                                
-  sc=0;                                  
-  ec=0;                                  
+  bc11=0;
+  sc=0;
+  ec=0;
   for(i=0;i<width;i+=2){
     t0=ABS(values[i+0]);
     t1=ABS(values[i+1]);
-    
-       
+
+
     sc = sc + (t0>0) + (t1>0);
 
     t00 = min(t0,16);
     t01 = min(t1,16);
     bc11 = bc11 + huff_ltab11[t00][t01];
-    
-     
+
+
     if(t0 >= 16){
       ec = ec + 5;
       while(sub(t0=(t0 >> 1), 16) >= 0) {
         ec = ec + 2;
       }
     }
-    
-     
+
+
     if(t1 >= 16){
       ec = ec + 5;
       while(sub(t1=(t1 >> 1), 16) >= 0) {
@@ -420,16 +420,16 @@
       }
     }
   }
-  bitCount[1]=INVALID_BITCOUNT;          
-  bitCount[2]=INVALID_BITCOUNT;          
-  bitCount[3]=INVALID_BITCOUNT;          
-  bitCount[4]=INVALID_BITCOUNT;          
-  bitCount[5]=INVALID_BITCOUNT;          
-  bitCount[6]=INVALID_BITCOUNT;          
-  bitCount[7]=INVALID_BITCOUNT;          
-  bitCount[8]=INVALID_BITCOUNT;          
-  bitCount[9]=INVALID_BITCOUNT;          
-  bitCount[10]=INVALID_BITCOUNT;         
+  bitCount[1]=INVALID_BITCOUNT;
+  bitCount[2]=INVALID_BITCOUNT;
+  bitCount[3]=INVALID_BITCOUNT;
+  bitCount[4]=INVALID_BITCOUNT;
+  bitCount[5]=INVALID_BITCOUNT;
+  bitCount[6]=INVALID_BITCOUNT;
+  bitCount[7]=INVALID_BITCOUNT;
+  bitCount[8]=INVALID_BITCOUNT;
+  bitCount[9]=INVALID_BITCOUNT;
+  bitCount[10]=INVALID_BITCOUNT;
   bitCount[11]=bc11 + sc + ec;
 }
 
@@ -463,7 +463,7 @@
 /*****************************************************************************
 *
 * function name: bitCount
-* description:  count bits 
+* description:  count bits
 *
 *****************************************************************************/
 Word16 bitCount(const Word16 *values,
@@ -474,7 +474,7 @@
   /*
     check if we can use codebook 0
   */
-     
+
   if(maxVal == 0)
     bitCount[0] = 0;
   else
@@ -489,7 +489,7 @@
 /*****************************************************************************
 *
 * function name: codeValues
-* description:  write huffum bits 
+* description:  write huffum bits
 *
 *****************************************************************************/
 Word16 codeValues(Word16 *values, Word16 width, Word16 codeBook, HANDLE_BIT_BUF hBitstream)
@@ -499,85 +499,85 @@
   UWord16 codeWord, codeLength;
   Word16 sign, signLength;
 
-   
+
   switch (codeBook) {
     case CODE_BOOK_ZERO_NO:
       break;
 
     case CODE_BOOK_1_NO:
       for(i=0; i<width; i+=4) {
-        t0         = values[i+0];                                        
-        t1         = values[i+1];                                        
-        t2         = values[i+2];                                        
-        t3         = values[i+3];                                        
-        codeWord   = huff_ctab1[t0+1][t1+1][t2+1][t3+1];                 
-        codeLength = HI_LTAB(huff_ltab1_2[t0+1][t1+1][t2+1][t3+1]);      
-        WriteBits(hBitstream, codeWord, codeLength);        
+        t0         = values[i+0];
+        t1         = values[i+1];
+        t2         = values[i+2];
+        t3         = values[i+3];
+        codeWord   = huff_ctab1[t0+1][t1+1][t2+1][t3+1];
+        codeLength = HI_LTAB(huff_ltab1_2[t0+1][t1+1][t2+1][t3+1]);
+        WriteBits(hBitstream, codeWord, codeLength);
       }
       break;
 
     case CODE_BOOK_2_NO:
       for(i=0; i<width; i+=4) {
-        t0         = values[i+0];                                        
-        t1         = values[i+1];                                        
-        t2         = values[i+2];                                        
-        t3         = values[i+3];                                        
-        codeWord   = huff_ctab2[t0+1][t1+1][t2+1][t3+1];                 
-        codeLength = LO_LTAB(huff_ltab1_2[t0+1][t1+1][t2+1][t3+1]);      
+        t0         = values[i+0];
+        t1         = values[i+1];
+        t2         = values[i+2];
+        t3         = values[i+3];
+        codeWord   = huff_ctab2[t0+1][t1+1][t2+1][t3+1];
+        codeLength = LO_LTAB(huff_ltab1_2[t0+1][t1+1][t2+1][t3+1]);
         WriteBits(hBitstream,codeWord,codeLength);
       }
       break;
 
     case CODE_BOOK_3_NO:
       for(i=0; i<width; i+=4) {
-        sign=0;                                                          
-        signLength=0;                                                    
-        t0 = values[i+0];                                                
-         
+        sign=0;
+        signLength=0;
+        t0 = values[i+0];
+
         if(t0 != 0){
           signLength = signLength + 1;
-          sign = sign << 1; 
-           
+          sign = sign << 1;
+
           if(t0 < 0){
-            sign|=1;                                                     
+            sign|=1;
             t0=-t0;
           }
         }
-        t1 = values[i+1];                                                
-         
+        t1 = values[i+1];
+
         if(t1 != 0){
           signLength = signLength + 1;
-          sign = sign << 1; 
-           
+          sign = sign << 1;
+
           if(t1 < 0){
-            sign|=1;                                                     
+            sign|=1;
             t1=-t1;
           }
         }
-        t2 = values[i+2];                                                
-         
+        t2 = values[i+2];
+
         if(t2 != 0){
           signLength = signLength + 1;
-          sign = sign << 1; 
-           
+          sign = sign << 1;
+
           if(t2 < 0){
-            sign|=1;                                                     
+            sign|=1;
             t2=-t2;
           }
         }
-        t3 = values[i+3];                                                
+        t3 = values[i+3];
         if(t3 != 0){
           signLength = signLength + 1;
-          sign = sign << 1; 
-           
+          sign = sign << 1;
+
           if(t3 < 0){
-            sign|=1;                                                     
+            sign|=1;
             t3=-t3;
           }
         }
 
-        codeWord   = huff_ctab3[t0][t1][t2][t3];                         
-        codeLength = HI_LTAB(huff_ltab3_4[t0][t1][t2][t3]);              
+        codeWord   = huff_ctab3[t0][t1][t2][t3];
+        codeLength = HI_LTAB(huff_ltab3_4[t0][t1][t2][t3]);
         WriteBits(hBitstream,codeWord,codeLength);
         WriteBits(hBitstream,sign,signLength);
       }
@@ -585,107 +585,107 @@
 
     case CODE_BOOK_4_NO:
       for(i=0; i<width; i+=4) {
-        sign=0;                                                          
-        signLength=0;                                                    
-        t0 = values[i+0];                                                
-         
-        if(t0 != 0){                                                             
+        sign=0;
+        signLength=0;
+        t0 = values[i+0];
+
+        if(t0 != 0){
           signLength = signLength + 1;
-          sign = sign << 1; 
-          if(t0 < 0){                                                            
-            sign|=1;                                                     
-            t0=-t0;                                                          
+          sign = sign << 1;
+          if(t0 < 0){
+            sign|=1;
+            t0=-t0;
           }
-        }                                                                        
-        t1 = values[i+1];                                                
-         
-        if(t1 != 0){                                                             
+        }
+        t1 = values[i+1];
+
+        if(t1 != 0){
           signLength = signLength + 1;
-          sign = sign << 1; 
-           
-          if(t1 < 0){                                                            
-            sign|=1;                                                     
-            t1=-t1;                                                          
-          }                                                                      
-        }                                                                        
-        t2 = values[i+2];                                                
-         
-        if(t2 != 0){                                                    
+          sign = sign << 1;
+
+          if(t1 < 0){
+            sign|=1;
+            t1=-t1;
+          }
+        }
+        t2 = values[i+2];
+
+        if(t2 != 0){
           signLength = signLength + 1;
-          sign = sign << 1; 
-           
-          if(t2 < 0){                                                   
-            sign|=1;                                                     
-            t2=-t2;                                                 
-          }                                                             
-        }                                                               
-        t3 = values[i+3];                                                
-         
-        if(t3 != 0){                                                    
+          sign = sign << 1;
+
+          if(t2 < 0){
+            sign|=1;
+            t2=-t2;
+          }
+        }
+        t3 = values[i+3];
+
+        if(t3 != 0){
           signLength = signLength + 1;
-          sign = sign << 1; 
-           
-          if(t3 < 0){                                                   
-            sign|=1;                                                     
-            t3=-t3;                                                 
-          }                                                             
-        }                                                               
-        codeWord   = huff_ctab4[t0][t1][t2][t3];                         
-        codeLength = LO_LTAB(huff_ltab3_4[t0][t1][t2][t3]);              
-        WriteBits(hBitstream,codeWord,codeLength);                      
-        WriteBits(hBitstream,sign,signLength);                          
-      }                                                                 
-      break;                                                            
-                                                                        
-    case CODE_BOOK_5_NO:                                                
-      for(i=0; i<width; i+=2) {                                         
-        t0         = values[i+0];                                         
-        t1         = values[i+1];                                        
-        codeWord   = huff_ctab5[t0+4][t1+4];                             
-        codeLength = HI_LTAB(huff_ltab5_6[t0+4][t1+4]);                  
+          sign = sign << 1;
+
+          if(t3 < 0){
+            sign|=1;
+            t3=-t3;
+          }
+        }
+        codeWord   = huff_ctab4[t0][t1][t2][t3];
+        codeLength = LO_LTAB(huff_ltab3_4[t0][t1][t2][t3]);
+        WriteBits(hBitstream,codeWord,codeLength);
+        WriteBits(hBitstream,sign,signLength);
+      }
+      break;
+
+    case CODE_BOOK_5_NO:
+      for(i=0; i<width; i+=2) {
+        t0         = values[i+0];
+        t1         = values[i+1];
+        codeWord   = huff_ctab5[t0+4][t1+4];
+        codeLength = HI_LTAB(huff_ltab5_6[t0+4][t1+4]);
         WriteBits(hBitstream,codeWord,codeLength);
       }
       break;
 
     case CODE_BOOK_6_NO:
       for(i=0; i<width; i+=2) {
-        t0         = values[i+0];                                        
-        t1         = values[i+1];                                        
-        codeWord   = huff_ctab6[t0+4][t1+4];                             
-        codeLength = LO_LTAB(huff_ltab5_6[t0+4][t1+4]);                  
+        t0         = values[i+0];
+        t1         = values[i+1];
+        codeWord   = huff_ctab6[t0+4][t1+4];
+        codeLength = LO_LTAB(huff_ltab5_6[t0+4][t1+4]);
         WriteBits(hBitstream,codeWord,codeLength);
       }
       break;
 
     case CODE_BOOK_7_NO:
       for(i=0; i<width; i+=2){
-        sign=0;                                                          
-        signLength=0;                                                    
-        t0 = values[i+0];                                                
-         
+        sign=0;
+        signLength=0;
+        t0 = values[i+0];
+
         if(t0 != 0){
           signLength = signLength + 1;
-          sign = sign << 1; 
-           
+          sign = sign << 1;
+
           if(t0 < 0){
-            sign|=1;                                                     
+            sign|=1;
             t0=-t0;
           }
         }
 
-        t1 = values[i+1];                                                
-         
+        t1 = values[i+1];
+
         if(t1 != 0){
           signLength = signLength + 1;
-          sign = sign << 1; 
-           
+          sign = sign << 1;
+
           if(t1 < 0){
-            sign|=1;                                                     
+            sign|=1;
             t1=-t1;
           }
         }
-        codeWord   = huff_ctab7[t0][t1];                                 
-        codeLength = HI_LTAB(huff_ltab7_8[t0][t1]);                      
+        codeWord   = huff_ctab7[t0][t1];
+        codeLength = HI_LTAB(huff_ltab7_8[t0][t1]);
         WriteBits(hBitstream,codeWord,codeLength);
         WriteBits(hBitstream,sign,signLength);
       }
@@ -693,33 +693,33 @@
 
     case CODE_BOOK_8_NO:
       for(i=0; i<width; i+=2) {
-        sign=0;                                                          
-        signLength=0;                                                    
-        t0 = values[i+0];                                                
-                                                                           
-        if(t0 != 0){                                                             
-          signLength = signLength + 1;                                       
-          sign = sign << 1;                                                   
-                                                                           
-          if(t0 < 0){                                                            
-            sign|=1;                                                     
-            t0=-t0;                                                        
-          }                                                                      
-        }                                                                        
-                                                                                 
-        t1 = values[i+1];                                                
-                                                                           
-        if(t1 != 0){                                                             
-          signLength = signLength + 1;                                       
-          sign = sign << 1;                                                   
-                                                                           
-          if(t1 < 0){                                                            
-            sign|=1;                                                     
-            t1=-t1;                                                        
-          }                                                                      
-        }                                                                        
-        codeWord   = huff_ctab8[t0][t1];                                 
-        codeLength = LO_LTAB(huff_ltab7_8[t0][t1]);                      
+        sign=0;
+        signLength=0;
+        t0 = values[i+0];
+
+        if(t0 != 0){
+          signLength = signLength + 1;
+          sign = sign << 1;
+
+          if(t0 < 0){
+            sign|=1;
+            t0=-t0;
+          }
+        }
+
+        t1 = values[i+1];
+
+        if(t1 != 0){
+          signLength = signLength + 1;
+          sign = sign << 1;
+
+          if(t1 < 0){
+            sign|=1;
+            t1=-t1;
+          }
+        }
+        codeWord   = huff_ctab8[t0][t1];
+        codeLength = LO_LTAB(huff_ltab7_8[t0][t1]);
         WriteBits(hBitstream,codeWord,codeLength);
         WriteBits(hBitstream,sign,signLength);
       }
@@ -727,33 +727,33 @@
 
     case CODE_BOOK_9_NO:
       for(i=0; i<width; i+=2) {
-        sign=0;                                                          
-        signLength=0;                                                    
-        t0 = values[i+0];                                                
-                                                                           
-        if(t0 != 0){                                                             
-          signLength = signLength + 1;                                       
-          sign = sign << 1;                                                   
-                                                                           
-          if(t0 < 0){                                                            
-            sign|=1;                                                     
-            t0=-t0;                                                        
-          }                                                                      
-        }                                                                        
-                                                                                 
-        t1 = values[i+1];                                                
-                                                                           
-        if(t1 != 0){                                                             
-          signLength = signLength + 1;                                       
-          sign = sign << 1;                                                   
-                                                                           
-          if(t1 < 0){                                                            
-            sign|=1;                                                     
-            t1=-t1;                                                        
-          }                                                                      
-        }                                                                        
-        codeWord   = huff_ctab9[t0][t1];                                 
-        codeLength = HI_LTAB(huff_ltab9_10[t0][t1]);                     
+        sign=0;
+        signLength=0;
+        t0 = values[i+0];
+
+        if(t0 != 0){
+          signLength = signLength + 1;
+          sign = sign << 1;
+
+          if(t0 < 0){
+            sign|=1;
+            t0=-t0;
+          }
+        }
+
+        t1 = values[i+1];
+
+        if(t1 != 0){
+          signLength = signLength + 1;
+          sign = sign << 1;
+
+          if(t1 < 0){
+            sign|=1;
+            t1=-t1;
+          }
+        }
+        codeWord   = huff_ctab9[t0][t1];
+        codeLength = HI_LTAB(huff_ltab9_10[t0][t1]);
         WriteBits(hBitstream,codeWord,codeLength);
         WriteBits(hBitstream,sign,signLength);
       }
@@ -761,33 +761,33 @@
 
     case CODE_BOOK_10_NO:
       for(i=0; i<width; i+=2) {
-        sign=0;                                                          
-        signLength=0;                                                    
-        t0 = values[i+0];                                                
-                                                                           
-        if(t0 != 0){                                                             
-          signLength = signLength + 1;                                       
-          sign = sign << 1;                                                   
-                                                                           
-          if(t0 < 0){                                                            
-            sign|=1;                                                     
-            t0=-t0;                                                        
-          }                                                                      
-        }                                                                        
-                                                                                 
-        t1 = values[i+1];                                                
-                                                                           
-        if(t1 != 0){                                                             
-          signLength = signLength + 1;                                       
-          sign = sign << 1;                                                   
-                                                                           
-          if(t1 < 0){                                                            
-            sign|=1;                                                     
-            t1=-t1;                                                        
-          }                                                                      
-        }                                                                        
-        codeWord   = huff_ctab10[t0][t1];                                
-        codeLength = LO_LTAB(huff_ltab9_10[t0][t1]);                     
+        sign=0;
+        signLength=0;
+        t0 = values[i+0];
+
+        if(t0 != 0){
+          signLength = signLength + 1;
+          sign = sign << 1;
+
+          if(t0 < 0){
+            sign|=1;
+            t0=-t0;
+          }
+        }
+
+        t1 = values[i+1];
+
+        if(t1 != 0){
+          signLength = signLength + 1;
+          sign = sign << 1;
+
+          if(t1 < 0){
+            sign|=1;
+            t1=-t1;
+          }
+        }
+        codeWord   = huff_ctab10[t0][t1];
+        codeLength = LO_LTAB(huff_ltab9_10[t0][t1]);
         WriteBits(hBitstream,codeWord,codeLength);
         WriteBits(hBitstream,sign,signLength);
       }
@@ -795,45 +795,45 @@
 
     case CODE_BOOK_ESC_NO:
       for(i=0; i<width; i+=2) {
-        sign=0;                                                  
-        signLength=0;                                            
-        t0 = values[i+0];                                        
-                                                                   
-        if(t0 != 0){                                                     
-          signLength = signLength + 1;                               
-          sign = sign << 1;                                           
-                                                                   
-          if(t0 < 0){                                                    
-            sign|=1;                                             
-            t0=-t0;                                                
-          }                                                              
-        }                                                                
-                                                                         
-        t1 = values[i+1];                                        
-                                                                   
-        if(t1 != 0){                                                     
-          signLength = signLength + 1;                               
-          sign = sign << 1;                                           
-                                                                   
-          if(t1 < 0){                                                    
-            sign|=1;                                             
-            t1=-t1;                                                
-          }                                                              
-        }                                                                
+        sign=0;
+        signLength=0;
+        t0 = values[i+0];
+
+        if(t0 != 0){
+          signLength = signLength + 1;
+          sign = sign << 1;
+
+          if(t0 < 0){
+            sign|=1;
+            t0=-t0;
+          }
+        }
+
+        t1 = values[i+1];
+
+        if(t1 != 0){
+          signLength = signLength + 1;
+          sign = sign << 1;
+
+          if(t1 < 0){
+            sign|=1;
+            t1=-t1;
+          }
+        }
         t00 = min(t0,16);
         t01 = min(t1,16);
 
-        codeWord   = huff_ctab11[t00][t01];                      
-        codeLength = huff_ltab11[t00][t01];                      
+        codeWord   = huff_ctab11[t00][t01];
+        codeLength = huff_ltab11[t00][t01];
         WriteBits(hBitstream,codeWord,codeLength);
         WriteBits(hBitstream,sign,signLength);
-         
+
         if(t0 >= 16){
           Word16 n, p;
-          n=0;                                                   
-          p=t0;                                                  
+          n=0;
+          p=t0;
           while(sub(p=(p >> 1), 16) >= 0){
-             
+
             WriteBits(hBitstream,1,1);
             n = n + 1;
           }
@@ -841,13 +841,13 @@
           n = n + 4;
           WriteBits(hBitstream,(t0 - (1 << n)),n);
         }
-         
+
         if(t1 >= 16){
           Word16 n, p;
-          n=0;                                                   
-          p=t1;                                                  
+          n=0;
+          p=t1;
           while(sub(p=(p >> 1), 16) >= 0){
-             
+
             WriteBits(hBitstream,1,1);
             n = n + 1;
           }
@@ -871,15 +871,15 @@
 
 Word16 codeScalefactorDelta(Word16 delta, HANDLE_BIT_BUF hBitstream)
 {
-  Word32 codeWord; 
+  Word32 codeWord;
   Word16 codeLength;
-  
-   
+
+
   if(delta > CODE_BOOK_SCF_LAV || delta < -CODE_BOOK_SCF_LAV)
     return(1);
-  
-  codeWord   = huff_ctabscf[delta + CODE_BOOK_SCF_LAV];            
-  codeLength = huff_ltabscf[delta + CODE_BOOK_SCF_LAV];            
+
+  codeWord   = huff_ctabscf[delta + CODE_BOOK_SCF_LAV];
+  codeLength = huff_ltabscf[delta + CODE_BOOK_SCF_LAV];
   WriteBits(hBitstream,codeWord,codeLength);
   return(0);
 }
diff --git a/media/libstagefright/codecs/aacenc/src/bitbuffer.c b/media/libstagefright/codecs/aacenc/src/bitbuffer.c
index ef13c13..0ce93d3 100644
--- a/media/libstagefright/codecs/aacenc/src/bitbuffer.c
+++ b/media/libstagefright/codecs/aacenc/src/bitbuffer.c
@@ -32,15 +32,15 @@
                                 UWord8 **pBitBufWord,
                                 Word16   cnt)
 {
-  *pBitBufWord += cnt;                                                                  
+  *pBitBufWord += cnt;
 
-                                                                                        
+
   if(*pBitBufWord > hBitBuf->pBitBufEnd) {
-    *pBitBufWord -= (hBitBuf->pBitBufEnd - hBitBuf->pBitBufBase + 1);                   
+    *pBitBufWord -= (hBitBuf->pBitBufEnd - hBitBuf->pBitBufBase + 1);
   }
-                                                                                        
+
   if(*pBitBufWord < hBitBuf->pBitBufBase) {
-    *pBitBufWord += (hBitBuf->pBitBufEnd - hBitBuf->pBitBufBase + 1);                   
+    *pBitBufWord += (hBitBuf->pBitBufEnd - hBitBuf->pBitBufBase + 1);
   }
 }
 
@@ -57,18 +57,18 @@
 {
   assert(bitBufSize*8 <= 32768);
 
-  hBitBuf->pBitBufBase = pBitBufBase;                                                    
-  hBitBuf->pBitBufEnd  = pBitBufBase + bitBufSize - 1;                                  
+  hBitBuf->pBitBufBase = pBitBufBase;
+  hBitBuf->pBitBufEnd  = pBitBufBase + bitBufSize - 1;
 
-  hBitBuf->pWriteNext  = pBitBufBase;                                                    
+  hBitBuf->pWriteNext  = pBitBufBase;
 
   hBitBuf->cache       = 0;
-  
-  hBitBuf->wBitPos     = 0;                                                              
-  hBitBuf->cntBits     = 0;   
-  
-  hBitBuf->size        = (bitBufSize << 3);                                             
-  hBitBuf->isValid     = 1;                                                              
+
+  hBitBuf->wBitPos     = 0;
+  hBitBuf->cntBits     = 0;
+
+  hBitBuf->size        = (bitBufSize << 3);
+  hBitBuf->isValid     = 1;
 
   return hBitBuf;
 }
@@ -82,8 +82,8 @@
 void DeleteBitBuffer(HANDLE_BIT_BUF *hBitBuf)
 {
   if(*hBitBuf)
-	(*hBitBuf)->isValid = 0;                                                               
-  *hBitBuf = NULL;                                                                       
+	(*hBitBuf)->isValid = 0;
+  *hBitBuf = NULL;
 }
 
 /*****************************************************************************
@@ -96,15 +96,15 @@
                  UWord8 *pBitBufBase,
                  Word16  bitBufSize)
 {
-  hBitBuf->pBitBufBase = pBitBufBase;                                                    
-  hBitBuf->pBitBufEnd  = pBitBufBase + bitBufSize - 1;                                  
+  hBitBuf->pBitBufBase = pBitBufBase;
+  hBitBuf->pBitBufEnd  = pBitBufBase + bitBufSize - 1;
 
-                                                 
-  hBitBuf->pWriteNext  = pBitBufBase;                                                    
 
-  hBitBuf->wBitPos     = 0;    
-  hBitBuf->cntBits     = 0;    
-  
+  hBitBuf->pWriteNext  = pBitBufBase;
+
+  hBitBuf->wBitPos     = 0;
+  hBitBuf->cntBits     = 0;
+
   hBitBuf->cache	   = 0;
 }
 
@@ -117,7 +117,7 @@
 void CopyBitBuf(HANDLE_BIT_BUF hBitBufSrc,
                 HANDLE_BIT_BUF hBitBufDst)
 {
-  *hBitBufDst = *hBitBufSrc;                                                             
+  *hBitBufDst = *hBitBufSrc;
 }
 
 /*****************************************************************************
@@ -138,7 +138,7 @@
 *
 *****************************************************************************/
 Word16 WriteBits(HANDLE_BIT_BUF hBitBuf,
-                 Word32 writeValue,
+                 UWord32 writeValue,
                  Word16 noBitsToWrite)
 {
   Word16 wBitPos;
@@ -148,25 +148,26 @@
   if(noBitsToWrite == 0)
 	  return noBitsToWrite;
 
-  hBitBuf->cntBits += noBitsToWrite;   
+  hBitBuf->cntBits += noBitsToWrite;
 
   wBitPos = hBitBuf->wBitPos;
   wBitPos += noBitsToWrite;
-  writeValue <<= 32 - wBitPos;	
+  writeValue &= ~(0xffffffff << noBitsToWrite); // Mask out everything except the lowest noBitsToWrite bits
+  writeValue <<= 32 - wBitPos;
   writeValue |= hBitBuf->cache;
-  
-  while (wBitPos >= 8) 
+
+  while (wBitPos >= 8)
   {
 	  UWord8 tmp;
 	  tmp = (UWord8)((writeValue >> 24) & 0xFF);
-	  
-	  *hBitBuf->pWriteNext++ = tmp;		
+
+	  *hBitBuf->pWriteNext++ = tmp;
 	  writeValue <<= 8;
 	  wBitPos -= 8;
   }
-  
+
   hBitBuf->wBitPos = wBitPos;
   hBitBuf->cache = writeValue;
-                                                                                     
+
   return noBitsToWrite;
 }
diff --git a/media/libstagefright/codecs/aacenc/src/bitenc.c b/media/libstagefright/codecs/aacenc/src/bitenc.c
index ea34407..fcc12dd 100644
--- a/media/libstagefright/codecs/aacenc/src/bitenc.c
+++ b/media/libstagefright/codecs/aacenc/src/bitenc.c
@@ -46,7 +46,7 @@
   Word16 i,sfb;
   Word16 dbgVal;
   SECTION_INFO* psectioninfo;
-  dbgVal = GetBitsAvail(hBitStream);                                     
+  dbgVal = GetBitsAvail(hBitStream);
 
   for(i=0; i<sectionData->noOfSections; i++) {
     psectioninfo = &(sectionData->sectionInfo[i]);
@@ -100,7 +100,7 @@
   WriteBits(hBitStream,blockType,2);
   WriteBits(hBitStream,windowShape,1);
 
-   
+
   switch(blockType){
     case LONG_WINDOW:
     case START_WINDOW:
@@ -137,30 +137,30 @@
   Word16 sectLen;
   Word16 i;
   Word16 dbgVal=GetBitsAvail(hBitStream);
-       
 
-   
+
+
   switch(sectionData->blockType)
   {
     case LONG_WINDOW:
     case START_WINDOW:
     case STOP_WINDOW:
-      sectEscapeVal = SECT_ESC_VAL_LONG;                 
-      sectLenBits   = SECT_BITS_LONG;                    
+      sectEscapeVal = SECT_ESC_VAL_LONG;
+      sectLenBits   = SECT_BITS_LONG;
       break;
 
     case SHORT_WINDOW:
-      sectEscapeVal = SECT_ESC_VAL_SHORT;                
-      sectLenBits   = SECT_BITS_SHORT;                   
+      sectEscapeVal = SECT_ESC_VAL_SHORT;
+      sectLenBits   = SECT_BITS_SHORT;
       break;
   }
 
   for(i=0;i<sectionData->noOfSections;i++) {
     WriteBits(hBitStream,sectionData->sectionInfo[i].codeBook,4);
-    sectLen = sectionData->sectionInfo[i].sfbCnt;        
+    sectLen = sectionData->sectionInfo[i].sfbCnt;
 
     while(sectLen >= sectEscapeVal) {
-       
+
       WriteBits(hBitStream,sectEscapeVal,sectLenBits);
       sectLen = sectLen - sectEscapeVal;
     }
@@ -183,24 +183,24 @@
 {
   Word16 i,j,lastValScf,deltaScf;
   Word16 dbgVal = GetBitsAvail(hBitStream);
-  SECTION_INFO* psectioninfo; 
+  SECTION_INFO* psectioninfo;
 
-  lastValScf=scalefac[sectionData->firstScf];                    
+  lastValScf=scalefac[sectionData->firstScf];
 
   for(i=0;i<sectionData->noOfSections;i++){
-    psectioninfo = &(sectionData->sectionInfo[i]); 
+    psectioninfo = &(sectionData->sectionInfo[i]);
     if (psectioninfo->codeBook != CODE_BOOK_ZERO_NO){
       for (j=psectioninfo->sfbStart;
            j<psectioninfo->sfbStart+psectioninfo->sfbCnt; j++){
-         
+
         if(maxValueInSfb[j] == 0) {
-          deltaScf = 0;                                          
+          deltaScf = 0;
         }
         else {
           deltaScf = lastValScf - scalefac[j];
-          lastValScf = scalefac[j];                              
+          lastValScf = scalefac[j];
         }
-         
+
         if(codeScalefactorDelta(deltaScf,hBitStream)){
           return(1);
         }
@@ -227,7 +227,7 @@
 {
   Word16 sfb, sfbOff;
 
-   
+
   switch(msDigest)
   {
     case MS_NONE:
@@ -242,7 +242,7 @@
       WriteBits(hBitStream,SI_MS_MASK_SOME,2);
       for(sfbOff = 0; sfbOff < sfbCnt; sfbOff+=grpSfb) {
         for(sfb=0; sfb<maxSfb; sfb++) {
-             
+
           if(jsFlags[sfbOff+sfb] & MS_ON) {
             WriteBits(hBitStream,1,1);
           }
@@ -272,7 +272,7 @@
   Word16 coefBits;
   Flag isShort;
 
-       
+
   if (blockType==2) {
     isShort = 1;
     numOfWindows = TRANS_FAC;
@@ -282,52 +282,52 @@
     numOfWindows = 1;
   }
 
-  tnsPresent=0;                                                  
+  tnsPresent=0;
   for (i=0; i<numOfWindows; i++) {
-     
+
     if (tnsInfo.tnsActive[i]) {
-      tnsPresent=1;                                              
+      tnsPresent=1;
     }
   }
-   
+
   if (tnsPresent==0) {
     WriteBits(hBitStream,0,1);
   }
   else{ /* there is data to be written*/
     WriteBits(hBitStream,1,1); /*data_present */
     for (i=0; i<numOfWindows; i++) {
-       
+
       WriteBits(hBitStream,tnsInfo.tnsActive[i],(isShort?1:2));
-       
+
       if (tnsInfo.tnsActive[i]) {
-         
+
         WriteBits(hBitStream,((tnsInfo.coefRes[i] - 4)==0?1:0),1);
-         
+
         WriteBits(hBitStream,tnsInfo.length[i],(isShort?4:6));
-         
+
         WriteBits(hBitStream,tnsInfo.order[i],(isShort?3:5));
-         
+
         if (tnsInfo.order[i]){
           WriteBits(hBitStream, FILTER_DIRECTION, 1);
-           
+
           if(tnsInfo.coefRes[i] == 4) {
-            coefBits = 3;                                                
+            coefBits = 3;
             for(k=0; k<tnsInfo.order[i]; k++) {
-                 
+
               if (tnsInfo.coef[i*TNS_MAX_ORDER_SHORT+k] > 3 ||
                   tnsInfo.coef[i*TNS_MAX_ORDER_SHORT+k] < -4) {
-                coefBits = 4;                                            
+                coefBits = 4;
                 break;
               }
             }
           }
           else {
-            coefBits = 2;                                                
+            coefBits = 2;
             for(k=0; k<tnsInfo.order[i]; k++) {
-                 
+
               if (tnsInfo.coef[i*TNS_MAX_ORDER_SHORT+k] > 1 ||
                   tnsInfo.coef[i*TNS_MAX_ORDER_SHORT+k] < -2) {
-                coefBits = 3;                                            
+                coefBits = 3;
                 break;
               }
             }
@@ -335,7 +335,7 @@
           WriteBits(hBitStream, tnsInfo.coefRes[i] - coefBits, 1); /*coef_compres*/
           for (k=0; k<tnsInfo.order[i]; k++ ) {
             static const Word16 rmask[] = {0,1,3,7,15};
-             
+
             WriteBits(hBitStream,tnsInfo.coef[i*TNS_MAX_ORDER_SHORT+k] & rmask[coefBits],coefBits);
           }
         }
@@ -397,7 +397,7 @@
 
   encodeGlobalGain(globalGain, logNorm,scf[sectionData->firstScf], hBitStream);
 
-   
+
   if(!commonWindow) {
     encodeIcsInfo(sectionData->blockType, windowShape, groupingMask, sectionData, hBitStream);
   }
@@ -536,7 +536,7 @@
     Write fill Element(s):
     amount of a fill element can be 7+X*8 Bits, X element of [0..270]
   */
-    
+
   while(totFillBits >= (3+4)) {
     cnt = min(((totFillBits - (3+4)) >> 3), ((1<<4)-1));
 
@@ -545,7 +545,7 @@
 
     totFillBits = totFillBits - (3+4);
 
-     
+
     if ((cnt == (1<<4)-1)) {
 
       esc_count = min( ((totFillBits >> 3) - ((1<<4)-1)), (1<<8)-1);
@@ -555,7 +555,7 @@
     }
 
     for(i=0;i<cnt;i++) {
-       
+
       if(ancBytes)
         WriteBits(hBitStream, *ancBytes++,8);
       else
@@ -576,7 +576,7 @@
                        ELEMENT_INFO elInfo,
                        QC_OUT *qcOut,
                        PSY_OUT *psyOut,
-                       Word16 *globUsedBits,					   
+                       Word16 *globUsedBits,
                        const UWord8 *ancBytes,
 					   Word16 sampindex
                        ) /* returns error code */
@@ -586,7 +586,7 @@
   Word16 frameBits=0;
 
   /*   struct bitbuffer bsWriteCopy; */
-  bitMarkUp = GetBitsAvail(hBitStream); 
+  bitMarkUp = GetBitsAvail(hBitStream);
   if(qcOut->qcElement.adtsUsed)  /*  write adts header*/
   {
 	  WriteBits(hBitStream, 0xFFF, 12); /* 12 bit Syncword */
@@ -601,23 +601,23 @@
 									6 channels or less, else a channel
 									configuration should be written */
 	  WriteBits(hBitStream, 0, 1); /* original/copy */
-	  WriteBits(hBitStream, 0, 1); /* home */	  
-	  
+	  WriteBits(hBitStream, 0, 1); /* home */
+
 	  /* Variable ADTS header */
 	  WriteBits(hBitStream, 0, 1); /* copyr. id. bit */
 	  WriteBits(hBitStream, 0, 1); /* copyr. id. start */
 	  WriteBits(hBitStream, *globUsedBits >> 3, 13);
 	  WriteBits(hBitStream, 0x7FF, 11); /* buffer fullness (0x7FF for VBR) */
-	  WriteBits(hBitStream, 0, 2); /* raw data blocks (0+1=1) */  
+	  WriteBits(hBitStream, 0, 2); /* raw data blocks (0+1=1) */
   }
 
-  *globUsedBits=0;                                               
+  *globUsedBits=0;
 
   {
 
     Word16 *sfbOffset[2];
     TNS_INFO tnsInfo[2];
-    elementUsedBits = 0;                                         
+    elementUsedBits = 0;
 
     switch (elInfo.elType) {
 
@@ -636,7 +636,7 @@
         {
           Word16 msDigest;
           Word16 *msFlags = psyOut->psyOutElement.toolsInfo.msMask;
-          msDigest = psyOut->psyOutElement.toolsInfo.msDigest;                        
+          msDigest = psyOut->psyOutElement.toolsInfo.msDigest;
           sfbOffset[0] =
             psyOut->psyOutChannel[elInfo.ChannelIndex[0]].sfbOffsets;
           sfbOffset[1] =
@@ -668,20 +668,20 @@
   }
 
   writeFillElement(NULL,
-                   qcOut->totFillBits, 
+                   qcOut->totFillBits,
                    hBitStream);
 
   WriteBits(hBitStream,ID_END,3);
 
   /* byte alignement */
-  WriteBits(hBitStream,0, (8 - (hBitStream->cntBits & 7)) & 7);          
-  
+  WriteBits(hBitStream,0, (8 - (hBitStream->cntBits & 7)) & 7);
+
   *globUsedBits = *globUsedBits- bitMarkUp;
-  bitMarkUp = GetBitsAvail(hBitStream);                                  
+  bitMarkUp = GetBitsAvail(hBitStream);
   *globUsedBits = *globUsedBits + bitMarkUp;
   frameBits = frameBits + *globUsedBits;
 
-   
+
   if (frameBits !=  (qcOut->totStaticBitsUsed+qcOut->totDynBitsUsed + qcOut->totAncBitsUsed +
                      qcOut->totFillBits + qcOut->alignBits)) {
     return(-1);
diff --git a/media/libstagefright/codecs/aacenc/src/block_switch.c b/media/libstagefright/codecs/aacenc/src/block_switch.c
index d54e32f..47fd15e 100644
--- a/media/libstagefright/codecs/aacenc/src/block_switch.c
+++ b/media/libstagefright/codecs/aacenc/src/block_switch.c
@@ -52,7 +52,7 @@
   IIR high pass coeffs
 */
 Word32 hiPassCoeff[BLOCK_SWITCHING_IIR_LEN] = {
-  0xbec8b439, 0x609d4952  /* -0.5095f, 0.7548f */ 
+  0xbec8b439, 0x609d4952  /* -0.5095f, 0.7548f */
 };
 
 static const Word32 accWindowNrgFac = 0x26666666;                   /* factor for accumulating filtered window energies 0.3 */
@@ -76,8 +76,8 @@
                           const Word32 bitRate, const Word16 nChannels)
 {
   /* select attackRatio */
-           
-  if ((sub(nChannels,1)==0 && L_sub(bitRate, 24000) > 0) || 
+
+  if ((sub(nChannels,1)==0 && L_sub(bitRate, 24000) > 0) ||
       (sub(nChannels,1)>0 && bitRate > (nChannels * 16000))) {
     blockSwitchingControl->invAttackRatio = invAttackRatioHighBr;
   }
@@ -116,7 +116,7 @@
 
   /* Reset grouping info */
   for (i=0; i<TRANS_FAC; i++) {
-    blockSwitchingControl->groupLen[i] = 0;                                      
+    blockSwitchingControl->groupLen[i] = 0;
   }
 
 
@@ -125,21 +125,21 @@
                                                           &blockSwitchingControl->attackIndex,
                                                           BLOCK_SWITCH_WINDOWS);
 
-  blockSwitchingControl->attackIndex = blockSwitchingControl->lastAttackIndex;   
+  blockSwitchingControl->attackIndex = blockSwitchingControl->lastAttackIndex;
 
   /* Set grouping info */
-  blockSwitchingControl->noOfGroups = MAX_NO_OF_GROUPS;                          
+  blockSwitchingControl->noOfGroups = MAX_NO_OF_GROUPS;
 
   for (i=0; i<MAX_NO_OF_GROUPS; i++) {
-    blockSwitchingControl->groupLen[i] = suggestedGroupingTable[blockSwitchingControl->attackIndex][i];  
+    blockSwitchingControl->groupLen[i] = suggestedGroupingTable[blockSwitchingControl->attackIndex][i];
   }
-	
+
   /* if the samplerate is less than 16000, it should be all the short block, avoid pre&post echo */
   if(sampleRate >= 16000) {
 	  /* Save current window energy as last window energy */
 	  for (w=0; w<BLOCK_SWITCH_WINDOWS; w++) {
-		  blockSwitchingControl->windowNrg[0][w] = blockSwitchingControl->windowNrg[1][w];             
-		  blockSwitchingControl->windowNrgF[0][w] = blockSwitchingControl->windowNrgF[1][w];           
+		  blockSwitchingControl->windowNrg[0][w] = blockSwitchingControl->windowNrg[1][w];
+		  blockSwitchingControl->windowNrgF[0][w] = blockSwitchingControl->windowNrgF[1][w];
 	  }
 
 
@@ -147,10 +147,10 @@
 	  CalcWindowEnergy(blockSwitchingControl, timeSignal, chIncrement, BLOCK_SWITCH_WINDOW_LEN);
 
 	  /* reset attack */
-	  blockSwitchingControl->attack = FALSE;                                         
+	  blockSwitchingControl->attack = FALSE;
 
-	  enMax = 0;                                                                     
-	  enM1 = blockSwitchingControl->windowNrgF[0][BLOCK_SWITCH_WINDOWS-1];           
+	  enMax = 0;
+	  enM1 = blockSwitchingControl->windowNrgF[0][BLOCK_SWITCH_WINDOWS-1];
 
 	  for (w=0; w<BLOCK_SWITCH_WINDOWS; w++) {
 		  Word32 enM1_Tmp, accWindowNrg_Tmp, windowNrgF_Tmp;
@@ -172,15 +172,15 @@
 		  /* if the energy with the ratio is bigger than the average, and the attack and short block  */
 		  if ((fixmul(windowNrgF_Tmp, blockSwitchingControl->invAttackRatio) >> windowNrgF_Shf) >
 			  blockSwitchingControl->accWindowNrg ) {
-				  blockSwitchingControl->attack = TRUE;                                      
-				  blockSwitchingControl->lastAttackIndex = w;                                
+				  blockSwitchingControl->attack = TRUE;
+				  blockSwitchingControl->lastAttackIndex = w;
 		  }
-		  enM1 = blockSwitchingControl->windowNrgF[1][w];                              
+		  enM1 = blockSwitchingControl->windowNrgF[1][w];
 		  enMax = max(enMax, enM1);
 	  }
 
 	  if (enMax < minAttackNrg) {
-		  blockSwitchingControl->attack = FALSE;                                       
+		  blockSwitchingControl->attack = FALSE;
 	  }
   }
   else
@@ -188,22 +188,22 @@
 	  blockSwitchingControl->attack = TRUE;
   }
 
-  /* Check if attack spreads over frame border */     
+  /* Check if attack spreads over frame border */
   if ((!blockSwitchingControl->attack) && (blockSwitchingControl->lastattack)) {
-     
+
     if (blockSwitchingControl->attackIndex == TRANS_FAC-1) {
-      blockSwitchingControl->attack = TRUE;                                      
+      blockSwitchingControl->attack = TRUE;
     }
 
-    blockSwitchingControl->lastattack = FALSE;                                   
+    blockSwitchingControl->lastattack = FALSE;
   }
   else {
-    blockSwitchingControl->lastattack = blockSwitchingControl->attack;           
+    blockSwitchingControl->lastattack = blockSwitchingControl->attack;
   }
 
-  blockSwitchingControl->windowSequence =  blockSwitchingControl->nextwindowSequence;    
+  blockSwitchingControl->windowSequence =  blockSwitchingControl->nextwindowSequence;
 
-     
+
   if (blockSwitchingControl->attack) {
     blockSwitchingControl->nextwindowSequence = SHORT_WINDOW;
   }
@@ -211,27 +211,27 @@
     blockSwitchingControl->nextwindowSequence = LONG_WINDOW;
   }
 
-  /* update short block group */ 
+  /* update short block group */
   if (blockSwitchingControl->nextwindowSequence == SHORT_WINDOW) {
-     
+
     if (blockSwitchingControl->windowSequence== LONG_WINDOW) {
-      blockSwitchingControl->windowSequence = START_WINDOW;                      
+      blockSwitchingControl->windowSequence = START_WINDOW;
     }
-     
+
     if (blockSwitchingControl->windowSequence == STOP_WINDOW) {
-      blockSwitchingControl->windowSequence = SHORT_WINDOW;                      
-      blockSwitchingControl->noOfGroups = 3;                                     
-      blockSwitchingControl->groupLen[0] = 3;                                    
-      blockSwitchingControl->groupLen[1] = 3;                                    
-      blockSwitchingControl->groupLen[2] = 2;                                    
+      blockSwitchingControl->windowSequence = SHORT_WINDOW;
+      blockSwitchingControl->noOfGroups = 3;
+      blockSwitchingControl->groupLen[0] = 3;
+      blockSwitchingControl->groupLen[1] = 3;
+      blockSwitchingControl->groupLen[2] = 2;
     }
   }
 
-  /* update block type */  
+  /* update block type */
   if (blockSwitchingControl->nextwindowSequence == LONG_WINDOW) {
-     
+
     if (blockSwitchingControl->windowSequence == SHORT_WINDOW) {
-      blockSwitchingControl->nextwindowSequence = STOP_WINDOW;                   
+      blockSwitchingControl->nextwindowSequence = STOP_WINDOW;
     }
   }
 
@@ -252,17 +252,17 @@
   Word32 i, idx;
 
   /* Search maximum value in array and return index and value */
-  max = 0;                                                       
-  idx = 0;                                                       
+  max = 0;
+  idx = 0;
 
   for (i = 0; i < n; i++) {
-     
+
     if (in[i+1]  > max) {
-      max = in[i+1];                                             
-      idx = i;                                                   
+      max = in[i+1];
+      idx = i;
     }
   }
-  *index = idx;                                                  
+  *index = idx;
 
   return(max);
 }
@@ -292,11 +292,11 @@
   states1 = blockSwitchingControl->iirStates[1];
   Coeff0 = hiPassCoeff[0];
   Coeff1 = hiPassCoeff[1];
-  tidx = 0;                                                   
+  tidx = 0;
   for (w=0; w < BLOCK_SWITCH_WINDOWS; w++) {
 
-    accuUE = 0;                                                  
-    accuFE = 0;                                                  
+    accuUE = 0;
+    accuFE = 0;
 
     for(i=0; i<windowLen; i++) {
 	  Word32 accu1, accu2, accu3;
@@ -309,16 +309,16 @@
 	  accu3 = accu1 - states0;
 	  out = accu3 - accu2;
 
-	  states0 = accu1;             
-	  states1 = out;               
+	  states0 = accu1;
+	  states1 = out;
 
-      tempFiltered = extract_h(out);	  
+      tempFiltered = extract_h(out);
       accuUE += (tempUnfiltered * tempUnfiltered) >> ENERGY_SHIFT;
       accuFE += (tempFiltered * tempFiltered) >> ENERGY_SHIFT;
     }
 
-    blockSwitchingControl->windowNrg[1][w] = accuUE;             
-    blockSwitchingControl->windowNrgF[1][w] = accuFE;            
+    blockSwitchingControl->windowNrg[1][w] = accuUE;
+    blockSwitchingControl->windowNrgF[1][w] = accuFE;
 
   }
 
@@ -346,8 +346,8 @@
   accu2 = fixmul( coeff[0], states[1] );
   out = accu3 - accu2;
 
-  states[0] = accu1;             
-  states[1] = out;               
+  states[0] = accu1;
+  states[1] = out;
 
   return round16(out);
 }
@@ -374,54 +374,54 @@
                           const Word16 nChannels)
 {
   Word16 i;
-  Word16 patchType = LONG_WINDOW;                
+  Word16 patchType = LONG_WINDOW;
 
-   
+
   if (nChannels == 1) { /* Mono */
     if (blockSwitchingControlLeft->windowSequence != SHORT_WINDOW) {
-      blockSwitchingControlLeft->noOfGroups = 1;                         
-      blockSwitchingControlLeft->groupLen[0] = 1;                        
+      blockSwitchingControlLeft->noOfGroups = 1;
+      blockSwitchingControlLeft->groupLen[0] = 1;
 
       for (i=1; i<TRANS_FAC; i++) {
-        blockSwitchingControlLeft->groupLen[i] = 0;                      
+        blockSwitchingControlLeft->groupLen[i] = 0;
       }
     }
   }
   else { /* Stereo common Window */
-    patchType = synchronizedBlockTypeTable[patchType][blockSwitchingControlLeft->windowSequence];        
-    patchType = synchronizedBlockTypeTable[patchType][blockSwitchingControlRight->windowSequence];       
+    patchType = synchronizedBlockTypeTable[patchType][blockSwitchingControlLeft->windowSequence];
+    patchType = synchronizedBlockTypeTable[patchType][blockSwitchingControlRight->windowSequence];
 
     /* Set synchronized Blocktype */
-    blockSwitchingControlLeft->windowSequence = patchType;               
-    blockSwitchingControlRight->windowSequence = patchType;              
+    blockSwitchingControlLeft->windowSequence = patchType;
+    blockSwitchingControlRight->windowSequence = patchType;
 
-    /* Synchronize grouping info */     
+    /* Synchronize grouping info */
     if(patchType != SHORT_WINDOW) { /* Long Blocks */
       /* Set grouping info */
-      blockSwitchingControlLeft->noOfGroups = 1;                         
-      blockSwitchingControlRight->noOfGroups = 1;                        
-      blockSwitchingControlLeft->groupLen[0] = 1;                        
-      blockSwitchingControlRight->groupLen[0] = 1;                       
+      blockSwitchingControlLeft->noOfGroups = 1;
+      blockSwitchingControlRight->noOfGroups = 1;
+      blockSwitchingControlLeft->groupLen[0] = 1;
+      blockSwitchingControlRight->groupLen[0] = 1;
 
       for (i=1; i<TRANS_FAC; i++) {
-        blockSwitchingControlLeft->groupLen[i] = 0;                      
-        blockSwitchingControlRight->groupLen[i] = 0;                     
+        blockSwitchingControlLeft->groupLen[i] = 0;
+        blockSwitchingControlRight->groupLen[i] = 0;
       }
     }
     else {
-       
+
       if (blockSwitchingControlLeft->maxWindowNrg > blockSwitchingControlRight->maxWindowNrg) {
         /* Left Channel wins */
-        blockSwitchingControlRight->noOfGroups = blockSwitchingControlLeft->noOfGroups;          
+        blockSwitchingControlRight->noOfGroups = blockSwitchingControlLeft->noOfGroups;
         for (i=0; i<TRANS_FAC; i++) {
-          blockSwitchingControlRight->groupLen[i] = blockSwitchingControlLeft->groupLen[i];      
+          blockSwitchingControlRight->groupLen[i] = blockSwitchingControlLeft->groupLen[i];
         }
       }
       else {
         /* Right Channel wins */
-        blockSwitchingControlLeft->noOfGroups = blockSwitchingControlRight->noOfGroups;          
+        blockSwitchingControlLeft->noOfGroups = blockSwitchingControlRight->noOfGroups;
         for (i=0; i<TRANS_FAC; i++) {
-          blockSwitchingControlLeft->groupLen[i] = blockSwitchingControlRight->groupLen[i];      
+          blockSwitchingControlLeft->groupLen[i] = blockSwitchingControlRight->groupLen[i];
         }
       }
     }
diff --git a/media/libstagefright/codecs/aacenc/src/channel_map.c b/media/libstagefright/codecs/aacenc/src/channel_map.c
index 2d41f8c..f6552ed 100644
--- a/media/libstagefright/codecs/aacenc/src/channel_map.c
+++ b/media/libstagefright/codecs/aacenc/src/channel_map.c
@@ -29,32 +29,32 @@
 
 static Word16 initElement(ELEMENT_INFO* elInfo, ELEMENT_TYPE elType)
 {
-  Word16 error=0;                                    
+  Word16 error=0;
 
-  elInfo->elType=elType;                             
+  elInfo->elType=elType;
 
   switch(elInfo->elType) {
 
     case ID_SCE:
-      elInfo->nChannelsInEl=1;                       
+      elInfo->nChannelsInEl=1;
 
-      elInfo->ChannelIndex[0]=0;                     
+      elInfo->ChannelIndex[0]=0;
 
-      elInfo->instanceTag=0;                         
+      elInfo->instanceTag=0;
       break;
 
     case ID_CPE:
 
-      elInfo->nChannelsInEl=2;                        
+      elInfo->nChannelsInEl=2;
 
-      elInfo->ChannelIndex[0]=0;                      
-      elInfo->ChannelIndex[1]=1;                      
+      elInfo->ChannelIndex[0]=0;
+      elInfo->ChannelIndex[1]=1;
 
-      elInfo->instanceTag=0;                    
+      elInfo->instanceTag=0;
       break;
 
     default:
-      error=1;                                  
+      error=1;
   }
 
   return error;
@@ -64,11 +64,11 @@
 Word16 InitElementInfo (Word16 nChannels, ELEMENT_INFO* elInfo)
 {
   Word16 error;
-  error = 0;                                        
+  error = 0;
 
   switch(nChannels) {
 
-    case 1: 
+    case 1:
       initElement(elInfo, ID_SCE);
       break;
 
@@ -77,7 +77,7 @@
       break;
 
     default:
-      error=4;                                         
+      error=4;
   }
 
   return error;
@@ -91,18 +91,18 @@
                        Word16 staticBitsTot)
 {
   Word16 error;
-  error = 0;                                    
+  error = 0;
 
    switch(elInfo.nChannelsInEl) {
     case 1:
-      elementBits->chBitrate = bitrateTot;                     
+      elementBits->chBitrate = bitrateTot;
       elementBits->averageBits = averageBitsTot - staticBitsTot;
-      elementBits->maxBits = maxChannelBits;                   
+      elementBits->maxBits = maxChannelBits;
 
       elementBits->maxBitResBits = maxChannelBits - averageBitsTot;
-      elementBits->maxBitResBits = elementBits->maxBitResBits - (elementBits->maxBitResBits & 7); 
-      elementBits->bitResLevel = elementBits->maxBitResBits;   
-      elementBits->relativeBits  = 0x4000; /* 1.0f/2 */        
+      elementBits->maxBitResBits = elementBits->maxBitResBits - (elementBits->maxBitResBits & 7);
+      elementBits->bitResLevel = elementBits->maxBitResBits;
+      elementBits->relativeBits  = 0x4000; /* 1.0f/2 */
       break;
 
     case 2:
@@ -111,13 +111,13 @@
       elementBits->maxBits     = maxChannelBits << 1;
 
       elementBits->maxBitResBits = (maxChannelBits << 1) - averageBitsTot;
-      elementBits->maxBitResBits = elementBits->maxBitResBits - (elementBits->maxBitResBits & 7);   
-      elementBits->bitResLevel = elementBits->maxBitResBits;     
-      elementBits->relativeBits = 0x4000; /* 1.0f/2 */           
+      elementBits->maxBitResBits = elementBits->maxBitResBits - (elementBits->maxBitResBits & 7);
+      elementBits->bitResLevel = elementBits->maxBitResBits;
+      elementBits->relativeBits = 0x4000; /* 1.0f/2 */
       break;
 
     default:
-      error = 1;                                                 
+      error = 1;
   }
   return error;
 }
diff --git a/media/libstagefright/codecs/aacenc/src/dyn_bits.c b/media/libstagefright/codecs/aacenc/src/dyn_bits.c
index f3b3e02..7769188 100644
--- a/media/libstagefright/codecs/aacenc/src/dyn_bits.c
+++ b/media/libstagefright/codecs/aacenc/src/dyn_bits.c
@@ -45,12 +45,12 @@
   for (i=0; i<maxSfb; i++) {
     Word16 sfbWidth, maxVal;
 
-    sectionInfo[i].sfbCnt = 1;                                   
-    sectionInfo[i].sfbStart = i;                                 
-    sectionInfo[i].sectionBits = INVALID_BITCOUNT;               
-    sectionInfo[i].codeBook = -1;                                
-    sfbWidth = sfbOffset[i + 1] - sfbOffset[i];              
-    maxVal = sfbMax[i];                                          
+    sectionInfo[i].sfbCnt = 1;
+    sectionInfo[i].sfbStart = i;
+    sectionInfo[i].sectionBits = INVALID_BITCOUNT;
+    sectionInfo[i].codeBook = -1;
+    sfbWidth = sfbOffset[i + 1] - sfbOffset[i];
+    maxVal = sfbMax[i];
     bitCount(quantSpectrum + sfbOffset[i], sfbWidth, maxVal, bitLookUp[i]);
   }
 }
@@ -66,13 +66,13 @@
 findBestBook(const Word16 *bc, Word16 *book)
 {
   Word32 minBits, j;
-  minBits = INVALID_BITCOUNT;                                    
+  minBits = INVALID_BITCOUNT;
 
   for (j=0; j<=CODE_BOOK_ESC_NDX; j++) {
-     
+
     if (bc[j] < minBits) {
-      minBits = bc[j];                                           
-      *book = j;                                                 
+      minBits = bc[j];
+      *book = j;
     }
   }
   return extract_l(minBits);
@@ -82,12 +82,12 @@
 findMinMergeBits(const Word16 *bc1, const Word16 *bc2)
 {
   Word32 minBits, j, sum;
-  minBits = INVALID_BITCOUNT;                                    
+  minBits = INVALID_BITCOUNT;
 
   for (j=0; j<=CODE_BOOK_ESC_NDX; j++) {
     sum = bc1[j] + bc2[j];
     if (sum < minBits) {
-      minBits = sum;                                             
+      minBits = sum;
     }
   }
   return extract_l(minBits);
@@ -109,13 +109,13 @@
              const Word16 maxSfb, Word16 *maxNdx)
 {
   Word32 i, maxMergeGain;
-  maxMergeGain = 0;                                              
+  maxMergeGain = 0;
 
   for (i=0; i+sectionInfo[i].sfbCnt < maxSfb; i += sectionInfo[i].sfbCnt) {
-     
+
     if (mergeGainLookUp[i] > maxMergeGain) {
-      maxMergeGain = mergeGainLookUp[i];                         
-      *maxNdx = i;                                               
+      maxMergeGain = mergeGainLookUp[i];
+      *maxNdx = i;
     }
   }
   return extract_l(maxMergeGain);
@@ -159,7 +159,7 @@
 
   for (i=0; i<maxSfb; i++) {
     /* Side-Info bits will be calculated in Stage 1!  */
-     
+
     if (sectionInfo[i].sectionBits == INVALID_BITCOUNT) {
       sectionInfo[i].sectionBits = findBestBook(bitLookUp[i], &(sectionInfo[i].codeBook));
     }
@@ -180,13 +180,13 @@
   SECTION_INFO * sectionInfo_s;
   SECTION_INFO * sectionInfo_e;
   Word32 mergeStart, mergeEnd;
-  mergeStart = 0;                                                        
+  mergeStart = 0;
 
   do {
 
     sectionInfo_s = sectionInfo + mergeStart;
 	for (mergeEnd=mergeStart+1; mergeEnd<maxSfb; mergeEnd++) {
-      sectionInfo_e = sectionInfo + mergeEnd; 
+      sectionInfo_e = sectionInfo + mergeEnd;
       if (sectionInfo_s->codeBook != sectionInfo_e->codeBook)
         break;
       sectionInfo_s->sfbCnt += 1;
@@ -196,11 +196,11 @@
     }
 
     sectionInfo_s->sectionBits += sideInfoTab[sectionInfo_s->sfbCnt];
-    sectionInfo[mergeEnd - 1].sfbStart = sectionInfo_s->sfbStart;      /* speed up prev search */  
+    sectionInfo[mergeEnd - 1].sfbStart = sectionInfo_s->sfbStart;      /* speed up prev search */
 
-    mergeStart = mergeEnd;                                               
+    mergeStart = mergeEnd;
 
-     
+
   } while (mergeStart - maxSfb < 0);
 }
 
@@ -230,7 +230,7 @@
 
     maxMergeGain = findMaxMerge(mergeGainLookUp, sectionInfo, maxSfb, &maxNdx);
 
-     
+
     if (maxMergeGain <= 0)
       break;
 
@@ -244,7 +244,7 @@
 
     mergeBitLookUp(bitLookUp[maxNdx], bitLookUp[maxNdxNext]);
 
-     
+
     if (maxNdx != 0) {
       maxNdxLast = sectionInfo[maxNdx - 1].sfbStart;
       mergeGainLookUp[maxNdxLast] = CalcMergeGain(sectionInfo,
@@ -255,9 +255,9 @@
     }
     maxNdxNext = maxNdx + sectionInfo[maxNdx].sfbCnt;
 
-    sectionInfo[maxNdxNext - 1].sfbStart = sectionInfo[maxNdx].sfbStart;             
+    sectionInfo[maxNdxNext - 1].sfbStart = sectionInfo[maxNdx].sfbStart;
 
-     
+
     if (maxNdxNext - maxSfb < 0) {
       mergeGainLookUp[maxNdx] = CalcMergeGain(sectionInfo,
                                               bitLookUp,
@@ -281,12 +281,12 @@
                  const Word32 blockType)
 {
   Word32 grpNdx, i;
-  Word16 *sideInfoTab = NULL;
+  const Word16 *sideInfoTab = NULL;
   SECTION_INFO *sectionInfo;
 
   /*
     use appropriate side info table
-  */   
+  */
   switch (blockType)
   {
     case LONG_WINDOW:
@@ -300,11 +300,11 @@
   }
 
 
-  sectionData->noOfSections = 0;                                         
-  sectionData->huffmanBits = 0;                                          
-  sectionData->sideInfoBits = 0;                                         
+  sectionData->noOfSections = 0;
+  sectionData->huffmanBits = 0;
+  sectionData->sideInfoBits = 0;
 
-   
+
   if (sectionData->maxSfbPerGroup == 0)
     return;
 
@@ -353,7 +353,7 @@
       sectionData->huffmanBits = (sectionData->huffmanBits +
                                      (sectionInfo[i].sectionBits - sideInfoTab[sectionInfo[i].sfbCnt]));
       sectionData->sideInfoBits = (sectionData->sideInfoBits + sideInfoTab[sectionInfo[i].sfbCnt]);
-      sectionData->sectionInfo[sectionData->noOfSections] = sectionInfo[i];             
+      sectionData->sectionInfo[sectionData->noOfSections] = sectionInfo[i];
       sectionData->noOfSections = sectionData->noOfSections + 1;
     }
   }
@@ -386,25 +386,25 @@
   Word32 lastValScf     = 0;
   Word32 deltaScf       = 0;
   Flag found            = 0;
-  Word32 scfSkipCounter = 0;           
-         
+  Word32 scfSkipCounter = 0;
 
-  sectionData->scalefacBits = 0;                                 
 
-   
+  sectionData->scalefacBits = 0;
+
+
   if (scalefacGain == NULL) {
     return;
   }
 
-  lastValScf = 0;                                                
-  sectionData->firstScf = 0;        
-  
+  lastValScf = 0;
+  sectionData->firstScf = 0;
+
   psectionInfo = sectionData->sectionInfo;
   for (i=0; i<sectionData->noOfSections; i++) {
-     
+
     if (psectionInfo->codeBook != CODE_BOOK_ZERO_NO) {
-      sectionData->firstScf = psectionInfo->sfbStart;      
-      lastValScf = scalefacGain[sectionData->firstScf];                  
+      sectionData->firstScf = psectionInfo->sfbStart;
+      lastValScf = scalefacGain[sectionData->firstScf];
       break;
     }
 	psectionInfo += 1;
@@ -412,38 +412,38 @@
 
   psectionInfo = sectionData->sectionInfo;
   for (i=0; i<sectionData->noOfSections; i++, psectionInfo += 1) {
-       
+
     if (psectionInfo->codeBook != CODE_BOOK_ZERO_NO
         && psectionInfo->codeBook != CODE_BOOK_PNS_NO) {
       for (j = psectionInfo->sfbStart;
            j < (psectionInfo->sfbStart + psectionInfo->sfbCnt); j++) {
         /* check if we can repeat the last value to save bits */
-         
+
         if (maxValueInSfb[j] == 0) {
-          found = 0;                                                     
-           
+          found = 0;
+
           if (scfSkipCounter == 0) {
             /* end of section */
-             
+
             if (j - ((psectionInfo->sfbStart + psectionInfo->sfbCnt) - 1) == 0) {
-              found = 0;                                                 
+              found = 0;
             }
             else {
               for (k = j + 1; k < psectionInfo->sfbStart + psectionInfo->sfbCnt; k++) {
-                 
+
                 if (maxValueInSfb[k] != 0) {
                   int tmp = L_abs(scalefacGain[k] - lastValScf);
-				  found = 1;                                             
-                   
+				  found = 1;
+
                   if ( tmp < CODE_BOOK_SCF_LAV) {
                     /* save bits */
-                    deltaScf = 0;                                        
+                    deltaScf = 0;
                   }
                   else {
                     /* do not save bits */
                     deltaScf = lastValScf - scalefacGain[j];
-                    lastValScf = scalefacGain[j];                        
-                    scfSkipCounter = 0;                                  
+                    lastValScf = scalefacGain[j];
+                    scfSkipCounter = 0;
                   }
                   break;
                 }
@@ -451,26 +451,26 @@
                 scfSkipCounter = scfSkipCounter + 1;
               }
             }
-			
+
 			psectionInfom = psectionInfo + 1;
             /* search for the next maxValueInSfb[] != 0 in all other sections */
             for (m = i + 1; (m < sectionData->noOfSections) && (found == 0); m++) {
-                 
+
               if ((psectionInfom->codeBook != CODE_BOOK_ZERO_NO) &&
                   (psectionInfom->codeBook != CODE_BOOK_PNS_NO)) {
                 for (n = psectionInfom->sfbStart;
                      n < (psectionInfom->sfbStart + psectionInfom->sfbCnt); n++) {
-                   
+
                   if (maxValueInSfb[n] != 0) {
-                    found = 1;                                           
-                     
+                    found = 1;
+
                     if ( (abs_s(scalefacGain[n] - lastValScf) < CODE_BOOK_SCF_LAV)) {
-                      deltaScf = 0;                                      
+                      deltaScf = 0;
                     }
                     else {
                       deltaScf = (lastValScf - scalefacGain[j]);
-                      lastValScf = scalefacGain[j];                      
-                      scfSkipCounter = 0;                                
+                      lastValScf = scalefacGain[j];
+                      scfSkipCounter = 0;
                     }
                     break;
                   }
@@ -481,20 +481,20 @@
 
 			  psectionInfom += 1;
             }
-             
+
             if (found == 0) {
-              deltaScf = 0;                                              
-              scfSkipCounter = 0;                                        
+              deltaScf = 0;
+              scfSkipCounter = 0;
             }
           }
           else {
-            deltaScf = 0;                                                
+            deltaScf = 0;
             scfSkipCounter = scfSkipCounter - 1;
           }
         }
         else {
           deltaScf = lastValScf - scalefacGain[j];
-          lastValScf = scalefacGain[j];                                  
+          lastValScf = scalefacGain[j];
         }
         sectionData->scalefacBits += bitCountScalefactorDelta(deltaScf);
       }
@@ -517,14 +517,14 @@
             const Word16  *sfbOffset,
             SECTION_DATA  *sectionData)
 {
-  sectionData->blockType      = blockType;                       
-  sectionData->sfbCnt         = sfbCnt;                          
-  sectionData->sfbPerGroup    = sfbPerGroup;           
+  sectionData->blockType      = blockType;
+  sectionData->sfbCnt         = sfbCnt;
+  sectionData->sfbPerGroup    = sfbPerGroup;
   if(sfbPerGroup)
-	sectionData->noOfGroups   = sfbCnt/sfbPerGroup; 
+	sectionData->noOfGroups   = sfbCnt/sfbPerGroup;
   else
 	sectionData->noOfGroups   = 0x7fff;
-  sectionData->maxSfbPerGroup = maxSfbPerGroup;                  
+  sectionData->maxSfbPerGroup = maxSfbPerGroup;
 
   noiselessCounter(sectionData,
                    sectionData->mergeGainLookUp,
@@ -539,7 +539,7 @@
            sectionData);
 
 
-  return (sectionData->huffmanBits + sectionData->sideInfoBits + 
+  return (sectionData->huffmanBits + sectionData->sideInfoBits +
 	      sectionData->scalefacBits);
 }
 
diff --git a/media/libstagefright/codecs/aacenc/src/grp_data.c b/media/libstagefright/codecs/aacenc/src/grp_data.c
index fb88654..7861e1c 100644
--- a/media/libstagefright/codecs/aacenc/src/grp_data.c
+++ b/media/libstagefright/codecs/aacenc/src/grp_data.c
@@ -57,29 +57,29 @@
 
   /* for short: regroup and  */
   /* cumulate energies und thresholds group-wise . */
-  
+
   /* calculate sfbCnt */
-  highestSfb = 0;                                        
+  highestSfb = 0;
   for (wnd=0; wnd<TRANS_FAC; wnd++) {
     for (sfb=sfbCnt - 1; sfb>=highestSfb; sfb--) {
       for (line=(sfbOffset[sfb + 1] - 1); line>=sfbOffset[sfb]; line--) {
-        
-        if (mdctSpectrum[wnd*FRAME_LEN_SHORT+line] != 0) break; 
+
+        if (mdctSpectrum[wnd*FRAME_LEN_SHORT+line] != 0) break;
       }
-      
+
       if (line >= sfbOffset[sfb]) break;
     }
     highestSfb = max(highestSfb, sfb);
   }
-  
+
   if (highestSfb < 0) {
-    highestSfb = 0;                                      
+    highestSfb = 0;
   }
   *maxSfbPerGroup = highestSfb + 1;
 
   /* calculate sfbOffset */
-  i = 0;                                                 
-  offset = 0;                                            
+  i = 0;
+  offset = 0;
   for (grp = 0; grp < noOfGroups; grp++) {
     for (sfb = 0; sfb < sfbCnt; sfb++) {
       groupedSfbOffset[i] = offset + sfbOffset[sfb] * groupLen[grp];
@@ -87,15 +87,15 @@
     }
     offset += groupLen[grp] * FRAME_LEN_SHORT;
   }
-  groupedSfbOffset[i] = FRAME_LEN_LONG;                  
+  groupedSfbOffset[i] = FRAME_LEN_LONG;
   i += 1;
 
   /* calculate minSnr */
-  i = 0;                                                 
-  offset = 0;                                            
+  i = 0;
+  offset = 0;
   for (grp = 0; grp < noOfGroups; grp++) {
     for (sfb = 0; sfb < sfbCnt; sfb++) {
-      groupedSfbMinSnr[i] = sfbMinSnr[sfb];              
+      groupedSfbMinSnr[i] = sfbMinSnr[sfb];
       i += 1;
     }
     offset += groupLen[grp] * FRAME_LEN_SHORT;
@@ -103,74 +103,74 @@
 
 
   /* sum up sfbThresholds */
-  wnd = 0;                                                       
-  i = 0;                                                         
+  wnd = 0;
+  i = 0;
   for (grp = 0; grp < noOfGroups; grp++) {
     for (sfb = 0; sfb < sfbCnt; sfb++) {
-      Word32 thresh = sfbThreshold->sfbShort[wnd][sfb];          
+      Word32 thresh = sfbThreshold->sfbShort[wnd][sfb];
       for (j=1; j<groupLen[grp]; j++) {
         thresh = L_add(thresh, sfbThreshold->sfbShort[wnd+j][sfb]);
       }
-      sfbThreshold->sfbLong[i] = thresh;                         
+      sfbThreshold->sfbLong[i] = thresh;
       i += 1;
     }
     wnd += groupLen[grp];
   }
 
   /* sum up sfbEnergies left/right */
-  wnd = 0;                                                       
-  i = 0;                                                         
+  wnd = 0;
+  i = 0;
   for (grp = 0; grp < noOfGroups; grp++) {
     for (sfb = 0; sfb < sfbCnt; sfb++) {
-      Word32 energy = sfbEnergy->sfbShort[wnd][sfb];             
+      Word32 energy = sfbEnergy->sfbShort[wnd][sfb];
       for (j=1; j<groupLen[grp]; j++) {
         energy = L_add(energy, sfbEnergy->sfbShort[wnd+j][sfb]);
       }
-      sfbEnergy->sfbLong[i] = energy;                            
+      sfbEnergy->sfbLong[i] = energy;
       i += 1;
     }
     wnd += groupLen[grp];
   }
 
   /* sum up sfbEnergies mid/side */
-  wnd = 0;                                                       
-  i = 0;                                                         
+  wnd = 0;
+  i = 0;
   for (grp = 0; grp < noOfGroups; grp++) {
     for (sfb = 0; sfb < sfbCnt; sfb++) {
-      Word32 energy = sfbEnergyMS->sfbShort[wnd][sfb];           
+      Word32 energy = sfbEnergyMS->sfbShort[wnd][sfb];
       for (j=1; j<groupLen[grp]; j++) {
         energy = L_add(energy, sfbEnergyMS->sfbShort[wnd+j][sfb]);
       }
-      sfbEnergyMS->sfbLong[i] = energy;                          
+      sfbEnergyMS->sfbLong[i] = energy;
       i += 1;
     }
     wnd += groupLen[grp];
   }
 
   /* sum up sfbSpreadedEnergies */
-  wnd = 0;                                                       
-  i = 0;                                                         
+  wnd = 0;
+  i = 0;
   for (grp = 0; grp < noOfGroups; grp++) {
     for (sfb = 0; sfb < sfbCnt; sfb++) {
-      Word32 energy = sfbSpreadedEnergy->sfbShort[wnd][sfb];     
+      Word32 energy = sfbSpreadedEnergy->sfbShort[wnd][sfb];
       for (j=1; j<groupLen[grp]; j++) {
         energy = L_add(energy, sfbSpreadedEnergy->sfbShort[wnd+j][sfb]);
       }
-      sfbSpreadedEnergy->sfbLong[i] = energy;                    
+      sfbSpreadedEnergy->sfbLong[i] = energy;
       i += 1;
     }
     wnd += groupLen[grp];
   }
 
   /* re-group spectrum */
-  wnd = 0;                                                       
-  i = 0;                                                         
+  wnd = 0;
+  i = 0;
   for (grp = 0; grp < noOfGroups; grp++) {
     for (sfb = 0; sfb < sfbCnt; sfb++) {
       for (j = 0; j < groupLen[grp]; j++) {
         Word16 lineOffset = FRAME_LEN_SHORT * (wnd + j);
         for (line = lineOffset + sfbOffset[sfb]; line < lineOffset + sfbOffset[sfb+1]; line++) {
-          tmpSpectrum[i] = mdctSpectrum[line];                   
+          tmpSpectrum[i] = mdctSpectrum[line];
           i = i + 1;
         }
       }
@@ -179,10 +179,10 @@
   }
 
   for(i=0;i<FRAME_LEN_LONG;i+=4) {
-    mdctSpectrum[i] = tmpSpectrum[i];  
-	mdctSpectrum[i+1] = tmpSpectrum[i+1];  
-	mdctSpectrum[i+2] = tmpSpectrum[i+2];  
-	mdctSpectrum[i+3] = tmpSpectrum[i+3];  	
+    mdctSpectrum[i] = tmpSpectrum[i];
+	mdctSpectrum[i+1] = tmpSpectrum[i+1];
+	mdctSpectrum[i+2] = tmpSpectrum[i+2];
+	mdctSpectrum[i+3] = tmpSpectrum[i+3];
   }
 }
 
diff --git a/media/libstagefright/codecs/aacenc/src/interface.c b/media/libstagefright/codecs/aacenc/src/interface.c
index 34fee00..d0ad433 100644
--- a/media/libstagefright/codecs/aacenc/src/interface.c
+++ b/media/libstagefright/codecs/aacenc/src/interface.c
@@ -49,64 +49,64 @@
                     PSY_OUT_CHANNEL         *psyOutCh)
 {
   Word32 j;
-  Word32 grp; 
+  Word32 grp;
   Word32 mask;
   Word16 *tmpV;
 
   /*
   copy values to psyOut
   */
-  psyOutCh->maxSfbPerGroup    = maxSfbPerGroup;                             
-  psyOutCh->sfbCnt            = groupedSfbCnt;   
+  psyOutCh->maxSfbPerGroup    = maxSfbPerGroup;
+  psyOutCh->sfbCnt            = groupedSfbCnt;
   if(noOfGroups)
 	psyOutCh->sfbPerGroup     = groupedSfbCnt/ noOfGroups;
   else
 	psyOutCh->sfbPerGroup     = 0x7fff;
-  psyOutCh->windowSequence    = windowSequence;                             
-  psyOutCh->windowShape       = windowShape;                                
-  psyOutCh->mdctScale         = mdctScale;                                  
+  psyOutCh->windowSequence    = windowSequence;
+  psyOutCh->windowShape       = windowShape;
+  psyOutCh->mdctScale         = mdctScale;
   psyOutCh->mdctSpectrum      = groupedMdctSpectrum;
   psyOutCh->sfbEnergy         = groupedSfbEnergy->sfbLong;
   psyOutCh->sfbThreshold      = groupedSfbThreshold->sfbLong;
   psyOutCh->sfbSpreadedEnergy = groupedSfbSpreadedEnergy->sfbLong;
-  
+
   tmpV = psyOutCh->sfbOffsets;
   for(j=0; j<groupedSfbCnt + 1; j++) {
       *tmpV++ = groupedSfbOffset[j];
   }
-  
+
   tmpV = psyOutCh->sfbMinSnr;
   for(j=0;j<groupedSfbCnt; j++) {
 	  *tmpV++ =   groupedSfbMinSnr[j];
   }
-  
+
   /* generate grouping mask */
-  mask = 0;                                                                      
+  mask = 0;
   for (grp = 0; grp < noOfGroups; grp++) {
     mask = mask << 1;
     for (j=1; j<groupLen[grp]; j++) {
       mask = mask << 1;
-      mask |= 1;                                                                 
+      mask |= 1;
     }
   }
-  psyOutCh->groupingMask = mask; 
-  
+  psyOutCh->groupingMask = mask;
+
   if (windowSequence != SHORT_WINDOW) {
-    psyOutCh->sfbEnSumLR =  sfbEnergySumLR.sfbLong;                              
-    psyOutCh->sfbEnSumMS =  sfbEnergySumMS.sfbLong;                              
+    psyOutCh->sfbEnSumLR =  sfbEnergySumLR.sfbLong;
+    psyOutCh->sfbEnSumMS =  sfbEnergySumMS.sfbLong;
   }
   else {
     Word32 i;
     Word32 accuSumMS=0;
-    Word32 accuSumLR=0;        
-	Word32 *pSumMS = sfbEnergySumMS.sfbShort;
-	Word32 *pSumLR = sfbEnergySumLR.sfbShort;
+    Word32 accuSumLR=0;
+    const Word32 *pSumMS = sfbEnergySumMS.sfbShort;
+    const Word32 *pSumLR = sfbEnergySumLR.sfbShort;
 
     for (i=TRANS_FAC; i; i--) {
       accuSumLR = L_add(accuSumLR, *pSumLR); pSumLR++;
       accuSumMS = L_add(accuSumMS, *pSumMS); pSumMS++;
     }
-    psyOutCh->sfbEnSumMS = accuSumMS;                                            
-    psyOutCh->sfbEnSumLR = accuSumLR;                                            
+    psyOutCh->sfbEnSumMS = accuSumMS;
+    psyOutCh->sfbEnSumLR = accuSumLR;
   }
 }
diff --git a/media/libstagefright/codecs/aacenc/src/line_pe.c b/media/libstagefright/codecs/aacenc/src/line_pe.c
index 5e93cd0..480dc28 100644
--- a/media/libstagefright/codecs/aacenc/src/line_pe.c
+++ b/media/libstagefright/codecs/aacenc/src/line_pe.c
@@ -45,20 +45,20 @@
                   const Word16 peOffset)
 {
   Word32 sfbGrp, sfb;
-  Word32 ch;     
+  Word32 ch;
 
   for(ch=0; ch<nChannels; ch++) {
     PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
     PE_CHANNEL_DATA *peChanData=&peData->peChannelData[ch];
     for(sfbGrp=0;sfbGrp<psyOutChan->sfbCnt; sfbGrp+=psyOutChan->sfbPerGroup){
       for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
-	    peChanData->sfbNLines4[sfbGrp+sfb] = sfbNRelevantLines[ch][sfbGrp+sfb];          
-        sfbNRelevantLines[ch][sfbGrp+sfb] = sfbNRelevantLines[ch][sfbGrp+sfb] >> 2;    
-	    peChanData->sfbLdEnergy[sfbGrp+sfb] = logSfbEnergy[ch][sfbGrp+sfb];              
+	    peChanData->sfbNLines4[sfbGrp+sfb] = sfbNRelevantLines[ch][sfbGrp+sfb];
+        sfbNRelevantLines[ch][sfbGrp+sfb] = sfbNRelevantLines[ch][sfbGrp+sfb] >> 2;
+	    peChanData->sfbLdEnergy[sfbGrp+sfb] = logSfbEnergy[ch][sfbGrp+sfb];
       }
     }
   }
-  peData->offset = peOffset;                                                             
+  peData->offset = peOffset;
 }
 
 
@@ -78,23 +78,23 @@
   Word32 ldThr, ldRatio;
   Word32 pe, constPart, nActiveLines;
 
-  peData->pe = peData->offset;                                           
-  peData->constPart = 0;                                                 
-  peData->nActiveLines = 0;                                              
+  peData->pe = peData->offset;
+  peData->constPart = 0;
+  peData->nActiveLines = 0;
   for(ch=0; ch<nChannels; ch++) {
     PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
     PE_CHANNEL_DATA *peChanData = &peData->peChannelData[ch];
     const Word32 *sfbEnergy = psyOutChan->sfbEnergy;
     const Word32 *sfbThreshold = psyOutChan->sfbThreshold;
 
-    pe = 0;                                                  
-    constPart = 0;                                           
-    nActiveLines = 0;                                        
+    pe = 0;
+    constPart = 0;
+    nActiveLines = 0;
 
     for(sfbGrp=0; sfbGrp<psyOutChan->sfbCnt; sfbGrp+=psyOutChan->sfbPerGroup) {
       for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
-        Word32 nrg = sfbEnergy[sfbGrp+sfb];                             
-        Word32 thres = sfbThreshold[sfbGrp+sfb];                           
+        Word32 nrg = sfbEnergy[sfbGrp+sfb];
+        Word32 thres = sfbThreshold[sfbGrp+sfb];
         Word32 sfbLDEn = peChanData->sfbLdEnergy[sfbGrp+sfb];
 
         if (nrg > thres) {
@@ -102,8 +102,8 @@
 
           ldRatio = sfbLDEn - ldThr;
 
-          nLines4 = peChanData->sfbNLines4[sfbGrp+sfb];                    
-           
+          nLines4 = peChanData->sfbNLines4[sfbGrp+sfb];
+
           /* sfbPe = nl*log2(en/thr)*/
 		  if (ldRatio >= C1_I) {
             peChanData->sfbPe[sfbGrp+sfb] = (nLines4*ldRatio + 8) >> 4;
@@ -120,26 +120,26 @@
           peChanData->sfbNActiveLines[sfbGrp+sfb] = nLines4 >> 2;
         }
         else {
-          peChanData->sfbPe[sfbGrp+sfb] = 0;                             
-          peChanData->sfbConstPart[sfbGrp+sfb] = 0;                      
-          peChanData->sfbNActiveLines[sfbGrp+sfb] = 0;                   
+          peChanData->sfbPe[sfbGrp+sfb] = 0;
+          peChanData->sfbConstPart[sfbGrp+sfb] = 0;
+          peChanData->sfbNActiveLines[sfbGrp+sfb] = 0;
         }
         pe = pe + peChanData->sfbPe[sfbGrp+sfb];
         constPart = constPart + peChanData->sfbConstPart[sfbGrp+sfb];
         nActiveLines = nActiveLines + peChanData->sfbNActiveLines[sfbGrp+sfb];
       }
     }
-	
-	peChanData->pe = saturate(pe);                                                  
-    peChanData->constPart = saturate(constPart);                                           
-    peChanData->nActiveLines = saturate(nActiveLines);                                        
 
-    
+	peChanData->pe = saturate(pe);
+    peChanData->constPart = saturate(constPart);
+    peChanData->nActiveLines = saturate(nActiveLines);
+
+
 	pe += peData->pe;
-	peData->pe = saturate(pe); 
+	peData->pe = saturate(pe);
     constPart += peData->constPart;
-	peData->constPart = saturate(constPart); 
+	peData->constPart = saturate(constPart);
     nActiveLines += peData->nActiveLines;
 	peData->nActiveLines = saturate(nActiveLines);
-  } 
+  }
 }
diff --git a/media/libstagefright/codecs/aacenc/src/memalign.c b/media/libstagefright/codecs/aacenc/src/memalign.c
index 44dd4ba..bb266dc 100644
--- a/media/libstagefright/codecs/aacenc/src/memalign.c
+++ b/media/libstagefright/codecs/aacenc/src/memalign.c
@@ -32,7 +32,7 @@
 /*****************************************************************************
 *
 * function name: mem_malloc
-* description:  malloc the alignments memory 
+* description:  malloc the alignments memory
 * returns:      the point of the memory
 *
 **********************************************************************************/
diff --git a/media/libstagefright/codecs/aacenc/src/ms_stereo.c b/media/libstagefright/codecs/aacenc/src/ms_stereo.c
index 44d45cc..2e34f14 100644
--- a/media/libstagefright/codecs/aacenc/src/ms_stereo.c
+++ b/media/libstagefright/codecs/aacenc/src/ms_stereo.c
@@ -30,7 +30,7 @@
 *
 * function name: MsStereoProcessing
 * description:  detect use ms stereo or not
-*				if ((min(thrLn, thrRn)*min(thrLn, thrRn))/(enMn*enSn)) 
+*				if ((min(thrLn, thrRn)*min(thrLn, thrRn))/(enMn*enSn))
 *				>= ((thrLn *thrRn)/(enLn*enRn)) then ms stereo
 *
 **********************************************************************************/
@@ -51,7 +51,7 @@
                         const Word16  maxSfbPerGroup,
                         const Word16 *sfbOffset) {
   Word32 temp;
-  Word32 sfb,sfboffs, j; 
+  Word32 sfb,sfboffs, j;
   Word32 msMaskTrueSomewhere = 0;
   Word32 msMaskFalseSomewhere = 0;
 
@@ -64,12 +64,12 @@
       Word32 thrL, thrR, nrgL, nrgR;
       Word32 idx, shift;
 
-      idx = sfb + sfboffs;                                                                       
+      idx = sfb + sfboffs;
 
-      thrL = sfbThresholdLeft[idx];                                                                 
-      thrR = sfbThresholdRight[idx];                                                                
-      nrgL = sfbEnergyLeft[idx];                                                                    
-      nrgR = sfbEnergyRight[idx];                                                                   
+      thrL = sfbThresholdLeft[idx];
+      thrR = sfbThresholdRight[idx];
+      nrgL = sfbEnergyLeft[idx];
+      nrgR = sfbEnergyRight[idx];
 
       minThreshold = min(thrL, thrR);
 
@@ -82,8 +82,8 @@
 
 	  pnlr = fixmul(nrgL, nrgR);
 
-      nrgL = sfbEnergyMid[idx];                                                                     
-      nrgR = sfbEnergySide[idx];                                                                    
+      nrgL = sfbEnergyMid[idx];
+      nrgR = sfbEnergySide[idx];
 
       nrgL = max(nrgL,minThreshold) + 1;
       shift = norm_l(nrgL);
@@ -97,42 +97,42 @@
 
       temp = (pnlr + 1) / ((pnms >> 8) + 1);
 
-      temp = pnms - pnlr;                                                                     
+      temp = pnms - pnlr;
       if( temp > 0 ){
 
-        msMask[idx] = 1;                                                                            
-        msMaskTrueSomewhere = 1;                                                                    
+        msMask[idx] = 1;
+        msMaskTrueSomewhere = 1;
 
         for (j=sfbOffset[idx]; j<sfbOffset[idx+1]; j++) {
           Word32 left, right;
           left  = (mdctSpectrumLeft[j] >>  1);
           right = (mdctSpectrumRight[j] >> 1);
-          mdctSpectrumLeft[j] =  left + right;                                               
-          mdctSpectrumRight[j] =  left - right;                                              
+          mdctSpectrumLeft[j] =  left + right;
+          mdctSpectrumRight[j] =  left - right;
         }
-        
-        sfbThresholdLeft[idx] = minThreshold;                                                       
-        sfbThresholdRight[idx] = minThreshold;                                                      
-        sfbEnergyLeft[idx] = sfbEnergyMid[idx];                                                     
-        sfbEnergyRight[idx] = sfbEnergySide[idx];                                                   
 
-        sfbSpreadedEnRight[idx] = min(sfbSpreadedEnLeft[idx],sfbSpreadedEnRight[idx]) >> 1;  
-        sfbSpreadedEnLeft[idx] = sfbSpreadedEnRight[idx];                                           
-        
+        sfbThresholdLeft[idx] = minThreshold;
+        sfbThresholdRight[idx] = minThreshold;
+        sfbEnergyLeft[idx] = sfbEnergyMid[idx];
+        sfbEnergyRight[idx] = sfbEnergySide[idx];
+
+        sfbSpreadedEnRight[idx] = min(sfbSpreadedEnLeft[idx],sfbSpreadedEnRight[idx]) >> 1;
+        sfbSpreadedEnLeft[idx] = sfbSpreadedEnRight[idx];
+
       }
       else {
-        msMask[idx]  = 0;                                                                           
-        msMaskFalseSomewhere = 1;                                                                   
+        msMask[idx]  = 0;
+        msMaskFalseSomewhere = 1;
       }
-    }                                                                                               
-    if ( msMaskTrueSomewhere ) {                                                                    
+    }
+    if ( msMaskTrueSomewhere ) {
       if(msMaskFalseSomewhere ) {
-        *msDigest = SI_MS_MASK_SOME;                                                                
+        *msDigest = SI_MS_MASK_SOME;
       } else {
-        *msDigest = SI_MS_MASK_ALL;                                                                 
+        *msDigest = SI_MS_MASK_ALL;
       }
     } else {
-      *msDigest = SI_MS_MASK_NONE;                                                                  
+      *msDigest = SI_MS_MASK_NONE;
     }
   }
 
diff --git a/media/libstagefright/codecs/aacenc/src/pre_echo_control.c b/media/libstagefright/codecs/aacenc/src/pre_echo_control.c
index 1e818a2..1406e11 100644
--- a/media/libstagefright/codecs/aacenc/src/pre_echo_control.c
+++ b/media/libstagefright/codecs/aacenc/src/pre_echo_control.c
@@ -29,7 +29,7 @@
 
 /*****************************************************************************
 *
-* function name:InitPreEchoControl 
+* function name:InitPreEchoControl
 * description: init pre echo control parameter
 *
 *****************************************************************************/
@@ -40,13 +40,13 @@
   Word16 pb;
 
   for(pb=0; pb<numPb; pb++) {
-    pbThresholdNm1[pb] = pbThresholdQuiet[pb];                                   
+    pbThresholdNm1[pb] = pbThresholdQuiet[pb];
   }
 }
 
 /*****************************************************************************
 *
-* function name:PreEchoControl 
+* function name:PreEchoControl
 * description: update shreshold to avoid pre echo
 *			   thr(n) = max(rpmin*thrq(n), min(thrq(n), rpelev*thrq1(n)))
 *
@@ -68,22 +68,22 @@
   (void)maxAllowedIncreaseFactor;
 
   scaling = ((mdctScale - mdctScalenm1) << 1);
-   
+
   if ( scaling > 0 ) {
     for(i = 0; i < numPb; i++) {
       tmpThreshold1 = pbThresholdNm1[i] >> (scaling-1);
       tmpThreshold2 = L_mpy_ls(pbThreshold[i], minRemainingThresholdFactor);
 
       /* copy thresholds to internal memory */
-      pbThresholdNm1[i] = pbThreshold[i];                                        
+      pbThresholdNm1[i] = pbThreshold[i];
 
-       
+
       if(pbThreshold[i] > tmpThreshold1) {
-        pbThreshold[i] = tmpThreshold1;                                          
+        pbThreshold[i] = tmpThreshold1;
       }
-       
+
       if(tmpThreshold2 > pbThreshold[i]) {
-        pbThreshold[i] = tmpThreshold2;                                          
+        pbThreshold[i] = tmpThreshold2;
       }
 
     }
@@ -96,15 +96,15 @@
       tmpThreshold2 = L_mpy_ls(pbThreshold[i], minRemainingThresholdFactor);
 
       /* copy thresholds to internal memory */
-      pbThresholdNm1[i] = pbThreshold[i];                                        
+      pbThresholdNm1[i] = pbThreshold[i];
 
-       
+
       if(((pbThreshold[i] >> scaling) > tmpThreshold1)) {
         pbThreshold[i] = tmpThreshold1 << scaling;
       }
-       
+
       if(tmpThreshold2 > pbThreshold[i]) {
-        pbThreshold[i] = tmpThreshold2;                                          
+        pbThreshold[i] = tmpThreshold2;
       }
 
     }
diff --git a/media/libstagefright/codecs/aacenc/src/psy_configuration.c b/media/libstagefright/codecs/aacenc/src/psy_configuration.c
index 8e599b0..dd40f9b 100644
--- a/media/libstagefright/codecs/aacenc/src/psy_configuration.c
+++ b/media/libstagefright/codecs/aacenc/src/psy_configuration.c
@@ -88,17 +88,17 @@
 *
 * function name: atan_1000
 * description:  calculates 1000*atan(x/1000)
-*               based on atan approx for x > 0				
+*               based on atan approx for x > 0
 *				atan(x) = x/((float)1.0f+(float)0.280872f*x*x)  if x < 1
 *						= pi/2 - x/((float)0.280872f +x*x)	    if x >= 1
 * return:       1000*atan(x/1000)
 *
 **********************************************************************************/
-static Word16 atan_1000(Word32 val) 
+static Word16 atan_1000(Word32 val)
 {
   Word32 y;
 
-   
+
   if(L_sub(val, 1000) < 0) {
     y = extract_l(((1000 * val) / (1000 + ((val * val) / ATAN_COEF1))));
   }
@@ -126,9 +126,9 @@
   /* center frequency of fft line */
   center_freq = (fftLine * samplingFreq) / (noOfLines << 1);
   temp =  atan_1000((center_freq << 2) / (3*10));
-  bvalFFTLine = 
+  bvalFFTLine =
     (26600 * atan_1000((center_freq*76) / 100) + 7*temp*temp) / (2*1000*1000 / BARC_SCALE);
-  
+
   return saturate(bvalFFTLine);
 }
 
@@ -139,7 +139,7 @@
 *
 *****************************************************************************/
 static void initThrQuiet(Word16  numPb,
-                         Word16 *pbOffset,
+                         const Word16 *pbOffset,
                          Word16 *pbBarcVal,
                          Word32 *pbThresholdQuiet) {
   Word16 i;
@@ -148,17 +148,17 @@
   for(i=0; i<numPb; i++) {
     Word16 bv1, bv2;
 
-     
+
     if (i>0)
       bv1 = (pbBarcVal[i] + pbBarcVal[i-1]) >> 1;
     else
       bv1 = pbBarcVal[i] >> 1;
 
-     
+
     if (i < (numPb - 1))
       bv2 = (pbBarcVal[i] + pbBarcVal[i+1]) >> 1;
     else {
-      bv2 = pbBarcVal[i];                                        
+      bv2 = pbBarcVal[i];
     }
 
     bv1 = min((bv1 / BARC_SCALE), max_bark);
@@ -166,9 +166,9 @@
 
     barcThrQuiet = min(BARC_THR_QUIET[bv1], BARC_THR_QUIET[bv2]);
 
-    
+
     /*
-      we calculate 
+      we calculate
       pow(10.0f,(float)(barcThrQuiet - ABS_LEV)*0.1)*(float)ABS_LOW*(pbOffset[i+1] - pbOffset[i]);
     */
 
@@ -196,47 +196,47 @@
   Word16 i;
   Word16 maskLowSprEn, maskHighSprEn;
 
-   
+
   if (sub(blockType, SHORT_WINDOW) != 0) {
-    maskLowSprEn = maskLowSprEnLong;                                     
-       
+    maskLowSprEn = maskLowSprEnLong;
+
     if (bitrate > 22000)
       maskHighSprEn = maskHighSprEnLong;
     else
       maskHighSprEn = maskHighSprEnLongLowBr;
   }
   else {
-    maskLowSprEn = maskLowSprEnShort;            
-    maskHighSprEn = maskHighSprEnShort;          
+    maskLowSprEn = maskLowSprEnShort;
+    maskHighSprEn = maskHighSprEnShort;
   }
 
   for(i=0; i<numPb; i++) {
-     
+
     if (i > 0) {
       Word32 dbVal;
       Word16 dbark = pbBarcValue[i] - pbBarcValue[i-1];
 
       /*
-        we calulate pow(10.0f, -0.1*dbVal/BARC_SCALE) 
+        we calulate pow(10.0f, -0.1*dbVal/BARC_SCALE)
       */
       dbVal = (maskHigh * dbark);
       pbMaskHiFactor[i] = round16(pow2_xy(L_negate(dbVal), (Word32)LOG2_1000));             /* 0.301 log10(2) */
-       
+
       dbVal = (maskLow * dbark);
-      pbMaskLoFactor[i-1] = round16(pow2_xy(L_negate(dbVal),(Word32)LOG2_1000)); 
-       
-      
+      pbMaskLoFactor[i-1] = round16(pow2_xy(L_negate(dbVal),(Word32)LOG2_1000));
+
+
       dbVal = (maskHighSprEn * dbark);
-      pbMaskHiFactorSprEn[i] =  round16(pow2_xy(L_negate(dbVal),(Word32)LOG2_1000)); 
+      pbMaskHiFactorSprEn[i] =  round16(pow2_xy(L_negate(dbVal),(Word32)LOG2_1000));
       dbVal = (maskLowSprEn * dbark);
       pbMaskLoFactorSprEn[i-1] = round16(pow2_xy(L_negate(dbVal),(Word32)LOG2_1000));
     }
     else {
-      pbMaskHiFactor[i] = 0;                     
-      pbMaskLoFactor[numPb-1] = 0;               
+      pbMaskHiFactor[i] = 0;
+      pbMaskLoFactor[numPb-1] = 0;
 
-      pbMaskHiFactorSprEn[i] = 0;                
-      pbMaskLoFactorSprEn[numPb-1] = 0;          
+      pbMaskHiFactorSprEn[i] = 0;
+      pbMaskLoFactorSprEn[numPb-1] = 0;
     }
   }
 
@@ -250,7 +250,7 @@
 *
 *****************************************************************************/
 static void initBarcValues(Word16  numPb,
-                           Word16 *pbOffset,
+                           const Word16 *pbOffset,
                            Word16  numLines,
                            Word32  samplingFrequency,
                            Word16 *pbBval)
@@ -258,12 +258,12 @@
   Word16 i;
   Word16 pbBval0, pbBval1;
 
-  pbBval0 = 0;                                       
+  pbBval0 = 0;
 
   for(i=0; i<numPb; i++){
     pbBval1 = BarcLineValue(numLines, pbOffset[i+1], samplingFrequency);
     pbBval[i] = (pbBval0 + pbBval1) >> 1;
-    pbBval0 = pbBval1;                              
+    pbBval0 = pbBval1;
   }
 }
 
@@ -295,38 +295,38 @@
 
   pePerWindow = bits2pe(extract_l((bitrate * numLines) / samplerate));
 
-  pbVal0 = 0;                                                    
+  pbVal0 = 0;
 
   for (sfb=0; sfb<sfbActive; sfb++) {
 
     pbVal1 = (pbBarcVal[sfb] << 1) - pbVal0;
     barcWidth = pbVal1 - pbVal0;
-    pbVal0 = pbVal1;                                             
+    pbVal0 = pbVal1;
 
     /* allow at least 2.4% of pe for each active barc */
 	pePart = ((pePerWindow * 24) * (max_bark * barcWidth)) /
         (pbBarcVal[sfbActive-1] * (sfbOffset[sfb+1] - sfbOffset[sfb]));
-   
-      
-    pePart = min(pePart, 8400); 
+
+
+    pePart = min(pePart, 8400);
     pePart = max(pePart, 1400);
 
     /* minSnr(n) = 1/(2^sfbPemin(n)/w(n) - 1.5)*/
 	/* we add an offset of 2^16 to the pow functions */
 	/* 0xc000 = 1.5*(1 << 15)*/
-      
+
     snr = pow2_xy((pePart - 16*1000),1000) - 0x0000c000;
-      
+
     if(snr > 0x00008000)
 	{
 		shift = norm_l(snr);
-		snr = Div_32(0x00008000 << shift, snr << shift);  
+		snr = Div_32(0x00008000 << shift, snr << shift);
 	}
 	else
 	{
 		snr = 0x7fffffff;
 	}
-      
+
     /* upper limit is -1 dB */
     snr = min(snr, c_maxsnr);
     /* lower limit is -25 dB */
@@ -354,7 +354,7 @@
   /*
     init sfb table
   */
-  samplerateindex = GetSRIndex(samplerate);  
+  samplerateindex = GetSRIndex(samplerate);
   psyConf->sfbCnt = sfBandTotalLong[samplerateindex];
   psyConf->sfbOffset = sfBandTabLong + sfBandTabLongOffset[samplerateindex];
   psyConf->sampRateIdx = samplerateindex;
@@ -391,19 +391,19 @@
   /*
     init ratio
   */
-  psyConf->ratio = c_ratio;      
+  psyConf->ratio = c_ratio;
 
-  psyConf->maxAllowedIncreaseFactor = 2;              
-  psyConf->minRemainingThresholdFactor = c_minRemainingThresholdFactor;    /* 0.01 *(1 << 15)*/  
+  psyConf->maxAllowedIncreaseFactor = 2;
+  psyConf->minRemainingThresholdFactor = c_minRemainingThresholdFactor;    /* 0.01 *(1 << 15)*/
 
-  psyConf->clipEnergy = c_maxClipEnergyLong;                   
+  psyConf->clipEnergy = c_maxClipEnergyLong;
   psyConf->lowpassLine = extract_l((bandwidth<<1) * FRAME_LEN_LONG / samplerate);
 
   for (sfb = 0; sfb < psyConf->sfbCnt; sfb++) {
     if (sub(psyConf->sfbOffset[sfb], psyConf->lowpassLine) >= 0)
       break;
   }
-  psyConf->sfbActive = sfb;                 
+  psyConf->sfbActive = sfb;
 
   /*
     calculate minSnr
@@ -429,7 +429,7 @@
 Word16 InitPsyConfigurationShort(Word32 bitrate,
                                  Word32 samplerate,
                                  Word16 bandwidth,
-                                 PSY_CONFIGURATION_SHORT *psyConf) 
+                                 PSY_CONFIGURATION_SHORT *psyConf)
 {
   Word32 samplerateindex;
   Word16 sfbBarcVal[MAX_SFB_SHORT];
@@ -437,7 +437,7 @@
   /*
     init sfb table
   */
-  samplerateindex = GetSRIndex(samplerate);  
+  samplerateindex = GetSRIndex(samplerate);
   psyConf->sfbCnt = sfBandTotalShort[samplerateindex];
   psyConf->sfbOffset = sfBandTabShort + sfBandTabShortOffset[samplerateindex];
   psyConf->sampRateIdx = samplerateindex;
@@ -473,21 +473,21 @@
   /*
     init ratio
   */
-  psyConf->ratio = c_ratio;                                                      
+  psyConf->ratio = c_ratio;
 
-  psyConf->maxAllowedIncreaseFactor = 2;                                         
-  psyConf->minRemainingThresholdFactor = c_minRemainingThresholdFactor;                            	 
+  psyConf->maxAllowedIncreaseFactor = 2;
+  psyConf->minRemainingThresholdFactor = c_minRemainingThresholdFactor;
 
-  psyConf->clipEnergy = c_maxClipEnergyShort;                                    
+  psyConf->clipEnergy = c_maxClipEnergyShort;
 
   psyConf->lowpassLine = extract_l(((bandwidth << 1) * FRAME_LEN_SHORT) / samplerate);
- 
+
   for (sfb = 0; sfb < psyConf->sfbCnt; sfb++) {
-     
+
     if (psyConf->sfbOffset[sfb] >= psyConf->lowpassLine)
       break;
   }
-  psyConf->sfbActive = sfb;                                                      
+  psyConf->sfbActive = sfb;
 
   /*
     calculate minSnr
diff --git a/media/libstagefright/codecs/aacenc/src/psy_main.c b/media/libstagefright/codecs/aacenc/src/psy_main.c
index 3d0a355..4e9218c 100644
--- a/media/libstagefright/codecs/aacenc/src/psy_main.c
+++ b/media/libstagefright/codecs/aacenc/src/psy_main.c
@@ -81,7 +81,7 @@
   Word32 *mdctSpectrum;
   Word32 *scratchTNS;
   Word16 *mdctDelayBuffer;
-  
+
   mdctSpectrum = (Word32 *)mem_malloc(pMemOP, nChan * FRAME_LEN_LONG * sizeof(Word32), 32, VO_INDEX_ENC_AAC);
   if(NULL == mdctSpectrum)
 	  return 1;
@@ -99,7 +99,7 @@
   }
 
   for (i=0; i<nChan; i++){
-    hPsy->psyData[i].mdctDelayBuffer = mdctDelayBuffer + i*BLOCK_SWITCHING_OFFSET;      
+    hPsy->psyData[i].mdctDelayBuffer = mdctDelayBuffer + i*BLOCK_SWITCHING_OFFSET;
     hPsy->psyData[i].mdctSpectrum = mdctSpectrum + i*FRAME_LEN_LONG;
   }
 
@@ -124,12 +124,12 @@
   {
 	if(hPsy->psyData[0].mdctDelayBuffer)
 		mem_free(pMemOP, hPsy->psyData[0].mdctDelayBuffer, VO_INDEX_ENC_AAC);
-      
+
     if(hPsy->psyData[0].mdctSpectrum)
 		mem_free(pMemOP, hPsy->psyData[0].mdctSpectrum, VO_INDEX_ENC_AAC);
 
     for (nch=0; nch<MAX_CHANNELS; nch++){
-	  hPsy->psyData[nch].mdctDelayBuffer = NULL;      
+	  hPsy->psyData[nch].mdctDelayBuffer = NULL;
 	  hPsy->psyData[nch].mdctSpectrum = NULL;
 	}
 
@@ -216,14 +216,14 @@
 
   if (!err)
     for(ch=0;ch < channels;ch++){
-  
+
       InitBlockSwitching(&hPsy->psyData[ch].blockSwitchingControl,
                          bitRate, channels);
 
       InitPreEchoControl(hPsy->psyData[ch].sfbThresholdnm1,
                          hPsy->psyConfLong.sfbCnt,
                          hPsy->psyConfLong.sfbThresholdQuiet);
-      hPsy->psyData[ch].mdctScalenm1 = 0;                                
+      hPsy->psyData[ch].mdctScalenm1 = 0;
     }
 
 	return(err);
@@ -241,7 +241,7 @@
 
 Word16 psyMain(Word16                   nChannels,
                ELEMENT_INFO            *elemInfo,
-               Word16                  *timeSignal, 
+               Word16                  *timeSignal,
                PSY_DATA                 psyData[MAX_CHANNELS],
                TNS_DATA                 tnsData[MAX_CHANNELS],
                PSY_CONFIGURATION_LONG  *hPsyConfLong,
@@ -260,8 +260,8 @@
   Word16 channels;
   Word16 maxScale;
 
-  channels = elemInfo->nChannelsInEl;                            
-  maxScale = 0;                                                  
+  channels = elemInfo->nChannelsInEl;
+  maxScale = 0;
 
   /* block switching */
   for(ch = 0; ch < channels; ch++) {
@@ -291,7 +291,7 @@
   /* common scaling for all channels */
   for (ch=0; ch<channels; ch++) {
     Word16 scaleDiff = maxScale - mdctScalingArray[ch];
-     
+
     if (scaleDiff > 0) {
       Word32 *Spectrum = psyData[ch].mdctSpectrum;
 	  for(line=0; line<FRAME_LEN_LONG; line++) {
@@ -299,11 +299,11 @@
 		Spectrum++;
       }
     }
-    psyData[ch].mdctScale = maxScale;                                    
+    psyData[ch].mdctScale = maxScale;
   }
 
   for (ch=0; ch<channels; ch++) {
-     
+
     if(psyData[ch].blockSwitchingControl.windowSequence != SHORT_WINDOW) {
       /* update long block parameter */
 	  advancePsychLong(&psyData[ch],
@@ -317,7 +317,7 @@
       /* determine maxSfb */
       for (sfb=hPsyConfLong->sfbCnt-1; sfb>=0; sfb--) {
         for (line=hPsyConfLong->sfbOffset[sfb+1] - 1; line>=hPsyConfLong->sfbOffset[sfb]; line--) {
-           
+
           if (psyData[ch].mdctSpectrum[line] != 0) break;
         }
         if (line >= hPsyConfLong->sfbOffset[sfb]) break;
@@ -326,7 +326,7 @@
 
       /* Calc bandwise energies for mid and side channel
          Do it only if 2 channels exist */
-       
+
       if (ch == 1)
         advancePsychLongMS(psyData, hPsyConfLong);
     }
@@ -341,7 +341,7 @@
 
       /* Calc bandwise energies for mid and side channel
          Do it only if 2 channels exist */
-       
+
       if (ch == 1)
         advancePsychShortMS (psyData, hPsyConfShort);
     }
@@ -349,7 +349,7 @@
 
   /* group short data */
   for(ch=0; ch<channels; ch++) {
-     
+
     if (psyData[ch].blockSwitchingControl.windowSequence == SHORT_WINDOW) {
       groupShortData(psyData[ch].mdctSpectrum,
                      pScratchTns,
@@ -374,10 +374,10 @@
     stereo Processing
   */
   if (channels == 2) {
-    psyOutElement->toolsInfo.msDigest = MS_NONE;                 
+    psyOutElement->toolsInfo.msDigest = MS_NONE;
     maxSfbPerGroup[0] = maxSfbPerGroup[1] = max(maxSfbPerGroup[0], maxSfbPerGroup[1]);
 
-     
+
     if (psyData[0].blockSwitchingControl.windowSequence != SHORT_WINDOW)
       MsStereoProcessing(psyData[0].sfbEnergy.sfbLong,
                          psyData[1].sfbEnergy.sfbLong,
@@ -420,7 +420,7 @@
     build output
   */
   for(ch=0;ch<channels;ch++) {
-     
+
     if (psyData[ch].blockSwitchingControl.windowSequence != SHORT_WINDOW)
       BuildInterface(psyData[ch].mdctSpectrum,
                      psyData[ch].mdctScale,
@@ -483,7 +483,7 @@
   /* low pass */
   data0 = psyData->mdctSpectrum + hPsyConfLong->lowpassLine;
   for(i=hPsyConfLong->lowpassLine; i<FRAME_LEN_LONG; i++) {
-    *data0++ = 0;                                
+    *data0++ = 0;
   }
 
   /* Calc sfb-bandwise mdct-energies for left and right channel */
@@ -505,7 +505,7 @@
             psyData->blockSwitchingControl.windowSequence,
             psyData->sfbEnergy.sfbLong);
 
-  /*  TnsSync */   
+  /*  TnsSync */
   if (ch == 1) {
     TnsSync(tnsData,
             tnsData2,
@@ -514,7 +514,7 @@
             psyData->blockSwitchingControl.windowSequence);
   }
 
-  /*  Tns Encoder */ 
+  /*  Tns Encoder */
   TnsEncode(&psyOutChannel->tnsInfo,
             tnsData,
             hPsyConfLong->sfbCnt,
@@ -532,15 +532,15 @@
     *data1++ = min(tdata, clipEnergy);
   }
 
-  /* Calc sfb-bandwise mdct-energies for left and right channel again */   
+  /* Calc sfb-bandwise mdct-energies for left and right channel again */
   if (tnsData->dataRaw.tnsLong.subBlockInfo.tnsActive!=0) {
-    Word16 tnsStartBand = hPsyConfLong->tnsConf.tnsStartBand;                            
+    Word16 tnsStartBand = hPsyConfLong->tnsConf.tnsStartBand;
     CalcBandEnergy( psyData->mdctSpectrum,
                     hPsyConfLong->sfbOffset+tnsStartBand,
                     hPsyConfLong->sfbActive - tnsStartBand,
                     psyData->sfbEnergy.sfbLong+tnsStartBand,
                     &psyData->sfbEnergySum.sfbLong);
-    
+
 	data0 = psyData->sfbEnergy.sfbLong;
 	tdata = psyData->sfbEnergySum.sfbLong;
 	for (i=0; i<tnsStartBand; i++)
@@ -565,13 +565,13 @@
 	  data0++; data1++;
   }
 
-  /* preecho control */   
+  /* preecho control */
   if (psyData->blockSwitchingControl.windowSequence == STOP_WINDOW) {
     data0 = psyData->sfbThresholdnm1;
 	for (i=hPsyConfLong->sfbCnt; i; i--) {
-      *data0++ = MAX_32;                              
+      *data0++ = MAX_32;
     }
-    psyData->mdctScalenm1 = 0;                                           
+    psyData->mdctScalenm1 = 0;
   }
 
   PreEchoControl( psyData->sfbThresholdnm1,
@@ -581,15 +581,15 @@
                   psyData->sfbThreshold.sfbLong,
                   psyData->mdctScale,
                   psyData->mdctScalenm1);
-  psyData->mdctScalenm1 = psyData->mdctScale;                            
+  psyData->mdctScalenm1 = psyData->mdctScale;
 
-   
+
   if (psyData->blockSwitchingControl.windowSequence== START_WINDOW) {
     data0 = psyData->sfbThresholdnm1;
 	for (i=hPsyConfLong->sfbCnt; i; i--) {
-      *data0++ = MAX_32;                              
+      *data0++ = MAX_32;
     }
-    psyData->mdctScalenm1 = 0;                                           
+    psyData->mdctScalenm1 = 0;
   }
 
   /* apply tns mult table on cb thresholds */
@@ -603,13 +603,13 @@
   data0 = psyData->sfbSpreadedEnergy.sfbLong;
   data1 = psyData->sfbEnergy.sfbLong;
   for (i=hPsyConfLong->sfbCnt; i; i--) {
-    //psyData->sfbSpreadedEnergy.sfbLong[i] = psyData->sfbEnergy.sfbLong[i];       
+    //psyData->sfbSpreadedEnergy.sfbLong[i] = psyData->sfbEnergy.sfbLong[i];
 	  *data0++ = *data1++;
   }
 
   /* spreading energy */
   SpreadingMax(hPsyConfLong->sfbCnt,
-               hPsyConfLong->sfbMaskLowFactorSprEn, 
+               hPsyConfLong->sfbMaskLowFactorSprEn,
                hPsyConfLong->sfbMaskHighFactorSprEn,
                psyData->sfbSpreadedEnergy.sfbLong);
 
@@ -619,7 +619,7 @@
 /*****************************************************************************
 *
 * function name: advancePsychLongMS
-* description:   update mdct-energies for left add or minus right channel 
+* description:   update mdct-energies for left add or minus right channel
 *				for long block
 *
 *****************************************************************************/
@@ -657,8 +657,9 @@
   Word32 w;
   Word32 normEnergyShift = (psyData->mdctScale + 1) << 1; /* in reference code, mdct spectrum must be multipied with 2, so +1 */
   Word32 clipEnergy = hPsyConfShort->clipEnergy >> normEnergyShift;
-  Word32 wOffset = 0;     
-  Word32 *data0, *data1;
+  Word32 wOffset = 0;
+  Word32 *data0;
+  const Word32 *data1;
 
   for(w = 0; w < TRANS_FAC; w++) {
     Word32 i, tdata;
@@ -666,7 +667,7 @@
     /* low pass */
     data0 = psyData->mdctSpectrum + wOffset + hPsyConfShort->lowpassLine;
 	for(i=hPsyConfShort->lowpassLine; i<FRAME_LEN_SHORT; i++){
-      *data0++ = 0;                                      
+      *data0++ = 0;
     }
 
     /* Calc sfb-bandwise mdct-energies for left and right channel */
@@ -713,9 +714,9 @@
       *data0++ = min(tdata, clipEnergy);
     }
 
-    /* Calc sfb-bandwise mdct-energies for left and right channel again */     
+    /* Calc sfb-bandwise mdct-energies for left and right channel again */
     if (tnsData->dataRaw.tnsShort.subBlockInfo[w].tnsActive != 0) {
-      Word16 tnsStartBand = hPsyConfShort->tnsConf.tnsStartBand;                            
+      Word16 tnsStartBand = hPsyConfShort->tnsConf.tnsStartBand;
       CalcBandEnergy( psyData->mdctSpectrum+wOffset,
                       hPsyConfShort->sfbOffset+tnsStartBand,
                       (hPsyConfShort->sfbActive - tnsStartBand),
@@ -748,7 +749,7 @@
 	}
 
 
-    /* preecho */     
+    /* preecho */
     PreEchoControl( psyData->sfbThresholdnm1,
                     hPsyConfShort->sfbCnt,
                     hPsyConfShort->maxAllowedIncreaseFactor,
@@ -770,14 +771,14 @@
 	  *data0++ = *data1++;
     }
     SpreadingMax(hPsyConfShort->sfbCnt,
-                 hPsyConfShort->sfbMaskLowFactorSprEn, 
+                 hPsyConfShort->sfbMaskLowFactorSprEn,
                  hPsyConfShort->sfbMaskHighFactorSprEn,
                  psyData->sfbSpreadedEnergy.sfbShort[w]);
 
     wOffset += FRAME_LEN_SHORT;
   } /* for TRANS_FAC */
 
-  psyData->mdctScalenm1 = psyData->mdctScale;              
+  psyData->mdctScalenm1 = psyData->mdctScale;
 
   return 0;
 }
@@ -785,7 +786,7 @@
 /*****************************************************************************
 *
 * function name: advancePsychShortMS
-* description:   update mdct-energies for left add or minus right channel 
+* description:   update mdct-energies for left add or minus right channel
 *				for short block
 *
 *****************************************************************************/
@@ -793,7 +794,7 @@
                                    const PSY_CONFIGURATION_SHORT *hPsyConfShort)
 {
   Word32 w, wOffset;
-  wOffset = 0;                                   
+  wOffset = 0;
   for(w=0; w<TRANS_FAC; w++) {
     CalcBandEnergyMS(psyData[0].mdctSpectrum+wOffset,
                      psyData[1].mdctSpectrum+wOffset,
diff --git a/media/libstagefright/codecs/aacenc/src/qc_main.c b/media/libstagefright/codecs/aacenc/src/qc_main.c
index e8c39e4..48ff300 100644
--- a/media/libstagefright/codecs/aacenc/src/qc_main.c
+++ b/media/libstagefright/codecs/aacenc/src/qc_main.c
@@ -68,12 +68,12 @@
   result = (FRAME_LEN_LONG >> 3) * bitRate;
   quot = result / sampleRate;
 
-   
+
   if (mode == FRAME_LEN_BYTES_MODULO) {
     result -= quot * sampleRate;
   }
   else { /* FRAME_LEN_BYTES_INT */
-    result = quot;                                      
+    result = quot;
   }
 
   return result;
@@ -83,7 +83,7 @@
 *
 *  function name:framePadding
 *  description: Calculates if padding is needed for actual frame
-*  returns: paddingOn or not 
+*  returns: paddingOn or not
 *
 *****************************************************************************/
 static Word16 framePadding(Word32 bitRate,
@@ -93,16 +93,16 @@
   Word16 paddingOn;
   Word16 difference;
 
-  paddingOn = 0;                                                 
+  paddingOn = 0;
 
   difference = calcFrameLen( bitRate,
                              sampleRate,
                              FRAME_LEN_BYTES_MODULO );
   *paddingRest = *paddingRest - difference;
 
-   
+
   if (*paddingRest <= 0 ) {
-    paddingOn = 1;                                               
+    paddingOn = 1;
     *paddingRest = *paddingRest + sampleRate;
   }
 
@@ -123,12 +123,12 @@
   Word32 i;
   Word16 *quantSpec;
   Word16 *scf;
-  UWord16 *maxValueInSfb;	
-	
+  UWord16 *maxValueInSfb;
+
   quantSpec = (Word16 *)mem_malloc(pMemOP, nChannels * FRAME_LEN_LONG * sizeof(Word16), 32, VO_INDEX_ENC_AAC);
   if(NULL == quantSpec)
 	  return 1;
-  scf = (Word16 *)mem_malloc(pMemOP, nChannels * MAX_GROUPED_SFB * sizeof(Word16), 32, VO_INDEX_ENC_AAC);     
+  scf = (Word16 *)mem_malloc(pMemOP, nChannels * MAX_GROUPED_SFB * sizeof(Word16), 32, VO_INDEX_ENC_AAC);
   if(NULL == scf)
   {
 	  return 1;
@@ -141,12 +141,12 @@
 
   for (i=0; i<nChannels; i++) {
     hQC->qcChannel[i].quantSpec = quantSpec + i*FRAME_LEN_LONG;
-    
+
     hQC->qcChannel[i].maxValueInSfb = maxValueInSfb + i*MAX_GROUPED_SFB;
-    
+
     hQC->qcChannel[i].scf = scf + i*MAX_GROUPED_SFB;
   }
- 
+
   return 0;
 }
 
@@ -163,23 +163,23 @@
    Word32 i;
    if(hQC)
    {
-      if(hQC->qcChannel[0].quantSpec);
+      if(hQC->qcChannel[0].quantSpec)
 		 mem_free(pMemOP, hQC->qcChannel[0].quantSpec, VO_INDEX_ENC_AAC);
-    
+
       if(hQC->qcChannel[0].maxValueInSfb)
 		  mem_free(pMemOP, hQC->qcChannel[0].maxValueInSfb, VO_INDEX_ENC_AAC);
-    
+
 	  if(hQC->qcChannel[0].scf)
 		  mem_free(pMemOP, hQC->qcChannel[0].scf, VO_INDEX_ENC_AAC);
 
 	  for (i=0; i<MAX_CHANNELS; i++) {
 		  hQC->qcChannel[i].quantSpec = NULL;
-		  
+
 		  hQC->qcChannel[i].maxValueInSfb = NULL;
-		  
+
 		  hQC->qcChannel[i].scf = NULL;
 	  }
-   } 
+   }
 }
 
 /*********************************************************************************
@@ -204,8 +204,8 @@
 **********************************************************************************/
 void QCDelete(QC_STATE *hQC, VO_MEM_OPERATOR *pMemOP)
 {
- 
-  /* 
+
+  /*
      nothing to do
   */
   hQC=NULL;
@@ -221,15 +221,15 @@
 Word16 QCInit(QC_STATE *hQC,
               struct QC_INIT *init)
 {
-  hQC->nChannels       = init->elInfo->nChannelsInEl;              
-  hQC->maxBitsTot      = init->maxBits;                            
+  hQC->nChannels       = init->elInfo->nChannelsInEl;
+  hQC->maxBitsTot      = init->maxBits;
   hQC->bitResTot       = sub(init->bitRes, init->averageBits);
-  hQC->averageBitsTot  = init->averageBits;                        
-  hQC->maxBitFac       = init->maxBitFac;                          
+  hQC->averageBitsTot  = init->averageBits;
+  hQC->maxBitFac       = init->maxBitFac;
 
-  hQC->padding.paddingRest = init->padding.paddingRest;            
+  hQC->padding.paddingRest = init->padding.paddingRest;
 
-  hQC->globStatBits    = 3;                          /* for ID_END */ 
+  hQC->globStatBits    = 3;                          /* for ID_END */
 
   /* channel elements init */
   InitElementBits(&hQC->elementBits,
@@ -248,13 +248,13 @@
 
 
 /*********************************************************************************
-* 
+*
 * function name: QCMain
 * description:  quantization and coding the spectrum
 * returns:      0 if success
 *
 **********************************************************************************/
-Word16 QCMain(QC_STATE* hQC,              
+Word16 QCMain(QC_STATE* hQC,
               ELEMENT_BITS* elBits,
               ATS_ELEMENT* adjThrStateElement,
               PSY_OUT_CHANNEL  psyOutChannel[MAX_CHANNELS],  /* may be modified in-place */
@@ -262,34 +262,34 @@
               QC_OUT_CHANNEL  qcOutChannel[MAX_CHANNELS],    /* out                      */
               QC_OUT_ELEMENT* qcOutElement,
               Word16 nChannels,
-			  Word16 ancillaryDataBytes)      
+			  Word16 ancillaryDataBytes)
 {
   Word16 maxChDynBits[MAX_CHANNELS];
-  Word16 chBitDistribution[MAX_CHANNELS];  
+  Word16 chBitDistribution[MAX_CHANNELS];
   Word32 ch;
-   
+
   if (elBits->bitResLevel < 0) {
     return -1;
   }
-   
+
   if (elBits->bitResLevel > elBits->maxBitResBits) {
     return -1;
   }
 
   qcOutElement->staticBitsUsed = countStaticBitdemand(psyOutChannel,
                                                       psyOutElement,
-                                                      nChannels, 
+                                                      nChannels,
 													  qcOutElement->adtsUsed);
 
-   
+
   if (ancillaryDataBytes) {
     qcOutElement->ancBitsUsed = 7 + (ancillaryDataBytes << 3);
-     
+
     if (ancillaryDataBytes >= 15)
       qcOutElement->ancBitsUsed = qcOutElement->ancBitsUsed + 8;
   }
   else {
-    qcOutElement->ancBitsUsed = 0; 
+    qcOutElement->ancBitsUsed = 0;
   }
 
   CalcFormFactor(hQC->logSfbFormFactor, hQC->sfbNRelevantLines, hQC->logSfbEnergy, psyOutChannel, nChannels);
@@ -301,7 +301,7 @@
                    psyOutElement,
                    chBitDistribution,
                    hQC->logSfbEnergy,
-                   hQC->sfbNRelevantLines,                   
+                   hQC->sfbNRelevantLines,
                    qcOutElement,
 				   elBits,
 				   nChannels,
@@ -323,14 +323,14 @@
     maxChDynBits[ch] = extract_l(chBitDistribution[ch] * maxDynBits / 1000);
   }
 
-  qcOutElement->dynBitsUsed = 0;                                         
+  qcOutElement->dynBitsUsed = 0;
   for (ch = 0; ch < nChannels; ch++) {
     Word32 chDynBits;
     Flag   constraintsFulfilled;
     Word32 iter;
-    iter = 0;                                                          
+    iter = 0;
     do {
-      constraintsFulfilled = 1;                                        
+      constraintsFulfilled = 1;
 
       QuantizeSpectrum(psyOutChannel[ch].sfbCnt,
                        psyOutChannel[ch].maxSfbPerGroup,
@@ -340,14 +340,14 @@
                        qcOutChannel[ch].globalGain,
                        qcOutChannel[ch].scf,
                        qcOutChannel[ch].quantSpec);
-       
+
       if (calcMaxValueInSfb(psyOutChannel[ch].sfbCnt,
                             psyOutChannel[ch].maxSfbPerGroup,
                             psyOutChannel[ch].sfbPerGroup,
                             psyOutChannel[ch].sfbOffsets,
                             qcOutChannel[ch].quantSpec,
                             qcOutChannel[ch].maxValueInSfb) > MAX_QUANT) {
-        constraintsFulfilled = 0;                                        
+        constraintsFulfilled = 0;
       }
 
       chDynBits = dynBitCount(qcOutChannel[ch].quantSpec,
@@ -359,24 +359,24 @@
                               psyOutChannel[ch].sfbPerGroup,
                               psyOutChannel[ch].sfbOffsets,
                               &qcOutChannel[ch].sectionData);
-       
+
       if (chDynBits >= maxChDynBits[ch]) {
-        constraintsFulfilled = 0;                                        
+        constraintsFulfilled = 0;
       }
-       
+
       if (!constraintsFulfilled) {
         qcOutChannel[ch].globalGain = qcOutChannel[ch].globalGain + 1;
       }
 
       iter = iter + 1;
-       
+
     } while(!constraintsFulfilled);
 
     qcOutElement->dynBitsUsed = qcOutElement->dynBitsUsed + chDynBits;
 
-    qcOutChannel[ch].mdctScale    = psyOutChannel[ch].mdctScale;         
-    qcOutChannel[ch].groupingMask = psyOutChannel[ch].groupingMask;      
-    qcOutChannel[ch].windowShape  = psyOutChannel[ch].windowShape;       
+    qcOutChannel[ch].mdctScale    = psyOutChannel[ch].mdctScale;
+    qcOutChannel[ch].groupingMask = psyOutChannel[ch].groupingMask;
+    qcOutChannel[ch].windowShape  = psyOutChannel[ch].windowShape;
   }
 
   /* save dynBitsUsed for correction of bits2pe relation */
@@ -411,13 +411,13 @@
   Word16 sfbOffs, sfb;
   Word16 maxValueAll;
 
-  maxValueAll = 0;                                       
+  maxValueAll = 0;
 
   for(sfbOffs=0;sfbOffs<sfbCnt;sfbOffs+=sfbPerGroup) {
     for (sfb = 0; sfb < maxSfbPerGroup; sfb++) {
       Word16 line;
       Word16 maxThisSfb;
-      maxThisSfb = 0;                                    
+      maxThisSfb = 0;
 
       for (line = sfbOffset[sfbOffs+sfb]; line < sfbOffset[sfbOffs+sfb+1]; line++) {
         Word16 absVal;
@@ -425,7 +425,7 @@
         maxThisSfb = max(maxThisSfb, absVal);
       }
 
-      maxValue[sfbOffs+sfb] = maxThisSfb;                
+      maxValue[sfbOffs+sfb] = maxThisSfb;
       maxValueAll = max(maxValueAll, maxThisSfb);
     }
   }
@@ -441,15 +441,15 @@
 **********************************************************************************/
 void updateBitres(QC_STATE* qcKernel,
                   QC_OUT*   qcOut)
-                  
+
 {
   ELEMENT_BITS *elBits;
- 
-  qcKernel->bitResTot = 0;                               
+
+  qcKernel->bitResTot = 0;
 
   elBits = &qcKernel->elementBits;
 
-   
+
   if (elBits->averageBits > 0) {
     /* constant bitrate */
     Word16 bitsUsed;
@@ -460,8 +460,8 @@
   }
   else {
     /* variable bitrate */
-    elBits->bitResLevel = elBits->maxBits;           
-    qcKernel->bitResTot = qcKernel->maxBitsTot;      
+    elBits->bitResLevel = elBits->maxBits;
+    qcKernel->bitResTot = qcKernel->maxBitsTot;
   }
 }
 
@@ -476,55 +476,55 @@
 {
   Word32 nFullFillElem;
   Word32 totFillBits;
-  Word16 diffBits;  
+  Word16 diffBits;
   Word16 bitsUsed;
 
-  totFillBits = 0;                                       
+  totFillBits = 0;
 
-  qcOut->totStaticBitsUsed = qcKernel->globStatBits;     
+  qcOut->totStaticBitsUsed = qcKernel->globStatBits;
   qcOut->totStaticBitsUsed += qcOut->qcElement.staticBitsUsed;
   qcOut->totDynBitsUsed    = qcOut->qcElement.dynBitsUsed;
   qcOut->totAncBitsUsed    = qcOut->qcElement.ancBitsUsed;
   qcOut->totFillBits       = qcOut->qcElement.fillBits;
-   
+
   if (qcOut->qcElement.fillBits) {
     totFillBits += qcOut->qcElement.fillBits;
   }
 
   nFullFillElem = (max((qcOut->totFillBits - 1), 0) / maxFillElemBits) * maxFillElemBits;
-  
+
   qcOut->totFillBits = qcOut->totFillBits - nFullFillElem;
 
   /* check fill elements */
-   
+
   if (qcOut->totFillBits > 0) {
     /* minimum Fillelement contains 7 (TAG + byte cnt) bits */
     qcOut->totFillBits = max(7, qcOut->totFillBits);
     /* fill element size equals n*8 + 7 */
-    qcOut->totFillBits = qcOut->totFillBits + ((8 - ((qcOut->totFillBits - 7) & 0x0007)) & 0x0007);     
+    qcOut->totFillBits = qcOut->totFillBits + ((8 - ((qcOut->totFillBits - 7) & 0x0007)) & 0x0007);
   }
 
   qcOut->totFillBits = qcOut->totFillBits + nFullFillElem;
 
   /* now distribute extra fillbits and alignbits over channel elements */
   qcOut->alignBits = 7 - ((qcOut->totDynBitsUsed + qcOut->totStaticBitsUsed +
-                           qcOut->totAncBitsUsed + qcOut->totFillBits - 1) & 0x0007);             
+                           qcOut->totAncBitsUsed + qcOut->totFillBits - 1) & 0x0007);
 
-     
+
   if ( (qcOut->alignBits + qcOut->totFillBits - totFillBits == 8) &&
        (qcOut->totFillBits > 8))
     qcOut->totFillBits = qcOut->totFillBits - 8;
 
-   
+
   diffBits = qcOut->alignBits + qcOut->totFillBits - totFillBits;
-   
+
   if(diffBits>=0) {
     qcOut->qcElement.fillBits += diffBits;
   }
 
   bitsUsed = qcOut->totDynBitsUsed + qcOut->totStaticBitsUsed + qcOut->totAncBitsUsed;
   bitsUsed = bitsUsed + qcOut->totFillBits + qcOut->alignBits;
-   
+
   if (bitsUsed > qcKernel->maxBitsTot) {
     return -1;
   }
@@ -564,9 +564,9 @@
   codeBitsLast = hQC->averageBitsTot - hQC->globStatBits;
   codeBits     = frameLen - hQC->globStatBits;
 
-  /* calculate bits for every channel element */   
+  /* calculate bits for every channel element */
   if (codeBits != codeBitsLast) {
-    Word16 totalBits = 0;                                       
+    Word16 totalBits = 0;
 
     hQC->elementBits.averageBits = (hQC->elementBits.relativeBits * codeBits) >> 16; /* relativeBits was scaled down by 2 */
     totalBits += hQC->elementBits.averageBits;
@@ -574,7 +574,7 @@
     hQC->elementBits.averageBits = hQC->elementBits.averageBits + (codeBits - totalBits);
   }
 
-  hQC->averageBitsTot = frameLen;                        
+  hQC->averageBitsTot = frameLen;
 
   return 0;
 }
diff --git a/media/libstagefright/codecs/aacenc/src/quantize.c b/media/libstagefright/codecs/aacenc/src/quantize.c
index 973554e..0d0f550 100644
--- a/media/libstagefright/codecs/aacenc/src/quantize.c
+++ b/media/libstagefright/codecs/aacenc/src/quantize.c
@@ -34,32 +34,32 @@
 
 /*****************************************************************************
 *
-* function name:pow34 
-* description: calculate $x^{\frac{3}{4}}, for 0.5 < x < 1.0$.  
+* function name:pow34
+* description: calculate $x^{\frac{3}{4}}, for 0.5 < x < 1.0$.
 *
 *****************************************************************************/
 __inline Word32 pow34(Word32 x)
 {
   /* index table using MANT_DIGITS bits, but mask out the sign bit and the MSB
-     which is always one */   
+     which is always one */
   return mTab_3_4[(x >> (INT_BITS-2-MANT_DIGITS)) & (MANT_SIZE-1)];
 }
 
 
 /*****************************************************************************
 *
-* function name:quantizeSingleLine 
-* description: quantizes spectrum  
-*              quaSpectrum = mdctSpectrum^3/4*2^(-(3/16)*gain)    
+* function name:quantizeSingleLine
+* description: quantizes spectrum
+*              quaSpectrum = mdctSpectrum^3/4*2^(-(3/16)*gain)
 *
 *****************************************************************************/
 static Word16 quantizeSingleLine(const Word16 gain, const Word32 absSpectrum)
 {
   Word32 e, minusFinalExp, finalShift;
   Word32 x;
-  Word16 qua = 0;                        
+  Word16 qua = 0;
 
-   
+
   if (absSpectrum) {
     e = norm_l(absSpectrum);
     x = pow34(absSpectrum << e);
@@ -71,7 +71,7 @@
 
     /* separate the exponent into a shift, and a multiply */
     finalShift = minusFinalExp >> 4;
-     
+
     if (finalShift < INT_BITS) {
       x = L_mpy_wx(x, pow2tominusNover16[minusFinalExp & 15]);
 
@@ -84,7 +84,7 @@
 		  x >>= finalShift;
 	  else
 		  x <<= (-finalShift);
-		
+
 	  qua = saturate(x);
     }
   }
@@ -94,10 +94,10 @@
 
 /*****************************************************************************
 *
-* function name:quantizeLines 
-* description: quantizes spectrum lines  
-*              quaSpectrum = mdctSpectrum^3/4*2^(-(3/16)*gain)    
-*  input: global gain, number of lines to process, spectral data         
+* function name:quantizeLines
+* description: quantizes spectrum lines
+*              quaSpectrum = mdctSpectrum^3/4*2^(-(3/16)*gain)
+*  input: global gain, number of lines to process, spectral data
 *  output: quantized spectrum
 *
 *****************************************************************************/
@@ -110,21 +110,21 @@
   Word32 m = gain&3;
   Word32 g = (gain >> 2) + 4;
   Word32 mdctSpeL;
-  Word16 *pquat;
+  const Word16 *pquat;
     /* gain&3 */
 
   pquat = quantBorders[m];
 
   g += 16;
-  
+
   if(g >= 0)
   {
 	for (line=0; line<noOfLines; line++) {
 	  Word32 qua;
-	  qua = 0;                                                     
-    
+	  qua = 0;
+
 	  mdctSpeL = mdctSpectrum[line];
-	
+
 	  if (mdctSpeL) {
 		Word32 sa;
 		Word32 saShft;
@@ -134,27 +134,27 @@
 	    saShft = sa >> g;
 
         if (saShft > pquat[0]) {
-         
+
           if (saShft < pquat[1]) {
-             
+
             qua = mdctSpeL>0 ? 1 : -1;
 		  }
           else {
-           
+
             if (saShft < pquat[2]) {
-               
+
               qua = mdctSpeL>0 ? 2 : -2;
 			}
             else {
-             
+
               if (saShft < pquat[3]) {
-                 
+
                 qua = mdctSpeL>0 ? 3 : -3;
 			  }
               else {
                 qua = quantizeSingleLine(gain, sa);
                 /* adjust the sign. Since 0 < qua < 1, this cannot overflow. */
-               
+
                 if (mdctSpeL < 0)
                   qua = -qua;
 			  }
@@ -162,17 +162,17 @@
 		  }
 		}
 	  }
-      quaSpectrum[line] = qua ;                                    
+      quaSpectrum[line] = qua ;
 	}
   }
   else
   {
 	for (line=0; line<noOfLines; line++) {
 	  Word32 qua;
-	  qua = 0;                                                     
-    
+	  qua = 0;
+
 	  mdctSpeL = mdctSpectrum[line];
-	
+
 	  if (mdctSpeL) {
 		Word32 sa;
 		Word32 saShft;
@@ -181,27 +181,27 @@
         saShft = sa << g;
 
         if (saShft > pquat[0]) {
-         
+
           if (saShft < pquat[1]) {
-             
+
             qua = mdctSpeL>0 ? 1 : -1;
 		  }
           else {
-           
+
             if (saShft < pquat[2]) {
-               
+
               qua = mdctSpeL>0 ? 2 : -2;
 			}
             else {
-             
+
               if (saShft < pquat[3]) {
-                 
+
                 qua = mdctSpeL>0 ? 3 : -3;
 			  }
               else {
                 qua = quantizeSingleLine(gain, sa);
                 /* adjust the sign. Since 0 < qua < 1, this cannot overflow. */
-               
+
                 if (mdctSpeL < 0)
                   qua = -qua;
 			  }
@@ -209,8 +209,8 @@
 		  }
 		}
 	  }
-      quaSpectrum[line] = qua ;                                    
-	}	  
+      quaSpectrum[line] = qua ;
+	}
   }
 
 }
@@ -218,10 +218,10 @@
 
 /*****************************************************************************
 *
-* function name:iquantizeLines 
+* function name:iquantizeLines
 * description: iquantizes spectrum lines without sign
-*              mdctSpectrum = iquaSpectrum^4/3 *2^(0.25*gain) 
-* input: global gain, number of lines to process,quantized spectrum        
+*              mdctSpectrum = iquaSpectrum^4/3 *2^(0.25*gain)
+* input: global gain, number of lines to process,quantized spectrum
 * output: spectral data
 *
 *****************************************************************************/
@@ -234,11 +234,11 @@
   Word32   iquantizershift;
   Word32   line;
 
-  iquantizermod = gain & 3;                              
+  iquantizermod = gain & 3;
   iquantizershift = gain >> 2;
 
   for (line=0; line<noOfLines; line++) {
-     
+
     if( quantSpectrum[line] != 0 ) {
       Word32 accu;
       Word32 ex;
@@ -252,19 +252,19 @@
       accu = accu << ex;
       specExp = INT_BITS-1 - ex;
 
-      tabIndex = (accu >> (INT_BITS-2-MANT_DIGITS)) & (~MANT_SIZE);        
+      tabIndex = (accu >> (INT_BITS-2-MANT_DIGITS)) & (~MANT_SIZE);
 
       /* calculate "mantissa" ^4/3 */
-      s = mTab_4_3[tabIndex];                                                    
+      s = mTab_4_3[tabIndex];
 
       /* get approperiate exponent multiplier for specExp^3/4 combined with scfMod */
-      t = specExpMantTableComb_enc[iquantizermod][specExp];                      
+      t = specExpMantTableComb_enc[iquantizermod][specExp];
 
       /* multiply "mantissa" ^4/3 with exponent multiplier */
       accu = MULHIGH(s, t);
 
       /* get approperiate exponent shifter */
-      specExp = specExpTableComb_enc[iquantizermod][specExp];                    
+      specExp = specExpTableComb_enc[iquantizermod][specExp];
 
       specExp += iquantizershift + 1;
 	  if(specExp >= 0)
@@ -273,7 +273,7 @@
 		  mdctSpectrum[line] = accu >> (-specExp);
     }
     else {
-      mdctSpectrum[line] = 0;                                                    
+      mdctSpectrum[line] = 0;
     }
   }
 }
@@ -301,7 +301,7 @@
   for(sfbOffs=0;sfbOffs<sfbCnt;sfbOffs+=sfbPerGroup) {
     Word32 sfbNext ;
     for (sfb = 0; sfb < maxSfbPerGroup; sfb = sfbNext) {
-      Word16 scalefactor = scalefactors[sfbOffs+sfb];                          
+      Word16 scalefactor = scalefactors[sfbOffs+sfb];
       /* coalesce sfbs with the same scalefactor */
       for (sfbNext = sfb+1;
            sfbNext < maxSfbPerGroup && scalefactor == scalefactors[sfbOffs+sfbNext];
@@ -318,7 +318,7 @@
 
 /*****************************************************************************
 *
-* function name:calcSfbDist 
+* function name:calcSfbDist
 * description: quantizes and requantizes lines to calculate distortion
 * input:  number of lines to be quantized, ...
 * output: distortion
@@ -333,19 +333,19 @@
   Word32 m = gain&3;
   Word32 g = (gain >> 2) + 4;
   Word32 g2 = (g << 1) + 1;
-  Word16 *pquat, *repquat;
+  const Word16 *pquat, *repquat;
     /* gain&3 */
 
   pquat = quantBorders[m];
   repquat = quantRecon[m];
-	
-  dist = 0;  
+
+  dist = 0;
   g += 16;
   if(g2 < 0 && g >= 0)
-  {	  
+  {
 	  g2 = -g2;
-	  for(line=0; line<sfbWidth; line++) {		  
-		  if (spec[line]) {			  
+	  for(line=0; line<sfbWidth; line++) {
+		  if (spec[line]) {
 			  Word32 diff;
 			  Word32 distSingle;
 			  Word32 sa;
@@ -359,19 +359,19 @@
 				  distSingle = (saShft * saShft) >> g2;
 			  }
 			  else {
-				  
+
 				  if (saShft < pquat[1]) {
 					  diff = saShft - repquat[0];
 					  distSingle = (diff * diff) >> g2;
 				  }
 				  else {
-					  
+
 					  if (saShft < pquat[2]) {
 						  diff = saShft - repquat[1];
 						  distSingle = (diff * diff) >> g2;
 					  }
 					  else {
-						  
+
 						  if (saShft < pquat[3]) {
 							  diff = saShft - repquat[2];
 							  distSingle = (diff * diff) >> g2;
@@ -387,15 +387,15 @@
 					  }
 				  }
 			  }
-			  
+
 			  dist = L_add(dist, distSingle);
 		  }
 	  }
   }
   else
   {
-	  for(line=0; line<sfbWidth; line++) {		  
-		  if (spec[line]) {			  
+	  for(line=0; line<sfbWidth; line++) {
+		  if (spec[line]) {
 			  Word32 diff;
 			  Word32 distSingle;
 			  Word32 sa;
@@ -408,19 +408,19 @@
 				  distSingle = L_shl((saShft * saShft), g2);
 			  }
 			  else {
-				  
+
 				  if (saShft < pquat[1]) {
 					  diff = saShft - repquat[0];
 					  distSingle = L_shl((diff * diff), g2);
 				  }
 				  else {
-					  
+
 					  if (saShft < pquat[2]) {
 						  diff = saShft - repquat[1];
 						  distSingle = L_shl((diff * diff), g2);
 					  }
 					  else {
-						  
+
 						  if (saShft < pquat[3]) {
 							  diff = saShft - repquat[2];
 							  distSingle = L_shl((diff * diff), g2);
@@ -438,7 +438,7 @@
 			  }
 			  dist = L_add(dist, distSingle);
 		  }
-	  }	  
+	  }
   }
 
   return dist;
diff --git a/media/libstagefright/codecs/aacenc/src/sf_estim.c b/media/libstagefright/codecs/aacenc/src/sf_estim.c
index ffe2e83..bc320ec 100644
--- a/media/libstagefright/codecs/aacenc/src/sf_estim.c
+++ b/media/libstagefright/codecs/aacenc/src/sf_estim.c
@@ -30,17 +30,17 @@
 static const Word16 MAX_SCF_DELTA = 60;
 
 /*!
-constants reference in comments 
+constants reference in comments
 
  C0 = 6.75f;
- C1 = -69.33295f;   -16/3*log(MAX_QUANT+0.5-logCon)/log(2) 
+ C1 = -69.33295f;   -16/3*log(MAX_QUANT+0.5-logCon)/log(2)
  C2 = 4.0f;
  C3 = 2.66666666f;
- 
-  PE_C1 = 3.0f;        log(8.0)/log(2) 
-  PE_C2 = 1.3219281f;  log(2.5)/log(2) 
-  PE_C3 = 0.5593573f;  1-C2/C1 
-  
+
+  PE_C1 = 3.0f;        log(8.0)/log(2)
+  PE_C2 = 1.3219281f;  log(2.5)/log(2)
+  PE_C3 = 0.5593573f;  1-C2/C1
+
 */
 
 #define FF_SQRT_BITS                    7
@@ -55,15 +55,15 @@
 /*********************************************************************************
 *
 * function name: formfac_sqrt
-* description:  calculates sqrt(x)/256 
+* description:  calculates sqrt(x)/256
 *
 **********************************************************************************/
 __inline Word32 formfac_sqrt(Word32 x)
 {
 	Word32 y;
 	Word32 preshift, postshift;
-	
-	
+
+
 	if (x==0) return 0;
 	preshift  = norm_l(x) - (INT_BITS-1-FF_SQRT_BITS);
 	postshift = preshift >> 1;
@@ -74,12 +74,12 @@
 	else
 		y = x >> (-preshift);
 	y = formfac_sqrttable[y-32];
-	
+
 	if(postshift >= 0)
 		y = y >> postshift;
 	else
 		y = y << (-postshift);
-	
+
 	return y;
 }
 
@@ -100,19 +100,19 @@
 	Word32 sfbw, sfbw1;
 	Word32 i, j;
 	Word32 sfbOffs, sfb, shift;
-	
+
 	sfbw = sfbw1 = 0;
 	for (sfbOffs=0; sfbOffs<psyOutChan->sfbCnt; sfbOffs+=psyOutChan->sfbPerGroup){
 		for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
-			i = sfbOffs+sfb;      
-			
+			i = sfbOffs+sfb;
+
 			if (psyOutChan->sfbEnergy[i] > psyOutChan->sfbThreshold[i]) {
 				Word32 accu, avgFormFactor,iSfbWidth;
 				Word32 *mdctSpec;
 				sfbw = psyOutChan->sfbOffsets[i+1] - psyOutChan->sfbOffsets[i];
 				iSfbWidth = invSBF[(sfbw >> 2) - 1];
 				mdctSpec = psyOutChan->mdctSpectrum + psyOutChan->sfbOffsets[i];
-				accu = 0;                                                                       
+				accu = 0;
 				/* calc sum of sqrt(spec) */
 				for (j=sfbw; j; j--) {
 					accu += formfac_sqrt(L_abs(*mdctSpec)); mdctSpec++;
@@ -129,7 +129,7 @@
 			}
 			else {
 				/* set number of lines to zero */
-				sfbNRelevantLines[i] = 0;                                                       
+				sfbNRelevantLines[i] = 0;
 			}
 		}
 	}
@@ -141,68 +141,68 @@
 * description:  find better scalefactor with analysis by synthesis
 *
 **********************************************************************************/
-static Word16 improveScf(Word32 *spec, 
-                         Word16  sfbWidth, 
-                         Word32  thresh, 
+static Word16 improveScf(Word32 *spec,
+                         Word16  sfbWidth,
+                         Word32  thresh,
                          Word16  scf,
                          Word16  minScf,
-                         Word32 *dist, 
+                         Word32 *dist,
                          Word16 *minScfCalculated)
 {
 	Word32 cnt;
 	Word32 sfbDist;
 	Word32 scfBest;
 	Word32 thresh125 = L_add(thresh, (thresh >> 2));
-	
-	scfBest = scf;                                                       
-	
+
+	scfBest = scf;
+
 	/* calc real distortion */
 	sfbDist = calcSfbDist(spec, sfbWidth, scf);
-	*minScfCalculated = scf;     
+	*minScfCalculated = scf;
 	if(!sfbDist)
 	  return scfBest;
-	
+
 	if (sfbDist > thresh125) {
 		Word32 scfEstimated;
 		Word32 sfbDistBest;
-		scfEstimated = scf;                                               
-		sfbDistBest = sfbDist;                                            
-		
-		cnt = 0;                                                          
+		scfEstimated = scf;
+		sfbDistBest = sfbDist;
+
+		cnt = 0;
 		while (sfbDist > thresh125 && (cnt < 3)) {
-			
+
 			scf = scf + 1;
 			sfbDist = calcSfbDist(spec, sfbWidth, scf);
-			
+
 			if (sfbDist < sfbDistBest) {
-				scfBest = scf;                                              
-				sfbDistBest = sfbDist;                                      
+				scfBest = scf;
+				sfbDistBest = sfbDist;
 			}
 			cnt = cnt + 1;
 		}
-		cnt = 0;                                                          
-		scf = scfEstimated;                                               
-		sfbDist = sfbDistBest;                                            
+		cnt = 0;
+		scf = scfEstimated;
+		sfbDist = sfbDistBest;
 		while ((sfbDist > thresh125) && (cnt < 1) && (scf > minScf)) {
-			
+
 			scf = scf - 1;
 			sfbDist = calcSfbDist(spec, sfbWidth, scf);
-			
+
 			if (sfbDist < sfbDistBest) {
-				scfBest = scf;                                              
-				sfbDistBest = sfbDist;                                      
+				scfBest = scf;
+				sfbDistBest = sfbDist;
 			}
-			*minScfCalculated = scf;                                       
+			*minScfCalculated = scf;
 			cnt = cnt + 1;
 		}
-		*dist = sfbDistBest;                                              
+		*dist = sfbDistBest;
 	}
 	else {
-		Word32 sfbDistBest; 
+		Word32 sfbDistBest;
 		Word32 sfbDistAllowed;
 		Word32 thresh08 = fixmul(COEF08_31, thresh);
-		sfbDistBest = sfbDist;                                            
-		
+		sfbDistBest = sfbDist;
+
 		if (sfbDist < thresh08)
 			sfbDistAllowed = sfbDist;
 		else
@@ -210,16 +210,16 @@
 		for (cnt=0; cnt<3; cnt++) {
 			scf = scf + 1;
 			sfbDist = calcSfbDist(spec, sfbWidth, scf);
-			
+
 			if (fixmul(COEF08_31,sfbDist) < sfbDistAllowed) {
 				*minScfCalculated = scfBest + 1;
-				scfBest = scf;                                              
-				sfbDistBest = sfbDist;                                      
+				scfBest = scf;
+				sfbDistBest = sfbDist;
 			}
 		}
-		*dist = sfbDistBest;                                              
+		*dist = sfbDistBest;
 	}
-	
+
 	/* return best scalefactor */
 	return scfBest;
 }
@@ -233,10 +233,10 @@
 static Word16 countSingleScfBits(Word16 scf, Word16 scfLeft, Word16 scfRight)
 {
 	Word16 scfBits;
-	
+
 	scfBits = bitCountScalefactorDelta(scfLeft - scf) +
 		bitCountScalefactorDelta(scf - scfRight);
-	
+
 	return scfBits;
 }
 
@@ -245,7 +245,7 @@
 * function name: calcSingleSpecPe
 * description:  ldRatio = log2(en(n)) - 0,375*scfGain(n)
 *				nbits = 0.7*nLines*ldRation for ldRation >= c1
-*				nbits = 0.7*nLines*(c2 + c3*ldRatio) for ldRation < c1 
+*				nbits = 0.7*nLines*(c2 + c3*ldRatio) for ldRation < c1
 *
 **********************************************************************************/
 static Word16 calcSingleSpecPe(Word16 scf, Word16 sfbConstPePart, Word16 nLines)
@@ -253,18 +253,18 @@
 	Word32 specPe;
 	Word32 ldRatio;
 	Word32 scf3;
-	
+
 	ldRatio = sfbConstPePart << 3; /*  (sfbConstPePart -0.375*scf)*8 */
 	scf3 = scf + scf + scf;
 	ldRatio = ldRatio - scf3;
-    
+
 	if (ldRatio < PE_C1_8) {
-		/* 21 : 2*8*PE_C2, 2*PE_C3 ~ 1*/ 
+		/* 21 : 2*8*PE_C2, 2*PE_C3 ~ 1*/
 		ldRatio = (ldRatio + PE_C2_16) >> 1;
 	}
 	specPe = nLines * ldRatio;
 	specPe = (specPe * PE_SCALE) >> 14;
-	
+
 	return saturate(specPe);
 }
 
@@ -275,53 +275,53 @@
 * description:  count different scf bits used
 *
 **********************************************************************************/
-static Word16 countScfBitsDiff(Word16 *scfOld, Word16 *scfNew, 
+static Word16 countScfBitsDiff(Word16 *scfOld, Word16 *scfNew,
                                Word16 sfbCnt, Word16 startSfb, Word16 stopSfb)
 {
 	Word32 scfBitsDiff;
 	Word32 sfb, sfbLast;
 	Word32 sfbPrev, sfbNext;
-	
-	scfBitsDiff = 0;                                                      
-	sfb = 0;                                                              
-	
+
+	scfBitsDiff = 0;
+	sfb = 0;
+
 	/* search for first relevant sfb */
-	sfbLast = startSfb;                                                   
+	sfbLast = startSfb;
 	while (sfbLast < stopSfb && scfOld[sfbLast] == VOAAC_SHRT_MIN) {
-		
+
 		sfbLast = sfbLast + 1;
 	}
 	/* search for previous relevant sfb and count diff */
 	sfbPrev = startSfb - 1;
 	while ((sfbPrev>=0) && scfOld[sfbPrev] == VOAAC_SHRT_MIN) {
-		
+
 		sfbPrev = sfbPrev - 1;
 	}
-	
+
 	if (sfbPrev>=0) {
 		scfBitsDiff += bitCountScalefactorDelta(scfNew[sfbPrev] - scfNew[sfbLast]) -
 			bitCountScalefactorDelta(scfOld[sfbPrev] - scfOld[sfbLast]);
 	}
 	/* now loop through all sfbs and count diffs of relevant sfbs */
 	for (sfb=sfbLast+1; sfb<stopSfb; sfb++) {
-		
+
 		if (scfOld[sfb] != VOAAC_SHRT_MIN) {
 			scfBitsDiff += bitCountScalefactorDelta(scfNew[sfbLast] - scfNew[sfb]) -
 				bitCountScalefactorDelta(scfOld[sfbLast] - scfOld[sfb]);
-			sfbLast = sfb;                                                    
+			sfbLast = sfb;
 		}
 	}
 	/* search for next relevant sfb and count diff */
-	sfbNext = stopSfb;                                                    
+	sfbNext = stopSfb;
 	while (sfbNext < sfbCnt && scfOld[sfbNext] == VOAAC_SHRT_MIN) {
-		
+
 		sfbNext = sfbNext + 1;
 	}
-	
+
 	if (sfbNext < sfbCnt)
 		scfBitsDiff += bitCountScalefactorDelta(scfNew[sfbLast] - scfNew[sfbNext]) -
 		bitCountScalefactorDelta(scfOld[sfbLast] - scfOld[sfbNext]);
-	
+
 	return saturate(scfBitsDiff);
 }
 
@@ -331,52 +331,52 @@
                              Word16 *logSfbEnergy,
                              Word16 *logSfbFormFactor,
                              Word16 *sfbNRelevantLines,
-                             Word16 startSfb, 
+                             Word16 startSfb,
                              Word16 stopSfb)
 {
 	Word32 specPeDiff;
 	Word32 sfb;
-	
-	specPeDiff = 0;                                                       
-	
+
+	specPeDiff = 0;
+
 	/* loop through all sfbs and count pe difference */
 	for (sfb=startSfb; sfb<stopSfb; sfb++) {
-		
-		
+
+
 		if (scfOld[sfb] != VOAAC_SHRT_MIN) {
 			Word32 ldRatioOld, ldRatioNew;
 			Word32 scf3;
-			
-			
+
+
 			if (sfbConstPePart[sfb] == MIN_16) {
 				sfbConstPePart[sfb] = ((logSfbEnergy[sfb] -
 					logSfbFormFactor[sfb]) + 11-8*4+3) >> 2;
 			}
-			
-			
+
+
 			ldRatioOld = sfbConstPePart[sfb] << 3;
 			scf3 = scfOld[sfb] + scfOld[sfb] + scfOld[sfb];
 			ldRatioOld = ldRatioOld - scf3;
 			ldRatioNew = sfbConstPePart[sfb] << 3;
 			scf3 = scfNew[sfb] + scfNew[sfb] + scfNew[sfb];
 			ldRatioNew = ldRatioNew - scf3;
-			
+
 			if (ldRatioOld < PE_C1_8) {
 				/* 21 : 2*8*PE_C2, 2*PE_C3 ~ 1*/
 				ldRatioOld = (ldRatioOld + PE_C2_16) >> 1;
 			}
-			
+
 			if (ldRatioNew < PE_C1_8) {
 				/* 21 : 2*8*PE_C2, 2*PE_C3 ~ 1*/
 				ldRatioNew = (ldRatioNew + PE_C2_16) >> 1;
 			}
-			
+
 			specPeDiff +=  sfbNRelevantLines[sfb] * (ldRatioNew - ldRatioOld);
 		}
 	}
-	
+
 	specPeDiff = (specPeDiff * PE_SCALE) >> 14;
-	
+
 	return saturate(specPeDiff);
 }
 
@@ -390,9 +390,9 @@
 *
 **********************************************************************************/
 static void assimilateSingleScf(PSY_OUT_CHANNEL *psyOutChan,
-                                Word16 *scf, 
+                                Word16 *scf,
                                 Word16 *minScf,
-                                Word32 *sfbDist, 
+                                Word32 *sfbDist,
                                 Word16 *sfbConstPePart,
                                 Word16 *logSfbEnergy,
                                 Word16 *logSfbFormFactor,
@@ -400,7 +400,7 @@
                                 Word16 *minScfCalculated,
                                 Flag    restartOnSuccess)
 {
-	Word32 sfbLast, sfbAct, sfbNext, scfAct, scfMin;
+	Word16 sfbLast, sfbAct, sfbNext, scfAct, scfMin;
 	Word16 *scfLast, *scfNext;
 	Word32 sfbPeOld, sfbPeNew;
 	Word32 sfbDistNew;
@@ -411,94 +411,94 @@
 	Word16 *prevScfNext = psyOutChan->prevScfNext;
 	Word16 *deltaPeLast = psyOutChan->deltaPeLast;
 	Flag   updateMinScfCalculated;
-	
-	success = 0;                                                                  
-	deltaPe = 0;                                                                  
-	
+
+	success = 0;
+	deltaPe = 0;
+
 	for(j=0;j<psyOutChan->sfbCnt;j++){
-		prevScfLast[j] = MAX_16;                                                    
-		prevScfNext[j] = MAX_16;                                                    
-		deltaPeLast[j] = MAX_16;                                                    
+		prevScfLast[j] = MAX_16;
+		prevScfNext[j] = MAX_16;
+		deltaPeLast[j] = MAX_16;
 	}
-	
-	sfbLast = -1;                                                                 
-	sfbAct = -1;                                                                  
-	sfbNext = -1;                                                                 
+
+	sfbLast = -1;
+	sfbAct = -1;
+	sfbNext = -1;
 	scfLast = 0;
 	scfNext = 0;
-	scfMin = MAX_16;                                                              
+	scfMin = MAX_16;
 	do {
 		/* search for new relevant sfb */
 		sfbNext = sfbNext + 1;
 		while (sfbNext < psyOutChan->sfbCnt && scf[sfbNext] == MIN_16) {
-			
+
 			sfbNext = sfbNext + 1;
 		}
-		
+
 		if ((sfbLast>=0) && (sfbAct>=0) && sfbNext < psyOutChan->sfbCnt) {
 			/* relevant scfs to the left and to the right */
-			scfAct  = scf[sfbAct];                                                    
+			scfAct  = scf[sfbAct];
 			scfLast = scf + sfbLast;
 			scfNext = scf + sfbNext;
 			scfMin  = min(*scfLast, *scfNext);
 		}
 		else {
-			
+
 			if (sfbLast == -1 && (sfbAct>=0) && sfbNext < psyOutChan->sfbCnt) {
 				/* first relevant scf */
-				scfAct  = scf[sfbAct];                                                  
+				scfAct  = scf[sfbAct];
 				scfLast = &scfAct;
 				scfNext = scf + sfbNext;
-				scfMin  = *scfNext;                                                     
+				scfMin  = *scfNext;
 			}
 			else {
-				
+
 				if ((sfbLast>=0) && (sfbAct>=0) && sfbNext == psyOutChan->sfbCnt) {
 					/* last relevant scf */
-					scfAct  = scf[sfbAct];                                                
+					scfAct  = scf[sfbAct];
 					scfLast = scf + sfbLast;
 					scfNext = &scfAct;
-					scfMin  = *scfLast;                                                   
+					scfMin  = *scfLast;
 				}
 			}
 		}
-		
+
 		if (sfbAct>=0)
 			scfMin = max(scfMin, minScf[sfbAct]);
-		
-		if ((sfbAct >= 0) && 
-			(sfbLast>=0 || sfbNext < psyOutChan->sfbCnt) && 
-			scfAct > scfMin && 
-			(*scfLast != prevScfLast[sfbAct] || 
-			*scfNext != prevScfNext[sfbAct] || 
+
+		if ((sfbAct >= 0) &&
+			(sfbLast>=0 || sfbNext < psyOutChan->sfbCnt) &&
+			scfAct > scfMin &&
+			(*scfLast != prevScfLast[sfbAct] ||
+			*scfNext != prevScfNext[sfbAct] ||
 			deltaPe < deltaPeLast[sfbAct])) {
-			success = 0;                                                              
-			
-			/* estimate required bits for actual scf */			
+			success = 0;
+
+			/* estimate required bits for actual scf */
 			if (sfbConstPePart[sfbAct] == MIN_16) {
 				sfbConstPePart[sfbAct] = logSfbEnergy[sfbAct] -
 					logSfbFormFactor[sfbAct] + 11-8*4; /* 4*log2(6.75) - 32 */
-				
+
 				if (sfbConstPePart[sfbAct] < 0)
 					sfbConstPePart[sfbAct] = sfbConstPePart[sfbAct] + 3;
 				sfbConstPePart[sfbAct] = sfbConstPePart[sfbAct] >> 2;
 			}
-			
+
 			sfbPeOld = calcSingleSpecPe(scfAct, sfbConstPePart[sfbAct], sfbNRelevantLines[sfbAct]) +
 				countSingleScfBits(scfAct, *scfLast, *scfNext);
-			deltaPeNew = deltaPe;                                                     
-			updateMinScfCalculated = 1;                                               
+			deltaPeNew = deltaPe;
+			updateMinScfCalculated = 1;
 			do {
 				scfAct = scfAct - 1;
 				/* check only if the same check was not done before */
-				
+
 				if (scfAct < minScfCalculated[sfbAct]) {
 					sfbPeNew = calcSingleSpecPe(scfAct, sfbConstPePart[sfbAct], sfbNRelevantLines[sfbAct]) +
 						countSingleScfBits(scfAct, *scfLast, *scfNext);
-					/* use new scf if no increase in pe and 
+					/* use new scf if no increase in pe and
 					quantization error is smaller */
 					deltaPeTmp = deltaPe + sfbPeNew - sfbPeOld;
-					
+
 					if (deltaPeTmp < 10) {
 						sfbDistNew = calcSfbDist(psyOutChan->mdctSpectrum+
 							psyOutChan->sfbOffsets[sfbAct],
@@ -506,46 +506,46 @@
 							scfAct);
 						if (sfbDistNew < sfbDist[sfbAct]) {
 							/* success, replace scf by new one */
-							scf[sfbAct] = scfAct;                                     
-							sfbDist[sfbAct] = sfbDistNew;                             
-							deltaPeNew = deltaPeTmp;                                  
-							success = 1;                                              
+							scf[sfbAct] = scfAct;
+							sfbDist[sfbAct] = sfbDistNew;
+							deltaPeNew = deltaPeTmp;
+							success = 1;
 						}
 						/* mark as already checked */
-						
+
 						if (updateMinScfCalculated) {
-							minScfCalculated[sfbAct] = scfAct;                        
+							minScfCalculated[sfbAct] = scfAct;
 						}
 					}
 					else {
-						updateMinScfCalculated = 0;                                 
+						updateMinScfCalculated = 0;
 					}
 				}
-				
+
 			} while (scfAct > scfMin);
-			deltaPe = deltaPeNew;                                             
+			deltaPe = deltaPeNew;
 			/* save parameters to avoid multiple computations of the same sfb */
-			prevScfLast[sfbAct] = *scfLast;                                   
-			prevScfNext[sfbAct] = *scfNext;                                   
-			deltaPeLast[sfbAct] = deltaPe;                                    
+			prevScfLast[sfbAct] = *scfLast;
+			prevScfNext[sfbAct] = *scfNext;
+			deltaPeLast[sfbAct] = deltaPe;
 		}
-		
+
 		if (success && restartOnSuccess) {
 			/* start again at first sfb */
-			sfbLast = -1;                                                     
-			sfbAct  = -1;                                                     
-			sfbNext = -1;                                                     
+			sfbLast = -1;
+			sfbAct  = -1;
+			sfbNext = -1;
 			scfLast = 0;
 			scfNext = 0;
-			scfMin  = MAX_16;                                                 
-			success = 0;                                                      
+			scfMin  = MAX_16;
+			success = 0;
 		}
 		else {
 			/* shift sfbs for next band */
-			sfbLast = sfbAct;                                                 
-			sfbAct  = sfbNext;                                                
+			sfbLast = sfbAct;
+			sfbAct  = sfbNext;
 		}
-		
+
   } while (sfbNext < psyOutChan->sfbCnt);
 }
 
@@ -557,9 +557,9 @@
 *
 **********************************************************************************/
 static void assimilateMultipleScf(PSY_OUT_CHANNEL *psyOutChan,
-                                  Word16 *scf, 
+                                  Word16 *scf,
                                   Word16 *minScf,
-                                  Word32 *sfbDist, 
+                                  Word32 *sfbDist,
                                   Word16 *sfbConstPePart,
                                   Word16 *logSfbEnergy,
                                   Word16 *logSfbFormFactor,
@@ -574,95 +574,95 @@
 	Word32 *sfbDistNew = psyOutChan->sfbDistNew;
 	Word16 *scfTmp = psyOutChan->prevScfLast;
 
-	deltaPe = 0;                                                          
-	sfbCnt = psyOutChan->sfbCnt;                                          
-	
+	deltaPe = 0;
+	sfbCnt = psyOutChan->sfbCnt;
+
 	/* calc min and max scalfactors */
-	scfMin = MAX_16;                                                      
-	scfMax = MIN_16;                                                      
+	scfMin = MAX_16;
+	scfMax = MIN_16;
 	for (sfb=0; sfb<sfbCnt; sfb++) {
-		
+
 		if (scf[sfb] != MIN_16) {
 			scfMin = min(scfMin, scf[sfb]);
 			scfMax = max(scfMax, scf[sfb]);
 		}
 	}
-	
+
 	if (scfMax !=  MIN_16) {
-		
-		scfAct = scfMax;                                             
-		
+
+		scfAct = scfMax;
+
 		do {
 			scfAct = scfAct - 1;
 			for (sfb=0; sfb<sfbCnt; sfb++) {
-				scfTmp[sfb] = scf[sfb];                                         
+				scfTmp[sfb] = scf[sfb];
 			}
-			stopSfb = 0;                                                      
+			stopSfb = 0;
 			do {
-				sfb = stopSfb;                                                  
-				
+				sfb = stopSfb;
+
 				while (sfb < sfbCnt && (scf[sfb] == MIN_16 || scf[sfb] <= scfAct)) {
 					sfb = sfb + 1;
 				}
-				startSfb = sfb;                                                 
+				startSfb = sfb;
 				sfb = sfb + 1;
-				
+
 				while (sfb < sfbCnt && (scf[sfb] == MIN_16 || scf[sfb] > scfAct)) {
 					sfb = sfb + 1;
 				}
-				stopSfb = sfb;                                                  
-				
-				possibleRegionFound = 0;                                        
-				
+				stopSfb = sfb;
+
+				possibleRegionFound = 0;
+
 				if (startSfb < sfbCnt) {
-					possibleRegionFound = 1;                                      
+					possibleRegionFound = 1;
 					for (sfb=startSfb; sfb<stopSfb; sfb++) {
-						
+
 						if (scf[sfb]!=MIN_16) {
-							
+
 							if (scfAct < minScf[sfb]) {
-								possibleRegionFound = 0;                                
+								possibleRegionFound = 0;
 								break;
 							}
 						}
 					}
 				}
-				
-				
+
+
 				if (possibleRegionFound) { /* region found */
-					
+
 					/* replace scfs in region by scfAct */
 					for (sfb=startSfb; sfb<stopSfb; sfb++) {
-						
+
 						if (scfTmp[sfb]!=MIN_16)
-							scfTmp[sfb] = scfAct;                                     
+							scfTmp[sfb] = scfAct;
 					}
-					
+
 					/* estimate change in bit demand for new scfs */
 					deltaScfBits = countScfBitsDiff(scf,scfTmp,sfbCnt,startSfb,stopSfb);
 					deltaSpecPe = calcSpecPeDiff(scf, scfTmp, sfbConstPePart,
-						logSfbEnergy, logSfbFormFactor, sfbNRelevantLines, 
+						logSfbEnergy, logSfbFormFactor, sfbNRelevantLines,
 						startSfb, stopSfb);
 					deltaPeNew = deltaPe + deltaScfBits + deltaSpecPe;
-					
-					
+
+
 					if (deltaPeNew < 10) {
 						Word32 distOldSum, distNewSum;
-						
+
 						/* quantize and calc sum of new distortion */
-						distOldSum = 0;                                                     
-						distNewSum = 0;                                                     
+						distOldSum = 0;
+						distNewSum = 0;
 						for (sfb=startSfb; sfb<stopSfb; sfb++) {
-							
+
 							if (scfTmp[sfb] != MIN_16) {
 								distOldSum = L_add(distOldSum, sfbDist[sfb]);
-								
+
 								sfbDistNew[sfb] = calcSfbDist(psyOutChan->mdctSpectrum +
-									psyOutChan->sfbOffsets[sfb], 
+									psyOutChan->sfbOffsets[sfb],
 									(psyOutChan->sfbOffsets[sfb+1] - psyOutChan->sfbOffsets[sfb]),
 									scfAct);
-								
-								
+
+
 								if (sfbDistNew[sfb] > psyOutChan->sfbThreshold[sfb]) {
 									distNewSum = distOldSum << 1;
 									break;
@@ -670,20 +670,20 @@
 								distNewSum = L_add(distNewSum, sfbDistNew[sfb]);
 							}
 						}
-						
+
 						if (distNewSum < distOldSum) {
-							deltaPe = deltaPeNew;                                             
+							deltaPe = deltaPeNew;
 							for (sfb=startSfb; sfb<stopSfb; sfb++) {
-								
+
 								if (scf[sfb]!=MIN_16) {
-									scf[sfb] = scfAct;                                            
-									sfbDist[sfb] = sfbDistNew[sfb];                               
+									scf[sfb] = scfAct;
+									sfbDist[sfb] = sfbDistNew[sfb];
 								}
 							}
 						}
 					}
-				}        
-			} while (stopSfb <= sfbCnt);      
+				}
+			} while (stopSfb <= sfbCnt);
 		} while (scfAct > scfMin);
 	}
 }
@@ -710,125 +710,125 @@
 	Word32 *sfbDist = psyOutChan->sfbDist;
 	Word16 *minSfMaxQuant = psyOutChan->minSfMaxQuant;
 	Word16 *minScfCalculated = psyOutChan->minScfCalculated;
-	
-	
+
+
 	for (i=0; i<psyOutChan->sfbCnt; i++) {
 		Word32 sbfwith, sbfStart;
 		Word32 *mdctSpec;
-		thresh = psyOutChan->sfbThreshold[i];                                       
-		energy = psyOutChan->sfbEnergy[i];                                          
-		
+		thresh = psyOutChan->sfbThreshold[i];
+		energy = psyOutChan->sfbEnergy[i];
+
 		sbfStart = psyOutChan->sfbOffsets[i];
 		sbfwith = psyOutChan->sfbOffsets[i+1] - sbfStart;
 		mdctSpec = psyOutChan->mdctSpectrum+sbfStart;
-		
-		maxSpec = 0;                                                                
+
+		maxSpec = 0;
 		/* maximum of spectrum */
 		for (j=sbfwith; j; j-- ) {
 			Word32 absSpec = L_abs(*mdctSpec); mdctSpec++;
-			maxSpec |= absSpec;                                                       
+			maxSpec |= absSpec;
 		}
-		
+
 		/* scfs without energy or with thresh>energy are marked with MIN_16 */
-		scf[i] = MIN_16;                                                            
-		minSfMaxQuant[i] = MIN_16;    
-		
+		scf[i] = MIN_16;
+		minSfMaxQuant[i] = MIN_16;
+
 		if ((maxSpec > 0) && (energy > thresh)) {
-			
-			energyPart = logSfbFormFactor[i];                                         
-			thresholdPart = iLog4(thresh);  
+
+			energyPart = logSfbFormFactor[i];
+			thresholdPart = iLog4(thresh);
 			/* -20 = 4*log2(6.75) - 32 */
 			scfInt = ((thresholdPart - energyPart - 20) * SCALE_ESTIMATE_COEF) >> 15;
-			
+
 			minSfMaxQuant[i] = iLog4(maxSpec) - 68; /* 68  -16/3*log(MAX_QUANT+0.5-logCon)/log(2) + 1 */
-			
-			
+
+
 			if (minSfMaxQuant[i] > scfInt) {
-				scfInt = minSfMaxQuant[i];                                              
+				scfInt = minSfMaxQuant[i];
 			}
-			
+
 			/* find better scalefactor with analysis by synthesis */
 			scfInt = improveScf(psyOutChan->mdctSpectrum+sbfStart,
 				sbfwith,
-				thresh, scfInt, minSfMaxQuant[i], 
+				thresh, scfInt, minSfMaxQuant[i],
 				&sfbDist[i], &minScfCalculated[i]);
-			
-			scf[i] = scfInt;                                                          
+
+			scf[i] = scfInt;
 		}
 	}
-	
-	
+
+
 	/* scalefactor differece reduction  */
 	{
 		Word16 sfbConstPePart[MAX_GROUPED_SFB];
 		for(i=0;i<psyOutChan->sfbCnt;i++) {
-			sfbConstPePart[i] = MIN_16;                                               
+			sfbConstPePart[i] = MIN_16;
 		}
-		
-		assimilateSingleScf(psyOutChan, scf, 
+
+		assimilateSingleScf(psyOutChan, scf,
 			minSfMaxQuant, sfbDist, sfbConstPePart, logSfbEnergy,
 			logSfbFormFactor, sfbNRelevantLines, minScfCalculated, 1);
-		
-		assimilateMultipleScf(psyOutChan, scf, 
+
+		assimilateMultipleScf(psyOutChan, scf,
 			minSfMaxQuant, sfbDist, sfbConstPePart, logSfbEnergy,
 			logSfbFormFactor, sfbNRelevantLines);
 	}
 
 	/* get max scalefac for global gain */
-	maxScf = MIN_16;                                                              
-	minScf = MAX_16;                                                              
+	maxScf = MIN_16;
+	minScf = MAX_16;
 	for (i=0; i<psyOutChan->sfbCnt; i++) {
-		
+
 		if (maxScf < scf[i]) {
-			maxScf = scf[i];                                                          
+			maxScf = scf[i];
 		}
-		
+
 		if ((scf[i] != MIN_16) && (minScf > scf[i])) {
-			minScf = scf[i];                                                          
+			minScf = scf[i];
 		}
 	}
 	/* limit scf delta */
 	maxAllowedScf = minScf + MAX_SCF_DELTA;
 	for(i=0; i<psyOutChan->sfbCnt; i++) {
-		
+
 		if ((scf[i] != MIN_16) && (maxAllowedScf < scf[i])) {
-			scf[i] = maxAllowedScf;                                                   
+			scf[i] = maxAllowedScf;
 		}
 	}
 	/* new maxScf if any scf has been limited */
-	
+
 	if (maxAllowedScf < maxScf) {
-		maxScf = maxAllowedScf;                                                     
+		maxScf = maxAllowedScf;
 	}
-	
+
 	/* calc loop scalefactors */
-	
+
 	if (maxScf > MIN_16) {
-		*globalGain = maxScf;                                                       
-		lastSf = 0;                                                                 
-		
+		*globalGain = maxScf;
+		lastSf = 0;
+
 		for(i=0; i<psyOutChan->sfbCnt; i++) {
-			
+
 			if (scf[i] == MIN_16) {
-				scf[i] = lastSf;                                                        
+				scf[i] = lastSf;
 				/* set band explicitely to zero */
 				for (j=psyOutChan->sfbOffsets[i]; j<psyOutChan->sfbOffsets[i+1]; j++) {
-					psyOutChan->mdctSpectrum[j] = 0;                                      
+					psyOutChan->mdctSpectrum[j] = 0;
 				}
 			}
 			else {
 				scf[i] = maxScf - scf[i];
-				lastSf = scf[i];                                                        
+				lastSf = scf[i];
 			}
 		}
 	}
 	else{
-		*globalGain = 0;                                                            
+		*globalGain = 0;
 		/* set spectrum explicitely to zero */
 		for(i=0; i<psyOutChan->sfbCnt; i++) {
-			scf[i] = 0;                                                               
+			scf[i] = 0;
 			for (j=psyOutChan->sfbOffsets[i]; j<psyOutChan->sfbOffsets[i+1]; j++) {
-				psyOutChan->mdctSpectrum[j] = 0;                                        
+				psyOutChan->mdctSpectrum[j] = 0;
 			}
 		}
 	}
@@ -848,7 +848,7 @@
                const Word16 nChannels)
 {
 	Word16 j;
-	
+
 	for (j=0; j<nChannels; j++) {
 		CalcFormFactorChannel(logSfbFormFactor[j], sfbNRelevantLines[j], logSfbEnergy[j], &psyOutChannel[j]);
 	}
@@ -869,7 +869,7 @@
                      const Word16    nChannels)
 {
 	Word16 j;
-	
+
 	for (j=0; j<nChannels; j++) {
 		EstimateScaleFactorsChannel(&psyOutChannel[j],
 			qcOutChannel[j].scf,
diff --git a/media/libstagefright/codecs/aacenc/src/stat_bits.c b/media/libstagefright/codecs/aacenc/src/stat_bits.c
index baa289c8..c2bd8bd 100644
--- a/media/libstagefright/codecs/aacenc/src/stat_bits.c
+++ b/media/libstagefright/codecs/aacenc/src/stat_bits.c
@@ -52,9 +52,9 @@
                               struct TOOLSINFO *toolsInfo)
 {
   Word16 msBits, sfbOff, sfb;
-  msBits = 0;                                            
+  msBits = 0;
 
-   
+
   switch(toolsInfo->msDigest) {
     case MS_NONE:
     case MS_ALL:
@@ -85,34 +85,34 @@
   Word32 coefBits;
   Word16 *ptcoef;
 
-  count = 0;       
-  
+  count = 0;
+
   if (blockType == 2)
     numOfWindows = 8;
   else
     numOfWindows = 1;
-  tnsPresent = 0;                                        
+  tnsPresent = 0;
 
   for (i=0; i<numOfWindows; i++) {
-     
+
     if (tnsInfo->tnsActive[i]!=0) {
-      tnsPresent = 1;                                    
+      tnsPresent = 1;
     }
   }
-   
+
   if (tnsPresent) {
     /* there is data to be written*/
     /*count += 1; */
     for (i=0; i<numOfWindows; i++) {
-       
+
       if (blockType == 2)
         count += 1;
       else
         count += 2;
-       
+
       if (tnsInfo->tnsActive[i]) {
         count += 1;
-         
+
         if (blockType == 2) {
           count += 4;
           count += 3;
@@ -121,29 +121,29 @@
           count += 6;
           count += 5;
         }
-         
+
         if (tnsInfo->order[i]) {
           count += 1; /*direction*/
-          count += 1; /*coef_compression */	
-           
+          count += 1; /*coef_compression */
+
           if (tnsInfo->coefRes[i] == 4) {
             ptcoef = tnsInfo->coef + i*TNS_MAX_ORDER_SHORT;
-			coefBits = 3;                                        
+			coefBits = 3;
             for(k=0; k<tnsInfo->order[i]; k++) {
-                 
+
               if ((ptcoef[k] > 3) || (ptcoef[k] < -4)) {
-                coefBits = 4;                                    
+                coefBits = 4;
                 break;
               }
             }
           }
           else {
-            coefBits = 2;                                        
+            coefBits = 2;
             ptcoef = tnsInfo->coef + i*TNS_MAX_ORDER_SHORT;
 			for(k=0; k<tnsInfo->order[i]; k++) {
-                 
+
               if ((ptcoef[k] > 1) || (ptcoef[k] < -2)) {
-                coefBits = 3;                                    
+                coefBits = 3;
                 break;
               }
             }
@@ -155,14 +155,14 @@
       }
     }
   }
-  
+
   return count;
 }
 
 /**********************************************************************************
 *
 * function name: countTnsBits
-* description:   count tns bit demand  
+* description:   count tns bit demand
 *
 **********************************************************************************/
 static Word16 countTnsBits(TNS_INFO *tnsInfo,Word16 blockType)
@@ -173,29 +173,29 @@
 /*********************************************************************************
 *
 * function name: countStaticBitdemand
-* description:   count static bit demand include tns  
+* description:   count static bit demand include tns
 *
 **********************************************************************************/
 Word16 countStaticBitdemand(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
                             PSY_OUT_ELEMENT *psyOutElement,
-                            Word16 channels, 
+                            Word16 channels,
 							Word16 adtsUsed)
 {
   Word32 statBits;
   Word32 ch;
-  
-  statBits = 0;                                                  
+
+  statBits = 0;
 
   /* if adts used, add 56 bits */
   if(adtsUsed) statBits += 56;
 
-   
+
   switch (channels) {
     case 1:
       statBits += SI_ID_BITS+SI_SCE_BITS+SI_ICS_BITS;
       statBits += countTnsBits(&(psyOutChannel[0].tnsInfo),
                                psyOutChannel[0].windowSequence);
-       
+
       switch(psyOutChannel[0].windowSequence){
         case LONG_WINDOW:
         case START_WINDOW:
@@ -215,7 +215,7 @@
 								  psyOutChannel[0].sfbPerGroup,
 								  psyOutChannel[0].maxSfbPerGroup,
 								  &psyOutElement->toolsInfo);
-       
+
       switch (psyOutChannel[0].windowSequence) {
         case LONG_WINDOW:
         case START_WINDOW:
diff --git a/media/libstagefright/codecs/aacenc/src/tns.c b/media/libstagefright/codecs/aacenc/src/tns.c
index 473e0a0..455a864 100644
--- a/media/libstagefright/codecs/aacenc/src/tns.c
+++ b/media/libstagefright/codecs/aacenc/src/tns.c
@@ -100,20 +100,20 @@
   /*  assert(freq >= 0);  */
   shift = norm_l(fs);
   lineNumber = (extract_l(fixmul((bandStartOffset[numOfBands] << 2),Div_32(freq << shift,fs << shift))) + 1) >> 1;
- 
+
   /* freq > fs/2 */
-  temp = lineNumber - bandStartOffset[numOfBands] ;                                            
+  temp = lineNumber - bandStartOffset[numOfBands] ;
   if (temp >= 0)
     return numOfBands;
 
   /* find band the line number lies in */
   for (band=0; band<numOfBands; band++) {
-    temp = bandStartOffset[band + 1] - lineNumber;                                           
+    temp = bandStartOffset[band + 1] - lineNumber;
     if (temp > 0) break;
   }
 
   temp = (lineNumber - bandStartOffset[band]);
-  temp = (temp - (bandStartOffset[band + 1] - lineNumber));                                   
+  temp = (temp - (bandStartOffset[band + 1] - lineNumber));
   if ( temp > 0 )
   {
     band = band + 1;
@@ -139,25 +139,25 @@
 {
 
   Word32 bitratePerChannel;
-  tC->maxOrder     = TNS_MAX_ORDER;                                           
+  tC->maxOrder     = TNS_MAX_ORDER;
   tC->tnsStartFreq = 1275;
-  tC->coefRes      = 4;                                                                                 
-  
+  tC->coefRes      = 4;
+
   /* to avoid integer division */
-  if ( sub(channels,2) == 0 ) { 
-    bitratePerChannel = bitRate >> 1;    
+  if ( sub(channels,2) == 0 ) {
+    bitratePerChannel = bitRate >> 1;
   }
   else {
-    bitratePerChannel = bitRate;                                                                    
+    bitratePerChannel = bitRate;
   }
 
   tC->tnsMaxSfb = tnsMaxBandsLongMainLow[pC->sampRateIdx];
 
-  tC->tnsActive = active;                                                                           
+  tC->tnsActive = active;
 
   /* now calc band and line borders */
   tC->tnsStopBand = min(pC->sfbCnt, tC->tnsMaxSfb);
-  tC->tnsStopLine = pC->sfbOffset[tC->tnsStopBand];                                                 
+  tC->tnsStopLine = pC->sfbOffset[tC->tnsStopBand];
 
   tC->tnsStartBand = FreqToBandWithRounding(tC->tnsStartFreq, sampleRate,
                                             pC->sfbCnt, (const Word16*)pC->sfbOffset);
@@ -173,18 +173,18 @@
                                                      (const Word16*)pC->sfbOffset);
 
 
-  tC->tnsStartLine = pC->sfbOffset[tC->tnsStartBand];                                                                                                             
+  tC->tnsStartLine = pC->sfbOffset[tC->tnsStartBand];
 
   tC->lpcStopBand = tnsMaxBandsLongMainLow[pC->sampRateIdx];
   tC->lpcStopBand = min(tC->lpcStopBand, pC->sfbActive);
 
-  tC->lpcStopLine = pC->sfbOffset[tC->lpcStopBand];   
-  
+  tC->lpcStopLine = pC->sfbOffset[tC->lpcStopBand];
+
   tC->lpcStartBand = tnsMinBandNumberLong[pC->sampRateIdx];
 
-  tC->lpcStartLine = pC->sfbOffset[tC->lpcStartBand];                                               
+  tC->lpcStartLine = pC->sfbOffset[tC->lpcStartBand];
 
-  tC->threshold = TNS_GAIN_THRESH;                                                             
+  tC->threshold = TNS_GAIN_THRESH;
 
 
   return(0);
@@ -207,23 +207,23 @@
   Word32 bitratePerChannel;
   tC->maxOrder     = TNS_MAX_ORDER_SHORT;
   tC->tnsStartFreq = 2750;
-  tC->coefRes      = 3;                                                                                 
-  
+  tC->coefRes      = 3;
+
   /* to avoid integer division */
   if ( sub(channels,2) == 0 ) {
-    bitratePerChannel = L_shr(bitRate,1);    
+    bitratePerChannel = L_shr(bitRate,1);
   }
   else {
-    bitratePerChannel = bitRate;                                                                    
+    bitratePerChannel = bitRate;
   }
 
   tC->tnsMaxSfb = tnsMaxBandsShortMainLow[pC->sampRateIdx];
 
-  tC->tnsActive = active;                                                                           
+  tC->tnsActive = active;
 
   /* now calc band and line borders */
   tC->tnsStopBand = min(pC->sfbCnt, tC->tnsMaxSfb);
-  tC->tnsStopLine = pC->sfbOffset[tC->tnsStopBand];                                                 
+  tC->tnsStopLine = pC->sfbOffset[tC->tnsStopBand];
 
   tC->tnsStartBand=FreqToBandWithRounding(tC->tnsStartFreq, sampleRate,
                                           pC->sfbCnt, (const Word16*)pC->sfbOffset);
@@ -239,19 +239,19 @@
                                                      (const Word16*)pC->sfbOffset);
 
 
-  tC->tnsStartLine = pC->sfbOffset[tC->tnsStartBand];                                               
+  tC->tnsStartLine = pC->sfbOffset[tC->tnsStartBand];
 
   tC->lpcStopBand = tnsMaxBandsShortMainLow[pC->sampRateIdx];
 
   tC->lpcStopBand = min(tC->lpcStopBand, pC->sfbActive);
 
-  tC->lpcStopLine = pC->sfbOffset[tC->lpcStopBand];                                                 
+  tC->lpcStopLine = pC->sfbOffset[tC->lpcStopBand];
 
   tC->lpcStartBand = tnsMinBandNumberShort[pC->sampRateIdx];
 
-  tC->lpcStartLine = pC->sfbOffset[tC->lpcStartBand];                                               
+  tC->lpcStartLine = pC->sfbOffset[tC->lpcStartBand];
 
-  tC->threshold = TNS_GAIN_THRESH;                                                             
+  tC->threshold = TNS_GAIN_THRESH;
 
   return(0);
 }
@@ -259,7 +259,7 @@
 /**
 *
 * function name: TnsDetect
-* description:  Calculate TNS filter and decide on TNS usage 
+* description:  Calculate TNS filter and decide on TNS usage
 * returns:		0 if success
 *
 */
@@ -278,7 +278,7 @@
   Word32* pWork32 = &pScratchTns[subBlockNumber >> 8];
   Word16* pWeightedSpectrum = (Word16 *)&pScratchTns[subBlockNumber >> 8];
 
-                                                                                                    
+
   if (tC.tnsActive) {
     CalcWeightedSpectrum(spectrum,
                          pWeightedSpectrum,
@@ -290,7 +290,7 @@
                          tC.lpcStopBand,
                          pWork32);
 
-    temp = blockType - SHORT_WINDOW;                                                          
+    temp = blockType - SHORT_WINDOW;
     if ( temp != 0 ) {
         predictionGain = CalcTnsFilter( &pWeightedSpectrum[tC.lpcStartLine],
                                         tC.acfWindow,
@@ -299,15 +299,15 @@
                                         tnsData->dataRaw.tnsLong.subBlockInfo.parcor);
 
 
-        temp = predictionGain - tC.threshold;                                                  
+        temp = predictionGain - tC.threshold;
         if ( temp > 0 ) {
-          tnsData->dataRaw.tnsLong.subBlockInfo.tnsActive = 1;                                      
+          tnsData->dataRaw.tnsLong.subBlockInfo.tnsActive = 1;
         }
         else {
-          tnsData->dataRaw.tnsLong.subBlockInfo.tnsActive = 0;                                      
+          tnsData->dataRaw.tnsLong.subBlockInfo.tnsActive = 0;
         }
 
-        tnsData->dataRaw.tnsLong.subBlockInfo.predictionGain = predictionGain;                      
+        tnsData->dataRaw.tnsLong.subBlockInfo.predictionGain = predictionGain;
     }
     else{
 
@@ -317,28 +317,28 @@
                                         tC.maxOrder,
                                         tnsData->dataRaw.tnsShort.subBlockInfo[subBlockNumber].parcor);
 
-        temp = predictionGain - tC.threshold;                                                 
+        temp = predictionGain - tC.threshold;
         if ( temp > 0 ) {
-          tnsData->dataRaw.tnsShort.subBlockInfo[subBlockNumber].tnsActive = 1;                     
+          tnsData->dataRaw.tnsShort.subBlockInfo[subBlockNumber].tnsActive = 1;
         }
         else {
-          tnsData->dataRaw.tnsShort.subBlockInfo[subBlockNumber].tnsActive = 0;                     
+          tnsData->dataRaw.tnsShort.subBlockInfo[subBlockNumber].tnsActive = 0;
         }
 
-        tnsData->dataRaw.tnsShort.subBlockInfo[subBlockNumber].predictionGain = predictionGain;     
+        tnsData->dataRaw.tnsShort.subBlockInfo[subBlockNumber].predictionGain = predictionGain;
     }
 
   }
   else{
 
-    temp = blockType - SHORT_WINDOW;                                                          
+    temp = blockType - SHORT_WINDOW;
     if ( temp != 0 ) {
-        tnsData->dataRaw.tnsLong.subBlockInfo.tnsActive = 0;                                        
-        tnsData->dataRaw.tnsLong.subBlockInfo.predictionGain = 0;                                   
+        tnsData->dataRaw.tnsLong.subBlockInfo.tnsActive = 0;
+        tnsData->dataRaw.tnsLong.subBlockInfo.predictionGain = 0;
     }
     else {
-        tnsData->dataRaw.tnsShort.subBlockInfo[subBlockNumber].tnsActive = 0;                       
-        tnsData->dataRaw.tnsShort.subBlockInfo[subBlockNumber].predictionGain = 0;                  
+        tnsData->dataRaw.tnsShort.subBlockInfo[subBlockNumber].tnsActive = 0;
+        tnsData->dataRaw.tnsShort.subBlockInfo[subBlockNumber].predictionGain = 0;
     }
   }
 
@@ -362,21 +362,21 @@
    const TNS_SUBBLOCK_INFO *sbInfoSrc;
    Word32 i, temp;
 
-   temp =  blockType - SHORT_WINDOW;                                                           
+   temp =  blockType - SHORT_WINDOW;
    if ( temp != 0 ) {
-      sbInfoDest = &tnsDataDest->dataRaw.tnsLong.subBlockInfo;                                      
-      sbInfoSrc  = &tnsDataSrc->dataRaw.tnsLong.subBlockInfo;                                       
+      sbInfoDest = &tnsDataDest->dataRaw.tnsLong.subBlockInfo;
+      sbInfoSrc  = &tnsDataSrc->dataRaw.tnsLong.subBlockInfo;
    }
    else {
-      sbInfoDest = &tnsDataDest->dataRaw.tnsShort.subBlockInfo[subBlockNumber];                     
-      sbInfoSrc  = &tnsDataSrc->dataRaw.tnsShort.subBlockInfo[subBlockNumber];                      
+      sbInfoDest = &tnsDataDest->dataRaw.tnsShort.subBlockInfo[subBlockNumber];
+      sbInfoSrc  = &tnsDataSrc->dataRaw.tnsShort.subBlockInfo[subBlockNumber];
    }
 
    if (100*abs_s(sbInfoDest->predictionGain - sbInfoSrc->predictionGain) <
        (3 * sbInfoDest->predictionGain)) {
-      sbInfoDest->tnsActive = sbInfoSrc->tnsActive;                                                 
+      sbInfoDest->tnsActive = sbInfoSrc->tnsActive;
       for ( i=0; i< tC.maxOrder; i++) {
-        sbInfoDest->parcor[i] = sbInfoSrc->parcor[i];                                               
+        sbInfoDest->parcor[i] = sbInfoSrc->parcor[i];
       }
    }
 }
@@ -402,11 +402,11 @@
   Word32 temp;
   TNS_SUBBLOCK_INFO *psubBlockInfo;
 
-  temp_s = blockType - SHORT_WINDOW;                                                             
-  if ( temp_s != 0) {                                                                               
+  temp_s = blockType - SHORT_WINDOW;
+  if ( temp_s != 0) {
     psubBlockInfo = &tnsData->dataRaw.tnsLong.subBlockInfo;
 	if (psubBlockInfo->tnsActive == 0) {
-      tnsInfo->tnsActive[subBlockNumber] = 0;                                                       
+      tnsInfo->tnsActive[subBlockNumber] = 0;
       return(0);
     }
     else {
@@ -422,22 +422,22 @@
                    tC.coefRes);
 
       for (i=tC.maxOrder - 1; i>=0; i--)  {
-        temp = psubBlockInfo->parcor[i] - TNS_PARCOR_THRESH;         
+        temp = psubBlockInfo->parcor[i] - TNS_PARCOR_THRESH;
         if ( temp > 0 )
           break;
-        temp = psubBlockInfo->parcor[i] + TNS_PARCOR_THRESH;         
+        temp = psubBlockInfo->parcor[i] + TNS_PARCOR_THRESH;
         if ( temp < 0 )
           break;
       }
-      tnsInfo->order[subBlockNumber] = i + 1;                                                    
+      tnsInfo->order[subBlockNumber] = i + 1;
 
 
-      tnsInfo->tnsActive[subBlockNumber] = 1;                                                       
+      tnsInfo->tnsActive[subBlockNumber] = 1;
       for (i=subBlockNumber+1; i<TRANS_FAC; i++) {
-        tnsInfo->tnsActive[i] = 0;                                                                  
+        tnsInfo->tnsActive[i] = 0;
       }
-      tnsInfo->coefRes[subBlockNumber] = tC.coefRes;                                                
-      tnsInfo->length[subBlockNumber] = numOfSfb - tC.tnsStartBand;                                 
+      tnsInfo->coefRes[subBlockNumber] = tC.coefRes;
+      tnsInfo->length[subBlockNumber] = numOfSfb - tC.tnsStartBand;
 
 
       AnalysisFilterLattice(&(spectrum[tC.tnsStartLine]),
@@ -448,10 +448,10 @@
 
     }
   }     /* if (blockType!=SHORT_WINDOW) */
-  else /*short block*/ {                                                                            
+  else /*short block*/ {
     psubBlockInfo = &tnsData->dataRaw.tnsShort.subBlockInfo[subBlockNumber];
 	if (psubBlockInfo->tnsActive == 0) {
-      tnsInfo->tnsActive[subBlockNumber] = 0;                                                       
+      tnsInfo->tnsActive[subBlockNumber] = 0;
       return(0);
     }
     else {
@@ -466,19 +466,19 @@
                    tC.maxOrder,
                    tC.coefRes);
       for (i=(tC.maxOrder - 1); i>=0; i--)  {
-        temp = psubBlockInfo->parcor[i] - TNS_PARCOR_THRESH;    
+        temp = psubBlockInfo->parcor[i] - TNS_PARCOR_THRESH;
          if ( temp > 0 )
           break;
 
-        temp = psubBlockInfo->parcor[i] + TNS_PARCOR_THRESH;    
+        temp = psubBlockInfo->parcor[i] + TNS_PARCOR_THRESH;
         if ( temp < 0 )
           break;
       }
-      tnsInfo->order[subBlockNumber] = i + 1;                                                    
+      tnsInfo->order[subBlockNumber] = i + 1;
 
-      tnsInfo->tnsActive[subBlockNumber] = 1;                                                       
-      tnsInfo->coefRes[subBlockNumber] = tC.coefRes;                                                
-      tnsInfo->length[subBlockNumber] = numOfSfb - tC.tnsStartBand;                             
+      tnsInfo->tnsActive[subBlockNumber] = 1;
+      tnsInfo->coefRes[subBlockNumber] = tC.coefRes;
+      tnsInfo->length[subBlockNumber] = numOfSfb - tC.tnsStartBand;
 
 
       AnalysisFilterLattice(&(spectrum[tC.tnsStartLine]), (tC.tnsStopLine - tC.tnsStartLine),
@@ -507,14 +507,14 @@
 {
   Word32 k;
 
-  Word32 accu_y = 0x40000000;                                                                     
+  Word32 accu_y = 0x40000000;
   accu_y = L_shr(accu_y,scale);
 
   for(k=1; k<INT_BITS; k++) {
-    const Word32 z = m_log2_table[k];                                                             
+    const Word32 z = m_log2_table[k];
 
     while(L_sub(x,z) >= 0) {
-       
+
       x = L_sub(x, z);
       accu_y = L_add(accu_y, (accu_y >> k));
     }
@@ -548,43 +548,43 @@
     Word32 maxWS;
     Word32 tnsSfbMean[MAX_SFB];    /* length [lpcStopBand-lpcStartBand] should be sufficient here */
 
-    maxWS = 0;                                                                                   
-  
+    maxWS = 0;
+
     /* calc 1.0*2^-INT_BITS/2/sqrt(en) */
     for( sfb = lpcStartBand; sfb < lpcStopBand; sfb++) {
 
-      tmp2 = sfbEnergy[sfb] - 2;                                                            
+      tmp2 = sfbEnergy[sfb] - 2;
       if( tmp2 > 0) {
         tmp = rsqrt(sfbEnergy[sfb], INT_BITS);
-		if(tmp > INT_BITS_SCAL) 
+		if(tmp > INT_BITS_SCAL)
 		{
 			shift =  norm_l(tmp);
-			tmp = Div_32( INT_BITS_SCAL << shift, tmp << shift ); 
+			tmp = Div_32( INT_BITS_SCAL << shift, tmp << shift );
 		}
 		else
 		{
-			tmp = 0x7fffffff; 
+			tmp = 0x7fffffff;
 		}
       }
       else {
-        tmp = 0x7fffffff;                                                                           
-      } 
-      tnsSfbMean[sfb] = tmp;                                                                        
+        tmp = 0x7fffffff;
+      }
+      tnsSfbMean[sfb] = tmp;
     }
 
     /* spread normalized values from sfbs to lines */
-    sfb = lpcStartBand;                                                                             
-    tmp = tnsSfbMean[sfb];                                                                          
+    sfb = lpcStartBand;
+    tmp = tnsSfbMean[sfb];
     for ( i=lpcStartLine; i<lpcStopLine; i++){
-      tmp_s = sfbOffset[sfb + 1] - i;                                                      
+      tmp_s = sfbOffset[sfb + 1] - i;
       if ( tmp_s == 0 ) {
         sfb = sfb + 1;
-        tmp2_s = sfb + 1 - lpcStopBand;                                                       
+        tmp2_s = sfb + 1 - lpcStopBand;
         if (tmp2_s <= 0) {
-          tmp = tnsSfbMean[sfb];                                                                    
+          tmp = tnsSfbMean[sfb];
         }
       }
-      pWork32[i] = tmp;                                                                    
+      pWork32[i] = tmp;
     }
     /*filter down*/
     for (i=(lpcStopLine - 2); i>=lpcStartLine; i--){
@@ -597,8 +597,8 @@
 
     /* weight and normalize */
     for (i=lpcStartLine; i<lpcStopLine; i++){
-      pWork32[i] = MULHIGH(pWork32[i], spectrum[i]);                               
-      maxWS |= L_abs(pWork32[i]);                                                          
+      pWork32[i] = MULHIGH(pWork32[i], spectrum[i]);
+      maxWS |= L_abs(pWork32[i]);
     }
     maxShift = norm_l(maxWS);
 
@@ -646,7 +646,7 @@
   assert(tnsOrder <= TNS_MAX_ORDER);      /* remove asserts later? (btg) */
 
   for(i=0;i<tnsOrder;i++) {
-    parcor[i] = 0;                               
+    parcor[i] = 0;
   }
 
   AutoCorrelation(signal, parcorWorkBuffer, numOfLines, tnsOrderPlus1);
@@ -678,15 +678,15 @@
   Word32 accu;
   Word32 scf;
 
-  scf = 10 - 1;                                                                                      
+  scf = 10 - 1;
 
   isamples = samples;
   /* calc first corrCoef:  R[0] = sum { t[i] * t[i] } ; i = 0..N-1 */
-  accu = 0;                                                                                      
+  accu = 0;
   for(j=0; j<isamples; j++) {
     accu = L_add(accu, ((input[j] * input[j]) >> scf));
   }
-  corr[0] = accu;                                                                                
+  corr[0] = accu;
 
   /* early termination if all corr coeffs are likely going to be zero */
   if(corr[0] == 0) return ;
@@ -694,13 +694,13 @@
   /* calc all other corrCoef:  R[j] = sum { t[i] * t[i+j] } ; i = 0..(N-j-1), j=1..p */
   for(i=1; i<corrCoeff; i++) {
     isamples = isamples - 1;
-    accu = 0;                                                                                    
+    accu = 0;
     for(j=0; j<isamples; j++) {
       accu = L_add(accu, ((input[j] * input[j+i]) >> scf));
     }
-    corr[i] = accu;                                                                              
+    corr[i] = accu;
   }
-}    
+}
 #endif
 
 /*****************************************************************************
@@ -720,20 +720,20 @@
   Word32 predictionGain = 0;
   Word32 num, denom;
   Word32 temp, workBuffer0;
-   
 
-  num = workBuffer[0];                                                                           
-  temp = workBuffer[numOfCoeff];                                                                 
+
+  num = workBuffer[0];
+  temp = workBuffer[numOfCoeff];
 
   for(i=0; i<numOfCoeff-1; i++) {
-    workBuffer[i + numOfCoeff] = workBuffer[i + 1];                                        
+    workBuffer[i + numOfCoeff] = workBuffer[i + 1];
   }
-  workBuffer[i + numOfCoeff] = temp;                                                                           
-  
+  workBuffer[i + numOfCoeff] = temp;
+
   for(i=0; i<numOfCoeff; i++) {
     Word32 refc;
 
-     
+
     if (workBuffer[0] < L_abs(workBuffer[i + numOfCoeff])) {
       return 0 ;
     }
@@ -742,21 +742,21 @@
     /* calculate refc = -workBuffer[numOfCoeff+i] / workBuffer[0]; -1 <= refc < 1 */
 	refc = L_negate(fixmul(workBuffer[numOfCoeff + i], workBuffer0));
 
-    reflCoeff[i] = refc;                                                                           
+    reflCoeff[i] = refc;
 
-    pWorkBuffer = &(workBuffer[numOfCoeff]);                                                        
+    pWorkBuffer = &(workBuffer[numOfCoeff]);
 
     for(j=i; j<numOfCoeff; j++) {
       Word32 accu1, accu2;
       accu1 = L_add(pWorkBuffer[j], fixmul(refc, workBuffer[j - i]));
       accu2 = L_add(workBuffer[j - i], fixmul(refc, pWorkBuffer[j]));
-      pWorkBuffer[j] = accu1;                                                                       
-      workBuffer[j - i] = accu2;                                                                 
+      pWorkBuffer[j] = accu1;
+      workBuffer[j - i] = accu2;
     }
   }
 
   denom = MULHIGH(workBuffer[0], NORM_COEF);
-   
+
   if (denom != 0) {
     Word32 temp;
 	shift = norm_l(denom);
@@ -774,11 +774,11 @@
   Word32 index = 0;
   Word32 i;
   Word32 temp;
-   
+
   for (i=0;i<8;i++) {
-    temp = L_sub( parcor, tnsCoeff3Borders[i]);                                                     
+    temp = L_sub( parcor, tnsCoeff3Borders[i]);
     if (temp > 0)
-      index=i;                                                                                      
+      index=i;
   }
   return extract_l(index - 4);
 }
@@ -788,12 +788,12 @@
   Word32 index = 0;
   Word32 i;
   Word32 temp;
-   
+
 
   for (i=0;i<16;i++) {
-    temp = L_sub(parcor, tnsCoeff4Borders[i]);                                                      
+    temp = L_sub(parcor, tnsCoeff4Borders[i]);
     if (temp > 0)
-      index=i;                                                                                      
+      index=i;
   }
   return extract_l(index - 8);
 }
@@ -814,12 +814,12 @@
   Word32 temp;
 
   for(i=0; i<order; i++) {
-    temp = bitsPerCoeff - 3;                                                                    
+    temp = bitsPerCoeff - 3;
     if (temp == 0) {
-      index[i] = Search3(parcor[i]);                                                                
-    } 
+      index[i] = Search3(parcor[i]);
+    }
     else {
-      index[i] = Search4(parcor[i]);                                                                
+      index[i] = Search4(parcor[i]);
     }
   }
 }
@@ -839,12 +839,12 @@
   Word32 temp;
 
   for (i=0; i<order; i++) {
-    temp = bitsPerCoeff - 4;                                                                     
+    temp = bitsPerCoeff - 4;
     if ( temp == 0 ) {
-        parcor[i] = tnsCoeff4[index[i] + 8];                                                     
+        parcor[i] = tnsCoeff4[index[i] + 8];
     }
     else {
-        parcor[i] = tnsCoeff3[index[i] + 4];                                                  
+        parcor[i] = tnsCoeff3[index[i] + 4];
     }
   }
 }
@@ -865,20 +865,20 @@
    Word32 accu,tmp,tmpSave;
 
    x = x >> 1;
-   tmpSave = x;                                                                                     
+   tmpSave = x;
 
    for (i=0; i<(order - 1); i++) {
 
      tmp = L_add(fixmul(coef_par[i], x), state_par[i]);
      x   = L_add(fixmul(coef_par[i], state_par[i]), x);
 
-     state_par[i] = tmpSave;                                                                        
-     tmpSave = tmp;                                                                                 
+     state_par[i] = tmpSave;
+     tmpSave = tmp;
   }
 
   /* last stage: only need half operations */
   accu = fixmul(state_par[order - 1], coef_par[(order - 1)]);
-  state_par[(order - 1)] = tmpSave;                                                                
+  state_par[(order - 1)] = tmpSave;
 
   x = L_add(accu, x);
   x = L_add(x, x);
@@ -903,11 +903,11 @@
   Word32 j;
 
   for ( j=0; j<TNS_MAX_ORDER; j++ ) {
-    state_par[j] = 0;                                                                               
+    state_par[j] = 0;
   }
 
   for(j=0; j<numOfLines; j++) {
-    output[j] = FIRLattice(order,signal[j],state_par,parCoeff);                                     
+    output[j] = FIRLattice(order,signal[j],state_par,parCoeff);
   }
 }
 
@@ -922,11 +922,11 @@
                                TNS_SUBBLOCK_INFO subInfo, /*!< TNS subblock info */
                                Word32 *thresholds)        /*!< thresholds (modified) */
 {
-  Word32 i;                                                                                         
+  Word32 i;
   if (subInfo.tnsActive) {
     for(i=startCb; i<stopCb; i++) {
       /* thresholds[i] * 0.25 */
-      thresholds[i] = (thresholds[i] >> 2);                                                      
+      thresholds[i] = (thresholds[i] >> 2);
     }
   }
 }
diff --git a/media/libstagefright/codecs/aacenc/src/transform.c b/media/libstagefright/codecs/aacenc/src/transform.c
index 4d11f78..a02336f 100644
--- a/media/libstagefright/codecs/aacenc/src/transform.c
+++ b/media/libstagefright/codecs/aacenc/src/transform.c
@@ -31,7 +31,7 @@
 #define swap2(p0,p1) \
 	t = p0; t1 = *(&(p0)+1);	\
 	p0 = p1; *(&(p0)+1) = *(&(p1)+1);	\
-	p1 = t; *(&(p1)+1) = t1	
+	p1 = t; *(&(p1)+1) = t1
 
 /*********************************************************************************
 *
@@ -47,18 +47,18 @@
 
 	part0 = buf;
     part1 = buf + num;
-	
+
 	while ((i = *bitTab++) != 0) {
         j = *bitTab++;
 
-        swap2(part0[4*i+0], part0[4*j+0]);	
-        swap2(part0[4*i+2], part1[4*j+0]);	
-        swap2(part1[4*i+0], part0[4*j+2]);	
-        swap2(part1[4*i+2], part1[4*j+2]);	
+        swap2(part0[4*i+0], part0[4*j+0]);
+        swap2(part0[4*i+2], part1[4*j+0]);
+        swap2(part1[4*i+0], part0[4*j+2]);
+        swap2(part1[4*i+2], part1[4*j+2]);
     }
 
     do {
-        swap2(part0[4*i+2], part1[4*i+0]);	
+        swap2(part0[4*i+2], part1[4*i+0]);
     } while ((i = *bitTab++) != 0);
 }
 
@@ -74,8 +74,8 @@
 {
     int r0, r1, r2, r3;
 	int r4, r5, r6, r7;
-	
-	for (; num != 0; num--) 
+
+	for (; num != 0; num--)
 	{
 		r0 = buf[0] + buf[2];
 		r1 = buf[1] + buf[3];
@@ -113,7 +113,7 @@
    int i4, i5, i6, i7;
    int t0, t1, t2, t3;
 
-	for ( ; num != 0; num--) 
+	for ( ; num != 0; num--)
 	{
 		r0 = buf[0] + buf[2];
 		i0 = buf[1] + buf[3];
@@ -194,23 +194,23 @@
 	int i, j, step;
 	int *xptr, *csptr;
 
-	for (num >>= 2; num != 0; num >>= 2) 
+	for (num >>= 2; num != 0; num >>= 2)
 	{
 		step = 2*bgn;
 		xptr = buf;
 
-    	for (i = num; i != 0; i--) 
+    	for (i = num; i != 0; i--)
 		{
 			csptr = twidTab;
 
-			for (j = bgn; j != 0; j--) 
+			for (j = bgn; j != 0; j--)
 			{
 				r0 = xptr[0];
 				r1 = xptr[1];
 				xptr += step;
-				
+
 				t0 = xptr[0];
-				t1 = xptr[1];				
+				t1 = xptr[1];
 				cosx = csptr[0];
 				sinx = csptr[1];
 				r2 = MULHIGH(cosx, t0) + MULHIGH(sinx, t1);		/* cos*br + sin*bi */
@@ -223,7 +223,7 @@
 				r1 = t1 - r3;
 				r2 = t0 + r2;
 				r3 = t1 + r3;
-				
+
 				t0 = xptr[0];
 				t1 = xptr[1];
 				cosx = csptr[2];
@@ -231,7 +231,7 @@
 				r4 = MULHIGH(cosx, t0) + MULHIGH(sinx, t1);		/* cos*cr + sin*ci */
 				r5 = MULHIGH(cosx, t1) - MULHIGH(sinx, t0);		/* cos*ci - sin*cr */
 				xptr += step;
-				
+
 				t0 = xptr[0];
 				t1 = xptr[1];
 				cosx = csptr[4];
@@ -282,25 +282,25 @@
 	int tr1, ti1, tr2, ti2;
 	int cosa, sina, cosb, sinb;
 	int *buf1;
-	
+
 	buf1 = buf0 + num - 1;
 
 	for(i = num >> 2; i != 0; i--)
 	{
-		cosa = *csptr++;	
-		sina = *csptr++;	
-		cosb = *csptr++;	
-		sinb = *csptr++;		
+		cosa = *csptr++;
+		sina = *csptr++;
+		cosb = *csptr++;
+		sinb = *csptr++;
 
 		tr1 = *(buf0 + 0);
 		ti2 = *(buf0 + 1);
 		tr2 = *(buf1 - 1);
 		ti1 = *(buf1 + 0);
-		
+
 		*buf0++ = MULHIGH(cosa, tr1) + MULHIGH(sina, ti1);
-		*buf0++ = MULHIGH(cosa, ti1) - MULHIGH(sina, tr1);		
-		
-		*buf1-- = MULHIGH(cosb, ti2) - MULHIGH(sinb, tr2);		
+		*buf0++ = MULHIGH(cosa, ti1) - MULHIGH(sina, tr1);
+
+		*buf1-- = MULHIGH(cosb, ti2) - MULHIGH(sinb, tr2);
 		*buf1-- = MULHIGH(cosb, tr2) + MULHIGH(sinb, ti2);
 	}
 }
@@ -319,12 +319,12 @@
 	int *buf1;
 
 	buf1 = buf0 + num - 1;
-	
+
 	for(i = num >> 2; i != 0; i--)
 	{
-		cosa = *csptr++;	
-		sina = *csptr++;	
-		cosb = *csptr++;	
+		cosa = *csptr++;
+		sina = *csptr++;
+		cosb = *csptr++;
 		sinb = *csptr++;
 
 		tr1 = *(buf0 + 0);
@@ -333,12 +333,18 @@
 		tr2 = *(buf1 - 1);
 
 		*buf0++ = MULHIGH(cosa, tr1) + MULHIGH(sina, ti1);
-		*buf1-- = MULHIGH(sina, tr1) - MULHIGH(cosa, ti1);		
-		
+		*buf1-- = MULHIGH(sina, tr1) - MULHIGH(cosa, ti1);
+
 		*buf0++ = MULHIGH(sinb, tr2) - MULHIGH(cosb, ti2);
-		*buf1-- = MULHIGH(cosb, tr2) + MULHIGH(sinb, ti2);	
+		*buf1-- = MULHIGH(cosb, tr2) + MULHIGH(sinb, ti2);
 	}
 }
+#else
+void Radix4First(int *buf, int num);
+void Radix8First(int *buf, int num);
+void Radix4FFT(int *buf, int num, int bgn, int *twidTab);
+void PreMDCT(int *buf0, int num, const int *csptr);
+void PostMDCT(int *buf0, int num, const int *csptr);
 #endif
 
 
@@ -353,17 +359,17 @@
 	PreMDCT(buf, 1024, cossintab + 128);
 
 	Shuffle(buf, 512, bitrevTab + 17);
-	Radix8First(buf, 512 >> 3);						
+	Radix8First(buf, 512 >> 3);
 	Radix4FFT(buf, 512 >> 3, 8, (int *)twidTab512);
 
-	PostMDCT(buf, 1024, cossintab + 128);	
+	PostMDCT(buf, 1024, cossintab + 128);
 }
 
 
 /**********************************************************************************
 *
 * function name: Mdct_Short
-* description:  the short block mdct 
+* description:  the short block mdct
 *
 **********************************************************************************/
 void Mdct_Short(int *buf)
@@ -371,10 +377,10 @@
 	PreMDCT(buf, 128, cossintab);
 
 	Shuffle(buf, 64, bitrevTab);
-	Radix4First(buf, 64 >> 2);						
-	Radix4FFT(buf, 64 >> 2, 4, (int *)twidTab64);	
+	Radix4First(buf, 64 >> 2);
+	Radix4FFT(buf, 64 >> 2, 4, (int *)twidTab64);
 
-	PostMDCT(buf, 128, cossintab);	
+	PostMDCT(buf, 128, cossintab);
 }
 
 
@@ -382,7 +388,7 @@
 *
 * function name: shiftMdctDelayBuffer
 * description:    the mdct delay buffer has a size of 1600,
-*  so the calculation of LONG,STOP must be  spilt in two 
+*  so the calculation of LONG,STOP must be  spilt in two
 *  passes with 1024 samples and a mid shift,
 *  the SHORT transforms can be completed in the delay buffer,
 *  and afterwards a shift
@@ -409,7 +415,7 @@
 	dsBuf = timeSignal;
 
 	for(i=0; i<FRAME_LEN_LONG; i+=8)
-	{   
+	{
 		*srBuf++ = *dsBuf; dsBuf += chIncrement;
 		*srBuf++ = *dsBuf; dsBuf += chIncrement;
 		*srBuf++ = *dsBuf; dsBuf += chIncrement;
@@ -470,10 +476,10 @@
 
 	Word32 delayBufferSf,timeSignalSf,minSf;
 	Word32 headRoom=0;
-	
+
 	switch(blockType){
-		
-		
+
+
 	case LONG_WINDOW:
 		/*
 		we access BLOCK_SWITCHING_OFFSET (1600 ) delay buffer samples + 448 new timeSignal samples
@@ -483,15 +489,15 @@
 		timeSignalSf  = getScalefactorOfShortVectorStride(timeSignal,2*FRAME_LEN_LONG-BLOCK_SWITCHING_OFFSET,chIncrement);
 		minSf = min(delayBufferSf,timeSignalSf);
 		minSf = min(minSf,14);
-		
+
 		dctIn0 = mdctDelayBuffer;
 		dctIn1 = mdctDelayBuffer + FRAME_LEN_LONG - 1;
 		outData0 = realOut + FRAME_LEN_LONG/2;
-		
+
 		/* add windows and pre add for mdct to last buffer*/
 		winPtr = (int *)LongWindowKBD;
 		for(i=0;i<FRAME_LEN_LONG/2;i++){
-			timeSignalSample = (*dctIn0++) << minSf; 
+			timeSignalSample = (*dctIn0++) << minSf;
 			ws1 = timeSignalSample * (*winPtr >> 16);
 			timeSignalSample = (*dctIn1--) << minSf;
 			ws2 = timeSignalSample * (*winPtr & 0xffff);
@@ -499,30 +505,30 @@
 			/* shift 2 to avoid overflow next */
 			*outData0++ = (ws1 >> 2) - (ws2 >> 2);
 		}
-		
+
 		shiftMdctDelayBuffer(mdctDelayBuffer,timeSignal,chIncrement);
-		
+
 		/* add windows and pre add for mdct to new buffer*/
 		dctIn0 = mdctDelayBuffer;
 		dctIn1 = mdctDelayBuffer + FRAME_LEN_LONG - 1;
-		outData0 = realOut + FRAME_LEN_LONG/2 - 1; 
+		outData0 = realOut + FRAME_LEN_LONG/2 - 1;
 		winPtr = (int *)LongWindowKBD;
-		for(i=0;i<FRAME_LEN_LONG/2;i++){    
+		for(i=0;i<FRAME_LEN_LONG/2;i++){
 			timeSignalSample = (*dctIn0++) << minSf;
 			ws1 = timeSignalSample * (*winPtr & 0xffff);
 			timeSignalSample = (*dctIn1--) << minSf;
 			ws2 = timeSignalSample * (*winPtr >> 16);
 			winPtr++;
 			/* shift 2 to avoid overflow next */
-			*outData0-- = -((ws1 >> 2) + (ws2 >> 2)); 
+			*outData0-- = -((ws1 >> 2) + (ws2 >> 2));
 		}
 
 		Mdct_Long(realOut);
 		/* update scale factor */
 		minSf = 14 - minSf;
-		*mdctScale=minSf; 
+		*mdctScale=minSf;
 		break;
-		
+
 	case START_WINDOW:
 		/*
 		we access BLOCK_SWITCHING_OFFSET (1600 ) delay buffer samples + no timeSignal samples
@@ -533,7 +539,7 @@
 
 		dctIn0 = mdctDelayBuffer;
 		dctIn1 = mdctDelayBuffer + FRAME_LEN_LONG - 1;
-		outData0 = realOut + FRAME_LEN_LONG/2; 		
+		outData0 = realOut + FRAME_LEN_LONG/2;
 		winPtr = (int *)LongWindowKBD;
 
 		/* add windows and pre add for mdct to last buffer*/
@@ -545,18 +551,18 @@
 			winPtr ++;
 			*outData0++ = (ws1 >> 2) - (ws2 >> 2);  /* shift 2 to avoid overflow next */
 		}
-		
+
 		shiftMdctDelayBuffer(mdctDelayBuffer,timeSignal,chIncrement);
-		
-		outData0 = realOut + FRAME_LEN_LONG/2 - 1; 
+
+		outData0 = realOut + FRAME_LEN_LONG/2 - 1;
 		for(i=0;i<LS_TRANS;i++){
-			*outData0-- = -mdctDelayBuffer[i] << (15 - 2 + minSf);  
+			*outData0-- = -mdctDelayBuffer[i] << (15 - 2 + minSf);
 		}
-		
+
 		/* add windows and pre add for mdct to new buffer*/
 		dctIn0 = mdctDelayBuffer + LS_TRANS;
 		dctIn1 = mdctDelayBuffer + FRAME_LEN_LONG - 1 - LS_TRANS;
-		outData0 = realOut + FRAME_LEN_LONG/2 - 1 -LS_TRANS; 
+		outData0 = realOut + FRAME_LEN_LONG/2 - 1 -LS_TRANS;
 		winPtr = (int *)ShortWindowSine;
 		for(i=0;i<FRAME_LEN_SHORT/2;i++){
 			timeSignalSample= (*dctIn0++) << minSf;
@@ -572,7 +578,7 @@
 		minSf = 14 - minSf;
 		*mdctScale= minSf;
 		break;
-		
+
 	case STOP_WINDOW:
 		/*
 		we access BLOCK_SWITCHING_OFFSET-LS_TRANS (1600-448 ) delay buffer samples + 448 new timeSignal samples
@@ -580,19 +586,19 @@
 		*/
 		delayBufferSf = getScalefactorOfShortVectorStride(mdctDelayBuffer+LS_TRANS,BLOCK_SWITCHING_OFFSET-LS_TRANS,1);
 		timeSignalSf  = getScalefactorOfShortVectorStride(timeSignal,2*FRAME_LEN_LONG-BLOCK_SWITCHING_OFFSET,chIncrement);
-		minSf = min(delayBufferSf,timeSignalSf);    
+		minSf = min(delayBufferSf,timeSignalSf);
 		minSf = min(minSf,13);
-		
+
 		outData0 = realOut + FRAME_LEN_LONG/2;
 		dctIn1 = mdctDelayBuffer + FRAME_LEN_LONG - 1;
 		for(i=0;i<LS_TRANS;i++){
-			*outData0++ = -(*dctIn1--) << (15 - 2 + minSf);    
+			*outData0++ = -(*dctIn1--) << (15 - 2 + minSf);
 		}
-		
+
 		/* add windows and pre add for mdct to last buffer*/
 		dctIn0 = mdctDelayBuffer + LS_TRANS;
 		dctIn1 = mdctDelayBuffer + FRAME_LEN_LONG - 1 - LS_TRANS;
-		outData0 = realOut + FRAME_LEN_LONG/2 + LS_TRANS; 
+		outData0 = realOut + FRAME_LEN_LONG/2 + LS_TRANS;
 		winPtr = (int *)ShortWindowSine;
 		for(i=0;i<FRAME_LEN_SHORT/2;i++){
 			timeSignalSample = (*dctIn0++) << minSf;
@@ -602,13 +608,13 @@
 			winPtr++;
 			*outData0++ = (ws1 >> 2) - (ws2 >> 2);  /* shift 2 to avoid overflow next */
 		}
-		
+
 		shiftMdctDelayBuffer(mdctDelayBuffer,timeSignal,chIncrement);
-		
+
 		/* add windows and pre add for mdct to new buffer*/
 		dctIn0 = mdctDelayBuffer;
 		dctIn1 = mdctDelayBuffer + FRAME_LEN_LONG - 1;
-		outData0 = realOut + FRAME_LEN_LONG/2 - 1; 
+		outData0 = realOut + FRAME_LEN_LONG/2 - 1;
 		winPtr = (int *)LongWindowKBD;
 		for(i=0;i<FRAME_LEN_LONG/2;i++){
 			timeSignalSample= (*dctIn0++) << minSf;
@@ -618,26 +624,26 @@
 			*outData0-- =  -((ws1 >> 2) + (ws2 >> 2));  /* shift 2 to avoid overflow next */
 			winPtr++;
 		}
-		
+
 		Mdct_Long(realOut);
 		minSf = 14 - minSf;
 		*mdctScale= minSf; /* update scale factor */
 		break;
-		
+
 	case SHORT_WINDOW:
 		/*
 		we access BLOCK_SWITCHING_OFFSET (1600 ) delay buffer samples + no new timeSignal samples
 		and get the biggest scale factor for next calculate more precise
-		*/		
+		*/
 		minSf = getScalefactorOfShortVectorStride(mdctDelayBuffer+TRANSFORM_OFFSET_SHORT,9*FRAME_LEN_SHORT,1);
 		minSf = min(minSf,10);
-		
-		
+
+
 		for(w=0;w<TRANS_FAC;w++){
 			dctIn0 = mdctDelayBuffer+w*FRAME_LEN_SHORT+TRANSFORM_OFFSET_SHORT;
 			dctIn1 = mdctDelayBuffer+w*FRAME_LEN_SHORT+TRANSFORM_OFFSET_SHORT + FRAME_LEN_SHORT-1;
-			outData0 = realOut + FRAME_LEN_SHORT/2; 
-			outData1 = realOut + FRAME_LEN_SHORT/2 - 1; 
+			outData0 = realOut + FRAME_LEN_SHORT/2;
+			outData1 = realOut + FRAME_LEN_SHORT/2 - 1;
 
 			winPtr = (int *)ShortWindowSine;
 			for(i=0;i<FRAME_LEN_SHORT/2;i++){
@@ -646,7 +652,7 @@
 				timeSignalSample= *dctIn1 << minSf;
 				ws2 = timeSignalSample * (*winPtr & 0xffff);
 				*outData0++ = (ws1 >> 2) - (ws2 >> 2);  /* shift 2 to avoid overflow next */
-				
+
 				timeSignalSample= *(dctIn0 + FRAME_LEN_SHORT) << minSf;
 				ws1 = timeSignalSample * (*winPtr & 0xffff);
 				timeSignalSample= *(dctIn1 + FRAME_LEN_SHORT) << minSf;
@@ -661,10 +667,10 @@
 			Mdct_Short(realOut);
 			realOut += FRAME_LEN_SHORT;
 		}
-		
+
 		minSf = 11 - minSf;
 		*mdctScale = minSf; /* update scale factor */
-		
+
 		shiftMdctDelayBuffer(mdctDelayBuffer,timeSignal,chIncrement);
 		break;
   }
diff --git a/media/libstagefright/codecs/amrnb/common/include/az_lsp.h b/media/libstagefright/codecs/amrnb/common/include/az_lsp.h
index 3e15ba3..7c24ca9 100644
--- a/media/libstagefright/codecs/amrnb/common/include/az_lsp.h
+++ b/media/libstagefright/codecs/amrnb/common/include/az_lsp.h
@@ -83,7 +83,7 @@
     ; EXTERNAL VARIABLES REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern Word16 grid[];
+    extern const Word16 grid[];
 
     /*----------------------------------------------------------------------------
     ; SIMPLE TYPEDEF'S
diff --git a/media/libstagefright/codecs/amrnb/common/include/inv_sqrt.h b/media/libstagefright/codecs/amrnb/common/include/inv_sqrt.h
index 4fb2b11..91ab3e4 100644
--- a/media/libstagefright/codecs/amrnb/common/include/inv_sqrt.h
+++ b/media/libstagefright/codecs/amrnb/common/include/inv_sqrt.h
@@ -85,7 +85,7 @@
     ; EXTERNAL VARIABLES REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern Word16 inv_sqrt_tbl[];
+    extern const Word16 inv_sqrt_tbl[];
     /*----------------------------------------------------------------------------
     ; SIMPLE TYPEDEF'S
     ----------------------------------------------------------------------------*/
diff --git a/media/libstagefright/codecs/amrnb/common/include/log2_norm.h b/media/libstagefright/codecs/amrnb/common/include/log2_norm.h
index b104a69..46b4e4d 100644
--- a/media/libstagefright/codecs/amrnb/common/include/log2_norm.h
+++ b/media/libstagefright/codecs/amrnb/common/include/log2_norm.h
@@ -85,7 +85,7 @@
     ; EXTERNAL VARIABLES REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern Word16 log2_tbl[];
+    extern const Word16 log2_tbl[];
     /*----------------------------------------------------------------------------
     ; SIMPLE TYPEDEF'S
     ----------------------------------------------------------------------------*/
diff --git a/media/libstagefright/codecs/amrnb/common/include/pow2.h b/media/libstagefright/codecs/amrnb/common/include/pow2.h
index c96fbdd..9b944eb 100644
--- a/media/libstagefright/codecs/amrnb/common/include/pow2.h
+++ b/media/libstagefright/codecs/amrnb/common/include/pow2.h
@@ -81,7 +81,7 @@
     ; EXTERNAL VARIABLES REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern Word16 pow2_tbl[];
+    extern const Word16 pow2_tbl[];
     /*----------------------------------------------------------------------------
     ; SIMPLE TYPEDEF'S
     ----------------------------------------------------------------------------*/
diff --git a/media/libstagefright/codecs/amrnb/common/include/sqrt_l.h b/media/libstagefright/codecs/amrnb/common/include/sqrt_l.h
index 86209bd..a6a2ee5 100644
--- a/media/libstagefright/codecs/amrnb/common/include/sqrt_l.h
+++ b/media/libstagefright/codecs/amrnb/common/include/sqrt_l.h
@@ -82,7 +82,7 @@
     ; EXTERNAL VARIABLES REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern Word16 sqrt_l_tbl[];
+    extern const Word16 sqrt_l_tbl[];
 
     /*----------------------------------------------------------------------------
     ; SIMPLE TYPEDEF'S
diff --git a/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp b/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp
index bd99b30..4135f30 100644
--- a/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp
@@ -299,7 +299,7 @@
     t0 += (Word32) * (p_f) << 13;
 
 
-    if ((UWord32)(t0 - 0xfe000000L) < 0x01ffffffL -  0xfe000000L)
+    if ((UWord32)(t0 - 0xfe000000L) < (UWord32)0x03ffffffL)
     {
         cheb = (Word16)(t0 >> 10);
     }
diff --git a/media/libstagefright/codecs/amrnb/common/src/bitno_tab.cpp b/media/libstagefright/codecs/amrnb/common/src/bitno_tab.cpp
index fed684d..4ee04a5 100644
--- a/media/libstagefright/codecs/amrnb/common/src/bitno_tab.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/bitno_tab.cpp
@@ -152,7 +152,7 @@
     ; Variable declaration - defined here and used outside this module
     ----------------------------------------------------------------------------*/
     /* number of parameters per modes (values must be <= MAX_PRM_SIZE!) */
-    extern const Word16 prmno[N_MODES] =
+    const Word16 prmno[N_MODES] =
     {
         PRMNO_MR475,
         PRMNO_MR515,
@@ -166,7 +166,7 @@
     };
 
     /* number of parameters to first subframe per modes */
-    extern const Word16 prmnofsf[N_MODES - 1] =
+    const Word16 prmnofsf[N_MODES - 1] =
     {
         PRMNOFSF_MR475,
         PRMNOFSF_MR515,
@@ -179,7 +179,7 @@
     };
 
     /* parameter sizes (# of bits), one table per mode */
-    extern const Word16 bitno_MR475[PRMNO_MR475] =
+    const Word16 bitno_MR475[PRMNO_MR475] =
     {
         8, 8, 7,                                 /* LSP VQ          */
         8, 7, 2, 8,                              /* first subframe  */
@@ -188,7 +188,7 @@
         4, 7, 2,                                 /* fourth subframe */
     };
 
-    extern const Word16 bitno_MR515[PRMNO_MR515] =
+    const Word16 bitno_MR515[PRMNO_MR515] =
     {
         8, 8, 7,                                 /* LSP VQ          */
         8, 7, 2, 6,                              /* first subframe  */
@@ -197,7 +197,7 @@
         4, 7, 2, 6,                              /* fourth subframe */
     };
 
-    extern const Word16 bitno_MR59[PRMNO_MR59] =
+    const Word16 bitno_MR59[PRMNO_MR59] =
     {
         8, 9, 9,                                 /* LSP VQ          */
         8, 9, 2, 6,                              /* first subframe  */
@@ -206,7 +206,7 @@
         4, 9, 2, 6,                              /* fourth subframe */
     };
 
-    extern const Word16 bitno_MR67[PRMNO_MR67] =
+    const Word16 bitno_MR67[PRMNO_MR67] =
     {
         8, 9, 9,                                 /* LSP VQ          */
         8, 11, 3, 7,                             /* first subframe  */
@@ -215,7 +215,7 @@
         4, 11, 3, 7,                             /* fourth subframe */
     };
 
-    extern const Word16 bitno_MR74[PRMNO_MR74] =
+    const Word16 bitno_MR74[PRMNO_MR74] =
     {
         8, 9, 9,                                 /* LSP VQ          */
         8, 13, 4, 7,                             /* first subframe  */
@@ -224,7 +224,7 @@
         5, 13, 4, 7,                             /* fourth subframe */
     };
 
-    extern const Word16 bitno_MR795[PRMNO_MR795] =
+    const Word16 bitno_MR795[PRMNO_MR795] =
     {
         9, 9, 9,                                 /* LSP VQ          */
         8, 13, 4, 4, 5,                          /* first subframe  */
@@ -233,7 +233,7 @@
         6, 13, 4, 4, 5,                          /* fourth subframe */
     };
 
-    extern const Word16 bitno_MR102[PRMNO_MR102] =
+    const Word16 bitno_MR102[PRMNO_MR102] =
     {
         8, 9, 9,                                 /* LSP VQ          */
         8, 1, 1, 1, 1, 10, 10, 7, 7,             /* first subframe  */
@@ -242,7 +242,7 @@
         5, 1, 1, 1, 1, 10, 10, 7, 7,             /* fourth subframe */
     };
 
-    extern const Word16 bitno_MR122[PRMNO_MR122] =
+    const Word16 bitno_MR122[PRMNO_MR122] =
     {
         7, 8, 9, 8, 6,                           /* LSP VQ          */
         9, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5,   /* first subframe  */
@@ -251,7 +251,7 @@
         6, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5    /* fourth subframe */
     };
 
-    extern const Word16 bitno_MRDTX[PRMNO_MRDTX] =
+    const Word16 bitno_MRDTX[PRMNO_MRDTX] =
     {
         3,
         8, 9, 9,
@@ -259,7 +259,7 @@
     };
 
     /* overall table with all parameter sizes for all modes */
-    extern const Word16 * const bitno[N_MODES] =
+    const Word16 * const bitno[N_MODES] =
     {
         bitno_MR475,
         bitno_MR515,
diff --git a/media/libstagefright/codecs/amrnb/common/src/bitreorder_tab.cpp b/media/libstagefright/codecs/amrnb/common/src/bitreorder_tab.cpp
index 69b20fb..e284bbc 100644
--- a/media/libstagefright/codecs/amrnb/common/src/bitreorder_tab.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/bitreorder_tab.cpp
@@ -123,6 +123,7 @@
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 #include "typedef.h"
+#include "bitreorder_tab.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -171,7 +172,7 @@
     ; Variable declaration - defined here and used outside this module
     ----------------------------------------------------------------------------*/
     /* number of parameters per modes (values must be <= MAX_PRM_SIZE!) */
-    extern const Word16 numOfBits[NUM_MODES] =
+    const Word16 numOfBits[NUM_MODES] =
     {
         NUMBIT_MR475,
         NUMBIT_MR515,
@@ -191,7 +192,7 @@
         NUMBIT_NO_DATA
     };
 
-    extern const Word16 reorderBits_MR475[NUMBIT_MR475] =
+    const Word16 reorderBits_MR475[NUMBIT_MR475] =
     {
         0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
         10, 11, 12, 13, 14, 15, 23, 24, 25, 26,
@@ -205,7 +206,7 @@
         92, 31, 52, 65, 86
     };
 
-    extern const Word16 reorderBits_MR515[NUMBIT_MR515] =
+    const Word16 reorderBits_MR515[NUMBIT_MR515] =
     {
         7,  6,  5,  4,  3,  2,  1,  0, 15, 14,
         13, 12, 11, 10,  9,  8, 23, 24, 25, 26,
@@ -220,7 +221,7 @@
         53, 72, 91
     };
 
-    extern const Word16 reorderBits_MR59[NUMBIT_MR59] =
+    const Word16 reorderBits_MR59[NUMBIT_MR59] =
     {
         0,  1,  4,  5,  3,  6,  7,  2, 13, 15,
         8,  9, 11, 12, 14, 10, 16, 28, 74, 29,
@@ -236,7 +237,7 @@
         38, 59, 84, 105, 37, 58, 83, 104
     };
 
-    extern const Word16 reorderBits_MR67[NUMBIT_MR67] =
+    const Word16 reorderBits_MR67[NUMBIT_MR67] =
     {
         0,  1,  4,  3,  5,  6, 13,  7,  2,  8,
         9, 11, 15, 12, 14, 10, 28, 82, 29, 83,
@@ -254,7 +255,7 @@
         36, 61, 90, 115
     };
 
-    extern const Word16 reorderBits_MR74[NUMBIT_MR74] =
+    const Word16 reorderBits_MR74[NUMBIT_MR74] =
     {
         0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
         10, 11, 12, 13, 14, 15, 16, 26, 87, 27,
@@ -273,7 +274,7 @@
         39, 68, 100, 129, 40, 69, 101, 130
     };
 
-    extern const Word16 reorderBits_MR795[NUMBIT_MR795] =
+    const Word16 reorderBits_MR795[NUMBIT_MR795] =
     {
         8,  7,  6,  5,  4,  3,  2, 14, 16,  9,
         10, 12, 13, 15, 11, 17, 20, 22, 24, 23,
@@ -293,7 +294,7 @@
         139, 37, 69, 103, 135, 38, 70, 104, 136
     };
 
-    extern const Word16 reorderBits_MR102[NUMBIT_MR102] =
+    const Word16 reorderBits_MR102[NUMBIT_MR102] =
     {
         7,  6,  5,  4,  3,  2,  1,  0, 16, 15,
         14, 13, 12, 11, 10,  9,  8, 26, 27, 28,
@@ -318,7 +319,7 @@
         63, 46, 55, 56
     };
 
-    extern const Word16 reorderBits_MR122[NUMBIT_MR122] =
+    const Word16 reorderBits_MR122[NUMBIT_MR122] =
     {
         0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
         10, 11, 12, 13, 14, 23, 15, 16, 17, 18,
@@ -348,7 +349,7 @@
     };
 
     /* overall table with all parameter sizes for all modes */
-    extern const Word16 * const reorderBits[NUM_MODES-1] =
+    const Word16 * const reorderBits[NUM_MODES-1] =
     {
         reorderBits_MR475,
         reorderBits_MR515,
@@ -361,7 +362,7 @@
     };
 
     /* Number of Frames (16-bit segments sent for each mode */
-    extern const Word16 numCompressedBytes[16] =
+    const Word16 numCompressedBytes[16] =
     {
         13, /*4.75*/
         14, /*5.15*/
diff --git a/media/libstagefright/codecs/amrnb/common/src/bytesused.cpp b/media/libstagefright/codecs/amrnb/common/src/bytesused.cpp
index 9552206..b61bac4 100644
--- a/media/libstagefright/codecs/amrnb/common/src/bytesused.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/bytesused.cpp
@@ -152,7 +152,7 @@
     ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
     ; Variable declaration - defined here and used outside this module
     ----------------------------------------------------------------------------*/
-    extern const short BytesUsed[16] =
+    const short BytesUsed[16] =
     {
         13, /* 4.75 */
         14, /* 5.15 */
diff --git a/media/libstagefright/codecs/amrnb/common/src/c2_9pf_tab.cpp b/media/libstagefright/codecs/amrnb/common/src/c2_9pf_tab.cpp
index 471bee8..20de9d6 100644
--- a/media/libstagefright/codecs/amrnb/common/src/c2_9pf_tab.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/c2_9pf_tab.cpp
@@ -86,7 +86,8 @@
     ; LOCAL VARIABLE DEFINITIONS
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
-    extern const Word16 startPos[2*4*2] = {0, 2, 0, 3,
+    extern const Word16 startPos[];
+    const Word16 startPos[2*4*2] = {0, 2, 0, 3,
         0, 2, 0, 3,
         1, 3, 2, 4,
         1, 4, 1, 4
diff --git a/media/libstagefright/codecs/amrnb/common/src/gains_tbl.cpp b/media/libstagefright/codecs/amrnb/common/src/gains_tbl.cpp
index a08dd2d..a7cd6fb 100644
--- a/media/libstagefright/codecs/amrnb/common/src/gains_tbl.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/gains_tbl.cpp
@@ -86,14 +86,16 @@
     ----------------------------------------------------------------------------*/
 
 
-    extern const Word16 qua_gain_pitch[NB_QUA_PITCH] =
+    extern const Word16 qua_gain_pitch[];
+    const Word16 qua_gain_pitch[NB_QUA_PITCH] =
     {
         0, 3277, 6556, 8192, 9830, 11469, 12288, 13107,
         13926, 14746, 15565, 16384, 17203, 18022, 18842, 19661
     };
 
 
-    extern const Word16 qua_gain_code[(NB_QUA_CODE+1)*3] =
+    extern const Word16 qua_gain_code[];
+    const Word16 qua_gain_code[(NB_QUA_CODE+1)*3] =
     {
         /* gain factor (g_fac) and quantized energy error (qua_ener_MR122, qua_ener)
          * are stored:
diff --git a/media/libstagefright/codecs/amrnb/common/src/gray_tbl.cpp b/media/libstagefright/codecs/amrnb/common/src/gray_tbl.cpp
index 99073d9..c4b2dbc 100644
--- a/media/libstagefright/codecs/amrnb/common/src/gray_tbl.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/gray_tbl.cpp
@@ -83,8 +83,10 @@
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
 
-    extern const Word16 gray[8]  = {0, 1, 3, 2, 6, 4, 5, 7};
-    extern const Word16 dgray[8] = {0, 1, 3, 2, 5, 6, 4, 7};
+    extern const Word16 gray[];
+    extern const Word16 dgray[];
+    const Word16 gray[8]  = {0, 1, 3, 2, 6, 4, 5, 7};
+    const Word16 dgray[8] = {0, 1, 3, 2, 5, 6, 4, 7};
 
     /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
diff --git a/media/libstagefright/codecs/amrnb/common/src/grid_tbl.cpp b/media/libstagefright/codecs/amrnb/common/src/grid_tbl.cpp
index cd81566..48566cc 100644
--- a/media/libstagefright/codecs/amrnb/common/src/grid_tbl.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/grid_tbl.cpp
@@ -63,6 +63,7 @@
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 #include "typedef.h"
+#include "az_lsp.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -91,7 +92,7 @@
     ; LOCAL VARIABLE DEFINITIONS
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
-    extern const Word16 grid[grid_points + 1] =
+    const Word16 grid[grid_points + 1] =
     {
         32760, 32723, 32588, 32364, 32051, 31651,
         31164, 30591, 29935, 29196, 28377, 27481,
diff --git a/media/libstagefright/codecs/amrnb/common/src/inv_sqrt_tbl.cpp b/media/libstagefright/codecs/amrnb/common/src/inv_sqrt_tbl.cpp
index bde2c4e..13c3b24 100644
--- a/media/libstagefright/codecs/amrnb/common/src/inv_sqrt_tbl.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/inv_sqrt_tbl.cpp
@@ -55,6 +55,7 @@
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 #include "typedef.h"
+#include "inv_sqrt.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -82,7 +83,7 @@
     ; LOCAL VARIABLE DEFINITIONS
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
-    extern const Word16 inv_sqrt_tbl[49] =
+    const Word16 inv_sqrt_tbl[49] =
     {
 
         32767, 31790, 30894, 30070, 29309, 28602, 27945, 27330, 26755, 26214,
diff --git a/media/libstagefright/codecs/amrnb/common/src/log2_tbl.cpp b/media/libstagefright/codecs/amrnb/common/src/log2_tbl.cpp
index 25d63b2..9b9b099 100644
--- a/media/libstagefright/codecs/amrnb/common/src/log2_tbl.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/log2_tbl.cpp
@@ -54,6 +54,7 @@
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 #include "typedef.h"
+#include "log2_norm.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -82,7 +83,7 @@
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
 
-    extern const Word16 log2_tbl[33] =
+    const Word16 log2_tbl[33] =
     {
         0, 1455, 2866, 4236, 5568, 6863, 8124, 9352, 10549, 11716,
         12855, 13967, 15054, 16117, 17156, 18172, 19167, 20142, 21097, 22033,
diff --git a/media/libstagefright/codecs/amrnb/common/src/lsp_lsf_tbl.cpp b/media/libstagefright/codecs/amrnb/common/src/lsp_lsf_tbl.cpp
index cee0f32..ddeeba4 100644
--- a/media/libstagefright/codecs/amrnb/common/src/lsp_lsf_tbl.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/lsp_lsf_tbl.cpp
@@ -77,7 +77,8 @@
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
 
-    extern const Word16 table[65] =
+    extern const Word16 table[];
+    const Word16 table[65] =
     {
         32767, 32729, 32610, 32413, 32138, 31786, 31357, 30853,
         30274, 29622, 28899, 28106, 27246, 26320, 25330, 24279,
@@ -94,7 +95,8 @@
 
     /* slope used to compute y = acos(x) */
 
-    extern const Word16 slope[64] =
+    extern const Word16 slope[];
+    const Word16 slope[64] =
     {
         -26887, -8812, -5323, -3813, -2979, -2444, -2081, -1811,
         -1608, -1450, -1322, -1219, -1132, -1059, -998, -946,
diff --git a/media/libstagefright/codecs/amrnb/common/src/lsp_tab.cpp b/media/libstagefright/codecs/amrnb/common/src/lsp_tab.cpp
index deded93..0a32dd7a 100644
--- a/media/libstagefright/codecs/amrnb/common/src/lsp_tab.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/lsp_tab.cpp
@@ -117,6 +117,7 @@
 ----------------------------------------------------------------------------*/
 #include    "typedef.h"
 #include    "cnst.h"
+#include    "lsp_tab.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -146,7 +147,7 @@
     ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
     ; Variable declaration - defined here and used outside this module
     ----------------------------------------------------------------------------*/
-    extern const Word16 lsp_init_data[M] = {30000, 26000, 21000, 15000, 8000,
+    const Word16 lsp_init_data[M] = {30000, 26000, 21000, 15000, 8000,
         0, -8000, -15000, -21000, -26000
     };
 
diff --git a/media/libstagefright/codecs/amrnb/common/src/overflow_tbl.cpp b/media/libstagefright/codecs/amrnb/common/src/overflow_tbl.cpp
index e5d42d6..c4a016d 100644
--- a/media/libstagefright/codecs/amrnb/common/src/overflow_tbl.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/overflow_tbl.cpp
@@ -81,7 +81,7 @@
     ; LOCAL VARIABLE DEFINITIONS
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
-    extern const Word32 overflow_tbl [32]   = {0x7fffffffL, 0x3fffffffL,
+    const Word32 overflow_tbl [32]   = {0x7fffffffL, 0x3fffffffL,
         0x1fffffffL, 0x0fffffffL,
         0x07ffffffL, 0x03ffffffL,
         0x01ffffffL, 0x00ffffffL,
diff --git a/media/libstagefright/codecs/amrnb/common/src/ph_disp_tab.cpp b/media/libstagefright/codecs/amrnb/common/src/ph_disp_tab.cpp
index 99725df..d568b78 100644
--- a/media/libstagefright/codecs/amrnb/common/src/ph_disp_tab.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/ph_disp_tab.cpp
@@ -81,14 +81,16 @@
     ; LOCAL VARIABLE DEFINITIONS
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
-    extern const Word16 ph_imp_low_MR795[40] =
+    extern const Word16 ph_imp_low_MR795[];
+    const Word16 ph_imp_low_MR795[40] =
     {
         26777,    801,   2505,   -683,  -1382,    582,    604,  -1274,   3511,  -5894,
         4534,   -499,  -1940,   3011,  -5058,   5614,  -1990,  -1061,  -1459,   4442,
         -700,  -5335,   4609,    452,   -589,  -3352,   2953,   1267,  -1212,  -2590,
         1731,   3670,  -4475,   -975,   4391,  -2537,    949,  -1363,   -979,   5734
     };
-    extern const Word16 ph_imp_mid_MR795[40] =
+    extern const Word16 ph_imp_mid_MR795[];
+    const Word16 ph_imp_mid_MR795[40] =
     {
         30274,   3831,  -4036,   2972,  -1048,  -1002,   2477,  -3043,   2815,  -2231,
         1753,  -1611,   1714,  -1775,   1543,  -1008,    429,   -169,    472,  -1264,
@@ -96,14 +98,16 @@
         -2063,   2644,  -3060,   2897,  -1978,    557,    780,  -1369,    842,    655
     };
 
-    extern const Word16 ph_imp_low[40] =
+    extern const Word16 ph_imp_low[];
+    const Word16 ph_imp_low[40] =
     {
         14690,  11518,   1268,  -2761,  -5671,   7514,    -35,  -2807,  -3040,   4823,
         2952,  -8424,   3785,   1455,   2179,  -8637,   8051,  -2103,  -1454,    777,
         1108,  -2385,   2254,   -363,   -674,  -2103,   6046,  -5681,   1072,   3123,
         -5058,   5312,  -2329,  -3728,   6924,  -3889,    675,  -1775,     29,  10145
     };
-    extern const Word16 ph_imp_mid[40] =
+    extern const Word16 ph_imp_mid[];
+    const Word16 ph_imp_mid[40] =
     {
         30274,   3831,  -4036,   2972,  -1048,  -1002,   2477,  -3043,   2815,  -2231,
         1753,  -1611,   1714,  -1775,   1543,  -1008,    429,   -169,    472,  -1264,
diff --git a/media/libstagefright/codecs/amrnb/common/src/pow2_tbl.cpp b/media/libstagefright/codecs/amrnb/common/src/pow2_tbl.cpp
index e0183a6..902ea0f 100644
--- a/media/libstagefright/codecs/amrnb/common/src/pow2_tbl.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/pow2_tbl.cpp
@@ -53,6 +53,7 @@
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 #include "typedef.h"
+#include "pow2.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -81,7 +82,7 @@
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
 
-    extern const Word16 pow2_tbl[33] =
+    const Word16 pow2_tbl[33] =
     {
         16384, 16743, 17109, 17484, 17867, 18258, 18658, 19066, 19484, 19911,
         20347, 20792, 21247, 21713, 22188, 22674, 23170, 23678, 24196, 24726,
diff --git a/media/libstagefright/codecs/amrnb/common/src/q_plsf_5_tbl.cpp b/media/libstagefright/codecs/amrnb/common/src/q_plsf_5_tbl.cpp
index ceb1e1e..caa81cb 100644
--- a/media/libstagefright/codecs/amrnb/common/src/q_plsf_5_tbl.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/q_plsf_5_tbl.cpp
@@ -56,6 +56,7 @@
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 #include "typedef.h"
+#include "q_plsf_5_tbl.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -94,7 +95,7 @@
     ----------------------------------------------------------------------------*/
     /* LSF means ->normalize frequency domain */
 
-    extern const Word16 mean_lsf_5[10] =
+    const Word16 mean_lsf_5[10] =
     {
         1384,
         2077,
@@ -108,7 +109,7 @@
         13701
     };
 
-    extern const Word16 dico1_lsf_5[DICO1_5_SIZE * 4] =
+    const Word16 dico1_lsf_5[DICO1_5_SIZE * 4] =
     {
         -451, -1065, -529, -1305,
         -450, -756, -497, -863,
@@ -240,7 +241,7 @@
         1469, 2181, 1443, 2016
     };
 
-    extern const Word16 dico2_lsf_5[DICO2_5_SIZE * 4] =
+    const Word16 dico2_lsf_5[DICO2_5_SIZE * 4] =
     {
         -1631, -1600, -1796, -2290,
         -1027, -1770, -1100, -2025,
@@ -500,7 +501,7 @@
         2374, 2787, 1821, 2788
     };
 
-    extern const Word16 dico3_lsf_5[DICO3_5_SIZE * 4] =
+    const Word16 dico3_lsf_5[DICO3_5_SIZE * 4] =
     {
         -1812, -2275, -1879, -2537,
         -1640, -1848, -1695, -2004,
@@ -760,7 +761,7 @@
         2180, 1975, 2326, 2020
     };
 
-    extern const Word16 dico4_lsf_5[DICO4_5_SIZE * 4] =
+    const Word16 dico4_lsf_5[DICO4_5_SIZE * 4] =
     {
         -1857, -1681, -1857, -1755,
         -2056, -1150, -2134, -1654,
@@ -1020,7 +1021,7 @@
         1716, 1376, 1948, 1465
     };
 
-    extern const Word16 dico5_lsf_5[DICO5_5_SIZE * 4] =
+    const Word16 dico5_lsf_5[DICO5_5_SIZE * 4] =
     {
         -1002, -929, -1096, -1203,
         -641, -931, -604, -961,
diff --git a/media/libstagefright/codecs/amrnb/common/src/qua_gain_tbl.cpp b/media/libstagefright/codecs/amrnb/common/src/qua_gain_tbl.cpp
index 52f77e9..2d913b8 100644
--- a/media/libstagefright/codecs/amrnb/common/src/qua_gain_tbl.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/qua_gain_tbl.cpp
@@ -54,6 +54,7 @@
 ----------------------------------------------------------------------------*/
 #include "typedef.h"
 #include "qua_gain.h"
+#include "qua_gain_tbl.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -96,7 +97,7 @@
 
     /* table used in 'high' rates: MR67 MR74 */
 
-    extern const Word16 table_gain_highrates[VQ_SIZE_HIGHRATES*4] =
+    const Word16 table_gain_highrates[VQ_SIZE_HIGHRATES*4] =
     {
 
         /*
@@ -240,7 +241,7 @@
 
     /* table used in 'low' rates: MR475, MR515, MR59 */
 
-    extern const Word16 table_gain_lowrates[VQ_SIZE_LOWRATES*4] =
+    const Word16 table_gain_lowrates[VQ_SIZE_LOWRATES*4] =
     {
         /*g_pit,    g_fac,  qua_ener_MR122, qua_ener */
         10813,    28753,            2879,    17333,
diff --git a/media/libstagefright/codecs/amrnb/common/src/sqrt_l_tbl.cpp b/media/libstagefright/codecs/amrnb/common/src/sqrt_l_tbl.cpp
index 5e9898c..5a84b63 100644
--- a/media/libstagefright/codecs/amrnb/common/src/sqrt_l_tbl.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/sqrt_l_tbl.cpp
@@ -58,6 +58,7 @@
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 #include "typedef.h"
+#include "sqrt_l.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -85,7 +86,7 @@
     ; LOCAL VARIABLE DEFINITIONS
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
-    extern const Word16 sqrt_l_tbl[50] =
+    const Word16 sqrt_l_tbl[50] =
     {
         16384, 16888, 17378, 17854, 18318, 18770, 19212, 19644, 20066, 20480,
         20886, 21283, 21674, 22058, 22435, 22806, 23170, 23530, 23884, 24232,
diff --git a/media/libstagefright/codecs/amrnb/common/src/window_tab.cpp b/media/libstagefright/codecs/amrnb/common/src/window_tab.cpp
index fa5faa6..d8fc8cc 100644
--- a/media/libstagefright/codecs/amrnb/common/src/window_tab.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/window_tab.cpp
@@ -117,6 +117,7 @@
 ----------------------------------------------------------------------------*/
 #include    "typedef.h"
 #include    "cnst.h"
+#include    "window_tab.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -154,7 +155,7 @@
 
     /* window for non-EFR modesm; uses 40 samples lookahead */
 
-    extern const Word16 window_200_40[L_WINDOW] =
+    const Word16 window_200_40[L_WINDOW] =
     {
         2621,  2623,  2629,  2638,  2651,  2668,  2689,  2713,  2741,  2772,
         2808,  2847,  2890,  2936,  2986,  3040,  3097,  3158,  3223,  3291,
@@ -185,7 +186,7 @@
 
     /* window for EFR, first two subframes, no lookahead */
 
-    extern const Word16 window_160_80[L_WINDOW] =
+    const Word16 window_160_80[L_WINDOW] =
     {
         2621, 2624, 2633, 2648, 2668, 2695, 2727, 2765, 2809, 2859,
         2915, 2976, 3043, 3116, 3194, 3279, 3368, 3464, 3565, 3671,
@@ -215,7 +216,7 @@
 
     /* window for EFR, last two subframes, no lookahead */
 
-    extern const Word16 window_232_8[L_WINDOW] =
+    const Word16 window_232_8[L_WINDOW] =
     {
         2621, 2623, 2627, 2634, 2644, 2656, 2671, 2689, 2710, 2734,
         2760, 2789, 2821, 2855, 2893, 2933, 2975, 3021, 3069, 3120,
diff --git a/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp b/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
index c0a588f..7602f2d 100644
--- a/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
+++ b/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
@@ -304,7 +304,7 @@
                   MIME_IETF);
 
             if (numBytesRead == -1) {
-                LOGE("PV AMR decoder AMRDecode() call failed");
+                ALOGE("PV AMR decoder AMRDecode() call failed");
 
                 notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
                 mSignalledError = true;
diff --git a/media/libstagefright/codecs/amrnb/dec/src/dec_input_format_tab.cpp b/media/libstagefright/codecs/amrnb/dec/src/dec_input_format_tab.cpp
index a59f5fa..fffbbfd 100644
--- a/media/libstagefright/codecs/amrnb/dec/src/dec_input_format_tab.cpp
+++ b/media/libstagefright/codecs/amrnb/dec/src/dec_input_format_tab.cpp
@@ -121,6 +121,7 @@
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 #include "typedef.h"
+#include "amrdecode.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -152,7 +153,7 @@
     ----------------------------------------------------------------------------*/
     /* Table containing the number of core AMR data bytes for                */
     /* each codec mode for WMF input format(number excludes frame type byte) */
-    extern const Word16 WmfDecBytesPerFrame[16] =
+    const Word16 WmfDecBytesPerFrame[16] =
     {
         12, /* 4.75 */
         13, /* 5.15 */
@@ -174,7 +175,7 @@
 
     /* Table containing the number of core AMR data bytes for   */
     /* each codec mode for IF2 input format.                    */
-    extern const Word16 If2DecBytesPerFrame[16] =
+    const Word16 If2DecBytesPerFrame[16] =
     {
         13, /* 4.75 */
         14, /* 5.15 */
diff --git a/media/libstagefright/codecs/amrnb/dec/src/qgain475_tab.cpp b/media/libstagefright/codecs/amrnb/dec/src/qgain475_tab.cpp
index fbcd412..1a08efa 100644
--- a/media/libstagefright/codecs/amrnb/dec/src/qgain475_tab.cpp
+++ b/media/libstagefright/codecs/amrnb/dec/src/qgain475_tab.cpp
@@ -92,7 +92,7 @@
      *    g_fac(2)          (Q12) // frame 1 and 3
      *
      */
-    extern const Word16 table_gain_MR475[MR475_VQ_SIZE*4] =
+    const Word16 table_gain_MR475[MR475_VQ_SIZE*4] =
     {
         /*g_pit(0), g_fac(0),      g_pit(1), g_fac(1) */
         812,          128,           542,      140,
diff --git a/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp b/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp
index d361ef4..3afbc4f 100644
--- a/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp
+++ b/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp
@@ -71,7 +71,7 @@
 
 status_t AMRNBEncoder::start(MetaData *params) {
     if (mStarted) {
-        LOGW("Call start() when encoder already started");
+        ALOGW("Call start() when encoder already started");
         return OK;
     }
 
@@ -84,7 +84,7 @@
 
     status_t err = mSource->start(params);
     if (err != OK) {
-        LOGE("AudioSource is not available");
+        ALOGE("AudioSource is not available");
         return err;
     }
 
@@ -105,7 +105,7 @@
 
 status_t AMRNBEncoder::stop() {
     if (!mStarted) {
-        LOGW("Call stop() when encoder has not started.");
+        ALOGW("Call stop() when encoder has not started.");
         return OK;
     }
 
diff --git a/media/libstagefright/codecs/amrnb/enc/src/corrwght_tab.cpp b/media/libstagefright/codecs/amrnb/enc/src/corrwght_tab.cpp
index 769e7ba..b3ed02d 100644
--- a/media/libstagefright/codecs/amrnb/enc/src/corrwght_tab.cpp
+++ b/media/libstagefright/codecs/amrnb/enc/src/corrwght_tab.cpp
@@ -57,6 +57,7 @@
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 #include "typedef.h"
+#include "p_ol_wgh.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -84,7 +85,7 @@
     ; LOCAL VARIABLE DEFINITIONS
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
-    extern const Word16 corrweight[251] =
+    const Word16 corrweight[251] =
     {
         20473,  20506,  20539,  20572,  20605,  20644,  20677,
         20716,  20749,  20788,  20821,  20860,  20893,  20932,
diff --git a/media/libstagefright/codecs/amrnb/enc/src/enc_output_format_tab.cpp b/media/libstagefright/codecs/amrnb/enc/src/enc_output_format_tab.cpp
index 147989f..4551fd7 100644
--- a/media/libstagefright/codecs/amrnb/enc/src/enc_output_format_tab.cpp
+++ b/media/libstagefright/codecs/amrnb/enc/src/enc_output_format_tab.cpp
@@ -117,6 +117,7 @@
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 #include "typedef.h"
+#include "amrencode.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -150,7 +151,7 @@
     /* for WMF output format.                                       */
     /* Each entry is the sum of the 3GPP frame type byte and the    */
     /* number of packed core AMR data bytes                         */
-    extern const Word16 WmfEncBytesPerFrame[16] =
+    const Word16 WmfEncBytesPerFrame[16] =
     {
         13, /* 4.75 */
         14, /* 5.15 */
@@ -173,7 +174,7 @@
 
     /* Number of data bytes in an encoder frame for each codec mode */
     /* for IF2 output format                                        */
-    extern const Word16 If2EncBytesPerFrame[16] =
+    const Word16 If2EncBytesPerFrame[16] =
     {
         13, /* 4.75 */
         14, /* 5.15 */
diff --git a/media/libstagefright/codecs/amrnb/enc/src/inter_36_tab.cpp b/media/libstagefright/codecs/amrnb/enc/src/inter_36_tab.cpp
index 27f33e9..c8d7b13 100644
--- a/media/libstagefright/codecs/amrnb/enc/src/inter_36_tab.cpp
+++ b/media/libstagefright/codecs/amrnb/enc/src/inter_36_tab.cpp
@@ -123,6 +123,7 @@
 ----------------------------------------------------------------------------*/
 #include    "typedef.h"
 #include    "cnst.h"
+#include    "inter_36_tab.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -162,7 +163,7 @@
              inter_3[k] = inter_6[2*k], 0 <= k <= 3*L_INTER_SRCH
      */
 
-    extern const Word16 inter_6[FIR_SIZE] =
+    const Word16 inter_6[FIR_SIZE] =
     {
         29519,
         28316, 24906, 19838, 13896, 7945, 2755,
diff --git a/media/libstagefright/codecs/amrnb/enc/src/lag_wind_tab.cpp b/media/libstagefright/codecs/amrnb/enc/src/lag_wind_tab.cpp
index 53889bb..b0f5b3a 100644
--- a/media/libstagefright/codecs/amrnb/enc/src/lag_wind_tab.cpp
+++ b/media/libstagefright/codecs/amrnb/enc/src/lag_wind_tab.cpp
@@ -138,6 +138,7 @@
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 #include    "typedef.h"
+#include    "lag_wind_tab.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -167,7 +168,7 @@
     ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
     ; Variable declaration - defined here and used outside this module
     ----------------------------------------------------------------------------*/
-    extern const Word16 lag_h[10] =
+    const Word16 lag_h[10] =
     {
         32728,
         32619,
@@ -181,7 +182,7 @@
         29321
     };
 
-    extern const Word16 lag_l[10] =
+    const Word16 lag_l[10] =
     {
         11904,
         17280,
diff --git a/media/libstagefright/codecs/amrnb/enc/src/set_sign.cpp b/media/libstagefright/codecs/amrnb/enc/src/set_sign.cpp
index dedf91a..d626de3 100644
--- a/media/libstagefright/codecs/amrnb/enc/src/set_sign.cpp
+++ b/media/libstagefright/codecs/amrnb/enc/src/set_sign.cpp
@@ -552,10 +552,10 @@
         else
         {
             *(p_sign--) = -32767;                     /* sign = -1 */
-            cor = - (cor);
+            cor = negate(cor);
 
             /* modify dn[] according to the fixed sign */
-            dn[i] = - val;
+            dn[i] = negate(val);
         }
 
         *(p_en--) = cor;
diff --git a/media/libstagefright/codecs/amrnb/enc/src/ton_stab.cpp b/media/libstagefright/codecs/amrnb/enc/src/ton_stab.cpp
index 3c4494d..455a510 100644
--- a/media/libstagefright/codecs/amrnb/enc/src/ton_stab.cpp
+++ b/media/libstagefright/codecs/amrnb/enc/src/ton_stab.cpp
@@ -791,7 +791,8 @@
                        )
 {
     OSCL_UNUSED_ARG(pOverflow);
-    for (int i = 0; i < N_FRAME - 1; i++)
+    int i;
+    for (i = 0; i < N_FRAME - 1; i++)
     {
         st->gp[i] = st->gp[i+1];
     }
diff --git a/media/libstagefright/codecs/amrwb/include/pvamrwbdecoder_api.h b/media/libstagefright/codecs/amrwb/include/pvamrwbdecoder_api.h
index 457c21f..eca5ae0 100644
--- a/media/libstagefright/codecs/amrwb/include/pvamrwbdecoder_api.h
+++ b/media/libstagefright/codecs/amrwb/include/pvamrwbdecoder_api.h
@@ -106,7 +106,7 @@
 #define NUM_OF_MODES  10
 
 
-    const int16 AMR_WB_COMPRESSED[NUM_OF_MODES] =
+    static const int16 AMR_WB_COMPRESSED[NUM_OF_MODES] =
     {
         NBBITS_7k,
         NBBITS_9k,
diff --git a/media/libstagefright/codecs/amrwb/src/get_amr_wb_bits.cpp b/media/libstagefright/codecs/amrwb/src/get_amr_wb_bits.cpp
index d7287f3..b325e8f 100644
--- a/media/libstagefright/codecs/amrwb/src/get_amr_wb_bits.cpp
+++ b/media/libstagefright/codecs/amrwb/src/get_amr_wb_bits.cpp
@@ -119,8 +119,9 @@
 )
 {
     int16 value = 0;
+    int16 i;
 
-    for (int16 i = no_of_bits >> 1; i != 0; i--)
+    for (i = no_of_bits >> 1; i != 0; i--)
     {
         value <<= 2;
 
diff --git a/media/libstagefright/codecs/amrwb/src/homing_amr_wb_dec.cpp b/media/libstagefright/codecs/amrwb/src/homing_amr_wb_dec.cpp
index 59c6c0a..f032a08 100644
--- a/media/libstagefright/codecs/amrwb/src/homing_amr_wb_dec.cpp
+++ b/media/libstagefright/codecs/amrwb/src/homing_amr_wb_dec.cpp
@@ -134,7 +134,7 @@
 ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
 ; Variable declaration - defined here and used outside this module
 ----------------------------------------------------------------------------*/
-const int16 prmnofsf[NUM_OF_SPMODES] =
+static const int16 prmnofsf[NUM_OF_SPMODES] =
 {
     63,  81, 100,
     108, 116, 128,
@@ -142,21 +142,21 @@
 };
 
 
-const int16 dfh_M7k[PRMN_7k] =
+static const int16 dfh_M7k[PRMN_7k] =
 {
     3168, 29954, 29213, 16121,
     64, 13440, 30624, 16430,
     19008
 };
 
-const int16 dfh_M9k[PRMN_9k] =
+static const int16 dfh_M9k[PRMN_9k] =
 {
     3168, 31665,  9943, 9123,
     15599,  4358, 20248, 2048,
     17040, 27787, 16816, 13888
 };
 
-const int16 dfh_M12k[PRMN_12k] =
+static const int16 dfh_M12k[PRMN_12k] =
 {
     3168, 31665,  9943,  9128,
     3647,  8129, 30930, 27926,
@@ -165,7 +165,7 @@
     13948
 };
 
-const int16 dfh_M14k[PRMN_14k] =
+static const int16 dfh_M14k[PRMN_14k] =
 {
     3168, 31665,  9943,  9131,
     24815,   655, 26616, 26764,
@@ -174,7 +174,7 @@
     221, 20321, 17823
 };
 
-const int16 dfh_M16k[PRMN_16k] =
+static const int16 dfh_M16k[PRMN_16k] =
 {
     3168, 31665,  9943,  9131,
     24815,   700,  3824,  7271,
@@ -184,7 +184,7 @@
     6759, 24576
 };
 
-const int16 dfh_M18k[PRMN_18k] =
+static const int16 dfh_M18k[PRMN_18k] =
 {
     3168, 31665,  9943,  9135,
     14787, 14423, 30477, 24927,
@@ -195,7 +195,7 @@
     0
 };
 
-const int16 dfh_M20k[PRMN_20k] =
+static const int16 dfh_M20k[PRMN_20k] =
 {
     3168, 31665,  9943,  9129,
     8637, 31807, 24646,   736,
@@ -206,7 +206,7 @@
     30249, 29123, 0
 };
 
-const int16 dfh_M23k[PRMN_23k] =
+static const int16 dfh_M23k[PRMN_23k] =
 {
     3168, 31665,  9943,  9132,
     16748,  3202, 28179, 16317,
@@ -218,7 +218,7 @@
     23392, 26053, 31216
 };
 
-const int16 dfh_M24k[PRMN_24k] =
+static const int16 dfh_M24k[PRMN_24k] =
 {
     3168, 31665,  9943,  9134,
     24776,  5857, 18475, 28535,
diff --git a/media/libstagefright/codecs/amrwb/src/isp_isf.cpp b/media/libstagefright/codecs/amrwb/src/isp_isf.cpp
index 41db7e3..0552733 100644
--- a/media/libstagefright/codecs/amrwb/src/isp_isf.cpp
+++ b/media/libstagefright/codecs/amrwb/src/isp_isf.cpp
@@ -108,7 +108,7 @@
 
 /* table of cos(x) in Q15 */
 
-const int16 table[129] =
+static const int16 table[129] =
 {
     32767,
     32758,  32729,  32679,  32610,  32522,  32413,  32286,  32138,
diff --git a/media/libstagefright/codecs/amrwb/src/oversamp_12k8_to_16k.cpp b/media/libstagefright/codecs/amrwb/src/oversamp_12k8_to_16k.cpp
index 143c26e..806851e 100644
--- a/media/libstagefright/codecs/amrwb/src/oversamp_12k8_to_16k.cpp
+++ b/media/libstagefright/codecs/amrwb/src/oversamp_12k8_to_16k.cpp
@@ -240,11 +240,11 @@
 {
 
     int32 i;
-    int16 frac;
+    int16 frac, j;
     int16 * pt_sig_u = sig_u;
 
     frac = 1;
-    for (int16 j = 0; j < L_frame; j++)
+    for (j = 0; j < L_frame; j++)
     {
         i = ((int32)j * INV_FAC5) >> 13;       /* integer part = pos * 1/5 */
 
@@ -337,6 +337,6 @@
 
     L_sum = shl_int32(L_sum, 2);               /* saturation can occur here */
 
-    return ((int16(L_sum >> 16)));
+    return ((int16)(L_sum >> 16));
 }
 
diff --git a/media/libstagefright/codecs/amrwb/src/phase_dispersion.cpp b/media/libstagefright/codecs/amrwb/src/phase_dispersion.cpp
index f90a5340..7b08a40 100644
--- a/media/libstagefright/codecs/amrwb/src/phase_dispersion.cpp
+++ b/media/libstagefright/codecs/amrwb/src/phase_dispersion.cpp
@@ -109,7 +109,7 @@
 /* impulse response with phase dispersion */
 
 /* 2.0 - 6.4 kHz phase dispersion */
-const int16 ph_imp_low[L_SUBFR] =
+static const int16 ph_imp_low[L_SUBFR] =
 {
     20182,  9693,  3270, -3437, 2864, -5240,  1589, -1357,
     600,  3893, -1497,  -698, 1203, -5249,  1199,  5371,
@@ -122,7 +122,7 @@
 };
 
 /* 3.2 - 6.4 kHz phase dispersion */
-const int16 ph_imp_mid[L_SUBFR] =
+static const int16 ph_imp_mid[L_SUBFR] =
 {
     24098, 10460, -5263,  -763,  2048,  -927,  1753, -3323,
     2212,   652, -2146,  2487, -3539,  4109, -2107,  -374,
diff --git a/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp b/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp
index 5eacc16..60b1163 100644
--- a/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp
+++ b/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp
@@ -80,7 +80,7 @@
     CHECK(mApiHandle);
 
     if (VO_ERR_NONE != voGetAMRWBEncAPI(mApiHandle)) {
-        LOGE("Failed to get api handle");
+        ALOGE("Failed to get api handle");
         return UNKNOWN_ERROR;
     }
 
@@ -97,20 +97,20 @@
     userData.memflag = VO_IMF_USERMEMOPERATOR;
     userData.memData = (VO_PTR) mMemOperator;
     if (VO_ERR_NONE != mApiHandle->Init(&mEncoderHandle, VO_AUDIO_CodingAMRWB, &userData)) {
-        LOGE("Failed to init AMRWB encoder");
+        ALOGE("Failed to init AMRWB encoder");
         return UNKNOWN_ERROR;
     }
 
     // Configure AMRWB encoder$
     VOAMRWBMODE mode = pickModeFromBitRate(mBitRate);
     if (VO_ERR_NONE != mApiHandle->SetParam(mEncoderHandle, VO_PID_AMRWB_MODE,  &mode)) {
-        LOGE("Failed to set AMRWB encoder mode to %d", mode);
+        ALOGE("Failed to set AMRWB encoder mode to %d", mode);
         return UNKNOWN_ERROR;
     }
 
     VOAMRWBFRAMETYPE type = VOAMRWB_RFC3267;
     if (VO_ERR_NONE != mApiHandle->SetParam(mEncoderHandle, VO_PID_AMRWB_FRAMETYPE, &type)) {
-        LOGE("Failed to set AMRWB encoder frame type to %d", type);
+        ALOGE("Failed to set AMRWB encoder frame type to %d", type);
         return UNKNOWN_ERROR;
     }
 
@@ -125,7 +125,7 @@
 
 status_t AMRWBEncoder::start(MetaData *params) {
     if (mStarted) {
-        LOGW("Call start() when encoder already started");
+        ALOGW("Call start() when encoder already started");
         return OK;
     }
 
@@ -140,7 +140,7 @@
 
     status_t err = mSource->start(params);
     if (err != OK) {
-        LOGE("AudioSource is not available");
+        ALOGE("AudioSource is not available");
         return err;
     }
     mStarted = true;
@@ -150,7 +150,7 @@
 
 status_t AMRWBEncoder::stop() {
     if (!mStarted) {
-        LOGW("Call stop() when encoder has not started");
+        ALOGW("Call stop() when encoder has not started");
         return OK;
     }
 
diff --git a/media/libstagefright/codecs/amrwbenc/Android.mk b/media/libstagefright/codecs/amrwbenc/Android.mk
index 5179380..ae43870 100644
--- a/media/libstagefright/codecs/amrwbenc/Android.mk
+++ b/media/libstagefright/codecs/amrwbenc/Android.mk
@@ -3,7 +3,7 @@
 include frameworks/base/media/libstagefright/codecs/common/Config.mk
 
 
- 	
+
 LOCAL_SRC_FILES := \
 	AMRWBEncoder.cpp \
 	src/autocorr.c \
@@ -91,7 +91,7 @@
 
 LOCAL_ARM_MODE := arm
 
-LOCAL_STATIC_LIBRARIES := 
+LOCAL_STATIC_LIBRARIES :=
 
 LOCAL_SHARED_LIBRARIES :=
 
diff --git a/media/libstagefright/codecs/amrwbenc/inc/basic_op.h b/media/libstagefright/codecs/amrwbenc/inc/basic_op.h
index 7734913..f42a27c 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/basic_op.h
+++ b/media/libstagefright/codecs/amrwbenc/inc/basic_op.h
@@ -29,11 +29,7 @@
 #define MIN_16 (Word16)-32768	/* 0x8000 */
 
 
-#ifdef LINUX
-#define  static_vo  static __inline__
-#else
 #define  static_vo  static __inline
-#endif 
 
 #define saturate(L_var1) (((L_var1) > 0X00007fffL) ? (MAX_16): (((L_var1) < (Word32) 0xffff8000L) ? (MIN_16): ((L_var1) & 0xffff)))
 
@@ -87,7 +83,7 @@
 static_vo Word32 L_shr_r (Word32 L_var1, Word16 var2); 				/* Long shift right with round,  3   */
 static_vo Word16 norm_s (Word16 var1);             				/* Short norm,           15  */
 static_vo Word16 div_s (Word16 var1, Word16 var2); 				/* Short division,       18  */
-static_vo Word16 norm_l (Word32 L_var1);           				/* Long norm,            30  */   
+static_vo Word16 norm_l (Word32 L_var1);           				/* Long norm,            30  */
 
 /*___________________________________________________________________________
 |                                                                           |
@@ -1030,8 +1026,8 @@
 				L_num <<= 1;
 				if (L_num >= L_denom)
 				{
-					L_num -= L_denom;      
-					var_out += 1;          
+					L_num -= L_denom;
+					var_out += 1;
 				}
 			}
 		}
diff --git a/media/libstagefright/codecs/amrwbenc/inc/homing.tab b/media/libstagefright/codecs/amrwbenc/inc/homing.tab
index edcccdd..e399fb8 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/homing.tab
+++ b/media/libstagefright/codecs/amrwbenc/inc/homing.tab
@@ -33,89 +33,89 @@
 
 static const Word16 dfh_M7k[PRMN_7k] =
 {
-  3168, 29954, 29213, 16121, 
-	64, 13440, 30624, 16430, 
+  3168, 29954, 29213, 16121,
+	64, 13440, 30624, 16430,
  19008
 };
 
 static const Word16 dfh_M9k[PRMN_9k] =
 {
-   3168, 31665,  9943, 9123, 
-  15599,  4358, 20248, 2048, 
+   3168, 31665,  9943, 9123,
+  15599,  4358, 20248, 2048,
   17040, 27787, 16816, 13888
 };
 
 static const Word16 dfh_M12k[PRMN_12k] =
 {
-  3168, 31665,  9943,  9128, 
-  3647,  8129, 30930, 27926, 
- 18880, 12319,   496,  1042, 
-  4061, 20446, 25629, 28069, 
+  3168, 31665,  9943,  9128,
+  3647,  8129, 30930, 27926,
+ 18880, 12319,   496,  1042,
+  4061, 20446, 25629, 28069,
  13948
 };
 
 static const Word16 dfh_M14k[PRMN_14k] =
 {
-    3168, 31665,  9943,  9131, 
-   24815,   655, 26616, 26764, 
-    7238, 19136,  6144,    88, 
-	4158, 25733, 30567, 30494, 
+    3168, 31665,  9943,  9131,
+   24815,   655, 26616, 26764,
+    7238, 19136,  6144,    88,
+	4158, 25733, 30567, 30494,
 	221, 20321, 17823
 };
 
 static const Word16 dfh_M16k[PRMN_16k] =
 {
-    3168, 31665,  9943,  9131, 
-   24815,   700,  3824,  7271, 
-   26400,  9528,  6594, 26112, 
-     108,  2068, 12867, 16317, 
-   23035, 24632,  7528,  1752, 
+    3168, 31665,  9943,  9131,
+   24815,   700,  3824,  7271,
+   26400,  9528,  6594, 26112,
+     108,  2068, 12867, 16317,
+   23035, 24632,  7528,  1752,
     6759, 24576
 };
 
 static const Word16 dfh_M18k[PRMN_18k] =
 {
-     3168, 31665,  9943,  9135, 
-	14787, 14423, 30477, 24927, 
-	25345, 30154,   916,  5728, 
-	18978,  2048,   528, 16449, 
-	 2436,  3581, 23527, 29479, 
-	 8237, 16810, 27091, 19052, 
+     3168, 31665,  9943,  9135,
+	14787, 14423, 30477, 24927,
+	25345, 30154,   916,  5728,
+	18978,  2048,   528, 16449,
+	 2436,  3581, 23527, 29479,
+	 8237, 16810, 27091, 19052,
 	    0
 };
 
 static const Word16 dfh_M20k[PRMN_20k] =
 {
-     3168, 31665,  9943,  9129, 
-	 8637, 31807, 24646,   736, 
-	28643,  2977,  2566, 25564, 
-	12930, 13960,  2048,   834, 
-	 3270,  4100, 26920, 16237, 
-	31227, 17667, 15059, 20589, 
+     3168, 31665,  9943,  9129,
+	 8637, 31807, 24646,   736,
+	28643,  2977,  2566, 25564,
+	12930, 13960,  2048,   834,
+	 3270,  4100, 26920, 16237,
+	31227, 17667, 15059, 20589,
 	30249, 29123, 0
 };
 
 static const Word16 dfh_M23k[PRMN_23k] =
 {
-	 3168, 31665,  9943,  9132, 
-	16748,  3202, 28179, 16317, 
-	30590, 15857, 19960,  8818, 
-	21711, 21538,  4260, 16690, 
-	20224,  3666,  4194,  9497, 
-	16320, 15388,  5755, 31551, 
-	14080,  3574, 15932,    50, 
+	 3168, 31665,  9943,  9132,
+	16748,  3202, 28179, 16317,
+	30590, 15857, 19960,  8818,
+	21711, 21538,  4260, 16690,
+	20224,  3666,  4194,  9497,
+	16320, 15388,  5755, 31551,
+	14080,  3574, 15932,    50,
 	23392, 26053, 31216
 };
 
 static const Word16 dfh_M24k[PRMN_24k] =
 {
-	 3168, 31665,  9943,  9134, 
-	24776,  5857, 18475, 28535, 
-	29662, 14321, 16725,  4396, 
-	29353, 10003, 17068, 20504, 
-	  720,     0,  8465, 12581, 
-	28863, 24774,  9709, 26043, 
-	 7941, 27649, 13965, 15236, 
+	 3168, 31665,  9943,  9134,
+	24776,  5857, 18475, 28535,
+	29662, 14321, 16725,  4396,
+	29353, 10003, 17068, 20504,
+	  720,     0,  8465, 12581,
+	28863, 24774,  9709, 26043,
+	 7941, 27649, 13965, 15236,
 	18026, 22047, 16681,  3968
 };
 
diff --git a/media/libstagefright/codecs/amrwbenc/inc/isp_isf.tab b/media/libstagefright/codecs/amrwbenc/inc/isp_isf.tab
index 2322845..865eea0 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/isp_isf.tab
+++ b/media/libstagefright/codecs/amrwbenc/inc/isp_isf.tab
@@ -21,7 +21,7 @@
 
 /* table of cos(x) in Q15 */
 
-const static Word16 table[129] = {
+static const Word16 table[129] = {
   32767,
   32758,  32729,  32679,  32610,  32522,  32413,  32286,  32138,
   31972,  31786,  31581,  31357,  31114,  30853,  30572,  30274,
@@ -42,7 +42,7 @@
 
 /* slope in Q11 used to compute y = acos(x) */
 
-const static Word16 slope[128] = { 
+static const Word16 slope[128] = {
  -26214, -9039, -5243, -3799, -2979, -2405, -2064, -1771,
  -1579, -1409, -1279, -1170, -1079, -1004, -933, -880,
  -827, -783, -743, -708, -676, -647, -621, -599,
diff --git a/media/libstagefright/codecs/amrwbenc/inc/log2.h b/media/libstagefright/codecs/amrwbenc/inc/log2.h
index 6a35019..b065eb4 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/log2.h
+++ b/media/libstagefright/codecs/amrwbenc/inc/log2.h
@@ -25,20 +25,20 @@
 */
 #ifndef __LOG2_H__
 #define __LOG2_H__
- 
+
 /*
 ********************************************************************************
 *                         INCLUDE FILES
 ********************************************************************************
 */
 #include "typedef.h"
- 
+
 /*
 ********************************************************************************
 *                         DEFINITION OF DATA TYPES
 ********************************************************************************
 */
- 
+
 /*
 ********************************************************************************
 *                         DECLARATION OF PROTOTYPES
diff --git a/media/libstagefright/codecs/amrwbenc/inc/mime_io.tab b/media/libstagefright/codecs/amrwbenc/inc/mime_io.tab
index 5f85dd0..7b485ea 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/mime_io.tab
+++ b/media/libstagefright/codecs/amrwbenc/inc/mime_io.tab
@@ -98,7 +98,7 @@
    244,  61, 111, 164, 214,  65, 115, 168, 218,  70,
    120, 173, 223,  74, 124, 177, 227,  79, 129, 182,
    232,  83, 133, 186, 236,  88, 138, 191, 241,  92,
-   142, 195, 245                         
+   142, 195, 245
 };
 
 static Word16 sort_1425[285] = {
@@ -205,7 +205,7 @@
    257, 243, 229, 356, 159, 119,  67, 187, 173, 145,
    240,  77, 304, 332, 314, 342, 109, 254,  81, 278,
    105,  91, 346, 318, 183, 250, 197, 328,  95, 155,
-   169, 268, 226, 236, 264                 
+   169, 268, 226, 236, 264
 };
 
 static Word16 sort_1985[397] = {
@@ -248,7 +248,7 @@
    128, 118, 303, 104, 379, 182, 114, 375, 200,  96,
    293, 172, 214, 365, 279,  86, 289, 351, 347, 357,
    261, 186, 176, 271,  90, 100, 147, 322, 275, 361,
-    71, 332,  61, 265, 157, 246, 236         
+    71, 332,  61, 265, 157, 246, 236
 };
 
 static Word16 sort_2305[461] = {
@@ -349,7 +349,7 @@
    132, 453, 336, 425, 325, 347, 126, 104, 137, 458,
    352, 243, 447, 115, 341, 210, 330, 221, 232, 436,
    465, 319, 359, 111, 454, 228, 217, 122, 443, 348,
-   239, 250, 133, 144, 432, 337, 326         
+   239, 250, 133, 144, 432, 337, 326
 };
 
 static Word16 sort_SID[35] = {
diff --git a/media/libstagefright/codecs/amrwbenc/inc/stream.h b/media/libstagefright/codecs/amrwbenc/inc/stream.h
index 3e5336a..4c1d0f0 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/stream.h
+++ b/media/libstagefright/codecs/amrwbenc/inc/stream.h
@@ -26,7 +26,7 @@
 #define __STREAM_H__
 
 #include "voMem.h"
-#define Frame_Maxsize  1024 * 2  //Work Buffer 10K 
+#define Frame_Maxsize  1024 * 2  //Work Buffer 10K
 #define Frame_MaxByte  640        //AMR_WB Encoder one frame 320 samples = 640 Bytes
 #define MIN(a,b)	 ((a) < (b)? (a) : (b))
 
@@ -35,7 +35,7 @@
 	unsigned char *frame_ptr;
 	unsigned char *frame_ptr_bk;
 	int  set_len;
-	int  framebuffer_len; 
+	int  framebuffer_len;
 	int  frame_storelen;
 	int  used_len;
 }FrameStream;
diff --git a/media/libstagefright/codecs/amrwbenc/inc/typedef.h b/media/libstagefright/codecs/amrwbenc/inc/typedef.h
index 533e68b..f08a678 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/typedef.h
+++ b/media/libstagefright/codecs/amrwbenc/inc/typedef.h
@@ -31,7 +31,7 @@
 /*
  * this is the original code from the ETSI file typedef.h
  */
-   
+
 #if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__ZTC__)
 typedef signed char Word8;
 typedef short Word16;
diff --git a/media/libstagefright/codecs/amrwbenc/inc/typedefs.h b/media/libstagefright/codecs/amrwbenc/inc/typedefs.h
index f30d255..0062584 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/typedefs.h
+++ b/media/libstagefright/codecs/amrwbenc/inc/typedefs.h
@@ -45,7 +45,7 @@
 *        OSF           only defined if the current platform is an Alpha
 *        PC            only defined if the current platform is a PC
 *        SUN           only defined if the current platform is a Sun
-*        
+*
 *        LSBFIRST      is defined if the byte order on this platform is
 *                      "least significant byte first" -> defined on DEC Alpha
 *                      and PC, undefined on Sun
@@ -68,7 +68,7 @@
 
 /*
 ********************************************************************************
-*                         DEFINITION OF CONSTANTS 
+*                         DEFINITION OF CONSTANTS
 ********************************************************************************
 */
 /*
@@ -197,7 +197,7 @@
 #define     Syn_filt_32      voAWB_Syn_filt_32
 #define     Isf_isp          voAWB_Isf_isp
 #define     Levinson         voAWB_Levinson
-#define     median5          voAWB_median5           
+#define     median5          voAWB_median5
 #define     Pred_lt4         voAWB_Pred_lt4
 #define     Reorder_isf      voAWB_Reorder_isf
 #define     Dpisf_2s_36b     voAWB_Dpisf_2s_36b
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Deemph_32_opt.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Deemph_32_opt.s
index c1c74e6..282db92 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Deemph_32_opt.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Deemph_32_opt.s
@@ -30,10 +30,10 @@
 
            .section  .text
            .global   Deemph_32_asm
-	   
+
 Deemph_32_asm:
 
-           STMFD   	r13!, {r4 - r12, r14} 
+           STMFD   	r13!, {r4 - r12, r14}
 	   MOV          r4, #2                   @i=0
 	   LDRSH        r6, [r0], #2             @load x_hi[0]
 	   LDRSH        r7, [r1], #2             @load x_lo[0]
@@ -47,9 +47,9 @@
 	   ADD          r12, r10, r7, LSL #4     @L_tmp += x_lo[0] << 4
 	   MOV          r10, r12, LSL #3         @L_tmp <<= 3
 	   MUL          r9, r5, r8
-	   LDRSH        r6, [r0], #2             @load x_hi[1] 
+	   LDRSH        r6, [r0], #2             @load x_hi[1]
 	   QDADD        r10, r10, r9
-	   LDRSH        r7, [r1], #2             @load x_lo[1]  
+	   LDRSH        r7, [r1], #2             @load x_lo[1]
 	   MOV          r12, r10, LSL #1         @L_tmp = L_mac(L_tmp, *mem, fac)
 	   QADD         r10, r12, r11
 	   MOV          r14, r10, ASR #16        @y[0] = round(L_tmp)
@@ -94,9 +94,9 @@
 
            BLT          LOOP
            STR          r14, [r3]
-           STRH         r14, [r2]	   
+           STRH         r14, [r2]
 
-           LDMFD   	r13!, {r4 - r12, r15} 
+           LDMFD   	r13!, {r4 - r12, r15}
 
 	   @ENDP
 	   .END
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Dot_p_opt.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Dot_p_opt.s
index 02bdcab..4aa317e 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Dot_p_opt.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Dot_p_opt.s
@@ -31,7 +31,7 @@
 
 Dot_product12_asm:
 
-          STMFD   	    r13!, {r4 - r12, r14} 
+          STMFD   	    r13!, {r4 - r12, r14}
           MOV               r4, #0                                 @ L_sum = 0
           MOV               r5, #0                                 @ i = 0
 
@@ -41,13 +41,13 @@
           LDR           r8, [r0], #4
           SMLABB        r4, r6, r7, r4
           LDR           r9, [r1], #4
-	  SMLATT        r4, r6, r7, r4 
+	  SMLATT        r4, r6, r7, r4
 
 	  LDR           r6, [r0], #4
 	  SMLABB        r4, r8, r9, r4
 
 	  LDR           r7, [r1], #4
-	  SMLATT        r4, r8, r9, r4	  
+	  SMLATT        r4, r8, r9, r4
 	  LDR           r8, [r0], #4
 
 	  SMLABB        r4, r6, r7, r4
@@ -58,7 +58,7 @@
 	  CMP           r5, r2
 	  SMLATT        r4, r8, r9, r4
 	  BLT           LOOP
-              
+
           MOV           r12, r4, LSL #1
           ADD           r12, r12, #1                         @ L_sum = (L_sum << 1)  + 1
 	  MOV           r4, r12
@@ -69,12 +69,12 @@
           SUB           r10, r10, #1                         @ sft = norm_l(L_sum)
           MOV           r0, r12, LSL r10                     @ L_sum = L_sum << sft
           RSB           r11, r10, #30                        @ *exp = 30 - sft
-          STRH          r11, [r3]                     
+          STRH          r11, [r3]
 
 Dot_product12_end:
-		     
-          LDMFD   	    r13!, {r4 - r12, r15} 
+
+          LDMFD   	    r13!, {r4 - r12, r15}
           @ENDFUNC
           .END
- 
+
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Filt_6k_7k_opt.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Filt_6k_7k_opt.s
index 1ce2a85..856ada8 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Filt_6k_7k_opt.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Filt_6k_7k_opt.s
@@ -23,7 +23,7 @@
 @******************************************************************
 @ r0    ---  signal[]
 @ r1    ---  lg
-@ r2    ---  mem[] 
+@ r2    ---  mem[]
 
           .section  .text
           .global  Filt_6k_7k_asm
@@ -32,7 +32,7 @@
 
 Filt_6k_7k_asm:
 
-          STMFD   		r13!, {r4 - r12, r14} 
+          STMFD   		r13!, {r4 - r12, r14}
           SUB    		r13, r13, #240              @ x[L_SUBFR16k + (L_FIR - 1)]
           MOV     		r8, r0                      @ copy signal[] address
           MOV     		r4, r1                      @ copy lg address
@@ -43,9 +43,9 @@
           MOV     		r2, #30                     @ L_FIR - 1
           BL      		voAWB_Copy                   @ memcpy(x, mem, (L_FIR - 1)<<1)
 
-          LDR     		r10, Lable1                 @ get fir_7k address     
+          LDR     		r10, Lable1                 @ get fir_7k address
 
-          MOV           	r14, #0  
+          MOV           	r14, #0
           MOV                   r3, r8                      @ change myMemCopy to Copy, due to Copy will change r3 content
           ADD     	    	r6, r13, #60                @ get x[L_FIR - 1] address
           MOV           	r7, r3                      @ get signal[i]
@@ -76,14 +76,14 @@
           STRH          	r12, [r6], #2
           ADD           	r14, r14, #8
           CMP           	r14, #80
-          BLT           	LOOP1          
+          BLT           	LOOP1
 
 
           STR     		r5, [sp, #-4]               @ PUSH  r5 to stack
 
           @ not use registers: r4, r10, r12, r14, r5
-          MOV     		r4, r13 
-          MOV     		r5, #0                      @ i = 0              
+          MOV     		r4, r13
+          MOV     		r5, #0                      @ i = 0
 LOOP2:
           LDR           	r0, [r10]
 
@@ -111,13 +111,13 @@
           LDRSH                 r8, [r4, #10]              @ load x[i+5]
           LDRSH                 r9, [r4, #50]              @ load x[i+25]
           SMLABT                r14, r1, r0, r14           @ (x[i+3] + x[i+27]) * fir_7k[3]
-          ADD                   r8, r8, r9                 @ x[i+5] + x[i+25] 
- 
+          ADD                   r8, r8, r9                 @ x[i+5] + x[i+25]
+
           LDR                   r0, [r10, #8]
           LDRSH                 r1, [r4, #12]              @ x[i+6]
           LDRSH                 r2, [r4, #48]              @ x[i+24]
           SMLABB                r14, r6, r0, r14           @ (x[i+4] + x[i+26]) * fir_7k[4]
-          LDRSH                 r6, [r4, #14]              @ x[i+7] 
+          LDRSH                 r6, [r4, #14]              @ x[i+7]
           LDRSH                 r7, [r4, #46]              @ x[i+23]
           SMLABT                r14, r8, r0, r14           @ (x[i+5] + x[i+25]) * fir_7k[5]
           LDR                   r0, [r10, #12]
@@ -125,8 +125,8 @@
           ADD                   r6, r6, r7                 @ (x[i+7] + x[i+23])
           SMLABB                r14, r1, r0, r14           @ (x[i+6] + x[i+24]) * fir_7k[6]
           LDRSH                 r8, [r4, #16]              @ x[i+8]
-          LDRSH                 r9, [r4, #44]              @ x[i+22] 
-          SMLABT                r14, r6, r0, r14           @ (x[i+7] + x[i+23]) * fir_7k[7]  
+          LDRSH                 r9, [r4, #44]              @ x[i+22]
+          SMLABT                r14, r6, r0, r14           @ (x[i+7] + x[i+23]) * fir_7k[7]
           LDR                   r0, [r10, #16]
           LDRSH                 r1, [r4, #18]              @ x[i+9]
           LDRSH                 r2, [r4, #42]              @ x[i+21]
@@ -144,7 +144,7 @@
           LDRSH                 r2, [r4, #36]              @ x[i+18]
           SMLABB                r14, r6, r0, r14           @ (x[i+10] + x[i+20]) * fir_7k[10]
           LDRSH                 r6, [r4, #26]              @ x[i+13]
-          ADD                   r8, r8, r9                 @ (x[i+11] + x[i+19])  
+          ADD                   r8, r8, r9                 @ (x[i+11] + x[i+19])
           LDRSH                 r7, [r4, #34]              @ x[i+17]
           SMLABT                r14, r8, r0, r14           @ (x[i+11] + x[i+19]) * fir_7k[11]
           LDR                   r0, [r10, #24]
@@ -152,31 +152,31 @@
           LDRSH                 r8, [r4, #28]              @ x[i+14]
           SMLABB                r14, r1, r0, r14           @ (x[i+12] + x[i+18]) * fir_7k[12]
           ADD                   r6, r6, r7                 @ (x[i+13] + x[i+17])
-          LDRSH                 r9, [r4, #32]              @ x[i+16] 
+          LDRSH                 r9, [r4, #32]              @ x[i+16]
           SMLABT                r14, r6, r0, r14           @ (x[i+13] + x[i+17]) * fir_7k[13]
-          LDR                   r0, [r10, #28]         
+          LDR                   r0, [r10, #28]
           ADD                   r8, r8, r9                 @ (x[i+14] + x[i+16])
           LDRSH                 r1, [r4, #30]              @ x[i+15]
           SMLABB                r14, r8, r0, r14           @ (x[i+14] + x[i+16]) * fir_7k[14]
-          SMLABT                r14, r1, r0, r14           @ x[i+15] * fir_7k[15]                              
+          SMLABT                r14, r1, r0, r14           @ x[i+15] * fir_7k[15]
 
           ADD     		r5, r5, #1
           ADD     		r14, r14, #0x4000
-          ADD     		r4, r4, #2                
+          ADD     		r4, r4, #2
           MOV     		r1, r14, ASR #15
           CMP     		r5, #80
           STRH    		r1, [r3], #2               @signal[i] = (L_tmp + 0x4000) >> 15
-          BLT     		LOOP2      
-           
+          BLT     		LOOP2
+
           LDR     		r1, [sp, #-4]               @mem address
           ADD     		r0, r13, #160               @x + lg
           MOV     		r2, #30
           BL      		voAWB_Copy
-                    
+
 Filt_6k_7k_end:
-          ADD     		r13, r13, #240  
-          LDMFD   		r13!, {r4 - r12, r15} 
- 
+          ADD     		r13, r13, #240
+          LDMFD   		r13!, {r4 - r12, r15}
+
 Lable1:
           .word   		fir_6k_7k
           @ENDFUNC
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Norm_Corr_opt.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Norm_Corr_opt.s
index b440a31..49bdc2b 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Norm_Corr_opt.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Norm_Corr_opt.s
@@ -32,8 +32,8 @@
 @ r6 --- corr_norm[]
 
 
-	.section  .text 
-        .global   Norm_corr_asm 
+	.section  .text
+        .global   Norm_corr_asm
         .extern   Convolve_asm
         .extern   Isqrt_n
 @******************************
@@ -47,17 +47,17 @@
 .equ         T_MIN         ,   212
 .equ         T_MAX         ,   216
 .equ         CORR_NORM     ,   220
-                  
+
 Norm_corr_asm:
 
-        STMFD      r13!, {r4 - r12, r14}  
+        STMFD      r13!, {r4 - r12, r14}
         SUB        r13, r13, #voSTACK
-  
+
         ADD        r8, r13, #20                 @get the excf[L_SUBFR]
         LDR        r4, [r13, #T_MIN]            @get t_min
         RSB        r11, r4, #0                  @k = -t_min
-        ADD        r5, r0, r11, LSL #1          @get the &exc[k]   
-        
+        ADD        r5, r0, r11, LSL #1          @get the &exc[k]
+
         @transfer Convolve function
         STMFD       sp!, {r0 - r3}
         MOV         r0, r5
@@ -68,7 +68,7 @@
 
         @ r8 --- excf[]
 
-	MOV         r14, r1                       @copy xn[] address                      
+	MOV         r14, r1                       @copy xn[] address
         MOV         r5, #64
         MOV         r6, #0                       @L_tmp = 0
         MOV         r7, #1
@@ -93,21 +93,21 @@
 	CLZ         r7, r9
 	SUB         r6, r7, #1                   @exp = norm_l(L_tmp)
         RSB         r7, r6, #32                  @exp = 32 - exp
-	MOV         r6, r7, ASR #1         
+	MOV         r6, r7, ASR #1
 	RSB         r7, r6, #0                   @scale = -(exp >> 1)
-	
+
         @loop for every possible period
 	@for(t = t_min@ t <= t_max@ t++)
 	@r7 --- scale r4 --- t_min r8 --- excf[]
 
-LOOPFOR:	
+LOOPFOR:
         MOV         r5, #0                       @L_tmp  = 0
 	MOV         r6, #0                       @L_tmp1 = 0
-	MOV         r9, #64  
+	MOV         r9, #64
 	MOV         r12, r1                      @copy of xn[]
 	ADD         r14, r13, #20                @copy of excf[]
 	MOV         r8, #0x8000
-        	
+
 LOOPi:
 	LDR         r11, [r14], #4               @load excf[i], excf[i+1]
         LDR         r10, [r12], #4               @load xn[i], xn[i+1]
@@ -128,13 +128,13 @@
 	MOV         r10, #1
 	ADD         r5, r10, r5, LSL #1          @L_tmp = (L_tmp << 1) + 1
 	ADD         r6, r10, r6, LSL #1          @L_tmp1 = (L_tmp1 << 1) + 1
- 
-	CLZ         r10, r5        
+
+	CLZ         r10, r5
 	CMP         r5, #0
 	RSBLT       r11, r5, #0
 	CLZLT       r10, r11
 	SUB         r10, r10, #1                 @exp = norm_l(L_tmp)
-     
+
 	MOV         r5, r5, LSL r10              @L_tmp = (L_tmp << exp)
 	RSB         r10, r10, #30                @exp_corr = 30 - exp
 	MOV         r11, r5, ASR #16             @corr = extract_h(L_tmp)
@@ -150,7 +150,7 @@
 	@Isqrt_n(&L_tmp, &exp_norm)
 
 	MOV         r14, r0
-	MOV         r12, r1 
+	MOV         r12, r1
 
         STMFD       sp!, {r0 - r4, r7 - r12, r14}
 	ADD         r1, sp, #4
@@ -168,7 +168,7 @@
 	MOV         r6, r6, ASR #16              @norm = extract_h(L_tmp)
 	MUL         r12, r6, r11
 	ADD         r12, r12, r12                @L_tmp = vo_L_mult(corr, norm)
-  
+
 	ADD         r6, r10, r5
 	ADD         r6, r6, r7                   @exp_corr + exp_norm + scale
 
@@ -187,9 +187,9 @@
 
 	CMP         r4, r6
 	BEQ         Norm_corr_asm_end
- 
+
 	ADD         r4, r4, #1                   @ t_min ++
-        
+
 	RSB         r5, r4, #0                   @ k
 
 	MOV         r6, #63                      @ i = 63
@@ -216,16 +216,16 @@
 	MUL         r14, r11, r8
         LDR         r6, [r13, #T_MAX]            @ get t_max
 	MOV         r8, r14, ASR #15
-	STRH        r8, [r10]                    
+	STRH        r8, [r10]
 
 	CMP         r4, r6
 	BLE         LOOPFOR
 
-Norm_corr_asm_end: 
-        
-        ADD            r13, r13, #voSTACK      
+Norm_corr_asm_end:
+
+        ADD            r13, r13, #voSTACK
         LDMFD          r13!, {r4 - r12, r15}
-    
+
         .END
 
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Syn_filt_32_opt.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Syn_filt_32_opt.s
index 70464e4..3f4930c 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Syn_filt_32_opt.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Syn_filt_32_opt.s
@@ -38,7 +38,7 @@
 
 Syn_filt_32_asm:
 
-          STMFD   	r13!, {r4 - r12, r14} 
+          STMFD   	r13!, {r4 - r12, r14}
           LDR           r4,  [r13, #40]                  @ get sig_hi[] address
           LDR           r5,  [r13, #44]                  @ get sig_lo[] address
 
@@ -55,7 +55,7 @@
           AND           r8, r8, r14
           ORR           r10, r6, r7, LSL #16             @ Aq[2] -- Aq[1]
           ORR           r11, r8, r9, LSL #16             @ Aq[4] -- Aq[3]
-          STR           r10, [r13, #-4]                  
+          STR           r10, [r13, #-4]
           STR           r11, [r13, #-8]
 
           LDRSH         r6, [r0, #10]                    @ load Aq[5]
@@ -73,12 +73,12 @@
           LDRSH         r7, [r0, #20]                    @ load Aq[10]
           LDRSH         r8, [r0, #22]                    @ load Aq[11]
           LDRSH         r9, [r0, #24]                    @ load Aq[12]
-          AND           r6, r6, r14 
+          AND           r6, r6, r14
           AND           r8, r8, r14
           ORR           r10, r6, r7, LSL #16             @ Aq[10] -- Aq[9]
           ORR           r11, r8, r9, LSL #16             @ Aq[12] -- Aq[11]
           STR           r10, [r13, #-20]
-          STR           r11, [r13, #-24]  
+          STR           r11, [r13, #-24]
 
           LDRSH         r6, [r0, #26]                    @ load Aq[13]
           LDRSH         r7, [r0, #28]                    @ load Aq[14]
@@ -90,14 +90,14 @@
           ORR           r11, r8, r9, LSL #16             @ Aq[16] -- Aq[15]
           STR           r10, [r13, #-28]
           STR           r11, [r13, #-32]
-          
+
           MOV           r8, #0                           @ i = 0
-              
-LOOP:            
+
+LOOP:
           LDRSH         r6, [r5, #-2]                    @ load sig_lo[i-1]
           LDRSH         r7, [r5, #-4]                    @ load sig_lo[i-2]
 
-          LDR           r11, [r13, #-4]                  @ Aq[2] -- Aq[1]        
+          LDR           r11, [r13, #-4]                  @ Aq[2] -- Aq[1]
           LDRSH         r9, [r5, #-6]                    @ load sig_lo[i-3]
           LDRSH         r10, [r5, #-8]                   @ load sig_lo[i-4]
 
@@ -135,12 +135,12 @@
           LDRSH         r10, [r5, #-32]                  @ load sig_lo[i-16]
           SMLABB        r12, r6, r11, r12                @ sig_lo[i-13] * Aq[13]
           SMLABT        r12, r7, r11, r12                @ sig_lo[i-14] * Aq[14]
- 
+
           LDR           r11, [r13, #-32]                 @ Aq[16] -- Aq[15]
-          LDRSH         r6, [r2],#2                      @ load exc[i] 
+          LDRSH         r6, [r2],#2                      @ load exc[i]
           SMLABB        r12, r9, r11, r12                @ sig_lo[i-15] * Aq[15]
           SMLABT        r12, r10, r11, r12               @ sig_lo[i-16] * Aq[16]
-          MUL           r7, r6, r3                       @ exc[i] * a0 
+          MUL           r7, r6, r3                       @ exc[i] * a0
           RSB           r14, r12, #0                     @ L_tmp
           MOV           r14, r14, ASR #11                @ L_tmp >>= 11
           ADD           r14, r14, r7, LSL #1             @ L_tmp += (exc[i] * a0) << 1
@@ -149,7 +149,7 @@
           LDRSH         r6, [r4, #-2]                    @ load sig_hi[i-1]
           LDRSH         r7, [r4, #-4]                    @ load sig_hi[i-2]
 
-          LDR           r11, [r13, #-4]                  @ Aq[2] -- Aq[1]        
+          LDR           r11, [r13, #-4]                  @ Aq[2] -- Aq[1]
           LDRSH         r9, [r4, #-6]                    @ load sig_hi[i-3]
           LDRSH         r10, [r4, #-8]                   @ load sig_hi[i-4]
           SMULBB        r12, r6, r11                     @ sig_hi[i-1] * Aq[1]
@@ -198,14 +198,14 @@
           LDRSH         r10, [r4, #-32]                  @ load sig_hi[i-16]
           SMLABB        r12, r6, r11, r12                @ sig_hi[i-13] * Aq[13]
           SMLABT        r12, r7, r11, r12                @ sig_hi[i-14] * Aq[14]
- 
+
           LDR           r11, [r13, #-32]                 @ Aq[16] -- Aq[15]
           SMLABB        r12, r9, r11, r12                @ sig_hi[i-15] * Aq[15]
-          SMLABT        r12, r10, r11, r12               @ sig_hi[i-16] * Aq[16]       
+          SMLABT        r12, r10, r11, r12               @ sig_hi[i-16] * Aq[16]
           ADD           r6, r12, r12                     @ r12 << 1
-          SUB           r14, r14, r6                     
+          SUB           r14, r14, r6
           MOV           r14, r14, LSL #3                 @ L_tmp <<=3
-  
+
           MOV           r7, r14, ASR #16                 @ L_tmp >> 16
 
           MOV           r14, r14, ASR #4                 @ L_tmp >>=4
@@ -213,14 +213,14 @@
           SUB           r9, r14, r7, LSL #12             @ sig_lo[i] = L_tmp - (sig_hi[i] << 12)
 
           ADD           r8, r8, #1
-          STRH          r9, [r5], #2   
+          STRH          r9, [r5], #2
           CMP           r8, #64
-          BLT           LOOP                            
-         
+          BLT           LOOP
+
 Syn_filt_32_end:
-		     
-          LDMFD   	    r13!, {r4 - r12, r15} 
+
+          LDMFD   	    r13!, {r4 - r12, r15}
           @ENDFUNC
           .END
- 
+
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/convolve_opt.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/convolve_opt.s
index 0228bda..71bb532 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/convolve_opt.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/convolve_opt.s
@@ -27,24 +27,24 @@
 @  r3 --- L
 
 	.section  .text
-        .global   Convolve_asm 
+        .global   Convolve_asm
 
 Convolve_asm:
 
-        STMFD          r13!, {r4 - r12, r14}  
+        STMFD          r13!, {r4 - r12, r14}
         MOV            r3,  #0                           @ n
 	MOV            r11, #0x8000
-        
-LOOP: 
+
+LOOP:
         ADD            r4, r1, r3, LSL #1                @ tmpH address
         ADD            r5, r3, #1                        @ i = n + 1
         MOV            r6, r0                            @ tmpX = x
         LDRSH          r9,  [r6], #2                     @ *tmpX++
         LDRSH          r10, [r4], #-2                    @ *tmpH--
         SUB            r5, r5, #1
-        MUL            r8,  r9, r10 
+        MUL            r8,  r9, r10
 
-LOOP1:                    
+LOOP1:
         CMP            r5, #0
         BLE            L1
 	LDRSH          r9,  [r6], #2                     @ *tmpX++
@@ -58,12 +58,12 @@
 	LDRSH          r12, [r6], #2                     @ *tmpX++
 	LDRSH          r14, [r4], #-2                    @ *tmpH--
 	MLA            r8, r9, r10, r8
-        SUBS           r5, r5, #4 
+        SUBS           r5, r5, #4
 	MLA            r8, r12, r14, r8
-    
-        B              LOOP1  
 
-L1:                  
+        B              LOOP1
+
+L1:
 
         ADD            r5, r11, r8, LSL #1
         MOV            r5, r5, LSR #16                   @extract_h(s)
@@ -75,14 +75,14 @@
         ADD            r5, r3, #1
         MOV            r6, r0
         LDRSH          r9,  [r6], #2                     @ *tmpX++
-        LDRSH          r10, [r4], #-2                     
+        LDRSH          r10, [r4], #-2
         LDRSH          r12, [r6], #2
         LDRSH          r14, [r4], #-2
 
         MUL            r8, r9, r10
         SUB            r5, r5, #2
         MLA            r8, r12, r14, r8
-        
+
 LOOP2:
         CMP            r5, #0
         BLE            L2
@@ -97,14 +97,14 @@
 	LDRSH          r12, [r6], #2                     @ *tmpX++
 	LDRSH          r14, [r4], #-2                    @ *tmpH--
 	MLA            r8, r9, r10, r8
-        SUBS           r5, r5, #4 
+        SUBS           r5, r5, #4
 	MLA            r8, r12, r14, r8
         B              LOOP2
 
 L2:
         ADD            r8, r11, r8, LSL #1
         MOV            r8, r8, LSR #16                   @extract_h(s)
-        ADD            r3, r3, #1  
+        ADD            r3, r3, #1
         STRH           r8, [r2], #2                      @y[n]
 
         ADD            r4, r1, r3, LSL #1
@@ -117,7 +117,7 @@
         MUL            r8, r9, r10
         LDRSH          r9,  [r6], #2
         LDRSH          r10, [r4], #-2
-        MLA            r8, r12, r14, r8 
+        MLA            r8, r12, r14, r8
         SUB            r5, r5, #3
         MLA            r8, r9, r10, r8
 
@@ -135,9 +135,9 @@
 	LDRSH          r12, [r6], #2                     @ *tmpX++
 	LDRSH          r14, [r4], #-2                    @ *tmpH--
 	MLA            r8, r9, r10, r8
-        SUBS           r5, r5, #4 
-	MLA            r8, r12, r14, r8 
-        B              LOOP3   
+        SUBS           r5, r5, #4
+	MLA            r8, r12, r14, r8
+        B              LOOP3
 
 L3:
         ADD            r8, r11, r8, LSL #1
@@ -150,7 +150,7 @@
         MOV            r6, r0
         MOV            r8, #0
 
-LOOP4:                    
+LOOP4:
         CMP            r5, #0
         BLE            L4
 	LDRSH          r9,  [r6], #2                     @ *tmpX++
@@ -164,22 +164,22 @@
 	LDRSH          r12, [r6], #2                     @ *tmpX++
 	LDRSH          r14, [r4], #-2                    @ *tmpH--
 	MLA            r8, r9, r10, r8
-        SUBS           r5, r5, #4 
-	MLA            r8, r12, r14, r8        
-        B              LOOP4    
-L4:                  
+        SUBS           r5, r5, #4
+	MLA            r8, r12, r14, r8
+        B              LOOP4
+L4:
         ADD            r5, r11, r8, LSL #1
         MOV            r5, r5, LSR #16                   @extract_h(s)
         ADD            r3, r3, #1
         STRH           r5, [r2], #2                      @y[n]
-        
+
         CMP            r3, #64
         BLT            LOOP
-                
-Convolve_asm_end: 
- 
+
+Convolve_asm_end:
+
         LDMFD      r13!, {r4 - r12, r15}
-    
+
         @ENDFUNC
         .END
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/cor_h_vec_opt.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/cor_h_vec_opt.s
index 8f32733..2d4c7cc 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/cor_h_vec_opt.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/cor_h_vec_opt.s
@@ -51,12 +51,12 @@
          RSB           r11, r2, #62                      @j=62-pos
 
 LOOPj1:
-	 LDRSH         r12, [r10], #2  
+	 LDRSH         r12, [r10], #2
 	 LDRSH         r8,  [r9], #2
 	 LDRSH         r14, [r9]
 	 SUBS          r11, r11, #1
          MLA           r5, r12, r8, r5
-         MLA           r6, r12, r14, r6	 
+         MLA           r6, r12, r14, r6
 	 BGE           LOOPj1
 
 	 LDRSH         r12, [r10], #2                     @*p1++
@@ -64,7 +64,7 @@
          MLA           r5, r12, r14, r5
          MOV           r14, #0x8000
          MOV           r5, r5, LSL #2                     @L_sum1 = (L_sum1 << 2)
-         ADD           r10, r6, r14         
+         ADD           r10, r6, r14
          ADD           r9, r5, r14
          MOV           r5, r9, ASR #16
          MOV           r6, r10, ASR #16
@@ -76,7 +76,7 @@
 	 MUL           r14, r6, r11
 	 MOV           r5, r12, ASR #15
 	 MOV           r6, r14, ASR #15
-	 LDR           r9,  [r13, #44]                   
+	 LDR           r9,  [r13, #44]
 	 LDR           r12, [r13, #48]
          LDRSH         r10, [r7], #2                      @*p0++
 	 LDRSH         r11, [r8]                          @*p3++
@@ -88,7 +88,7 @@
 	 STRH          r6, [r12]
 
          ADD           r2, r2, #4
- 
+
          MOV           r5, #0                            @L_sum1 = 0
 	 MOV           r6, #0                            @L_sum2 = 0
 	 ADD           r9, r1, r2, LSL #1                @p2 = &vec[pos]
@@ -97,12 +97,12 @@
 	 ADD           r4, r4, #1                        @i++
 
 LOOPj2:
-	 LDRSH         r12, [r10], #2  
+	 LDRSH         r12, [r10], #2
 	 LDRSH         r8,  [r9], #2
 	 LDRSH         r14, [r9]
 	 SUBS          r11, r11, #1
          MLA           r5, r12, r8, r5
-         MLA           r6, r12, r14, r6	 
+         MLA           r6, r12, r14, r6
 	 BGE           LOOPj2
 
 	 LDRSH         r12, [r10], #2                     @*p1++
@@ -110,7 +110,7 @@
          MLA           r5, r12, r14, r5
          MOV           r14, #0x8000
          MOV           r5, r5, LSL #2                     @L_sum1 = (L_sum1 << 2)
-         ADD           r10, r6, r14        
+         ADD           r10, r6, r14
          ADD           r9, r5, r14
 
          MOV           r5, r9, ASR #16
@@ -123,7 +123,7 @@
 	 MUL           r14, r6, r11
 	 MOV           r5, r12, ASR #15
 	 MOV           r6, r14, ASR #15
-	 LDR           r9,  [r13, #44]                   
+	 LDR           r9,  [r13, #44]
 	 LDR           r12, [r13, #48]
          LDRSH         r10, [r7], #2                      @*p0++
 	 LDRSH         r11, [r8]                          @*p3++
@@ -136,16 +136,16 @@
 	 ADD           r4, r4, #1                         @i+1
 	 ADD           r2, r2, #4                         @pos += STEP
 	 CMP           r4, #16
-	 
+
 	 BLT           LOOPi
-         
+
 the_end:
          LDMFD         r13!, {r4 - r12, r15}
-      
+
          @ENDFUNC
-         .END	 
-        
-	
-	  
+         .END
+
+
+
 
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/pred_lt4_1_opt.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/pred_lt4_1_opt.s
index d7b4509..e0b338d 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/pred_lt4_1_opt.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/pred_lt4_1_opt.s
@@ -35,7 +35,7 @@
 
 pred_lt4_asm:
 
-         STMFD     r13!, {r4 - r12, r14} 
+         STMFD     r13!, {r4 - r12, r14}
          RSB       r4, r1, #0                         @-T0
          RSB       r2, r2, #0                         @frac = -frac
          ADD       r5, r0, r4, LSL #1                 @x = exc - T0
@@ -45,7 +45,7 @@
          SUB       r5, r5, #30                        @x -= 15
          RSB       r4, r2, #3                         @k = 3 - frac
          LDR       r6, Table
-	 MOV       r8, r4, LSL #6                    
+	 MOV       r8, r4, LSL #6
          @MOV       r7, #0                             @j = 0
          ADD       r8, r6, r8                         @ptr2 = &(inter4_2[k][0])
 
@@ -63,7 +63,7 @@
 	 LDRSH     r6, [r1], #2                       @x[1]
 	 LDRSH     r9, [r1], #2                       @x[2]
 
-	 SMULBB    r10, r4, r3                        @x[0] * h[0]                  
+	 SMULBB    r10, r4, r3                        @x[0] * h[0]
 	 SMULBB    r11, r6, r3                        @x[1] * h[0]
 	 SMULBB    r12, r9, r3                        @x[2] * h[0]
 
@@ -285,7 +285,7 @@
 
 	 SMLABB    r10, r9, r3, r10                   @x[2] * h[2]
          SMLABB    r11, r4, r3, r11                   @x[3] * h[2]
-      
+
 	 SMLABT    r10, r4, r3, r10                   @x[3] * h[3]
 	 SMLABT    r11, r6, r3, r11                   @x[4] * h[3]
 
@@ -435,7 +435,7 @@
 	 MOV       r11, r11, LSL #1
 
 	 QADD      r10, r10, r10
-	 QADD      r11, r11, r11 
+	 QADD      r11, r11, r11
 
 	 QADD      r10, r10, r5
 	 QADD      r11, r11, r5
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/residu_asm_opt.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/residu_asm_opt.s
index 86b3bd6..5ff0964 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/residu_asm_opt.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/residu_asm_opt.s
@@ -34,12 +34,12 @@
 
         LDRH    r5, [r0], #2
         LDRH    r6, [r0], #2
-        ORR     r5, r6, r5, LSL #16                  @r5 --- a0, a1	
+        ORR     r5, r6, r5, LSL #16                  @r5 --- a0, a1
 
         LDRH    r6, [r0], #2
 	LDRH    r7, [r0], #2
 	ORR     r6, r7, r6, LSL #16                  @r6 --- a2, a3
-	
+
         LDRH    r7, [r0], #2
 	LDRH    r8, [r0], #2
 	ORR     r7, r8, r7, LSL #16                  @r7 --- a4, a5
@@ -59,13 +59,13 @@
         LDRH    r11, [r0], #2
 	LDRH    r12, [r0], #2
 	ORR     r11, r12, r11, LSL #16               @r11 --- a12, a13
-	
+
 	LDRH    r12, [r0], #2
 	LDRH    r4, [r0], #2
 	ORR     r12, r4, r12, LSL #16                @r12 --- a14, a15
-	
 
-	STMFD   r13!, {r8 - r12}                     @store r8-r12 
+
+	STMFD   r13!, {r8 - r12}                     @store r8-r12
 	LDRH    r4, [r0], #2                         @load a16
         MOV     r14, r3, ASR #2                      @one loop get 4 outputs
 	ADD     r1, r1, #4
@@ -78,7 +78,7 @@
 	LDR     r2,  [r1], #-4                       @r2   --- x[1], x[0]
 
 	SMULTB  r3, r5, r2                           @i1(0)  --- r3 = x[0] * a0
-        SMULTT  r4, r5, r2                           @i2(0)  --- r4 = x[1] * a0	
+        SMULTT  r4, r5, r2                           @i2(0)  --- r4 = x[1] * a0
 	SMULTB  r11, r5, r10                         @i3(0)  --- r11 = x[2] * a0
 	SMULTT  r12, r5, r10                         @i4(0)  --- r12 = x[3] * a0
 
@@ -88,20 +88,20 @@
 
 	SMLATB  r11, r6, r2, r11                     @i3(2)  --- r11 += x[0] * a2
 	SMLATT  r12, r6, r2, r12                     @i4(2)  --- r12 += x[1] * a2
-	SMLABB  r12, r6, r2, r12                     @i4(3)  --- r12 += x[0] * a3                 
-	
+	SMLABB  r12, r6, r2, r12                     @i4(3)  --- r12 += x[0] * a3
+
 	LDR     r2, [r1], #-4                        @r2 ---- x[-1], x[-2]
 
 	SMLABT  r3, r5, r2, r3                       @i1(1) --- r3 += x[-1] * a1
 	SMLATT  r4, r6, r2, r4                       @i2(2) --- r4 += x[-1] * a2
 	SMLABT  r11, r6, r2, r11                     @i3(3) --- r11 += x[-1] * a3
 	SMLATT  r12, r7, r2, r12                     @i4(4) --- r12 += x[-1] * a4
-        SMLATB  r3, r6, r2, r3                       @i1(2) --- r3 += x[-2] * a2	
+        SMLATB  r3, r6, r2, r3                       @i1(2) --- r3 += x[-2] * a2
 
 	SMLABB	r4, r6, r2, r4				@ i2	(3)
 	SMLATB  r11,r7, r2, r11				@ i3	(4)
 	SMLABB	r12,r7, r2, r12				@ i4	(5)
-	
+
 	LDR	r2,[r1],#-4
 	SMLABT	r3, r6, r2, r3				@ i1	(3)
 	SMLATT	r4, r7, r2, r4				@ i2	(4)
@@ -111,7 +111,7 @@
 	SMLABB	r4, r7, r2, r4				@ i2	(5)
 	SMLATB	r11,r8, r2, r11				@ i3	(6)
 	SMLABB	r12,r8, r2, r12				@ i4	(7)
-		
+
 	LDR	r2,[r1],#-4
 	SMLABT	r3, r7, r2, r3				@ i1	(5)
 	SMLATT	r4, r8, r2, r4				@ i2	(6)
@@ -122,7 +122,7 @@
 	SMLATB	r11,r9, r2, r11				@ i3	(8)
 	SMLABB	r12,r9, r2, r12				@ i4	(9)
 	LDR	r10, [r13, #8]				@ [ a10 | a11]
-	
+
 	LDR	r2,[r1],#-4
 	SMLABT	r3, r8, r2, r3				@ i1	(7)
 	SMLATT	r4, r9, r2, r4				@ i2	(8)
@@ -133,7 +133,7 @@
 	SMLATB	r11,r10, r2, r11			@ i3	(10)
 	SMLABB	r12,r10, r2, r12			@ i4	(11)
 	LDR	r8, [r13, #12]				@ [ a12 | a13 ]
-		
+
 	LDR	r2,[r1],#-4
 	SMLABT	r3, r9, r2, r3				@ i1	(9)
 	SMLATT	r4, r10, r2, r4				@ i2	(10)
@@ -144,7 +144,7 @@
 	SMLATB	r11,r8, r2, r11				@ i3	(12)
 	SMLABB	r12,r8, r2, r12				@ i4	(13)
 	LDR	r9, [r13, #16]				@ [ a14 | a15 ]
-	
+
 	LDR	r2,[r1],#-4
 	SMLABT	r3, r10, r2, r3				@ i1	(11)
 	SMLATT	r4, r8, r2, r4				@ i2	(12)
@@ -154,7 +154,7 @@
 	SMLABB	r4, r8, r2, r4				@ i2	(13)
 	SMLATB	r11,r9, r2, r11				@ i3	(14)
 	SMLABB	r12,r9, r2, r12				@ i4	(15)
-	
+
 
 	LDR	r2,[r1],#-4
 	SMLABT	r3, r8, r2, r3				@ i1	(13)
@@ -165,64 +165,64 @@
 	SMLABB	r4, r9, r2, r4				@ i2	(15)
 	SMLABB	r11,r14, r2, r11			@ i3	(16)
 	LDR		r8, [r13]					@ [ a6 | a7 ]
-			
+
         LDR     r2,[r1],#44         		@ Change
 	SMLABT	r3, r9, r2, r3
 	SMLABB	r3, r14, r2, r3
 	SMLABT	r4, r14, r2, r4
 	LDR		r9, [r13, #4]				@ [ a8 | a9 ]
-	
 
-	QADD	r3,r3,r3					
-	QADD	r4,r4,r4					
-	QADD	r11,r11,r11					
-	QADD	r12,r12,r12					
-		
-	QADD	r3,r3,r3					
-	QADD	r4,r4,r4					
-	QADD	r11,r11,r11					
-	QADD	r12,r12,r12					
-	
-	QADD	r3,r3,r3					
-	QADD	r4,r4,r4					
-	QADD	r11,r11,r11					
-	QADD	r12,r12,r12					
-	
-	QADD	r3,r3,r3					
-	QADD	r4,r4,r4					
-	QADD	r11,r11,r11					
-	QADD	r12,r12,r12					
-	
-	MOV	r2,#32768	
-	
-	QDADD	r3,r2,r3					
-	QDADD	r4,r2,r4					
-	QDADD	r11,r2,r11					
-	QDADD	r12,r2,r12					
-		
-	
+
+	QADD	r3,r3,r3
+	QADD	r4,r4,r4
+	QADD	r11,r11,r11
+	QADD	r12,r12,r12
+
+	QADD	r3,r3,r3
+	QADD	r4,r4,r4
+	QADD	r11,r11,r11
+	QADD	r12,r12,r12
+
+	QADD	r3,r3,r3
+	QADD	r4,r4,r4
+	QADD	r11,r11,r11
+	QADD	r12,r12,r12
+
+	QADD	r3,r3,r3
+	QADD	r4,r4,r4
+	QADD	r11,r11,r11
+	QADD	r12,r12,r12
+
+	MOV	r2,#32768
+
+	QDADD	r3,r2,r3
+	QDADD	r4,r2,r4
+	QDADD	r11,r2,r11
+	QDADD	r12,r2,r12
+
+
 	MOV	r3,r3,asr #16
 	MOV	r4,r4,asr #16
 	MOV	r11,r11,asr #16
 	MOV	r12,r12,asr #16
-	
+
 	STRH	r3,[r0],#2
 	STRH	r4,[r0],#2
 	STRH	r11,[r0],#2
 	STRH	r12,[r0],#2
-	
+
 	MOV	r2,r14,asr #16
 	SUB	r14, r14, #0x10000
 	SUBS	r2,r2,#1
-	BNE	residu_loop	
+	BNE	residu_loop
 end:
-	LDMFD	r13!, {r8 -r12}	
+	LDMFD	r13!, {r8 -r12}
 	LDMFD	r13!, {r4 -r12,pc}
 
         @ENDFUNC
-        .END	 
-        
-	
-	  
+        .END
+
+
+
 
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/scale_sig_opt.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/scale_sig_opt.s
index f83e688..b300224 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/scale_sig_opt.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/scale_sig_opt.s
@@ -38,7 +38,7 @@
 	 MOV           r8, #0x7fffffff
 	 MOV           r9, #0x8000
 	 BLE           LOOP2
-	 
+
 LOOP1:
 
          LDRSH          r5, [r4]                    @load x[i]
@@ -65,11 +65,11 @@
 
 The_end:
          LDMFD         r13!, {r4 - r12, r15}
-     
+
          @ENDFUNC
-         .END	 
-        
-	
-	  
+         .END
+
+
+
 
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/syn_filt_opt.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/syn_filt_opt.s
index f4700cd..0c287a4 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/syn_filt_opt.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/syn_filt_opt.s
@@ -33,18 +33,18 @@
 
 Syn_filt_asm:
 
-          STMFD   	r13!, {r4 - r12, r14} 
+          STMFD   	r13!, {r4 - r12, r14}
           SUB           r13, r13, #700                   @ y_buf[L_FRAME16k + M16k]
-   
+
           MOV           r4, r3                           @ copy mem[] address
           MOV           r5, r13                          @ copy yy = y_buf address
 
           @ for(i = 0@ i < m@ i++)
           @{
           @    *yy++ = mem[i]@
-          @} 
+          @}
 
-          LDRH          r6,  [r4], #2          
+          LDRH          r6,  [r4], #2
           LDRH          r7,  [r4], #2
           LDRH          r8,  [r4], #2
           LDRH          r9,  [r4], #2
@@ -62,7 +62,7 @@
           STRH          r12, [r5], #2
           STRH          r14, [r5], #2
 
-          LDRH          r6,  [r4], #2          
+          LDRH          r6,  [r4], #2
           LDRH          r7,  [r4], #2
           LDRH          r8,  [r4], #2
           LDRH          r9,  [r4], #2
@@ -92,45 +92,45 @@
           LDRSH         r9, [r0, #6]                     @ load a[3]
           LDRSH         r11,[r0, #8]                     @ load a[4]
           AND           r6, r6, r14
-          AND           r9, r9, r14          
+          AND           r9, r9, r14
           ORR           r10, r6, r7, LSL #16             @ -a[2] -- -a[1]
           ORR           r12, r9, r11, LSL #16            @ -a[4] -- -a[3]
           STR           r10, [r13, #-4]
           STR           r12, [r13, #-8]
-          
+
           LDRSH         r6, [r0, #10]                    @ load a[5]
           LDRSH         r7, [r0, #12]                    @ load a[6]
           LDRSH         r9, [r0, #14]                    @ load a[7]
           LDRSH         r11,[r0, #16]                    @ load a[8]
           AND           r6, r6, r14
-          AND           r9, r9, r14          
+          AND           r9, r9, r14
           ORR           r10, r6, r7, LSL #16             @ -a[6] -- -a[5]
           ORR           r12, r9, r11, LSL #16            @ -a[8] -- -a[7]
           STR           r10, [r13, #-12]
-          STR           r12, [r13, #-16]          
-           
+          STR           r12, [r13, #-16]
+
           LDRSH         r6, [r0, #18]                    @ load a[9]
           LDRSH         r7, [r0, #20]                    @ load a[10]
           LDRSH         r9, [r0, #22]                    @ load a[11]
           LDRSH         r11,[r0, #24]                    @ load a[12]
           AND           r6, r6, r14
-          AND           r9, r9, r14          
+          AND           r9, r9, r14
           ORR           r10, r6, r7, LSL #16             @ -a[10] -- -a[9]
           ORR           r12, r9, r11, LSL #16            @ -a[12] -- -a[11]
           STR           r10, [r13, #-20]
-          STR           r12, [r13, #-24]    
+          STR           r12, [r13, #-24]
 
           LDRSH         r6, [r0, #26]                    @ load a[13]
           LDRSH         r7, [r0, #28]                    @ load a[14]
           LDRSH         r9, [r0, #30]                    @ load a[15]
           LDRSH         r11,[r0, #32]                    @ load a[16]
           AND           r6, r6, r14
-          AND           r9, r9, r14          
+          AND           r9, r9, r14
           ORR           r10, r6, r7, LSL #16             @ -a[14] -- -a[13]
           ORR           r12, r9, r11, LSL #16            @ -a[16] -- -a[15]
           STR           r10, [r13, #-28]
-          STR           r12, [r13, #-32]                
-                     
+          STR           r12, [r13, #-32]
+
           ADD           r4, r13, #32
 LOOP:
           LDRSH         r6,  [r1], #2                    @ load x[i]
@@ -155,8 +155,8 @@
           SMLABB        r14, r6, r7, r14                 @ -a[3] * (*(temp_p -3))
 
           LDRSH         r9,  [r10, #-10]                 @ *(temp_p - 5)
-   
-          SMLABT        r14, r11, r7, r14                @ -a[4] * (*(temp_p -4))        
+
+          SMLABT        r14, r11, r7, r14                @ -a[4] * (*(temp_p -4))
 
           LDR           r7,  [r13, #-12]                 @ -a[6]  -a[5]
           LDRSH         r12, [r10, #-12]                 @ *(temp_p - 6)
@@ -169,13 +169,13 @@
 
           LDR           r7,  [r13, #-16]                 @ -a[8] -a[7]
           LDRSH         r11, [r10, #-16]                 @ *(temp_p - 8)
-         
+
           SMLABB        r14, r6, r7, r14                 @ -a[7] * (*(temp_p -7))
 
           LDRSH         r9,  [r10, #-18]                 @ *(temp_p - 9)
 
-          SMLABT        r14, r11, r7, r14                @ -a[8] * (*(temp_p -8))          
- 
+          SMLABT        r14, r11, r7, r14                @ -a[8] * (*(temp_p -8))
+
           LDR           r7,  [r13, #-20]                 @ -a[10]  -a[9]
           LDRSH         r12, [r10, #-20]                 @ *(temp_p - 10)
 
@@ -192,11 +192,11 @@
 
           LDRSH         r9,  [r10, #-26]                 @ *(temp_p - 13)
 
-          SMLABT        r14, r11, r7, r14                @ -a[12] * (*(temp_p -12))           
+          SMLABT        r14, r11, r7, r14                @ -a[12] * (*(temp_p -12))
 
           LDR           r7,  [r13, #-28]                 @ -a[14] -a[13]
           LDRSH         r12, [r10, #-28]                 @ *(temp_p - 14)
- 
+
           SMLABB        r14, r9, r7, r14                 @ -a[13] * (*(temp_p -13))
 
           LDRSH         r6,  [r10, #-30]                 @ *(temp_p - 15)
@@ -211,28 +211,28 @@
           SMLABT        r14, r11, r7, r14                @ -a[16] * (*(temp_p -16))
 
           RSB           r14, r14, r0
-                                  
+
           MOV           r7, r14, LSL #4                  @ L_tmp <<=4
           ADD           r8, r8, #1
-          ADD           r14, r7, #0x8000                 
+          ADD           r14, r7, #0x8000
           MOV           r7, r14, ASR #16                 @ (L_tmp + 0x8000) >> 16
           CMP           r8, #80
           STRH          r7, [r10]                        @ yy[i]
           STRH          r7, [r2], #2                     @ y[i]
           BLT           LOOP
- 
+
           @ update mem[]
           ADD           r5, r13, #160                    @ yy[64] address
           MOV           r1, r3
           MOV           r0, r5
           MOV           r2, #16
-          BL            voAWB_Copy          
+          BL            voAWB_Copy
 
 Syn_filt_asm_end:
- 
-          ADD           r13, r13, #700		     
-          LDMFD   	r13!, {r4 - r12, r15} 
+
+          ADD           r13, r13, #700
+          LDMFD   	r13!, {r4 - r12, r15}
           @ENDFUNC
           .END
- 
+
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Deemph_32_neon.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Deemph_32_neon.s
index 2afc146..1d5893f 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Deemph_32_neon.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Deemph_32_neon.s
@@ -30,10 +30,10 @@
 
            .section  .text
            .global   Deemph_32_asm
-	   
+
 Deemph_32_asm:
 
-           STMFD   	r13!, {r4 - r12, r14} 
+           STMFD   	r13!, {r4 - r12, r14}
 	   MOV          r4, #2                   @i=0
 	   LDRSH        r6, [r0], #2             @load x_hi[0]
 	   LDRSH        r7, [r1], #2             @load x_lo[0]
@@ -47,9 +47,9 @@
 	   ADD          r12, r10, r7, LSL #4     @L_tmp += x_lo[0] << 4
 	   MOV          r10, r12, LSL #3         @L_tmp <<= 3
 	   MUL          r9, r5, r8
-	   LDRSH        r6, [r0], #2             @load x_hi[1] 
+	   LDRSH        r6, [r0], #2             @load x_hi[1]
 	   QDADD        r10, r10, r9
-	   LDRSH        r7, [r1], #2             @load x_lo[1]  
+	   LDRSH        r7, [r1], #2             @load x_lo[1]
 	   MOV          r12, r10, LSL #1         @L_tmp = L_mac(L_tmp, *mem, fac)
 	   QADD         r10, r12, r11
 	   MOV          r14, r10, ASR #16        @y[0] = round(L_tmp)
@@ -94,9 +94,9 @@
 
            BLT          LOOP
            STR          r14, [r3]
-           STRH         r14, [r2]	   
+           STRH         r14, [r2]
 
-           LDMFD   	r13!, {r4 - r12, r15} 
+           LDMFD   	r13!, {r4 - r12, r15}
 
 	   .END
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Dot_p_neon.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Dot_p_neon.s
index 678f1d0..8230944d 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Dot_p_neon.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Dot_p_neon.s
@@ -45,14 +45,14 @@
 	  VLD1.S16          {Q12, Q13}, [r1]!             @load 16 Word16 y[]
 
           VMULL.S16         Q15, D16, D0
-          VMLAL.S16         Q15, D17, D1               
+          VMLAL.S16         Q15, D17, D1
           VMLAL.S16         Q15, D18, D2
           VMLAL.S16         Q15, D19, D3
-	  VLD1.S16          {Q0, Q1}, [r1]!               @load 16 Word16 y[]   
-          VMLAL.S16         Q15, D20, D4       
+	  VLD1.S16          {Q0, Q1}, [r1]!               @load 16 Word16 y[]
+          VMLAL.S16         Q15, D20, D4
           VMLAL.S16         Q15, D21, D5
           VMLAL.S16         Q15, D22, D6
-          VMLAL.S16         Q15, D23, D7                                       
+          VMLAL.S16         Q15, D23, D7
           VMLAL.S16         Q15, D24, D8
           VMLAL.S16         Q15, D25, D9
           VMLAL.S16         Q15, D26, D10
@@ -64,9 +64,9 @@
 
           CMP               r2, #64
           BEQ               Lable1
-          VLD1.S16          {Q0, Q1}, [r0]!               @load 16 Word16 x[]  
-	  VLD1.S16          {Q2, Q3}, [r1]! 
-          VMLAL.S16         Q15, D4, D0             
+          VLD1.S16          {Q0, Q1}, [r0]!               @load 16 Word16 x[]
+	  VLD1.S16          {Q2, Q3}, [r1]!
+          VMLAL.S16         Q15, D4, D0
           VMLAL.S16         Q15, D5, D1
           VMLAL.S16         Q15, D6, D2
           VMLAL.S16         Q15, D7, D3
@@ -102,11 +102,11 @@
 	  VMLAL.S16         Q15, D2, D2
 	  VMLAL.S16         Q15, D3, D3
 
-Lable1: 
+Lable1:
 
           VQADD.S32         D30, D30, D31
           VPADD.S32         D30, D30, D30
-          VMOV.S32          r12, D30[0]        
+          VMOV.S32          r12, D30[0]
 
 	  ADD               r12, r12, r12
           ADD               r12, r12, #1                         @ L_sum = (L_sum << 1)  + 1
@@ -117,11 +117,11 @@
           SUB               r10, r10, #1                         @ sft = norm_l(L_sum)
           MOV               r0, r12, LSL r10                     @ L_sum = L_sum << sft
           RSB               r11, r10, #30                        @ *exp = 30 - sft
-          STRH              r11, [r3]                     
+          STRH              r11, [r3]
 
 Dot_product12_end:
-		     
-          LDMFD   	    r13!, {r4 - r12, r15} 
+
+          LDMFD   	    r13!, {r4 - r12, r15}
 
           .END
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Filt_6k_7k_neon.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Filt_6k_7k_neon.s
index 5389a1c..14ba828 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Filt_6k_7k_neon.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Filt_6k_7k_neon.s
@@ -13,7 +13,7 @@
 @ ** See the License for the specific language governing permissions and
 @ ** limitations under the License.
 @ */
-@                             
+@
 @**********************************************************************/
 @void Filt_6k_7k(
 @     Word16 signal[],                      /* input:  signal                  */
@@ -23,7 +23,7 @@
 @***********************************************************************
 @ r0    ---  signal[]
 @ r1    ---  lg
-@ r2    ---  mem[] 
+@ r2    ---  mem[]
 
           .section  .text
           .global   Filt_6k_7k_asm
@@ -31,7 +31,7 @@
 
 Filt_6k_7k_asm:
 
-          STMFD   		r13!, {r0 - r12, r14} 
+          STMFD   		r13!, {r0 - r12, r14}
           SUB    		r13, r13, #240              @ x[L_SUBFR16k + (L_FIR - 1)]
           MOV     		r8, r0                      @ copy signal[] address
           MOV     		r5, r2                      @ copy mem[] address
@@ -49,7 +49,7 @@
 
 
 
-          LDR     		r10, Lable1                 @ get fir_7k address     
+          LDR     		r10, Lable1                 @ get fir_7k address
           MOV                   r3, r8                      @ change myMemCopy to Copy, due to Copy will change r3 content
           ADD     	    	r6, r13, #60                @ get x[L_FIR - 1] address
           MOV           	r7, r3                      @ get signal[i]
@@ -81,9 +81,9 @@
 	  MOV                   r12, r5
           @STR     		r5, [sp, #-4]               @ PUSH  r5 to stack
           @ not use registers: r4, r10, r12, r14, r5
-          MOV     		r4, r13 
-          MOV     		r5, #0                      @ i = 0    
-         
+          MOV     		r4, r13
+          MOV     		r5, #0                      @ i = 0
+
           @ r4 --- x[i], r10 ---- fir_6k_7k
           VLD1.S16              {Q0, Q1}, [r10]!           @fir_6k_7k[0]  ~ fir_6k_7k[15]
 	  VLD1.S16              {Q2, Q3}, [r10]!           @fir_6k_7k[16] ~ fir_6k_7k[31]
@@ -91,20 +91,20 @@
 
 	  VLD1.S16              {Q4, Q5}, [r4]!            @x[0]  ~ x[15]
 	  VLD1.S16              {Q6, Q7}, [r4]!            @x[16] ~ X[31]
-	  VLD1.S16              {Q8}, [r4]! 
-          VMOV.S16              Q15, #0	  
-          
+	  VLD1.S16              {Q8}, [r4]!
+          VMOV.S16              Q15, #0
+
 LOOP_6K7K:
 
-          VMULL.S16             Q9,D8,D0[0]                 
-          VMULL.S16             Q10,D9,D1[0] 
-          VMULL.S16             Q11,D9,D0[0]                 
+          VMULL.S16             Q9,D8,D0[0]
+          VMULL.S16             Q10,D9,D1[0]
+          VMULL.S16             Q11,D9,D0[0]
           VMULL.S16             Q12,D10,D1[0]
           VEXT.8                Q4,Q4,Q5,#2
           VMLAL.S16             Q9,D10,D2[0]
           VMLAL.S16             Q10,D11,D3[0]
           VMLAL.S16             Q11,D11,D2[0]
-          VMLAL.S16             Q12,D12,D3[0]    
+          VMLAL.S16             Q12,D12,D3[0]
           VEXT.8                Q5,Q5,Q6,#2
           VMLAL.S16             Q9,D12,D4[0]
           VMLAL.S16             Q10,D13,D5[0]
@@ -115,18 +115,18 @@
           VMLAL.S16             Q10,D15,D7[0]
           VMLAL.S16             Q11,D15,D6[0]
 	  VMLAL.S16             Q12,D16,D7[0]
-	  VEXT.8  		Q7,Q7,Q8,#2 
+	  VEXT.8  		Q7,Q7,Q8,#2
 
-	  VMLAL.S16 		Q9,D8,D0[1]                
+	  VMLAL.S16 		Q9,D8,D0[1]
 	  VMLAL.S16     	Q10,D9,D1[1]
-	  VEXT.8 		Q8,Q8,Q15,#2 
-	  VMLAL.S16 		Q11,D9,D0[1]                
+	  VEXT.8 		Q8,Q8,Q15,#2
+	  VMLAL.S16 		Q11,D9,D0[1]
 	  VMLAL.S16 		Q12,D10,D1[1]
 	  VEXT.8  		Q4,Q4,Q5,#2
 	  VMLAL.S16 		Q9,D10,D2[1]
 	  VMLAL.S16 		Q10,D11,D3[1]
 	  VMLAL.S16 		Q11,D11,D2[1]
-	  VMLAL.S16 		Q12,D12,D3[1]    
+	  VMLAL.S16 		Q12,D12,D3[1]
 	  VEXT.8  		Q5,Q5,Q6,#2
 	  VMLAL.S16 		Q9,D12,D4[1]
 	  VMLAL.S16 		Q10,D13,D5[1]
@@ -137,18 +137,18 @@
 	  VMLAL.S16 		Q10,D15,D7[1]
 	  VMLAL.S16 		Q11,D15,D6[1]
 	  VMLAL.S16 		Q12,D16,D7[1]
-	  VEXT.8  		Q7,Q7,Q8,#2 
+	  VEXT.8  		Q7,Q7,Q8,#2
 
-	  VMLAL.S16 		Q9,D8,D0[2]           
+	  VMLAL.S16 		Q9,D8,D0[2]
 	  VMLAL.S16 		Q10,D9,D1[2]
-	  VEXT.8 		Q8,Q8,Q15,#2 
-	  VMLAL.S16 		Q11,D9,D0[2]           
+	  VEXT.8 		Q8,Q8,Q15,#2
+	  VMLAL.S16 		Q11,D9,D0[2]
 	  VMLAL.S16 		Q12,D10,D1[2]
 	  VEXT.8  		Q4,Q4,Q5,#2
 	  VMLAL.S16 		Q9,D10,D2[2]
 	  VMLAL.S16 		Q10,D11,D3[2]
 	  VMLAL.S16 		Q11,D11,D2[2]
-	  VMLAL.S16 		Q12,D12,D3[2]    
+	  VMLAL.S16 		Q12,D12,D3[2]
 	  VEXT.8  		Q5,Q5,Q6,#2
 	  VMLAL.S16 		Q9,D12,D4[2]
 	  VMLAL.S16 		Q10,D13,D5[2]
@@ -159,18 +159,18 @@
 	  VMLAL.S16 		Q10,D15,D7[2]
 	  VMLAL.S16 		Q11,D15,D6[2]
 	  VMLAL.S16 		Q12,D16,D7[2]
-	  VEXT.8  		Q7,Q7,Q8,#2 
+	  VEXT.8  		Q7,Q7,Q8,#2
 
-	  VMLAL.S16 		Q9,D8,D0[3]              
+	  VMLAL.S16 		Q9,D8,D0[3]
 	  VMLAL.S16 		Q10,D9,D1[3]
-	  VEXT.8 		Q8,Q8,Q15,#2 
-	  VMLAL.S16 		Q11,D9,D0[3]              
+	  VEXT.8 		Q8,Q8,Q15,#2
+	  VMLAL.S16 		Q11,D9,D0[3]
 	  VMLAL.S16 		Q12,D10,D1[3]
 	  VEXT.8  		Q4,Q4,Q5,#2
 	  VMLAL.S16 		Q9,D10,D2[3]
 	  VMLAL.S16 		Q10,D11,D3[3]
 	  VMLAL.S16 		Q11,D11,D2[3]
-	  VMLAL.S16 		Q12,D12,D3[3]    
+	  VMLAL.S16 		Q12,D12,D3[3]
 	  VEXT.8  		Q5,Q5,Q6,#2
 	  VMLAL.S16 		Q9,D12,D4[3]
 	  VMLAL.S16 		Q10,D13,D5[3]
@@ -181,10 +181,10 @@
 	  VMLAL.S16 		Q10,D15,D7[3]
 	  VMLAL.S16 		Q11,D15,D6[3]
 	  VMLAL.S16 		Q12,D16,D7[3]
-	  VEXT.8 		Q7,Q7,Q8,#2     
+	  VEXT.8 		Q7,Q7,Q8,#2
 
 	  VMOV.S16  		D8,D9
-	  VEXT.8 		Q8,Q8,Q15,#2 
+	  VEXT.8 		Q8,Q8,Q15,#2
 	  VMOV.S16  		D9,D10
 	  VADD.S32  		Q9,Q9,Q10
 	  VMOV.S16  		D10,D11
@@ -214,12 +214,12 @@
 	  VST1.S16              {D4, D5, D6}, [r1]!
 	  VST1.S16              D7[0], [r1]!
 	  VST1.S16              D7[1], [r1]!
-                    
+
 Filt_6k_7k_end:
 
-          ADD     		r13, r13, #240  
-          LDMFD   		r13!, {r0 - r12, r15} 
- 
+          ADD     		r13, r13, #240
+          LDMFD   		r13!, {r0 - r12, r15}
+
 Lable1:
           .word   		fir_6k_7k
           @ENDFUNC
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Norm_Corr_neon.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Norm_Corr_neon.s
index 60e9ade..4263cd4 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Norm_Corr_neon.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Norm_Corr_neon.s
@@ -33,7 +33,7 @@
 
 
 	.section  .text
-        .global    Norm_corr_asm 
+        .global    Norm_corr_asm
         .extern    Convolve_asm
         .extern    Isqrt_n
 @******************************
@@ -47,17 +47,17 @@
 .equ    T_MIN             , 212
 .equ    T_MAX             , 216
 .equ    CORR_NORM         , 220
-                  
+
 Norm_corr_asm:
 
-        STMFD          r13!, {r4 - r12, r14}  
+        STMFD          r13!, {r4 - r12, r14}
         SUB            r13, r13, #voSTACK
-  
+
         ADD            r8, r13, #20                 @get the excf[L_SUBFR]
         LDR            r4, [r13, #T_MIN]            @get t_min
         RSB            r11, r4, #0                  @k = -t_min
-        ADD            r5, r0, r11, LSL #1          @get the &exc[k]   
-        
+        ADD            r5, r0, r11, LSL #1          @get the &exc[k]
+
         @transfer Convolve function
         STMFD          sp!, {r0 - r3}
         MOV            r0, r5
@@ -68,7 +68,7 @@
 
         @ r8 --- excf[]
 
-	MOV            r14, r1                       @copy xn[] address                      
+	MOV            r14, r1                       @copy xn[] address
         MOV            r7, #1
 	VLD1.S16       {Q0, Q1}, [r14]!
 	VLD1.S16       {Q2, Q3}, [r14]!
@@ -95,34 +95,34 @@
         VQADD.S32      D20, D20, D21
         VMOV.S32       r9,  D20[0]
         VMOV.S32       r10, D20[1]
-        QADD           r6, r9, r10 
+        QADD           r6, r9, r10
 	QADD           r6, r6, r6
         QADD           r9, r6, r7                   @L_tmp = (L_tmp << 1) + 1;
 	CLZ            r7, r9
 	SUB            r6, r7, #1                   @exp = norm_l(L_tmp)
         RSB            r7, r6, #32                  @exp = 32 - exp
-	MOV            r6, r7, ASR #1         
+	MOV            r6, r7, ASR #1
 	RSB            r7, r6, #0                   @scale = -(exp >> 1)
-	
+
         @loop for every possible period
 	@for(t = t_min@ t <= t_max@ t++)
 	@r7 --- scale r4 --- t_min r8 --- excf[]
 
-LOOPFOR:	
+LOOPFOR:
 	ADD            r14, r13, #20                @copy of excf[]
 	MOV            r12, r1                      @copy of xn[]
 	MOV            r8, #0x8000
 
         VLD1.S16       {Q0, Q1}, [r14]!                 @ load 16 excf[]
-        VLD1.S16       {Q2, Q3}, [r14]!                 @ load 16 excf[]       
+        VLD1.S16       {Q2, Q3}, [r14]!                 @ load 16 excf[]
         VLD1.S16       {Q4, Q5}, [r12]!                 @ load 16 x[]
 	VLD1.S16       {Q6, Q7}, [r12]!                 @ load 16 x[]
         VMULL.S16    Q10, D0, D0                      @L_tmp1 += excf[] * excf[]
-        VMULL.S16    Q11, D0, D8                      @L_tmp  += x[] * excf[]                   
+        VMULL.S16    Q11, D0, D8                      @L_tmp  += x[] * excf[]
         VMLAL.S16    Q10, D1, D1
         VMLAL.S16    Q11, D1, D9
         VMLAL.S16    Q10, D2, D2
-        VMLAL.S16    Q11, D2, D10        
+        VMLAL.S16    Q11, D2, D10
         VMLAL.S16    Q10, D3, D3
         VMLAL.S16    Q11, D3, D11
         VMLAL.S16    Q10, D4, D4
@@ -143,7 +143,7 @@
         VMLAL.S16    Q10, D1, D1
         VMLAL.S16    Q11, D1, D9
         VMLAL.S16    Q10, D2, D2
-        VMLAL.S16    Q11, D2, D10        
+        VMLAL.S16    Q11, D2, D10
         VMLAL.S16    Q10, D3, D3
         VMLAL.S16    Q11, D3, D11
         VMLAL.S16    Q10, D4, D4
@@ -162,19 +162,19 @@
 	VPADD.S32      D22, D22, D22                   @D22[0] --- L_tmp << 1
 
 	VMOV.S32       r6, D20[0]
-        VMOV.S32       r5, D22[0]	
+        VMOV.S32       r5, D22[0]
 
 	@r5 --- L_tmp, r6 --- L_tmp1
 	MOV            r10, #1
 	ADD            r5, r10, r5, LSL #1                     @L_tmp = (L_tmp << 1) + 1
 	ADD            r6, r10, r6, LSL #1                     @L_tmp1 = (L_tmp1 << 1) + 1
- 
-	CLZ            r10, r5        
+
+	CLZ            r10, r5
 	CMP            r5, #0
 	RSBLT          r11, r5, #0
 	CLZLT          r10, r11
 	SUB            r10, r10, #1                 @exp = norm_l(L_tmp)
-     
+
 	MOV            r5, r5, LSL r10              @L_tmp = (L_tmp << exp)
 	RSB            r10, r10, #30                @exp_corr = 30 - exp
 	MOV            r11, r5, ASR #16             @corr = extract_h(L_tmp)
@@ -190,7 +190,7 @@
 	@Isqrt_n(&L_tmp, &exp_norm)
 
 	MOV            r14, r0
-	MOV            r12, r1 
+	MOV            r12, r1
 
         STMFD          sp!, {r0 - r4, r7 - r12, r14}
 	ADD            r1, sp, #4
@@ -208,7 +208,7 @@
 	MOV            r6, r6, ASR #16              @norm = extract_h(L_tmp)
 	MUL            r12, r6, r11
 	ADD            r12, r12, r12                @L_tmp = vo_L_mult(corr, norm)
-  
+
 	ADD            r6, r10, r5
 	ADD            r6, r6, r7                   @exp_corr + exp_norm + scale
 
@@ -227,8 +227,8 @@
 
 	CMP            r4, r6
 	BEQ            Norm_corr_asm_end
- 
-	ADD            r4, r4, #1                   @ t_min ++ 
+
+	ADD            r4, r4, #1                   @ t_min ++
 	RSB            r5, r4, #0                   @ k
 
 	MOV            r6, #63                      @ i = 63
@@ -255,16 +255,16 @@
 	MUL            r14, r11, r8
         LDR            r6, [r13, #T_MAX]            @ get t_max
 	MOV            r8, r14, ASR #15
-	STRH           r8, [r10]                    
+	STRH           r8, [r10]
 
 	CMP            r4, r6
 	BLE            LOOPFOR
 
-Norm_corr_asm_end: 
-        
-        ADD            r13, r13, #voSTACK      
+Norm_corr_asm_end:
+
+        ADD            r13, r13, #voSTACK
         LDMFD          r13!, {r4 - r12, r15}
-    
+
         .END
 
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Syn_filt_32_neon.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Syn_filt_32_neon.s
index 1e65efa..e786dde 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Syn_filt_32_neon.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Syn_filt_32_neon.s
@@ -33,12 +33,12 @@
 @ sig_lo[] --- r5
 @ lg       --- r6
 
-          .section  .text 
+          .section  .text
           .global   Syn_filt_32_asm
 
 Syn_filt_32_asm:
 
-          STMFD   	r13!, {r4 - r12, r14} 
+          STMFD   	r13!, {r4 - r12, r14}
           LDR           r4,  [r13, #40]                  @ get sig_hi[] address
           LDR           r5,  [r13, #44]                  @ get sig_lo[] address
 
@@ -49,8 +49,8 @@
 	  SUB           r10, r4, #32                     @ sig_hi[-16] address
 	  SUB           r11, r5, #32                     @ sig_lo[-16] address
 
-	  VLD1.S16      {D0, D1, D2, D3}, [r0]!          @a[1] ~ a[16] 
-  
+	  VLD1.S16      {D0, D1, D2, D3}, [r0]!          @a[1] ~ a[16]
+
           MOV           r8, #0                           @ i = 0
 
 	  VLD1.S16      {D4, D5, D6, D7}, [r10]!         @ sig_hi[-16] ~ sig_hi[-1]
@@ -58,9 +58,9 @@
           VREV64.16     D1, D1
 	  VLD1.S16      {D8, D9, D10, D11}, [r11]!       @ sig_lo[-16] ~ sig_lo[-1]
           VREV64.16     D2, D2
-          VREV64.16     D3, D3	
+          VREV64.16     D3, D3
           VDUP.S32      Q15, r8
-              
+
 SYN_LOOP:
 
           LDRSH         r6, [r2], #2                     @exc[i]
@@ -73,12 +73,12 @@
 
 	  VEXT.8        D9, D9, D10, #2
 	  VEXT.8        D10, D10, D11, #2
-	  
+
 	  VPADD.S32     D28, D20, D21
           MUL           r12, r6, r3                      @exc[i] * a0
 	  VPADD.S32     D29, D28, D28
 	  VDUP.S32      Q10, D29[0]                      @result1
-          
+
 	  VMULL.S16     Q11, D4, D3
 	  VMLAL.S16     Q11, D5, D2
           VSUB.S32      Q10, Q15, Q10
@@ -101,7 +101,7 @@
 
 	  VSHR.S32      Q10, Q10, #11                    @result1 >>= 11
 	  VSHL.S32      Q11, Q11, #1                     @result2 <<= 1
-	  VDUP.S32      Q12, r14                         
+	  VDUP.S32      Q12, r14
 	  VADD.S32      Q12, Q12, Q10                    @L_tmp = L_tmp - (result1 >>= 11) - (result2 <<= 1)
 	  VSUB.S32      Q12, Q12, Q11
 
@@ -122,12 +122,12 @@
 	  STRH          r12, [r5], #2                    @stroe sig_lo[i]
 
           CMP           r8, #64
-          BLT           SYN_LOOP                          
-         
+          BLT           SYN_LOOP
+
 Syn_filt_32_end:
-		     
-          LDMFD   	    r13!, {r4 - r12, r15} 
+
+          LDMFD   	    r13!, {r4 - r12, r15}
           @ENDFUNC
           .END
- 
+
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/convolve_neon.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/convolve_neon.s
index 189e33b..8efa9fb 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/convolve_neon.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/convolve_neon.s
@@ -20,22 +20,22 @@
 @*    Word16 y[],        /* (o)     : output vector                          */
 @*    Word16 L           /* (i)     : vector size                            */
 @*)
-@ 
+@
 @ r0 --- x[]
 @ r1 --- h[]
 @ r2 --- y[]
 @ r3 --- L
 
-	.section  .text 
-        .global   Convolve_asm 
+	.section  .text
+        .global   Convolve_asm
 
 Convolve_asm:
 
-        STMFD          r13!, {r4 - r12, r14}  
-        MOV            r3,  #0                        
+        STMFD          r13!, {r4 - r12, r14}
+        MOV            r3,  #0
 	MOV            r11, #0x8000
-        
-LOOP: 
+
+LOOP:
         @MOV            r8, #0                            @ s = 0
         ADD            r4, r1, r3, LSL #1                @ tmpH address
         ADD            r5, r3, #1                        @ i = n + 1
@@ -43,21 +43,21 @@
         LDRSH          r9,  [r6], #2                     @ *tmpX++
         LDRSH          r10, [r4]                         @ *tmpH--
         SUB            r5, r5, #1
-        VMOV.S32       Q10, #0 
-        MUL            r8,  r9, r10 
+        VMOV.S32       Q10, #0
+        MUL            r8,  r9, r10
 
-LOOP1:                    
+LOOP1:
         CMP            r5, #0
         BLE            L1
         SUB            r4, r4, #8
         MOV            r9, r4
-        VLD1.S16       D0, [r6]!   
+        VLD1.S16       D0, [r6]!
         VLD1.S16       D1, [r9]!
         VREV64.16      D1, D1
-        SUBS           r5, r5, #4  
-        VMLAL.S16      Q10, D0, D1         
-        B              LOOP1    
-L1:                  
+        SUBS           r5, r5, #4
+        VMLAL.S16      Q10, D0, D1
+        B              LOOP1
+L1:
         VADD.S32       D20, D20, D21
         VPADD.S32      D20, D20, D20
         VMOV.S32       r5, D20[0]
@@ -73,25 +73,25 @@
         ADD            r5, r3, #1
         MOV            r6, r0
         LDRSH          r9,  [r6], #2                     @ *tmpX++
-        LDRSH          r10, [r4], #-2                     
+        LDRSH          r10, [r4], #-2
         LDRSH          r12, [r6], #2
         LDRSH          r14, [r4]
 
         MUL            r8, r9, r10
         SUB            r5, r5, #2
         MLA            r8, r12, r14, r8
-        
+
         VMOV.S32       Q10, #0
 LOOP2:
         CMP            r5, #0
         BLE            L2
         SUB            r4, r4, #8
         MOV            r9, r4
-        VLD1.S16       D0, [r6]!   
+        VLD1.S16       D0, [r6]!
         VLD1.S16       D1, [r9]!
         SUBS           r5, r5, #4
         VREV64.16      D1, D1
-        VMLAL.S16      Q10, D0, D1 
+        VMLAL.S16      Q10, D0, D1
         B              LOOP2
 L2:
         VADD.S32       D20, D20, D21
@@ -100,7 +100,7 @@
         ADD            r8, r8, r5
         ADD            r8, r11, r8, LSL #1
         MOV            r8, r8, LSR #16                   @extract_h(s)
-        ADD            r3, r3, #1  
+        ADD            r3, r3, #1
         STRH           r8, [r2], #2                      @y[n]
 
 
@@ -115,7 +115,7 @@
         MUL            r8, r9, r10
         LDRSH          r9,  [r6], #2
         LDRSH          r10, [r4]
-        MLA            r8, r12, r14, r8 
+        MLA            r8, r12, r14, r8
         SUB            r5, r5, #3
         MLA            r8, r9, r10, r8
 
@@ -125,12 +125,12 @@
         BLE            L3
         SUB            r4, r4, #8
         MOV            r9, r4
-        VLD1.S16       D0, [r6]!   
+        VLD1.S16       D0, [r6]!
         VLD1.S16       D1, [r9]!
         VREV64.16      D1, D1
         SUBS           r5, r5, #4
-        VMLAL.S16      Q10, D0, D1 
-        B              LOOP3   
+        VMLAL.S16      Q10, D0, D1
+        B              LOOP3
 
 L3:
         VADD.S32       D20, D20, D21
@@ -146,18 +146,18 @@
         ADD            r4, r1, r5, LSL #1                @ tmpH address
         MOV            r6, r0
         VMOV.S32       Q10, #0
-LOOP4:                    
+LOOP4:
         CMP            r5, #0
         BLE            L4
         SUB            r4, r4, #8
         MOV            r9, r4
-        VLD1.S16       D0, [r6]!   
+        VLD1.S16       D0, [r6]!
         VLD1.S16       D1, [r9]!
         VREV64.16      D1, D1
-        SUBS           r5, r5, #4  
-        VMLAL.S16      Q10, D0, D1         
-        B              LOOP4    
-L4:                  
+        SUBS           r5, r5, #4
+        VMLAL.S16      Q10, D0, D1
+        B              LOOP4
+L4:
         VADD.S32       D20, D20, D21
         VPADD.S32      D20, D20, D20
         VMOV.S32       r5,  D20[0]
@@ -165,14 +165,14 @@
         MOV            r5, r5, LSR #16                   @extract_h(s)
         ADD            r3, r3, #1
         STRH           r5, [r2], #2                      @y[n]
-        
+
         CMP            r3, #64
         BLT            LOOP
-                
-Convolve_asm_end: 
- 
+
+Convolve_asm_end:
+
         LDMFD      r13!, {r4 - r12, r15}
-    
+
         @ENDFUNC
         .END
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/cor_h_vec_neon.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/cor_h_vec_neon.s
index c314a88..8904289 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/cor_h_vec_neon.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/cor_h_vec_neon.s
@@ -31,7 +31,7 @@
 @r5 ---- cor_1[]
 @r6 ---- cor_2[]
 
-              .section .text 
+              .section .text
 	      .global  cor_h_vec_012_asm
 
 cor_h_vec_012_asm:
@@ -52,12 +52,12 @@
 	     RSB           r11, r2, #62                      @j=62-pos
 
 LOOPj1:
-	     LDRSH         r12, [r10], #2  
+	     LDRSH         r12, [r10], #2
 	     LDRSH         r8,  [r9], #2
 	     LDRSH         r14, [r9]
 	     SUBS          r11, r11, #1
              MLA           r5, r12, r8, r5
-             MLA           r6, r12, r14, r6	 
+             MLA           r6, r12, r14, r6
 	     BGE           LOOPj1
 
 	     LDRSH         r12, [r10], #2                     @*p1++
@@ -65,7 +65,7 @@
              MLA           r5, r12, r14, r5
              MOV           r14, #0x8000
              MOV           r5, r5, LSL #2                     @L_sum1 = (L_sum1 << 2)
-             ADD           r10, r6, r14         
+             ADD           r10, r6, r14
              ADD           r9, r5, r14
              MOV           r5, r9, ASR #16
              MOV           r6, r10, ASR #16
@@ -77,7 +77,7 @@
 	     MUL           r14, r6, r11
 	     MOV           r5, r12, ASR #15
 	     MOV           r6, r14, ASR #15
-	     LDR           r9,  [r13, #44]                   
+	     LDR           r9,  [r13, #44]
 	     LDR           r12, [r13, #48]
              LDRSH         r10, [r7], #2                      @*p0++
 	     LDRSH         r11, [r8]                          @*p3++
@@ -89,7 +89,7 @@
 	     STRH          r6, [r12]
 
              ADD           r2, r2, #4
- 
+
              MOV           r5, #0                            @L_sum1 = 0
 	     MOV           r6, #0                            @L_sum2 = 0
 	     ADD           r9, r1, r2, LSL #1                @p2 = &vec[pos]
@@ -98,12 +98,12 @@
 	     ADD           r4, r4, #1                        @i++
 
 LOOPj2:
-	     LDRSH         r12, [r10], #2  
+	     LDRSH         r12, [r10], #2
 	     LDRSH         r8,  [r9], #2
 	     LDRSH         r14, [r9]
 	     SUBS          r11, r11, #1
              MLA           r5, r12, r8, r5
-             MLA           r6, r12, r14, r6	 
+             MLA           r6, r12, r14, r6
 	     BGE           LOOPj2
 
 	     LDRSH         r12, [r10], #2                     @*p1++
@@ -111,7 +111,7 @@
              MLA           r5, r12, r14, r5
              MOV           r14, #0x8000
              MOV           r5, r5, LSL #2                     @L_sum1 = (L_sum1 << 2)
-             ADD           r10, r6, r14        
+             ADD           r10, r6, r14
              ADD           r9, r5, r14
 
              MOV           r5, r9, ASR #16
@@ -124,7 +124,7 @@
 	     MUL           r14, r6, r11
 	     MOV           r5, r12, ASR #15
 	     MOV           r6, r14, ASR #15
-	     LDR           r9,  [r13, #44]                   
+	     LDR           r9,  [r13, #44]
 	     LDR           r12, [r13, #48]
              LDRSH         r10, [r7], #2                      @*p0++
 	     LDRSH         r11, [r8]                          @*p3++
@@ -137,15 +137,15 @@
 	     ADD           r4, r4, #1                         @i+1
 	     ADD           r2, r2, #4                         @pos += STEP
 	     CMP           r4, #16
-	     
+
 	     BLT           LOOPi
-         
+
 the_end:
              LDMFD         r13!, {r4 - r12, r15}
-             
-	     .END	 
-        
-	
-	  
+
+	     .END
+
+
+
 
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/pred_lt4_1_neon.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/pred_lt4_1_neon.s
index dffb750..6b782cb 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/pred_lt4_1_neon.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/pred_lt4_1_neon.s
@@ -25,14 +25,14 @@
 @ r1    ---  T0
 @ r2    ---  frac
 @ r3    ---  L_subfr
- 
-          .section  .text 
+
+          .section  .text
           .global   pred_lt4_asm
           .extern   inter4_2
 
 pred_lt4_asm:
 
-          STMFD   	r13!, {r4 - r12, r14} 
+          STMFD   	r13!, {r4 - r12, r14}
           SUB           r4, r0, r1, LSL #1                        @ x = exc - T0
           RSB           r2, r2, #0                                @ frac = - frac
           SUB           r4, r4, #30                               @ x -= L_INTERPOL2 - 1
@@ -47,8 +47,8 @@
 
 	  VLD1.S16      {Q0, Q1}, [r11]!
 	  VLD1.S16      {Q2, Q3}, [r11]!
-          
-	  MOV           r6, #0x8000 
+
+	  MOV           r6, #0x8000
 
           VLD1.S16      {Q4, Q5}, [r4]!                           @load 16 x[]
           VLD1.S16      {Q6, Q7}, [r4]!                           @load 16 x[]
@@ -58,14 +58,14 @@
           VQDMLAL.S16   Q15, D9, D1
           VQDMLAL.S16   Q15, D10, D2
           VQDMLAL.S16   Q15, D11, D3
-        
+
           VQDMLAL.S16   Q15, D12, D4
           VQDMLAL.S16   Q15, D13, D5
           VQDMLAL.S16   Q15, D14, D6
           VQDMLAL.S16   Q15, D15, D7
 
-          LDRSH         r12, [r4], #2                
-          
+          LDRSH         r12, [r4], #2
+
           VEXT.S16      D8, D8, D9, #1
           VEXT.S16      D9, D9, D10, #1
           VEXT.S16      D10, D10, D11, #1
@@ -73,26 +73,26 @@
           VDUP.S16      D24, r12
           VEXT.S16      D12, D12, D13, #1
           VEXT.S16      D13, D13, D14, #1
-     
+
           VQADD.S32     D30, D30, D31
-	  MOV           r11, #0x8000          
+	  MOV           r11, #0x8000
           VPADD.S32     D30, D30, D30
           ADD           r8, r8, #1
           VMOV.S32      r12, D30[0]
-          VEXT.S16      D14, D14, D15, #1          
+          VEXT.S16      D14, D14, D15, #1
 
           QADD          r1, r12, r12                              @ L_sum = (L_sum << 2)
           VEXT.S16      D15, D15, D24, #1
-          QADD          r5, r1, r6                         
+          QADD          r5, r1, r6
           MOV           r1, r5, ASR #16
           CMP           r8, r3
           STRH          r1, [r0], #2                              @ exc[j] = (L_sum + 0x8000) >> 16
           BLT           LOOP
-                    
+
 pred_lt4_end:
-		     
-          LDMFD   	r13!, {r4 - r12, r15} 
- 
+
+          LDMFD   	r13!, {r4 - r12, r15}
+
 Lable1:
           .word   	inter4_2
           @ENDFUNC
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/residu_asm_neon.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/residu_asm_neon.s
index b9e6b23..394fa83 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/residu_asm_neon.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/residu_asm_neon.s
@@ -26,17 +26,17 @@
 @lg         RN     r3
 
 	.section   .text
-        .global    Residu_opt 
+        .global    Residu_opt
 
 Residu_opt:
 
-        STMFD          r13!, {r4 - r12, r14} 
+        STMFD          r13!, {r4 - r12, r14}
         SUB            r7, r3, #4                       @i = lg - 4
-        
-        VLD1.S16       {D0, D1, D2, D3}, [r0]!              @get all a[]  
+
+        VLD1.S16       {D0, D1, D2, D3}, [r0]!              @get all a[]
 	VLD1.S16       {D4}, [r0]!
         VMOV.S32       Q8,  #0x8000
-        
+
 LOOP1:
         ADD            r9, r1, r7, LSL #1               @copy the address
         ADD            r10, r2, r7, LSL #1
@@ -45,7 +45,7 @@
         VQDMULL.S16    Q10, D5, D0[0]                  @finish the first L_mult
 
         SUB            r8, r9, #2                       @get the x[i-1] address
-        VLD1.S16       D5, [r8]! 
+        VLD1.S16       D5, [r8]!
         VQDMLAL.S16    Q10, D5, D0[1]
 
         SUB            r8, r9, #4                       @load the x[i-2] address
@@ -53,36 +53,36 @@
         VQDMLAL.S16    Q10, D5, D0[2]
 
         SUB            r8, r9, #6                       @load the x[i-3] address
-        VLD1.S16       D5, [r8]!     
-        VQDMLAL.S16    Q10, D5, D0[3]                    
+        VLD1.S16       D5, [r8]!
+        VQDMLAL.S16    Q10, D5, D0[3]
 
         SUB            r8, r9, #8                       @load the x[i-4] address
-        VLD1.S16       D5, [r8]!     
-        VQDMLAL.S16    Q10, D5, D1[0]  
+        VLD1.S16       D5, [r8]!
+        VQDMLAL.S16    Q10, D5, D1[0]
 
         SUB            r8, r9, #10                      @load the x[i-5] address
-        VLD1.S16       D5, [r8]!     
-        VQDMLAL.S16    Q10, D5, D1[1] 
+        VLD1.S16       D5, [r8]!
+        VQDMLAL.S16    Q10, D5, D1[1]
 
         SUB            r8, r9, #12                      @load the x[i-6] address
-        VLD1.S16       D5, [r8]!     
-        VQDMLAL.S16    Q10, D5, D1[2]  
+        VLD1.S16       D5, [r8]!
+        VQDMLAL.S16    Q10, D5, D1[2]
 
         SUB            r8, r9, #14                      @load the x[i-7] address
-        VLD1.S16       D5, [r8]!     
-        VQDMLAL.S16    Q10, D5, D1[3]  
+        VLD1.S16       D5, [r8]!
+        VQDMLAL.S16    Q10, D5, D1[3]
 
         SUB            r8, r9, #16                      @load the x[i-8] address
-        VLD1.S16       D5, [r8]!     
-        VQDMLAL.S16    Q10, D5, D2[0]  
+        VLD1.S16       D5, [r8]!
+        VQDMLAL.S16    Q10, D5, D2[0]
 
         SUB            r8, r9, #18                      @load the x[i-9] address
-        VLD1.S16       D5, [r8]!     
-        VQDMLAL.S16    Q10, D5, D2[1]         
-           
+        VLD1.S16       D5, [r8]!
+        VQDMLAL.S16    Q10, D5, D2[1]
+
         SUB            r8, r9, #20                      @load the x[i-10] address
-        VLD1.S16       D5, [r8]!     
-        VQDMLAL.S16    Q10, D5, D2[2]  
+        VLD1.S16       D5, [r8]!
+        VQDMLAL.S16    Q10, D5, D2[2]
 
 	SUB            r8, r9, #22                      @load the x[i-11] address
 	VLD1.S16       D5, [r8]!
@@ -117,10 +117,10 @@
 
         BGE            LOOP1
 
-Residu_asm_end: 
- 
+Residu_asm_end:
+
         LDMFD      r13!, {r4 - r12, r15}
-    
+
         @ENDFUNC
         .END
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/scale_sig_neon.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/scale_sig_neon.s
index bbd354d..e45daac 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/scale_sig_neon.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/scale_sig_neon.s
@@ -13,7 +13,7 @@
 @ ** See the License for the specific language governing permissions and
 @ ** limitations under the License.
 @ */
-@                   
+@
 @**********************************************************************/
 @void Scale_sig(
 @               Word16 x[],                           /* (i/o) : signal to scale               */
@@ -25,16 +25,16 @@
 @  lg    ---  r1
 @  exp   ---  r2
 
-          .section  .text 
+          .section  .text
           .global   Scale_sig_opt
 
 Scale_sig_opt:
 
-          STMFD   	r13!, {r4 - r12, r14} 
+          STMFD   	r13!, {r4 - r12, r14}
           MOV           r4, #4
-          VMOV.S32      Q15, #0x8000       
-          VDUP.S32      Q14, r2  
-          MOV           r5, r0                          @ copy x[] address    
+          VMOV.S32      Q15, #0x8000
+          VDUP.S32      Q14, r2
+          MOV           r5, r0                          @ copy x[] address
           CMP           r1, #64
           MOVEQ         r4, #1
           BEQ           LOOP
@@ -48,7 +48,7 @@
 	  BEQ           LOOP1
 
 LOOP1:
-          VLD1.S16      {Q0, Q1}, [r5]!                 @load 16 Word16 x[]     
+          VLD1.S16      {Q0, Q1}, [r5]!                 @load 16 Word16 x[]
           VSHLL.S16     Q10, D0, #16
           VSHLL.S16     Q11, D1, #16
           VSHLL.S16     Q12, D2, #16
@@ -63,7 +63,7 @@
           VADDHN.S32    D19, Q13, Q15
           VST1.S16      {Q8, Q9}, [r0]!                 @store 16 Word16 x[]
 
-LOOP:                
+LOOP:
           VLD1.S16      {Q0, Q1}, [r5]!                 @load 16 Word16 x[]
           VLD1.S16      {Q2, Q3}, [r5]!                 @load 16 Word16 x[]
           VLD1.S16      {Q4, Q5}, [r5]!                 @load 16 Word16 x[]
@@ -72,7 +72,7 @@
           VSHLL.S16     Q8, D0, #16
           VSHLL.S16     Q9, D1, #16
           VSHLL.S16     Q10, D2, #16
-          VSHLL.S16     Q11, D3, #16     
+          VSHLL.S16     Q11, D3, #16
           VSHL.S32      Q8, Q8, Q14
           VSHL.S32      Q9, Q9, Q14
           VSHL.S32      Q10, Q10, Q14
@@ -83,7 +83,7 @@
           VADDHN.S32    D19, Q11, Q15
           VST1.S16      {Q8, Q9}, [r0]!                 @store 16 Word16 x[]
 
-   
+
           VSHLL.S16     Q12, D4, #16
           VSHLL.S16     Q13, D5, #16
           VSHLL.S16     Q10, D6, #16
@@ -112,7 +112,7 @@
           VADDHN.S32    D19, Q13, Q15
           VST1.S16      {Q8, Q9}, [r0]!                 @store 16 Word16 x[]
 
-          VSHLL.S16     Q10, D12, #16   
+          VSHLL.S16     Q10, D12, #16
           VSHLL.S16     Q11, D13, #16
           VSHLL.S16     Q12, D14, #16
           VSHLL.S16     Q13, D15, #16
@@ -123,16 +123,16 @@
           VADDHN.S32    D16, Q10, Q15
           VADDHN.S32    D17, Q11, Q15
           VADDHN.S32    D18, Q12, Q15
-          VADDHN.S32    D19, Q13, Q15 
-          VST1.S16      {Q8, Q9}, [r0]!                 @store 16 Word16 x[]  
+          VADDHN.S32    D19, Q13, Q15
+          VST1.S16      {Q8, Q9}, [r0]!                 @store 16 Word16 x[]
           SUBS          r4, r4, #1
-          BGT           LOOP     
-                
-                          
+          BGT           LOOP
+
+
 Scale_sig_asm_end:
 
-          LDMFD   	r13!, {r4 - r12, r15} 
+          LDMFD   	r13!, {r4 - r12, r15}
           @ENDFUNC
           .END
- 
+
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/syn_filt_neon.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/syn_filt_neon.s
index db4559c..5731bdb 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/syn_filt_neon.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/syn_filt_neon.s
@@ -27,21 +27,21 @@
 @ mem[]  ---   r3
 @ m ---  16  lg --- 80  update --- 1
 
-          .section  .text 
+          .section  .text
           .global   Syn_filt_asm
 
 Syn_filt_asm:
 
-          STMFD   	r13!, {r4 - r12, r14} 
+          STMFD   	r13!, {r4 - r12, r14}
           SUB           r13, r13, #700                   @ y_buf[L_FRAME16k + M16k]
-   
+
           MOV           r4, r3                           @ copy mem[] address
           MOV           r5, r13                          @ copy yy = y_buf address
 
           @ for(i = 0@ i < m@ i++)
           @{
           @    *yy++ = mem[i]@
-          @} 
+          @}
           VLD1.S16      {D0, D1, D2, D3}, [r4]!          @load 16 mems
 	  VST1.S16      {D0, D1, D2, D3}, [r5]!          @store 16 mem[] to *yy
 
@@ -54,7 +54,7 @@
 	  VREV64.16     D0, D0
 	  VREV64.16     D1, D1
 	  VREV64.16     D2, D2
-	  VREV64.16     D3, D3 
+	  VREV64.16     D3, D3
 	  MOV           r8, #0                           @ loop times
 	  MOV           r10, r13                         @ temp = y_buf
 	  ADD           r4, r13, #32                     @ yy[i] address
@@ -68,7 +68,7 @@
 	  ADD           r10, r4, r8, LSL #1              @ y[i], yy[i] address
 
 	  VDUP.S32      Q10, r12
-	  VMULL.S16     Q5, D3, D4                    
+	  VMULL.S16     Q5, D3, D4
           VMLAL.S16     Q5, D2, D5
           VMLAL.S16     Q5, D1, D6
           VMLAL.S16     Q5, D0, D7
@@ -82,25 +82,25 @@
 	  VDUP.S32      Q7, D10[0]
 
 	  VSUB.S32      Q9, Q10, Q7
-          VQRSHRN.S32   D20, Q9, #12   
+          VQRSHRN.S32   D20, Q9, #12
           VMOV.S16      r9, D20[0]
           VEXT.8        D7, D7, D20, #2
           CMP           r8, #80
           STRH          r9, [r10]                        @ yy[i]
-          STRH          r9, [r2], #2                     @ y[i]          	         
-	  
+          STRH          r9, [r2], #2                     @ y[i]
+
           BLT           SYN_LOOP
- 
+
           @ update mem[]
           ADD           r5, r13, #160                    @ yy[64] address
 	  VLD1.S16      {D0, D1, D2, D3}, [r5]!
-	  VST1.S16      {D0, D1, D2, D3}, [r3]!              
+	  VST1.S16      {D0, D1, D2, D3}, [r3]!
 
 Syn_filt_asm_end:
- 
-          ADD           r13, r13, #700		     
-          LDMFD   	r13!, {r4 - r12, r15} 
+
+          ADD           r13, r13, #700
+          LDMFD   	r13!, {r4 - r12, r15}
           @ENDFUNC
           .END
- 
+
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/autocorr.c b/media/libstagefright/codecs/amrwbenc/src/autocorr.c
index 9baa937..8c477ca 100644
--- a/media/libstagefright/codecs/amrwbenc/src/autocorr.c
+++ b/media/libstagefright/codecs/amrwbenc/src/autocorr.c
@@ -70,19 +70,19 @@
 		p1 = y;
 		for (i = 0; i < L_WINDOW; i+=4)
 		{
-			*p1 = vo_shr_r(*p1, shift); 
-			p1++;
-			*p1 = vo_shr_r(*p1, shift); 
+			*p1 = vo_shr_r(*p1, shift);
 			p1++;
 			*p1 = vo_shr_r(*p1, shift);
 			p1++;
-			*p1 = vo_shr_r(*p1, shift); 
+			*p1 = vo_shr_r(*p1, shift);
+			p1++;
+			*p1 = vo_shr_r(*p1, shift);
 			p1++;
 		}
 	}
 
 	/* Compute and normalize r[0] */
-	L_sum = 1; 
+	L_sum = 1;
 	for (i = 0; i < L_WINDOW; i+=4)
 	{
 		L_sum += vo_L_mult(y[i], y[i]);
diff --git a/media/libstagefright/codecs/amrwbenc/src/az_isp.c b/media/libstagefright/codecs/amrwbenc/src/az_isp.c
index 9333d19..43db27a 100644
--- a/media/libstagefright/codecs/amrwbenc/src/az_isp.c
+++ b/media/libstagefright/codecs/amrwbenc/src/az_isp.c
@@ -90,9 +90,9 @@
 		f1[i] = vo_round(t0 + (a[M - i] << 15));        /* =(a[i]+a[M-i])/2 */
 		f2[i] = vo_round(t0 - (a[M - i] << 15));        /* =(a[i]-a[M-i])/2 */
 	}
-	f1[NC] = a[NC];                        
+	f1[NC] = a[NC];
 	for (i = 2; i < NC; i++)               /* Divide by (1-z^-2) */
-		f2[i] = add1(f2[i], f2[i - 2]);     
+		f2[i] = add1(f2[i], f2[i - 2]);
 
 	/*---------------------------------------------------------------------*
 	 * Find the ISPs (roots of F1(z) and F2(z) ) using the                 *
@@ -107,17 +107,17 @@
 	 *---------------------------------------------------------------------*/
 	nf = 0;                                  /* number of found frequencies */
 	ip = 0;                                  /* indicator for f1 or f2      */
-	coef = f1;                             
-	order = NC;                            
-	xlow = vogrid[0];                        
+	coef = f1;
+	order = NC;
+	xlow = vogrid[0];
 	ylow = Chebps2(xlow, coef, order);
 	j = 0;
 	while ((nf < M - 1) && (j < GRID_POINTS))
 	{
 		j ++;
-		xhigh = xlow;                     
-		yhigh = ylow;                      
-		xlow = vogrid[j];                    
+		xhigh = xlow;
+		yhigh = ylow;
+		xlow = vogrid[j];
 		ylow = Chebps2(xlow, coef, order);
 		if ((ylow * yhigh) <= (Word32) 0)
 		{
@@ -128,12 +128,12 @@
 				ymid = Chebps2(xmid, coef, order);
 				if ((ylow * ymid) <= (Word32) 0)
 				{
-					yhigh = ymid;         
-					xhigh = xmid;          
+					yhigh = ymid;
+					xhigh = xmid;
 				} else
 				{
-					ylow = ymid;           
-					xlow = xmid;          
+					ylow = ymid;
+					xlow = xmid;
 				}
 			}
 			/*-------------------------------------------------------------*
@@ -144,10 +144,10 @@
 			y = yhigh - ylow;
 			if (y == 0)
 			{
-				xint = xlow;               
+				xint = xlow;
 			} else
 			{
-				sign = y;                 
+				sign = y;
 				y = abs_s(y);
 				exp = norm_s(y);
 				y = y << exp;
@@ -161,19 +161,19 @@
 				t0 = (t0 >> 10);        /* result in Q15 */
 				xint = vo_sub(xlow, vo_extract_l(t0));        /* xint = xlow - ylow*y */
 			}
-			isp[nf] = xint;                
-			xlow = xint;                   
-			nf++;                          
+			isp[nf] = xint;
+			xlow = xint;
+			nf++;
 			if (ip == 0)
 			{
-				ip = 1;                    
-				coef = f2;                
-				order = NC - 1;           
+				ip = 1;
+				coef = f2;
+				order = NC - 1;
 			} else
 			{
-				ip = 0;                   
-				coef = f1;                 
-				order = NC;              
+				ip = 0;
+				coef = f1;
+				order = NC;
 			}
 			ylow = Chebps2(xlow, coef, order);
 		}
@@ -183,7 +183,7 @@
 	{
 		for (i = 0; i < M; i++)
 		{
-			isp[i] = old_isp[i];          
+			isp[i] = old_isp[i];
 		}
 	} else
 	{
@@ -243,9 +243,9 @@
 		b0_l = (t0 & 0xffff) >> 1;
 
 		b2_l = b1_l;                         /* b2 = b1; */
-		b2_h = b1_h;                       
+		b2_h = b1_h;
 		b1_l = b0_l;                         /* b1 = b0; */
-		b1_h = b0_h;                       
+		b1_h = b0_h;
 	}
 
 	t0 = ((b1_h * x)<<1) + (((b1_l * x)>>15)<<1);
diff --git a/media/libstagefright/codecs/amrwbenc/src/bits.c b/media/libstagefright/codecs/amrwbenc/src/bits.c
index 61cac3d5..e78dc1f 100644
--- a/media/libstagefright/codecs/amrwbenc/src/bits.c
+++ b/media/libstagefright/codecs/amrwbenc/src/bits.c
@@ -34,8 +34,8 @@
 
 int PackBits(Word16 prms[],             /*  i: analysis parameters */
 			 Word16 coding_mode,        /*  i: coding bit-stream ratio mode */
-			 Word16 mode,               /*  i: coding bit-stream ratio mode*/ 
-			 Coder_State *st            /*i/o: coder global parameters struct */           
+			 Word16 mode,               /*  i: coding bit-stream ratio mode*/
+			 Coder_State *st            /*i/o: coder global parameters struct */
 			 )
 {
 	Word16 i, frame_type;
@@ -46,7 +46,7 @@
 	unsigned short* dataOut = st->outputStream;
 
 	if (coding_mode == MRDTX)
-	{	   
+	{
 		st->sid_update_counter--;
 
 		if (st->prev_ft == TX_SPEECH)
@@ -92,7 +92,7 @@
 	} else
 	{
 		if (bitstreamformat == 1)		/* ITU file format */
-		{  						
+		{
 			*(dataOut) = 0x6b21;
 			if(frame_type != TX_NO_DATA && frame_type != TX_SID_FIRST)
 			{
@@ -100,17 +100,17 @@
 				for (i = 0; i < nb_of_bits[coding_mode]; i++)
 				{
 					if(prms[i] == BIT_0){
-						*(dataOut + 2 + i) = BIT_0_ITU;	 			
+						*(dataOut + 2 + i) = BIT_0_ITU;
 					}
 					else{
 						*(dataOut + 2 + i) = BIT_1_ITU;
 					}
 				}
-				return (2 + nb_of_bits[coding_mode])<<1;   
+				return (2 + nb_of_bits[coding_mode])<<1;
 			} else
 			{
 				*(dataOut + 1) = 0;
-				return 2<<1;	   
+				return 2<<1;
 			}
 		} else							/* MIME/storage file format */
 		{
@@ -191,7 +191,7 @@
 		)
 {
 	Word16 i, bit;
-	*prms += no_of_bits;                  
+	*prms += no_of_bits;
 	for (i = 0; i < no_of_bits; i++)
 	{
 		bit = (Word16) (value & 0x0001);    /* get lsb */
@@ -199,9 +199,9 @@
 			*--(*prms) = BIT_0;
 		else
 			*--(*prms) = BIT_1;
-		value >>= 1;          
+		value >>= 1;
 	}
-	*prms += no_of_bits;                  
+	*prms += no_of_bits;
 	return;
 }
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/c2t64fx.c b/media/libstagefright/codecs/amrwbenc/src/c2t64fx.c
index 80990d9..18698e2 100644
--- a/media/libstagefright/codecs/amrwbenc/src/c2t64fx.c
+++ b/media/libstagefright/codecs/amrwbenc/src/c2t64fx.c
@@ -79,7 +79,7 @@
 #endif
 
 	Isqrt_n(&s, &exp);
-	s = L_shl(s, add1(exp, 5));             
+	s = L_shl(s, add1(exp, 5));
 	k_cn = vo_round(s);
 
 	/* set k_dn = 32..512 (ener_dn = 2^30..2^22) */
@@ -107,22 +107,22 @@
 		s = (k_cn* (*p0++))+(k_dn * (*p1++));
 		*p2++ = s >> 7;
 		s = (k_cn* (*p0++))+(k_dn * (*p1++));
-		*p2++ = s >> 7; 
+		*p2++ = s >> 7;
 	}
 
 	/* set sign according to dn2[] = k_cn*cn[] + k_dn*dn[]    */
 	for (i = 0; i < L_SUBFR; i ++)
 	{
-		val = dn[i];                   
-		ps = dn2[i];                   
+		val = dn[i];
+		ps = dn2[i];
 		if (ps >= 0)
 		{
 			sign[i] = 32767;             /* sign = +1 (Q12) */
-			vec[i] = -32768;           
+			vec[i] = -32768;
 		} else
 		{
 			sign[i] = -32768;            /* sign = -1 (Q12) */
-			vec[i] = 32767;            
+			vec[i] = 32767;
 			dn[i] = -val;
 		}
 	}
@@ -130,13 +130,13 @@
 	 * Compute h_inv[i].                                          *
 	 *------------------------------------------------------------*/
 	/* impulse response buffer for fast computation */
-	h = h_buf + L_SUBFR;                             
-	h_inv = h + (L_SUBFR<<1);         
+	h = h_buf + L_SUBFR;
+	h_inv = h + (L_SUBFR<<1);
 
 	for (i = 0; i < L_SUBFR; i++)
 	{
-		h[i] = H[i];                       
-		h_inv[i] = vo_negate(h[i]);           
+		h[i] = H[i];
+		h_inv[i] = vo_negate(h[i]);
 	}
 
 	/*------------------------------------------------------------*
@@ -144,46 +144,46 @@
 	 * Result is multiplied by 0.5                                *
 	 *------------------------------------------------------------*/
 	/* Init pointers to last position of rrixix[] */
-	p0 = &rrixix[0][NB_POS - 1];           
-	p1 = &rrixix[1][NB_POS - 1];           
+	p0 = &rrixix[0][NB_POS - 1];
+	p1 = &rrixix[1][NB_POS - 1];
 
-	ptr_h1 = h;                            
+	ptr_h1 = h;
 	cor = 0x00010000L;                          /* for rounding */
 	for (i = 0; i < NB_POS; i++)
 	{
 		cor += ((*ptr_h1) * (*ptr_h1) << 1);
 		ptr_h1++;
-		*p1-- = (extract_h(cor) >> 1);            
+		*p1-- = (extract_h(cor) >> 1);
 		cor += ((*ptr_h1) * (*ptr_h1) << 1);
 		ptr_h1++;
-		*p0-- = (extract_h(cor) >> 1);            
+		*p0-- = (extract_h(cor) >> 1);
 	}
 
 	/*------------------------------------------------------------*
 	 * Compute rrixiy[][] needed for the codebook search.         *
 	 *------------------------------------------------------------*/
-	pos = MSIZE - 1;                       
-	pos2 = MSIZE - 2;                      
-	ptr_hf = h + 1;                        
+	pos = MSIZE - 1;
+	pos2 = MSIZE - 2;
+	ptr_hf = h + 1;
 
 	for (k = 0; k < NB_POS; k++)
 	{
-		p1 = &rrixiy[pos];                 
-		p0 = &rrixiy[pos2];                
+		p1 = &rrixiy[pos];
+		p0 = &rrixiy[pos2];
 		cor = 0x00008000L;                        /* for rounding */
-		ptr_h1 = h;                        
-		ptr_h2 = ptr_hf;                   
+		ptr_h1 = h;
+		ptr_h2 = ptr_hf;
 
 		for (i = (k + 1); i < NB_POS; i++)
 		{
 			cor += ((*ptr_h1) * (*ptr_h2))<<1;
 			ptr_h1++;
 			ptr_h2++;
-			*p1 = extract_h(cor);          
+			*p1 = extract_h(cor);
 			cor += ((*ptr_h1) * (*ptr_h2))<<1;
 			ptr_h1++;
 			ptr_h2++;
-			*p0 = extract_h(cor);         
+			*p0 = extract_h(cor);
 
 			p1 -= (NB_POS + 1);
 			p0 -= (NB_POS + 1);
@@ -191,7 +191,7 @@
 		cor += ((*ptr_h1) * (*ptr_h2))<<1;
 		ptr_h1++;
 		ptr_h2++;
-		*p1 = extract_h(cor);              
+		*p1 = extract_h(cor);
 
 		pos -= NB_POS;
 		pos2--;
@@ -201,17 +201,17 @@
 	/*------------------------------------------------------------*
 	 * Modification of rrixiy[][] to take signs into account.     *
 	 *------------------------------------------------------------*/
-	p0 = rrixiy;                          
+	p0 = rrixiy;
 	for (i = 0; i < L_SUBFR; i += STEP)
 	{
-		psign = sign;                      
+		psign = sign;
 		if (psign[i] < 0)
 		{
-			psign = vec;                   
+			psign = vec;
 		}
 		for (j = 1; j < L_SUBFR; j += STEP)
 		{
-			*p0 = vo_mult(*p0, psign[j]);     
+			*p0 = vo_mult(*p0, psign[j]);
 			p0++;
 		}
 	}
@@ -220,20 +220,20 @@
 	 * ~@~~~~~~~~~~~~~~                                                  *
 	 * 32 pos x 32 pos = 1024 tests (all combinaisons is tested)         *
 	 *-------------------------------------------------------------------*/
-	p0 = rrixix[0];                        
-	p1 = rrixix[1];                        
-	p2 = rrixiy;                          
+	p0 = rrixix[0];
+	p1 = rrixix[1];
+	p2 = rrixiy;
 
-	psk = -1;                              
-	alpk = 1;                              
-	ix = 0;                                
-	iy = 1;                                
+	psk = -1;
+	alpk = 1;
+	ix = 0;
+	iy = 1;
 
 	for (i0 = 0; i0 < L_SUBFR; i0 += STEP)
 	{
-		ps1 = dn[i0];                      
-		alp1 = (*p0++);                    
-		pos = -1;                          
+		ps1 = dn[i0];
+		alp1 = (*p0++);
+		pos = -1;
 		for (i1 = 1; i1 < L_SUBFR; i1 += STEP)
 		{
 			ps2 = add1(ps1, dn[i1]);
@@ -242,16 +242,16 @@
 			s = vo_L_mult(alpk, sq) - ((psk * alp2)<<1);
 			if (s > 0)
 			{
-				psk = sq;                  
-				alpk = alp2;               
-				pos = i1;                  
+				psk = sq;
+				alpk = alp2;
+				pos = i1;
 			}
 		}
 		p1 -= NB_POS;
 		if (pos >= 0)
 		{
-			ix = i0;                      
-			iy = pos;                      
+			ix = i0;
+			iy = pos;
 		}
 	}
 	/*-------------------------------------------------------------------*
@@ -260,7 +260,7 @@
 
 	for (i = 0; i < L_SUBFR; i++)
 	{
-		code[i] = 0;                       
+		code[i] = 0;
 	}
 
 	i0 = (ix >> 1);                       /* pos of pulse 1 (0..31) */
@@ -268,24 +268,24 @@
 	if (sign[ix] > 0)
 	{
 		code[ix] = 512;                     /* codeword in Q9 format */
-		p0 = h - ix;                       
+		p0 = h - ix;
 	} else
 	{
-		code[ix] = -512;                   
-		i0 += NB_POS;                      
-		p0 = h_inv - ix;                   
+		code[ix] = -512;
+		i0 += NB_POS;
+		p0 = h_inv - ix;
 	}
 	if (sign[iy] > 0)
 	{
-		code[iy] = 512;                    
-		p1 = h - iy;                       
+		code[iy] = 512;
+		p1 = h - iy;
 	} else
 	{
-		code[iy] = -512;                   
-		i1 += NB_POS;                      
-		p1 = h_inv - iy;                   
+		code[iy] = -512;
+		i1 += NB_POS;
+		p1 = h_inv - iy;
 	}
-	*index = add1((i0 << 6), i1);          
+	*index = add1((i0 << 6), i1);
 	for (i = 0; i < L_SUBFR; i++)
 	{
 		y[i] = vo_shr_r(add1((*p0++), (*p1++)), 3);
diff --git a/media/libstagefright/codecs/amrwbenc/src/c4t64fx.c b/media/libstagefright/codecs/amrwbenc/src/c4t64fx.c
index 17f3d47..1ecc11f 100644
--- a/media/libstagefright/codecs/amrwbenc/src/c4t64fx.c
+++ b/media/libstagefright/codecs/amrwbenc/src/c4t64fx.c
@@ -151,58 +151,58 @@
 		case 20:                               /* 20 bits, 4 pulses, 4 tracks */
 			nbiter = 4;                          /* 4x16x16=1024 loop */
 			alp = 8192;                          /* alp = 2.0 (Q12) */
-			nb_pulse = 4;                      
-			nbpos[0] = 4;                      
-			nbpos[1] = 8;                      
+			nb_pulse = 4;
+			nbpos[0] = 4;
+			nbpos[1] = 8;
 			break;
 		case 36:                               /* 36 bits, 8 pulses, 4 tracks */
 			nbiter = 4;                          /* 4x20x16=1280 loop */
 			alp = 4096;                          /* alp = 1.0 (Q12) */
-			nb_pulse = 8;                      
-			nbpos[0] = 4;                      
-			nbpos[1] = 8;                      
-			nbpos[2] = 8;                      
+			nb_pulse = 8;
+			nbpos[0] = 4;
+			nbpos[1] = 8;
+			nbpos[2] = 8;
 			break;
 		case 44:                               /* 44 bits, 10 pulses, 4 tracks */
 			nbiter = 4;                          /* 4x26x16=1664 loop */
 			alp = 4096;                          /* alp = 1.0 (Q12) */
-			nb_pulse = 10;                     
-			nbpos[0] = 4;                      
-			nbpos[1] = 6;                      
-			nbpos[2] = 8;                      
-			nbpos[3] = 8;                      
+			nb_pulse = 10;
+			nbpos[0] = 4;
+			nbpos[1] = 6;
+			nbpos[2] = 8;
+			nbpos[3] = 8;
 			break;
 		case 52:                               /* 52 bits, 12 pulses, 4 tracks */
 			nbiter = 4;                          /* 4x26x16=1664 loop */
 			alp = 4096;                          /* alp = 1.0 (Q12) */
-			nb_pulse = 12;                     
-			nbpos[0] = 4;                      
-			nbpos[1] = 6;                      
-			nbpos[2] = 8;                      
-			nbpos[3] = 8;                      
+			nb_pulse = 12;
+			nbpos[0] = 4;
+			nbpos[1] = 6;
+			nbpos[2] = 8;
+			nbpos[3] = 8;
 			break;
 		case 64:                               /* 64 bits, 16 pulses, 4 tracks */
 			nbiter = 3;                          /* 3x36x16=1728 loop */
 			alp = 3277;                          /* alp = 0.8 (Q12) */
-			nb_pulse = 16;                     
-			nbpos[0] = 4;                      
-			nbpos[1] = 4;                      
-			nbpos[2] = 6;                      
-			nbpos[3] = 6;                      
-			nbpos[4] = 8;                      
-			nbpos[5] = 8;                      
+			nb_pulse = 16;
+			nbpos[0] = 4;
+			nbpos[1] = 4;
+			nbpos[2] = 6;
+			nbpos[3] = 6;
+			nbpos[4] = 8;
+			nbpos[5] = 8;
 			break;
 		case 72:                               /* 72 bits, 18 pulses, 4 tracks */
 			nbiter = 3;                          /* 3x35x16=1680 loop */
 			alp = 3072;                          /* alp = 0.75 (Q12) */
-			nb_pulse = 18;                     
-			nbpos[0] = 2;                      
-			nbpos[1] = 3;                      
-			nbpos[2] = 4;                      
-			nbpos[3] = 5;                      
-			nbpos[4] = 6;                      
-			nbpos[5] = 7;                      
-			nbpos[6] = 8;                      
+			nb_pulse = 18;
+			nbpos[0] = 2;
+			nbpos[1] = 3;
+			nbpos[2] = 4;
+			nbpos[3] = 5;
+			nbpos[4] = 6;
+			nbpos[5] = 7;
+			nbpos[6] = 8;
 			break;
 		case 88:                               /* 88 bits, 24 pulses, 4 tracks */
 			if(ser_size > 462)
@@ -211,17 +211,17 @@
 				nbiter = 2;                    /* 2x53x16=1696 loop */
 
 			alp = 2048;                          /* alp = 0.5 (Q12) */
-			nb_pulse = 24;                     
-			nbpos[0] = 2;                      
-			nbpos[1] = 2;                      
-			nbpos[2] = 3;                      
-			nbpos[3] = 4;                      
-			nbpos[4] = 5;                      
-			nbpos[5] = 6;                      
-			nbpos[6] = 7;                      
-			nbpos[7] = 8;                      
-			nbpos[8] = 8;                      
-			nbpos[9] = 8;                      
+			nb_pulse = 24;
+			nbpos[0] = 2;
+			nbpos[1] = 2;
+			nbpos[2] = 3;
+			nbpos[3] = 4;
+			nbpos[4] = 5;
+			nbpos[5] = 6;
+			nbpos[6] = 7;
+			nbpos[7] = 8;
+			nbpos[8] = 8;
+			nbpos[9] = 8;
 			break;
 		default:
 			nbiter = 0;
@@ -231,7 +231,7 @@
 
 	for (i = 0; i < nb_pulse; i++)
 	{
-		codvec[i] = i;                     
+		codvec[i] = i;
 	}
 
 	/*----------------------------------------------------------------*
@@ -246,7 +246,7 @@
 #endif
 
 	Isqrt_n(&s, &exp);
-	s = L_shl(s, (exp + 5)); 
+	s = L_shl(s, (exp + 5));
 	k_cn = extract_h(L_add(s, 0x8000));
 
 	/* set k_dn = 32..512 (ener_dn = 2^30..2^22) */
@@ -274,22 +274,22 @@
 		s = (k_cn* (*p0++))+(k_dn * (*p1++));
 		*p2++ = s >> 7;
 		s = (k_cn* (*p0++))+(k_dn * (*p1++));
-		*p2++ = s >> 7; 
+		*p2++ = s >> 7;
 	}
 
 	/* set sign according to dn2[] = k_cn*cn[] + k_dn*dn[]    */
 	for(i = 0; i < L_SUBFR; i++)
 	{
-		val = dn[i];                   
-		ps = dn2[i];                   
+		val = dn[i];
+		ps = dn2[i];
 		if (ps >= 0)
 		{
 			sign[i] = 32767;             /* sign = +1 (Q12) */
-			vec[i] = -32768;           
+			vec[i] = -32768;
 		} else
 		{
 			sign[i] = -32768;            /* sign = -1 (Q12) */
-			vec[i] = 32767;            
+			vec[i] = 32767;
 			dn[i] = -val;
 			dn2[i] = -ps;
 		}
@@ -302,19 +302,19 @@
 	{
 		for (k = 0; k < NB_MAX; k++)
 		{
-			ps = -1;                       
+			ps = -1;
 			for (j = i; j < L_SUBFR; j += STEP)
 			{
 				if(dn2[j] > ps)
 				{
-					ps = dn2[j];          
-					pos = j;               
+					ps = dn2[j];
+					pos = j;
 				}
 			}
 			dn2[pos] = (k - NB_MAX);     /* dn2 < 0 when position is selected */
 			if (k == 0)
 			{
-				pos_max[i] = pos;          
+				pos_max[i] = pos;
 			}
 		}
 	}
@@ -335,22 +335,22 @@
 
 	/* impulse response buffer for fast computation */
 
-	h = h_buf;                             
-	h_inv = h_buf + (2 * L_SUBFR);   
+	h = h_buf;
+	h_inv = h_buf + (2 * L_SUBFR);
 	L_tmp = 0;
 	for (i = 0; i < L_SUBFR; i++)
 	{
-		*h++ = 0;                          
-		*h_inv++ = 0;   
+		*h++ = 0;
+		*h_inv++ = 0;
 		L_tmp += (H[i] * H[i]) << 1;
 	}
 	/* scale h[] down (/2) when energy of h[] is high with many pulses used */
 	val = extract_h(L_tmp);
-	h_shift = 0;                           
+	h_shift = 0;
 
 	if ((nb_pulse >= 12) && (val > 1024))
 	{
-		h_shift = 1;                       
+		h_shift = 1;
 	}
 	p0 = H;
 	p1 = h;
@@ -358,14 +358,14 @@
 
 	for (i = 0; i < L_SUBFR/4; i++)
 	{
-		*p1 = *p0++ >> h_shift;         
-		*p2++ = -(*p1++);  
-		*p1 = *p0++ >> h_shift;         
-		*p2++ = -(*p1++); 
-		*p1 = *p0++ >> h_shift;         
-		*p2++ = -(*p1++); 
-		*p1 = *p0++ >> h_shift;         
-		*p2++ = -(*p1++); 
+		*p1 = *p0++ >> h_shift;
+		*p2++ = -(*p1++);
+		*p1 = *p0++ >> h_shift;
+		*p2++ = -(*p1++);
+		*p1 = *p0++ >> h_shift;
+		*p2++ = -(*p1++);
+		*p1 = *p0++ >> h_shift;
+		*p2++ = -(*p1++);
 	}
 
 	/*------------------------------------------------------------*
@@ -377,27 +377,27 @@
 	/* storage order --> i3i3, i2i2, i1i1, i0i0 */
 
 	/* Init pointers to last position of rrixix[] */
-	p0 = &rrixix[0][NB_POS - 1];           
-	p1 = &rrixix[1][NB_POS - 1];           
-	p2 = &rrixix[2][NB_POS - 1];           
-	p3 = &rrixix[3][NB_POS - 1];           
+	p0 = &rrixix[0][NB_POS - 1];
+	p1 = &rrixix[1][NB_POS - 1];
+	p2 = &rrixix[2][NB_POS - 1];
+	p3 = &rrixix[3][NB_POS - 1];
 
-	ptr_h1 = h;                            
+	ptr_h1 = h;
 	cor = 0x00008000L;                             /* for rounding */
 	for (i = 0; i < NB_POS; i++)
 	{
 		cor += vo_L_mult((*ptr_h1), (*ptr_h1));
 		ptr_h1++;
-		*p3-- = extract_h(cor);            
+		*p3-- = extract_h(cor);
 		cor += vo_L_mult((*ptr_h1), (*ptr_h1));
 		ptr_h1++;
-		*p2-- = extract_h(cor);            
+		*p2-- = extract_h(cor);
 		cor += vo_L_mult((*ptr_h1), (*ptr_h1));
 		ptr_h1++;
-		*p1-- = extract_h(cor);            
+		*p1-- = extract_h(cor);
 		cor += vo_L_mult((*ptr_h1), (*ptr_h1));
 		ptr_h1++;
-		*p0-- = extract_h(cor);            
+		*p0-- = extract_h(cor);
 	}
 
 	/*------------------------------------------------------------*
@@ -409,38 +409,38 @@
 
 	/* storage order --> i2i3, i1i2, i0i1, i3i0 */
 
-	pos = MSIZE - 1;                       
-	ptr_hf = h + 1;                        
+	pos = MSIZE - 1;
+	ptr_hf = h + 1;
 
 	for (k = 0; k < NB_POS; k++)
 	{
-		p3 = &rrixiy[2][pos];              
-		p2 = &rrixiy[1][pos];              
-		p1 = &rrixiy[0][pos];              
-		p0 = &rrixiy[3][pos - NB_POS];     
+		p3 = &rrixiy[2][pos];
+		p2 = &rrixiy[1][pos];
+		p1 = &rrixiy[0][pos];
+		p0 = &rrixiy[3][pos - NB_POS];
 
 		cor = 0x00008000L;                   /* for rounding */
-		ptr_h1 = h;                        
-		ptr_h2 = ptr_hf;                   
+		ptr_h1 = h;
+		ptr_h2 = ptr_hf;
 
 		for (i = k + 1; i < NB_POS; i++)
 		{
 			cor += vo_L_mult((*ptr_h1), (*ptr_h2));
 			ptr_h1++;
 			ptr_h2++;
-			*p3 = extract_h(cor);          
+			*p3 = extract_h(cor);
 			cor += vo_L_mult((*ptr_h1), (*ptr_h2));
 			ptr_h1++;
 			ptr_h2++;
-			*p2 = extract_h(cor);          
+			*p2 = extract_h(cor);
 			cor += vo_L_mult((*ptr_h1), (*ptr_h2));
 			ptr_h1++;
 			ptr_h2++;
-			*p1 = extract_h(cor);          
+			*p1 = extract_h(cor);
 			cor += vo_L_mult((*ptr_h1), (*ptr_h2));
 			ptr_h1++;
 			ptr_h2++;
-			*p0 = extract_h(cor);         
+			*p0 = extract_h(cor);
 
 			p3 -= (NB_POS + 1);
 			p2 -= (NB_POS + 1);
@@ -450,15 +450,15 @@
 		cor += vo_L_mult((*ptr_h1), (*ptr_h2));
 		ptr_h1++;
 		ptr_h2++;
-		*p3 = extract_h(cor);              
+		*p3 = extract_h(cor);
 		cor += vo_L_mult((*ptr_h1), (*ptr_h2));
 		ptr_h1++;
 		ptr_h2++;
-		*p2 = extract_h(cor);              
+		*p2 = extract_h(cor);
 		cor += vo_L_mult((*ptr_h1), (*ptr_h2));
 		ptr_h1++;
 		ptr_h2++;
-		*p1 = extract_h(cor);              
+		*p1 = extract_h(cor);
 
 		pos -= NB_POS;
 		ptr_hf += STEP;
@@ -466,38 +466,38 @@
 
 	/* storage order --> i3i0, i2i3, i1i2, i0i1 */
 
-	pos = MSIZE - 1;                       
-	ptr_hf = h + 3;                        
+	pos = MSIZE - 1;
+	ptr_hf = h + 3;
 
 	for (k = 0; k < NB_POS; k++)
 	{
-		p3 = &rrixiy[3][pos];              
-		p2 = &rrixiy[2][pos - 1];          
-		p1 = &rrixiy[1][pos - 1];          
-		p0 = &rrixiy[0][pos - 1];          
+		p3 = &rrixiy[3][pos];
+		p2 = &rrixiy[2][pos - 1];
+		p1 = &rrixiy[1][pos - 1];
+		p0 = &rrixiy[0][pos - 1];
 
 		cor = 0x00008000L;								/* for rounding */
-		ptr_h1 = h;                        
-		ptr_h2 = ptr_hf;                   
+		ptr_h1 = h;
+		ptr_h2 = ptr_hf;
 
 		for (i = k + 1; i < NB_POS; i++)
 		{
 			cor += vo_L_mult((*ptr_h1), (*ptr_h2));
 			ptr_h1++;
 			ptr_h2++;
-			*p3 = extract_h(cor);          
+			*p3 = extract_h(cor);
 			cor += vo_L_mult((*ptr_h1), (*ptr_h2));
 			ptr_h1++;
 			ptr_h2++;
-			*p2 = extract_h(cor);          
+			*p2 = extract_h(cor);
 			cor += vo_L_mult((*ptr_h1), (*ptr_h2));
 			ptr_h1++;
 			ptr_h2++;
-			*p1 = extract_h(cor);          
+			*p1 = extract_h(cor);
 			cor += vo_L_mult((*ptr_h1), (*ptr_h2));
 			ptr_h1++;
 			ptr_h2++;
-			*p0 = extract_h(cor);          
+			*p0 = extract_h(cor);
 
 			p3 -= (NB_POS + 1);
 			p2 -= (NB_POS + 1);
@@ -507,7 +507,7 @@
 		cor += vo_L_mult((*ptr_h1), (*ptr_h2));
 		ptr_h1++;
 		ptr_h2++;
-		*p3 = extract_h(cor);              
+		*p3 = extract_h(cor);
 
 		pos--;
 		ptr_hf += STEP;
@@ -517,22 +517,22 @@
 	 * Modification of rrixiy[][] to take signs into account.     *
 	 *------------------------------------------------------------*/
 
-	p0 = &rrixiy[0][0];                    
+	p0 = &rrixiy[0][0];
 
 	for (k = 0; k < NB_TRACK; k++)
 	{
 		j_temp = (k + 1)&0x03;
 		for (i = k; i < L_SUBFR; i += STEP)
 		{
-			psign = sign;                  
+			psign = sign;
 			if (psign[i] < 0)
 			{
-				psign = vec;               
+				psign = vec;
 			}
 			j = j_temp;
 			for (; j < L_SUBFR; j += STEP)
 			{
-				*p0 = vo_mult(*p0, psign[j]);    
+				*p0 = vo_mult(*p0, psign[j]);
 				p0++;
 			}
 		}
@@ -542,8 +542,8 @@
 	 *                       Deep first search                           *
 	 *-------------------------------------------------------------------*/
 
-	psk = -1;                              
-	alpk = 1;                              
+	psk = -1;
+	alpk = 1;
 
 	for (k = 0; k < nbiter; k++)
 	{
@@ -553,12 +553,12 @@
 
 		if(nbbits == 20)
 		{
-			pos = 0;                       
-			ps = 0;                        
-			alp = 0;                       
+			pos = 0;
+			ps = 0;
+			alp = 0;
 			for (i = 0; i < L_SUBFR; i++)
 			{
-				vec[i] = 0;                
+				vec[i] = 0;
 			}
 		} else if ((nbbits == 36) || (nbbits == 44))
 		{
@@ -591,18 +591,18 @@
 
 			if(nbbits == 44)
 			{
-				ipos[8] = 0;               
-				ipos[9] = 1;               
+				ipos[8] = 0;
+				ipos[9] = 1;
 			}
 		} else
 		{
 			/* first stage: fix 4 pulses */
 			pos = 4;
 
-			ix = ind[0] = pos_max[ipos[0]];  
-			iy = ind[1] = pos_max[ipos[1]];  
-			i = ind[2] = pos_max[ipos[2]];   
-			j = ind[3] = pos_max[ipos[3]];   
+			ix = ind[0] = pos_max[ipos[0]];
+			iy = ind[1] = pos_max[ipos[1]];
+			i = ind[2] = pos_max[ipos[2]];
+			j = ind[3] = pos_max[ipos[3]];
 			ps = add1(add1(add1(dn[ix], dn[iy]), dn[i]), dn[j]);
 
 			if (sign[ix] < 0)
@@ -636,8 +636,8 @@
 
 			if(nbbits == 72)
 			{
-				ipos[16] = 0;              
-				ipos[17] = 1;              
+				ipos[16] = 0;
+				ipos[17] = 1;
 			}
 		}
 
@@ -668,8 +668,8 @@
 			search_ixiy(nbpos[st], ipos[j], ipos[j + 1], &ps, &alp,
 					&ix, &iy, dn, dn2, cor_x, cor_y, rrixiy);
 
-			ind[j] = ix;                   
-			ind[j + 1] = iy;               
+			ind[j] = ix;
+			ind[j + 1] = iy;
 
 			if (sign[ix] < 0)
 				p0 = h_inv - ix;
@@ -682,10 +682,10 @@
 
 			for (i = 0; i < L_SUBFR; i+=4)
 			{
-				vec[i]   += add1((*p0++), (*p1++));       
-				vec[i+1] += add1((*p0++), (*p1++));        
-				vec[i+2] += add1((*p0++), (*p1++));        
-				vec[i+3] += add1((*p0++), (*p1++));      
+				vec[i]   += add1((*p0++), (*p1++));
+				vec[i+1] += add1((*p0++), (*p1++));
+				vec[i+2] += add1((*p0++), (*p1++));
+				vec[i+3] += add1((*p0++), (*p1++));
 			}
 		}
 		/* memorise the best codevector */
@@ -693,15 +693,15 @@
 		s = vo_L_msu(vo_L_mult(alpk, ps), psk, alp);
 		if (s > 0)
 		{
-			psk = ps;                      
-			alpk = alp;                    
+			psk = ps;
+			alpk = alp;
 			for (i = 0; i < nb_pulse; i++)
 			{
-				codvec[i] = ind[i];        
+				codvec[i] = ind[i];
 			}
 			for (i = 0; i < L_SUBFR; i++)
 			{
-				y[i] = vec[i];             
+				y[i] = vec[i];
 			}
 		}
 	}
@@ -710,11 +710,11 @@
 	 *-------------------------------------------------------------------*/
 	for (i = 0; i < NPMAXPT * NB_TRACK; i++)
 	{
-		ind[i] = -1;                       
+		ind[i] = -1;
 	}
 	for (i = 0; i < L_SUBFR; i++)
 	{
-		code[i] = 0;                       
+		code[i] = 0;
 		y[i] = vo_shr_r(y[i], 3);               /* Q12 to Q9 */
 	}
 	val = (512 >> h_shift);               /* codeword in Q9 format */
@@ -727,12 +727,12 @@
 
 		if (j > 0)
 		{
-			code[i] += val;   
-			codvec[k] += 128;  
+			code[i] += val;
+			codvec[k] += 128;
 		} else
 		{
-			code[i] -= val;   
-			index += NB_POS;    
+			code[i] -= val;
+			index += NB_POS;
 		}
 
 		i = (Word16)((vo_L_mult(track, NPMAXPT) >> 1));
@@ -741,10 +741,10 @@
 		{
 			i += 1;
 		}
-		ind[i] = index;                    
+		ind[i] = index;
 	}
 
-	k = 0;                                 
+	k = 0;
 	/* Build index of codevector */
 	if(nbbits == 20)
 	{
@@ -849,20 +849,20 @@
 		p2 = &vec[pos];
 		for (j=pos;j < L_SUBFR; j++)
 		{
-			L_sum1 += *p1 * *p2;		
+			L_sum1 += *p1 * *p2;
 			p2-=3;
-			L_sum2 += *p1++ * *p2;		
+			L_sum2 += *p1++ * *p2;
 			p2+=4;
 		}
 		p2-=3;
-		L_sum2 += *p1++ * *p2++;	
-		L_sum2 += *p1++ * *p2++;	
-		L_sum2 += *p1++ * *p2++;	
+		L_sum2 += *p1++ * *p2++;
+		L_sum2 += *p1++ * *p2++;
+		L_sum2 += *p1++ * *p2++;
 
 		L_sum1 = (L_sum1 << 2);
 		L_sum2 = (L_sum2 << 2);
 
-		corr = vo_round(L_sum1);	
+		corr = vo_round(L_sum1);
 		*cor_x++ = vo_mult(corr, sign[pos]) + (*p0++);
 		corr = vo_round(L_sum2);
 		*cor_y++ = vo_mult(corr, sign[pos-3]) + (*p3++);
@@ -873,20 +873,20 @@
 		p2 = &vec[pos];
 		for (j=pos;j < L_SUBFR; j++)
 		{
-			L_sum1 += *p1 * *p2;		
+			L_sum1 += *p1 * *p2;
 			p2-=3;
-			L_sum2 += *p1++ * *p2;		
+			L_sum2 += *p1++ * *p2;
 			p2+=4;
 		}
 		p2-=3;
-		L_sum2 += *p1++ * *p2++;	
-		L_sum2 += *p1++ * *p2++;	
-		L_sum2 += *p1++ * *p2++;	
+		L_sum2 += *p1++ * *p2++;
+		L_sum2 += *p1++ * *p2++;
+		L_sum2 += *p1++ * *p2++;
 
 		L_sum1 = (L_sum1 << 2);
 		L_sum2 = (L_sum2 << 2);
 
-		corr = vo_round(L_sum1);	
+		corr = vo_round(L_sum1);
 		*cor_x++ = vo_mult(corr, sign[pos]) + (*p0++);
 		corr = vo_round(L_sum2);
 		*cor_y++ = vo_mult(corr, sign[pos-3]) + (*p3++);
@@ -982,17 +982,17 @@
 	Word16 *p0, *p1, *p2;
 	Word32 s, alp0, alp1, alp2;
 
-	p0 = cor_x;                            
-	p1 = cor_y;                            
-	p2 = rrixiy[track_x];                  
+	p0 = cor_x;
+	p1 = cor_y;
+	p2 = rrixiy[track_x];
 
 	thres_ix = nb_pos_ix - NB_MAX;
 
 	alp0 = L_deposit_h(*alp);
 	alp0 = (alp0 + 0x00008000L);       /* for rounding */
 
-	sqk = -1;                              
-	alpk = 1;                              
+	sqk = -1;
+	alpk = 1;
 
 	for (x = track_x; x < L_SUBFR; x += STEP)
 	{
@@ -1014,17 +1014,17 @@
 
 				if (s > 0)
 				{
-					sqk = sq;              
-					alpk = alp_16;         
-					pos = y;               
+					sqk = sq;
+					alpk = alp_16;
+					pos = y;
 				}
 			}
 			p1 -= NB_POS;
 
 			if (pos >= 0)
 			{
-				*ix = x;                   
-				*iy = pos;                 
+				*ix = x;
+				*iy = pos;
 			}
 		} else
 		{
@@ -1032,8 +1032,8 @@
 		}
 	}
 
-	*ps = add1(*ps, add1(dn[*ix], dn[*iy])); 
-	*alp = alpk;                           
+	*ps = add1(*ps, add1(dn[*ix], dn[*iy]));
+	*alp = alpk;
 
 	return;
 }
diff --git a/media/libstagefright/codecs/amrwbenc/src/convolve.c b/media/libstagefright/codecs/amrwbenc/src/convolve.c
index 4f7fd8a..acba532 100644
--- a/media/libstagefright/codecs/amrwbenc/src/convolve.c
+++ b/media/libstagefright/codecs/amrwbenc/src/convolve.c
@@ -49,7 +49,7 @@
 			s += vo_mult32((*tmpX++), (*tmpH--));
 			i -= 4;
 		}
-		y[n] = ((s<<1) + 0x8000)>>16;   
+		y[n] = ((s<<1) + 0x8000)>>16;
 		n++;
 
 		tmpH = h+n;
@@ -66,7 +66,7 @@
 			s += vo_mult32((*tmpX++), (*tmpH--));
 			i -= 4;
 		}
-		y[n] = ((s<<1) + 0x8000)>>16;    
+		y[n] = ((s<<1) + 0x8000)>>16;
 		n++;
 
 		tmpH = h+n;
@@ -84,7 +84,7 @@
 			s += vo_mult32((*tmpX++), (*tmpH--));
 			i -= 4;
 		}
-		y[n] = ((s<<1) + 0x8000)>>16;   
+		y[n] = ((s<<1) + 0x8000)>>16;
 		n++;
 
 		s = 0;
@@ -99,8 +99,8 @@
 			s += vo_mult32((*tmpX++), (*tmpH--));
 			i -= 4;
 		}
-		y[n] = ((s<<1) + 0x8000)>>16;   
-		n++;        
+		y[n] = ((s<<1) + 0x8000)>>16;
+		n++;
 	}
 	return;
 }
diff --git a/media/libstagefright/codecs/amrwbenc/src/cor_h_x.c b/media/libstagefright/codecs/amrwbenc/src/cor_h_x.c
index b645fa3..d9245ed 100644
--- a/media/libstagefright/codecs/amrwbenc/src/cor_h_x.c
+++ b/media/libstagefright/codecs/amrwbenc/src/cor_h_x.c
@@ -18,7 +18,7 @@
 *       File: cor_h_x.c                                                *
 *                                                                      *
 *	   Description:Compute correlation between target "x[]" and "h[]"  *
-*	               Designed for codebook search (24 pulses, 4 tracks,  * 
+*	               Designed for codebook search (24 pulses, 4 tracks,  *
 *				   4 pulses per track, 16 positions in each track) to  *
 *				   avoid saturation.                                   *
 *                                                                      *
@@ -44,8 +44,8 @@
 	Word32 *p3;
 	Word32 L_max, L_max1, L_max2, L_max3;
 	/* first keep the result on 32 bits and find absolute maximum */
-	L_tot  = 1;                            
-	L_max  = 0; 
+	L_tot  = 1;
+	L_max  = 0;
 	L_max1 = 0;
 	L_max2 = 0;
 	L_max3 = 0;
@@ -57,11 +57,11 @@
 		for (j = i; j < L_SUBFR; j++)
 			L_tmp += vo_L_mult(*p1++, *p2++);
 
-		y32[i] = L_tmp;               
+		y32[i] = L_tmp;
 		L_tmp = (L_tmp > 0)? L_tmp:-L_tmp;
 		if(L_tmp > L_max)
 		{
-			L_max = L_tmp;             
+			L_max = L_tmp;
 		}
 
 		L_tmp = 1L;
@@ -70,11 +70,11 @@
 		for (j = i+1; j < L_SUBFR; j++)
 			L_tmp += vo_L_mult(*p1++, *p2++);
 
-		y32[i+1] = L_tmp;               
+		y32[i+1] = L_tmp;
 		L_tmp = (L_tmp > 0)? L_tmp:-L_tmp;
 		if(L_tmp > L_max1)
 		{
-			L_max1 = L_tmp;             
+			L_max1 = L_tmp;
 		}
 
 		L_tmp = 1;
@@ -83,11 +83,11 @@
 		for (j = i+2; j < L_SUBFR; j++)
 			L_tmp += vo_L_mult(*p1++, *p2++);
 
-		y32[i+2] = L_tmp;               
+		y32[i+2] = L_tmp;
 		L_tmp = (L_tmp > 0)? L_tmp:-L_tmp;
 		if(L_tmp > L_max2)
 		{
-			L_max2 = L_tmp;             
+			L_max2 = L_tmp;
 		}
 
 		L_tmp = 1;
@@ -96,11 +96,11 @@
 		for (j = i+3; j < L_SUBFR; j++)
 			L_tmp += vo_L_mult(*p1++, *p2++);
 
-		y32[i+3] = L_tmp;               
+		y32[i+3] = L_tmp;
 		L_tmp = (L_tmp > 0)? L_tmp:-L_tmp;
 		if(L_tmp > L_max3)
 		{
-			L_max3 = L_tmp;             
+			L_max3 = L_tmp;
 		}
 	}
 	/* tot += 3*max / 8 */
diff --git a/media/libstagefright/codecs/amrwbenc/src/decim54.c b/media/libstagefright/codecs/amrwbenc/src/decim54.c
index 7bc5576..3b88514 100644
--- a/media/libstagefright/codecs/amrwbenc/src/decim54.c
+++ b/media/libstagefright/codecs/amrwbenc/src/decim54.c
@@ -136,8 +136,8 @@
 		L_sum += vo_mult32((*x++),(*y++));
 		L_sum += vo_mult32((*x),(*y));
 
-		L_sum = L_shl2(L_sum, 2);              
-		sig_d[j] = extract_h(L_add(L_sum, 0x8000)); 
+		L_sum = L_shl2(L_sum, 2);
+		sig_d[j] = extract_h(L_add(L_sum, 0x8000));
 		pos += FAC5;              /* pos + 5/4 */
 	}
 	return;
diff --git a/media/libstagefright/codecs/amrwbenc/src/deemph.c b/media/libstagefright/codecs/amrwbenc/src/deemph.c
index 4ee1449..0c49d6b 100644
--- a/media/libstagefright/codecs/amrwbenc/src/deemph.c
+++ b/media/libstagefright/codecs/amrwbenc/src/deemph.c
@@ -39,16 +39,16 @@
 
 	L_tmp = L_deposit_h(x[0]);
 	L_tmp = L_mac(L_tmp, *mem, mu);
-	x[0] = vo_round(L_tmp);                   
+	x[0] = vo_round(L_tmp);
 
 	for (i = 1; i < L; i++)
 	{
 		L_tmp = L_deposit_h(x[i]);
 		L_tmp = L_mac(L_tmp, x[i - 1], mu);
-		x[i] = voround(L_tmp);               
+		x[i] = voround(L_tmp);
 	}
 
-	*mem = x[L - 1];                       
+	*mem = x[L - 1];
 
 	return;
 }
@@ -65,14 +65,14 @@
 	Word32 L_tmp;
 	L_tmp = x[0] << 15;
 	L_tmp += ((*mem) * mu)<<1;
-	x[0] = (L_tmp + 0x8000)>>16;                   
+	x[0] = (L_tmp + 0x8000)>>16;
 	for (i = 1; i < L; i++)
 	{
 		L_tmp = x[i] << 15;
 		L_tmp += (x[i - 1] * mu)<<1;
-		x[i] = (L_tmp + 0x8000)>>16;               
+		x[i] = (L_tmp + 0x8000)>>16;
 	}
-	*mem = x[L - 1];                       
+	*mem = x[L - 1];
 	return;
 }
 
@@ -95,8 +95,8 @@
 	L_tmp += (x_lo[0] * 8)<<1;
 	L_tmp = (L_tmp << 3);
 	L_tmp += ((*mem) * fac)<<1;
-	L_tmp = (L_tmp << 1);               
-	y[0] = (L_tmp + 0x8000)>>16;                  
+	L_tmp = (L_tmp << 1);
+	y[0] = (L_tmp + 0x8000)>>16;
 
 	for (i = 1; i < L; i++)
 	{
@@ -104,11 +104,11 @@
 		L_tmp += (x_lo[i] * 8)<<1;
 		L_tmp = (L_tmp << 3);
 		L_tmp += (y[i - 1] * fac)<<1;
-		L_tmp = (L_tmp << 1);           
-		y[i] = (L_tmp + 0x8000)>>16;               
+		L_tmp = (L_tmp << 1);
+		y[i] = (L_tmp + 0x8000)>>16;
 	}
 
-	*mem = y[L - 1];                       
+	*mem = y[L - 1];
 
 	return;
 }
diff --git a/media/libstagefright/codecs/amrwbenc/src/dtx.c b/media/libstagefright/codecs/amrwbenc/src/dtx.c
index df53131..2cfaced 100644
--- a/media/libstagefright/codecs/amrwbenc/src/dtx.c
+++ b/media/libstagefright/codecs/amrwbenc/src/dtx.c
@@ -105,30 +105,30 @@
 		fprintf(stderr, "dtx_enc_reset: invalid parameter\n");
 		return -1;
 	}
-	st->hist_ptr = 0;                      
-	st->log_en_index = 0;                  
+	st->hist_ptr = 0;
+	st->log_en_index = 0;
 
 	/* Init isf_hist[] */
 	for (i = 0; i < DTX_HIST_SIZE; i++)
 	{
 		Copy(isf_init, &st->isf_hist[i * M], M);
 	}
-	st->cng_seed = RANDOM_INITSEED;       
+	st->cng_seed = RANDOM_INITSEED;
 
 	/* Reset energy history */
 	Set_zero(st->log_en_hist, DTX_HIST_SIZE);
 
-	st->dtxHangoverCount = DTX_HANG_CONST; 
-	st->decAnaElapsedCount = 32767;        
+	st->dtxHangoverCount = DTX_HANG_CONST;
+	st->decAnaElapsedCount = 32767;
 
 	for (i = 0; i < 28; i++)
 	{
-		st->D[i] = 0;                      
+		st->D[i] = 0;
 	}
 
 	for (i = 0; i < DTX_HIST_SIZE - 1; i++)
 	{
-		st->sumD[i] = 0;                   
+		st->sumD[i] = 0;
 	}
 
 	return 1;
@@ -279,7 +279,7 @@
 	for (i = 0; i < L_FRAME; i++)
 	{
 		tmp = mult(exc2[i], gain);         /* Q0 * Q15 */
-		exc2[i] = shl(tmp, exp); 
+		exc2[i] = shl(tmp, exp);
 	}
 
 	return 0;
@@ -301,7 +301,7 @@
 
 	Word16 log_en_e;
 	Word16 log_en_m;
-	st->hist_ptr = add(st->hist_ptr, 1); 
+	st->hist_ptr = add(st->hist_ptr, 1);
 	if(st->hist_ptr == DTX_HIST_SIZE)
 	{
 		st->hist_ptr = 0;
@@ -345,7 +345,7 @@
 {
 
 	/* this state machine is in synch with the GSMEFR txDtx machine      */
-	st->decAnaElapsedCount = add(st->decAnaElapsedCount, 1); 
+	st->decAnaElapsedCount = add(st->decAnaElapsedCount, 1);
 
 	if (vad_flag != 0)
 	{
@@ -354,8 +354,8 @@
 	{                                      /* non-speech */
 		if (st->dtxHangoverCount == 0)
 		{                                  /* out of decoder analysis hangover  */
-			st->decAnaElapsedCount = 0;    
-			*usedMode = MRDTX;            
+			st->decAnaElapsedCount = 0;
+			*usedMode = MRDTX;
 		} else
 		{                                  /* in possible analysis hangover */
 			st->dtxHangoverCount = sub(st->dtxHangoverCount, 1);
@@ -394,8 +394,8 @@
 		{
 			for (i = 0; i < M; i++)
 			{
-				isf_tmp[k * M + i] = isf_old[indices[k] * M + i];      
-				isf_old[indices[k] * M + i] = isf_old[indices[2] * M + i];    
+				isf_tmp[k * M + i] = isf_old[indices[k] * M + i];
+				isf_old[indices[k] * M + i] = isf_old[indices[2] * M + i];
 			}
 		}
 	}
@@ -403,13 +403,13 @@
 	/* Perform the ISF averaging */
 	for (j = 0; j < M; j++)
 	{
-		L_tmp = 0;                      
+		L_tmp = 0;
 
 		for (i = 0; i < DTX_HIST_SIZE; i++)
 		{
 			L_tmp = L_add(L_tmp, L_deposit_l(isf_old[i * M + j]));
 		}
-		isf_aver[j] = L_tmp;              
+		isf_aver[j] = L_tmp;
 	}
 
 	/* Retrieve from isf_tmp[][] the ISF vectors saved prior to averaging */
@@ -441,12 +441,12 @@
 	/* sum sumD[0..DTX_HIST_SIZE-1]. sumD[DTX_HIST_SIZE] is    */
 	/* not updated since it will be removed later.           */
 
-	tmp = DTX_HIST_SIZE_MIN_ONE;           
-	j = -1;                                
+	tmp = DTX_HIST_SIZE_MIN_ONE;
+	j = -1;
 	for (i = 0; i < DTX_HIST_SIZE_MIN_ONE; i++)
 	{
 		j = add(j, tmp);
-		st->sumD[i] = L_sub(st->sumD[i], st->D[j]);     
+		st->sumD[i] = L_sub(st->sumD[i], st->D[j]);
 		tmp = sub(tmp, 1);
 	}
 
@@ -458,86 +458,86 @@
 
 	for (i = DTX_HIST_SIZE_MIN_ONE; i > 0; i--)
 	{
-		st->sumD[i] = st->sumD[i - 1];     
+		st->sumD[i] = st->sumD[i - 1];
 	}
-	st->sumD[0] = 0;                       
+	st->sumD[0] = 0;
 
 	/* Remove the oldest frame from the distance matrix.           */
 	/* Note that the distance matrix is replaced by a one-         */
 	/* dimensional array to save static memory.                    */
 
-	tmp = 0;                               
+	tmp = 0;
 	for (i = 27; i >= 12; i = (Word16) (i - tmp))
 	{
 		tmp = add(tmp, 1);
 		for (j = tmp; j > 0; j--)
 		{
-			st->D[i - j + 1] = st->D[i - j - tmp];   
+			st->D[i - j + 1] = st->D[i - j - tmp];
 		}
 	}
 
 	/* Compute the first column of the distance matrix D            */
 	/* (squared Euclidean distances from isf1[] to isf_old_tx[][]). */
 
-	ptr = st->hist_ptr;                 
+	ptr = st->hist_ptr;
 	for (i = 1; i < DTX_HIST_SIZE; i++)
 	{
 		/* Compute the distance between the latest isf and the other isfs. */
 		ptr = sub(ptr, 1);
 		if (ptr < 0)
 		{
-			ptr = DTX_HIST_SIZE_MIN_ONE;   
+			ptr = DTX_HIST_SIZE_MIN_ONE;
 		}
-		L_tmp = 0;                         
+		L_tmp = 0;
 		for (j = 0; j < M; j++)
 		{
 			tmp = sub(isf_old_tx[st->hist_ptr * M + j], isf_old_tx[ptr * M + j]);
 			L_tmp = L_mac(L_tmp, tmp, tmp);
 		}
-		st->D[i - 1] = L_tmp;           
+		st->D[i - 1] = L_tmp;
 
 		/* Update also the column sums. */
-		st->sumD[0] = L_add(st->sumD[0], st->D[i - 1]); 
-		st->sumD[i] = L_add(st->sumD[i], st->D[i - 1]); 
+		st->sumD[0] = L_add(st->sumD[0], st->D[i - 1]);
+		st->sumD[i] = L_add(st->sumD[i], st->D[i - 1]);
 	}
 
 	/* Find the minimum and maximum distances */
-	summax = st->sumD[0];                  
-	summin = st->sumD[0];                  
-	indices[0] = 0;                        
-	indices[2] = 0;                        
+	summax = st->sumD[0];
+	summin = st->sumD[0];
+	indices[0] = 0;
+	indices[2] = 0;
 	for (i = 1; i < DTX_HIST_SIZE; i++)
 	{
 		if (L_sub(st->sumD[i], summax) > 0)
 		{
-			indices[0] = i;                
-			summax = st->sumD[i];          
+			indices[0] = i;
+			summax = st->sumD[i];
 		}
 		if (L_sub(st->sumD[i], summin) < 0)
 		{
-			indices[2] = i;                
-			summin = st->sumD[i];          
+			indices[2] = i;
+			summin = st->sumD[i];
 		}
 	}
 
 	/* Find the second largest distance */
-	summax2nd = -2147483647L;              
-	indices[1] = -1;                       
+	summax2nd = -2147483647L;
+	indices[1] = -1;
 	for (i = 0; i < DTX_HIST_SIZE; i++)
 	{
 		if ((L_sub(st->sumD[i], summax2nd) > 0) && (sub(i, indices[0]) != 0))
 		{
-			indices[1] = i;                
-			summax2nd = st->sumD[i];       
+			indices[1] = i;
+			summax2nd = st->sumD[i];
 		}
 	}
 
 	for (i = 0; i < 3; i++)
 	{
-		indices[i] = sub(st->hist_ptr, indices[i]);     
+		indices[i] = sub(st->hist_ptr, indices[i]);
 		if (indices[i] < 0)
 		{
-			indices[i] = add(indices[i], DTX_HIST_SIZE);       
+			indices[i] = add(indices[i], DTX_HIST_SIZE);
 		}
 	}
 
@@ -549,7 +549,7 @@
 	L_tmp = L_mult(voround(summax), INV_MED_THRESH);
 	if(L_tmp <= summin)
 	{
-		indices[0] = -1; 
+		indices[0] = -1;
 	}
 	/* If second largest distance/MED_THRESH is smaller than     */
 	/* minimum distance then the median ISF vector replacement is    */
@@ -558,7 +558,7 @@
 	L_tmp = L_mult(voround(summax2nd), INV_MED_THRESH);
 	if(L_tmp <= summin)
 	{
-		indices[1] = -1;                 
+		indices[1] = -1;
 	}
 	return;
 }
diff --git a/media/libstagefright/codecs/amrwbenc/src/g_pitch.c b/media/libstagefright/codecs/amrwbenc/src/g_pitch.c
index f5112c5..d681f2e 100644
--- a/media/libstagefright/codecs/amrwbenc/src/g_pitch.c
+++ b/media/libstagefright/codecs/amrwbenc/src/g_pitch.c
@@ -48,10 +48,10 @@
 
 #endif
 
-	g_coeff[0] = yy;                       
-	g_coeff[1] = exp_yy;                   
-	g_coeff[2] = xy;                       
-	g_coeff[3] = exp_xy;                   
+	g_coeff[0] = yy;
+	g_coeff[1] = exp_yy;
+	g_coeff[2] = xy;
+	g_coeff[3] = exp_xy;
 
 	/* If (xy < 0) gain = 0 */
 	if (xy < 0)
@@ -65,12 +65,12 @@
 	i = exp_xy;
 	i -= exp_yy;
 
-	gain = shl(gain, i);                   
+	gain = shl(gain, i);
 
 	/* if (gain > 1.2) gain = 1.2  in Q14 */
 	if(gain > 19661)
 	{
-		gain = 19661;                      
+		gain = 19661;
 	}
 	return (gain);
 }
diff --git a/media/libstagefright/codecs/amrwbenc/src/gpclip.c b/media/libstagefright/codecs/amrwbenc/src/gpclip.c
index 24158e3..800b3f9 100644
--- a/media/libstagefright/codecs/amrwbenc/src/gpclip.c
+++ b/media/libstagefright/codecs/amrwbenc/src/gpclip.c
@@ -22,7 +22,7 @@
 *      case occurs                                                        *
 *      a resonance on LPC filter(lp_disp < 60Hz)                          *
 *      a good pitch prediction (lp_gp > 0.95)                             *
-*                                                                         *   
+*                                                                         *
 ***************************************************************************/
 #include "typedef.h"
 #include "basic_op.h"
@@ -38,8 +38,8 @@
 		Word16 mem[]                          /* (o) : memory of gain of pitch clipping algorithm */
 		)
 {
-	mem[0] = DIST_ISF_MAX;                 
-	mem[1] = GAIN_PIT_MIN;                 
+	mem[0] = DIST_ISF_MAX;
+	mem[1] = GAIN_PIT_MIN;
 }
 
 
@@ -49,7 +49,7 @@
 {
 	Word16 clip = 0;
 	if ((mem[0] < DIST_ISF_THRES) && (mem[1] > GAIN_PIT_THRES))
-		clip = 1;                          
+		clip = 1;
 
 	return (clip);
 }
@@ -70,7 +70,7 @@
 		dist = vo_sub(isf[i], isf[i - 1]);
 		if(dist < dist_min)
 		{
-			dist_min = dist;               
+			dist_min = dist;
 		}
 	}
 
@@ -78,9 +78,9 @@
 
 	if (dist > DIST_ISF_MAX)
 	{
-		dist = DIST_ISF_MAX;               
+		dist = DIST_ISF_MAX;
 	}
-	mem[0] = dist;                        
+	mem[0] = dist;
 
 	return;
 }
@@ -100,9 +100,9 @@
 
 	if(gain < GAIN_PIT_MIN)
 	{
-		gain = GAIN_PIT_MIN;              
+		gain = GAIN_PIT_MIN;
 	}
-	mem[1] = gain;                         
+	mem[1] = gain;
 	return;
 }
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/hp400.c b/media/libstagefright/codecs/amrwbenc/src/hp400.c
index fa66f1a..a6f9701 100644
--- a/media/libstagefright/codecs/amrwbenc/src/hp400.c
+++ b/media/libstagefright/codecs/amrwbenc/src/hp400.c
@@ -68,8 +68,8 @@
 	y2_lo = *mem++;
 	y1_hi = *mem++;
 	y1_lo = *mem++;
-	x0 = *mem++;   
-	x1 = *mem;   
+	x0 = *mem++;
+	x1 = *mem;
 	num = (Word32)lg;
 	do
 	{
@@ -98,7 +98,7 @@
 	*mem-- = y1_lo;
 	*mem-- = y1_hi;
 	*mem-- = y2_lo;
-	*mem   = y2_hi;  
+	*mem   = y2_hi;
 	return;
 }
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/hp50.c b/media/libstagefright/codecs/amrwbenc/src/hp50.c
index 36dd1f1..c1c7b83 100644
--- a/media/libstagefright/codecs/amrwbenc/src/hp50.c
+++ b/media/libstagefright/codecs/amrwbenc/src/hp50.c
@@ -70,7 +70,7 @@
 	y2_lo = *mem++;
 	y1_hi = *mem++;
 	y1_lo = *mem++;
-	x0 = *mem++;   
+	x0 = *mem++;
 	x1 = *mem;
 	num = (Word32)lg;
 	do
@@ -98,7 +98,7 @@
 	*mem-- = y1_lo;
 	*mem-- = y1_hi;
 	*mem-- = y2_lo;
-	*mem-- = y2_hi;  
+	*mem-- = y2_hi;
 
 	return;
 }
diff --git a/media/libstagefright/codecs/amrwbenc/src/hp6k.c b/media/libstagefright/codecs/amrwbenc/src/hp6k.c
index 578633a..8e66eb0 100644
--- a/media/libstagefright/codecs/amrwbenc/src/hp6k.c
+++ b/media/libstagefright/codecs/amrwbenc/src/hp6k.c
@@ -20,7 +20,7 @@
 *	Description:15th order band pass 6kHz to 7kHz FIR filter        *
 *       frequency: 4kHz   5kHz  5.5kHz  6kHz  6.5kHz  7kHz 7.5kHz 8kHz  *
 *	dB loss:  -60dB  -45dB  -13dB   -3dB   0dB    -3dB -13dB  -45dB *
-*	                                                                *                                                                 
+*	                                                                *
 ************************************************************************/
 
 #include "typedef.h"
@@ -63,7 +63,7 @@
 	for (i = lg - 1; i >= 0; i--)
 	{
 		x[i + L_FIR - 1] = signal[i] >> 2;                         /* gain of filter = 4 */
-	}	
+	}
 	for (i = 0; i < lg; i++)
 	{
 		L_tmp =  (x[i] + x[i+ 30]) * fir_6k_7k[0];
diff --git a/media/libstagefright/codecs/amrwbenc/src/hp_wsp.c b/media/libstagefright/codecs/amrwbenc/src/hp_wsp.c
index 3510272..bc1ec49 100644
--- a/media/libstagefright/codecs/amrwbenc/src/hp_wsp.c
+++ b/media/libstagefright/codecs/amrwbenc/src/hp_wsp.c
@@ -88,22 +88,22 @@
 	Word16 y3_hi, y3_lo, y2_hi, y2_lo, y1_hi, y1_lo;
 	Word32 i, L_tmp;
 
-	y3_hi = mem[0];                        
-	y3_lo = mem[1];                        
-	y2_hi = mem[2];                        
-	y2_lo = mem[3];                        
-	y1_hi = mem[4];                        
-	y1_lo = mem[5];                        
-	x0 = mem[6];                           
-	x1 = mem[7];                           
-	x2 = mem[8];                           
+	y3_hi = mem[0];
+	y3_lo = mem[1];
+	y2_hi = mem[2];
+	y2_lo = mem[3];
+	y1_hi = mem[4];
+	y1_lo = mem[5];
+	x0 = mem[6];
+	x1 = mem[7];
+	x2 = mem[8];
 
 	for (i = 0; i < lg; i++)
 	{
-		x3 = x2;                           
-		x2 = x1;                           
-		x1 = x0;                           
-		x0 = wsp[i];                       
+		x3 = x2;
+		x2 = x1;
+		x1 = x0;
+		x0 = wsp[i];
 		/* y[i] = b[0]*x[i] + b[1]*x[i-1] + b140[2]*x[i-2] + b[3]*x[i-3]  */
 		/* + a[1]*y[i-1] + a[2] * y[i-2]  + a[3]*y[i-3]  */
 
@@ -122,25 +122,25 @@
 
 		L_tmp = L_tmp << 2;
 
-		y3_hi = y2_hi;                     
-		y3_lo = y2_lo;                     
-		y2_hi = y1_hi;                     
-		y2_lo = y1_lo; 
+		y3_hi = y2_hi;
+		y3_lo = y2_lo;
+		y2_hi = y1_hi;
+		y2_lo = y1_lo;
 		y1_hi = L_tmp >> 16;
 		y1_lo = (L_tmp & 0xffff) >>1;
 
-		hp_wsp[i] = (L_tmp + 0x4000)>>15;          
+		hp_wsp[i] = (L_tmp + 0x4000)>>15;
 	}
 
-	mem[0] = y3_hi;                        
-	mem[1] = y3_lo;                        
-	mem[2] = y2_hi;                        
-	mem[3] = y2_lo;                        
-	mem[4] = y1_hi;                        
-	mem[5] = y1_lo;                        
-	mem[6] = x0;                           
-	mem[7] = x1;                           
-	mem[8] = x2;                           
+	mem[0] = y3_hi;
+	mem[1] = y3_lo;
+	mem[2] = y2_hi;
+	mem[3] = y2_lo;
+	mem[4] = y1_hi;
+	mem[5] = y1_lo;
+	mem[6] = x0;
+	mem[7] = x1;
+	mem[8] = x2;
 
 	return;
 }
diff --git a/media/libstagefright/codecs/amrwbenc/src/int_lpc.c b/media/libstagefright/codecs/amrwbenc/src/int_lpc.c
index 88285e8..1119bc7 100644
--- a/media/libstagefright/codecs/amrwbenc/src/int_lpc.c
+++ b/media/libstagefright/codecs/amrwbenc/src/int_lpc.c
@@ -36,21 +36,21 @@
 		Word16 Az[]                           /* output: LP coefficients in 4 subframes    */
 	    )
 {
-	Word32 i, k; 
+	Word32 i, k;
 	Word16 fac_old, fac_new;
 	Word16 isp[M];
 	Word32 L_tmp;
 
 	for (k = 0; k < 3; k++)
 	{
-		fac_new = frac[k];                
+		fac_new = frac[k];
 		fac_old = (32767 - fac_new) + 1;  /* 1.0 - fac_new */
 
 		for (i = 0; i < M; i++)
 		{
 			L_tmp = (isp_old[i] * fac_old)<<1;
 			L_tmp += (isp_new[i] * fac_new)<<1;
-			isp[i] = (L_tmp + 0x8000)>>16;        
+			isp[i] = (L_tmp + 0x8000)>>16;
 		}
 		Isp_Az(isp, Az, M, 0);
 		Az += MP1;
diff --git a/media/libstagefright/codecs/amrwbenc/src/isp_az.c b/media/libstagefright/codecs/amrwbenc/src/isp_az.c
index c235c5d..30a8bbd 100644
--- a/media/libstagefright/codecs/amrwbenc/src/isp_az.c
+++ b/media/libstagefright/codecs/amrwbenc/src/isp_az.c
@@ -42,7 +42,7 @@
 		                                      /*     1   : adaptive scaling enabled  */
 	   )
 {
-	Word32 i, j; 
+	Word32 i, j;
 	Word16 hi, lo;
 	Word32 f1[NC16k + 1], f2[NC16k];
 	Word16 nc;
@@ -92,14 +92,14 @@
 		lo = (f1[i] & 0xffff)>>1;
 
 		t0 = Mpy_32_16(hi, lo, isp[m - 1]);
-		f1[i] = vo_L_add(f1[i], t0); 
+		f1[i] = vo_L_add(f1[i], t0);
 
 		/* f2[i] *= (1.0 - isp[M-1]); */
 
 		hi = f2[i] >> 16;
 		lo = (f2[i] & 0xffff)>>1;
 		t0 = Mpy_32_16(hi, lo, isp[m - 1]);
-		f2[i] = vo_L_sub(f2[i], t0); 
+		f2[i] = vo_L_sub(f2[i], t0);
 	}
 
 	/*-----------------------------------------------------*
@@ -108,20 +108,20 @@
 	 *-----------------------------------------------------*/
 
 	/* a[0] = 1.0; */
-	a[0] = 4096;  
-	tmax = 1;                            
+	a[0] = 4096;
+	tmax = 1;
 	for (i = 1, j = m - 1; i < nc; i++, j--)
 	{
 		/* a[i] = 0.5*(f1[i] + f2[i]); */
 
 		t0 = vo_L_add(f1[i], f2[i]);          /* f1[i] + f2[i]             */
-		tmax |= L_abs(t0);                 
+		tmax |= L_abs(t0);
 		a[i] = (Word16)(vo_L_shr_r(t0, 12)); /* from Q23 to Q12 and * 0.5 */
 
 		/* a[j] = 0.5*(f1[i] - f2[i]); */
 
 		t0 = vo_L_sub(f1[i], f2[i]);          /* f1[i] - f2[i]             */
-		tmax |= L_abs(t0);                
+		tmax |= L_abs(t0);
 		a[j] = (Word16)(vo_L_shr_r(t0, 12)); /* from Q23 to Q12 and * 0.5 */
 	}
 
@@ -144,12 +144,12 @@
 			t0 = vo_L_sub(f1[i], f2[i]);          /* f1[i] - f2[i]             */
 			a[j] = (Word16)(vo_L_shr_r(t0, q_sug)); /* from Q23 to Q12 and * 0.5 */
 		}
-		a[0] = shr(a[0], q); 
+		a[0] = shr(a[0], q);
 	}
 	else
 	{
-		q_sug = 12; 
-		q     = 0; 
+		q_sug = 12;
+		q     = 0;
 	}
 	/* a[NC] = 0.5*f1[NC]*(1.0 + isp[M-1]); */
 	hi = f1[nc] >> 16;
@@ -196,7 +196,7 @@
 	isp += 2;                                /* Advance isp pointer        */
 	for (i = 2; i <= n; i++)
 	{
-		*f = f[-2];                        
+		*f = f[-2];
 		for (j = 1; j < i; j++, f--)
 		{
 			hi = f[-1]>>16;
@@ -228,7 +228,7 @@
 
 	for (i = 2; i <= n; i++)
 	{
-		*f = f[-2];                        
+		*f = f[-2];
 		for (j = 1; j < i; j++, f--)
 		{
 			VO_L_Extract(f[-1], &hi, &lo);
diff --git a/media/libstagefright/codecs/amrwbenc/src/isp_isf.c b/media/libstagefright/codecs/amrwbenc/src/isp_isf.c
index fbe80eb..b4ba408 100644
--- a/media/libstagefright/codecs/amrwbenc/src/isp_isf.c
+++ b/media/libstagefright/codecs/amrwbenc/src/isp_isf.c
@@ -51,9 +51,9 @@
 		/* acos(isp[i])= ind*128 + ( ( isp[i]-table[ind] ) * slope[ind] )/2048 */
 		L_tmp = vo_L_mult(vo_sub(isp[i], table[ind]), slope[ind]);
 		isf[i] = vo_round((L_tmp << 4));   /* (isp[i]-table[ind])*slope[ind])>>11 */
-		isf[i] = add1(isf[i], (ind << 7)); 
+		isf[i] = add1(isf[i], (ind << 7));
 	}
-	isf[m - 1] = (isf[m - 1] >> 1);      
+	isf[m - 1] = (isf[m - 1] >> 1);
 	return;
 }
 
@@ -69,7 +69,7 @@
 
 	for (i = 0; i < m - 1; i++)
 	{
-		isp[i] = isf[i];                  
+		isp[i] = isf[i];
 	}
 	isp[m - 1] = (isf[m - 1] << 1);
 
@@ -80,7 +80,7 @@
 
 		/* isp[i] = table[ind]+ ((table[ind+1]-table[ind])*offset) / 128 */
 		L_tmp = vo_L_mult(vo_sub(table[ind + 1], table[ind]), offset);
-		isp[i] = add1(table[ind], (Word16)((L_tmp >> 8)));   
+		isp[i] = add1(table[ind], (Word16)((L_tmp >> 8)));
 	}
 
 	return;
diff --git a/media/libstagefright/codecs/amrwbenc/src/levinson.c b/media/libstagefright/codecs/amrwbenc/src/levinson.c
index a68845f..4b2f8ed 100644
--- a/media/libstagefright/codecs/amrwbenc/src/levinson.c
+++ b/media/libstagefright/codecs/amrwbenc/src/levinson.c
@@ -122,8 +122,8 @@
 	Word16 *old_A, *old_rc;
 
 	/* Last A(z) for case of unstable filter */
-	old_A = mem;                           
-	old_rc = mem + M;                      
+	old_A = mem;
+	old_rc = mem + M;
 
 	/* K = A[1] = -R[1] / R[0] */
 
@@ -135,7 +135,7 @@
 
 	Kh = t0 >> 16;
 	Kl = (t0 & 0xffff)>>1;
-	rc[0] = Kh;                            
+	rc[0] = Kh;
 	t0 = (t0 >> 4);                        /* A[1] in Q27      */
 
 	Ah[1] = t0 >> 16;
@@ -163,7 +163,7 @@
 	for (i = 2; i <= M; i++)
 	{
 		/* t0 = SUM ( R[j]*A[i-j] ,j=1,i-1 ) +  R[i] */
-		t0 = 0;                           
+		t0 = 0;
 		for (j = 1; j < i; j++)
 			t0 = vo_L_add(t0, Mpy_32(Rh[j], Rl[j], Ah[i - j], Al[i - j]));
 
@@ -182,14 +182,14 @@
 		Kh = t2 >> 16;
 		Kl = (t2 & 0xffff)>>1;
 
-		rc[i - 1] = Kh;                   
+		rc[i - 1] = Kh;
 		/* Test for unstable filter. If unstable keep old A(z) */
 		if (abs_s(Kh) > 32750)
 		{
 			A[0] = 4096;                    /* Ai[0] not stored (always 1.0) */
 			for (j = 0; j < M; j++)
 			{
-				A[j + 1] = old_A[j];       
+				A[j + 1] = old_A[j];
 			}
 			rc[0] = old_rc[0];             /* only two rc coefficients are needed */
 			rc[1] = old_rc[1];
@@ -229,19 +229,19 @@
 		/* A[j] = An[j] */
 		for (j = 1; j <= i; j++)
 		{
-			Ah[j] = Anh[j];               
-			Al[j] = Anl[j];                
+			Ah[j] = Anh[j];
+			Al[j] = Anl[j];
 		}
 	}
 	/* Truncate A[i] in Q27 to Q12 with rounding */
-	A[0] = 4096;                          
+	A[0] = 4096;
 	for (i = 1; i <= M; i++)
 	{
 		t0 = (Ah[i] << 16) + (Al[i] << 1);
-		old_A[i - 1] = A[i] = vo_round((t0 << 1));      
+		old_A[i - 1] = A[i] = vo_round((t0 << 1));
 	}
-	old_rc[0] = rc[0];                    
-	old_rc[1] = rc[1];                    
+	old_rc[0] = rc[0];
+	old_rc[1] = rc[1];
 
 	return;
 }
diff --git a/media/libstagefright/codecs/amrwbenc/src/log2.c b/media/libstagefright/codecs/amrwbenc/src/log2.c
index 646d6af..0f65541 100644
--- a/media/libstagefright/codecs/amrwbenc/src/log2.c
+++ b/media/libstagefright/codecs/amrwbenc/src/log2.c
@@ -64,11 +64,11 @@
 	Word32 L_y;
 	if (L_x <= (Word32) 0)
 	{
-		*exponent = 0; 
-		*fraction = 0; 
+		*exponent = 0;
+		*fraction = 0;
 		return;
 	}
-	*exponent = (30 - exp); 
+	*exponent = (30 - exp);
 	L_x = (L_x >> 9);
 	i = extract_h (L_x);                /* Extract b25-b31 */
 	L_x = (L_x >> 1);
@@ -78,7 +78,7 @@
 	L_y = L_deposit_h (table[i]);       /* table[i] << 16        */
 	tmp = vo_sub(table[i], table[i + 1]); /* table[i] - table[i+1] */
 	L_y = vo_L_msu (L_y, tmp, a);          /* L_y -= tmp*a*2        */
-	*fraction = extract_h (L_y); 
+	*fraction = extract_h (L_y);
 
 	return;
 }
diff --git a/media/libstagefright/codecs/amrwbenc/src/lp_dec2.c b/media/libstagefright/codecs/amrwbenc/src/lp_dec2.c
index 29bd46b..1d5d076 100644
--- a/media/libstagefright/codecs/amrwbenc/src/lp_dec2.c
+++ b/media/libstagefright/codecs/amrwbenc/src/lp_dec2.c
@@ -42,25 +42,25 @@
 	Word32 i, j;
 	Word32 L_tmp;
 	/* copy initial filter states into buffer */
-	p_x = x_buf;                           
+	p_x = x_buf;
 	for (i = 0; i < L_MEM; i++)
 	{
-		*p_x++ = mem[i];  
-		mem[i] = x[l - L_MEM + i];  
+		*p_x++ = mem[i];
+		mem[i] = x[l - L_MEM + i];
 	}
 	for (i = 0; i < l; i++)
 	{
-		*p_x++ = x[i];                     
+		*p_x++ = x[i];
 	}
 	for (i = 0, j = 0; i < l; i += 2, j++)
 	{
-		p_x = &x_buf[i];  
+		p_x = &x_buf[i];
 		L_tmp  = ((*p_x++) * h_fir[0]);
 		L_tmp += ((*p_x++) * h_fir[1]);
 		L_tmp += ((*p_x++) * h_fir[2]);
 		L_tmp += ((*p_x++) * h_fir[3]);
 		L_tmp += ((*p_x++) * h_fir[4]);
-		x[j] = (L_tmp + 0x4000)>>15;              
+		x[j] = (L_tmp + 0x4000)>>15;
 	}
 	return;
 }
diff --git a/media/libstagefright/codecs/amrwbenc/src/math_op.c b/media/libstagefright/codecs/amrwbenc/src/math_op.c
index 1a7b513..7affbb2 100644
--- a/media/libstagefright/codecs/amrwbenc/src/math_op.c
+++ b/media/libstagefright/codecs/amrwbenc/src/math_op.c
@@ -106,21 +106,21 @@
 
 	if (*frac <= (Word32) 0)
 	{
-		*exp = 0;                          
-		*frac = 0x7fffffffL;               
+		*exp = 0;
+		*frac = 0x7fffffffL;
 		return;
 	}
 
 	if((*exp & 1) == 1)                       /*If exponant odd -> shift right */
 		*frac = (*frac) >> 1;
 
-	*exp = negate((*exp - 1) >> 1);   
+	*exp = negate((*exp - 1) >> 1);
 
-	*frac = (*frac >> 9);               
+	*frac = (*frac >> 9);
 	i = extract_h(*frac);                  /* Extract b25-b31 */
-	*frac = (*frac >> 1);              
+	*frac = (*frac >> 1);
 	a = (Word16)(*frac);                  /* Extract b10-b24 */
-	a = (Word16) (a & (Word16) 0x7fff);    
+	a = (Word16) (a & (Word16) 0x7fff);
 	i -= 16;
 	*frac = L_deposit_h(table_isqrt[i]);   /* table[i] << 16         */
 	tmp = vo_sub(table_isqrt[i], table_isqrt[i + 1]);      /* table[i] - table[i+1]) */
@@ -167,7 +167,7 @@
 	i = extract_h(L_x);                    /* Extract b10-b16 of fraction */
 	L_x =L_x >> 1;
 	a = (Word16)(L_x);                    /* Extract b0-b9   of fraction */
-	a = (Word16) (a & (Word16) 0x7fff); 
+	a = (Word16) (a & (Word16) 0x7fff);
 
 	L_x = L_deposit_h(table_pow2[i]);      /* table[i] << 16        */
 	tmp = vo_sub(table_pow2[i], table_pow2[i + 1]);        /* table[i] - table[i+1] */
diff --git a/media/libstagefright/codecs/amrwbenc/src/mem_align.c b/media/libstagefright/codecs/amrwbenc/src/mem_align.c
index e58915a..3b7853f 100644
--- a/media/libstagefright/codecs/amrwbenc/src/mem_align.c
+++ b/media/libstagefright/codecs/amrwbenc/src/mem_align.c
@@ -23,11 +23,16 @@
 
 
 #include	"mem_align.h"
+#ifdef _MSC_VER
+#include	<stddef.h>
+#else
+#include	<stdint.h>
+#endif
 
 /*****************************************************************************
 *
 * function name: mem_malloc
-* description:  malloc the alignments memory 
+* description:  malloc the alignments memory
 * returns:      the point of the memory
 *
 **********************************************************************************/
@@ -66,8 +71,8 @@
 		pMemop->Set(CodecID, tmp, 0, size + alignment);
 
 		mem_ptr =
-			(unsigned char *) ((unsigned int) (tmp + alignment - 1) &
-					(~((unsigned int) (alignment - 1))));
+			(unsigned char *) ((intptr_t) (tmp + alignment - 1) &
+					(~((intptr_t) (alignment - 1))));
 
 		if (mem_ptr == tmp)
 			mem_ptr += alignment;
diff --git a/media/libstagefright/codecs/amrwbenc/src/p_med_ol.c b/media/libstagefright/codecs/amrwbenc/src/p_med_ol.c
index 08f430f..b8174b9 100644
--- a/media/libstagefright/codecs/amrwbenc/src/p_med_ol.c
+++ b/media/libstagefright/codecs/amrwbenc/src/p_med_ol.c
@@ -18,7 +18,7 @@
 *      File: p_med_ol.c                                                *
 *                                                                      *
 *      Description: Compute the open loop pitch lag                    *
-*	            output: open loop pitch lag                        *                            
+*	            output: open loop pitch lag                        *
 ************************************************************************/
 
 #include "typedef.h"
@@ -29,7 +29,7 @@
 #include "p_med_ol.tab"
 
 Word16 Pitch_med_ol(
-		   Word16      wsp[],        /*   i: signal used to compute the open loop pitch*/  
+		   Word16      wsp[],        /*   i: signal used to compute the open loop pitch*/
                                      /*      wsp[-pit_max] to wsp[-1] should be known */
 		   Coder_State *st,          /* i/o: codec global structure */
 		   Word16      L_frame       /*   i: length of frame to compute pitch */
@@ -52,8 +52,8 @@
 	ww = &corrweight[198];
 	we = &corrweight[98 + L_max - L_0];
 
-	max = MIN_32;                          
-	Tm = 0;                                
+	max = MIN_32;
+	Tm = 0;
 	for (i = L_max; i > L_min; i--)
 	{
 		/* Compute the correlation */
@@ -65,7 +65,7 @@
 			R0 += vo_L_mult((*p1++), (*p2++));
 			R0 += vo_L_mult((*p1++), (*p2++));
 			R0 += vo_L_mult((*p1++), (*p2++));
-			R0 += vo_L_mult((*p1++), (*p2++));     
+			R0 += vo_L_mult((*p1++), (*p2++));
 		}
 		/* Weighting of the correlation function.   */
 		hi = R0>>16;
@@ -90,13 +90,13 @@
 	}
 
 	/* Hypass the wsp[] vector */
-	hp_wsp = old_hp_wsp + L_max;           
+	hp_wsp = old_hp_wsp + L_max;
 	Hp_wsp(wsp, hp_wsp, L_frame, hp_wsp_mem);
 
 	/* Compute normalize correlation at delay Tm */
-	R0 = 0;                                
-	R1 = 0;                               
-	R2 = 0; 
+	R0 = 0;
+	R1 = 0;
+	R2 = 0;
 	p1 = hp_wsp;
 	p2 = hp_wsp - Tm;
 	for (j = 0; j < L_frame; j+=4)
@@ -174,57 +174,57 @@
 	Word16 x1, x2, x3, x4, x5;
 	Word16 tmp;
 
-	x1 = x[-2];                            
-	x2 = x[-1];                            
-	x3 = x[0];                             
-	x4 = x[1];                             
-	x5 = x[2];                             
+	x1 = x[-2];
+	x2 = x[-1];
+	x3 = x[0];
+	x4 = x[1];
+	x5 = x[2];
 
 	if (x2 < x1)
 	{
 		tmp = x1;
 		x1 = x2;
-		x2 = tmp;                          
+		x2 = tmp;
 	}
 	if (x3 < x1)
 	{
 		tmp = x1;
 		x1 = x3;
-		x3 = tmp;                          
+		x3 = tmp;
 	}
 	if (x4 < x1)
 	{
 		tmp = x1;
 		x1 = x4;
-		x4 = tmp;                          
+		x4 = tmp;
 	}
 	if (x5 < x1)
 	{
-		x5 = x1;                           
+		x5 = x1;
 	}
 	if (x3 < x2)
 	{
 		tmp = x2;
 		x2 = x3;
-		x3 = tmp;                          
+		x3 = tmp;
 	}
 	if (x4 < x2)
 	{
 		tmp = x2;
 		x2 = x4;
-		x4 = tmp;                          
+		x4 = tmp;
 	}
 	if (x5 < x2)
 	{
-		x5 = x2;                           
+		x5 = x2;
 	}
 	if (x4 < x3)
 	{
-		x3 = x4;                           
+		x3 = x4;
 	}
 	if (x5 < x3)
 	{
-		x3 = x5;                           
+		x3 = x5;
 	}
 	return (x3);
 }
@@ -241,10 +241,10 @@
 
 	for (i = 4; i > 0; i--)
 	{
-		old_ol_lag[i] = old_ol_lag[i - 1]; 
+		old_ol_lag[i] = old_ol_lag[i - 1];
 	}
 
-	old_ol_lag[0] = prev_ol_lag;           
+	old_ol_lag[0] = prev_ol_lag;
 
 	i = median5(&old_ol_lag[2]);
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/pitch_f4.c b/media/libstagefright/codecs/amrwbenc/src/pitch_f4.c
index 41d7413..0d66c31 100644
--- a/media/libstagefright/codecs/amrwbenc/src/pitch_f4.c
+++ b/media/libstagefright/codecs/amrwbenc/src/pitch_f4.c
@@ -90,7 +90,7 @@
     Norm_corr_asm(exc, xn, h, L_subfr, t_min, t_max, corr);
 #else
 	Norm_Corr(exc, xn, h, L_subfr, t_min, t_max, corr);
-#endif 
+#endif
 
 	/* Find integer pitch */
 
@@ -100,8 +100,8 @@
 	{
 		if (corr[i] >= max)
 		{
-			max = corr[i];                 
-			t0 = i;                        
+			max = corr[i];
+			t0 = i;
 		}
 	}
 	/* If first subframe and t0 >= t0_fr1, do not search fractionnal pitch */
@@ -182,7 +182,7 @@
 #endif
 
 	/* Compute rounded down 1/sqrt(energy of xn[]) */
-	L_tmp = 0; 
+	L_tmp = 0;
 	for (i = 0; i < 64; i+=4)
 	{
 		L_tmp += (xn[i] * xn[i]);
@@ -202,7 +202,7 @@
 	for (t = t_min; t <= t_max; t++)
 	{
 		/* Compute correlation between xn[] and excf[] */
-		L_tmp  = 0;  
+		L_tmp  = 0;
 		L_tmp1 = 0;
 		for (i = 0; i < 64; i+=4)
 		{
@@ -246,7 +246,7 @@
 			L_tmp = L_tmp << L_tmp2;
 		}
 
-		corr_norm[t] = vo_round(L_tmp);      
+		corr_norm[t] = vo_round(L_tmp);
 		/* modify the filtered excitation excf[] for the next iteration */
 
 		if(t != t_max)
@@ -310,10 +310,10 @@
 	L_sum += vo_mult32(x[1], (*ptr++));
 	L_sum += vo_mult32(x[2], (*ptr++));
 	L_sum += vo_mult32(x[3], (*ptr++));
-	L_sum += vo_mult32(x[4], (*ptr++));  
+	L_sum += vo_mult32(x[4], (*ptr++));
 	L_sum += vo_mult32(x[5], (*ptr++));
 	L_sum += vo_mult32(x[6], (*ptr++));
-	L_sum += vo_mult32(x[7], (*ptr++));   
+	L_sum += vo_mult32(x[7], (*ptr++));
 
 	sum = extract_h(L_add(L_shl2(L_sum, 2), 0x8000));
 	return (sum);
diff --git a/media/libstagefright/codecs/amrwbenc/src/pred_lt4.c b/media/libstagefright/codecs/amrwbenc/src/pred_lt4.c
index b359651..8404cf9 100644
--- a/media/libstagefright/codecs/amrwbenc/src/pred_lt4.c
+++ b/media/libstagefright/codecs/amrwbenc/src/pred_lt4.c
@@ -60,13 +60,13 @@
 	Word16 *ptr, *ptr1;
 	Word16 *ptr2;
 
-	x = exc - T0;   
+	x = exc - T0;
 	frac = -frac;
 	if (frac < 0)
 	{
 		frac += UP_SAMP;
 		x--;
-	}   
+	}
 	x -= 15;                                     /* x = L_INTERPOL2 - 1 */
 	k = 3 - frac;                                /* k = UP_SAMP - 1 - frac */
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/preemph.c b/media/libstagefright/codecs/amrwbenc/src/preemph.c
index 5408617..c867bf7 100644
--- a/media/libstagefright/codecs/amrwbenc/src/preemph.c
+++ b/media/libstagefright/codecs/amrwbenc/src/preemph.c
@@ -35,20 +35,20 @@
 	Word16 temp;
 	Word32 i, L_tmp;
 
-	temp = x[lg - 1];                     
+	temp = x[lg - 1];
 
 	for (i = lg - 1; i > 0; i--)
 	{
 		L_tmp = L_deposit_h(x[i]);
 		L_tmp -= (x[i - 1] * mu)<<1;
-		x[i] = (L_tmp + 0x8000)>>16;               
+		x[i] = (L_tmp + 0x8000)>>16;
 	}
 
 	L_tmp = L_deposit_h(x[0]);
 	L_tmp -= ((*mem) * mu)<<1;
-	x[0] = (L_tmp + 0x8000)>>16;                   
+	x[0] = (L_tmp + 0x8000)>>16;
 
-	*mem = temp;                           
+	*mem = temp;
 
 	return;
 }
@@ -64,22 +64,22 @@
 	Word16 temp;
 	Word32 i, L_tmp;
 
-	temp = x[lg - 1];                     
+	temp = x[lg - 1];
 
 	for (i = (Word16) (lg - 1); i > 0; i--)
 	{
 		L_tmp = L_deposit_h(x[i]);
 		L_tmp -= (x[i - 1] * mu)<<1;
 		L_tmp = (L_tmp << 1);
-		x[i] = (L_tmp + 0x8000)>>16;               
+		x[i] = (L_tmp + 0x8000)>>16;
 	}
 
 	L_tmp = L_deposit_h(x[0]);
 	L_tmp -= ((*mem) * mu)<<1;
 	L_tmp = (L_tmp << 1);
-	x[0] = (L_tmp + 0x8000)>>16;                   
+	x[0] = (L_tmp + 0x8000)>>16;
 
-	*mem = temp;                           
+	*mem = temp;
 
 	return;
 }
diff --git a/media/libstagefright/codecs/amrwbenc/src/q_gain2.c b/media/libstagefright/codecs/amrwbenc/src/q_gain2.c
index 7bc299f..e8ca043 100644
--- a/media/libstagefright/codecs/amrwbenc/src/q_gain2.c
+++ b/media/libstagefright/codecs/amrwbenc/src/q_gain2.c
@@ -83,7 +83,7 @@
 	Word32 i, j, L_tmp, dist_min;
 	Word16 *past_qua_en, *t_qua_gain;
 
-	past_qua_en = mem;                     
+	past_qua_en = mem;
 
 	/*-----------------------------------------------------------------*
 	 * - Find the initial quantization pitch index                     *
@@ -91,9 +91,9 @@
 	 *-----------------------------------------------------------------*/
 	if (nbits == 6)
 	{
-		t_qua_gain = t_qua_gain6b;         
-		min_ind = 0;                       
-		size = RANGE;                      
+		t_qua_gain = t_qua_gain6b;
+		min_ind = 0;
+		size = RANGE;
 
 		if(gp_clip == 1)
 		{
@@ -101,18 +101,18 @@
 		}
 	} else
 	{
-		t_qua_gain = t_qua_gain7b;         
+		t_qua_gain = t_qua_gain7b;
 
 		p = t_qua_gain7b + RANGE;            /* pt at 1/4th of table */
 
-		j = nb_qua_gain7b - RANGE;         
+		j = nb_qua_gain7b - RANGE;
 
 		if (gp_clip == 1)
 		{
 			j = j - 27;                /* limit gain pitch to 1.0 */
 		}
-		min_ind = 0;                       
-		g_pitch = *gain_pit;               
+		min_ind = 0;
+		g_pitch = *gain_pit;
 
 		for (i = 0; i < j; i++, p += 2)
 		{
@@ -121,7 +121,7 @@
 				min_ind = min_ind + 1;
 			}
 		}
-		size = RANGE;                      
+		size = RANGE;
 	}
 
 	/*------------------------------------------------------------------*
@@ -137,10 +137,10 @@
 	 * are in vector g_coeff[].                                         *
 	 *------------------------------------------------------------------*/
 
-	coeff[0] = g_coeff[0];                 
-	exp_coeff[0] = g_coeff[1];             
+	coeff[0] = g_coeff[0];
+	exp_coeff[0] = g_coeff[1];
 	coeff[1] = negate(g_coeff[2]);                    /* coeff[1] = -2 xn y1 */
-	exp_coeff[1] = g_coeff[3] + 1;     
+	exp_coeff[1] = g_coeff[3] + 1;
 
 	/* Compute scalar product <y2[],y2[]> */
 #ifdef ASM_OPT                   /* asm optimization branch */
@@ -242,20 +242,20 @@
 	 *-------------------------------------------------------------------------*/
 
 	exp_code = (exp_gcode0 + 4);
-	exp_max[0] = (exp_coeff[0] - 13);    
-	exp_max[1] = (exp_coeff[1] - 14);    
-	exp_max[2] = (exp_coeff[2] + (15 + (exp_code << 1)));  
-	exp_max[3] = (exp_coeff[3] + exp_code);   
-	exp_max[4] = (exp_coeff[4] + (1 + exp_code));  
+	exp_max[0] = (exp_coeff[0] - 13);
+	exp_max[1] = (exp_coeff[1] - 14);
+	exp_max[2] = (exp_coeff[2] + (15 + (exp_code << 1)));
+	exp_max[3] = (exp_coeff[3] + exp_code);
+	exp_max[4] = (exp_coeff[4] + (1 + exp_code));
 
 	/* Find maximum exponant */
 
-	e_max = exp_max[0];                   
+	e_max = exp_max[0];
 	for (i = 1; i < 5; i++)
 	{
 		if(exp_max[i] > e_max)
 		{
-			e_max = exp_max[i];            
+			e_max = exp_max[i];
 		}
 	}
 
@@ -271,14 +271,14 @@
 	}
 
 	/* Codebook search */
-	dist_min = MAX_32;                     
-	p = &t_qua_gain[min_ind << 1];      
+	dist_min = MAX_32;
+	p = &t_qua_gain[min_ind << 1];
 
-	index = 0;                             
+	index = 0;
 	for (i = 0; i < size; i++)
 	{
-		g_pitch = *p++;                    
-		g_code = *p++;                     
+		g_pitch = *p++;
+		g_code = *p++;
 
 		g_code = ((g_code * gcode0) + 0x4000)>>15;
 		g2_pitch = ((g_pitch * g_pitch) + 0x4000)>>15;
@@ -302,14 +302,14 @@
 
 		if(L_tmp < dist_min)
 		{
-			dist_min = L_tmp;              
-			index = i;                     
+			dist_min = L_tmp;
+			index = i;
 		}
 	}
 
 	/* Read the quantized gains */
 	index = index + min_ind;
-	p = &t_qua_gain[(index + index)];    
+	p = &t_qua_gain[(index + index)];
 	*gain_pit = *p++;                       /* selected pitch gain in Q14 */
 	g_code = *p++;                          /* selected code gain in Q11  */
 
@@ -333,10 +333,10 @@
 
 	/* update table of past quantized energies */
 
-	past_qua_en[3] = past_qua_en[2];       
-	past_qua_en[2] = past_qua_en[1];       
-	past_qua_en[1] = past_qua_en[0];       
-	past_qua_en[0] = qua_ener;             
+	past_qua_en[3] = past_qua_en[2];
+	past_qua_en[2] = past_qua_en[1];
+	past_qua_en[1] = past_qua_en[0];
+	past_qua_en[0] = qua_ener;
 
 	return (index);
 }
diff --git a/media/libstagefright/codecs/amrwbenc/src/q_pulse.c b/media/libstagefright/codecs/amrwbenc/src/q_pulse.c
index 496ca80..80a0b73 100644
--- a/media/libstagefright/codecs/amrwbenc/src/q_pulse.c
+++ b/media/libstagefright/codecs/amrwbenc/src/q_pulse.c
@@ -82,7 +82,7 @@
 		if (vo_sub((Word16) (pos1 & mask), (Word16) (pos2 & mask)) <= 0)
 		{
 			/* index = ((pos2 & mask) << N) + (pos1 & mask); */
-			index = L_deposit_l(add1((((Word16) (pos2 & mask)) << N), ((Word16) (pos1 & mask)))); 
+			index = L_deposit_l(add1((((Word16) (pos2 & mask)) << N), ((Word16) (pos1 & mask))));
 			if ((pos2 & NB_POS) != 0)
 			{
 				tmp = (N << 1);           /* index += 1 << (2*N); */
@@ -91,7 +91,7 @@
 		} else
 		{
 			/* index = ((pos1 & mask) << N) + (pos2 & mask);	 */
-			index = L_deposit_l(add1((((Word16) (pos1 & mask)) << N), ((Word16) (pos2 & mask)))); 
+			index = L_deposit_l(add1((((Word16) (pos1 & mask)) << N), ((Word16) (pos2 & mask))));
 			if ((pos1 & NB_POS) != 0)
 			{
 				tmp = (N << 1);
@@ -120,14 +120,14 @@
 	{
 		index = quant_2p_2N1(pos1, pos2, sub(N, 1));    /* index = quant_2p_2N1(pos1, pos2, (N-1)); */
 		/* index += (pos1 & nb_pos) << N; */
-		index = vo_L_add(index, (L_deposit_l((Word16) (pos1 & nb_pos)) << N));  
+		index = vo_L_add(index, (L_deposit_l((Word16) (pos1 & nb_pos)) << N));
 		/* index += quant_1p_N1(pos3, N) << (2*N); */
 		index = vo_L_add(index, (quant_1p_N1(pos3, N)<<(N << 1)));
 
 	} else if (((pos1 ^ pos3) & nb_pos) == 0)
 	{
 		index = quant_2p_2N1(pos1, pos3, sub(N, 1));    /* index = quant_2p_2N1(pos1, pos3, (N-1)); */
-		index = vo_L_add(index, (L_deposit_l((Word16) (pos1 & nb_pos)) << N)); 
+		index = vo_L_add(index, (L_deposit_l((Word16) (pos1 & nb_pos)) << N));
 		/* index += (pos1 & nb_pos) << N; */
 		index = vo_L_add(index, (quant_1p_N1(pos2, N) << (N << 1)));
 		/* index += quant_1p_N1(pos2, N) <<
@@ -136,7 +136,7 @@
 	{
 		index = quant_2p_2N1(pos2, pos3, (N - 1));    /* index = quant_2p_2N1(pos2, pos3, (N-1)); */
 		/* index += (pos2 & nb_pos) << N;			 */
-		index = vo_L_add(index, (L_deposit_l((Word16) (pos2 & nb_pos)) << N));  
+		index = vo_L_add(index, (L_deposit_l((Word16) (pos2 & nb_pos)) << N));
 		/* index += quant_1p_N1(pos1, N) << (2*N);	 */
 		index = vo_L_add(index, (quant_1p_N1(pos1, N) << (N << 1)));
 	}
@@ -162,21 +162,21 @@
 	{
 		index = quant_2p_2N1(pos1, pos2, sub(N, 1));    /* index = quant_2p_2N1(pos1, pos2, (N-1)); */
 		/* index += (pos1 & nb_pos) << N;	 */
-		index = vo_L_add(index, (L_deposit_l((Word16) (pos1 & nb_pos)) << N));  
+		index = vo_L_add(index, (L_deposit_l((Word16) (pos1 & nb_pos)) << N));
 		/* index += quant_2p_2N1(pos3, pos4, N) << (2*N); */
 		index = vo_L_add(index, (quant_2p_2N1(pos3, pos4, N) << (N << 1)));
 	} else if (((pos1 ^ pos3) & nb_pos) == 0)
 	{
 		index = quant_2p_2N1(pos1, pos3, (N - 1));
 		/* index += (pos1 & nb_pos) << N; */
-		index = vo_L_add(index, (L_deposit_l((Word16) (pos1 & nb_pos)) << N));  
+		index = vo_L_add(index, (L_deposit_l((Word16) (pos1 & nb_pos)) << N));
 		/* index += quant_2p_2N1(pos2, pos4, N) << (2*N); */
 		index = vo_L_add(index, (quant_2p_2N1(pos2, pos4, N) << (N << 1)));
 	} else
 	{
 		index = quant_2p_2N1(pos2, pos3, (N - 1));
 		/* index += (pos2 & nb_pos) << N; */
-		index = vo_L_add(index, (L_deposit_l((Word16) (pos2 & nb_pos)) << N));  
+		index = vo_L_add(index, (L_deposit_l((Word16) (pos2 & nb_pos)) << N));
 		/* index += quant_2p_2N1(pos1, pos4, N) << (2*N); */
 		index = vo_L_add(index, (quant_2p_2N1(pos1, pos4, N) << (N << 1)));
 	}
@@ -192,20 +192,20 @@
 	Word16 posA[4], posB[4];
 	Word32 i, j, k, index;
 
-	n_1 = (Word16) (N - 1);                
+	n_1 = (Word16) (N - 1);
 	nb_pos = (1 << n_1);                  /* nb_pos = (1<<n_1); */
 	mask = vo_sub((1 << N), 1);              /* mask = ((1<<N)-1); */
 
-	i = 0;                                 
-	j = 0;                                 
+	i = 0;
+	j = 0;
 	for (k = 0; k < 4; k++)
 	{
 		if ((pos[k] & nb_pos) == 0)
 		{
-			posA[i++] = pos[k];            
+			posA[i++] = pos[k];
 		} else
 		{
-			posB[j++] = pos[k];            
+			posB[j++] = pos[k];
 		}
 	}
 
@@ -258,19 +258,19 @@
 	Word16 posA[5], posB[5];
 	Word32 i, j, k, index, tmp2;
 
-	n_1 = (Word16) (N - 1);                
+	n_1 = (Word16) (N - 1);
 	nb_pos = (1 << n_1);                  /* nb_pos = (1<<n_1); */
 
-	i = 0;                                 
-	j = 0;                                 
+	i = 0;
+	j = 0;
 	for (k = 0; k < 5; k++)
 	{
 		if ((pos[k] & nb_pos) == 0)
 		{
-			posA[i++] = pos[k];            
+			posA[i++] = pos[k];
 		} else
 		{
-			posB[j++] = pos[k];            
+			posB[j++] = pos[k];
 		}
 	}
 
@@ -333,19 +333,19 @@
 	Word32 i, j, k, index;
 
 	/* !!  N and n_1 are constants -> it doesn't need to be operated by Basic Operators */
-	n_1 = (Word16) (N - 1);                
+	n_1 = (Word16) (N - 1);
 	nb_pos = (1 << n_1);                  /* nb_pos = (1<<n_1); */
 
-	i = 0;                                 
-	j = 0;                                 
+	i = 0;
+	j = 0;
 	for (k = 0; k < 6; k++)
 	{
 		if ((pos[k] & nb_pos) == 0)
 		{
-			posA[i++] = pos[k];            
+			posA[i++] = pos[k];
 		} else
 		{
-			posB[j++] = pos[k];            
+			posB[j++] = pos[k];
 		}
 	}
 
@@ -368,23 +368,23 @@
 			index = vo_L_add(index, quant_2p_2N1(posA[0], posA[1], n_1));      /* index += quant_2p_2N1(posA[0], posA[1], n_1); */
 			break;
 		case 3:
-			index = (quant_3p_3N1(posA[0], posA[1], posA[2], n_1) << (Word16) (3 * n_1 + 1));    
+			index = (quant_3p_3N1(posA[0], posA[1], posA[2], n_1) << (Word16) (3 * n_1 + 1));
 			                                  /* index = quant_3p_3N1(posA[0], posA[1], posA[2], n_1) << ((3*n_1)+1); */
-			index =vo_L_add(index, quant_3p_3N1(posB[0], posB[1], posB[2], n_1));     
+			index =vo_L_add(index, quant_3p_3N1(posB[0], posB[1], posB[2], n_1));
 			                                 /* index += quant_3p_3N1(posB[0], posB[1], posB[2], n_1); */
 			break;
 		case 4:
-			i = 2;                            
+			i = 2;
 			index = (quant_4p_4N(posA, n_1) << (Word16) (2 * n_1 + 1));  /* index = quant_4p_4N(posA, n_1) << ((2*n_1)+1); */
 			index = vo_L_add(index, quant_2p_2N1(posB[0], posB[1], n_1));      /* index += quant_2p_2N1(posB[0], posB[1], n_1); */
 			break;
 		case 5:
-			i = 1;                            
+			i = 1;
 			index = (quant_5p_5N(posA, n_1) << N);       /* index = quant_5p_5N(posA, n_1) << N; */
 			index = vo_L_add(index, quant_1p_N1(posB[0], n_1));        /* index += quant_1p_N1(posB[0], n_1); */
 			break;
 		case 6:
-			i = 0;                             
+			i = 0;
 			index = (quant_5p_5N(posA, n_1) << N);       /* index = quant_5p_5N(posA, n_1) << N; */
 			index = vo_L_add(index, quant_1p_N1(posA[5], n_1));        /* index += quant_1p_N1(posA[5], n_1); */
 			break;
diff --git a/media/libstagefright/codecs/amrwbenc/src/qisf_ns.c b/media/libstagefright/codecs/amrwbenc/src/qisf_ns.c
index f6d53de..fc2f00d 100644
--- a/media/libstagefright/codecs/amrwbenc/src/qisf_ns.c
+++ b/media/libstagefright/codecs/amrwbenc/src/qisf_ns.c
@@ -43,14 +43,14 @@
 
 	for (i = 0; i < ORDER; i++)
 	{
-		isf_q[i] = sub(isf1[i], mean_isf_noise[i]);     
+		isf_q[i] = sub(isf1[i], mean_isf_noise[i]);
 	}
 
-	indice[0] = Sub_VQ(&isf_q[0], dico1_isf_noise, 2, SIZE_BK_NOISE1, &tmp);    
-	indice[1] = Sub_VQ(&isf_q[2], dico2_isf_noise, 3, SIZE_BK_NOISE2, &tmp);    
-	indice[2] = Sub_VQ(&isf_q[5], dico3_isf_noise, 3, SIZE_BK_NOISE3, &tmp);    
-	indice[3] = Sub_VQ(&isf_q[8], dico4_isf_noise, 4, SIZE_BK_NOISE4, &tmp);    
-	indice[4] = Sub_VQ(&isf_q[12], dico5_isf_noise, 4, SIZE_BK_NOISE5, &tmp);   
+	indice[0] = Sub_VQ(&isf_q[0], dico1_isf_noise, 2, SIZE_BK_NOISE1, &tmp);
+	indice[1] = Sub_VQ(&isf_q[2], dico2_isf_noise, 3, SIZE_BK_NOISE2, &tmp);
+	indice[2] = Sub_VQ(&isf_q[5], dico3_isf_noise, 3, SIZE_BK_NOISE3, &tmp);
+	indice[3] = Sub_VQ(&isf_q[8], dico4_isf_noise, 4, SIZE_BK_NOISE4, &tmp);
+	indice[4] = Sub_VQ(&isf_q[12], dico5_isf_noise, 4, SIZE_BK_NOISE5, &tmp);
 
 	/* decoding the ISFs */
 
@@ -78,28 +78,28 @@
 
 	for (i = 0; i < 2; i++)
 	{
-		isf_q[i] = dico1_isf_noise[indice[0] * 2 + i];  
+		isf_q[i] = dico1_isf_noise[indice[0] * 2 + i];
 	}
 	for (i = 0; i < 3; i++)
 	{
-		isf_q[i + 2] = dico2_isf_noise[indice[1] * 3 + i];      
+		isf_q[i + 2] = dico2_isf_noise[indice[1] * 3 + i];
 	}
 	for (i = 0; i < 3; i++)
 	{
-		isf_q[i + 5] = dico3_isf_noise[indice[2] * 3 + i];      
+		isf_q[i + 5] = dico3_isf_noise[indice[2] * 3 + i];
 	}
 	for (i = 0; i < 4; i++)
 	{
-		isf_q[i + 8] = dico4_isf_noise[indice[3] * 4 + i];      
+		isf_q[i + 8] = dico4_isf_noise[indice[3] * 4 + i];
 	}
 	for (i = 0; i < 4; i++)
 	{
-		isf_q[i + 12] = dico5_isf_noise[indice[4] * 4 + i];     
+		isf_q[i + 12] = dico5_isf_noise[indice[4] * 4 + i];
 	}
 
 	for (i = 0; i < ORDER; i++)
 	{
-		isf_q[i] = add(isf_q[i], mean_isf_noise[i]);   
+		isf_q[i] = add(isf_q[i], mean_isf_noise[i]);
 	}
 
 	Reorder_isf(isf_q, ISF_GAP, ORDER);
diff --git a/media/libstagefright/codecs/amrwbenc/src/qpisf_2s.c b/media/libstagefright/codecs/amrwbenc/src/qpisf_2s.c
index ac13a67..c711cd0 100644
--- a/media/libstagefright/codecs/amrwbenc/src/qpisf_2s.c
+++ b/media/libstagefright/codecs/amrwbenc/src/qpisf_2s.c
@@ -70,30 +70,30 @@
 	for (i = 0; i < ORDER; i++)
 	{
 		isf[i] = vo_sub(isf1[i], mean_isf[i]);
-		isf[i] = vo_sub(isf[i], vo_mult(MU, past_isfq[i])); 
+		isf[i] = vo_sub(isf[i], vo_mult(MU, past_isfq[i]));
 	}
 
 	VQ_stage1(&isf[0], dico1_isf, 9, SIZE_BK1, surv1, nb_surv);
 
-	distance = MAX_32;          
+	distance = MAX_32;
 
 	for (k = 0; k < nb_surv; k++)
 	{
 		for (i = 0; i < 9; i++)
 		{
-			isf_stage2[i] = vo_sub(isf[i], dico1_isf[i + surv1[k] * 9]); 
+			isf_stage2[i] = vo_sub(isf[i], dico1_isf[i + surv1[k] * 9]);
 		}
-		tmp_ind[0] = Sub_VQ(&isf_stage2[0], dico21_isf, 3, SIZE_BK21, &min_err); 
+		tmp_ind[0] = Sub_VQ(&isf_stage2[0], dico21_isf, 3, SIZE_BK21, &min_err);
 		temp = min_err;
-		tmp_ind[1] = Sub_VQ(&isf_stage2[3], dico22_isf, 3, SIZE_BK22, &min_err); 
+		tmp_ind[1] = Sub_VQ(&isf_stage2[3], dico22_isf, 3, SIZE_BK22, &min_err);
 		temp = vo_L_add(temp, min_err);
-		tmp_ind[2] = Sub_VQ(&isf_stage2[6], dico23_isf, 3, SIZE_BK23, &min_err);  
+		tmp_ind[2] = Sub_VQ(&isf_stage2[6], dico23_isf, 3, SIZE_BK23, &min_err);
 		temp = vo_L_add(temp, min_err);
 
 		if(temp < distance)
 		{
-			distance = temp;               
-			indice[0] = surv1[k];          
+			distance = temp;
+			indice[0] = surv1[k];
 			for (i = 0; i < 3; i++)
 			{
 				indice[i + 2] = tmp_ind[i];
@@ -104,24 +104,24 @@
 
 	VQ_stage1(&isf[9], dico2_isf, 7, SIZE_BK2, surv1, nb_surv);
 
-	distance = MAX_32;                   
+	distance = MAX_32;
 
 	for (k = 0; k < nb_surv; k++)
 	{
 		for (i = 0; i < 7; i++)
 		{
-			isf_stage2[i] = vo_sub(isf[9 + i], dico2_isf[i + surv1[k] * 7]);       
+			isf_stage2[i] = vo_sub(isf[9 + i], dico2_isf[i + surv1[k] * 7]);
 		}
 
 		tmp_ind[0] = Sub_VQ(&isf_stage2[0], dico24_isf, 3, SIZE_BK24, &min_err);
-		temp = min_err; 
+		temp = min_err;
 		tmp_ind[1] = Sub_VQ(&isf_stage2[3], dico25_isf, 4, SIZE_BK25, &min_err);
 		temp = vo_L_add(temp, min_err);
 
 		if(temp < distance)
 		{
-			distance = temp;               
-			indice[1] = surv1[k];          
+			distance = temp;
+			indice[1] = surv1[k];
 			for (i = 0; i < 2; i++)
 			{
 				indice[i + 5] = tmp_ind[i];
@@ -165,24 +165,24 @@
 
 	VQ_stage1(&isf[0], dico1_isf, 9, SIZE_BK1, surv1, nb_surv);
 
-	distance = MAX_32;                  
+	distance = MAX_32;
 
 	for (k = 0; k < nb_surv; k++)
 	{
 		for (i = 0; i < 9; i++)
 		{
-			isf_stage2[i] = vo_sub(isf[i], dico1_isf[i + surv1[k] * 9]); 
+			isf_stage2[i] = vo_sub(isf[i], dico1_isf[i + surv1[k] * 9]);
 		}
 
-		tmp_ind[0] = Sub_VQ(&isf_stage2[0], dico21_isf_36b, 5, SIZE_BK21_36b, &min_err);        
-		temp = min_err;                  
-		tmp_ind[1] = Sub_VQ(&isf_stage2[5], dico22_isf_36b, 4, SIZE_BK22_36b, &min_err);        
+		tmp_ind[0] = Sub_VQ(&isf_stage2[0], dico21_isf_36b, 5, SIZE_BK21_36b, &min_err);
+		temp = min_err;
+		tmp_ind[1] = Sub_VQ(&isf_stage2[5], dico22_isf_36b, 4, SIZE_BK22_36b, &min_err);
 		temp = vo_L_add(temp, min_err);
 
 		if(temp < distance)
 		{
-			distance = temp;               
-			indice[0] = surv1[k];          
+			distance = temp;
+			indice[0] = surv1[k];
 			for (i = 0; i < 2; i++)
 			{
 				indice[i + 2] = tmp_ind[i];
@@ -191,23 +191,23 @@
 	}
 
 	VQ_stage1(&isf[9], dico2_isf, 7, SIZE_BK2, surv1, nb_surv);
-	distance = MAX_32;                    
+	distance = MAX_32;
 
 	for (k = 0; k < nb_surv; k++)
 	{
 		for (i = 0; i < 7; i++)
 		{
-			isf_stage2[i] = vo_sub(isf[9 + i], dico2_isf[i + surv1[k] * 7]);     
+			isf_stage2[i] = vo_sub(isf[9 + i], dico2_isf[i + surv1[k] * 7]);
 		}
 
-		tmp_ind[0] = Sub_VQ(&isf_stage2[0], dico23_isf_36b, 7, SIZE_BK23_36b, &min_err);  
-		temp = min_err;                  
+		tmp_ind[0] = Sub_VQ(&isf_stage2[0], dico23_isf_36b, 7, SIZE_BK23_36b, &min_err);
+		temp = min_err;
 
 		if(temp < distance)
 		{
-			distance = temp;               
-			indice[1] = surv1[k];          
-			indice[4] = tmp_ind[0];        
+			distance = temp;
+			indice[1] = surv1[k];
+			indice[4] = tmp_ind[0];
 		}
 	}
 
@@ -239,32 +239,32 @@
 	{
 		for (i = 0; i < 9; i++)
 		{
-			isf_q[i] = dico1_isf[indice[0] * 9 + i];    
+			isf_q[i] = dico1_isf[indice[0] * 9 + i];
 		}
 		for (i = 0; i < 7; i++)
 		{
-			isf_q[i + 9] = dico2_isf[indice[1] * 7 + i];       
+			isf_q[i + 9] = dico2_isf[indice[1] * 7 + i];
 		}
 
 		for (i = 0; i < 3; i++)
 		{
-			isf_q[i] = add1(isf_q[i], dico21_isf[indice[2] * 3 + i]);   
-			isf_q[i + 3] = add1(isf_q[i + 3], dico22_isf[indice[3] * 3 + i]);  
-			isf_q[i + 6] = add1(isf_q[i + 6], dico23_isf[indice[4] * 3 + i]); 
-			isf_q[i + 9] = add1(isf_q[i + 9], dico24_isf[indice[5] * 3 + i]); 
+			isf_q[i] = add1(isf_q[i], dico21_isf[indice[2] * 3 + i]);
+			isf_q[i + 3] = add1(isf_q[i + 3], dico22_isf[indice[3] * 3 + i]);
+			isf_q[i + 6] = add1(isf_q[i + 6], dico23_isf[indice[4] * 3 + i]);
+			isf_q[i + 9] = add1(isf_q[i + 9], dico24_isf[indice[5] * 3 + i]);
 		}
 
 		for (i = 0; i < 4; i++)
 		{
-			isf_q[i + 12] = add1(isf_q[i + 12], dico25_isf[indice[6] * 4 + i]);  
+			isf_q[i + 12] = add1(isf_q[i + 12], dico25_isf[indice[6] * 4 + i]);
 		}
 
 		for (i = 0; i < ORDER; i++)
 		{
-			tmp = isf_q[i];               
-			isf_q[i] = add1(tmp, mean_isf[i]);  
+			tmp = isf_q[i];
+			isf_q[i] = add1(tmp, mean_isf[i]);
 			isf_q[i] = add1(isf_q[i], vo_mult(MU, past_isfq[i]));
-			past_isfq[i] = tmp;  
+			past_isfq[i] = tmp;
 		}
 
 		if (enc_dec)
@@ -273,9 +273,9 @@
 			{
 				for (j = (L_MEANBUF - 1); j > 0; j--)
 				{
-					isf_buf[j * M + i] = isf_buf[(j - 1) * M + i]; 
+					isf_buf[j * M + i] = isf_buf[(j - 1) * M + i];
 				}
-				isf_buf[i] = isf_q[i]; 
+				isf_buf[i] = isf_q[i];
 			}
 		}
 	} else
@@ -293,14 +293,14 @@
 		/* use the past ISFs slightly shifted towards their mean */
 		for (i = 0; i < ORDER; i++)
 		{
-			isf_q[i] = add1(vo_mult(ALPHA, isfold[i]), vo_mult(ONE_ALPHA, ref_isf[i])); 
+			isf_q[i] = add1(vo_mult(ALPHA, isfold[i]), vo_mult(ONE_ALPHA, ref_isf[i]));
 		}
 
 		/* estimate past quantized residual to be used in next frame */
 		for (i = 0; i < ORDER; i++)
 		{
 			tmp = add1(ref_isf[i], vo_mult(past_isfq[i], MU));      /* predicted ISF */
-			past_isfq[i] = vo_sub(isf_q[i], tmp); 
+			past_isfq[i] = vo_sub(isf_q[i], tmp);
 			past_isfq[i] = (past_isfq[i] >> 1);        /* past_isfq[i] *= 0.5 */
 		}
 	}
@@ -332,32 +332,32 @@
 	{
 		for (i = 0; i < 9; i++)
 		{
-			isf_q[i] = dico1_isf[indice[0] * 9 + i];    
+			isf_q[i] = dico1_isf[indice[0] * 9 + i];
 		}
 		for (i = 0; i < 7; i++)
 		{
-			isf_q[i + 9] = dico2_isf[indice[1] * 7 + i];       
+			isf_q[i + 9] = dico2_isf[indice[1] * 7 + i];
 		}
 
 		for (i = 0; i < 5; i++)
 		{
-			isf_q[i] = add1(isf_q[i], dico21_isf_36b[indice[2] * 5 + i]);       
+			isf_q[i] = add1(isf_q[i], dico21_isf_36b[indice[2] * 5 + i]);
 		}
 		for (i = 0; i < 4; i++)
 		{
-			isf_q[i + 5] = add1(isf_q[i + 5], dico22_isf_36b[indice[3] * 4 + i]);        
+			isf_q[i + 5] = add1(isf_q[i + 5], dico22_isf_36b[indice[3] * 4 + i]);
 		}
 		for (i = 0; i < 7; i++)
 		{
-			isf_q[i + 9] = add1(isf_q[i + 9], dico23_isf_36b[indice[4] * 7 + i]);       
+			isf_q[i + 9] = add1(isf_q[i + 9], dico23_isf_36b[indice[4] * 7 + i]);
 		}
 
 		for (i = 0; i < ORDER; i++)
 		{
 			tmp = isf_q[i];
-			isf_q[i] = add1(tmp, mean_isf[i]);   
-			isf_q[i] = add1(isf_q[i], vo_mult(MU, past_isfq[i]));   
-			past_isfq[i] = tmp;           
+			isf_q[i] = add1(tmp, mean_isf[i]);
+			isf_q[i] = add1(isf_q[i], vo_mult(MU, past_isfq[i]));
+			past_isfq[i] = tmp;
 		}
 
 
@@ -367,9 +367,9 @@
 			{
 				for (j = (L_MEANBUF - 1); j > 0; j--)
 				{
-					isf_buf[j * M + i] = isf_buf[(j - 1) * M + i];      
+					isf_buf[j * M + i] = isf_buf[(j - 1) * M + i];
 				}
-				isf_buf[i] = isf_q[i];    
+				isf_buf[i] = isf_q[i];
 			}
 		}
 	} else
@@ -381,20 +381,20 @@
 			{
 				L_tmp += (isf_buf[j * M + i] << 14);
 			}
-			ref_isf[i] = vo_round(L_tmp);    
+			ref_isf[i] = vo_round(L_tmp);
 		}
 
 		/* use the past ISFs slightly shifted towards their mean */
 		for (i = 0; i < ORDER; i++)
 		{
-			isf_q[i] = add1(vo_mult(ALPHA, isfold[i]), vo_mult(ONE_ALPHA, ref_isf[i]));        
+			isf_q[i] = add1(vo_mult(ALPHA, isfold[i]), vo_mult(ONE_ALPHA, ref_isf[i]));
 		}
 
 		/* estimate past quantized residual to be used in next frame */
 		for (i = 0; i < ORDER; i++)
 		{
 			tmp = add1(ref_isf[i], vo_mult(past_isfq[i], MU));      /* predicted ISF */
-			past_isfq[i] = vo_sub(isf_q[i], tmp);  
+			past_isfq[i] = vo_sub(isf_q[i], tmp);
 			past_isfq[i] = past_isfq[i] >> 1;         /* past_isfq[i] *= 0.5 */
 		}
 	}
@@ -424,15 +424,15 @@
 		Word16 n                              /* (i)      : number of ISF                        */
 		)
 {
-	Word32 i; 
+	Word32 i;
 	Word16 isf_min;
 
-	isf_min = min_dist;                    
+	isf_min = min_dist;
 	for (i = 0; i < n - 1; i++)
 	{
 		if(isf[i] < isf_min)
 		{
-			isf[i] = isf_min;              
+			isf[i] = isf_min;
 		}
 		isf_min = (isf[i] + min_dist);
 	}
@@ -452,13 +452,13 @@
 	Word32 i, j, index;
 	Word32 dist_min, dist;
 
-	dist_min = MAX_32;                     
-	p_dico = dico;                         
+	dist_min = MAX_32;
+	p_dico = dico;
 
-	index = 0;                             
+	index = 0;
 	for (i = 0; i < dico_size; i++)
 	{
-		dist = 0;  
+		dist = 0;
 
 		for (j = 0; j < dim; j++)
 		{
@@ -468,18 +468,18 @@
 
 		if(dist < dist_min)
 		{
-			dist_min = dist;               
-			index = i;                     
+			dist_min = dist;
+			index = i;
 		}
 	}
 
-	*distance = dist_min;                  
+	*distance = dist_min;
 
 	/* Reading the selected vector */
-	p_dico = &dico[index * dim];           
+	p_dico = &dico[index * dim];
 	for (j = 0; j < dim; j++)
 	{
-		x[j] = *p_dico++;                  
+		x[j] = *p_dico++;
 	}
 
 	return index;
@@ -508,11 +508,11 @@
 	index[2] = 2;
 	index[3] = 3;
 
-	p_dico = dico;                         
+	p_dico = dico;
 
 	for (i = 0; i < dico_size; i++)
 	{
-		dist = 0;                          
+		dist = 0;
 		for (j = 0; j < dim; j++)
 		{
 			temp = x[j] -  (*p_dico++);
@@ -525,11 +525,11 @@
 			{
 				for (l = surv - 1; l > k; l--)
 				{
-					dist_min[l] = dist_min[l - 1];      
-					index[l] = index[l - 1];    
+					dist_min[l] = dist_min[l - 1];
+					index[l] = index[l - 1];
 				}
-				dist_min[k] = dist;        
-				index[k] = i;              
+				dist_min[k] = dist;
+				index[k] = i;
 				break;
 			}
 		}
diff --git a/media/libstagefright/codecs/amrwbenc/src/residu.c b/media/libstagefright/codecs/amrwbenc/src/residu.c
index 328aed2..b0c04b5 100644
--- a/media/libstagefright/codecs/amrwbenc/src/residu.c
+++ b/media/libstagefright/codecs/amrwbenc/src/residu.c
@@ -56,7 +56,7 @@
 		s += vo_mult32((*p1++), (*p2--));
 		s += vo_mult32((*p1), (*p2));
 
-		s = L_shl2(s, 5); 
+		s = L_shl2(s, 5);
 		y[i] = extract_h(L_add(s, 0x8000));
 	}
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/scale.c b/media/libstagefright/codecs/amrwbenc/src/scale.c
index b203bec..418cc06 100644
--- a/media/libstagefright/codecs/amrwbenc/src/scale.c
+++ b/media/libstagefright/codecs/amrwbenc/src/scale.c
@@ -36,8 +36,8 @@
 	{
 		for (i = lg - 1 ; i >= 0; i--)
 		{
-			L_tmp = L_shl2(x[i], 16 + exp);  
-			x[i] = extract_h(L_add(L_tmp, 0x8000));            
+			L_tmp = L_shl2(x[i], 16 + exp);
+			x[i] = extract_h(L_add(L_tmp, 0x8000));
 		}
 	}
 	else
@@ -46,8 +46,8 @@
 		for (i = lg - 1; i >= 0; i--)
 		{
 			L_tmp = x[i] << 16;
-			L_tmp >>= exp; 
-			x[i] = (L_tmp + 0x8000)>>16;            
+			L_tmp >>= exp;
+			x[i] = (L_tmp + 0x8000)>>16;
 		}
 	}
 	return;
diff --git a/media/libstagefright/codecs/amrwbenc/src/stream.c b/media/libstagefright/codecs/amrwbenc/src/stream.c
index bdf0d46..780f009 100644
--- a/media/libstagefright/codecs/amrwbenc/src/stream.c
+++ b/media/libstagefright/codecs/amrwbenc/src/stream.c
@@ -29,11 +29,11 @@
 	stream->frame_ptr_bk = stream->frame_ptr;
 	stream->set_len = 0;
 	stream->framebuffer_len = 0;
-	stream->frame_storelen = 0;	
+	stream->frame_storelen = 0;
 }
 
 void voAWB_UpdateFrameBuffer(
-		FrameStream *stream, 
+		FrameStream *stream,
 		VO_MEM_OPERATOR *pMemOP
 		)
 {
@@ -53,6 +53,6 @@
 	stream->frame_ptr_bk = stream->frame_ptr;
 	stream->set_len = 0;
 	stream->framebuffer_len = 0;
-	stream->frame_storelen = 0;	
+	stream->frame_storelen = 0;
 }
 
diff --git a/media/libstagefright/codecs/amrwbenc/src/syn_filt.c b/media/libstagefright/codecs/amrwbenc/src/syn_filt.c
index 90fafb0..1bda05a 100644
--- a/media/libstagefright/codecs/amrwbenc/src/syn_filt.c
+++ b/media/libstagefright/codecs/amrwbenc/src/syn_filt.c
@@ -39,11 +39,11 @@
 	Word16 y_buf[L_SUBFR16k + M16k];
 	Word32 L_tmp;
 	Word16 *yy, *p1, *p2;
-	yy = &y_buf[0];                        
+	yy = &y_buf[0];
 	/* copy initial filter states into synthesis buffer */
 	for (i = 0; i < 16; i++)
 	{
-		*yy++ = mem[i];                    
+		*yy++ = mem[i];
 	}
 	a0 = (a[0] >> 1);                     /* input / 2 */
 	/* Do the filtering. */
@@ -70,7 +70,7 @@
 		L_tmp -= vo_mult32((*p1), (*p2));
 
 		L_tmp = L_shl2(L_tmp, 4);
-		y[i] = yy[i] = extract_h(L_add(L_tmp, 0x8000));  
+		y[i] = yy[i] = extract_h(L_add(L_tmp, 0x8000));
 	}
 	/* Update memory if required */
 	if (update)
@@ -99,7 +99,7 @@
 	/* Do the filtering. */
 	for (i = 0; i < lg; i++)
 	{
-		L_tmp  = 0; 
+		L_tmp  = 0;
 		L_tmp1 = 0;
 		p1 = a;
 		p2 = &sig_lo[i - 1];
@@ -138,18 +138,18 @@
 		L_tmp  -= vo_mult32((*p2--), (*p1));
 		L_tmp1 -= vo_mult32((*p3--), (*p1++));
 
-		L_tmp = L_tmp >> 11;      
+		L_tmp = L_tmp >> 11;
 		L_tmp += vo_L_mult(exc[i], a0);
 
 		/* sig_hi = bit16 to bit31 of synthesis */
 		L_tmp = L_tmp - (L_tmp1<<1);
 
 		L_tmp = L_tmp >> 3;           /* ai in Q12 */
-		sig_hi[i] = extract_h(L_tmp);      
+		sig_hi[i] = extract_h(L_tmp);
 
 		/* sig_lo = bit4 to bit15 of synthesis */
 		L_tmp >>= 4;           /* 4 : sig_lo[i] >> 4 */
-		sig_lo[i] = (Word16)((L_tmp - (sig_hi[i] << 13)));  
+		sig_lo[i] = (Word16)((L_tmp - (sig_hi[i] << 13)));
 	}
 
 	return;
diff --git a/media/libstagefright/codecs/amrwbenc/src/updt_tar.c b/media/libstagefright/codecs/amrwbenc/src/updt_tar.c
index eda2b1c..96779fd 100644
--- a/media/libstagefright/codecs/amrwbenc/src/updt_tar.c
+++ b/media/libstagefright/codecs/amrwbenc/src/updt_tar.c
@@ -39,7 +39,7 @@
 	{
 		L_tmp = x[i] << 15;
 		L_tmp -= (y[i] * gain)<<1;
-		x2[i] = extract_h(L_shl2(L_tmp, 1)); 
+		x2[i] = extract_h(L_shl2(L_tmp, 1));
 	}
 
 	return;
diff --git a/media/libstagefright/codecs/amrwbenc/src/voAMRWBEnc.c b/media/libstagefright/codecs/amrwbenc/src/voAMRWBEnc.c
index bac00dd..ea9da52 100644
--- a/media/libstagefright/codecs/amrwbenc/src/voAMRWBEnc.c
+++ b/media/libstagefright/codecs/amrwbenc/src/voAMRWBEnc.c
@@ -84,11 +84,11 @@
 	Set_zero(cod_state->old_exc, PIT_MAX + L_INTERPOL);
 	Set_zero(cod_state->mem_syn, M);
 	Set_zero(cod_state->past_isfq, M);
-	cod_state->mem_w0 = 0;                 
-	cod_state->tilt_code = 0;              
-	cod_state->first_frame = 1;            
+	cod_state->mem_w0 = 0;
+	cod_state->tilt_code = 0;
+	cod_state->first_frame = 1;
 	Init_gp_clip(cod_state->gp_clip);
-	cod_state->L_gc_thres = 0;             
+	cod_state->L_gc_thres = 0;
 	if (reset_all != 0)
 	{
 		/* Static vectors to zero */
@@ -105,21 +105,21 @@
 		Copy(isp_init, cod_state->ispold, M);
 		Copy(isp_init, cod_state->ispold_q, M);
 		/* variable initialization */
-		cod_state->mem_preemph = 0;        
-		cod_state->mem_wsp = 0;            
-		cod_state->Q_old = 15;             
-		cod_state->Q_max[0] = 15;          
-		cod_state->Q_max[1] = 15;          
-		cod_state->old_wsp_max = 0;        
-		cod_state->old_wsp_shift = 0;      
+		cod_state->mem_preemph = 0;
+		cod_state->mem_wsp = 0;
+		cod_state->Q_old = 15;
+		cod_state->Q_max[0] = 15;
+		cod_state->Q_max[1] = 15;
+		cod_state->old_wsp_max = 0;
+		cod_state->old_wsp_shift = 0;
 		/* pitch ol initialization */
-		cod_state->old_T0_med = 40;        
-		cod_state->ol_gain = 0;            
-		cod_state->ada_w = 0;              
-		cod_state->ol_wght_flg = 0;        
+		cod_state->old_T0_med = 40;
+		cod_state->ol_gain = 0;
+		cod_state->ada_w = 0;
+		cod_state->ol_wght_flg = 0;
 		for (i = 0; i < 5; i++)
 		{
-			cod_state->old_ol_lag[i] = 40; 
+			cod_state->old_ol_lag[i] = 40;
 		}
 		Set_zero(cod_state->old_hp_wsp, (L_FRAME / 2) / OPL_DECIM + (PIT_MAX / OPL_DECIM));
 		Set_zero(cod_state->mem_syn_hf, M);
@@ -129,10 +129,10 @@
 		Init_Filt_6k_7k(cod_state->mem_hf);
 		Init_HP400_12k8(cod_state->mem_hp400);
 		Copy(isf_init, cod_state->isfold, M);
-		cod_state->mem_deemph = 0;         
-		cod_state->seed2 = 21845;          
+		cod_state->mem_deemph = 0;
+		cod_state->seed2 = 21845;
 		Init_Filt_6k_7k(cod_state->mem_hf2);
-		cod_state->gain_alpha = 32767;     
+		cod_state->gain_alpha = 32767;
 		cod_state->vad_hist = 0;
 		wb_vad_reset(cod_state->vadSt);
 		dtx_enc_reset(cod_state->dtx_encSt, isf_init);
@@ -212,8 +212,8 @@
 
 	st = (Coder_State *) spe_state;
 
-	*ser_size = nb_of_bits[*mode];         
-	codec_mode = *mode;                    
+	*ser_size = nb_of_bits[*mode];
+	codec_mode = *mode;
 
 	/*--------------------------------------------------------------------------*
 	 *          Initialize pointers to speech vector.                           *
@@ -233,10 +233,10 @@
 
 	new_speech = old_speech + L_TOTAL - L_FRAME - L_FILT;         /* New speech     */
 	speech = old_speech + L_TOTAL - L_FRAME - L_NEXT;             /* Present frame  */
-	p_window = old_speech + L_TOTAL - L_WINDOW; 
+	p_window = old_speech + L_TOTAL - L_WINDOW;
 
-	exc = old_exc + PIT_MAX + L_INTERPOL;  
-	wsp = old_wsp + (PIT_MAX / OPL_DECIM); 
+	exc = old_exc + PIT_MAX + L_INTERPOL;
+	wsp = old_wsp + (PIT_MAX / OPL_DECIM);
 
 	/* copy coder memory state into working space */
 	Copy(st->old_speech, old_speech, L_TOTAL - L_FRAME);
@@ -287,7 +287,7 @@
 		L_tmp = L_abs(L_tmp);
 		if(L_tmp > L_max)
 		{
-			L_max = L_tmp;                 
+			L_max = L_tmp;
 		}
 	}
 
@@ -297,50 +297,50 @@
 	tmp = extract_h(L_max);
 	if (tmp == 0)
 	{
-		shift = Q_MAX;                     
+		shift = Q_MAX;
 	} else
 	{
 		shift = norm_s(tmp) - 1;
 		if (shift < 0)
 		{
-			shift = 0;                     
+			shift = 0;
 		}
 		if (shift > Q_MAX)
 		{
-			shift = Q_MAX;                 
+			shift = Q_MAX;
 		}
 	}
-	Q_new = shift;                         
+	Q_new = shift;
 	if (Q_new > st->Q_max[0])
 	{
-		Q_new = st->Q_max[0];              
+		Q_new = st->Q_max[0];
 	}
 	if (Q_new > st->Q_max[1])
 	{
-		Q_new = st->Q_max[1];              
+		Q_new = st->Q_max[1];
 	}
 	exp = (Q_new - st->Q_old);
-	st->Q_old = Q_new;                     
-	st->Q_max[1] = st->Q_max[0];           
-	st->Q_max[0] = shift;                  
+	st->Q_old = Q_new;
+	st->Q_max[1] = st->Q_max[0];
+	st->Q_max[0] = shift;
 
 	/* preemphasis with scaling (L_FRAME+L_FILT) */
-	tmp = new_speech[L_FRAME - 1];         
+	tmp = new_speech[L_FRAME - 1];
 
 	for (i = L_FRAME + L_FILT - 1; i > 0; i--)
 	{
 		L_tmp = new_speech[i] << 15;
 		L_tmp -= (new_speech[i - 1] * mu)<<1;
 		L_tmp = (L_tmp << Q_new);
-		new_speech[i] = vo_round(L_tmp);      
+		new_speech[i] = vo_round(L_tmp);
 	}
 
 	L_tmp = new_speech[0] << 15;
 	L_tmp -= (st->mem_preemph * mu)<<1;
 	L_tmp = (L_tmp << Q_new);
-	new_speech[0] = vo_round(L_tmp);          
+	new_speech[0] = vo_round(L_tmp);
 
-	st->mem_preemph = tmp;                 
+	st->mem_preemph = tmp;
 
 	/* scale previous samples and memory */
 
@@ -364,13 +364,13 @@
 	Scale_sig(buf, L_FRAME, 1 - Q_new);
 #endif
 
-	vad_flag = wb_vad(st->vadSt, buf);          /* Voice Activity Detection */ 
+	vad_flag = wb_vad(st->vadSt, buf);          /* Voice Activity Detection */
 	if (vad_flag == 0)
 	{
-		st->vad_hist = (st->vad_hist + 1);        
+		st->vad_hist = (st->vad_hist + 1);
 	} else
 	{
-		st->vad_hist = 0;             
+		st->vad_hist = 0;
 	}
 
 	/* DTX processing */
@@ -378,7 +378,7 @@
 	{
 		/* Note that mode may change here */
 		tx_dtx_handler(st->dtx_encSt, vad_flag, mode);
-		*ser_size = nb_of_bits[*mode]; 
+		*ser_size = nb_of_bits[*mode];
 	}
 
 	if(*mode != MRDTX)
@@ -423,7 +423,7 @@
 	 * - scale wsp[] to avoid overflow in pitch estimation                  *
 	 * - Find open loop pitch lag for whole speech frame                    *
 	 *----------------------------------------------------------------------*/
-	p_A = A;                             
+	p_A = A;
 	for (i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR)
 	{
 		/* Weighting of LPC coefficients */
@@ -435,27 +435,27 @@
 		Residu(Ap, &speech[i_subfr], &wsp[i_subfr], L_SUBFR);
 #endif
 
-		p_A += (M + 1);                    
+		p_A += (M + 1);
 	}
 
 	Deemph2(wsp, TILT_FAC, L_FRAME, &(st->mem_wsp));
 
 	/* find maximum value on wsp[] for 12 bits scaling */
-	max = 0;                              
+	max = 0;
 	for (i = 0; i < L_FRAME; i++)
 	{
 		tmp = abs_s(wsp[i]);
 		if(tmp > max)
 		{
-			max = tmp;                     
+			max = tmp;
 		}
 	}
-	tmp = st->old_wsp_max;                 
+	tmp = st->old_wsp_max;
 	if(max > tmp)
 	{
 		tmp = max;                         /* tmp = max(wsp_max, old_wsp_max) */
 	}
-	st->old_wsp_max = max;                
+	st->old_wsp_max = max;
 
 	shift = norm_s(tmp) - 3;
 	if (shift > 0)
@@ -494,8 +494,8 @@
 
 	if(st->ol_gain > 19661)       /* 0.6 in Q15 */
 	{
-		st->old_T0_med = Med_olag(T_op, st->old_ol_lag);       
-		st->ada_w = 32767;                 
+		st->old_T0_med = Med_olag(T_op, st->old_ol_lag);
+		st->ada_w = 32767;
 	} else
 	{
 		st->ada_w = vo_mult(st->ada_w, 29491);
@@ -507,7 +507,7 @@
 		st->ol_wght_flg = 1;
 
 	wb_vad_tone_detection(st->vadSt, st->ol_gain);
-	T_op *= OPL_DECIM;                     
+	T_op *= OPL_DECIM;
 
 	if(*ser_size != NBBITS_7k)
 	{
@@ -516,11 +516,11 @@
 
 		if(st->ol_gain > 19661)   /* 0.6 in Q15 */
 		{
-			st->old_T0_med = Med_olag(T_op2, st->old_ol_lag);  
-			st->ada_w = 32767;             
+			st->old_T0_med = Med_olag(T_op2, st->old_ol_lag);
+			st->ada_w = 32767;
 		} else
 		{
-			st->ada_w = mult(st->ada_w, 29491); 
+			st->ada_w = mult(st->ada_w, 29491);
 		}
 
 		if(st->ada_w < 26214)
@@ -530,11 +530,11 @@
 
 		wb_vad_tone_detection(st->vadSt, st->ol_gain);
 
-		T_op2 *= OPL_DECIM;                
+		T_op2 *= OPL_DECIM;
 
 	} else
 	{
-		T_op2 = T_op;                      
+		T_op2 = T_op;
 	}
 	/*----------------------------------------------------------------------*
 	 *                              DTX-CNG                                 *
@@ -550,10 +550,10 @@
 
 		for (i = 0; i < L_FRAME; i++)
 		{
-			exc2[i] = shr(exc[i], Q_new);  
+			exc2[i] = shr(exc[i], Q_new);
 		}
 
-		L_tmp = 0;                         
+		L_tmp = 0;
 		for (i = 0; i < L_FRAME; i++)
 			L_tmp += (exc2[i] * exc2[i])<<1;
 
@@ -617,23 +617,23 @@
 
 	/* Check stability on isf : distance between old isf and current isf */
 
-	L_tmp = 0;                           
+	L_tmp = 0;
 	for (i = 0; i < M - 1; i++)
 	{
 		tmp = vo_sub(isf[i], st->isfold[i]);
 		L_tmp += (tmp * tmp)<<1;
 	}
 
-	tmp = extract_h(L_shl2(L_tmp, 8)); 
+	tmp = extract_h(L_shl2(L_tmp, 8));
 
 	tmp = vo_mult(tmp, 26214);                /* tmp = L_tmp*0.8/256 */
 	tmp = vo_sub(20480, tmp);                 /* 1.25 - tmp (in Q14) */
 
-	stab_fac = shl(tmp, 1); 
+	stab_fac = shl(tmp, 1);
 
 	if (stab_fac < 0)
 	{
-		stab_fac = 0;                      
+		stab_fac = 0;
 	}
 	Copy(isf, st->isfold, M);
 
@@ -642,7 +642,7 @@
 
 	if (st->first_frame != 0)
 	{
-		st->first_frame = 0;              
+		st->first_frame = 0;
 		Copy(ispnew_q, st->ispold_q, M);
 	}
 	/* Find the interpolated ISPs and convert to a[] for all subframes */
@@ -660,7 +660,7 @@
 #else
 		Residu(p_Aq, &speech[i_subfr], &exc[i_subfr], L_SUBFR);
 #endif
-		p_Aq += (M + 1);                   
+		p_Aq += (M + 1);
 	}
 
 	/* Buffer isf's and energy for dtx on non-speech frame */
@@ -670,7 +670,7 @@
 		{
 			exc2[i] = exc[i] >> Q_new;
 		}
-		L_tmp = 0;                         
+		L_tmp = 0;
 		for (i = 0; i < L_FRAME; i++)
 			L_tmp += (exc2[i] * exc2[i])<<1;
 		L_tmp >>= 1;
@@ -682,14 +682,14 @@
 	T0_min = T_op - 8;
 	if (T0_min < PIT_MIN)
 	{
-		T0_min = PIT_MIN;                  
+		T0_min = PIT_MIN;
 	}
 	T0_max = (T0_min + 15);
 
 	if(T0_max > PIT_MAX)
 	{
-		T0_max = PIT_MAX;                  
-		T0_min = T0_max - 15;          
+		T0_max = PIT_MAX;
+		T0_min = T0_max - 15;
 	}
 	/*------------------------------------------------------------------------*
 	 *          Loop for every subframe in the analysis frame                 *
@@ -711,25 +711,25 @@
 	 *     - update states of weighting filter                                *
 	 *     - find excitation and synthesis speech                             *
 	 *------------------------------------------------------------------------*/
-	p_A = A;                               
-	p_Aq = Aq;                             
+	p_A = A;
+	p_Aq = Aq;
 	for (i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR)
 	{
-		pit_flag = i_subfr;                
+		pit_flag = i_subfr;
 		if ((i_subfr == 2 * L_SUBFR) && (*ser_size > NBBITS_7k))
 		{
-			pit_flag = 0;                 
+			pit_flag = 0;
 			/* range for closed loop pitch search in 3rd subframe */
 			T0_min = (T_op2 - 8);
 
 			if (T0_min < PIT_MIN)
 			{
-				T0_min = PIT_MIN;          
+				T0_min = PIT_MIN;
 			}
 			T0_max = (T0_min + 15);
 			if (T0_max > PIT_MAX)
 			{
-				T0_max = PIT_MAX;         
+				T0_max = PIT_MAX;
 				T0_min = (T0_max - 15);
 			}
 		}
@@ -776,7 +776,7 @@
 		/* first half: xn[] --> cn[] */
 		Set_zero(code, M);
 		Copy(xn, code + M, L_SUBFR / 2);
-		tmp = 0;                          
+		tmp = 0;
 		Preemph2(code + M, TILT_FAC, L_SUBFR / 2, &tmp);
 		Weight_a(p_A, Ap, GAMMA1, M);
 		Syn_filt(Ap,code + M, code + M, L_SUBFR / 2, code, 0);
@@ -791,7 +791,7 @@
 		Copy(&exc[i_subfr + (L_SUBFR / 2)], cn + (L_SUBFR / 2), L_SUBFR / 2);
 
 		/*---------------------------------------------------------------*
-		 * Compute impulse response, h1[], of weighted synthesis filter  * 
+		 * Compute impulse response, h1[], of weighted synthesis filter  *
 		 *---------------------------------------------------------------*/
 
 		Set_zero(error, M + L_SUBFR);
@@ -814,7 +814,7 @@
 			*vo_p3++ = *vo_p0++ = vo_round((L_tmp <<4));
 		}
 		/* deemph without division by 2 -> Q14 to Q15 */
-		tmp = 0; 
+		tmp = 0;
 		Deemph2(h1, TILT_FAC, L_SUBFR, &tmp);   /* h1 in Q14 */
 
 		/* h2 in Q12 for codebook search */
@@ -917,7 +917,7 @@
 				T0_min = (T0 - 8);
 				if (T0_min < PIT_MIN)
 				{
-					T0_min = PIT_MIN; 
+					T0_min = PIT_MIN;
 				}
 				T0_max = T0_min + 15;
 
@@ -964,18 +964,18 @@
 			Convolve_asm(&exc[i_subfr], h1, y1, L_SUBFR);
 #else
 			Convolve(&exc[i_subfr], h1, y1, L_SUBFR);
-#endif 
+#endif
 			gain1 = G_pitch(xn, y1, g_coeff, L_SUBFR);
 			/* clip gain if necessary to avoid problem at decoder */
 			if ((clip_gain != 0) && (gain1 > GP_CLIP))
 			{
-				gain1 = GP_CLIP; 
+				gain1 = GP_CLIP;
 			}
 			/* find energy of new target xn2[] */
 			Updt_tar(xn, dn, y1, gain1, L_SUBFR);       /* dn used temporary */
 		} else
 		{
-			gain1 = 0; 
+			gain1 = 0;
 		}
 		/*-----------------------------------------------------------------*
 		 * - find pitch excitation filtered by 1st order LP filter.        *
@@ -1002,7 +1002,7 @@
 		Convolve_asm(code, h1, y2, L_SUBFR);
 #else
 		Convolve(code, h1, y2, L_SUBFR);
-#endif 
+#endif
 
 		gain2 = G_pitch(xn, y2, g_coeff2, L_SUBFR);
 
@@ -1016,7 +1016,7 @@
 		/*-----------------------------------------------------------------*
 		 * use the best prediction (minimise quadratic error).             *
 		 *-----------------------------------------------------------------*/
-		select = 0; 
+		select = 0;
 		if(*ser_size > NBBITS_9k)
 		{
 			L_tmp = 0L;
@@ -1036,7 +1036,7 @@
 
 			if (L_tmp <= 0)
 			{
-				select = 1; 
+				select = 1;
 			}
 			Parm_serial(select, 1, &prms);
 		}
@@ -1154,7 +1154,7 @@
 		/*-------------------------------------------------------*
 		 * - Add the fixed-gain pitch contribution to code[].    *
 		 *-------------------------------------------------------*/
-		tmp = 0; 
+		tmp = 0;
 		Preemph(code, st->tilt_code, L_SUBFR, &tmp);
 		Pit_shrp(code, T0, PIT_SHARP, L_SUBFR);
 		/*----------------------------------------------------------*
@@ -1175,7 +1175,7 @@
 		/* test quantized gain of pitch for pitch clipping algorithm */
 		Gp_clip_test_gain_pit(gain_pit, st->gp_clip);
 
-		L_tmp = L_shl(L_gain_code, Q_new); 
+		L_tmp = L_shl(L_gain_code, Q_new);
 		gain_code = extract_h(L_add(L_tmp, 0x8000));
 
 		/*----------------------------------------------------------*
@@ -1218,7 +1218,7 @@
 			L_tmp = (gain_code * code[i])<<1;
 			L_tmp = (L_tmp << 5);
 			L_tmp += (exc[i + i_subfr] * gain_pit)<<1;
-			L_tmp = L_shl2(L_tmp, 1); 
+			L_tmp = L_shl2(L_tmp, 1);
 			exc[i + i_subfr] = extract_h(L_add(L_tmp, 0x8000));
 		}
 
@@ -1242,7 +1242,7 @@
 			 *------------------------------------------------------------*/
 			tmp = (16384 - (voice_fac >> 1));        /* 1=unvoiced, 0=voiced */
 			fac = vo_mult(stab_fac, tmp);
-			L_tmp = L_gain_code; 
+			L_tmp = L_gain_code;
 			if(L_tmp < st->L_gc_thres)
 			{
 				L_tmp = vo_L_add(L_tmp, Mpy_32_16(gain_code, gain_code_lo, 6226));
@@ -1276,19 +1276,19 @@
 
 			L_tmp = L_deposit_h(code[0]);
 			L_tmp -= (code[1] * tmp)<<1;
-			code2[0] = vo_round(L_tmp); 
+			code2[0] = vo_round(L_tmp);
 
 			for (i = 1; i < L_SUBFR - 1; i++)
 			{
 				L_tmp = L_deposit_h(code[i]);
 				L_tmp -= (code[i + 1] * tmp)<<1;
 				L_tmp -= (code[i - 1] * tmp)<<1;
-				code2[i] = vo_round(L_tmp); 
+				code2[i] = vo_round(L_tmp);
 			}
 
 			L_tmp = L_deposit_h(code[L_SUBFR - 1]);
 			L_tmp -= (code[L_SUBFR - 2] * tmp)<<1;
-			code2[L_SUBFR - 1] = vo_round(L_tmp); 
+			code2[L_SUBFR - 1] = vo_round(L_tmp);
 
 			/* build excitation */
 			gain_code = vo_round(L_shl(L_gain_code, Q_new));
@@ -1381,7 +1381,7 @@
 	/* Original speech signal as reference for high band gain quantisation */
 	for (i = 0; i < L_SUBFR16k; i++)
 	{
-		HF_SP[i] = synth16k[i]; 
+		HF_SP[i] = synth16k[i];
 	}
 
 	/*------------------------------------------------------*
@@ -1454,7 +1454,7 @@
 		fac = div_s(tmp, ener);
 	} else
 	{
-		fac = 0; 
+		fac = 0;
 	}
 
 	/* modify energy of white noise according to synthesis tilt */
@@ -1550,7 +1550,7 @@
 
 /*************************************************
 *
-* Breif: Codec main function 
+* Breif: Codec main function
 *
 **************************************************/
 
@@ -1622,7 +1622,7 @@
 	else
 	{
 		pMemOP = (VO_MEM_OPERATOR *)pUserData->memData;
-	} 
+	}
 	/*-------------------------------------------------------------------------*
 	 * Memory allocation for coder state.                                      *
 	 *-------------------------------------------------------------------------*/
@@ -1631,8 +1631,8 @@
 		return VO_ERR_OUTOF_MEMORY;
 	}
 
-	st->vadSt = NULL;                      
-	st->dtx_encSt = NULL;                  
+	st->vadSt = NULL;
+	st->dtx_encSt = NULL;
 	st->sid_update_counter = 3;
 	st->sid_handover_debt = 0;
 	st->prev_ft = TX_SPEECH;
@@ -1702,7 +1702,7 @@
 	gData = (Coder_State *)hCodec;
 	stream = gData->stream;
 
-	if(NULL == pInput || NULL == pInput->Buffer || 0 > pInput->Length)
+	if(NULL == pInput || NULL == pInput->Buffer)
 	{
 		return VO_ERR_INVALID_ARG;
 	}
@@ -1764,7 +1764,7 @@
 	{
 		pAudioFormat->Format.Channels = 1;
 		pAudioFormat->Format.SampleRate = 8000;
-		pAudioFormat->Format.SampleBits = 16;	
+		pAudioFormat->Format.SampleBits = 16;
 		pAudioFormat->InputUsed = stream->used_len;
 	}
 	return VO_ERR_NONE;
@@ -1792,14 +1792,14 @@
 		/* setting AMR-WB frame type*/
 		case VO_PID_AMRWB_FRAMETYPE:
 			if(*lValue < VOAMRWB_DEFAULT || *lValue > VOAMRWB_RFC3267)
-				return VO_ERR_WRONG_PARAM_ID; 
+				return VO_ERR_WRONG_PARAM_ID;
 			gData->frameType = *lValue;
 			break;
 		/* setting AMR-WB bit rate */
 		case VO_PID_AMRWB_MODE:
 			{
 				if(*lValue < VOAMRWB_MD66 || *lValue > VOAMRWB_MD2385)
-					return VO_ERR_WRONG_PARAM_ID; 
+					return VO_ERR_WRONG_PARAM_ID;
 				gData->mode = *lValue;
 			}
 			break;
@@ -1839,7 +1839,7 @@
 	int    temp;
 	Coder_State* gData = (Coder_State*)hCodec;
 
-	if (gData==NULL) 
+	if (gData==NULL)
 		return VO_ERR_INVALID_ARG;
 	switch(uParamID)
 	{
diff --git a/media/libstagefright/codecs/amrwbenc/src/voicefac.c b/media/libstagefright/codecs/amrwbenc/src/voicefac.c
index 17e4e55..d890044 100644
--- a/media/libstagefright/codecs/amrwbenc/src/voicefac.c
+++ b/media/libstagefright/codecs/amrwbenc/src/voicefac.c
@@ -18,7 +18,7 @@
 *   File: voicefac.c                                                   *
 *                                                                      *
 *   Description: Find the voicing factors (1 = voice to -1 = unvoiced) *
-*                                                                      *                                                 
+*                                                                      *
 ************************************************************************/
 
 #include "typedef.h"
diff --git a/media/libstagefright/codecs/amrwbenc/src/wb_vad.c b/media/libstagefright/codecs/amrwbenc/src/wb_vad.c
index 7e1d673..13dd2aa 100644
--- a/media/libstagefright/codecs/amrwbenc/src/wb_vad.c
+++ b/media/libstagefright/codecs/amrwbenc/src/wb_vad.c
@@ -52,7 +52,7 @@
 
 	if (mant <= 0)
 	{
-		mant = 1;                         
+		mant = 1;
 	}
 	ex = norm_s(mant);
 	mant = mant << ex;
@@ -88,14 +88,14 @@
 
 	temp0 = vo_sub(*in0, vo_mult(COEFF5_1, data[0]));
 	temp1 = add1(data[0], vo_mult(COEFF5_1, temp0));
-	data[0] = temp0;                      
+	data[0] = temp0;
 
 	temp0 = vo_sub(*in1, vo_mult(COEFF5_2, data[1]));
 	temp2 = add1(data[1], vo_mult(COEFF5_2, temp0));
-	data[1] = temp0;                       
+	data[1] = temp0;
 
-	*in0 = extract_h((vo_L_add(temp1, temp2) << 15));   
-	*in1 = extract_h((vo_L_sub(temp1, temp2) << 15));  
+	*in0 = extract_h((vo_L_add(temp1, temp2) << 15));
+	*in1 = extract_h((vo_L_sub(temp1, temp2) << 15));
 }
 
 /******************************************************************************
@@ -116,10 +116,10 @@
 
 	temp1 = vo_sub(*in1, vo_mult(COEFF3, *data));
 	temp2 = add1(*data, vo_mult(COEFF3, temp1));
-	*data = temp1;                        
+	*data = temp1;
 
-	*in1 = extract_h((vo_L_sub(*in0, temp2) << 15));   
-	*in0 = extract_h((vo_L_add(*in0, temp2) << 15));   
+	*in1 = extract_h((vo_L_sub(*in0, temp2) << 15));
+	*in0 = extract_h((vo_L_add(*in0, temp2) << 15));
 }
 
 /******************************************************************************
@@ -149,14 +149,14 @@
 	Word32 i, l_temp1, l_temp2;
 	Word16 level;
 
-	l_temp1 = 0L;                          
+	l_temp1 = 0L;
 	for (i = count1; i < count2; i++)
 	{
 		l_temp1 += (abs_s(data[ind_m * i + ind_a])<<1);
 	}
 
 	l_temp2 = vo_L_add(l_temp1, L_shl(*sub_level, 16 - scale));
-	*sub_level = extract_h(L_shl(l_temp1, scale));      
+	*sub_level = extract_h(L_shl(l_temp1, scale));
 
 	for (i = 0; i < count1; i++)
 	{
@@ -187,7 +187,7 @@
 	/* shift input 1 bit down for safe scaling */
 	for (i = 0; i < FRAME_LEN; i++)
 	{
-		tmp_buf[i] = in[i] >> 1;       
+		tmp_buf[i] = in[i] >> 1;
 	}
 
 	/* run the filter bank */
@@ -222,29 +222,29 @@
 	/* calculate levels in each frequency band */
 
 	/* 4800 - 6400 Hz */
-	level[11] = level_calculation(tmp_buf, &st->sub_level[11], 16, 64, 4, 1, 14);   
+	level[11] = level_calculation(tmp_buf, &st->sub_level[11], 16, 64, 4, 1, 14);
 	/* 4000 - 4800 Hz */
-	level[10] = level_calculation(tmp_buf, &st->sub_level[10], 8, 32, 8, 7, 15);   
+	level[10] = level_calculation(tmp_buf, &st->sub_level[10], 8, 32, 8, 7, 15);
 	/* 3200 - 4000 Hz */
-	level[9] = level_calculation(tmp_buf, &st->sub_level[9],8, 32, 8, 3, 15);   
+	level[9] = level_calculation(tmp_buf, &st->sub_level[9],8, 32, 8, 3, 15);
 	/* 2400 - 3200 Hz */
-	level[8] = level_calculation(tmp_buf, &st->sub_level[8],8, 32, 8, 2, 15);   
+	level[8] = level_calculation(tmp_buf, &st->sub_level[8],8, 32, 8, 2, 15);
 	/* 2000 - 2400 Hz */
-	level[7] = level_calculation(tmp_buf, &st->sub_level[7],4, 16, 16, 14, 16);       
+	level[7] = level_calculation(tmp_buf, &st->sub_level[7],4, 16, 16, 14, 16);
 	/* 1600 - 2000 Hz */
-	level[6] = level_calculation(tmp_buf, &st->sub_level[6],4, 16, 16, 6, 16);        
+	level[6] = level_calculation(tmp_buf, &st->sub_level[6],4, 16, 16, 6, 16);
 	/* 1200 - 1600 Hz */
-	level[5] = level_calculation(tmp_buf, &st->sub_level[5],4, 16, 16, 4, 16);        
+	level[5] = level_calculation(tmp_buf, &st->sub_level[5],4, 16, 16, 4, 16);
 	/* 800 - 1200 Hz */
-	level[4] = level_calculation(tmp_buf, &st->sub_level[4],4, 16, 16, 12, 16);       
+	level[4] = level_calculation(tmp_buf, &st->sub_level[4],4, 16, 16, 12, 16);
 	/* 600 - 800 Hz */
-	level[3] = level_calculation(tmp_buf, &st->sub_level[3],2, 8, 32, 8, 17); 
+	level[3] = level_calculation(tmp_buf, &st->sub_level[3],2, 8, 32, 8, 17);
 	/* 400 - 600 Hz */
-	level[2] = level_calculation(tmp_buf, &st->sub_level[2],2, 8, 32, 24, 17);        
+	level[2] = level_calculation(tmp_buf, &st->sub_level[2],2, 8, 32, 24, 17);
 	/* 200 - 400 Hz */
-	level[1] = level_calculation(tmp_buf, &st->sub_level[1],2, 8, 32, 16, 17);        
+	level[1] = level_calculation(tmp_buf, &st->sub_level[1],2, 8, 32, 16, 17);
 	/* 0 - 200 Hz */
-	level[0] = level_calculation(tmp_buf, &st->sub_level[0],2, 8, 32, 0, 17); 
+	level[0] = level_calculation(tmp_buf, &st->sub_level[0],2, 8, 32, 0, 17);
 }
 
 /******************************************************************************
@@ -266,31 +266,31 @@
 	/* if a tone has been detected for a while, initialize stat_count */
 	if (sub((Word16) (st->tone_flag & 0x7c00), 0x7c00) == 0)
 	{
-		st->stat_count = STAT_COUNT;      
+		st->stat_count = STAT_COUNT;
 	} else
 	{
 		/* if 8 last vad-decisions have been "0", reinitialize stat_count */
 		if ((st->vadreg & 0x7f80) == 0)
 		{
-			st->stat_count = STAT_COUNT;   
+			st->stat_count = STAT_COUNT;
 		} else
 		{
-			stat_rat = 0;                  
+			stat_rat = 0;
 			for (i = 0; i < COMPLEN; i++)
 			{
 				if(level[i] > st->ave_level[i])
 				{
-					num = level[i];        
-					denom = st->ave_level[i];   
+					num = level[i];
+					denom = st->ave_level[i];
 				} else
 				{
 					num = st->ave_level[i];
-					denom = level[i];      
+					denom = level[i];
 				}
 				/* Limit nimimum value of num and denom to STAT_THR_LEVEL */
 				if(num < STAT_THR_LEVEL)
 				{
-					num = STAT_THR_LEVEL;  
+					num = STAT_THR_LEVEL;
 				}
 				if(denom < STAT_THR_LEVEL)
 				{
@@ -307,7 +307,7 @@
 			/* compare stat_rat with a threshold and update stat_count */
 			if(stat_rat > STAT_THR)
 			{
-				st->stat_count = STAT_COUNT;    
+				st->stat_count = STAT_COUNT;
 			} else
 			{
 				if ((st->vadreg & 0x4000) != 0)
@@ -315,7 +315,7 @@
 
 					if (st->stat_count != 0)
 					{
-						st->stat_count = st->stat_count - 1;       
+						st->stat_count = st->stat_count - 1;
 					}
 				}
 			}
@@ -323,17 +323,17 @@
 	}
 
 	/* Update average amplitude estimate for stationarity estimation */
-	alpha = ALPHA4;                        
+	alpha = ALPHA4;
 	if(st->stat_count == STAT_COUNT)
 	{
-		alpha = 32767;                    
+		alpha = 32767;
 	} else if ((st->vadreg & 0x4000) == 0)
 	{
-		alpha = ALPHA5;                   
+		alpha = ALPHA5;
 	}
 	for (i = 0; i < COMPLEN; i++)
 	{
-		st->ave_level[i] = add1(st->ave_level[i], vo_mult_r(alpha, vo_sub(level[i], st->ave_level[i])));   
+		st->ave_level[i] = add1(st->ave_level[i], vo_mult_r(alpha, vo_sub(level[i], st->ave_level[i])));
 	}
 }
 
@@ -354,25 +354,25 @@
 	/* if the input power (pow_sum) is lower than a threshold, clear counters and set VAD_flag to "0"         */
 	if (low_power != 0)
 	{
-		st->burst_count = 0;               
-		st->hang_count = 0;                
+		st->burst_count = 0;
+		st->hang_count = 0;
 		return 0;
 	}
 	/* update the counters (hang_count, burst_count) */
 	if ((st->vadreg & 0x4000) != 0)
 	{
-		st->burst_count = st->burst_count + 1;    
+		st->burst_count = st->burst_count + 1;
 		if(st->burst_count >= burst_len)
 		{
-			st->hang_count = hang_len;     
+			st->hang_count = hang_len;
 		}
 		return 1;
 	} else
 	{
-		st->burst_count = 0;               
+		st->burst_count = 0;
 		if (st->hang_count > 0)
 		{
-			st->hang_count = st->hang_count - 1;    
+			st->hang_count = st->hang_count - 1;
 			return 1;
 		}
 	}
@@ -391,7 +391,7 @@
 		Word16 level[]                        /* i   : sub-band levels of the input frame */
 		)
 {
-	Word32 i; 
+	Word32 i;
 	Word16 alpha_up, alpha_down, bckr_add = 2;
 
 	/* Control update of bckr_est[] */
@@ -400,19 +400,19 @@
 	/* Choose update speed */
 	if ((0x7800 & st->vadreg) == 0)
 	{
-		alpha_up = ALPHA_UP1;              
-		alpha_down = ALPHA_DOWN1;          
+		alpha_up = ALPHA_UP1;
+		alpha_down = ALPHA_DOWN1;
 	} else
 	{
 		if ((st->stat_count == 0))
 		{
-			alpha_up = ALPHA_UP2;          
-			alpha_down = ALPHA_DOWN2;      
+			alpha_up = ALPHA_UP2;
+			alpha_down = ALPHA_DOWN2;
 		} else
 		{
-			alpha_up = 0;                  
-			alpha_down = ALPHA3;           
-			bckr_add = 0;                  
+			alpha_up = 0;
+			alpha_down = ALPHA3;
+			bckr_add = 0;
 		}
 	}
 
@@ -424,20 +424,20 @@
 
 		if (temp < 0)
 		{                                  /* update downwards */
-			st->bckr_est[i] = add1(-2, add(st->bckr_est[i],vo_mult_r(alpha_down, temp))); 
+			st->bckr_est[i] = add1(-2, add(st->bckr_est[i],vo_mult_r(alpha_down, temp)));
 			/* limit minimum value of the noise estimate to NOISE_MIN */
 			if(st->bckr_est[i] < NOISE_MIN)
 			{
-				st->bckr_est[i] = NOISE_MIN;   
+				st->bckr_est[i] = NOISE_MIN;
 			}
 		} else
 		{                                  /* update upwards */
-			st->bckr_est[i] = add1(bckr_add, add1(st->bckr_est[i],vo_mult_r(alpha_up, temp)));   
+			st->bckr_est[i] = add1(bckr_add, add1(st->bckr_est[i],vo_mult_r(alpha_up, temp)));
 
 			/* limit maximum value of the noise estimate to NOISE_MAX */
 			if(st->bckr_est[i] > NOISE_MAX)
 			{
-				st->bckr_est[i] = NOISE_MAX;    
+				st->bckr_est[i] = NOISE_MAX;
 			}
 		}
 	}
@@ -445,7 +445,7 @@
 	/* Update signal levels of the previous frame (old_level) */
 	for (i = 0; i < COMPLEN; i++)
 	{
-		st->old_level[i] = level[i];      
+		st->old_level[i] = level[i];
 	}
 }
 
@@ -473,7 +473,7 @@
 
 	/* Calculate squared sum of the input levels (level) divided by the background noise components
 	 * (bckr_est). */
-	L_snr_sum = 0;                        
+	L_snr_sum = 0;
 	for (i = 0; i < COMPLEN; i++)
 	{
 		Word16 exp;
@@ -486,7 +486,7 @@
 	}
 
 	/* Calculate average level of estimated background noise */
-	L_temp = 0;                           
+	L_temp = 0;
 	for (i = 1; i < COMPLEN; i++)          /* ignore lowest band */
 	{
 		L_temp = vo_L_add(L_temp, st->bckr_est[i]);
@@ -498,7 +498,7 @@
 
 	if(st->speech_level < temp)
 	{
-		st->speech_level = temp;          
+		st->speech_level = temp;
 	}
 	ilog2_noise_level = ilog2(noise_level);
 
@@ -511,33 +511,33 @@
 	temp2 = add1(SP_CH_MIN, vo_mult(SP_SLOPE, (ilog2_speech_level - SP_P1)));
 	if (temp2 < SP_CH_MIN)
 	{
-		temp2 = SP_CH_MIN;                 
+		temp2 = SP_CH_MIN;
 	}
 	if (temp2 > SP_CH_MAX)
 	{
-		temp2 = SP_CH_MAX;                 
+		temp2 = SP_CH_MAX;
 	}
 	vad_thr = temp + temp2;
 
 	if(vad_thr < THR_MIN)
 	{
-		vad_thr = THR_MIN;                 
+		vad_thr = THR_MIN;
 	}
 	/* Shift VAD decision register */
-	st->vadreg = (st->vadreg >> 1);       
+	st->vadreg = (st->vadreg >> 1);
 
 	/* Make intermediate VAD decision */
 	if(L_snr_sum > vo_L_mult(vad_thr, (512 * COMPLEN)))
 	{
-		st->vadreg = (Word16) (st->vadreg | 0x4000); 
+		st->vadreg = (Word16) (st->vadreg | 0x4000);
 	}
 	/* check if the input power (pow_sum) is lower than a threshold" */
 	if(pow_sum < VAD_POW_LOW)
 	{
-		low_power_flag = 1;               
+		low_power_flag = 1;
 	} else
 	{
-		low_power_flag = 0;               
+		low_power_flag = 0;
 	}
 	/* Update background noise estimates */
 	noise_estimate_update(st, level);
@@ -546,7 +546,7 @@
 	hang_len = add1(vo_mult(HANG_SLOPE, (vad_thr - HANG_P1)), HANG_HIGH);
 	if(hang_len < HANG_LOW)
 	{
-		hang_len = HANG_LOW;              
+		hang_len = HANG_LOW;
 	}
 	burst_len = add1(vo_mult(BURST_SLOPE, (vad_thr - BURST_P1)), BURST_HIGH);
 
@@ -575,20 +575,20 @@
 	/* if the required activity count cannot be achieved, reset counters */
 	if((st->sp_est_cnt - st->sp_max_cnt) > (SP_EST_COUNT - SP_ACTIVITY_COUNT))
 	{
-		st->sp_est_cnt = 0;                
-		st->sp_max = 0;                    
-		st->sp_max_cnt = 0;                
+		st->sp_est_cnt = 0;
+		st->sp_max = 0;
+		st->sp_max_cnt = 0;
 	}
-	st->sp_est_cnt += 1; 
+	st->sp_est_cnt += 1;
 
 	if (((st->vadreg & 0x4000)||(in_level > st->speech_level)) && (in_level > MIN_SPEECH_LEVEL1))
 	{
 		/* update sp_max */
 		if(in_level > st->sp_max)
 		{
-			st->sp_max = in_level;         
+			st->sp_max = in_level;
 		}
-		st->sp_max_cnt += 1;        
+		st->sp_max_cnt += 1;
 
 		if(st->sp_max_cnt >= SP_ACTIVITY_COUNT)
 		{
@@ -599,19 +599,19 @@
 			/* select update speed */
 			if(tmp > st->speech_level)
 			{
-				alpha = ALPHA_SP_UP;       
+				alpha = ALPHA_SP_UP;
 			} else
 			{
-				alpha = ALPHA_SP_DOWN;    
+				alpha = ALPHA_SP_DOWN;
 			}
 			if(tmp > MIN_SPEECH_LEVEL2)
 			{
-				st->speech_level = add1(st->speech_level, vo_mult_r(alpha, vo_sub(tmp, st->speech_level))); 
+				st->speech_level = add1(st->speech_level, vo_mult_r(alpha, vo_sub(tmp, st->speech_level)));
 			}
 			/* clear all counters used for speech estimation */
-			st->sp_max = 0;                
-			st->sp_max_cnt = 0;            
-			st->sp_est_cnt = 0;            
+			st->sp_max = 0;
+			st->sp_max_cnt = 0;
+			st->sp_est_cnt = 0;
 		}
 	}
 }
@@ -767,22 +767,22 @@
 	Word32 L_temp, pow_sum;
 
 	/* Calculate power of the input frame. */
-	L_temp = 0L;                           
+	L_temp = 0L;
 	for (i = 0; i < FRAME_LEN; i++)
 	{
 		L_temp = L_mac(L_temp, in_buf[i], in_buf[i]);
 	}
 
 	/* pow_sum = power of current frame and previous frame */
-	pow_sum = L_add(L_temp, st->prev_pow_sum);  
+	pow_sum = L_add(L_temp, st->prev_pow_sum);
 
 	/* save power of current frame for next call */
-	st->prev_pow_sum = L_temp;             
+	st->prev_pow_sum = L_temp;
 
 	/* If input power is very low, clear tone flag */
 	if (pow_sum < POW_TONE_THR)
 	{
-		st->tone_flag = (Word16) (st->tone_flag & 0x1fff);      
+		st->tone_flag = (Word16) (st->tone_flag & 0x1fff);
 	}
 	/* Run the filter bank and calculate signal levels at each band */
 	filter_bank(st, in_buf, level);
@@ -791,7 +791,7 @@
 	VAD_flag = vad_decision(st, level, pow_sum);
 
 	/* Calculate input level */
-	L_temp = 0;                          
+	L_temp = 0;
 	for (i = 1; i < COMPLEN; i++)          /* ignore lowest band */
 	{
 		L_temp = vo_L_add(L_temp, level[i]);
diff --git a/media/libstagefright/codecs/amrwbenc/src/weight_a.c b/media/libstagefright/codecs/amrwbenc/src/weight_a.c
index 8f0fb39..a02b48d 100644
--- a/media/libstagefright/codecs/amrwbenc/src/weight_a.c
+++ b/media/libstagefright/codecs/amrwbenc/src/weight_a.c
@@ -19,7 +19,7 @@
 *                                                                      *
 *       Description:Weighting of LPC coefficients                      *
 *	               ap[i] = a[i] * (gamma ** i)                     *
-*                                                                      * 
+*                                                                      *
 ************************************************************************/
 
 #include "typedef.h"
diff --git a/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp b/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp
index 0096760..e202a2b 100644
--- a/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp
+++ b/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp
@@ -35,20 +35,20 @@
 
 static status_t ConvertOmxAvcProfileToAvcSpecProfile(
         int32_t omxProfile, AVCProfile* pvProfile) {
-    LOGV("ConvertOmxAvcProfileToAvcSpecProfile: %d", omxProfile);
+    ALOGV("ConvertOmxAvcProfileToAvcSpecProfile: %d", omxProfile);
     switch (omxProfile) {
         case OMX_VIDEO_AVCProfileBaseline:
             *pvProfile = AVC_BASELINE;
             return OK;
         default:
-            LOGE("Unsupported omx profile: %d", omxProfile);
+            ALOGE("Unsupported omx profile: %d", omxProfile);
     }
     return BAD_VALUE;
 }
 
 static status_t ConvertOmxAvcLevelToAvcSpecLevel(
         int32_t omxLevel, AVCLevel *pvLevel) {
-    LOGV("ConvertOmxAvcLevelToAvcSpecLevel: %d", omxLevel);
+    ALOGV("ConvertOmxAvcLevelToAvcSpecLevel: %d", omxLevel);
     AVCLevel level = AVC_LEVEL5_1;
     switch (omxLevel) {
         case OMX_VIDEO_AVCLevel1:
@@ -100,7 +100,7 @@
             level = AVC_LEVEL5_1;
             break;
         default:
-            LOGE("Unknown omx level: %d", omxLevel);
+            ALOGE("Unknown omx level: %d", omxLevel);
             return BAD_VALUE;
     }
     *pvLevel = level;
@@ -178,7 +178,7 @@
       mInputFrameData(NULL),
       mGroup(NULL) {
 
-    LOGI("Construct software AVCEncoder");
+    ALOGI("Construct software AVCEncoder");
 
     mHandle = new tagAVCHandle;
     memset(mHandle, 0, sizeof(tagAVCHandle));
@@ -194,7 +194,7 @@
 }
 
 AVCEncoder::~AVCEncoder() {
-    LOGV("Destruct software AVCEncoder");
+    ALOGV("Destruct software AVCEncoder");
     if (mStarted) {
         stop();
     }
@@ -204,7 +204,7 @@
 }
 
 status_t AVCEncoder::initCheck(const sp<MetaData>& meta) {
-    LOGV("initCheck");
+    ALOGV("initCheck");
     CHECK(meta->findInt32(kKeyWidth, &mVideoWidth));
     CHECK(meta->findInt32(kKeyHeight, &mVideoHeight));
     CHECK(meta->findInt32(kKeyFrameRate, &mVideoFrameRate));
@@ -214,7 +214,7 @@
     CHECK(meta->findInt32(kKeyColorFormat, &mVideoColorFormat));
     if (mVideoColorFormat != OMX_COLOR_FormatYUV420Planar) {
         if (mVideoColorFormat != OMX_COLOR_FormatYUV420SemiPlanar) {
-            LOGE("Color format %d is not supported", mVideoColorFormat);
+            ALOGE("Color format %d is not supported", mVideoColorFormat);
             return BAD_VALUE;
         }
         // Allocate spare buffer only when color conversion is needed.
@@ -226,7 +226,7 @@
 
     // XXX: Remove this restriction
     if (mVideoWidth % 16 != 0 || mVideoHeight % 16 != 0) {
-        LOGE("Video frame size %dx%d must be a multiple of 16",
+        ALOGE("Video frame size %dx%d must be a multiple of 16",
             mVideoWidth, mVideoHeight);
         return BAD_VALUE;
     }
@@ -295,7 +295,7 @@
         mEncParams->idr_period =
             (iFramesIntervalSec * mVideoFrameRate);
     }
-    LOGV("idr_period: %d, I-frames interval: %d seconds, and frame rate: %d",
+    ALOGV("idr_period: %d, I-frames interval: %d seconds, and frame rate: %d",
         mEncParams->idr_period, iFramesIntervalSec, mVideoFrameRate);
 
     // Set profile and level
@@ -330,20 +330,20 @@
 }
 
 status_t AVCEncoder::start(MetaData *params) {
-    LOGV("start");
+    ALOGV("start");
     if (mInitCheck != OK) {
         return mInitCheck;
     }
 
     if (mStarted) {
-        LOGW("Call start() when encoder already started");
+        ALOGW("Call start() when encoder already started");
         return OK;
     }
 
     AVCEnc_Status err;
     err = PVAVCEncInitialize(mHandle, mEncParams, NULL, NULL);
     if (err != AVCENC_SUCCESS) {
-        LOGE("Failed to initialize the encoder: %d", err);
+        ALOGE("Failed to initialize the encoder: %d", err);
         return UNKNOWN_ERROR;
     }
 
@@ -366,9 +366,9 @@
 }
 
 status_t AVCEncoder::stop() {
-    LOGV("stop");
+    ALOGV("stop");
     if (!mStarted) {
-        LOGW("Call stop() when encoder has not started");
+        ALOGW("Call stop() when encoder has not started");
         return OK;
     }
 
@@ -396,7 +396,7 @@
 }
 
 void AVCEncoder::releaseOutputBuffers() {
-    LOGV("releaseOutputBuffers");
+    ALOGV("releaseOutputBuffers");
     for (size_t i = 0; i < mOutputBuffers.size(); ++i) {
         MediaBuffer *buffer = mOutputBuffers.editItemAt(i);
         buffer->setObserver(NULL);
@@ -406,7 +406,7 @@
 }
 
 sp<MetaData> AVCEncoder::getFormat() {
-    LOGV("getFormat");
+    ALOGV("getFormat");
     return mFormat;
 }
 
@@ -461,7 +461,7 @@
                     *out = outputBuffer;
                     return OK;
                 default:
-                    LOGE("Nal type (%d) other than SPS/PPS is unexpected", type);
+                    ALOGE("Nal type (%d) other than SPS/PPS is unexpected", type);
                     return UNKNOWN_ERROR;
             }
         }
@@ -476,7 +476,7 @@
         status_t err = mSource->read(&mInputBuffer, options);
         if (err != OK) {
             if (err != ERROR_END_OF_STREAM) {
-                LOGE("Failed to read input video frame: %d", err);
+                ALOGE("Failed to read input video frame: %d", err);
             }
             outputBuffer->release();
             return err;
@@ -563,7 +563,7 @@
         if (mIsIDRFrame) {
             outputBuffer->meta_data()->setInt32(kKeyIsSyncFrame, mIsIDRFrame);
             mIsIDRFrame = 0;
-            LOGV("Output an IDR frame");
+            ALOGV("Output an IDR frame");
         }
         mReadyForNextFrame = true;
         AVCFrameIO recon;
diff --git a/media/libstagefright/codecs/common/Config.mk b/media/libstagefright/codecs/common/Config.mk
index 3d754e7..187f25c 100644
--- a/media/libstagefright/codecs/common/Config.mk
+++ b/media/libstagefright/codecs/common/Config.mk
@@ -1,8 +1,8 @@
-# 
+#
 # This configure file is just for Linux projects against Android
 #
 
-VOPRJ := 
+VOPRJ :=
 VONJ :=
 
 # WARNING:
@@ -20,5 +20,5 @@
 
 VOTEST := 0
 
-VO_CFLAGS:=-DLINUX 
+VO_CFLAGS:=-DLINUX
 
diff --git a/media/libstagefright/codecs/common/include/voAMRWB.h b/media/libstagefright/codecs/common/include/voAMRWB.h
index 13290c7..d3eb537 100644
--- a/media/libstagefright/codecs/common/include/voAMRWB.h
+++ b/media/libstagefright/codecs/common/include/voAMRWB.h
@@ -29,20 +29,20 @@
 #pragma pack(push, 4)
 
 /*!* the bit rate the codec supports*/
-typedef enum { 
+typedef enum {
 	VOAMRWB_MDNONE		= -1,	/*!< Invalid mode */
 	VOAMRWB_MD66		= 0,	/*!< 6.60kbps   */
-	VOAMRWB_MD885		= 1,    /*!< 8.85kbps   */       
+	VOAMRWB_MD885		= 1,    /*!< 8.85kbps   */
 	VOAMRWB_MD1265		= 2,	/*!< 12.65kbps  */
 	VOAMRWB_MD1425		= 3,	/*!< 14.25kbps  */
 	VOAMRWB_MD1585		= 4,	/*!< 15.85bps   */
 	VOAMRWB_MD1825		= 5,	/*!< 18.25bps   */
 	VOAMRWB_MD1985		= 6,	/*!< 19.85kbps  */
 	VOAMRWB_MD2305		= 7,    /*!< 23.05kbps  */
-	VOAMRWB_MD2385          = 8,    /*!< 23.85kbps> */	
+	VOAMRWB_MD2385          = 8,    /*!< 23.85kbps> */
 	VOAMRWB_N_MODES 	= 9,	/*!< Invalid mode */
 	VOAMRWB_MODE_MAX    = VO_MAX_ENUM_VALUE
-	
+
 }VOAMRWBMODE;
 
 /*!* the frame format the codec supports*/
@@ -51,17 +51,17 @@
 	/*One word (2-byte) for sync word (0x6b21)*/
 	/*One word (2-byte) for frame length N.*/
 	/*N words (2-byte) containing N bits (bit 0 = 0x007f, bit 1 = 0x0081).*/
-	VOAMRWB_ITU         = 1, 
+	VOAMRWB_ITU         = 1,
 	/*One word (2-byte) for sync word (0x6b21).*/
-	/*One word (2-byte) to indicate the frame type.*/	
+	/*One word (2-byte) to indicate the frame type.*/
 	/*One word (2-byte) to indicate the mode.*/
 	/*N words  (2-byte) containing N bits (bit 0 = 0xff81, bit 1 = 0x007f).*/
-	VOAMRWB_RFC3267		= 2,	/* see RFC 3267 */  
-    VOAMRWB_TMAX        = VO_MAX_ENUM_VALUE	
+	VOAMRWB_RFC3267		= 2,	/* see RFC 3267 */
+    VOAMRWB_TMAX        = VO_MAX_ENUM_VALUE
 }VOAMRWBFRAMETYPE;
 
 
-#define    VO_PID_AMRWB_Module							0x42261000 
+#define    VO_PID_AMRWB_Module							0x42261000
 #define    VO_PID_AMRWB_FORMAT                          (VO_PID_AMRWB_Module | 0x0002)
 #define    VO_PID_AMRWB_CHANNELS                        (VO_PID_AMRWB_Module | 0x0003)
 #define    VO_PID_AMRWB_SAMPLERATE                      (VO_PID_AMRWB_Module | 0x0004)
diff --git a/media/libstagefright/codecs/common/include/voAudio.h b/media/libstagefright/codecs/common/include/voAudio.h
index 21d0cf6..d8628ee 100644
--- a/media/libstagefright/codecs/common/include/voAudio.h
+++ b/media/libstagefright/codecs/common/include/voAudio.h
@@ -135,7 +135,7 @@
 	 * \param pOutInfo [OUT] The codec fills audio format and the input data size used in current call.
 	 *						 pOutInfo->InputUsed is total used input data size in byte.
 	 * \retval  VO_ERR_NONE Succeeded.
-	 *			VO_ERR_INPUT_BUFFER_SMALL. The input was finished or the input data was not enought. Continue to input 
+	 *			VO_ERR_INPUT_BUFFER_SMALL. The input was finished or the input data was not enought. Continue to input
 	 *										data before next call.
 	 */
 	VO_U32 (VO_API * GetOutputData) (VO_HANDLE hCodec, VO_CODECBUFFER * pOutBuffer, VO_AUDIO_OUTPUTINFO * pOutInfo);
diff --git a/media/libstagefright/codecs/common/include/voIndex.h b/media/libstagefright/codecs/common/include/voIndex.h
index a409a6e..320a2f8 100644
--- a/media/libstagefright/codecs/common/include/voIndex.h
+++ b/media/libstagefright/codecs/common/include/voIndex.h
@@ -173,7 +173,7 @@
 // Module own error ID
 #define VO_ERR_Module					0x8xxx0X00
 */
- 
+
 #define	VO_PID_COMMON_BASE				 0x40000000						/*!< The base of common param ID */
 #define	VO_PID_COMMON_QUERYMEM			(VO_PID_COMMON_BASE | 0X0001)	/*!< Query the memory needed; Reserved. */
 #define	VO_PID_COMMON_INPUTTYPE			(VO_PID_COMMON_BASE | 0X0002)	/*!< Set or get the input buffer type. VO_INPUT_TYPE */
diff --git a/media/libstagefright/codecs/g711/dec/SoftG711.cpp b/media/libstagefright/codecs/g711/dec/SoftG711.cpp
index 15e2c26..32ef003 100644
--- a/media/libstagefright/codecs/g711/dec/SoftG711.cpp
+++ b/media/libstagefright/codecs/g711/dec/SoftG711.cpp
@@ -210,7 +210,7 @@
         }
 
         if (inHeader->nFilledLen > kMaxNumSamplesPerFrame) {
-            LOGE("input buffer too large (%ld).", inHeader->nFilledLen);
+            ALOGE("input buffer too large (%ld).", inHeader->nFilledLen);
 
             notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
             mSignalledError = true;
diff --git a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
index aa07e57..a34a0ca 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
+++ b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
@@ -207,7 +207,7 @@
                     (OMX_VIDEO_PARAM_PROFILELEVELTYPE *) params;
 
             if (profileLevel->nPortIndex != 0) {  // Input port only
-                LOGE("Invalid port index: %ld", profileLevel->nPortIndex);
+                ALOGE("Invalid port index: %ld", profileLevel->nPortIndex);
                 return OMX_ErrorUnsupportedIndex;
             }
 
@@ -371,7 +371,7 @@
                     mHandle, vol_data, &vol_size, 1, mWidth, mHeight, mode);
 
             if (!success) {
-                LOGW("PVInitVideoDecoder failed. Unsupported content?");
+                ALOGW("PVInitVideoDecoder failed. Unsupported content?");
 
                 notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
                 mSignalledError = true;
@@ -430,7 +430,7 @@
                     mHandle, &bitstream, &timestamp, &tmp,
                     &useExtTimestamp,
                     outHeader->pBuffer) != PV_TRUE) {
-            LOGE("failed to decode video frame.");
+            ALOGE("failed to decode video frame.");
 
             notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
             mSignalledError = true;
@@ -489,7 +489,7 @@
     CHECK_LE(disp_width, buf_width);
     CHECK_LE(disp_height, buf_height);
 
-    LOGV("disp_width = %d, disp_height = %d, buf_width = %d, buf_height = %d",
+    ALOGV("disp_width = %d, disp_height = %d, buf_width = %d, buf_height = %d",
             disp_width, disp_height, buf_width, buf_height);
 
     if (mCropRight != disp_width - 1
diff --git a/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp b/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp
index d7249c1..d538603 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp
+++ b/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp
@@ -37,22 +37,22 @@
         int32_t omxProfile,
         int32_t omxLevel,
         ProfileLevelType* pvProfileLevel) {
-    LOGV("ConvertOmxProfileLevel: %d/%d/%d", mode, omxProfile, omxLevel);
+    ALOGV("ConvertOmxProfileLevel: %d/%d/%d", mode, omxProfile, omxLevel);
     ProfileLevelType profileLevel;
     if (mode == H263_MODE) {
         switch (omxProfile) {
             case OMX_VIDEO_H263ProfileBaseline:
                 if (omxLevel > OMX_VIDEO_H263Level45) {
-                    LOGE("Unsupported level (%d) for H263", omxLevel);
+                    ALOGE("Unsupported level (%d) for H263", omxLevel);
                     return BAD_VALUE;
                 } else {
-                    LOGW("PV does not support level configuration for H263");
+                    ALOGW("PV does not support level configuration for H263");
                     profileLevel = CORE_PROFILE_LEVEL2;
                     break;
                 }
                 break;
             default:
-                LOGE("Unsupported profile (%d) for H263", omxProfile);
+                ALOGE("Unsupported profile (%d) for H263", omxProfile);
                 return BAD_VALUE;
         }
     } else {  // MPEG4
@@ -72,7 +72,7 @@
                         profileLevel = SIMPLE_PROFILE_LEVEL3;
                         break;
                     default:
-                        LOGE("Unsupported level (%d) for MPEG4 simple profile",
+                        ALOGE("Unsupported level (%d) for MPEG4 simple profile",
                             omxLevel);
                         return BAD_VALUE;
                 }
@@ -89,7 +89,7 @@
                         profileLevel = SIMPLE_SCALABLE_PROFILE_LEVEL2;
                         break;
                     default:
-                        LOGE("Unsupported level (%d) for MPEG4 simple "
+                        ALOGE("Unsupported level (%d) for MPEG4 simple "
                              "scalable profile", omxLevel);
                         return BAD_VALUE;
                 }
@@ -103,7 +103,7 @@
                         profileLevel = CORE_PROFILE_LEVEL2;
                         break;
                     default:
-                        LOGE("Unsupported level (%d) for MPEG4 core "
+                        ALOGE("Unsupported level (%d) for MPEG4 core "
                              "profile", omxLevel);
                         return BAD_VALUE;
                 }
@@ -120,13 +120,13 @@
                         profileLevel = CORE_SCALABLE_PROFILE_LEVEL3;
                         break;
                     default:
-                        LOGE("Unsupported level (%d) for MPEG4 core "
+                        ALOGE("Unsupported level (%d) for MPEG4 core "
                              "scalable profile", omxLevel);
                         return BAD_VALUE;
                 }
                 break;
             default:
-                LOGE("Unsupported MPEG4 profile (%d)", omxProfile);
+                ALOGE("Unsupported MPEG4 profile (%d)", omxProfile);
                 return BAD_VALUE;
         }
     }
@@ -178,7 +178,7 @@
       mInputFrameData(NULL),
       mGroup(NULL) {
 
-    LOGI("Construct software M4vH263Encoder");
+    ALOGI("Construct software M4vH263Encoder");
 
     mHandle = new tagvideoEncControls;
     memset(mHandle, 0, sizeof(tagvideoEncControls));
@@ -187,7 +187,7 @@
 }
 
 M4vH263Encoder::~M4vH263Encoder() {
-    LOGV("Destruct software M4vH263Encoder");
+    ALOGV("Destruct software M4vH263Encoder");
     if (mStarted) {
         stop();
     }
@@ -197,7 +197,7 @@
 }
 
 status_t M4vH263Encoder::initCheck(const sp<MetaData>& meta) {
-    LOGV("initCheck");
+    ALOGV("initCheck");
     CHECK(meta->findInt32(kKeyWidth, &mVideoWidth));
     CHECK(meta->findInt32(kKeyHeight, &mVideoHeight));
     CHECK(meta->findInt32(kKeyFrameRate, &mVideoFrameRate));
@@ -207,7 +207,7 @@
     CHECK(meta->findInt32(kKeyColorFormat, &mVideoColorFormat));
     if (mVideoColorFormat != OMX_COLOR_FormatYUV420Planar) {
         if (mVideoColorFormat != OMX_COLOR_FormatYUV420SemiPlanar) {
-            LOGE("Color format %d is not supported", mVideoColorFormat);
+            ALOGE("Color format %d is not supported", mVideoColorFormat);
             return BAD_VALUE;
         }
         // Allocate spare buffer only when color conversion is needed.
@@ -219,7 +219,7 @@
 
     // XXX: Remove this restriction
     if (mVideoWidth % 16 != 0 || mVideoHeight % 16 != 0) {
-        LOGE("Video frame size %dx%d must be a multiple of 16",
+        ALOGE("Video frame size %dx%d must be a multiple of 16",
             mVideoWidth, mVideoHeight);
         return BAD_VALUE;
     }
@@ -227,7 +227,7 @@
     mEncParams = new tagvideoEncOptions;
     memset(mEncParams, 0, sizeof(tagvideoEncOptions));
     if (!PVGetDefaultEncOption(mEncParams, 0)) {
-        LOGE("Failed to get default encoding parameters");
+        ALOGE("Failed to get default encoding parameters");
         return BAD_VALUE;
     }
 
@@ -308,18 +308,18 @@
 }
 
 status_t M4vH263Encoder::start(MetaData *params) {
-    LOGV("start");
+    ALOGV("start");
     if (mInitCheck != OK) {
         return mInitCheck;
     }
 
     if (mStarted) {
-        LOGW("Call start() when encoder already started");
+        ALOGW("Call start() when encoder already started");
         return OK;
     }
 
     if (!PVInitVideoEncoder(mHandle, mEncParams)) {
-        LOGE("Failed to initialize the encoder");
+        ALOGE("Failed to initialize the encoder");
         return UNKNOWN_ERROR;
     }
 
@@ -328,7 +328,7 @@
     if (!PVGetMaxVideoFrameSize(mHandle, &maxSize)) {
         maxSize = 256 * 1024;  // Magic #
     }
-    LOGV("Max output buffer size: %d", maxSize);
+    ALOGV("Max output buffer size: %d", maxSize);
     mGroup->add_buffer(new MediaBuffer(maxSize));
 
     mSource->start(params);
@@ -339,9 +339,9 @@
 }
 
 status_t M4vH263Encoder::stop() {
-    LOGV("stop");
+    ALOGV("stop");
     if (!mStarted) {
-        LOGW("Call stop() when encoder has not started");
+        ALOGW("Call stop() when encoder has not started");
         return OK;
     }
 
@@ -369,7 +369,7 @@
 }
 
 sp<MetaData> M4vH263Encoder::getFormat() {
-    LOGV("getFormat");
+    ALOGV("getFormat");
     return mFormat;
 }
 
@@ -386,10 +386,10 @@
     // Output codec specific data
     if (mNumInputFrames < 0) {
         if (!PVGetVolHeader(mHandle, outPtr, &dataLength, 0)) {
-            LOGE("Failed to get VOL header");
+            ALOGE("Failed to get VOL header");
             return UNKNOWN_ERROR;
         }
-        LOGV("Output VOL header: %d bytes", dataLength);
+        ALOGV("Output VOL header: %d bytes", dataLength);
         outputBuffer->meta_data()->setInt32(kKeyIsCodecConfig, 1);
         outputBuffer->set_range(0, dataLength);
         *out = outputBuffer;
@@ -401,7 +401,7 @@
     status_t err = mSource->read(&mInputBuffer, options);
     if (OK != err) {
         if (err != ERROR_END_OF_STREAM) {
-            LOGE("Failed to read from data source");
+            ALOGE("Failed to read from data source");
         }
         outputBuffer->release();
         return err;
@@ -460,7 +460,7 @@
     if (!PVEncodeVideoFrame(mHandle, &vin, &vout,
             &modTimeMs, outPtr, &dataLength, &nLayer) ||
         !PVGetHintTrack(mHandle, &hintTrack)) {
-        LOGE("Failed to encode frame or get hink track at frame %lld",
+        ALOGE("Failed to encode frame or get hink track at frame %lld",
             mNumInputFrames);
         outputBuffer->release();
         mInputBuffer->release();
diff --git a/media/libstagefright/codecs/mp3dec/SoftMP3.cpp b/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
index 066c88e..ad55295 100644
--- a/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
+++ b/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
@@ -219,14 +219,14 @@
         ERROR_CODE decoderErr;
         if ((decoderErr = pvmp3_framedecoder(mConfig, mDecoderBuf))
                 != NO_DECODING_ERROR) {
-            LOGV("mp3 decoder returned error %d", decoderErr);
+            ALOGV("mp3 decoder returned error %d", decoderErr);
 
             if (decoderErr != NO_ENOUGH_MAIN_DATA_ERROR ||
                     mConfig->outputFrameSize == 0) {
-                LOGE("mp3 decoder returned error %d", decoderErr);
+                ALOGE("mp3 decoder returned error %d", decoderErr);
 
                 if (mConfig->outputFrameSize == 0) {
-                    LOGE("Output frame size is 0");
+                    ALOGE("Output frame size is 0");
                 }
 
                 notify(OMX_EventError, OMX_ErrorUndefined, decoderErr, NULL);
diff --git a/media/libstagefright/codecs/on2/dec/SoftVPX.cpp b/media/libstagefright/codecs/on2/dec/SoftVPX.cpp
index 61a02ac..bf9ab3a 100644
--- a/media/libstagefright/codecs/on2/dec/SoftVPX.cpp
+++ b/media/libstagefright/codecs/on2/dec/SoftVPX.cpp
@@ -126,7 +126,7 @@
     cpuCoreCount = sysconf(_SC_NPROC_ONLN);
 #endif
     CHECK(cpuCoreCount >= 1);
-    LOGV("Number of CPU cores: %d", cpuCoreCount);
+    ALOGV("Number of CPU cores: %d", cpuCoreCount);
     return cpuCoreCount;
 }
 
@@ -138,7 +138,7 @@
     cfg.threads = GetCPUCoreCount();
     if ((vpx_err = vpx_codec_dec_init(
                 (vpx_codec_ctx_t *)mCtx, &vpx_codec_vp8_dx_algo, &cfg, 0))) {
-        LOGE("on2 decoder failed to initialize. (%d)", vpx_err);
+        ALOGE("on2 decoder failed to initialize. (%d)", vpx_err);
         return UNKNOWN_ERROR;
     }
 
@@ -254,7 +254,7 @@
                     inHeader->nFilledLen,
                     NULL,
                     0)) {
-            LOGE("on2 decoder failed to decode frame.");
+            ALOGE("on2 decoder failed to decode frame.");
 
             notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
             return;
diff --git a/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp b/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp
index dede3ac..6c3f834 100644
--- a/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp
+++ b/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp
@@ -204,7 +204,7 @@
                     (OMX_VIDEO_PARAM_PROFILELEVELTYPE *) params;
 
             if (profileLevel->nPortIndex != kInputPortIndex) {
-                LOGE("Invalid port index: %ld", profileLevel->nPortIndex);
+                ALOGE("Invalid port index: %ld", profileLevel->nPortIndex);
                 return OMX_ErrorUnsupportedIndex;
             }
 
@@ -371,7 +371,7 @@
                 }
                 inPicture.dataLen = 0;
                 if (ret < 0) {
-                    LOGE("Decoder failed: %d", ret);
+                    ALOGE("Decoder failed: %d", ret);
 
                     notify(OMX_EventError, OMX_ErrorUndefined,
                            ERROR_MALFORMED, NULL);
diff --git a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
index 4091111..ac88107 100644
--- a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
+++ b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
@@ -353,21 +353,21 @@
 
         int err = vorbis_dsp_synthesis(mState, &pack, 1);
         if (err != 0) {
-            LOGW("vorbis_dsp_synthesis returned %d", err);
+            ALOGW("vorbis_dsp_synthesis returned %d", err);
         } else {
             numFrames = vorbis_dsp_pcmout(
                     mState, (int16_t *)outHeader->pBuffer,
                     kMaxNumSamplesPerBuffer);
 
             if (numFrames < 0) {
-                LOGE("vorbis_dsp_pcmout returned %d", numFrames);
+                ALOGE("vorbis_dsp_pcmout returned %d", numFrames);
                 numFrames = 0;
             }
         }
 
         if (mNumFramesLeftOnPage >= 0) {
             if (numFrames > mNumFramesLeftOnPage) {
-                LOGV("discarding %d frames at end of page",
+                ALOGV("discarding %d frames at end of page",
                      numFrames - mNumFramesLeftOnPage);
                 numFrames = mNumFramesLeftOnPage;
             }
diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
index 3246021..e892f92 100644
--- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp
+++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
@@ -135,7 +135,7 @@
     ANativeWindowBuffer *buf;
     int err;
     if ((err = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buf)) != 0) {
-        LOGW("Surface::dequeueBuffer returned error %d", err);
+        ALOGW("Surface::dequeueBuffer returned error %d", err);
         return;
     }
 
@@ -225,7 +225,7 @@
     CHECK_EQ(0, mapper.unlock(buf->handle));
 
     if ((err = mNativeWindow->queueBuffer(mNativeWindow.get(), buf)) != 0) {
-        LOGW("Surface::queueBuffer returned error %d", err);
+        ALOGW("Surface::queueBuffer returned error %d", err);
     }
     buf = NULL;
 }
diff --git a/media/libstagefright/foundation/AHierarchicalStateMachine.cpp b/media/libstagefright/foundation/AHierarchicalStateMachine.cpp
index 3b3f786..40c5a3c 100644
--- a/media/libstagefright/foundation/AHierarchicalStateMachine.cpp
+++ b/media/libstagefright/foundation/AHierarchicalStateMachine.cpp
@@ -63,7 +63,7 @@
         return;
     }
 
-    LOGW("Warning message %s unhandled in root state.",
+    ALOGW("Warning message %s unhandled in root state.",
          msg->debugString().c_str());
 }
 
diff --git a/media/libstagefright/foundation/ALooperRoster.cpp b/media/libstagefright/foundation/ALooperRoster.cpp
index e399f2f..dff931d 100644
--- a/media/libstagefright/foundation/ALooperRoster.cpp
+++ b/media/libstagefright/foundation/ALooperRoster.cpp
@@ -82,7 +82,7 @@
     ssize_t index = mHandlers.indexOfKey(msg->target());
 
     if (index < 0) {
-        LOGW("failed to post message. Target handler not registered.");
+        ALOGW("failed to post message. Target handler not registered.");
         return -ENOENT;
     }
 
@@ -91,7 +91,7 @@
     sp<ALooper> looper = info.mLooper.promote();
 
     if (looper == NULL) {
-        LOGW("failed to post message. "
+        ALOGW("failed to post message. "
              "Target handler %d still registered, but object gone.",
              msg->target());
 
@@ -113,7 +113,7 @@
         ssize_t index = mHandlers.indexOfKey(msg->target());
 
         if (index < 0) {
-            LOGW("failed to deliver message. Target handler not registered.");
+            ALOGW("failed to deliver message. Target handler not registered.");
             return;
         }
 
@@ -121,7 +121,7 @@
         handler = info.mHandler.promote();
 
         if (handler == NULL) {
-            LOGW("failed to deliver message. "
+            ALOGW("failed to deliver message. "
                  "Target handler %d registered, but object gone.",
                  msg->target());
 
diff --git a/media/libstagefright/foundation/AMessage.cpp b/media/libstagefright/foundation/AMessage.cpp
index f039bc1..0a6776e 100644
--- a/media/libstagefright/foundation/AMessage.cpp
+++ b/media/libstagefright/foundation/AMessage.cpp
@@ -471,7 +471,7 @@
 
             default:
             {
-                LOGE("This type of object cannot cross process boundaries.");
+                ALOGE("This type of object cannot cross process boundaries.");
                 TRESPASS();
             }
         }
@@ -535,7 +535,7 @@
 
             default:
             {
-                LOGE("This type of object cannot cross process boundaries.");
+                ALOGE("This type of object cannot cross process boundaries.");
                 TRESPASS();
             }
         }
diff --git a/media/libstagefright/foundation/hexdump.cpp b/media/libstagefright/foundation/hexdump.cpp
index 9f6bf9e..16c1ca5 100644
--- a/media/libstagefright/foundation/hexdump.cpp
+++ b/media/libstagefright/foundation/hexdump.cpp
@@ -67,7 +67,7 @@
             }
         }
 
-        LOGI("%s", line.c_str());
+        ALOGI("%s", line.c_str());
 
         offset += 16;
     }
diff --git a/media/libstagefright/httplive/LiveDataSource.cpp b/media/libstagefright/httplive/LiveDataSource.cpp
index 5f5c6d4..7560642 100644
--- a/media/libstagefright/httplive/LiveDataSource.cpp
+++ b/media/libstagefright/httplive/LiveDataSource.cpp
@@ -59,7 +59,7 @@
     Mutex::Autolock autoLock(mLock);
 
     if (offset != mOffset) {
-        LOGE("Attempt at reading non-sequentially from LiveDataSource.");
+        ALOGE("Attempt at reading non-sequentially from LiveDataSource.");
         return -EPIPE;
     }
 
@@ -89,7 +89,7 @@
 
 ssize_t LiveDataSource::readAt_l(off64_t offset, void *data, size_t size) {
     if (offset != mOffset) {
-        LOGE("Attempt at reading non-sequentially from LiveDataSource.");
+        ALOGE("Attempt at reading non-sequentially from LiveDataSource.");
         return -EPIPE;
     }
 
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index f67cdac..0df66f1 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -168,9 +168,9 @@
     }
 
     if (!(mFlags & kFlagIncognito)) {
-        LOGI("onConnect '%s'", url.c_str());
+        ALOGI("onConnect '%s'", url.c_str());
     } else {
-        LOGI("onConnect <URL suppressed>");
+        ALOGI("onConnect <URL suppressed>");
     }
 
     mMasterURL = url;
@@ -179,7 +179,7 @@
     sp<M3UParser> playlist = fetchPlaylist(url.c_str(), &dummy);
 
     if (playlist == NULL) {
-        LOGE("unable to fetch master playlist '%s'.", url.c_str());
+        ALOGE("unable to fetch master playlist '%s'.", url.c_str());
 
         mDataSource->queueEOS(ERROR_IO);
         return;
@@ -207,7 +207,7 @@
 }
 
 void LiveSession::onDisconnect() {
-    LOGI("onDisconnect");
+    ALOGI("onDisconnect");
 
     mDataSource->queueEOS(ERROR_END_OF_STREAM);
 
@@ -260,7 +260,7 @@
         if (bufferRemaining == 0) {
             bufferRemaining = 32768;
 
-            LOGV("increasing download buffer to %d bytes",
+            ALOGV("increasing download buffer to %d bytes",
                  buffer->size() + bufferRemaining);
 
             sp<ABuffer> copy = new ABuffer(buffer->size() + bufferRemaining);
@@ -321,7 +321,7 @@
 
         *unchanged = true;
 
-        LOGV("Playlist unchanged, refresh state is now %d",
+        ALOGV("Playlist unchanged, refresh state is now %d",
              (int)mRefreshState);
 
         return NULL;
@@ -336,7 +336,7 @@
         new M3UParser(url, buffer->data(), buffer->size());
 
     if (playlist->initCheck() != OK) {
-        LOGE("failed to parse .m3u8 playlist");
+        ALOGE("failed to parse .m3u8 playlist");
 
         return NULL;
     }
@@ -357,9 +357,9 @@
     int32_t bandwidthBps;
     if (mHTTPDataSource != NULL
             && mHTTPDataSource->estimateBandwidth(&bandwidthBps)) {
-        LOGV("bandwidth estimated at %.2f kbps", bandwidthBps / 1024.0f);
+        ALOGV("bandwidth estimated at %.2f kbps", bandwidthBps / 1024.0f);
     } else {
-        LOGV("no bandwidth estimate.");
+        ALOGV("no bandwidth estimate.");
         return 0;  // Pick the lowest bandwidth stream by default.
     }
 
@@ -369,7 +369,7 @@
         long maxBw = strtoul(value, &end, 10);
         if (end > value && *end == '\0') {
             if (maxBw > 0 && bandwidthBps > maxBw) {
-                LOGV("bandwidth capped to %ld bps", maxBw);
+                ALOGV("bandwidth capped to %ld bps", maxBw);
                 bandwidthBps = maxBw;
             }
         }
@@ -507,7 +507,7 @@
                 // We succeeded in fetching the playlist, but it was
                 // unchanged from the last time we tried.
             } else {
-                LOGE("failed to load playlist at url '%s'", url.c_str());
+                ALOGE("failed to load playlist at url '%s'", url.c_str());
                 mDataSource->queueEOS(ERROR_IO);
                 return;
             }
@@ -572,7 +572,7 @@
                 int32_t newSeqNumber = firstSeqNumberInPlaylist + index;
 
                 if (newSeqNumber != mSeqNumber) {
-                    LOGI("seeking to seq no %d", newSeqNumber);
+                    ALOGI("seeking to seq no %d", newSeqNumber);
 
                     mSeqNumber = newSeqNumber;
 
@@ -609,7 +609,7 @@
         if (mPrevBandwidthIndex != (ssize_t)bandwidthIndex) {
             // Go back to the previous bandwidth.
 
-            LOGI("new bandwidth does not have the sequence number "
+            ALOGI("new bandwidth does not have the sequence number "
                  "we're looking for, switching back to previous bandwidth");
 
             mLastPlaylistFetchTimeUs = -1;
@@ -629,13 +629,13 @@
             // we've missed the boat, let's start from the lowest sequence
             // number available and signal a discontinuity.
 
-            LOGI("We've missed the boat, restarting playback.");
+            ALOGI("We've missed the boat, restarting playback.");
             mSeqNumber = lastSeqNumberInPlaylist;
             explicitDiscontinuity = true;
 
             // fall through
         } else {
-            LOGE("Cannot find sequence number %d in playlist "
+            ALOGE("Cannot find sequence number %d in playlist "
                  "(contains %d - %d)",
                  mSeqNumber, firstSeqNumberInPlaylist,
                  firstSeqNumberInPlaylist + mPlaylist->size() - 1);
@@ -662,7 +662,7 @@
     sp<ABuffer> buffer;
     status_t err = fetchFile(uri.c_str(), &buffer);
     if (err != OK) {
-        LOGE("failed to fetch .ts segment at url '%s'", uri.c_str());
+        ALOGE("failed to fetch .ts segment at url '%s'", uri.c_str());
         mDataSource->queueEOS(err);
         return;
     }
@@ -672,7 +672,7 @@
     err = decryptBuffer(mSeqNumber - firstSeqNumberInPlaylist, buffer);
 
     if (err != OK) {
-        LOGE("decryptBuffer failed w/ error %d", err);
+        ALOGE("decryptBuffer failed w/ error %d", err);
 
         mDataSource->queueEOS(err);
         return;
@@ -681,7 +681,7 @@
     if (buffer->size() == 0 || buffer->data()[0] != 0x47) {
         // Not a transport stream???
 
-        LOGE("This doesn't look like a transport stream...");
+        ALOGE("This doesn't look like a transport stream...");
 
         mBandwidthItems.removeAt(bandwidthIndex);
 
@@ -690,7 +690,7 @@
             return;
         }
 
-        LOGI("Retrying with a different bandwidth stream.");
+        ALOGI("Retrying with a different bandwidth stream.");
 
         mLastPlaylistFetchTimeUs = -1;
         bandwidthIndex = getBandwidthIndex();
@@ -713,7 +713,7 @@
     if (seekDiscontinuity || explicitDiscontinuity || bandwidthChanged) {
         // Signal discontinuity.
 
-        LOGI("queueing discontinuity (seek=%d, explicit=%d, bandwidthChanged=%d)",
+        ALOGI("queueing discontinuity (seek=%d, explicit=%d, bandwidthChanged=%d)",
              seekDiscontinuity, explicitDiscontinuity, bandwidthChanged);
 
         sp<ABuffer> tmp = new ABuffer(188);
@@ -765,13 +765,13 @@
     if (method == "NONE") {
         return OK;
     } else if (!(method == "AES-128")) {
-        LOGE("Unsupported cipher method '%s'", method.c_str());
+        ALOGE("Unsupported cipher method '%s'", method.c_str());
         return ERROR_UNSUPPORTED;
     }
 
     AString keyURI;
     if (!itemMeta->findString("cipher-uri", &keyURI)) {
-        LOGE("Missing key uri");
+        ALOGE("Missing key uri");
         return ERROR_MALFORMED;
     }
 
@@ -813,7 +813,7 @@
         }
 
         if (err != OK) {
-            LOGE("failed to fetch cipher key from '%s'.", keyURI.c_str());
+            ALOGE("failed to fetch cipher key from '%s'.", keyURI.c_str());
             return ERROR_IO;
         }
 
@@ -822,7 +822,7 @@
 
     AES_KEY aes_key;
     if (AES_set_decrypt_key(key->data(), 128, &aes_key) != 0) {
-        LOGE("failed to set AES decryption key.");
+        ALOGE("failed to set AES decryption key.");
         return UNKNOWN_ERROR;
     }
 
@@ -832,7 +832,7 @@
     if (itemMeta->findString("cipher-iv", &iv)) {
         if ((!iv.startsWith("0x") && !iv.startsWith("0X"))
                 || iv.size() != 16 * 2 + 2) {
-            LOGE("malformed cipher IV '%s'.", iv.c_str());
+            ALOGE("malformed cipher IV '%s'.", iv.c_str());
             return ERROR_MALFORMED;
         }
 
@@ -841,7 +841,7 @@
             char c1 = tolower(iv.c_str()[2 + 2 * i]);
             char c2 = tolower(iv.c_str()[3 + 2 * i]);
             if (!isxdigit(c1) || !isxdigit(c2)) {
-                LOGE("malformed cipher IV '%s'.", iv.c_str());
+                ALOGE("malformed cipher IV '%s'.", iv.c_str());
                 return ERROR_MALFORMED;
             }
             uint8_t nibble1 = isdigit(c1) ? c1 - '0' : c1 - 'a' + 10;
diff --git a/media/libstagefright/httplive/M3UParser.cpp b/media/libstagefright/httplive/M3UParser.cpp
index 9df9f59..5e30488 100644
--- a/media/libstagefright/httplive/M3UParser.cpp
+++ b/media/libstagefright/httplive/M3UParser.cpp
@@ -101,7 +101,7 @@
         // "url" is already an absolute URL, ignore base URL.
         out->setTo(url);
 
-        LOGV("base:'%s', url:'%s' => '%s'", baseURL, url, out->c_str());
+        ALOGV("base:'%s', url:'%s' => '%s'", baseURL, url, out->c_str());
 
         return true;
     }
@@ -140,7 +140,7 @@
         }
     }
 
-    LOGV("base:'%s', url:'%s' => '%s'", baseURL, url, out->c_str());
+    ALOGV("base:'%s', url:'%s' => '%s'", baseURL, url, out->c_str());
 
     return true;
 }
@@ -168,7 +168,7 @@
             line.setTo(&data[offset], offsetLF - offset);
         }
 
-        // LOGI("#%s#", line.c_str());
+        // ALOGI("#%s#", line.c_str());
 
         if (line.empty()) {
             offset = offsetLF + 1;
@@ -332,7 +332,7 @@
         AString val(attr, equalPos + 1, attr.size() - equalPos - 1);
         val.trim();
 
-        LOGV("key=%s value=%s", key.c_str(), val.c_str());
+        ALOGV("key=%s value=%s", key.c_str(), val.c_str());
 
         if (!strcasecmp("bandwidth", key.c_str())) {
             const char *s = val.c_str();
@@ -410,7 +410,7 @@
         AString val(attr, equalPos + 1, attr.size() - equalPos - 1);
         val.trim();
 
-        LOGV("key=%s value=%s", key.c_str(), val.c_str());
+        ALOGV("key=%s value=%s", key.c_str(), val.c_str());
 
         key.tolower();
 
@@ -432,7 +432,7 @@
                 if (MakeURL(baseURI.c_str(), val.c_str(), &absURI)) {
                     val = absURI;
                 } else {
-                    LOGE("failed to make absolute url for '%s'.",
+                    ALOGE("failed to make absolute url for '%s'.",
                          val.c_str());
                 }
             }
diff --git a/media/libstagefright/id3/ID3.cpp b/media/libstagefright/id3/ID3.cpp
index 45e018d..6dde9d8 100644
--- a/media/libstagefright/id3/ID3.cpp
+++ b/media/libstagefright/id3/ID3.cpp
@@ -129,7 +129,7 @@
     }
 
     if (size > kMaxMetadataSize) {
-        LOGE("skipping huge ID3 metadata of size %d", size);
+        ALOGE("skipping huge ID3 metadata of size %d", size);
         return false;
     }
 
@@ -160,7 +160,7 @@
             success = removeUnsynchronizationV2_4(true /* iTunesHack */);
 
             if (success) {
-                LOGV("Had to apply the iTunes hack to parse this ID3 tag");
+                ALOGV("Had to apply the iTunes hack to parse this ID3 tag");
             }
         }
 
@@ -174,7 +174,7 @@
             return false;
         }
     } else if (header.flags & 0x80) {
-        LOGV("removing unsynchronization");
+        ALOGV("removing unsynchronization");
 
         removeUnsynchronization();
     }
@@ -219,7 +219,7 @@
             }
 
             if (extendedFlags & 0x8000) {
-                LOGV("have crc");
+                ALOGV("have crc");
             }
         }
     } else if (header.version_major == 4 && (header.flags & 0x40)) {
@@ -580,7 +580,7 @@
             mFrameSize += 6;
 
             if (mOffset + mFrameSize > mParent.mSize) {
-                LOGV("partial frame at offset %d (size = %d, bytes-remaining = %d)",
+                ALOGV("partial frame at offset %d (size = %d, bytes-remaining = %d)",
                      mOffset, mFrameSize, mParent.mSize - mOffset - 6);
                 return;
             }
@@ -621,7 +621,7 @@
             mFrameSize = 10 + baseSize;
 
             if (mOffset + mFrameSize > mParent.mSize) {
-                LOGV("partial frame at offset %d (size = %d, bytes-remaining = %d)",
+                ALOGV("partial frame at offset %d (size = %d, bytes-remaining = %d)",
                      mOffset, mFrameSize, mParent.mSize - mOffset - 10);
                 return;
             }
@@ -634,7 +634,7 @@
                 // Per-frame unsynchronization and data-length indicator
                 // have already been taken care of.
 
-                LOGV("Skipping unsupported frame (compression, encryption "
+                ALOGV("Skipping unsupported frame (compression, encryption "
                      "or per-frame unsynchronization flagged");
 
                 mOffset += mFrameSize;
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp
index 20a25d7..4fbf47e 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.cpp
+++ b/media/libstagefright/matroska/MatroskaExtractor.cpp
@@ -180,7 +180,7 @@
         CHECK_GE(avccSize, 5u);
 
         mNALSizeLen = 1 + (avcc[4] & 3);
-        LOGV("mNALSizeLen = %d", mNALSizeLen);
+        ALOGV("mNALSizeLen = %d", mNALSizeLen);
     } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC)) {
         mType = AAC;
     }
@@ -230,7 +230,7 @@
 void BlockIterator::advance_l() {
     for (;;) {
         long res = mCluster->GetEntry(mBlockEntryIndex, mBlockEntry);
-        LOGV("GetEntry returned %ld", res);
+        ALOGV("GetEntry returned %ld", res);
 
         long long pos;
         long len;
@@ -240,12 +240,12 @@
             CHECK_EQ(res, mkvparser::E_BUFFER_NOT_FULL);
 
             res = mCluster->Parse(pos, len);
-            LOGV("Parse returned %ld", res);
+            ALOGV("Parse returned %ld", res);
 
             if (res < 0) {
                 // I/O error
 
-                LOGE("Cluster::Parse returned result %ld", res);
+                ALOGE("Cluster::Parse returned result %ld", res);
 
                 mCluster = NULL;
                 break;
@@ -258,7 +258,7 @@
             const mkvparser::Cluster *nextCluster;
             res = mExtractor->mSegment->ParseNext(
                     mCluster, nextCluster, pos, len);
-            LOGV("ParseNext returned %ld", res);
+            ALOGV("ParseNext returned %ld", res);
 
             if (res > 0) {
                 // EOF
@@ -274,7 +274,7 @@
             mCluster = nextCluster;
 
             res = mCluster->Parse(pos, len);
-            LOGV("Parse (2) returned %ld", res);
+            ALOGV("Parse (2) returned %ld", res);
             CHECK_GE(res, 0);
 
             mBlockEntryIndex = 0;
@@ -563,7 +563,7 @@
 
 #if 0
     const mkvparser::SegmentInfo *info = mSegment->GetInfo();
-    LOGI("muxing app: %s, writing app: %s",
+    ALOGI("muxing app: %s, writing app: %s",
          info->GetMuxingAppAsUTF8(),
          info->GetWritingAppAsUTF8());
 #endif
@@ -687,8 +687,8 @@
         }
 
         const char *const codecID = track->GetCodecId();
-        LOGV("codec id = %s", codecID);
-        LOGV("codec name = %s", track->GetCodecNameAsUTF8());
+        ALOGV("codec id = %s", codecID);
+        ALOGV("codec name = %s", track->GetCodecNameAsUTF8());
 
         size_t codecPrivateSize;
         const unsigned char *codecPrivate =
diff --git a/media/libstagefright/mpeg2ts/ATSParser.cpp b/media/libstagefright/mpeg2ts/ATSParser.cpp
index 6cec63a..3f4de1f 100644
--- a/media/libstagefright/mpeg2ts/ATSParser.cpp
+++ b/media/libstagefright/mpeg2ts/ATSParser.cpp
@@ -39,7 +39,7 @@
 
 // I want the expression "y" evaluated even if verbose logging is off.
 #define MY_LOGV(x, y) \
-    do { unsigned tmp = y; LOGV(x, tmp); } while (0)
+    do { unsigned tmp = y; ALOGV(x, tmp); } while (0)
 
 static const size_t kTSPacketSize = 188;
 
@@ -138,7 +138,7 @@
       mProgramMapPID(programMapPID),
       mFirstPTSValid(false),
       mFirstPTS(0) {
-    LOGV("new program number %u", programNumber);
+    ALOGV("new program number %u", programNumber);
 }
 
 bool ATSParser::Program::parsePID(
@@ -188,18 +188,18 @@
 
 status_t ATSParser::Program::parseProgramMap(ABitReader *br) {
     unsigned table_id = br->getBits(8);
-    LOGV("  table_id = %u", table_id);
+    ALOGV("  table_id = %u", table_id);
     CHECK_EQ(table_id, 0x02u);
 
     unsigned section_syntax_indicator = br->getBits(1);
-    LOGV("  section_syntax_indicator = %u", section_syntax_indicator);
+    ALOGV("  section_syntax_indicator = %u", section_syntax_indicator);
     CHECK_EQ(section_syntax_indicator, 1u);
 
     CHECK_EQ(br->getBits(1), 0u);
     MY_LOGV("  reserved = %u", br->getBits(2));
 
     unsigned section_length = br->getBits(12);
-    LOGV("  section_length = %u", section_length);
+    ALOGV("  section_length = %u", section_length);
     CHECK_EQ(section_length & 0xc00, 0u);
     CHECK_LE(section_length, 1021u);
 
@@ -214,7 +214,7 @@
     MY_LOGV("  reserved = %u", br->getBits(4));
 
     unsigned program_info_length = br->getBits(12);
-    LOGV("  program_info_length = %u", program_info_length);
+    ALOGV("  program_info_length = %u", program_info_length);
     CHECK_EQ(program_info_length & 0xc00, 0u);
 
     br->skipBits(program_info_length * 8);  // skip descriptors
@@ -230,17 +230,17 @@
         CHECK_GE(infoBytesRemaining, 5u);
 
         unsigned streamType = br->getBits(8);
-        LOGV("    stream_type = 0x%02x", streamType);
+        ALOGV("    stream_type = 0x%02x", streamType);
 
         MY_LOGV("    reserved = %u", br->getBits(3));
 
         unsigned elementaryPID = br->getBits(13);
-        LOGV("    elementary_PID = 0x%04x", elementaryPID);
+        ALOGV("    elementary_PID = 0x%04x", elementaryPID);
 
         MY_LOGV("    reserved = %u", br->getBits(4));
 
         unsigned ES_info_length = br->getBits(12);
-        LOGV("    ES_info_length = %u", ES_info_length);
+        ALOGV("    ES_info_length = %u", ES_info_length);
         CHECK_EQ(ES_info_length & 0xc00, 0u);
 
         CHECK_GE(infoBytesRemaining - 5, ES_info_length);
@@ -253,7 +253,7 @@
             MY_LOGV("      tag = 0x%02x", br->getBits(8));
 
             unsigned descLength = br->getBits(8);
-            LOGV("      len = %u", descLength);
+            ALOGV("      len = %u", descLength);
 
             CHECK_GE(info_bytes_remaining, 2 + descLength);
 
@@ -282,7 +282,7 @@
         ssize_t index = mStreams.indexOfKey(info.mPID);
 
         if (index >= 0 && mStreams.editValueAt(index)->type() != info.mType) {
-            LOGI("uh oh. stream PIDs have changed.");
+            ALOGI("uh oh. stream PIDs have changed.");
             PIDsChanged = true;
             break;
         }
@@ -290,18 +290,18 @@
 
     if (PIDsChanged) {
 #if 0
-        LOGI("before:");
+        ALOGI("before:");
         for (size_t i = 0; i < mStreams.size(); ++i) {
             sp<Stream> stream = mStreams.editValueAt(i);
 
-            LOGI("PID 0x%08x => type 0x%02x", stream->pid(), stream->type());
+            ALOGI("PID 0x%08x => type 0x%02x", stream->pid(), stream->type());
         }
 
-        LOGI("after:");
+        ALOGI("after:");
         for (size_t i = 0; i < infos.size(); ++i) {
             StreamInfo &info = infos.editItemAt(i);
 
-            LOGI("PID 0x%08x => type 0x%02x", info.mPID, info.mType);
+            ALOGI("PID 0x%08x => type 0x%02x", info.mPID, info.mType);
         }
 #endif
 
@@ -340,7 +340,7 @@
         }
 
         if (!success) {
-            LOGI("Stream PIDs changed and we cannot recover.");
+            ALOGI("Stream PIDs changed and we cannot recover.");
             return ERROR_MALFORMED;
         }
     }
@@ -428,7 +428,7 @@
             break;
     }
 
-    LOGV("new stream PID 0x%02x, type 0x%02x", elementaryPID, streamType);
+    ALOGV("new stream PID 0x%02x, type 0x%02x", elementaryPID, streamType);
 
     if (mQueue != NULL) {
         mBuffer = new ABuffer(192 * 1024);
@@ -475,7 +475,7 @@
         // Increment in multiples of 64K.
         neededSize = (neededSize + 65535) & ~65535;
 
-        LOGI("resizing buffer to %d bytes", neededSize);
+        ALOGI("resizing buffer to %d bytes", neededSize);
 
         sp<ABuffer> newBuffer = new ABuffer(neededSize);
         memcpy(newBuffer->data(), mBuffer->data(), mBuffer->size());
@@ -563,10 +563,10 @@
 status_t ATSParser::Stream::parsePES(ABitReader *br) {
     unsigned packet_startcode_prefix = br->getBits(24);
 
-    LOGV("packet_startcode_prefix = 0x%08x", packet_startcode_prefix);
+    ALOGV("packet_startcode_prefix = 0x%08x", packet_startcode_prefix);
 
     if (packet_startcode_prefix != 1) {
-        LOGV("Supposedly payload_unit_start=1 unit does not start "
+        ALOGV("Supposedly payload_unit_start=1 unit does not start "
              "with startcode.");
 
         return ERROR_MALFORMED;
@@ -575,10 +575,10 @@
     CHECK_EQ(packet_startcode_prefix, 0x000001u);
 
     unsigned stream_id = br->getBits(8);
-    LOGV("stream_id = 0x%02x", stream_id);
+    ALOGV("stream_id = 0x%02x", stream_id);
 
     unsigned PES_packet_length = br->getBits(16);
-    LOGV("PES_packet_length = %u", PES_packet_length);
+    ALOGV("PES_packet_length = %u", PES_packet_length);
 
     if (stream_id != 0xbc  // program_stream_map
             && stream_id != 0xbe  // padding_stream
@@ -597,25 +597,25 @@
         MY_LOGV("original_or_copy = %u", br->getBits(1));
 
         unsigned PTS_DTS_flags = br->getBits(2);
-        LOGV("PTS_DTS_flags = %u", PTS_DTS_flags);
+        ALOGV("PTS_DTS_flags = %u", PTS_DTS_flags);
 
         unsigned ESCR_flag = br->getBits(1);
-        LOGV("ESCR_flag = %u", ESCR_flag);
+        ALOGV("ESCR_flag = %u", ESCR_flag);
 
         unsigned ES_rate_flag = br->getBits(1);
-        LOGV("ES_rate_flag = %u", ES_rate_flag);
+        ALOGV("ES_rate_flag = %u", ES_rate_flag);
 
         unsigned DSM_trick_mode_flag = br->getBits(1);
-        LOGV("DSM_trick_mode_flag = %u", DSM_trick_mode_flag);
+        ALOGV("DSM_trick_mode_flag = %u", DSM_trick_mode_flag);
 
         unsigned additional_copy_info_flag = br->getBits(1);
-        LOGV("additional_copy_info_flag = %u", additional_copy_info_flag);
+        ALOGV("additional_copy_info_flag = %u", additional_copy_info_flag);
 
         MY_LOGV("PES_CRC_flag = %u", br->getBits(1));
         MY_LOGV("PES_extension_flag = %u", br->getBits(1));
 
         unsigned PES_header_data_length = br->getBits(8);
-        LOGV("PES_header_data_length = %u", PES_header_data_length);
+        ALOGV("PES_header_data_length = %u", PES_header_data_length);
 
         unsigned optional_bytes_remaining = PES_header_data_length;
 
@@ -633,8 +633,8 @@
             PTS |= br->getBits(15);
             CHECK_EQ(br->getBits(1), 1u);
 
-            LOGV("PTS = %llu", PTS);
-            // LOGI("PTS = %.2f secs", PTS / 90000.0f);
+            ALOGV("PTS = %llu", PTS);
+            // ALOGI("PTS = %.2f secs", PTS / 90000.0f);
 
             optional_bytes_remaining -= 5;
 
@@ -650,7 +650,7 @@
                 DTS |= br->getBits(15);
                 CHECK_EQ(br->getBits(1), 1u);
 
-                LOGV("DTS = %llu", DTS);
+                ALOGV("DTS = %llu", DTS);
 
                 optional_bytes_remaining -= 5;
             }
@@ -668,7 +668,7 @@
             ESCR |= br->getBits(15);
             CHECK_EQ(br->getBits(1), 1u);
 
-            LOGV("ESCR = %llu", ESCR);
+            ALOGV("ESCR = %llu", ESCR);
             MY_LOGV("ESCR_extension = %u", br->getBits(9));
 
             CHECK_EQ(br->getBits(1), 1u);
@@ -697,7 +697,7 @@
                 PES_packet_length - 3 - PES_header_data_length;
 
             if (br->numBitsLeft() < dataLength * 8) {
-                LOGE("PES packet does not carry enough data to contain "
+                ALOGE("PES packet does not carry enough data to contain "
                      "payload. (numBitsLeft = %d, required = %d)",
                      br->numBitsLeft(), dataLength * 8);
 
@@ -718,7 +718,7 @@
             size_t payloadSizeBits = br->numBitsLeft();
             CHECK_EQ(payloadSizeBits % 8, 0u);
 
-            LOGV("There's %d bytes of payload.", payloadSizeBits / 8);
+            ALOGV("There's %d bytes of payload.", payloadSizeBits / 8);
         }
     } else if (stream_id == 0xbe) {  // padding_stream
         CHECK_NE(PES_packet_length, 0u);
@@ -736,7 +736,7 @@
         return OK;
     }
 
-    LOGV("flushing stream 0x%04x size = %d", mElementaryPID, mBuffer->size());
+    ALOGV("flushing stream 0x%04x size = %d", mElementaryPID, mBuffer->size());
 
     ABitReader br(mBuffer->data(), mBuffer->size());
 
@@ -750,7 +750,7 @@
 void ATSParser::Stream::onPayloadData(
         unsigned PTS_DTS_flags, uint64_t PTS, uint64_t DTS,
         const uint8_t *data, size_t size) {
-    LOGV("onPayloadData mStreamType=0x%02x", mStreamType);
+    ALOGV("onPayloadData mStreamType=0x%02x", mStreamType);
 
     int64_t timeUs = 0ll;  // no presentation timestamp available.
     if (PTS_DTS_flags == 2 || PTS_DTS_flags == 3) {
@@ -769,7 +769,7 @@
             sp<MetaData> meta = mQueue->getFormat();
 
             if (meta != NULL) {
-                LOGV("Stream PID 0x%08x of type 0x%02x now has data.",
+                ALOGV("Stream PID 0x%08x of type 0x%02x now has data.",
                      mElementaryPID, mStreamType);
 
                 mSource = new AnotherPacketSource(meta);
@@ -846,18 +846,18 @@
 
 void ATSParser::parseProgramAssociationTable(ABitReader *br) {
     unsigned table_id = br->getBits(8);
-    LOGV("  table_id = %u", table_id);
+    ALOGV("  table_id = %u", table_id);
     CHECK_EQ(table_id, 0x00u);
 
     unsigned section_syntax_indictor = br->getBits(1);
-    LOGV("  section_syntax_indictor = %u", section_syntax_indictor);
+    ALOGV("  section_syntax_indictor = %u", section_syntax_indictor);
     CHECK_EQ(section_syntax_indictor, 1u);
 
     CHECK_EQ(br->getBits(1), 0u);
     MY_LOGV("  reserved = %u", br->getBits(2));
 
     unsigned section_length = br->getBits(12);
-    LOGV("  section_length = %u", section_length);
+    ALOGV("  section_length = %u", section_length);
     CHECK_EQ(section_length & 0xc00, 0u);
 
     MY_LOGV("  transport_stream_id = %u", br->getBits(16));
@@ -872,7 +872,7 @@
 
     for (size_t i = 0; i < numProgramBytes / 4; ++i) {
         unsigned program_number = br->getBits(16);
-        LOGV("    program_number = %u", program_number);
+        ALOGV("    program_number = %u", program_number);
 
         MY_LOGV("    reserved = %u", br->getBits(3));
 
@@ -881,7 +881,7 @@
         } else {
             unsigned programMapPID = br->getBits(13);
 
-            LOGV("    program_map_PID = 0x%04x", programMapPID);
+            ALOGV("    program_map_PID = 0x%04x", programMapPID);
 
             bool found = false;
             for (size_t index = 0; index < mPrograms.size(); ++index) {
@@ -931,7 +931,7 @@
     }
 
     if (!handled) {
-        LOGV("PID 0x%04x not handled.", PID);
+        ALOGV("PID 0x%04x not handled.", PID);
     }
 
     return OK;
@@ -945,7 +945,7 @@
 }
 
 status_t ATSParser::parseTS(ABitReader *br) {
-    LOGV("---");
+    ALOGV("---");
 
     unsigned sync_byte = br->getBits(8);
     CHECK_EQ(sync_byte, 0x47u);
@@ -953,22 +953,22 @@
     MY_LOGV("transport_error_indicator = %u", br->getBits(1));
 
     unsigned payload_unit_start_indicator = br->getBits(1);
-    LOGV("payload_unit_start_indicator = %u", payload_unit_start_indicator);
+    ALOGV("payload_unit_start_indicator = %u", payload_unit_start_indicator);
 
     MY_LOGV("transport_priority = %u", br->getBits(1));
 
     unsigned PID = br->getBits(13);
-    LOGV("PID = 0x%04x", PID);
+    ALOGV("PID = 0x%04x", PID);
 
     MY_LOGV("transport_scrambling_control = %u", br->getBits(2));
 
     unsigned adaptation_field_control = br->getBits(2);
-    LOGV("adaptation_field_control = %u", adaptation_field_control);
+    ALOGV("adaptation_field_control = %u", adaptation_field_control);
 
     unsigned continuity_counter = br->getBits(4);
-    LOGV("continuity_counter = %u", continuity_counter);
+    ALOGV("continuity_counter = %u", continuity_counter);
 
-    // LOGI("PID = 0x%04x, continuity_counter = %u", PID, continuity_counter);
+    // ALOGI("PID = 0x%04x, continuity_counter = %u", PID, continuity_counter);
 
     if (adaptation_field_control == 2 || adaptation_field_control == 3) {
         parseAdaptationField(br);
diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp
index f782ce5..d708ba6 100644
--- a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp
+++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp
@@ -143,7 +143,7 @@
 
     int64_t timeUs;
     CHECK(buffer->meta()->findInt64("timeUs", &timeUs));
-    LOGV("queueAccessUnit timeUs=%lld us (%.2f secs)", timeUs, timeUs / 1E6);
+    ALOGV("queueAccessUnit timeUs=%lld us (%.2f secs)", timeUs, timeUs / 1E6);
 
     Mutex::Autolock autoLock(mLock);
     mBuffers.push_back(buffer);
diff --git a/media/libstagefright/mpeg2ts/ESQueue.cpp b/media/libstagefright/mpeg2ts/ESQueue.cpp
index b9a4826..7fd99a8 100644
--- a/media/libstagefright/mpeg2ts/ESQueue.cpp
+++ b/media/libstagefright/mpeg2ts/ESQueue.cpp
@@ -144,7 +144,7 @@
                 }
 
                 if (startOffset > 0) {
-                    LOGI("found something resembling an H.264/MPEG syncword at "
+                    ALOGI("found something resembling an H.264/MPEG syncword at "
                          "offset %ld",
                          startOffset);
                 }
@@ -177,7 +177,7 @@
                 }
 
                 if (startOffset > 0) {
-                    LOGI("found something resembling an H.264/MPEG syncword at "
+                    ALOGI("found something resembling an H.264/MPEG syncword at "
                          "offset %ld",
                          startOffset);
                 }
@@ -210,7 +210,7 @@
                 }
 
                 if (startOffset > 0) {
-                    LOGI("found something resembling an AAC syncword at offset %ld",
+                    ALOGI("found something resembling an AAC syncword at offset %ld",
                          startOffset);
                 }
 
@@ -237,7 +237,7 @@
                 }
 
                 if (startOffset > 0) {
-                    LOGI("found something resembling an MPEG audio "
+                    ALOGI("found something resembling an MPEG audio "
                          "syncword at offset %ld",
                          startOffset);
                 }
@@ -257,7 +257,7 @@
     if (mBuffer == NULL || neededSize > mBuffer->capacity()) {
         neededSize = (neededSize + 65535) & ~65535;
 
-        LOGV("resizing buffer to size %d", neededSize);
+        ALOGV("resizing buffer to size %d", neededSize);
 
         sp<ABuffer> buffer = new ABuffer(neededSize);
         if (mBuffer != NULL) {
@@ -280,7 +280,7 @@
 
 #if 0
     if (mMode == AAC) {
-        LOGI("size = %d, timeUs = %.2f secs", size, timeUs / 1E6);
+        ALOGI("size = %d, timeUs = %.2f secs", size, timeUs / 1E6);
         hexdump(data, size);
     }
 #endif
@@ -337,7 +337,7 @@
             CHECK(mFormat->findInt32(kKeySampleRate, &sampleRate));
             CHECK(mFormat->findInt32(kKeyChannelCount, &numChannels));
 
-            LOGI("found AAC codec config (%d Hz, %d channels)",
+            ALOGI("found AAC codec config (%d Hz, %d channels)",
                  sampleRate, numChannels);
         } else {
             // profile_ObjectType, sampling_frequency_index, private_bits,
@@ -408,7 +408,7 @@
     if (timeUs >= 0) {
         accessUnit->meta()->setInt64("timeUs", timeUs);
     } else {
-        LOGW("no time for AAC access unit");
+        ALOGW("no time for AAC access unit");
     }
 
     return accessUnit;
@@ -445,7 +445,7 @@
     }
 
     if (timeUs == 0ll) {
-        LOGV("Returning 0 timestamp");
+        ALOGV("Returning 0 timestamp");
     }
 
     return timeUs;
@@ -529,7 +529,7 @@
                 dstOffset += pos.nalSize + 4;
             }
 
-            LOGV("accessUnit contains nal types %s", out.c_str());
+            ALOGV("accessUnit contains nal types %s", out.c_str());
 
             const NALPosition &pos = nals.itemAt(nals.size() - 1);
             size_t nextScan = pos.nalOffset + pos.nalSize;
@@ -714,7 +714,7 @@
                 mFormat->setInt32(kKeyWidth, width);
                 mFormat->setInt32(kKeyHeight, height);
 
-                LOGI("found MPEG2 video codec config (%d x %d)", width, height);
+                ALOGI("found MPEG2 video codec config (%d x %d)", width, height);
 
                 sp<ABuffer> csd = new ABuffer(offset);
                 memcpy(csd->data(), data, offset);
@@ -760,7 +760,7 @@
 
                 accessUnit->meta()->setInt64("timeUs", timeUs);
 
-                LOGV("returning MPEG video access unit at time %lld us",
+                ALOGV("returning MPEG video access unit at time %lld us",
                       timeUs);
 
                 // hexdump(accessUnit->data(), accessUnit->size());
@@ -880,7 +880,7 @@
                     mFormat->setInt32(kKeyWidth, width);
                     mFormat->setInt32(kKeyHeight, height);
 
-                    LOGI("found MPEG4 video codec config (%d x %d)",
+                    ALOGI("found MPEG4 video codec config (%d x %d)",
                          width, height);
 
                     sp<ABuffer> csd = new ABuffer(offset);
@@ -919,7 +919,7 @@
 
                     accessUnit->meta()->setInt64("timeUs", timeUs);
 
-                    LOGV("returning MPEG4 video access unit at time %lld us",
+                    ALOGV("returning MPEG4 video access unit at time %lld us",
                          timeUs);
 
                     // hexdump(accessUnit->data(), accessUnit->size());
diff --git a/media/libstagefright/mpeg2ts/MPEG2PSExtractor.cpp b/media/libstagefright/mpeg2ts/MPEG2PSExtractor.cpp
index a089dbf..dd714c9 100644
--- a/media/libstagefright/mpeg2ts/MPEG2PSExtractor.cpp
+++ b/media/libstagefright/mpeg2ts/MPEG2PSExtractor.cpp
@@ -274,10 +274,10 @@
 
     unsigned packet_startcode_prefix = br.getBits(24);
 
-    LOGV("packet_startcode_prefix = 0x%08x", packet_startcode_prefix);
+    ALOGV("packet_startcode_prefix = 0x%08x", packet_startcode_prefix);
 
     if (packet_startcode_prefix != 1) {
-        LOGV("Supposedly payload_unit_start=1 unit does not start "
+        ALOGV("Supposedly payload_unit_start=1 unit does not start "
              "with startcode.");
 
         return ERROR_MALFORMED;
@@ -286,7 +286,7 @@
     CHECK_EQ(packet_startcode_prefix, 0x000001u);
 
     unsigned stream_id = br.getBits(8);
-    LOGV("stream_id = 0x%02x", stream_id);
+    ALOGV("stream_id = 0x%02x", stream_id);
 
     /* unsigned PES_packet_length = */br.getBits(16);
 
@@ -315,7 +315,7 @@
             unsigned descriptor_tag = br.getBits(8);
             unsigned descriptor_length = br.getBits(8);
 
-            LOGI("found descriptor tag 0x%02x of length %u",
+            ALOGI("found descriptor tag 0x%02x of length %u",
                  descriptor_tag, descriptor_length);
 
             if (offset + 2 + descriptor_length > program_stream_info_length) {
@@ -338,7 +338,7 @@
             unsigned stream_type = br.getBits(8);
             unsigned elementary_stream_id = br.getBits(8);
 
-            LOGI("elementary stream id 0x%02x has stream type 0x%02x",
+            ALOGI("elementary stream id 0x%02x has stream type 0x%02x",
                  elementary_stream_id, stream_type);
 
             mStreamTypeByESID.add(elementary_stream_id, stream_type);
@@ -372,25 +372,25 @@
         /* unsigned original_or_copy = */br.getBits(1);
 
         unsigned PTS_DTS_flags = br.getBits(2);
-        LOGV("PTS_DTS_flags = %u", PTS_DTS_flags);
+        ALOGV("PTS_DTS_flags = %u", PTS_DTS_flags);
 
         unsigned ESCR_flag = br.getBits(1);
-        LOGV("ESCR_flag = %u", ESCR_flag);
+        ALOGV("ESCR_flag = %u", ESCR_flag);
 
         unsigned ES_rate_flag = br.getBits(1);
-        LOGV("ES_rate_flag = %u", ES_rate_flag);
+        ALOGV("ES_rate_flag = %u", ES_rate_flag);
 
         unsigned DSM_trick_mode_flag = br.getBits(1);
-        LOGV("DSM_trick_mode_flag = %u", DSM_trick_mode_flag);
+        ALOGV("DSM_trick_mode_flag = %u", DSM_trick_mode_flag);
 
         unsigned additional_copy_info_flag = br.getBits(1);
-        LOGV("additional_copy_info_flag = %u", additional_copy_info_flag);
+        ALOGV("additional_copy_info_flag = %u", additional_copy_info_flag);
 
         /* unsigned PES_CRC_flag = */br.getBits(1);
         /* PES_extension_flag = */br.getBits(1);
 
         unsigned PES_header_data_length = br.getBits(8);
-        LOGV("PES_header_data_length = %u", PES_header_data_length);
+        ALOGV("PES_header_data_length = %u", PES_header_data_length);
 
         unsigned optional_bytes_remaining = PES_header_data_length;
 
@@ -408,8 +408,8 @@
             PTS |= br.getBits(15);
             CHECK_EQ(br.getBits(1), 1u);
 
-            LOGV("PTS = %llu", PTS);
-            // LOGI("PTS = %.2f secs", PTS / 90000.0f);
+            ALOGV("PTS = %llu", PTS);
+            // ALOGI("PTS = %.2f secs", PTS / 90000.0f);
 
             optional_bytes_remaining -= 5;
 
@@ -425,7 +425,7 @@
                 DTS |= br.getBits(15);
                 CHECK_EQ(br.getBits(1), 1u);
 
-                LOGV("DTS = %llu", DTS);
+                ALOGV("DTS = %llu", DTS);
 
                 optional_bytes_remaining -= 5;
             }
@@ -443,7 +443,7 @@
             ESCR |= br.getBits(15);
             CHECK_EQ(br.getBits(1), 1u);
 
-            LOGV("ESCR = %llu", ESCR);
+            ALOGV("ESCR = %llu", ESCR);
             /* unsigned ESCR_extension = */br.getBits(9);
 
             CHECK_EQ(br.getBits(1), 1u);
@@ -471,7 +471,7 @@
             PES_packet_length - 3 - PES_header_data_length;
 
         if (br.numBitsLeft() < dataLength * 8) {
-            LOGE("PES packet does not carry enough data to contain "
+            ALOGE("PES packet does not carry enough data to contain "
                  "payload. (numBitsLeft = %d, required = %d)",
                  br.numBitsLeft(), dataLength * 8);
 
@@ -568,7 +568,7 @@
     if (supported) {
         mQueue = new ElementaryStreamQueue(mode);
     } else {
-        LOGI("unsupported stream ID 0x%02x", stream_id);
+        ALOGI("unsupported stream ID 0x%02x", stream_id);
     }
 }
 
@@ -650,7 +650,7 @@
             sp<MetaData> meta = mQueue->getFormat();
 
             if (meta != NULL) {
-                LOGV("Stream ID 0x%02x now has data.", mStreamID);
+                ALOGV("Stream ID 0x%02x now has data.", mStreamID);
 
                 mSource = new AnotherPacketSource(meta);
                 mSource->queueAccessUnit(accessUnit);
diff --git a/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp b/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp
index 17cf45a..03033f5 100644
--- a/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp
+++ b/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp
@@ -199,7 +199,7 @@
         }
     }
 
-    LOGI("haveAudio=%d, haveVideo=%d", haveAudio, haveVideo);
+    ALOGI("haveAudio=%d, haveVideo=%d", haveAudio, haveVideo);
 }
 
 status_t MPEG2TSExtractor::feedMore() {
diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp
index 3715fe9..694b12d8 100644
--- a/media/libstagefright/omx/OMX.cpp
+++ b/media/libstagefright/omx/OMX.cpp
@@ -115,7 +115,7 @@
 
 void OMX::CallbackDispatcher::dispatch(const omx_message &msg) {
     if (mOwner == NULL) {
-        LOGV("Would have dispatched a message to a node that's already gone.");
+        ALOGV("Would have dispatched a message to a node that's already gone.");
         return;
     }
     mOwner->onMessage(msg);
@@ -231,7 +231,7 @@
             instance, &handle);
 
     if (err != OMX_ErrorNone) {
-        LOGV("FAILED to allocate omx component '%s'", name);
+        ALOGV("FAILED to allocate omx component '%s'", name);
 
         instance->onGetHandleFailed();
 
@@ -384,7 +384,7 @@
         OMX_IN OMX_U32 nData1,
         OMX_IN OMX_U32 nData2,
         OMX_IN OMX_PTR pEventData) {
-    LOGV("OnEvent(%d, %ld, %ld)", eEvent, nData1, nData2);
+    ALOGV("OnEvent(%d, %ld, %ld)", eEvent, nData1, nData2);
 
     omx_message msg;
     msg.type = omx_message::EVENT;
@@ -400,7 +400,7 @@
 
 OMX_ERRORTYPE OMX::OnEmptyBufferDone(
         node_id node, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer) {
-    LOGV("OnEmptyBufferDone buffer=%p", pBuffer);
+    ALOGV("OnEmptyBufferDone buffer=%p", pBuffer);
 
     omx_message msg;
     msg.type = omx_message::EMPTY_BUFFER_DONE;
@@ -414,7 +414,7 @@
 
 OMX_ERRORTYPE OMX::OnFillBufferDone(
         node_id node, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer) {
-    LOGV("OnFillBufferDone buffer=%p", pBuffer);
+    ALOGV("OnFillBufferDone buffer=%p", pBuffer);
 
     omx_message msg;
     msg.type = omx_message::FILL_BUFFER_DONE;
diff --git a/media/libstagefright/omx/OMXMaster.cpp b/media/libstagefright/omx/OMXMaster.cpp
index c8278ab..d698939 100644
--- a/media/libstagefright/omx/OMXMaster.cpp
+++ b/media/libstagefright/omx/OMXMaster.cpp
@@ -81,7 +81,7 @@
         String8 name8(name);
 
         if (mPluginByComponentName.indexOfKey(name8) >= 0) {
-            LOGE("A component of name '%s' already exists, ignoring this one.",
+            ALOGE("A component of name '%s' already exists, ignoring this one.",
                  name8.string());
 
             continue;
@@ -91,7 +91,7 @@
     }
 
     if (err != OMX_ErrorNoMore) {
-        LOGE("OMX plugin failed w/ error 0x%08x after registering %d "
+        ALOGE("OMX plugin failed w/ error 0x%08x after registering %d "
              "components", err, mPluginByComponentName.size());
     }
 }
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index 0ff398a..8938e33 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -142,7 +142,7 @@
     switch (state) {
         case OMX_StateExecuting:
         {
-            LOGV("forcing Executing->Idle");
+            ALOGV("forcing Executing->Idle");
             sendCommand(OMX_CommandStateSet, OMX_StateIdle);
             OMX_ERRORTYPE err;
             int32_t iteration = 0;
@@ -150,7 +150,7 @@
                    && state != OMX_StateIdle
                    && state != OMX_StateInvalid) {
                 if (++iteration > kMaxNumIterations) {
-                    LOGE("component failed to enter Idle state, aborting.");
+                    ALOGE("component failed to enter Idle state, aborting.");
                     state = OMX_StateInvalid;
                     break;
                 }
@@ -168,7 +168,7 @@
 
         case OMX_StateIdle:
         {
-            LOGV("forcing Idle->Loaded");
+            ALOGV("forcing Idle->Loaded");
             sendCommand(OMX_CommandStateSet, OMX_StateLoaded);
 
             freeActiveBuffers();
@@ -179,12 +179,12 @@
                    && state != OMX_StateLoaded
                    && state != OMX_StateInvalid) {
                 if (++iteration > kMaxNumIterations) {
-                    LOGE("component failed to enter Loaded state, aborting.");
+                    ALOGE("component failed to enter Loaded state, aborting.");
                     state = OMX_StateInvalid;
                     break;
                 }
 
-                LOGV("waiting for Loaded state...");
+                ALOGV("waiting for Loaded state...");
                 usleep(100000);
             }
             CHECK_EQ(err, OMX_ErrorNone);
@@ -201,21 +201,21 @@
             break;
     }
 
-    LOGV("calling destroyComponentInstance");
+    ALOGV("calling destroyComponentInstance");
     OMX_ERRORTYPE err = master->destroyComponentInstance(
             static_cast<OMX_COMPONENTTYPE *>(mHandle));
-    LOGV("destroyComponentInstance returned err %d", err);
+    ALOGV("destroyComponentInstance returned err %d", err);
 
     mHandle = NULL;
 
     if (err != OMX_ErrorNone) {
-        LOGE("FreeHandle FAILED with error 0x%08x.", err);
+        ALOGE("FreeHandle FAILED with error 0x%08x.", err);
     }
 
     mOwner->invalidateNodeID(mNodeID);
     mNodeID = NULL;
 
-    LOGV("OMXNodeInstance going away.");
+    ALOGV("OMXNodeInstance going away.");
     delete this;
 
     return StatusFromOMXError(err);
@@ -285,7 +285,7 @@
             &index);
 
     if (err != OMX_ErrorNone) {
-        LOGE("OMX_GetExtensionIndex failed");
+        ALOGE("OMX_GetExtensionIndex failed");
 
         return StatusFromOMXError(err);
     }
@@ -302,7 +302,7 @@
     err = OMX_SetParameter(mHandle, index, &params);
 
     if (err != OMX_ErrorNone) {
-        LOGE("OMX_EnableAndroidNativeBuffers failed with error %d (0x%08x)",
+        ALOGE("OMX_EnableAndroidNativeBuffers failed with error %d (0x%08x)",
                 err, err);
 
         return UNKNOWN_ERROR;
@@ -323,7 +323,7 @@
             &index);
 
     if (err != OMX_ErrorNone) {
-        LOGE("OMX_GetExtensionIndex failed");
+        ALOGE("OMX_GetExtensionIndex failed");
 
         return StatusFromOMXError(err);
     }
@@ -340,7 +340,7 @@
     err = OMX_GetParameter(mHandle, index, &params);
 
     if (err != OMX_ErrorNone) {
-        LOGE("OMX_GetAndroidNativeBufferUsage failed with error %d (0x%08x)",
+        ALOGE("OMX_GetAndroidNativeBufferUsage failed with error %d (0x%08x)",
                 err, err);
         return UNKNOWN_ERROR;
     }
@@ -361,7 +361,7 @@
 
     OMX_ERRORTYPE err = OMX_GetExtensionIndex(mHandle, name, &index);
     if (err != OMX_ErrorNone) {
-        LOGE("OMX_GetExtensionIndex %s failed", name);
+        ALOGE("OMX_GetExtensionIndex %s failed", name);
         return StatusFromOMXError(err);
     }
 
@@ -375,7 +375,7 @@
     params.nPortIndex = portIndex;
     params.bStoreMetaData = enable;
     if ((err = OMX_SetParameter(mHandle, index, &params)) != OMX_ErrorNone) {
-        LOGE("OMX_SetParameter() failed for StoreMetaDataInBuffers: 0x%08x", err);
+        ALOGE("OMX_SetParameter() failed for StoreMetaDataInBuffers: 0x%08x", err);
         return UNKNOWN_ERROR;
     }
     return err;
@@ -395,7 +395,7 @@
             params->size(), static_cast<OMX_U8 *>(params->pointer()));
 
     if (err != OMX_ErrorNone) {
-        LOGE("OMX_UseBuffer failed with error %d (0x%08x)", err, err);
+        ALOGE("OMX_UseBuffer failed with error %d (0x%08x)", err, err);
 
         delete buffer_meta;
         buffer_meta = NULL;
@@ -429,7 +429,7 @@
     OMX_ERRORTYPE err = OMX_GetParameter(mHandle, OMX_IndexParamPortDefinition, &def);
     if (err != OMX_ErrorNone)
     {
-        LOGE("%s::%d:Error getting OMX_IndexParamPortDefinition", __FUNCTION__, __LINE__);
+        ALOGE("%s::%d:Error getting OMX_IndexParamPortDefinition", __FUNCTION__, __LINE__);
         return err;
     }
 
@@ -448,7 +448,7 @@
             bufferHandle);
 
     if (err != OMX_ErrorNone) {
-        LOGE("OMX_UseBuffer failed with error %d (0x%08x)", err, err);
+        ALOGE("OMX_UseBuffer failed with error %d (0x%08x)", err, err);
         delete bufferMeta;
         bufferMeta = NULL;
         *buffer = 0;
@@ -488,7 +488,7 @@
             &index);
 
     if (err != OMX_ErrorNone) {
-        LOGE("OMX_GetExtensionIndex failed");
+        ALOGE("OMX_GetExtensionIndex failed");
 
         return StatusFromOMXError(err);
     }
@@ -510,7 +510,7 @@
     err = OMX_SetParameter(mHandle, index, &params);
 
     if (err != OMX_ErrorNone) {
-        LOGE("OMX_UseAndroidNativeBuffer failed with error %d (0x%08x)", err,
+        ALOGE("OMX_UseAndroidNativeBuffer failed with error %d (0x%08x)", err,
                 err);
 
         delete bufferMeta;
@@ -543,7 +543,7 @@
             mHandle, &header, portIndex, buffer_meta, size);
 
     if (err != OMX_ErrorNone) {
-        LOGE("OMX_AllocateBuffer failed with error %d (0x%08x)", err, err);
+        ALOGE("OMX_AllocateBuffer failed with error %d (0x%08x)", err, err);
 
         delete buffer_meta;
         buffer_meta = NULL;
@@ -576,7 +576,7 @@
             mHandle, &header, portIndex, buffer_meta, params->size());
 
     if (err != OMX_ErrorNone) {
-        LOGE("OMX_AllocateBuffer failed with error %d (0x%08x)", err, err);
+        ALOGE("OMX_AllocateBuffer failed with error %d (0x%08x)", err, err);
 
         delete buffer_meta;
         buffer_meta = NULL;
@@ -672,7 +672,7 @@
 }
 
 void OMXNodeInstance::onObserverDied(OMXMaster *master) {
-    LOGE("!!! Observer died. Quickly, do something, ... anything...");
+    ALOGE("!!! Observer died. Quickly, do something, ... anything...");
 
     // Try to force shutdown of the node and hope for the best.
     freeNode(master);
@@ -742,7 +742,7 @@
     }
 
     if (!found) {
-        LOGW("Attempt to remove an active buffer we know nothing about...");
+        ALOGW("Attempt to remove an active buffer we know nothing about...");
     }
 }
 
diff --git a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
index b705d00..0914f32 100644
--- a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
+++ b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
@@ -589,7 +589,7 @@
 
         if (port->mTransition == PortInfo::DISABLING) {
             if (port->mBuffers.empty()) {
-                LOGV("Port %d now disabled.", i);
+                ALOGV("Port %d now disabled.", i);
 
                 port->mTransition = PortInfo::NONE;
                 notify(OMX_EventCmdComplete, OMX_CommandPortDisable, i, NULL);
@@ -598,7 +598,7 @@
             }
         } else if (port->mTransition == PortInfo::ENABLING) {
             if (port->mDef.bPopulated == OMX_TRUE) {
-                LOGV("Port %d now enabled.", i);
+                ALOGV("Port %d now enabled.", i);
 
                 port->mTransition = PortInfo::NONE;
                 port->mDef.bEnabled = OMX_TRUE;
diff --git a/media/libstagefright/omx/SoftOMXPlugin.cpp b/media/libstagefright/omx/SoftOMXPlugin.cpp
index 1e33f05f..da3ae42 100644
--- a/media/libstagefright/omx/SoftOMXPlugin.cpp
+++ b/media/libstagefright/omx/SoftOMXPlugin.cpp
@@ -58,7 +58,7 @@
         const OMX_CALLBACKTYPE *callbacks,
         OMX_PTR appData,
         OMX_COMPONENTTYPE **component) {
-    LOGV("makeComponentInstance '%s'", name);
+    ALOGV("makeComponentInstance '%s'", name);
 
     for (size_t i = 0; i < kNumComponents; ++i) {
         if (strcmp(name, kComponents[i].mName)) {
@@ -72,7 +72,7 @@
         void *libHandle = dlopen(libName.c_str(), RTLD_NOW);
 
         if (libHandle == NULL) {
-            LOGE("unable to dlopen %s", libName.c_str());
+            ALOGE("unable to dlopen %s", libName.c_str());
 
             return OMX_ErrorComponentNotFound;
         }
diff --git a/media/libstagefright/omx/tests/OMXHarness.cpp b/media/libstagefright/omx/tests/OMXHarness.cpp
index d4354db..8faf544 100644
--- a/media/libstagefright/omx/tests/OMXHarness.cpp
+++ b/media/libstagefright/omx/tests/OMXHarness.cpp
@@ -174,7 +174,7 @@
 
 #define EXPECT(condition, info) \
     if (!(condition)) {         \
-        LOGE(info); printf("\n  * " info "\n"); return UNKNOWN_ERROR; \
+        ALOGE(info); printf("\n  * " info "\n"); return UNKNOWN_ERROR; \
     }
 
 #define EXPECT_SUCCESS(err, info) \
@@ -571,7 +571,7 @@
     const char *mime = GetMimeFromComponentRole(componentRole);
 
     if (!mime) {
-        LOGI("Cannot perform seek test with this componentRole (%s)",
+        ALOGI("Cannot perform seek test with this componentRole (%s)",
              componentRole);
 
         return OK;
@@ -597,7 +597,7 @@
     int64_t durationUs;
     CHECK(source->getFormat()->findInt64(kKeyDuration, &durationUs));
 
-    LOGI("stream duration is %lld us (%.2f secs)",
+    ALOGI("stream duration is %lld us (%.2f secs)",
          durationUs, durationUs / 1E6);
 
     static const int32_t kNumIterations = 5000;
@@ -617,19 +617,19 @@
 
             requestedSeekTimeUs = -1;
 
-            LOGI("requesting linear read");
+            ALOGI("requesting linear read");
         } else {
             if (i == 0 || r < 0.55) {
                 // 5% chance of seeking beyond end of stream.
 
                 requestedSeekTimeUs = durationUs;
 
-                LOGI("requesting seek beyond EOF");
+                ALOGI("requesting seek beyond EOF");
             } else {
                 requestedSeekTimeUs =
                     (int64_t)(uniform_rand() * durationUs);
 
-                LOGI("requesting seek to %lld us (%.2f secs)",
+                ALOGI("requesting seek to %lld us (%.2f secs)",
                      requestedSeekTimeUs, requestedSeekTimeUs / 1E6);
             }
 
@@ -649,7 +649,7 @@
                 buffer = NULL;
             }
 
-            LOGI("nearest keyframe is at %lld us (%.2f secs)",
+            ALOGI("nearest keyframe is at %lld us (%.2f secs)",
                  actualSeekTimeUs, actualSeekTimeUs / 1E6);
         }
 
@@ -733,7 +733,7 @@
 status_t Harness::test(
         const char *componentName, const char *componentRole) {
     printf("testing %s [%s] ... ", componentName, componentRole);
-    LOGI("testing %s [%s].", componentName, componentRole);
+    ALOGI("testing %s [%s].", componentName, componentRole);
 
     status_t err1 = testStateTransitions(componentName, componentRole);
     status_t err2 = testSeek(componentName, componentRole);
diff --git a/media/libstagefright/rtsp/AAMRAssembler.cpp b/media/libstagefright/rtsp/AAMRAssembler.cpp
index 328cadf..9d72b1f 100644
--- a/media/libstagefright/rtsp/AAMRAssembler.cpp
+++ b/media/libstagefright/rtsp/AAMRAssembler.cpp
@@ -127,7 +127,7 @@
         mNextExpectedSeqNoValid = true;
         mNextExpectedSeqNo = (uint32_t)buffer->int32Data();
     } else if ((uint32_t)buffer->int32Data() != mNextExpectedSeqNo) {
-        LOGV("Not the sequence number I expected");
+        ALOGV("Not the sequence number I expected");
 
         return WRONG_SEQUENCE_NUMBER;
     }
@@ -138,7 +138,7 @@
         queue->erase(queue->begin());
         ++mNextExpectedSeqNo;
 
-        LOGV("AMR packet too short.");
+        ALOGV("AMR packet too short.");
 
         return MALFORMED_PACKET;
     }
@@ -156,7 +156,7 @@
             queue->erase(queue->begin());
             ++mNextExpectedSeqNo;
 
-            LOGV("Unable to parse TOC.");
+            ALOGV("Unable to parse TOC.");
 
             return MALFORMED_PACKET;
         }
@@ -170,7 +170,7 @@
             queue->erase(queue->begin());
             ++mNextExpectedSeqNo;
 
-            LOGV("Illegal TOC entry.");
+            ALOGV("Illegal TOC entry.");
 
             return MALFORMED_PACKET;
         }
@@ -197,7 +197,7 @@
             queue->erase(queue->begin());
             ++mNextExpectedSeqNo;
 
-            LOGV("AMR packet too short.");
+            ALOGV("AMR packet too short.");
 
             return MALFORMED_PACKET;
         }
diff --git a/media/libstagefright/rtsp/AAVCAssembler.cpp b/media/libstagefright/rtsp/AAVCAssembler.cpp
index 11c6ae7..ed8b1df 100644
--- a/media/libstagefright/rtsp/AAVCAssembler.cpp
+++ b/media/libstagefright/rtsp/AAVCAssembler.cpp
@@ -72,7 +72,7 @@
         mNextExpectedSeqNoValid = true;
         mNextExpectedSeqNo = (uint32_t)buffer->int32Data();
     } else if ((uint32_t)buffer->int32Data() != mNextExpectedSeqNo) {
-        LOGV("Not the sequence number I expected");
+        ALOGV("Not the sequence number I expected");
 
         return WRONG_SEQUENCE_NUMBER;
     }
@@ -83,7 +83,7 @@
     if (size < 1 || (data[0] & 0x80)) {
         // Corrupt.
 
-        LOGV("Ignoring corrupt buffer.");
+        ALOGV("Ignoring corrupt buffer.");
         queue->erase(queue->begin());
 
         ++mNextExpectedSeqNo;
@@ -107,7 +107,7 @@
 
         return success ? OK : MALFORMED_PACKET;
     } else {
-        LOGV("Ignoring unsupported buffer (nalType=%d)", nalType);
+        ALOGV("Ignoring unsupported buffer (nalType=%d)", nalType);
 
         queue->erase(queue->begin());
         ++mNextExpectedSeqNo;
@@ -117,7 +117,7 @@
 }
 
 void AAVCAssembler::addSingleNALUnit(const sp<ABuffer> &buffer) {
-    LOGV("addSingleNALUnit of size %d", buffer->size());
+    ALOGV("addSingleNALUnit of size %d", buffer->size());
 #if !LOG_NDEBUG
     hexdump(buffer->data(), buffer->size());
 #endif
@@ -138,7 +138,7 @@
     size_t size = buffer->size();
 
     if (size < 3) {
-        LOGV("Discarding too small STAP-A packet.");
+        ALOGV("Discarding too small STAP-A packet.");
         return false;
     }
 
@@ -148,7 +148,7 @@
         size_t nalSize = (data[0] << 8) | data[1];
 
         if (size < nalSize + 2) {
-            LOGV("Discarding malformed STAP-A packet.");
+            ALOGV("Discarding malformed STAP-A packet.");
             return false;
         }
 
@@ -164,7 +164,7 @@
     }
 
     if (size != 0) {
-        LOGV("Unexpected padding at end of STAP-A packet.");
+        ALOGV("Unexpected padding at end of STAP-A packet.");
     }
 
     return true;
@@ -184,7 +184,7 @@
     CHECK((indicator & 0x1f) == 28);
 
     if (size < 2) {
-        LOGV("Ignoring malformed FU buffer (size = %d)", size);
+        ALOGV("Ignoring malformed FU buffer (size = %d)", size);
 
         queue->erase(queue->begin());
         ++mNextExpectedSeqNo;
@@ -194,7 +194,7 @@
     if (!(data[1] & 0x80)) {
         // Start bit not set on the first buffer.
 
-        LOGV("Start bit not set on first buffer");
+        ALOGV("Start bit not set on first buffer");
 
         queue->erase(queue->begin());
         ++mNextExpectedSeqNo;
@@ -212,13 +212,13 @@
     if (data[1] & 0x40) {
         // Huh? End bit also set on the first buffer.
 
-        LOGV("Grrr. This isn't fragmented at all.");
+        ALOGV("Grrr. This isn't fragmented at all.");
 
         complete = true;
     } else {
         List<sp<ABuffer> >::iterator it = ++queue->begin();
         while (it != queue->end()) {
-            LOGV("sequence length %d", totalCount);
+            ALOGV("sequence length %d", totalCount);
 
             const sp<ABuffer> &buffer = *it;
 
@@ -226,7 +226,7 @@
             size_t size = buffer->size();
 
             if ((uint32_t)buffer->int32Data() != expectedSeqNo) {
-                LOGV("sequence not complete, expected seqNo %d, got %d",
+                ALOGV("sequence not complete, expected seqNo %d, got %d",
                      expectedSeqNo, (uint32_t)buffer->int32Data());
 
                 return WRONG_SEQUENCE_NUMBER;
@@ -236,7 +236,7 @@
                     || data[0] != indicator
                     || (data[1] & 0x1f) != nalType
                     || (data[1] & 0x80)) {
-                LOGV("Ignoring malformed FU buffer.");
+                ALOGV("Ignoring malformed FU buffer.");
 
                 // Delete the whole start of the FU.
 
@@ -287,7 +287,7 @@
     for (size_t i = 0; i < totalCount; ++i) {
         const sp<ABuffer> &buffer = *it;
 
-        LOGV("piece #%d/%d", i + 1, totalCount);
+        ALOGV("piece #%d/%d", i + 1, totalCount);
 #if !LOG_NDEBUG
         hexdump(buffer->data(), buffer->size());
 #endif
@@ -302,7 +302,7 @@
 
     addSingleNALUnit(unit);
 
-    LOGV("successfully assembled a NAL unit from fragments.");
+    ALOGV("successfully assembled a NAL unit from fragments.");
 
     return OK;
 }
@@ -310,7 +310,7 @@
 void AAVCAssembler::submitAccessUnit() {
     CHECK(!mNALUnits.empty());
 
-    LOGV("Access unit complete (%d nal units)", mNALUnits.size());
+    ALOGV("Access unit complete (%d nal units)", mNALUnits.size());
 
     size_t totalSize = 0;
     for (List<sp<ABuffer> >::iterator it = mNALUnits.begin();
@@ -360,7 +360,7 @@
 
 void AAVCAssembler::packetLost() {
     CHECK(mNextExpectedSeqNoValid);
-    LOGV("packetLost (expected %d)", mNextExpectedSeqNo);
+    ALOGV("packetLost (expected %d)", mNextExpectedSeqNo);
 
     ++mNextExpectedSeqNo;
 
diff --git a/media/libstagefright/rtsp/AMPEG4AudioAssembler.cpp b/media/libstagefright/rtsp/AMPEG4AudioAssembler.cpp
index 11d9c22..b0c7007 100644
--- a/media/libstagefright/rtsp/AMPEG4AudioAssembler.cpp
+++ b/media/libstagefright/rtsp/AMPEG4AudioAssembler.cpp
@@ -196,7 +196,7 @@
 
         unsigned syncExtensionType = bits->getBits(11);
         if (syncExtensionType == 0x2b7) {
-            LOGI("found syncExtension");
+            ALOGI("found syncExtension");
 
             CHECK_EQ(parseAudioObjectType(bits, &extensionAudioObjectType),
                      (status_t)OK);
@@ -217,7 +217,7 @@
                 // Apparently an extension is always considered an even
                 // multiple of 8 bits long.
 
-                LOGI("Skipping %d bits after sync extension",
+                ALOGI("Skipping %d bits after sync extension",
                      8 - (numBitsInExtension & 7));
 
                 bits->skipBits(8 - (numBitsInExtension & 7));
@@ -424,7 +424,7 @@
     }
 
     if (offset < buffer->size()) {
-        LOGI("ignoring %d bytes of trailing data", buffer->size() - offset);
+        ALOGI("ignoring %d bytes of trailing data", buffer->size() - offset);
     }
     CHECK_LE(offset, buffer->size());
 
diff --git a/media/libstagefright/rtsp/AMPEG4ElementaryAssembler.cpp b/media/libstagefright/rtsp/AMPEG4ElementaryAssembler.cpp
index 9f6bd29..2f2e2c2 100644
--- a/media/libstagefright/rtsp/AMPEG4ElementaryAssembler.cpp
+++ b/media/libstagefright/rtsp/AMPEG4ElementaryAssembler.cpp
@@ -203,7 +203,7 @@
         mNextExpectedSeqNoValid = true;
         mNextExpectedSeqNo = (uint32_t)buffer->int32Data();
     } else if ((uint32_t)buffer->int32Data() != mNextExpectedSeqNo) {
-        LOGV("Not the sequence number I expected");
+        ALOGV("Not the sequence number I expected");
 
         return WRONG_SEQUENCE_NUMBER;
     }
@@ -336,7 +336,7 @@
 void AMPEG4ElementaryAssembler::submitAccessUnit() {
     CHECK(!mPackets.empty());
 
-    LOGV("Access unit complete (%d nal units)", mPackets.size());
+    ALOGV("Access unit complete (%d nal units)", mPackets.size());
 
     size_t totalSize = 0;
     for (List<sp<ABuffer> >::iterator it = mPackets.begin();
@@ -383,7 +383,7 @@
 
 void AMPEG4ElementaryAssembler::packetLost() {
     CHECK(mNextExpectedSeqNoValid);
-    LOGV("packetLost (expected %d)", mNextExpectedSeqNo);
+    ALOGV("packetLost (expected %d)", mNextExpectedSeqNo);
 
     ++mNextExpectedSeqNo;
 
diff --git a/media/libstagefright/rtsp/APacketSource.cpp b/media/libstagefright/rtsp/APacketSource.cpp
index 3f4cdb5..6cf1301 100644
--- a/media/libstagefright/rtsp/APacketSource.cpp
+++ b/media/libstagefright/rtsp/APacketSource.cpp
@@ -193,7 +193,7 @@
 
         if (i == 0) {
             FindAVCDimensions(nal, width, height);
-            LOGI("dimensions %dx%d", *width, *height);
+            ALOGI("dimensions %dx%d", *width, *height);
         }
     }
 
@@ -371,7 +371,7 @@
         return NULL;
     }
 
-    LOGI("VOL dimensions = %dx%d", *width, *height);
+    ALOGI("VOL dimensions = %dx%d", *width, *height);
 
     size_t len1 = config->size() + GetSizeWidth(config->size()) + 1;
     size_t len2 = len1 + GetSizeWidth(len1) + 1 + 13;
diff --git a/media/libstagefright/rtsp/ARTPConnection.cpp b/media/libstagefright/rtsp/ARTPConnection.cpp
index cd374e2..8c9dd8d 100644
--- a/media/libstagefright/rtsp/ARTPConnection.cpp
+++ b/media/libstagefright/rtsp/ARTPConnection.cpp
@@ -294,7 +294,7 @@
             if (err == -ECONNRESET) {
                 // socket failure, this stream is dead, Jim.
 
-                LOGW("failed to receive RTP/RTCP datagram.");
+                ALOGW("failed to receive RTP/RTCP datagram.");
                 it = mStreams.erase(it);
                 continue;
             }
@@ -336,7 +336,7 @@
             }
 
             if (buffer->size() > 0) {
-                LOGV("Sending RR...");
+                ALOGV("Sending RR...");
 
                 ssize_t n;
                 do {
@@ -347,7 +347,7 @@
                 } while (n < 0 && errno == EINTR);
 
                 if (n <= 0) {
-                    LOGW("failed to send RTCP receiver report (%s).",
+                    ALOGW("failed to send RTCP receiver report (%s).",
                          n == 0 ? "connection gone" : strerror(errno));
 
                     it = mStreams.erase(it);
@@ -369,7 +369,7 @@
 }
 
 status_t ARTPConnection::receive(StreamInfo *s, bool receiveRTP) {
-    LOGV("receiving %s", receiveRTP ? "RTP" : "RTCP");
+    ALOGV("receiving %s", receiveRTP ? "RTP" : "RTCP");
 
     CHECK(!s->mIsInjected);
 
@@ -396,7 +396,7 @@
 
     buffer->setRange(0, nbytes);
 
-    // LOGI("received %d bytes.", buffer->size());
+    // ALOGI("received %d bytes.", buffer->size());
 
     status_t err;
     if (receiveRTP) {
@@ -561,7 +561,7 @@
 
             default:
             {
-                LOGW("Unknown RTCP packet type %u of size %d",
+                ALOGW("Unknown RTCP packet type %u of size %d",
                      (unsigned)data[1], headerLength);
                 break;
             }
@@ -606,7 +606,7 @@
     uint32_t rtpTime = u32at(&data[16]);
 
 #if 0
-    LOGI("XXX timeUpdate: ssrc=0x%08x, rtpTime %u == ntpTime %.3f",
+    ALOGI("XXX timeUpdate: ssrc=0x%08x, rtpTime %u == ntpTime %.3f",
          id,
          rtpTime,
          (ntpTime >> 32) + (double)(ntpTime & 0xffffffff) / (1ll << 32));
diff --git a/media/libstagefright/rtsp/ARTPSession.cpp b/media/libstagefright/rtsp/ARTPSession.cpp
index c6bcb12..7a05b88 100644
--- a/media/libstagefright/rtsp/ARTPSession.cpp
+++ b/media/libstagefright/rtsp/ARTPSession.cpp
@@ -53,24 +53,24 @@
         if (!mDesc->findAttribute(i, "c=", &connection)) {
             // No per-stream connection information, try global fallback.
             if (!mDesc->findAttribute(0, "c=", &connection)) {
-                LOGE("Unable to find connection attribute.");
+                ALOGE("Unable to find connection attribute.");
                 return mInitCheck;
             }
         }
         if (!(connection == "IN IP4 127.0.0.1")) {
-            LOGE("We only support localhost connections for now.");
+            ALOGE("We only support localhost connections for now.");
             return mInitCheck;
         }
 
         unsigned port;
         if (!validateMediaFormat(i, &port) || (port & 1) != 0) {
-            LOGE("Invalid media format.");
+            ALOGE("Invalid media format.");
             return mInitCheck;
         }
 
         sp<APacketSource> source = new APacketSource(mDesc, i);
         if (source->initCheck() != OK) {
-            LOGE("Unsupported format.");
+            ALOGE("Unsupported format.");
             return mInitCheck;
         }
 
@@ -159,7 +159,7 @@
             printf("access unit complete size=%d\tntp-time=0x%016llx\n",
                    accessUnit->size(), ntpTime);
 #else
-            LOGI("access unit complete, size=%d, ntp-time=%llu",
+            ALOGI("access unit complete, size=%d, ntp-time=%llu",
                  accessUnit->size(), ntpTime);
             hexdump(accessUnit->data(), accessUnit->size());
 #endif
@@ -170,7 +170,7 @@
             CHECK(!memcmp("\x00\x00\x00\x01", accessUnit->data(), 4));
             unsigned x = accessUnit->data()[4];
 
-            LOGI("access unit complete: nalType=0x%02x, nalRefIdc=0x%02x",
+            ALOGI("access unit complete: nalType=0x%02x, nalRefIdc=0x%02x",
                  x & 0x1f, (x & 0x60) >> 5);
 #endif
 
@@ -181,7 +181,7 @@
             int32_t damaged;
             if (accessUnit->meta()->findInt32("damaged", &damaged)
                     && damaged != 0) {
-                LOGI("ignoring damaged AU");
+                ALOGI("ignoring damaged AU");
             } else
 #endif
             {
diff --git a/media/libstagefright/rtsp/ARTPSource.cpp b/media/libstagefright/rtsp/ARTPSource.cpp
index 3aa07ce..ed68790 100644
--- a/media/libstagefright/rtsp/ARTPSource.cpp
+++ b/media/libstagefright/rtsp/ARTPSource.cpp
@@ -147,7 +147,7 @@
     }
 
     if (it != mQueue.end() && (uint32_t)(*it)->int32Data() == seqNum) {
-        LOGW("Discarding duplicate buffer");
+        ALOGW("Discarding duplicate buffer");
         return false;
     }
 
@@ -174,7 +174,7 @@
     mLastFIRRequestUs = nowUs;
 
     if (buffer->size() + 20 > buffer->capacity()) {
-        LOGW("RTCP buffer too small to accomodate FIR.");
+        ALOGW("RTCP buffer too small to accomodate FIR.");
         return;
     }
 
@@ -207,12 +207,12 @@
 
     buffer->setRange(buffer->offset(), buffer->size() + 20);
 
-    LOGV("Added FIR request.");
+    ALOGV("Added FIR request.");
 }
 
 void ARTPSource::addReceiverReport(const sp<ABuffer> &buffer) {
     if (buffer->size() + 32 > buffer->capacity()) {
-        LOGW("RTCP buffer too small to accomodate RR.");
+        ALOGW("RTCP buffer too small to accomodate RR.");
         return;
     }
 
diff --git a/media/libstagefright/rtsp/ARTPWriter.cpp b/media/libstagefright/rtsp/ARTPWriter.cpp
index 5a033e1..0d07043 100644
--- a/media/libstagefright/rtsp/ARTPWriter.cpp
+++ b/media/libstagefright/rtsp/ARTPWriter.cpp
@@ -269,7 +269,7 @@
     status_t err = mSource->read(&mediaBuf);
 
     if (err != OK) {
-        LOGI("reached EOS.");
+        ALOGI("reached EOS.");
 
         Mutex::Autolock autoLock(mLock);
         mFlags |= kFlagEOS;
@@ -277,7 +277,7 @@
     }
 
     if (mediaBuf->range_length() > 0) {
-        LOGV("read buffer of size %d", mediaBuf->range_length());
+        ALOGV("read buffer of size %d", mediaBuf->range_length());
 
         if (mMode == H264) {
             StripStartcode(mediaBuf);
@@ -520,7 +520,7 @@
         sdp.append("a=fmtp:" PT_STR " octed-align\r\n");
     }
 
-    LOGI("%s", sdp.c_str());
+    ALOGI("%s", sdp.c_str());
 }
 
 void ARTPWriter::makeH264SPropParamSets(MediaBuffer *buffer) {
diff --git a/media/libstagefright/rtsp/ARTSPConnection.cpp b/media/libstagefright/rtsp/ARTSPConnection.cpp
index 380b3dc..80a010e 100644
--- a/media/libstagefright/rtsp/ARTSPConnection.cpp
+++ b/media/libstagefright/rtsp/ARTSPConnection.cpp
@@ -55,7 +55,7 @@
 
 ARTSPConnection::~ARTSPConnection() {
     if (mSocket >= 0) {
-        LOGE("Connection is still open, closing the socket.");
+        ALOGE("Connection is still open, closing the socket.");
         if (mUIDValid) {
             HTTPBase::UnRegisterSocketUserTag(mSocket);
         }
@@ -235,7 +235,7 @@
         // right here, since we currently have no way of asking the user
         // for this information.
 
-        LOGE("Malformed rtsp url %s", url.c_str());
+        ALOGE("Malformed rtsp url %s", url.c_str());
 
         reply->setInt32("result", ERROR_MALFORMED);
         reply->post();
@@ -245,12 +245,12 @@
     }
 
     if (mUser.size() > 0) {
-        LOGV("user = '%s', pass = '%s'", mUser.c_str(), mPass.c_str());
+        ALOGV("user = '%s', pass = '%s'", mUser.c_str(), mPass.c_str());
     }
 
     struct hostent *ent = gethostbyname(host.c_str());
     if (ent == NULL) {
-        LOGE("Unknown host %s", host.c_str());
+        ALOGE("Unknown host %s", host.c_str());
 
         reply->setInt32("result", -ENOENT);
         reply->post();
@@ -376,7 +376,7 @@
     CHECK_EQ(optionLen, (socklen_t)sizeof(err));
 
     if (err != 0) {
-        LOGE("err = %d (%s)", err, strerror(err));
+        ALOGE("err = %d (%s)", err, strerror(err));
 
         reply->setInt32("result", -err);
 
@@ -429,7 +429,7 @@
 
     request.insert(cseqHeader, i + 2);
 
-    LOGV("request: '%s'", request.c_str());
+    ALOGV("request: '%s'", request.c_str());
 
     size_t numBytesSent = 0;
     while (numBytesSent < request.size()) {
@@ -446,12 +446,12 @@
 
             if (n == 0) {
                 // Server closed the connection.
-                LOGE("Server unexpectedly closed the connection.");
+                ALOGE("Server unexpectedly closed the connection.");
 
                 reply->setInt32("result", ERROR_IO);
                 reply->post();
             } else {
-                LOGE("Error sending rtsp request. (%s)", strerror(errno));
+                ALOGE("Error sending rtsp request. (%s)", strerror(errno));
                 reply->setInt32("result", -errno);
                 reply->post();
             }
@@ -536,10 +536,10 @@
 
             if (n == 0) {
                 // Server closed the connection.
-                LOGE("Server unexpectedly closed the connection.");
+                ALOGE("Server unexpectedly closed the connection.");
                 return ERROR_IO;
             } else {
-                LOGE("Error reading rtsp response. (%s)", strerror(errno));
+                ALOGE("Error reading rtsp response. (%s)", strerror(errno));
                 return -errno;
             }
         }
@@ -615,7 +615,7 @@
             notify->setObject("buffer", buffer);
             notify->post();
         } else {
-            LOGW("received binary data, but no one cares.");
+            ALOGW("received binary data, but no one cares.");
         }
 
         return true;
@@ -624,7 +624,7 @@
     sp<ARTSPResponse> response = new ARTSPResponse;
     response->mStatusLine = statusLine;
 
-    LOGI("status: %s", response->mStatusLine.c_str());
+    ALOGI("status: %s", response->mStatusLine.c_str());
 
     ssize_t space1 = response->mStatusLine.find(" ");
     if (space1 < 0) {
@@ -669,7 +669,7 @@
             break;
         }
 
-        LOGV("line: '%s'", line.c_str());
+        ALOGV("line: '%s'", line.c_str());
 
         if (line.c_str()[0] == ' ' || line.c_str()[0] == '\t') {
             // Support for folded header values.
@@ -740,7 +740,7 @@
             msg->setMessage("reply", reply);
             msg->setString("request", request.c_str(), request.size());
 
-            LOGI("re-sending request with authentication headers...");
+            ALOGI("re-sending request with authentication headers...");
             onSendRequest(msg);
 
             return true;
@@ -793,9 +793,9 @@
         if (n <= 0) {
             if (n == 0) {
                 // Server closed the connection.
-                LOGE("Server unexpectedly closed the connection.");
+                ALOGE("Server unexpectedly closed the connection.");
             } else {
-                LOGE("Error sending rtsp response (%s).", strerror(errno));
+                ALOGE("Error sending rtsp response (%s).", strerror(errno));
             }
 
             performDisconnect();
diff --git a/media/libstagefright/rtsp/ARawAudioAssembler.cpp b/media/libstagefright/rtsp/ARawAudioAssembler.cpp
index dd47ea3..98bee82 100644
--- a/media/libstagefright/rtsp/ARawAudioAssembler.cpp
+++ b/media/libstagefright/rtsp/ARawAudioAssembler.cpp
@@ -77,7 +77,7 @@
         mNextExpectedSeqNoValid = true;
         mNextExpectedSeqNo = (uint32_t)buffer->int32Data();
     } else if ((uint32_t)buffer->int32Data() != mNextExpectedSeqNo) {
-        LOGV("Not the sequence number I expected");
+        ALOGV("Not the sequence number I expected");
 
         return WRONG_SEQUENCE_NUMBER;
     }
@@ -88,7 +88,7 @@
         queue->erase(queue->begin());
         ++mNextExpectedSeqNo;
 
-        LOGV("raw audio packet too short.");
+        ALOGV("raw audio packet too short.");
 
         return MALFORMED_PACKET;
     }
diff --git a/media/libstagefright/rtsp/ASessionDescription.cpp b/media/libstagefright/rtsp/ASessionDescription.cpp
index f03f7a2..a9b3330 100644
--- a/media/libstagefright/rtsp/ASessionDescription.cpp
+++ b/media/libstagefright/rtsp/ASessionDescription.cpp
@@ -80,7 +80,7 @@
             return false;
         }
 
-        LOGI("%s", line.c_str());
+        ALOGI("%s", line.c_str());
 
         switch (line.c_str()[0]) {
             case 'v':
@@ -120,7 +120,7 @@
                 key.trim();
                 value.trim();
 
-                LOGV("adding '%s' => '%s'", key.c_str(), value.c_str());
+                ALOGV("adding '%s' => '%s'", key.c_str(), value.c_str());
 
                 mTracks.editItemAt(mTracks.size() - 1).add(key, value);
                 break;
@@ -128,7 +128,7 @@
 
             case 'm':
             {
-                LOGV("new section '%s'",
+                ALOGV("new section '%s'",
                      AString(line, 2, line.size() - 2).c_str());
 
                 mTracks.push(Attribs());
@@ -148,7 +148,7 @@
                 key.trim();
                 value.trim();
 
-                LOGV("adding '%s' => '%s'", key.c_str(), value.c_str());
+                ALOGV("adding '%s' => '%s'", key.c_str(), value.c_str());
 
                 mTracks.editItemAt(mTracks.size() - 1).add(key, value);
                 break;
diff --git a/media/libstagefright/rtsp/MyHandler.h b/media/libstagefright/rtsp/MyHandler.h
index 5a95f9c..2391c5c 100644
--- a/media/libstagefright/rtsp/MyHandler.h
+++ b/media/libstagefright/rtsp/MyHandler.h
@@ -155,7 +155,7 @@
             mSessionURL.append(StringPrintf("%u", port));
             mSessionURL.append(path);
 
-            LOGI("rewritten session url: '%s'", mSessionURL.c_str());
+            ALOGI("rewritten session url: '%s'", mSessionURL.c_str());
         }
 
         mSessionHost = host;
@@ -264,12 +264,12 @@
         if (!GetAttribute(transport.c_str(),
                           "source",
                           &source)) {
-            LOGW("Missing 'source' field in Transport response. Using "
+            ALOGW("Missing 'source' field in Transport response. Using "
                  "RTSP endpoint address.");
 
             struct hostent *ent = gethostbyname(mSessionHost.c_str());
             if (ent == NULL) {
-                LOGE("Failed to look up address of session host '%s'",
+                ALOGE("Failed to look up address of session host '%s'",
                      mSessionHost.c_str());
 
                 return false;
@@ -283,7 +283,7 @@
         if (!GetAttribute(transport.c_str(),
                                  "server_port",
                                  &server_port)) {
-            LOGI("Missing 'server_port' field in Transport response.");
+            ALOGI("Missing 'server_port' field in Transport response.");
             return false;
         }
 
@@ -292,7 +292,7 @@
                 || rtpPort <= 0 || rtpPort > 65535
                 || rtcpPort <=0 || rtcpPort > 65535
                 || rtcpPort != rtpPort + 1) {
-            LOGE("Server picked invalid RTP/RTCP port pair %s,"
+            ALOGE("Server picked invalid RTP/RTCP port pair %s,"
                  " RTP port must be even, RTCP port must be one higher.",
                  server_port.c_str());
 
@@ -300,7 +300,7 @@
         }
 
         if (rtpPort & 1) {
-            LOGW("Server picked an odd RTP port, it should've picked an "
+            ALOGW("Server picked an odd RTP port, it should've picked an "
                  "even one, we'll let it pass for now, but this may break "
                  "in the future.");
         }
@@ -327,7 +327,7 @@
                 (const sockaddr *)&addr, sizeof(addr));
 
         if (n < (ssize_t)buf->size()) {
-            LOGE("failed to poke a hole for RTP packets");
+            ALOGE("failed to poke a hole for RTP packets");
             return false;
         }
 
@@ -338,11 +338,11 @@
                 (const sockaddr *)&addr, sizeof(addr));
 
         if (n < (ssize_t)buf->size()) {
-            LOGE("failed to poke a hole for RTCP packets");
+            ALOGE("failed to poke a hole for RTCP packets");
             return false;
         }
 
-        LOGV("successfully poked holes.");
+        ALOGV("successfully poked holes.");
 
         return true;
     }
@@ -354,7 +354,7 @@
                 int32_t result;
                 CHECK(msg->findInt32("result", &result));
 
-                LOGI("connection request completed with result %d (%s)",
+                ALOGI("connection request completed with result %d (%s)",
                      result, strerror(-result));
 
                 if (result == OK) {
@@ -392,7 +392,7 @@
                 int32_t result;
                 CHECK(msg->findInt32("result", &result));
 
-                LOGI("DESCRIBE completed with result %d (%s)",
+                ALOGI("DESCRIBE completed with result %d (%s)",
                      result, strerror(-result));
 
                 if (result == OK) {
@@ -429,7 +429,7 @@
                                 response->mContent->size());
 
                         if (!mSessionDesc->isValid()) {
-                            LOGE("Failed to parse session description.");
+                            ALOGE("Failed to parse session description.");
                             result = ERROR_MALFORMED;
                         } else {
                             ssize_t i = response->mHeaders.indexOfKey("content-base");
@@ -450,7 +450,7 @@
                                 // it with the absolute session URL to get
                                 // something usable...
 
-                                LOGW("Server specified a non-absolute base URL"
+                                ALOGW("Server specified a non-absolute base URL"
                                      ", combining it with the session URL to "
                                      "get something usable...");
 
@@ -468,7 +468,7 @@
                                 // The first "track" is merely session meta
                                 // data.
 
-                                LOGW("Session doesn't contain any playable "
+                                ALOGW("Session doesn't contain any playable "
                                      "tracks. Aborting.");
                                 result = ERROR_UNSUPPORTED;
                             } else {
@@ -499,7 +499,7 @@
                 int32_t result;
                 CHECK(msg->findInt32("result", &result));
 
-                LOGI("SETUP(%d) completed with result %d (%s)",
+                ALOGI("SETUP(%d) completed with result %d (%s)",
                      index, result, strerror(-result));
 
                 if (result == OK) {
@@ -527,12 +527,12 @@
                                 strtoul(timeoutStr.c_str(), &end, 10);
 
                             if (end == timeoutStr.c_str() || *end != '\0') {
-                                LOGW("server specified malformed timeout '%s'",
+                                ALOGW("server specified malformed timeout '%s'",
                                      timeoutStr.c_str());
 
                                 mKeepAliveTimeoutUs = kDefaultKeepAliveTimeoutUs;
                             } else if (timeoutSecs < 15) {
-                                LOGW("server specified too short a timeout "
+                                ALOGW("server specified too short a timeout "
                                      "(%lu secs), using default.",
                                      timeoutSecs);
 
@@ -540,7 +540,7 @@
                             } else {
                                 mKeepAliveTimeoutUs = timeoutSecs * 1000000ll;
 
-                                LOGI("server specified timeout of %lu secs.",
+                                ALOGI("server specified timeout of %lu secs.",
                                      timeoutSecs);
                             }
                         }
@@ -625,7 +625,7 @@
                 int32_t result;
                 CHECK(msg->findInt32("result", &result));
 
-                LOGI("PLAY completed with result %d (%s)",
+                ALOGI("PLAY completed with result %d (%s)",
                      result, strerror(-result));
 
                 if (result == OK) {
@@ -682,7 +682,7 @@
                 int32_t result;
                 CHECK(msg->findInt32("result", &result));
 
-                LOGI("OPTIONS completed with result %d (%s)",
+                ALOGI("OPTIONS completed with result %d (%s)",
                      result, strerror(-result));
 
                 int32_t generation;
@@ -759,7 +759,7 @@
                 int32_t result;
                 CHECK(msg->findInt32("result", &result));
 
-                LOGI("TEARDOWN completed with result %d (%s)",
+                ALOGI("TEARDOWN completed with result %d (%s)",
                      result, strerror(-result));
 
                 sp<AMessage> reply = new AMessage('disc', id());
@@ -793,11 +793,11 @@
 
                 if (mNumAccessUnitsReceived == 0) {
 #if 1
-                    LOGI("stream ended? aborting.");
+                    ALOGI("stream ended? aborting.");
                     (new AMessage('abor', id()))->post();
                     break;
 #else
-                    LOGI("haven't seen an AU in a looong time.");
+                    ALOGI("haven't seen an AU in a looong time.");
 #endif
                 }
 
@@ -840,7 +840,7 @@
                 CHECK(msg->findSize("track-index", &trackIndex));
 
                 if (trackIndex >= mTracks.size()) {
-                    LOGV("late packets ignored.");
+                    ALOGV("late packets ignored.");
                     break;
                 }
 
@@ -848,7 +848,7 @@
 
                 int32_t eos;
                 if (msg->findInt32("eos", &eos)) {
-                    LOGI("received BYE on track index %d", trackIndex);
+                    ALOGI("received BYE on track index %d", trackIndex);
 #if 0
                     track->mPacketSource->signalEOS(ERROR_END_OF_STREAM);
 #endif
@@ -863,12 +863,12 @@
                 uint32_t seqNum = (uint32_t)accessUnit->int32Data();
 
                 if (mSeekPending) {
-                    LOGV("we're seeking, dropping stale packet.");
+                    ALOGV("we're seeking, dropping stale packet.");
                     break;
                 }
 
                 if (seqNum < track->mFirstSeqNumInSegment) {
-                    LOGV("dropping stale access-unit (%d < %d)",
+                    ALOGV("dropping stale access-unit (%d < %d)",
                          seqNum, track->mFirstSeqNumInSegment);
                     break;
                 }
@@ -884,7 +884,7 @@
             case 'seek':
             {
                 if (!mSeekable) {
-                    LOGW("This is a live stream, ignoring seek request.");
+                    ALOGW("This is a live stream, ignoring seek request.");
 
                     sp<AMessage> msg = mNotify->dup();
                     msg->setInt32("what", kWhatSeekDone);
@@ -961,7 +961,7 @@
                 int32_t result;
                 CHECK(msg->findInt32("result", &result));
 
-                LOGI("PLAY completed with result %d (%s)",
+                ALOGI("PLAY completed with result %d (%s)",
                      result, strerror(-result));
 
                 mCheckPending = false;
@@ -981,14 +981,14 @@
                         ssize_t i = response->mHeaders.indexOfKey("rtp-info");
                         CHECK_GE(i, 0);
 
-                        LOGV("rtp-info: %s", response->mHeaders.valueAt(i).c_str());
+                        ALOGV("rtp-info: %s", response->mHeaders.valueAt(i).c_str());
 
-                        LOGI("seek completed.");
+                        ALOGI("seek completed.");
                     }
                 }
 
                 if (result != OK) {
-                    LOGE("seek failed, aborting.");
+                    ALOGE("seek failed, aborting.");
                     (new AMessage('abor', id()))->post();
                 }
 
@@ -1017,7 +1017,7 @@
             {
                 if (!mReceivedFirstRTCPPacket) {
                     if (mReceivedFirstRTPPacket && !mTryFakeRTCP) {
-                        LOGW("We received RTP packets but no RTCP packets, "
+                        ALOGW("We received RTP packets but no RTCP packets, "
                              "using fake timestamps.");
 
                         mTryFakeRTCP = true;
@@ -1026,7 +1026,7 @@
 
                         fakeTimestamps();
                     } else if (!mReceivedFirstRTPPacket && !mTryTCPInterleaving) {
-                        LOGW("Never received any data, switching transports.");
+                        ALOGW("Never received any data, switching transports.");
 
                         mTryTCPInterleaving = true;
 
@@ -1034,7 +1034,7 @@
                         msg->setInt32("reconnect", true);
                         msg->post();
                     } else {
-                        LOGW("Never received any data, disconnecting.");
+                        ALOGW("Never received any data, disconnecting.");
                         (new AMessage('abor', id()))->post();
                     }
                 }
@@ -1092,7 +1092,7 @@
         }
 
         AString range = response->mHeaders.valueAt(i);
-        LOGV("Range: %s", range.c_str());
+        ALOGV("Range: %s", range.c_str());
 
         AString val;
         CHECK(GetAttribute(range.c_str(), "npt", &val));
@@ -1101,7 +1101,7 @@
         if (!ASessionDescription::parseNTPRange(val.c_str(), &npt1, &npt2)) {
             // This is a live stream and therefore not seekable.
 
-            LOGI("This is a live stream");
+            ALOGI("This is a live stream");
             return;
         }
 
@@ -1116,7 +1116,7 @@
         for (List<AString>::iterator it = streamInfos.begin();
              it != streamInfos.end(); ++it) {
             (*it).trim();
-            LOGV("streamInfo[%d] = %s", n, (*it).c_str());
+            ALOGV("streamInfo[%d] = %s", n, (*it).c_str());
 
             CHECK(GetAttribute((*it).c_str(), "url", &val));
 
@@ -1140,7 +1140,7 @@
 
             uint32_t rtpTime = strtoul(val.c_str(), &end, 10);
 
-            LOGV("track #%d: rtpTime=%u <=> npt=%.2f", n, rtpTime, npt1);
+            ALOGV("track #%d: rtpTime=%u <=> npt=%.2f", n, rtpTime, npt1);
 
             info->mNormalPlayTimeRTP = rtpTime;
             info->mNormalPlayTimeUs = (int64_t)(npt1 * 1E6);
@@ -1233,7 +1233,7 @@
             new APacketSource(mSessionDesc, index);
 
         if (source->initCheck() != OK) {
-            LOGW("Unsupported format. Ignoring track #%d.", index);
+            ALOGW("Unsupported format. Ignoring track #%d.", index);
 
             sp<AMessage> reply = new AMessage('setu', id());
             reply->setSize("index", index);
@@ -1272,7 +1272,7 @@
 
         info->mTimeScale = timescale;
 
-        LOGV("track #%d URL=%s", mTracks.size(), trackURL.c_str());
+        ALOGV("track #%d URL=%s", mTracks.size(), trackURL.c_str());
 
         AString request = "SETUP ";
         request.append(trackURL);
@@ -1363,7 +1363,7 @@
     }
 
     void onTimeUpdate(int32_t trackIndex, uint32_t rtpTime, uint64_t ntpTime) {
-        LOGV("onTimeUpdate track %d, rtpTime = 0x%08x, ntpTime = 0x%016llx",
+        ALOGV("onTimeUpdate track %d, rtpTime = 0x%08x, ntpTime = 0x%016llx",
              trackIndex, rtpTime, ntpTime);
 
         int64_t ntpTimeUs = (int64_t)(ntpTime * 1E6 / (1ll << 32));
@@ -1381,7 +1381,7 @@
 
     void onAccessUnitComplete(
             int32_t trackIndex, const sp<ABuffer> &accessUnit) {
-        LOGV("onAccessUnitComplete track %d", trackIndex);
+        ALOGV("onAccessUnitComplete track %d", trackIndex);
 
         if (mFirstAccessUnit) {
             sp<AMessage> msg = mNotify->dup();
@@ -1404,7 +1404,7 @@
         TrackInfo *track = &mTracks.editItemAt(trackIndex);
 
         if (mNTPAnchorUs < 0 || mMediaAnchorUs < 0 || track->mNTPAnchorUs < 0) {
-            LOGV("storing accessUnit, no time established yet");
+            ALOGV("storing accessUnit, no time established yet");
             track->mPackets.push_back(accessUnit);
             return;
         }
@@ -1443,11 +1443,11 @@
         }
 
         if (mediaTimeUs < 0) {
-            LOGV("dropping early accessUnit.");
+            ALOGV("dropping early accessUnit.");
             return false;
         }
 
-        LOGV("track %d rtpTime=%d mediaTimeUs = %lld us (%.2f secs)",
+        ALOGV("track %d rtpTime=%d mediaTimeUs = %lld us (%.2f secs)",
              trackIndex, rtpTime, mediaTimeUs, mediaTimeUs / 1E6);
 
         accessUnit->meta()->setInt64("timeUs", mediaTimeUs);
diff --git a/media/libstagefright/rtsp/UDPPusher.cpp b/media/libstagefright/rtsp/UDPPusher.cpp
index 576b3ca..47ea6f1 100644
--- a/media/libstagefright/rtsp/UDPPusher.cpp
+++ b/media/libstagefright/rtsp/UDPPusher.cpp
@@ -71,7 +71,7 @@
 bool UDPPusher::onPush() {
     uint32_t length;
     if (fread(&length, 1, sizeof(length), mFile) < sizeof(length)) {
-        LOGI("No more data to push.");
+        ALOGI("No more data to push.");
         return false;
     }
 
@@ -81,7 +81,7 @@
 
     sp<ABuffer> buffer = new ABuffer(length);
     if (fread(buffer->data(), 1, length, mFile) < length) {
-        LOGE("File truncated?.");
+        ALOGE("File truncated?.");
         return false;
     }
 
@@ -93,7 +93,7 @@
 
     uint32_t timeMs;
     if (fread(&timeMs, 1, sizeof(timeMs), mFile) < sizeof(timeMs)) {
-        LOGI("No more data to push.");
+        ALOGI("No more data to push.");
         return false;
     }
 
@@ -113,7 +113,7 @@
         case kWhatPush:
         {
             if (!onPush() && !(ntohs(mRemoteAddr.sin_port) & 1)) {
-                LOGI("emulating BYE packet");
+                ALOGI("emulating BYE packet");
 
                 sp<ABuffer> buffer = new ABuffer(8);
                 uint8_t *data = buffer->data();
diff --git a/media/libstagefright/rtsp/rtp_test.cpp b/media/libstagefright/rtsp/rtp_test.cpp
index f0cb5a5..d43cd2a 100644
--- a/media/libstagefright/rtsp/rtp_test.cpp
+++ b/media/libstagefright/rtsp/rtp_test.cpp
@@ -204,7 +204,7 @@
                 continue;
             }
 
-            LOGE("decoder returned error 0x%08x", err);
+            ALOGE("decoder returned error 0x%08x", err);
             break;
         }
 
diff --git a/media/libstagefright/tests/DummyRecorder.cpp b/media/libstagefright/tests/DummyRecorder.cpp
index 8d75d6b..ac37b28 100644
--- a/media/libstagefright/tests/DummyRecorder.cpp
+++ b/media/libstagefright/tests/DummyRecorder.cpp
@@ -27,7 +27,7 @@
 
 // static
 void *DummyRecorder::threadWrapper(void *pthis) {
-    LOGV("ThreadWrapper: %p", pthis);
+    ALOGV("ThreadWrapper: %p", pthis);
     DummyRecorder *writer = static_cast<DummyRecorder *>(pthis);
     writer->readFromSource();
     return NULL;
@@ -35,7 +35,7 @@
 
 
 status_t DummyRecorder::start() {
-    LOGV("Start");
+    ALOGV("Start");
     mStarted = true;
 
     mSource->start();
@@ -47,7 +47,7 @@
     pthread_attr_destroy(&attr);
 
     if (err) {
-        LOGE("Error creating thread!");
+        ALOGE("Error creating thread!");
         return -ENODEV;
     }
     return OK;
@@ -55,7 +55,7 @@
 
 
 status_t DummyRecorder::stop() {
-    LOGV("Stop");
+    ALOGV("Stop");
     mStarted = false;
 
     mSource->stop();
@@ -63,20 +63,20 @@
     pthread_join(mThread, &dummy);
     status_t err = (status_t) dummy;
 
-    LOGV("Ending the reading thread");
+    ALOGV("Ending the reading thread");
     return err;
 }
 
 // pretend to read the source buffers
 void DummyRecorder::readFromSource() {
-    LOGV("ReadFromSource");
+    ALOGV("ReadFromSource");
     if (!mStarted) {
         return;
     }
 
     status_t err = OK;
     MediaBuffer *buffer;
-    LOGV("A fake writer accessing the frames");
+    ALOGV("A fake writer accessing the frames");
     while (mStarted && (err = mSource->read(&buffer)) == OK){
         // if not getting a valid buffer from source, then exit
         if (buffer == NULL) {
diff --git a/media/libstagefright/tests/SurfaceMediaSource_test.cpp b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
index d7bb703..76b507f 100644
--- a/media/libstagefright/tests/SurfaceMediaSource_test.cpp
+++ b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
@@ -58,7 +58,7 @@
     }
 
     virtual void SetUp() {
-        LOGV("GLTest::SetUp()");
+        ALOGV("GLTest::SetUp()");
         mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
         ASSERT_EQ(EGL_SUCCESS, eglGetError());
         ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay);
@@ -106,7 +106,7 @@
             mEglSurface = eglCreateWindowSurface(mEglDisplay, mGlConfig,
                     window.get(), NULL);
         } else {
-            LOGV("No actual display. Choosing EGLSurface based on SurfaceMediaSource");
+            ALOGV("No actual display. Choosing EGLSurface based on SurfaceMediaSource");
             sp<SurfaceMediaSource> sms = new SurfaceMediaSource(
                     getSurfaceWidth(), getSurfaceHeight());
             sp<SurfaceTextureClient> stc = new SurfaceTextureClient(sms);
@@ -162,7 +162,7 @@
     }
 
     virtual EGLint const* getConfigAttribs() {
-        LOGV("GLTest getConfigAttribs");
+        ALOGV("GLTest getConfigAttribs");
         static EGLint sDefaultConfigAttribs[] = {
             EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
             EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
@@ -392,7 +392,7 @@
 protected:
 
     virtual void SetUp() {
-        LOGV("SMS-GLTest::SetUp()");
+        ALOGV("SMS-GLTest::SetUp()");
         android::ProcessState::self()->startThreadPool();
         mSMS = new SurfaceMediaSource(mYuvTexWidth, mYuvTexHeight);
         mSTC = new SurfaceTextureClient(mSMS);
@@ -423,7 +423,7 @@
 // Methods in SurfaceMediaSourceGLTest
 /////////////////////////////////////////////////////////////////////
 EGLint const* SurfaceMediaSourceGLTest::getConfigAttribs() {
-        LOGV("SurfaceMediaSourceGLTest getConfigAttribs");
+        ALOGV("SurfaceMediaSourceGLTest getConfigAttribs");
     static EGLint sDefaultConfigAttribs[] = {
         EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
         EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
@@ -474,7 +474,7 @@
     mr->setVideoSize(width, height);
     mr->setVideoFrameRate(fps);
     mr->prepare();
-    LOGV("Starting MediaRecorder...");
+    ALOGV("Starting MediaRecorder...");
     CHECK_EQ(OK, mr->start());
     return mr;
 }
@@ -624,8 +624,8 @@
 // Dummy Encoder
 static int testId = 1;
 TEST_F(SurfaceMediaSourceTest, DISABLED_DummyEncodingFromCpuFilledYV12BufferNpotOneBufferPass) {
-    LOGV("Test # %d", testId++);
-    LOGV("Testing OneBufferPass ******************************");
+    ALOGV("Test # %d", testId++);
+    ALOGV("Testing OneBufferPass ******************************");
 
     ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
             HAL_PIXEL_FORMAT_YV12));
@@ -635,8 +635,8 @@
 // Pass the buffer with the wrong height and weight and should not be accepted
 // Dummy Encoder
 TEST_F(SurfaceMediaSourceTest, DISABLED_DummyEncodingFromCpuFilledYV12BufferNpotWrongSizeBufferPass) {
-    LOGV("Test # %d", testId++);
-    LOGV("Testing Wrong size BufferPass ******************************");
+    ALOGV("Test # %d", testId++);
+    ALOGV("Testing Wrong size BufferPass ******************************");
 
     // setting the client side buffer size different than the server size
     ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(),
@@ -653,8 +653,8 @@
 // pass multiple buffers from the native_window the SurfaceMediaSource
 // Dummy Encoder
 TEST_F(SurfaceMediaSourceTest,  DISABLED_DummyEncodingFromCpuFilledYV12BufferNpotMultiBufferPass) {
-    LOGV("Test # %d", testId++);
-    LOGV("Testing MultiBufferPass, Dummy Recorder *********************");
+    ALOGV("Test # %d", testId++);
+    ALOGV("Testing MultiBufferPass, Dummy Recorder *********************");
     ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
             HAL_PIXEL_FORMAT_YV12));
 
@@ -675,8 +675,8 @@
 // Delayed pass of multiple buffers from the native_window the SurfaceMediaSource
 // Dummy Encoder
 TEST_F(SurfaceMediaSourceTest,  DISABLED_DummyLagEncodingFromCpuFilledYV12BufferNpotMultiBufferPass) {
-    LOGV("Test # %d", testId++);
-    LOGV("Testing MultiBufferPass, Dummy Recorder Lagging **************");
+    ALOGV("Test # %d", testId++);
+    ALOGV("Testing MultiBufferPass, Dummy Recorder Lagging **************");
 
     ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
             HAL_PIXEL_FORMAT_YV12));
@@ -700,8 +700,8 @@
 // pass multiple buffers from the native_window the SurfaceMediaSource
 // A dummy writer (MULTITHREADED) is used to simulate actual MPEG4Writer
 TEST_F(SurfaceMediaSourceTest, DISABLED_DummyThreadedEncodingFromCpuFilledYV12BufferNpotMultiBufferPass) {
-    LOGV("Test # %d", testId++);
-    LOGV("Testing MultiBufferPass, Dummy Recorder Multi-Threaded **********");
+    ALOGV("Test # %d", testId++);
+    ALOGV("Testing MultiBufferPass, Dummy Recorder Multi-Threaded **********");
     ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
             HAL_PIXEL_FORMAT_YV12));
 
@@ -724,14 +724,14 @@
 // Very close to the actual camera, except that the
 // buffers are filled and queueud by the CPU instead of GL.
 TEST_F(SurfaceMediaSourceTest, DISABLED_EncodingFromCpuYV12BufferNpotWriteMediaServer) {
-    LOGV("Test # %d", testId++);
-    LOGV("************** Testing the whole pipeline with actual MediaRecorder ***********");
-    LOGV("************** SurfaceMediaSource is same process as mediaserver    ***********");
+    ALOGV("Test # %d", testId++);
+    ALOGV("************** Testing the whole pipeline with actual MediaRecorder ***********");
+    ALOGV("************** SurfaceMediaSource is same process as mediaserver    ***********");
 
     const char *fileName = "/sdcard/outputSurfEncMSource.mp4";
     int fd = open(fileName, O_RDWR | O_CREAT, 0744);
     if (fd < 0) {
-        LOGE("ERROR: Could not open the the file %s, fd = %d !!", fileName, fd);
+        ALOGE("ERROR: Could not open the the file %s, fd = %d !!", fileName, fd);
     }
     CHECK(fd >= 0);
 
@@ -752,11 +752,11 @@
     while (nFramesCount <= 300) {
         oneBufferPassNoFill(mYuvTexWidth, mYuvTexHeight);
         nFramesCount++;
-        LOGV("framesCount = %d", nFramesCount);
+        ALOGV("framesCount = %d", nFramesCount);
     }
 
     ASSERT_EQ(NO_ERROR, native_window_api_disconnect(mANW.get(), NATIVE_WINDOW_API_CPU));
-    LOGV("Stopping MediaRecorder...");
+    ALOGV("Stopping MediaRecorder...");
     CHECK_EQ(OK, mr->stop());
     mr.clear();
     close(fd);
@@ -769,8 +769,8 @@
 // Test to examine whether we can choose the Recordable Android GLConfig
 // DummyRecorder used- no real encoding here
 TEST_F(SurfaceMediaSourceGLTest, ChooseAndroidRecordableEGLConfigDummyWriter) {
-    LOGV("Test # %d", testId++);
-    LOGV("Verify creating a surface w/ right config + dummy writer*********");
+    ALOGV("Test # %d", testId++);
+    ALOGV("Verify creating a surface w/ right config + dummy writer*********");
 
     mSMS = new SurfaceMediaSource(mYuvTexWidth, mYuvTexHeight);
     mSTC = new SurfaceTextureClient(mSMS);
@@ -792,7 +792,7 @@
     while (nFramesCount <= 300) {
         oneBufferPassGL();
         nFramesCount++;
-        LOGV("framesCount = %d", nFramesCount);
+        ALOGV("framesCount = %d", nFramesCount);
     }
 
     EXPECT_TRUE(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
@@ -806,8 +806,8 @@
 // Test to examine whether we can render GL buffers in to the surface
 // created with the native window handle
 TEST_F(SurfaceMediaSourceGLTest, RenderingToRecordableEGLSurfaceWorks) {
-    LOGV("Test # %d", testId++);
-    LOGV("RenderingToRecordableEGLSurfaceWorks *********************");
+    ALOGV("Test # %d", testId++);
+    ALOGV("RenderingToRecordableEGLSurfaceWorks *********************");
     // Do the producer side of things
     glClearColor(0.6, 0.6, 0.6, 0.6);
     glClear(GL_COLOR_BUFFER_BIT);
@@ -852,16 +852,16 @@
 // Actual encoder, Actual GL Buffers Filled SurfaceMediaSource
 // The same pattern is rendered every frame
 TEST_F(SurfaceMediaSourceGLTest, EncodingFromGLRgbaSameImageEachBufNpotWrite) {
-    LOGV("Test # %d", testId++);
-    LOGV("************** Testing the whole pipeline with actual Recorder ***********");
-    LOGV("************** GL Filling the buffers ***********");
+    ALOGV("Test # %d", testId++);
+    ALOGV("************** Testing the whole pipeline with actual Recorder ***********");
+    ALOGV("************** GL Filling the buffers ***********");
     // Note: No need to set the colorformat for the buffers. The colorformat is
     // in the GRAlloc buffers itself.
 
     const char *fileName = "/sdcard/outputSurfEncMSourceGL.mp4";
     int fd = open(fileName, O_RDWR | O_CREAT, 0744);
     if (fd < 0) {
-        LOGE("ERROR: Could not open the the file %s, fd = %d !!", fileName, fd);
+        ALOGE("ERROR: Could not open the the file %s, fd = %d !!", fileName, fd);
     }
     CHECK(fd >= 0);
 
@@ -876,7 +876,7 @@
     while (nFramesCount <= 300) {
         oneBufferPassGL();
         nFramesCount++;
-        LOGV("framesCount = %d", nFramesCount);
+        ALOGV("framesCount = %d", nFramesCount);
     }
 
     EXPECT_TRUE(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
@@ -885,7 +885,7 @@
     eglDestroySurface(mEglDisplay, mEglSurface);
     mEglSurface = EGL_NO_SURFACE;
 
-    LOGV("Stopping MediaRecorder...");
+    ALOGV("Stopping MediaRecorder...");
     CHECK_EQ(OK, mr->stop());
     mr.clear();
     close(fd);
@@ -895,16 +895,16 @@
 // Actual encoder, Actual GL Buffers Filled SurfaceMediaSource
 // A different pattern is rendered every frame
 TEST_F(SurfaceMediaSourceGLTest, EncodingFromGLRgbaDiffImageEachBufNpotWrite) {
-    LOGV("Test # %d", testId++);
-    LOGV("************** Testing the whole pipeline with actual Recorder ***********");
-    LOGV("************** Diff GL Filling the buffers ***********");
+    ALOGV("Test # %d", testId++);
+    ALOGV("************** Testing the whole pipeline with actual Recorder ***********");
+    ALOGV("************** Diff GL Filling the buffers ***********");
     // Note: No need to set the colorformat for the buffers. The colorformat is
     // in the GRAlloc buffers itself.
 
     const char *fileName = "/sdcard/outputSurfEncMSourceGLDiff.mp4";
     int fd = open(fileName, O_RDWR | O_CREAT, 0744);
     if (fd < 0) {
-        LOGE("ERROR: Could not open the the file %s, fd = %d !!", fileName, fd);
+        ALOGE("ERROR: Could not open the the file %s, fd = %d !!", fileName, fd);
     }
     CHECK(fd >= 0);
 
@@ -919,7 +919,7 @@
     while (nFramesCount <= 300) {
         oneBufferPassGL(nFramesCount);
         nFramesCount++;
-        LOGV("framesCount = %d", nFramesCount);
+        ALOGV("framesCount = %d", nFramesCount);
     }
 
     EXPECT_TRUE(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
@@ -928,7 +928,7 @@
     eglDestroySurface(mEglDisplay, mEglSurface);
     mEglSurface = EGL_NO_SURFACE;
 
-    LOGV("Stopping MediaRecorder...");
+    ALOGV("Stopping MediaRecorder...");
     CHECK_EQ(OK, mr->stop());
     mr.clear();
     close(fd);
diff --git a/media/libstagefright/timedtext/TimedTextPlayer.cpp b/media/libstagefright/timedtext/TimedTextPlayer.cpp
index 7c8a747..3014b0b 100644
--- a/media/libstagefright/timedtext/TimedTextPlayer.cpp
+++ b/media/libstagefright/timedtext/TimedTextPlayer.cpp
@@ -91,7 +91,7 @@
 
     if (index >=
             mTextTrackVector.size() + mTextOutOfBandVector.size()) {
-        LOGE("Incorrect text track index: %d", index);
+        ALOGE("Incorrect text track index: %d", index);
         return BAD_VALUE;
     }
 
diff --git a/media/libstagefright/yuv/YUVImage.cpp b/media/libstagefright/yuv/YUVImage.cpp
index b712062..0d67c96 100644
--- a/media/libstagefright/yuv/YUVImage.cpp
+++ b/media/libstagefright/yuv/YUVImage.cpp
@@ -54,7 +54,7 @@
         // Y takes numberOfPixels bytes and U/V take numberOfPixels/4 bytes each.
         numberOfBytes = (size_t)(numberOfPixels + (numberOfPixels >> 1));
     } else {
-        LOGE("Format not supported");
+        ALOGE("Format not supported");
     }
     return numberOfBytes;
 }
@@ -74,7 +74,7 @@
         mVdata = mYdata + numberOfPixels;
         mUdata = mVdata + 1;
     } else {
-        LOGE("Format not supported");
+        ALOGE("Format not supported");
         return false;
     }
     return true;
@@ -98,7 +98,7 @@
         *uOffset = 2*uvOffset;
         *vOffset = 2*uvOffset;
     } else {
-        LOGE("Format not supported");
+        ALOGE("Format not supported");
         return false;
     }
 
@@ -122,7 +122,7 @@
         *uDataOffsetIncrement = 2*uvDataOffsetIncrement;
         *vDataOffsetIncrement = 2*uvDataOffsetIncrement;
     } else {
-        LOGE("Format not supported");
+        ALOGE("Format not supported");
         return false;
     }
 
diff --git a/media/mediaserver/main_mediaserver.cpp b/media/mediaserver/main_mediaserver.cpp
index 7094cfa..f078192 100644
--- a/media/mediaserver/main_mediaserver.cpp
+++ b/media/mediaserver/main_mediaserver.cpp
@@ -37,7 +37,7 @@
 {
     sp<ProcessState> proc(ProcessState::self());
     sp<IServiceManager> sm = defaultServiceManager();
-    LOGI("ServiceManager: %p", sm.get());
+    ALOGI("ServiceManager: %p", sm.get());
     AudioFlinger::instantiate();
     MediaPlayerService::instantiate();
     CameraService::instantiate();
diff --git a/media/mtp/MtpDataPacket.cpp b/media/mtp/MtpDataPacket.cpp
index cfea7e8..930f0b0 100644
--- a/media/mtp/MtpDataPacket.cpp
+++ b/media/mtp/MtpDataPacket.cpp
@@ -418,7 +418,7 @@
 // Queue a read request.  Call readDataWait to wait for result
 int MtpDataPacket::readDataAsync(struct usb_request *req) {
     if (usb_request_queue(req)) {
-        LOGE("usb_endpoint_queue failed, errno: %d", errno);
+        ALOGE("usb_endpoint_queue failed, errno: %d", errno);
         return -1;
     }
     return 0;
diff --git a/media/mtp/MtpDevice.cpp b/media/mtp/MtpDevice.cpp
index 2e86159..bf7795c 100644
--- a/media/mtp/MtpDevice.cpp
+++ b/media/mtp/MtpDevice.cpp
@@ -53,7 +53,7 @@
 MtpDevice* MtpDevice::open(const char* deviceName, int fd) {
     struct usb_device *device = usb_device_new(deviceName, fd);
     if (!device) {
-        LOGE("usb_device_new failed for %s", deviceName);
+        ALOGE("usb_device_new failed for %s", deviceName);
         return NULL;
     }
 
@@ -72,7 +72,7 @@
             {
                 char* manufacturerName = usb_device_get_manufacturer_name(device);
                 char* productName = usb_device_get_product_name(device);
-                LOGD("Found camera: \"%s\" \"%s\"\n", manufacturerName, productName);
+                ALOGD("Found camera: \"%s\" \"%s\"\n", manufacturerName, productName);
                 free(manufacturerName);
                 free(productName);
             } else if (interface->bInterfaceClass == 0xFF &&
@@ -90,7 +90,7 @@
                 // Looks like an android style MTP device
                 char* manufacturerName = usb_device_get_manufacturer_name(device);
                 char* productName = usb_device_get_product_name(device);
-                LOGD("Found MTP device: \"%s\" \"%s\"\n", manufacturerName, productName);
+                ALOGD("Found MTP device: \"%s\" \"%s\"\n", manufacturerName, productName);
                 free(manufacturerName);
                 free(productName);
             }
@@ -134,7 +134,7 @@
             for (int i = 0; i < 3; i++) {
                 ep = (struct usb_endpoint_descriptor *)usb_descriptor_iter_next(&iter);
                 if (!ep || ep->bDescriptorType != USB_DT_ENDPOINT) {
-                    LOGE("endpoints not found\n");
+                    ALOGE("endpoints not found\n");
                     usb_device_close(device);
                     return NULL;
                 }
@@ -149,13 +149,13 @@
                 }
             }
             if (!ep_in_desc || !ep_out_desc || !ep_intr_desc) {
-                LOGE("endpoints not found\n");
+                ALOGE("endpoints not found\n");
                 usb_device_close(device);
                 return NULL;
             }
 
             if (usb_device_claim_interface(device, interface->bInterfaceNumber)) {
-                LOGE("usb_device_claim_interface failed errno: %d\n", errno);
+                ALOGE("usb_device_claim_interface failed errno: %d\n", errno);
                 usb_device_close(device);
                 return NULL;
             }
@@ -168,7 +168,7 @@
     }
 
     usb_device_close(device);
-    LOGE("device not found");
+    ALOGE("device not found");
     return NULL;
 }
 
@@ -232,7 +232,7 @@
         mDeviceInfo->print();
 
         if (mDeviceInfo->mDeviceProperties) {
-            LOGI("***** DEVICE PROPERTIES *****\n");
+            ALOGI("***** DEVICE PROPERTIES *****\n");
             int count = mDeviceInfo->mDeviceProperties->size();
             for (int i = 0; i < count; i++) {
                 MtpDeviceProperty propCode = (*mDeviceInfo->mDeviceProperties)[i];
@@ -246,11 +246,11 @@
     }
 
     if (mDeviceInfo->mPlaybackFormats) {
-            LOGI("***** OBJECT PROPERTIES *****\n");
+            ALOGI("***** OBJECT PROPERTIES *****\n");
         int count = mDeviceInfo->mPlaybackFormats->size();
         for (int i = 0; i < count; i++) {
             MtpObjectFormat format = (*mDeviceInfo->mPlaybackFormats)[i];
-            LOGI("*** FORMAT: %s\n", MtpDebug::getFormatCodeName(format));
+            ALOGI("*** FORMAT: %s\n", MtpDebug::getFormatCodeName(format));
             MtpObjectPropertyList* props = getObjectPropsSupported(format);
             if (props) {
                 for (int j = 0; j < props->size(); j++) {
@@ -260,7 +260,7 @@
                         property->print();
                         delete property;
                     } else {
-                        LOGE("could not fetch property: %s",
+                        ALOGE("could not fetch property: %s",
                                 MtpDebug::getObjectPropCodeName(prop));
                     }
                 }
@@ -584,7 +584,7 @@
             && mData.readDataHeader(mRequestIn1)) {
         uint32_t length = mData.getContainerLength();
         if (length - MTP_CONTAINER_HEADER_SIZE != objectSize) {
-            LOGE("readObject error objectSize: %d, length: %d",
+            ALOGE("readObject error objectSize: %d, length: %d",
                     objectSize, length);
             goto fail;
         }
@@ -617,7 +617,7 @@
                 // queue up a read request
                 req->buffer_length = (remaining > sizeof(buffer1) ? sizeof(buffer1) : remaining);
                 if (mData.readDataAsync(req)) {
-                    LOGE("readDataAsync failed");
+                    ALOGE("readDataAsync failed");
                     goto fail;
                 }
             } else {
@@ -627,7 +627,7 @@
             if (writeBuffer) {
                 // write previous buffer
                 if (!callback(writeBuffer, offset, writeLength, clientData)) {
-                    LOGE("write failed");
+                    ALOGE("write failed");
                     // wait for pending read before failing
                     if (req)
                         mData.readDataWait(mDevice);
@@ -666,10 +666,10 @@
 
 // reads the object's data and writes it to the specified file path
 bool MtpDevice::readObject(MtpObjectHandle handle, const char* destPath, int group, int perm) {
-    LOGD("readObject: %s", destPath);
+    ALOGD("readObject: %s", destPath);
     int fd = ::open(destPath, O_RDWR | O_CREAT | O_TRUNC);
     if (fd < 0) {
-        LOGE("open failed for %s", destPath);
+        ALOGE("open failed for %s", destPath);
         return false;
     }
 
@@ -718,7 +718,7 @@
                 // queue up a read request
                 req->buffer_length = (remaining > sizeof(buffer1) ? sizeof(buffer1) : remaining);
                 if (mData.readDataAsync(req)) {
-                    LOGE("readDataAsync failed");
+                    ALOGE("readDataAsync failed");
                     goto fail;
                 }
             } else {
@@ -728,7 +728,7 @@
             if (writeBuffer) {
                 // write previous buffer
                 if (write(fd, writeBuffer, writeLength) != writeLength) {
-                    LOGE("write failed");
+                    ALOGE("write failed");
                     // wait for pending read before failing
                     if (req)
                         mData.readDataWait(mDevice);
@@ -765,7 +765,7 @@
 }
 
 bool MtpDevice::sendRequest(MtpOperationCode operation) {
-    LOGV("sendRequest: %s\n", MtpDebug::getOperationCodeName(operation));
+    ALOGV("sendRequest: %s\n", MtpDebug::getOperationCodeName(operation));
     mReceivedResponse = false;
     mRequest.setOperationCode(operation);
     if (mTransactionID > 0)
@@ -776,7 +776,7 @@
 }
 
 bool MtpDevice::sendData() {
-    LOGV("sendData\n");
+    ALOGV("sendData\n");
     mData.setOperationCode(mRequest.getOperationCode());
     mData.setTransactionID(mRequest.getTransactionID());
     int ret = mData.write(mRequestOut);
@@ -787,10 +787,10 @@
 bool MtpDevice::readData() {
     mData.reset();
     int ret = mData.read(mRequestIn1);
-    LOGV("readData returned %d\n", ret);
+    ALOGV("readData returned %d\n", ret);
     if (ret >= MTP_CONTAINER_HEADER_SIZE) {
         if (mData.getContainerType() == MTP_CONTAINER_TYPE_RESPONSE) {
-            LOGD("got response packet instead of data packet");
+            ALOGD("got response packet instead of data packet");
             // we got a response packet rather than data
             // copy it to mResponse
             mResponse.copyFrom(mData);
@@ -801,7 +801,7 @@
         return true;
     }
     else {
-        LOGV("readResponse failed\n");
+        ALOGV("readResponse failed\n");
         return false;
     }
 }
@@ -813,7 +813,7 @@
 }
 
 MtpResponseCode MtpDevice::readResponse() {
-    LOGV("readResponse\n");
+    ALOGV("readResponse\n");
     if (mReceivedResponse) {
         mReceivedResponse = false;
         return mResponse.getResponseCode();
@@ -827,7 +827,7 @@
         mResponse.dump();
         return mResponse.getResponseCode();
     } else {
-        LOGD("readResponse failed\n");
+        ALOGD("readResponse failed\n");
         return -1;
     }
 }
diff --git a/media/mtp/MtpDeviceInfo.cpp b/media/mtp/MtpDeviceInfo.cpp
index 5a9322e..108e2b8 100644
--- a/media/mtp/MtpDeviceInfo.cpp
+++ b/media/mtp/MtpDeviceInfo.cpp
@@ -88,9 +88,9 @@
 }
 
 void MtpDeviceInfo::print() {
-    LOGV("Device Info:\n\tmStandardVersion: %d\n\tmVendorExtensionID: %d\n\tmVendorExtensionVersiony: %d\n",
+    ALOGV("Device Info:\n\tmStandardVersion: %d\n\tmVendorExtensionID: %d\n\tmVendorExtensionVersiony: %d\n",
             mStandardVersion, mVendorExtensionID, mVendorExtensionVersion);
-    LOGV("\tmVendorExtensionDesc: %s\n\tmFunctionalCode: %d\n\tmManufacturer: %s\n\tmModel: %s\n\tmVersion: %s\n\tmSerial: %s\n",
+    ALOGV("\tmVendorExtensionDesc: %s\n\tmFunctionalCode: %d\n\tmManufacturer: %s\n\tmModel: %s\n\tmVersion: %s\n\tmSerial: %s\n",
             mVendorExtensionDesc, mFunctionalCode, mManufacturer, mModel, mVersion, mSerial);
 }
 
diff --git a/media/mtp/MtpObjectInfo.cpp b/media/mtp/MtpObjectInfo.cpp
index ea68c3b..cd15343 100644
--- a/media/mtp/MtpObjectInfo.cpp
+++ b/media/mtp/MtpObjectInfo.cpp
@@ -91,17 +91,17 @@
 }
 
 void MtpObjectInfo::print() {
-    LOGD("MtpObject Info %08X: %s\n", mHandle, mName);
-    LOGD("  mStorageID: %08X mFormat: %04X mProtectionStatus: %d\n",
+    ALOGD("MtpObject Info %08X: %s\n", mHandle, mName);
+    ALOGD("  mStorageID: %08X mFormat: %04X mProtectionStatus: %d\n",
             mStorageID, mFormat, mProtectionStatus);
-    LOGD("  mCompressedSize: %d mThumbFormat: %04X mThumbCompressedSize: %d\n",
+    ALOGD("  mCompressedSize: %d mThumbFormat: %04X mThumbCompressedSize: %d\n",
             mCompressedSize, mFormat, mThumbCompressedSize);
-    LOGD("  mThumbPixWidth: %d mThumbPixHeight: %d\n", mThumbPixWidth, mThumbPixHeight);
-    LOGD("  mImagePixWidth: %d mImagePixHeight: %d mImagePixDepth: %d\n",
+    ALOGD("  mThumbPixWidth: %d mThumbPixHeight: %d\n", mThumbPixWidth, mThumbPixHeight);
+    ALOGD("  mImagePixWidth: %d mImagePixHeight: %d mImagePixDepth: %d\n",
             mImagePixWidth, mImagePixHeight, mImagePixDepth);
-    LOGD("  mParent: %08X mAssociationType: %04X mAssociationDesc: %04X\n",
+    ALOGD("  mParent: %08X mAssociationType: %04X mAssociationDesc: %04X\n",
             mParent, mAssociationType, mAssociationDesc);
-    LOGD("  mSequenceNumber: %d mDateCreated: %ld mDateModified: %ld mKeywords: %s\n",
+    ALOGD("  mSequenceNumber: %d mDateCreated: %ld mDateModified: %ld mKeywords: %s\n",
             mSequenceNumber, mDateCreated, mDateModified, mKeywords);
 }
 
diff --git a/media/mtp/MtpPacket.cpp b/media/mtp/MtpPacket.cpp
index baf99e5..dd07843 100644
--- a/media/mtp/MtpPacket.cpp
+++ b/media/mtp/MtpPacket.cpp
@@ -36,7 +36,7 @@
 {
     mBuffer = (uint8_t *)malloc(bufferSize);
     if (!mBuffer) {
-        LOGE("out of memory!");
+        ALOGE("out of memory!");
         abort();
     }
 }
@@ -57,7 +57,7 @@
         int newLength = length + mAllocationIncrement;
         mBuffer = (uint8_t *)realloc(mBuffer, newLength);
         if (!mBuffer) {
-            LOGE("out of memory!");
+            ALOGE("out of memory!");
             abort();
         }
         mBufferSize = newLength;
@@ -73,15 +73,15 @@
         sprintf(bufptr, "%02X ", mBuffer[i]);
         bufptr += strlen(bufptr);
         if (i % DUMP_BYTES_PER_ROW == (DUMP_BYTES_PER_ROW - 1)) {
-            LOGV("%s", buffer);
+            ALOGV("%s", buffer);
             bufptr = buffer;
         }
     }
     if (bufptr != buffer) {
         // print last line
-        LOGV("%s", buffer);
+        ALOGV("%s", buffer);
     }
-    LOGV("\n");
+    ALOGV("\n");
 }
 
 void MtpPacket::copyFrom(const MtpPacket& src) {
@@ -134,7 +134,7 @@
 
 uint32_t MtpPacket::getParameter(int index) const {
     if (index < 1 || index > 5) {
-        LOGE("index %d out of range in MtpPacket::getParameter", index);
+        ALOGE("index %d out of range in MtpPacket::getParameter", index);
         return 0;
     }
     return getUInt32(MTP_CONTAINER_PARAMETER_OFFSET + (index - 1) * sizeof(uint32_t));
@@ -142,7 +142,7 @@
 
 void MtpPacket::setParameter(int index, uint32_t value) {
     if (index < 1 || index > 5) {
-        LOGE("index %d out of range in MtpPacket::setParameter", index);
+        ALOGE("index %d out of range in MtpPacket::setParameter", index);
         return;
     }
     int offset = MTP_CONTAINER_PARAMETER_OFFSET + (index - 1) * sizeof(uint32_t);
diff --git a/media/mtp/MtpProperty.cpp b/media/mtp/MtpProperty.cpp
index 8016c35..64dd45b 100644
--- a/media/mtp/MtpProperty.cpp
+++ b/media/mtp/MtpProperty.cpp
@@ -91,7 +91,7 @@
                 mDefaultValue.u.u64 = defaultValue;
                 break;
             default:
-                LOGE("unknown type %04X in MtpProperty::MtpProperty", type);
+                ALOGE("unknown type %04X in MtpProperty::MtpProperty", type);
         }
     }
 }
@@ -267,7 +267,7 @@
             mStepSize.u.u64 = step;
             break;
         default:
-            LOGE("unsupported type for MtpProperty::setRange");
+            ALOGE("unsupported type for MtpProperty::setRange");
             break;
     }
 }
@@ -306,7 +306,7 @@
                     mEnumValues[i].u.u64 = value;
                     break;
                 default:
-                    LOGE("unsupported type for MtpProperty::setEnum");
+                    ALOGE("unsupported type for MtpProperty::setEnum");
                     break;
         }
     }
@@ -320,18 +320,18 @@
     MtpString buffer;
     bool deviceProp = isDeviceProperty();
     if (deviceProp)
-        LOGI("    %s (%04X)", MtpDebug::getDevicePropCodeName(mCode), mCode);
+        ALOGI("    %s (%04X)", MtpDebug::getDevicePropCodeName(mCode), mCode);
     else
-        LOGI("    %s (%04X)", MtpDebug::getObjectPropCodeName(mCode), mCode);
-    LOGI("    type %04X", mType);
-    LOGI("    writeable %s", (mWriteable ? "true" : "false"));
+        ALOGI("    %s (%04X)", MtpDebug::getObjectPropCodeName(mCode), mCode);
+    ALOGI("    type %04X", mType);
+    ALOGI("    writeable %s", (mWriteable ? "true" : "false"));
     buffer = "    default value: ";
     print(mDefaultValue, buffer);
-    LOGI("%s", (const char *)buffer);
+    ALOGI("%s", (const char *)buffer);
     if (deviceProp) {
         buffer = "    current value: ";
         print(mCurrentValue, buffer);
-        LOGI("%s", (const char *)buffer);
+        ALOGI("%s", (const char *)buffer);
     }
     switch (mFormFlag) {
         case kFormNone:
@@ -344,7 +344,7 @@
             buffer += ", ";
             print(mStepSize, buffer);
             buffer += ")";
-            LOGI("%s", (const char *)buffer);
+            ALOGI("%s", (const char *)buffer);
             break;
         case kFormEnum:
             buffer = "    Enum { ";
@@ -353,13 +353,13 @@
                 buffer += " ";
             }
             buffer += "}";
-            LOGI("%s", (const char *)buffer);
+            ALOGI("%s", (const char *)buffer);
             break;
         case kFormDateTime:
-            LOGI("    DateTime\n");
+            ALOGI("    DateTime\n");
             break;
         default:
-            LOGI("    form %d\n", mFormFlag);
+            ALOGI("    form %d\n", mFormFlag);
             break;
     }
 }
@@ -402,7 +402,7 @@
             buffer.appendFormat("%s", value.str);
             break;
         default:
-            LOGE("unsupported type for MtpProperty::print\n");
+            ALOGE("unsupported type for MtpProperty::print\n");
             break;
     }
 }
@@ -456,7 +456,7 @@
             value.str = strdup(stringBuffer);
             break;
         default:
-            LOGE("unknown type %04X in MtpProperty::readValue", mType);
+            ALOGE("unknown type %04X in MtpProperty::readValue", mType);
     }
 }
 
@@ -511,7 +511,7 @@
                 packet.putEmptyString();
             break;
         default:
-            LOGE("unknown type %04X in MtpProperty::writeValue", mType);
+            ALOGE("unknown type %04X in MtpProperty::writeValue", mType);
     }
 }
 
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index 1dcfb74..5606187 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -153,12 +153,12 @@
 void MtpServer::run() {
     int fd = mFD;
 
-    LOGV("MtpServer::run fd: %d\n", fd);
+    ALOGV("MtpServer::run fd: %d\n", fd);
 
     while (1) {
         int ret = mRequest.read(fd);
         if (ret < 0) {
-            LOGV("request read returned %d, errno: %d", ret, errno);
+            ALOGV("request read returned %d, errno: %d", ret, errno);
             if (errno == ECANCELED) {
                 // return to top of loop and wait for next command
                 continue;
@@ -168,7 +168,7 @@
         MtpOperationCode operation = mRequest.getOperationCode();
         MtpTransactionID transaction = mRequest.getTransactionID();
 
-        LOGV("operation: %s", MtpDebug::getOperationCodeName(operation));
+        ALOGV("operation: %s", MtpDebug::getOperationCodeName(operation));
         mRequest.dump();
 
         // FIXME need to generalize this
@@ -179,14 +179,14 @@
         if (dataIn) {
             int ret = mData.read(fd);
             if (ret < 0) {
-                LOGE("data read returned %d, errno: %d", ret, errno);
+                ALOGE("data read returned %d, errno: %d", ret, errno);
                 if (errno == ECANCELED) {
                     // return to top of loop and wait for next command
                     continue;
                 }
                 break;
             }
-            LOGV("received data:");
+            ALOGV("received data:");
             mData.dump();
         } else {
             mData.reset();
@@ -196,11 +196,11 @@
             if (!dataIn && mData.hasData()) {
                 mData.setOperationCode(operation);
                 mData.setTransactionID(transaction);
-                LOGV("sending data:");
+                ALOGV("sending data:");
                 mData.dump();
                 ret = mData.write(fd);
                 if (ret < 0) {
-                    LOGE("request write returned %d, errno: %d", ret, errno);
+                    ALOGE("request write returned %d, errno: %d", ret, errno);
                     if (errno == ECANCELED) {
                         // return to top of loop and wait for next command
                         continue;
@@ -210,11 +210,11 @@
             }
 
             mResponse.setTransactionID(transaction);
-            LOGV("sending response %04X", mResponse.getResponseCode());
+            ALOGV("sending response %04X", mResponse.getResponseCode());
             ret = mResponse.write(fd);
             mResponse.dump();
             if (ret < 0) {
-                LOGE("request write returned %d, errno: %d", ret, errno);
+                ALOGE("request write returned %d, errno: %d", ret, errno);
                 if (errno == ECANCELED) {
                     // return to top of loop and wait for next command
                     continue;
@@ -222,7 +222,7 @@
                 break;
             }
         } else {
-            LOGV("skipping response\n");
+            ALOGV("skipping response\n");
         }
     }
 
@@ -242,22 +242,22 @@
 }
 
 void MtpServer::sendObjectAdded(MtpObjectHandle handle) {
-    LOGV("sendObjectAdded %d\n", handle);
+    ALOGV("sendObjectAdded %d\n", handle);
     sendEvent(MTP_EVENT_OBJECT_ADDED, handle);
 }
 
 void MtpServer::sendObjectRemoved(MtpObjectHandle handle) {
-    LOGV("sendObjectRemoved %d\n", handle);
+    ALOGV("sendObjectRemoved %d\n", handle);
     sendEvent(MTP_EVENT_OBJECT_REMOVED, handle);
 }
 
 void MtpServer::sendStoreAdded(MtpStorageID id) {
-    LOGV("sendStoreAdded %08X\n", id);
+    ALOGV("sendStoreAdded %08X\n", id);
     sendEvent(MTP_EVENT_STORE_ADDED, id);
 }
 
 void MtpServer::sendStoreRemoved(MtpStorageID id) {
-    LOGV("sendStoreRemoved %08X\n", id);
+    ALOGV("sendStoreRemoved %08X\n", id);
     sendEvent(MTP_EVENT_STORE_REMOVED, id);
 }
 
@@ -267,7 +267,7 @@
         mEvent.setTransactionID(mRequest.getTransactionID());
         mEvent.setParameter(1, param1);
         int ret = mEvent.write(mFD);
-        LOGV("mEvent.write returned %d\n", ret);
+        ALOGV("mEvent.write returned %d\n", ret);
     }
 }
 
@@ -296,7 +296,7 @@
             return;
         }
     }
-    LOGE("ObjectEdit not found in removeEditObject");
+    ALOGE("ObjectEdit not found in removeEditObject");
 }
 
 void MtpServer::commitEdit(ObjectEdit* edit) {
@@ -314,7 +314,7 @@
 
     if (mSendObjectHandle != kInvalidObjectHandle && operation != MTP_OPERATION_SEND_OBJECT) {
         // FIXME - need to delete mSendObjectHandle from the database
-        LOGE("expected SendObject after SendObjectInfo");
+        ALOGE("expected SendObject after SendObjectInfo");
         mSendObjectHandle = kInvalidObjectHandle;
     }
 
@@ -408,7 +408,7 @@
             response = doEndEditObject();
             break;
         default:
-            LOGE("got unsupported command %s", MtpDebug::getOperationCodeName(operation));
+            ALOGE("got unsupported command %s", MtpDebug::getOperationCodeName(operation));
             response = MTP_RESPONSE_OPERATION_NOT_SUPPORTED;
             break;
     }
@@ -614,7 +614,7 @@
         return MTP_RESPONSE_INVALID_OBJECT_HANDLE;
     MtpObjectHandle handle = mRequest.getParameter(1);
     MtpObjectProperty property = mRequest.getParameter(2);
-    LOGV("GetObjectPropValue %d %s\n", handle,
+    ALOGV("GetObjectPropValue %d %s\n", handle,
             MtpDebug::getObjectPropCodeName(property));
 
     return mDatabase->getObjectPropertyValue(handle, property, mData);
@@ -625,7 +625,7 @@
         return MTP_RESPONSE_INVALID_OBJECT_HANDLE;
     MtpObjectHandle handle = mRequest.getParameter(1);
     MtpObjectProperty property = mRequest.getParameter(2);
-    LOGV("SetObjectPropValue %d %s\n", handle,
+    ALOGV("SetObjectPropValue %d %s\n", handle,
             MtpDebug::getObjectPropCodeName(property));
 
     return mDatabase->setObjectPropertyValue(handle, property, mData);
@@ -633,7 +633,7 @@
 
 MtpResponseCode MtpServer::doGetDevicePropValue() {
     MtpDeviceProperty property = mRequest.getParameter(1);
-    LOGV("GetDevicePropValue %s\n",
+    ALOGV("GetDevicePropValue %s\n",
             MtpDebug::getDevicePropCodeName(property));
 
     return mDatabase->getDevicePropertyValue(property, mData);
@@ -641,7 +641,7 @@
 
 MtpResponseCode MtpServer::doSetDevicePropValue() {
     MtpDeviceProperty property = mRequest.getParameter(1);
-    LOGV("SetDevicePropValue %s\n",
+    ALOGV("SetDevicePropValue %s\n",
             MtpDebug::getDevicePropCodeName(property));
 
     return mDatabase->setDevicePropertyValue(property, mData);
@@ -649,7 +649,7 @@
 
 MtpResponseCode MtpServer::doResetDevicePropValue() {
     MtpDeviceProperty property = mRequest.getParameter(1);
-    LOGV("ResetDevicePropValue %s\n",
+    ALOGV("ResetDevicePropValue %s\n",
             MtpDebug::getDevicePropCodeName(property));
 
     return mDatabase->resetDeviceProperty(property);
@@ -665,7 +665,7 @@
     uint32_t property = mRequest.getParameter(3);
     int groupCode = mRequest.getParameter(4);
     int depth = mRequest.getParameter(5);
-   LOGV("GetObjectPropList %d format: %s property: %s group: %d depth: %d\n",
+   ALOGV("GetObjectPropList %d format: %s property: %s group: %d depth: %d\n",
             handle, MtpDebug::getFormatCodeName(format),
             MtpDebug::getObjectPropCodeName(property), groupCode, depth);
 
@@ -736,7 +736,7 @@
 
     // then transfer the file
     int ret = ioctl(mFD, MTP_SEND_FILE_WITH_HEADER, (unsigned long)&mfr);
-    LOGV("MTP_SEND_FILE_WITH_HEADER returned %d\n", ret);
+    ALOGV("MTP_SEND_FILE_WITH_HEADER returned %d\n", ret);
     close(mfr.fd);
     if (ret < 0) {
         if (errno == ECANCELED)
@@ -802,7 +802,7 @@
 
     // transfer the file
     int ret = ioctl(mFD, MTP_SEND_FILE_WITH_HEADER, (unsigned long)&mfr);
-    LOGV("MTP_SEND_FILE_WITH_HEADER returned %d\n", ret);
+    ALOGV("MTP_SEND_FILE_WITH_HEADER returned %d\n", ret);
     close(mfr.fd);
     if (ret < 0) {
         if (errno == ECANCELED)
@@ -857,7 +857,7 @@
     mData.getString(modified);     // date modified
     // keywords follow
 
-    LOGV("name: %s format: %04X\n", (const char *)name, format);
+    ALOGV("name: %s format: %04X\n", (const char *)name, format);
     time_t modifiedTime;
     if (!parseDateTime(modified, modifiedTime))
         modifiedTime = 0;
@@ -878,7 +878,7 @@
             return MTP_RESPONSE_OBJECT_TOO_LARGE;
     }
 
-LOGD("path: %s parent: %d storageID: %08X", (const char*)path, parent, storageID);
+    ALOGD("path: %s parent: %d storageID: %08X", (const char*)path, parent, storageID);
     MtpObjectHandle handle = mDatabase->beginSendObject((const char*)path,
             format, parent, storageID, mSendObjectFileSize, modifiedTime);
     if (handle == kInvalidObjectHandle) {
@@ -917,7 +917,7 @@
     int ret, initialData;
 
     if (mSendObjectHandle == kInvalidObjectHandle) {
-        LOGE("Expected SendObjectInfo before SendObject");
+        ALOGE("Expected SendObjectInfo before SendObject");
         result = MTP_RESPONSE_NO_VALID_OBJECT_INFO;
         goto done;
     }
@@ -954,10 +954,10 @@
             mfr.length = mSendObjectFileSize - initialData;
         }
 
-        LOGV("receiving %s\n", (const char *)mSendObjectFilePath);
+        ALOGV("receiving %s\n", (const char *)mSendObjectFilePath);
         // transfer the file
         ret = ioctl(mFD, MTP_RECEIVE_FILE, (unsigned long)&mfr);
-        LOGV("MTP_RECEIVE_FILE returned %d\n", ret);
+        ALOGV("MTP_RECEIVE_FILE returned %d\n", ret);
     }
     close(mfr.fd);
 
@@ -984,7 +984,7 @@
     char pathbuf[PATH_MAX];
     int pathLength = strlen(path);
     if (pathLength >= sizeof(pathbuf) - 1) {
-        LOGE("path too long: %s\n", path);
+        ALOGE("path too long: %s\n", path);
     }
     strcpy(pathbuf, path);
     if (pathbuf[pathLength - 1] != '/') {
@@ -995,7 +995,7 @@
 
     DIR* dir = opendir(path);
     if (!dir) {
-        LOGE("opendir %s failed: %s", path, strerror(errno));
+        ALOGE("opendir %s failed: %s", path, strerror(errno));
         return;
     }
 
@@ -1010,7 +1010,7 @@
 
         int nameLength = strlen(name);
         if (nameLength > pathRemaining) {
-            LOGE("path %s/%s too long\n", path, name);
+            ALOGE("path %s/%s too long\n", path, name);
             continue;
         }
         strcpy(fileSpot, name);
@@ -1036,7 +1036,7 @@
             unlink(path);
         }
     } else {
-        LOGE("deletePath stat failed for %s: %s", path, strerror(errno));
+        ALOGE("deletePath stat failed for %s: %s", path, strerror(errno));
     }
 }
 
@@ -1052,7 +1052,7 @@
     int64_t fileLength;
     int result = mDatabase->getObjectFilePath(handle, filePath, fileLength, format);
     if (result == MTP_RESPONSE_OK) {
-        LOGV("deleting %s", (const char *)filePath);
+        ALOGV("deleting %s", (const char *)filePath);
         result = mDatabase->deleteFile(handle);
         // Don't delete the actual files unless the database deletion is allowed
         if (result == MTP_RESPONSE_OK) {
@@ -1066,7 +1066,7 @@
 MtpResponseCode MtpServer::doGetObjectPropDesc() {
     MtpObjectProperty propCode = mRequest.getParameter(1);
     MtpObjectFormat format = mRequest.getParameter(2);
-    LOGV("GetObjectPropDesc %s %s\n", MtpDebug::getObjectPropCodeName(propCode),
+    ALOGV("GetObjectPropDesc %s %s\n", MtpDebug::getObjectPropCodeName(propCode),
                                         MtpDebug::getFormatCodeName(format));
     MtpProperty* property = mDatabase->getObjectPropertyDesc(propCode, format);
     if (!property)
@@ -1078,7 +1078,7 @@
 
 MtpResponseCode MtpServer::doGetDevicePropDesc() {
     MtpDeviceProperty propCode = mRequest.getParameter(1);
-    LOGV("GetDevicePropDesc %s\n", MtpDebug::getDevicePropCodeName(propCode));
+    ALOGV("GetDevicePropDesc %s\n", MtpDebug::getDevicePropCodeName(propCode));
     MtpProperty* property = mDatabase->getDevicePropertyDesc(propCode);
     if (!property)
         return MTP_RESPONSE_DEVICE_PROP_NOT_SUPPORTED;
@@ -1098,18 +1098,18 @@
 
     ObjectEdit* edit = getEditObject(handle);
     if (!edit) {
-        LOGE("object not open for edit in doSendPartialObject");
+        ALOGE("object not open for edit in doSendPartialObject");
         return MTP_RESPONSE_GENERAL_ERROR;
     }
 
     // can't start writing past the end of the file
     if (offset > edit->mSize) {
-        LOGD("writing past end of object, offset: %lld, edit->mSize: %lld", offset, edit->mSize);
+        ALOGD("writing past end of object, offset: %lld, edit->mSize: %lld", offset, edit->mSize);
         return MTP_RESPONSE_GENERAL_ERROR;
     }
 
     const char* filePath = (const char *)edit->mPath;
-    LOGV("receiving partial %s %lld %lld\n", filePath, offset, length);
+    ALOGV("receiving partial %s %lld %lld\n", filePath, offset, length);
 
     // read the header, and possibly some data
     int ret = mData.read(mFD);
@@ -1131,7 +1131,7 @@
 
         // transfer the file
         ret = ioctl(mFD, MTP_RECEIVE_FILE, (unsigned long)&mfr);
-        LOGV("MTP_RECEIVE_FILE returned %d", ret);
+        ALOGV("MTP_RECEIVE_FILE returned %d", ret);
     }
     if (ret < 0) {
         mResponse.setParameter(1, 0);
@@ -1155,7 +1155,7 @@
     MtpObjectHandle handle = mRequest.getParameter(1);
     ObjectEdit* edit = getEditObject(handle);
     if (!edit) {
-        LOGE("object not open for edit in doTruncateObject");
+        ALOGE("object not open for edit in doTruncateObject");
         return MTP_RESPONSE_GENERAL_ERROR;
     }
 
@@ -1173,7 +1173,7 @@
 MtpResponseCode MtpServer::doBeginEditObject() {
     MtpObjectHandle handle = mRequest.getParameter(1);
     if (getEditObject(handle)) {
-        LOGE("object already open for edit in doBeginEditObject");
+        ALOGE("object already open for edit in doBeginEditObject");
         return MTP_RESPONSE_GENERAL_ERROR;
     }
 
@@ -1186,7 +1186,7 @@
 
     int fd = open((const char *)path, O_RDWR | O_EXCL);
     if (fd < 0) {
-        LOGE("open failed for %s in doBeginEditObject (%d)", (const char *)path, errno);
+        ALOGE("open failed for %s in doBeginEditObject (%d)", (const char *)path, errno);
         return MTP_RESPONSE_GENERAL_ERROR;
     }
 
@@ -1198,7 +1198,7 @@
     MtpObjectHandle handle = mRequest.getParameter(1);
     ObjectEdit* edit = getEditObject(handle);
     if (!edit) {
-        LOGE("object not open for edit in doEndEditObject");
+        ALOGE("object not open for edit in doEndEditObject");
         return MTP_RESPONSE_GENERAL_ERROR;
     }
 
diff --git a/media/mtp/MtpStorage.cpp b/media/mtp/MtpStorage.cpp
index 941e303..d77ca72 100644
--- a/media/mtp/MtpStorage.cpp
+++ b/media/mtp/MtpStorage.cpp
@@ -43,7 +43,7 @@
         mReserveSpace(reserveSpace),
         mRemovable(removable)
 {
-    LOGV("MtpStorage id: %d path: %s\n", id, filePath);
+    ALOGV("MtpStorage id: %d path: %s\n", id, filePath);
 }
 
 MtpStorage::~MtpStorage() {
diff --git a/media/mtp/MtpStorageInfo.cpp b/media/mtp/MtpStorageInfo.cpp
index ca64ac0..dcd37cd 100644
--- a/media/mtp/MtpStorageInfo.cpp
+++ b/media/mtp/MtpStorageInfo.cpp
@@ -61,11 +61,11 @@
 }
 
 void MtpStorageInfo::print() {
-    LOGD("Storage Info %08X:\n\tmStorageType: %d\n\tmFileSystemType: %d\n\tmAccessCapability: %d\n",
+    ALOGD("Storage Info %08X:\n\tmStorageType: %d\n\tmFileSystemType: %d\n\tmAccessCapability: %d\n",
             mStorageID, mStorageType, mFileSystemType, mAccessCapability);
-    LOGD("\tmMaxCapacity: %lld\n\tmFreeSpaceBytes: %lld\n\tmFreeSpaceObjects: %d\n",
+    ALOGD("\tmMaxCapacity: %lld\n\tmFreeSpaceBytes: %lld\n\tmFreeSpaceObjects: %d\n",
             mMaxCapacity, mFreeSpaceBytes, mFreeSpaceObjects);
-    LOGD("\tmStorageDescription: %s\n\tmVolumeIdentifier: %s\n",
+    ALOGD("\tmStorageDescription: %s\n\tmVolumeIdentifier: %s\n",
             mStorageDescription, mVolumeIdentifier);
 }
 
diff --git a/media/tests/omxjpegdecoder/omx_jpeg_decoder.cpp b/media/tests/omxjpegdecoder/omx_jpeg_decoder.cpp
index 209e71c..42df66c 100644
--- a/media/tests/omxjpegdecoder/omx_jpeg_decoder.cpp
+++ b/media/tests/omxjpegdecoder/omx_jpeg_decoder.cpp
@@ -113,7 +113,7 @@
 
     // mode == DecodePixels
     if (!this->allocPixelRef(bm, NULL)) {
-        LOGI("Cannot allocPixelRef()!");
+        ALOGI("Cannot allocPixelRef()!");
         return false;
     }
 
@@ -141,7 +141,7 @@
         const sp<MediaSource>& source, SkBitmap* bm) {
     status_t rt = decoder->start();
     if (rt != OK) {
-        LOGE("Cannot start OMX Decoder!");
+        ALOGE("Cannot start OMX Decoder!");
         return false;
     }
     int64_t startTime = getNowUs();
diff --git a/media/tests/players/invoke_mock_media_player.cpp b/media/tests/players/invoke_mock_media_player.cpp
index a6fdeea..1289dfa 100644
--- a/media/tests/players/invoke_mock_media_player.cpp
+++ b/media/tests/players/invoke_mock_media_player.cpp
@@ -59,7 +59,7 @@
     virtual status_t    setDataSource(
             const char *url,
             const KeyedVector<String8, String8> *) {
-        LOGV("setDataSource %s", url);
+        ALOGV("setDataSource %s", url);
         mTest = TEST_UNKNOWN;
         if (strncmp(url, kPing, strlen(kPing)) == 0) {
             mTest = PING;
@@ -118,13 +118,13 @@
 
 extern "C" android::MediaPlayerBase* newPlayer()
 {
-    LOGD("New invoke test player");
+    ALOGD("New invoke test player");
     return new Player();
 }
 
 extern "C" android::status_t deletePlayer(android::MediaPlayerBase *player)
 {
-    LOGD("Delete invoke test player");
+    ALOGD("Delete invoke test player");
     delete player;
     return OK;
 }
diff --git a/native/android/looper.cpp b/native/android/looper.cpp
index 615493f..455e950 100644
--- a/native/android/looper.cpp
+++ b/native/android/looper.cpp
@@ -44,7 +44,7 @@
 int ALooper_pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData) {
     sp<Looper> looper = Looper::getForThread();
     if (looper == NULL) {
-        LOGE("ALooper_pollOnce: No looper for this thread!");
+        ALOGE("ALooper_pollOnce: No looper for this thread!");
         return ALOOPER_POLL_ERROR;
     }
 
@@ -55,7 +55,7 @@
 int ALooper_pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData) {
     sp<Looper> looper = Looper::getForThread();
     if (looper == NULL) {
-        LOGE("ALooper_pollAll: No looper for this thread!");
+        ALOGE("ALooper_pollAll: No looper for this thread!");
         return ALOOPER_POLL_ERROR;
     }
 
diff --git a/native/android/storage_manager.cpp b/native/android/storage_manager.cpp
index a4233e7..f2f36b62 100644
--- a/native/android/storage_manager.cpp
+++ b/native/android/storage_manager.cpp
@@ -87,13 +87,13 @@
     bool initialize() {
         sp<IServiceManager> sm = defaultServiceManager();
         if (sm == NULL) {
-            LOGE("Couldn't get default ServiceManager\n");
+            ALOGE("Couldn't get default ServiceManager\n");
             return false;
         }
 
         mMountService = interface_cast<IMountService>(sm->getService(String16("mount")));
         if (mMountService == NULL) {
-            LOGE("Couldn't get connection to MountService\n");
+            ALOGE("Couldn't get connection to MountService\n");
             return false;
         }
 
@@ -121,7 +121,7 @@
             target->cb(filename, state, target->data);
             delete target;
         } else {
-            LOGI("Didn't find the callback handler for: %s\n", filename);
+            ALOGI("Didn't find the callback handler for: %s\n", filename);
         }
     }
 
diff --git a/opengl/libagl/TextureObjectManager.cpp b/opengl/libagl/TextureObjectManager.cpp
index 022de09..6a006aa 100644
--- a/opengl/libagl/TextureObjectManager.cpp
+++ b/opengl/libagl/TextureObjectManager.cpp
@@ -195,7 +195,7 @@
                 return NO_MEMORY;
         }
 
-        LOGW_IF(level-1 >= mNumExtraLod,
+        ALOGW_IF(level-1 >= mNumExtraLod,
                 "specifying mipmap level %d, but # of level is %d",
                 level, mNumExtraLod+1);
 
diff --git a/opengl/libagl/Tokenizer.cpp b/opengl/libagl/Tokenizer.cpp
index 9b3ea1a..eac8d6d 100644
--- a/opengl/libagl/Tokenizer.cpp
+++ b/opengl/libagl/Tokenizer.cpp
@@ -163,9 +163,9 @@
 {
     const run_t* ranges = mRanges.array();
     const size_t c = mRanges.size();
-    LOGD("Tokenizer (%p, size = %u)\n", this, c);
+    ALOGD("Tokenizer (%p, size = %u)\n", this, c);
     for (size_t i=0 ; i<c ; i++) {
-        LOGD("%u: (%u, %u)\n", i, ranges[i].first, ranges[i].length);
+        ALOGD("%u: (%u, %u)\n", i, ranges[i].first, ranges[i].length);
     }
 }
 
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index 6d4098c..eb55bee 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -184,7 +184,7 @@
     free(depth.data);
 }
 bool egl_surface_t::isValid() const {
-    LOGE_IF(magic != MAGIC, "invalid EGLSurface (%p)", this);
+    ALOGE_IF(magic != MAGIC, "invalid EGLSurface (%p)", this);
     return magic == MAGIC; 
 }
 
@@ -263,7 +263,7 @@
             return (left>=right || top>=bottom);
         }
         void dump(char const* what) {
-            LOGD("%s { %5d, %5d, w=%5d, h=%5d }", 
+            ALOGD("%s { %5d, %5d, w=%5d, h=%5d }",
                     what, left, top, right-left, bottom-top);
         }
         
@@ -397,7 +397,7 @@
     // pin the buffer down
     if (lock(buffer, GRALLOC_USAGE_SW_READ_OFTEN | 
             GRALLOC_USAGE_SW_WRITE_OFTEN, &bits) != NO_ERROR) {
-        LOGE("connect() failed to lock buffer %p (%ux%u)",
+        ALOGE("connect() failed to lock buffer %p (%ux%u)",
                 buffer, buffer->width, buffer->height);
         return setError(EGL_BAD_ACCESS, EGL_FALSE);
         // FIXME: we should make sure we're not accessing the buffer anymore
@@ -552,7 +552,7 @@
         // finally pin the buffer down
         if (lock(buffer, GRALLOC_USAGE_SW_READ_OFTEN |
                 GRALLOC_USAGE_SW_WRITE_OFTEN, &bits) != NO_ERROR) {
-            LOGE("eglSwapBuffers() failed to lock buffer %p (%ux%u)",
+            ALOGE("eglSwapBuffers() failed to lock buffer %p (%ux%u)",
                     buffer, buffer->width, buffer->height);
             return setError(EGL_BAD_ACCESS, EGL_FALSE);
             // FIXME: we should make sure we're not accessing the buffer anymore
@@ -721,7 +721,7 @@
         case GGL_PIXEL_FORMAT_RGBA_8888:    size *= 4; break;
         case GGL_PIXEL_FORMAT_RGBX_8888:    size *= 4; break;
         default:
-            LOGE("incompatible pixel format for pbuffer (format=%d)", f);
+            ALOGE("incompatible pixel format for pbuffer (format=%d)", f);
             pbuffer.data = 0;
             break;
     }
diff --git a/opengl/libagl/matrix.cpp b/opengl/libagl/matrix.cpp
index 9520f04..cdeccb3 100644
--- a/opengl/libagl/matrix.cpp
+++ b/opengl/libagl/matrix.cpp
@@ -217,9 +217,9 @@
 void transform_t::dump(const char* what)
 {
     GLfixed const * const m = matrix.m;
-    LOGD("%s:", what);
+    ALOGD("%s:", what);
     for (int i=0 ; i<4 ; i++)
-        LOGD("[%08x %08x %08x %08x] [%f %f %f %f]\n",
+        ALOGD("[%08x %08x %08x %08x] [%f %f %f %f]\n",
             m[I(0,i)], m[I(1,i)], m[I(2,i)], m[I(3,i)],
             fixedToFloat(m[I(0,i)]),
             fixedToFloat(m[I(1,i)]), 
@@ -273,11 +273,11 @@
 }
 
 void matrixf_t::dump(const char* what) {
-    LOGD("%s", what);
-    LOGD("[ %9f %9f %9f %9f ]", m[I(0,0)], m[I(1,0)], m[I(2,0)], m[I(3,0)]);
-    LOGD("[ %9f %9f %9f %9f ]", m[I(0,1)], m[I(1,1)], m[I(2,1)], m[I(3,1)]);
-    LOGD("[ %9f %9f %9f %9f ]", m[I(0,2)], m[I(1,2)], m[I(2,2)], m[I(3,2)]);
-    LOGD("[ %9f %9f %9f %9f ]", m[I(0,3)], m[I(1,3)], m[I(2,3)], m[I(3,3)]);
+    ALOGD("%s", what);
+    ALOGD("[ %9f %9f %9f %9f ]", m[I(0,0)], m[I(1,0)], m[I(2,0)], m[I(3,0)]);
+    ALOGD("[ %9f %9f %9f %9f ]", m[I(0,1)], m[I(1,1)], m[I(2,1)], m[I(3,1)]);
+    ALOGD("[ %9f %9f %9f %9f ]", m[I(0,2)], m[I(1,2)], m[I(2,2)], m[I(3,2)]);
+    ALOGD("[ %9f %9f %9f %9f ]", m[I(0,3)], m[I(1,3)], m[I(2,3)], m[I(3,3)]);
 }
 
 void matrixf_t::loadIdentity() {
diff --git a/opengl/libagl/mipmap.cpp b/opengl/libagl/mipmap.cpp
index ccd77b7..e142a58 100644
--- a/opengl/libagl/mipmap.cpp
+++ b/opengl/libagl/mipmap.cpp
@@ -174,7 +174,7 @@
                 }
             }
         } else {
-            LOGE("Unsupported format (%d)", base->format);
+            ALOGE("Unsupported format (%d)", base->format);
             return BAD_TYPE;
         }
 
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index 325193c..160abc2c 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -131,7 +131,7 @@
 
     /* Special case for GLES emulation */
     if (checkGlesEmulationStatus() == 0) {
-        LOGD("Emulator without GPU support detected. Fallback to software renderer.");
+        ALOGD("Emulator without GPU support detected. Fallback to software renderer.");
         gConfig.add( entry_t(0, 0, "android") );
         return;
     }
@@ -140,14 +140,14 @@
     FILE* cfg = fopen("/system/lib/egl/egl.cfg", "r");
     if (cfg == NULL) {
         // default config
-        LOGD("egl.cfg not found, using default config");
+        ALOGD("egl.cfg not found, using default config");
         gConfig.add( entry_t(0, 0, "android") );
     } else {
         while (fgets(line, 256, cfg)) {
             int dpy;
             int impl;
             if (sscanf(line, "%u %u %s", &dpy, &impl, tag) == 3) {
-                //LOGD(">>> %u %u %s", dpy, impl, tag);
+                //ALOGD(">>> %u %u %s", dpy, impl, tag);
                 gConfig.add( entry_t(dpy, impl, tag) );
             }
         }
@@ -238,7 +238,7 @@
                 strncpy(scrap, name, index);
                 scrap[index] = 0;
                 f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
-                //LOGD_IF(f, "found <%s> instead", scrap);
+                //ALOGD_IF(f, "found <%s> instead", scrap);
             }
         }
         if (f == NULL) {
@@ -247,11 +247,11 @@
             if (index>0 && strcmp(name+index, "OES")) {
                 snprintf(scrap, SIZE, "%sOES", name);
                 f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
-                //LOGD_IF(f, "found <%s> instead", scrap);
+                //ALOGD_IF(f, "found <%s> instead", scrap);
             }
         }
         if (f == NULL) {
-            //LOGD("%s", name);
+            //ALOGD("%s", name);
             f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented;
         }
         *curr++ = f;
@@ -278,16 +278,16 @@
     void* dso = dlopen(driver_absolute_path, RTLD_NOW | RTLD_LOCAL);
     if (dso == 0) {
         const char* err = dlerror();
-        LOGE("load_driver(%s): %s", driver_absolute_path, err?err:"unknown");
+        ALOGE("load_driver(%s): %s", driver_absolute_path, err?err:"unknown");
         return 0;
     }
 
-    LOGD("loaded %s", driver_absolute_path);
+    ALOGD("loaded %s", driver_absolute_path);
 
     if (mask & EGL) {
         getProcAddress = (getProcAddressType)dlsym(dso, "eglGetProcAddress");
 
-        LOGE_IF(!getProcAddress, 
+        ALOGE_IF(!getProcAddress, 
                 "can't find eglGetProcAddress() in %s", driver_absolute_path);
 
         egl_t* egl = &cnx->egl;
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 6ad06af..60baeaa 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -146,7 +146,7 @@
 
 static int gl_no_context() {
     if (egl_tls_t::logNoContextCall()) {
-        LOGE("call to OpenGL ES API with no current context "
+        ALOGE("call to OpenGL ES API with no current context "
              "(logged once per thread)");
         char value[PROPERTY_VALUE_MAX];
         property_get("debug.egl.callstack", value, "0");
@@ -270,7 +270,7 @@
             cnx->hooks[GLESv2_INDEX] = &gHooks[GLESv2_INDEX][IMPL_HARDWARE];
             cnx->dso = loader.open(EGL_DEFAULT_DISPLAY, 1, cnx);
         } else {
-            LOGD("3D hardware acceleration is disabled");
+            ALOGD("3D hardware acceleration is disabled");
         }
     }
 
@@ -292,7 +292,7 @@
 }
 
 void gl_unimplemented() {
-    LOGE("called unimplemented OpenGL ES API");
+    ALOGE("called unimplemented OpenGL ES API");
 }
 
 // ----------------------------------------------------------------------------
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 2b0ed5d..d5e9cb8 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -353,7 +353,7 @@
         EGLint format;
 
         if (native_window_api_connect(window, NATIVE_WINDOW_API_EGL) != OK) {
-            LOGE("EGLNativeWindowType %p already connected to another API",
+            ALOGE("EGLNativeWindowType %p already connected to another API",
                     window);
             return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
         }
@@ -364,7 +364,7 @@
             if (format != 0) {
                 int err = native_window_set_buffers_format(window, format);
                 if (err != 0) {
-                    LOGE("error setting native window pixel format: %s (%d)",
+                    ALOGE("error setting native window pixel format: %s (%d)",
                             strerror(-err), err);
                     native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL);
                     return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
@@ -670,7 +670,7 @@
             egl_tls_t::setContext(EGL_NO_CONTEXT);
         }
     } else {
-        // this will LOGE the error
+        // this will ALOGE the error
         result = setError(c->cnx->egl.eglGetError(), EGL_FALSE);
     }
     return result;
@@ -882,7 +882,7 @@
         addr = sGLExtentionMap.valueFor(name);
         const int slot = sGLExtentionSlot;
 
-        LOGE_IF(slot >= MAX_NUMBER_OF_GL_EXTENSIONS,
+        ALOGE_IF(slot >= MAX_NUMBER_OF_GL_EXTENSIONS,
                 "no more slots for eglGetProcAddress(\"%s\")",
                 procname);
 
diff --git a/opengl/libs/EGL/egl_cache.cpp b/opengl/libs/EGL/egl_cache.cpp
index c4a7466..7fd6519 100644
--- a/opengl/libs/EGL/egl_cache.cpp
+++ b/opengl/libs/EGL/egl_cache.cpp
@@ -101,7 +101,7 @@
                             cnx->egl.eglGetProcAddress(
                                     "eglSetBlobCacheFuncsANDROID"));
                 if (eglSetBlobCacheFuncsANDROID == NULL) {
-                    LOGE("EGL_ANDROID_blob_cache advertised by display %d, "
+                    ALOGE("EGL_ANDROID_blob_cache advertised by display %d, "
                             "but unable to get eglSetBlobCacheFuncsANDROID", i);
                     continue;
                 }
@@ -110,7 +110,7 @@
                         android::setBlob, android::getBlob);
                 EGLint err = cnx->egl.eglGetError();
                 if (err != EGL_SUCCESS) {
-                    LOGE("eglSetBlobCacheFuncsANDROID resulted in an error: "
+                    ALOGE("eglSetBlobCacheFuncsANDROID resulted in an error: "
                             "%#x", err);
                 }
             }
@@ -133,7 +133,7 @@
     Mutex::Autolock lock(mMutex);
 
     if (keySize < 0 || valueSize < 0) {
-        LOGW("EGL_ANDROID_blob_cache set: negative sizes are not allowed");
+        ALOGW("EGL_ANDROID_blob_cache set: negative sizes are not allowed");
         return;
     }
 
@@ -172,7 +172,7 @@
     Mutex::Autolock lock(mMutex);
 
     if (keySize < 0 || valueSize < 0) {
-        LOGW("EGL_ANDROID_blob_cache set: negative sizes are not allowed");
+        ALOGW("EGL_ANDROID_blob_cache set: negative sizes are not allowed");
         return 0;
     }
 
@@ -226,7 +226,7 @@
                 // The file exists, delete it and try again.
                 if (unlink(fname) == -1) {
                     // No point in retrying if the unlink failed.
-                    LOGE("error unlinking cache file %s: %s (%d)", fname,
+                    ALOGE("error unlinking cache file %s: %s (%d)", fname,
                             strerror(errno), errno);
                     return;
                 }
@@ -234,7 +234,7 @@
                 fd = open(fname, O_CREAT | O_EXCL | O_RDWR, 0);
             }
             if (fd == -1) {
-                LOGE("error creating cache file %s: %s (%d)", fname,
+                ALOGE("error creating cache file %s: %s (%d)", fname,
                         strerror(errno), errno);
                 return;
             }
@@ -242,7 +242,7 @@
 
         size_t fileSize = headerSize + cacheSize;
         if (ftruncate(fd, fileSize) == -1) {
-            LOGE("error setting cache file size: %s (%d)", strerror(errno),
+            ALOGE("error setting cache file size: %s (%d)", strerror(errno),
                     errno);
             close(fd);
             unlink(fname);
@@ -252,7 +252,7 @@
         uint8_t* buf = reinterpret_cast<uint8_t*>(mmap(NULL, fileSize,
                 PROT_WRITE, MAP_SHARED, fd, 0));
         if (buf == MAP_FAILED) {
-            LOGE("error mmaping cache file: %s (%d)", strerror(errno),
+            ALOGE("error mmaping cache file: %s (%d)", strerror(errno),
                     errno);
             close(fd);
             unlink(fname);
@@ -262,7 +262,7 @@
         status_t err = mBlobCache->flatten(buf + headerSize, cacheSize, NULL,
                 0);
         if (err != OK) {
-            LOGE("error writing cache contents: %s (%d)", strerror(-err),
+            ALOGE("error writing cache contents: %s (%d)", strerror(-err),
                     -err);
             munmap(buf, fileSize);
             close(fd);
@@ -288,7 +288,7 @@
         int fd = open(mFilename.string(), O_RDONLY, 0);
         if (fd == -1) {
             if (errno != ENOENT) {
-                LOGE("error opening cache file %s: %s (%d)", mFilename.string(),
+                ALOGE("error opening cache file %s: %s (%d)", mFilename.string(),
                         strerror(errno), errno);
             }
             return;
@@ -296,7 +296,7 @@
 
         struct stat statBuf;
         if (fstat(fd, &statBuf) == -1) {
-            LOGE("error stat'ing cache file: %s (%d)", strerror(errno), errno);
+            ALOGE("error stat'ing cache file: %s (%d)", strerror(errno), errno);
             close(fd);
             return;
         }
@@ -304,7 +304,7 @@
         // Sanity check the size before trying to mmap it.
         size_t fileSize = statBuf.st_size;
         if (fileSize > maxTotalSize * 2) {
-            LOGE("cache file is too large: %#llx", statBuf.st_size);
+            ALOGE("cache file is too large: %#llx", statBuf.st_size);
             close(fd);
             return;
         }
@@ -312,7 +312,7 @@
         uint8_t* buf = reinterpret_cast<uint8_t*>(mmap(NULL, fileSize,
                 PROT_READ, MAP_PRIVATE, fd, 0));
         if (buf == MAP_FAILED) {
-            LOGE("error mmaping cache file: %s (%d)", strerror(errno),
+            ALOGE("error mmaping cache file: %s (%d)", strerror(errno),
                     errno);
             close(fd);
             return;
@@ -321,13 +321,13 @@
         // Check the file magic and CRC
         size_t cacheSize = fileSize - headerSize;
         if (memcmp(buf, cacheFileMagic, 4) != 0) {
-            LOGE("cache file has bad mojo");
+            ALOGE("cache file has bad mojo");
             close(fd);
             return;
         }
         uint32_t* crc = reinterpret_cast<uint32_t*>(buf + 4);
         if (crc32c(buf + headerSize, cacheSize) != *crc) {
-            LOGE("cache file failed CRC check");
+            ALOGE("cache file failed CRC check");
             close(fd);
             return;
         }
@@ -335,7 +335,7 @@
         status_t err = mBlobCache->unflatten(buf + headerSize, cacheSize, NULL,
                 0);
         if (err != OK) {
-            LOGE("error reading cache contents: %s (%d)", strerror(-err),
+            ALOGE("error reading cache contents: %s (%d)", strerror(-err),
                     -err);
             munmap(buf, fileSize);
             close(fd);
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
index 31119f9..53eaf9a 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -184,7 +184,7 @@
 
         EGLDisplay idpy = disp[i].dpy;
         if (cnx->egl.eglInitialize(idpy, &cnx->major, &cnx->minor)) {
-            //LOGD("initialized %d dpy=%p, ver=%d.%d, cnx=%p",
+            //ALOGD("initialized %d dpy=%p, ver=%d.%d, cnx=%p",
             //        i, idpy, cnx->major, cnx->minor, cnx);
 
             // display is now initialized
@@ -201,7 +201,7 @@
                     EGL_CLIENT_APIS);
 
         } else {
-            LOGW("%d: eglInitialize(%p) failed (%s)", i, idpy,
+            ALOGW("%d: eglInitialize(%p) failed (%s)", i, idpy,
                     egl_tls_t::egl_strerror(cnx->egl.eglGetError()));
         }
     }
@@ -309,7 +309,7 @@
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso && disp[i].state == egl_display_t::INITIALIZED) {
             if (cnx->egl.eglTerminate(disp[i].dpy) == EGL_FALSE) {
-                LOGW("%d: eglTerminate(%p) failed (%s)", i, disp[i].dpy,
+                ALOGW("%d: eglTerminate(%p) failed (%s)", i, disp[i].dpy,
                         egl_tls_t::egl_strerror(cnx->egl.eglGetError()));
             }
             // REVISIT: it's unclear what to do if eglTerminate() fails
@@ -327,7 +327,7 @@
     // there are no reference to them, it which case, we're free to
     // delete them.
     size_t count = objects.size();
-    LOGW_IF(count, "eglTerminate() called w/ %d objects remaining", count);
+    ALOGW_IF(count, "eglTerminate() called w/ %d objects remaining", count);
     for (size_t i=0 ; i<count ; i++) {
         egl_object_t* o = objects.itemAt(i);
         o->destroy();
diff --git a/opengl/libs/EGL/egl_object.cpp b/opengl/libs/EGL/egl_object.cpp
index 20cdc7e..26e8c3e 100644
--- a/opengl/libs/EGL/egl_object.cpp
+++ b/opengl/libs/EGL/egl_object.cpp
@@ -45,7 +45,7 @@
     display->removeObject(this);
     if (decRef() == 1) {
         // shouldn't happen because this is called from LocalRef
-        LOGE("egl_object_t::terminate() removed the last reference!");
+        ALOGE("egl_object_t::terminate() removed the last reference!");
     }
 }
 
diff --git a/opengl/libs/EGL/egl_object.h b/opengl/libs/EGL/egl_object.h
index df1b261..7106fa5 100644
--- a/opengl/libs/EGL/egl_object.h
+++ b/opengl/libs/EGL/egl_object.h
@@ -110,7 +110,7 @@
     if (ref) {
         if (ref->decRef() == 1) {
             // shouldn't happen because this is called from LocalRef
-            LOGE("LocalRef::release() removed the last reference!");
+            ALOGE("LocalRef::release() removed the last reference!");
         }
     }
 }
@@ -131,7 +131,7 @@
         if (window != NULL) {
             native_window_set_buffers_format(window, 0);
             if (native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL)) {
-                LOGW("EGLNativeWindowType %p disconnect failed", window);
+                ALOGW("EGLNativeWindowType %p disconnect failed", window);
             }
         }
     }
diff --git a/opengl/libs/EGL/egl_tls.cpp b/opengl/libs/EGL/egl_tls.cpp
index b341ddb..cf144ce 100644
--- a/opengl/libs/EGL/egl_tls.cpp
+++ b/opengl/libs/EGL/egl_tls.cpp
@@ -73,7 +73,7 @@
     egl_tls_t* tls = getTLS();
     if (tls->error != error) {
         if (!quiet) {
-            LOGE("%s:%d error %x (%s)",
+            ALOGE("%s:%d error %x (%s)",
                     caller, line, error, egl_strerror(error));
             char value[PROPERTY_VALUE_MAX];
             property_get("debug.egl.callstack", value, "0");
diff --git a/opengl/libs/EGL/trace.cpp b/opengl/libs/EGL/trace.cpp
index 0e934e2..d04ef10 100644
--- a/opengl/libs/EGL/trace.cpp
+++ b/opengl/libs/EGL/trace.cpp
@@ -97,30 +97,30 @@
 
 static void TraceGLShaderSource(GLuint shader, GLsizei count,
     const GLchar** string, const GLint* length) {
-    LOGD("const char* shaderSrc[] = {");
+    ALOGD("const char* shaderSrc[] = {");
     for (GLsizei i = 0; i < count; i++) {
         const char* comma = i < count-1 ? "," : "";
         const GLchar* s = string[i];
         if (length) {
             GLint len = length[i];
-            LOGD("    \"%*s\"%s", len, s, comma);
+            ALOGD("    \"%*s\"%s", len, s, comma);
         } else {
-            LOGD("    \"%s\"%s", s, comma);
+            ALOGD("    \"%s\"%s", s, comma);
         }
     }
-    LOGD("};");
+    ALOGD("};");
     if (length) {
-        LOGD("const GLint* shaderLength[] = {");
+        ALOGD("const GLint* shaderLength[] = {");
         for (GLsizei i = 0; i < count; i++) {
             const char* comma = i < count-1 ? "," : "";
             GLint len = length[i];
-            LOGD("    \"%d\"%s", len, comma);
+            ALOGD("    \"%d\"%s", len, comma);
         }
-        LOGD("};");
-        LOGD("glShaderSource(%u, %u, shaderSrc, shaderLength);",
+        ALOGD("};");
+        ALOGD("glShaderSource(%u, %u, shaderSrc, shaderLength);",
             shader, count);
     } else {
-        LOGD("glShaderSource(%u, %u, shaderSrc, (const GLint*) 0);",
+        ALOGD("glShaderSource(%u, %u, shaderSrc, (const GLint*) 0);",
             shader, count);
     }
 }
@@ -131,7 +131,7 @@
     GLsizei count = chunkCount * chunkSize;
     bool isFloat = type == 'f';
     const char* typeString = isFloat ? "GLfloat" : "GLint";
-    LOGD("const %s value[] = {", typeString);
+    ALOGD("const %s value[] = {", typeString);
     for (GLsizei i = 0; i < count; i++) {
         StringBuilder builder;
         builder.append("    ");
@@ -152,25 +152,25 @@
                 value = (void*) (((GLint*) value) + 1);
             }
         }
-        LOGD("%s", builder.getString());
+        ALOGD("%s", builder.getString());
         if (chunkSize > 1 && i < count-1
                 && (i % chunkSize) == (chunkSize-1)) {
-            LOGD("%s", ""); // Print a blank line.
+            ALOGD("%s", ""); // Print a blank line.
         }
     }
-    LOGD("};");
+    ALOGD("};");
 }
 
 static void TraceUniformv(int elementCount, char type,
         GLuint location, GLsizei count, const void* value) {
     TraceValue(elementCount, type, count, 1, value);
-    LOGD("glUniform%d%c(%u, %u, value);", elementCount, type, location, count);
+    ALOGD("glUniform%d%c(%u, %u, value);", elementCount, type, location, count);
 }
 
 static void TraceUniformMatrix(int matrixSideLength,
         GLuint location, GLsizei count, GLboolean transpose, const void* value) {
     TraceValue(matrixSideLength, 'f', count, matrixSideLength, value);
-    LOGD("glUniformMatrix%dfv(%u, %u, %s, value);", matrixSideLength, location, count,
+    ALOGD("glUniformMatrix%dfv(%u, %u, %s, value);", matrixSideLength, location, count,
             GLbooleanToString(transpose));
 }
 
@@ -310,7 +310,7 @@
         }
     }
     builder.append(");");
-    LOGD("%s", builder.getString());
+    ALOGD("%s", builder.getString());
     va_end(argp);
 }
 
diff --git a/opengl/libs/GLES2/gl2.cpp b/opengl/libs/GLES2/gl2.cpp
index fee4609..df22b96 100644
--- a/opengl/libs/GLES2/gl2.cpp
+++ b/opengl/libs/GLES2/gl2.cpp
@@ -83,7 +83,7 @@
         _c->_api(__VA_ARGS__); \
         GLenum status = GL_NO_ERROR; \
         while ((status = glGetError()) != GL_NO_ERROR) { \
-            LOGD("[" #_api "] 0x%x", status); \
+            ALOGD("[" #_api "] 0x%x", status); \
         }
 
 #else
diff --git a/opengl/libs/GLES2_dbg/src/caller.cpp b/opengl/libs/GLES2_dbg/src/caller.cpp
index 6b72751..70d23d6 100644
--- a/opengl/libs/GLES2_dbg/src/caller.cpp
+++ b/opengl/libs/GLES2_dbg/src/caller.cpp
@@ -103,7 +103,7 @@
 const int * GenerateCall(DbgContext * const dbg, const glesv2debugger::Message & cmd,
                   glesv2debugger::Message & msg, const int * const prevRet)
 {
-    LOGD("GenerateCall function=%u", cmd.function());
+    ALOGD("GenerateCall function=%u", cmd.function());
     const int * ret = prevRet; // only some functions have return value
     nsecs_t c0 = systemTime(timeMode);
     switch (cmd.function()) {    case glesv2debugger::Message_Function_glActiveTexture:
diff --git a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
index 41061e1..7bbaa18 100644
--- a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
+++ b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
@@ -100,7 +100,7 @@
     case GL_UNSIGNED_BYTE:
         break;
     default:
-        LOGE("GetBytesPerPixel: unknown type %x", type);
+        ALOGE("GetBytesPerPixel: unknown type %x", type);
     }
 
     switch (format) {
@@ -115,7 +115,7 @@
     case 0x80E1:   // GL_BGRA_EXT
         return 4;
     default:
-        LOGE("GetBytesPerPixel: unknown format %x", format);
+        ALOGE("GetBytesPerPixel: unknown format %x", format);
     }
 
     return 1; // in doubt...
@@ -242,7 +242,7 @@
 void DbgContext::glUseProgram(GLuint program)
 {
     while (GLenum error = hooks->gl.glGetError())
-        LOGD("DbgContext::glUseProgram(%u): before glGetError() = 0x%.4X",
+        ALOGD("DbgContext::glUseProgram(%u): before glGetError() = 0x%.4X",
              program, error);
     this->program = program;
     maxAttrib = 0;
@@ -286,7 +286,7 @@
     }
     delete name;
     while (GLenum error = hooks->gl.glGetError())
-        LOGD("DbgContext::glUseProgram(%u): after glGetError() = 0x%.4X",
+        ALOGD("DbgContext::glUseProgram(%u): after glGetError() = 0x%.4X",
              program, error);
 }
 
diff --git a/opengl/libs/GLES2_dbg/src/header.h b/opengl/libs/GLES2_dbg/src/header.h
index 49f3847..0ab4890 100644
--- a/opengl/libs/GLES2_dbg/src/header.h
+++ b/opengl/libs/GLES2_dbg/src/header.h
@@ -48,9 +48,9 @@
 #endif
 
 #undef assert
-#define assert(expr) if (!(expr)) { LOGD("\n*\n*\n* assert: %s at %s \n*\n*", #expr, __location__); int * x = 0; *x = 5; }
-//#undef LOGD
-//#define LOGD(...)
+#define assert(expr) if (!(expr)) { ALOGD("\n*\n*\n* assert: %s at %s \n*\n*", #expr, __location__); int * x = 0; *x = 5; }
+//#undef ALOGD
+//#define ALOGD(...)
 
 namespace android
 {
diff --git a/opengl/libs/GLES2_dbg/src/server.cpp b/opengl/libs/GLES2_dbg/src/server.cpp
index 0c711bf..3e93697 100644
--- a/opengl/libs/GLES2_dbg/src/server.cpp
+++ b/opengl/libs/GLES2_dbg/src/server.cpp
@@ -34,7 +34,7 @@
 
 static void Die(const char * msg)
 {
-    LOGD("\n*\n*\n* GLESv2_dbg: Die: %s \n*\n*", msg);
+    ALOGD("\n*\n*\n* GLESv2_dbg: Die: %s \n*\n*", msg);
     StopDebugServer();
     exit(1);
 }
@@ -44,11 +44,11 @@
 {
     MAX_FILE_SIZE = maxFileSize;
 
-    LOGD("GLESv2_dbg: StartDebugServer");
+    ALOGD("GLESv2_dbg: StartDebugServer");
     if (serverSock >= 0 || file)
         return;
 
-    LOGD("GLESv2_dbg: StartDebugServer create socket");
+    ALOGD("GLESv2_dbg: StartDebugServer create socket");
     struct sockaddr_in server = {}, client = {};
 
     /* Create the TCP socket */
@@ -75,7 +75,7 @@
         Die("Failed to listen on server socket");
     }
 
-    LOGD("server started on %d \n", server.sin_port);
+    ALOGD("server started on %d \n", server.sin_port);
 
 
     /* Wait for client connection */
@@ -85,13 +85,13 @@
         Die("Failed to accept client connection");
     }
 
-    LOGD("Client connected: %s\n", inet_ntoa(client.sin_addr));
+    ALOGD("Client connected: %s\n", inet_ntoa(client.sin_addr));
 //    fcntl(clientSock, F_SETFL, O_NONBLOCK);
 }
 
 void StopDebugServer()
 {
-    LOGD("GLESv2_dbg: StopDebugServer");
+    ALOGD("GLESv2_dbg: StopDebugServer");
     if (clientSock > 0) {
         close(clientSock);
         clientSock = -1;
@@ -115,7 +115,7 @@
     if (received < 0)
         Die("Failed to receive response length");
     else if (4 != received) {
-        LOGD("received %dB: %.8X", received, len);
+        ALOGD("received %dB: %.8X", received, len);
         Die("Received length mismatch, expected 4");
     }
     static void * buffer = NULL;
@@ -150,7 +150,7 @@
 
     bool received = false;
     if (FD_ISSET(clientSock, &readSet)) {
-        LOGD("TryReceive: avaiable for read");
+        ALOGD("TryReceive: avaiable for read");
         Receive(cmd);
         return true;
     }
@@ -190,14 +190,14 @@
     int sent = -1;
     sent = send(clientSock, &len, sizeof(len), 0);
     if (sent != sizeof(len)) {
-        LOGD("actual sent=%d expected=%d clientSock=%d", sent, sizeof(len), clientSock);
+        ALOGD("actual sent=%d expected=%d clientSock=%d", sent, sizeof(len), clientSock);
         Die("Failed to send message length");
     }
     nsecs_t c0 = systemTime(timeMode);
     sent = send(clientSock, str.data(), str.length(), 0);
     float t = (float)ns2ms(systemTime(timeMode) - c0);
     if (sent != str.length()) {
-        LOGD("actual sent=%d expected=%d clientSock=%d", sent, str.length(), clientSock);
+        ALOGD("actual sent=%d expected=%d clientSock=%d", sent, str.length(), clientSock);
         Die("Failed to send message");
     }
     // TODO: factor Receive & TryReceive out and into MessageLoop, or add control argument.
@@ -210,9 +210,9 @@
     if (!msg.expect_response()) {
         if (TryReceive(cmd)) {
             if (glesv2debugger::Message_Function_SETPROP == cmd.function())
-                LOGD("Send: TryReceived SETPROP");
+                ALOGD("Send: TryReceived SETPROP");
             else
-                LOGD("Send: TryReceived %u", cmd.function());
+                ALOGD("Send: TryReceived %u", cmd.function());
         }
     } else
         Receive(cmd);
@@ -223,19 +223,19 @@
 {
     switch (cmd.prop()) {
     case glesv2debugger::Message_Prop_CaptureDraw:
-        LOGD("SetProp Message_Prop_CaptureDraw %d", cmd.arg0());
+        ALOGD("SetProp Message_Prop_CaptureDraw %d", cmd.arg0());
         dbg->captureDraw = cmd.arg0();
         break;
     case glesv2debugger::Message_Prop_TimeMode:
-        LOGD("SetProp Message_Prop_TimeMode %d", cmd.arg0());
+        ALOGD("SetProp Message_Prop_TimeMode %d", cmd.arg0());
         timeMode = cmd.arg0();
         break;
     case glesv2debugger::Message_Prop_ExpectResponse:
-        LOGD("SetProp Message_Prop_ExpectResponse %d=%d", cmd.arg0(), cmd.arg1());
+        ALOGD("SetProp Message_Prop_ExpectResponse %d=%d", cmd.arg0(), cmd.arg1());
         dbg->expectResponse.Bit((glesv2debugger::Message_Function)cmd.arg0(), cmd.arg1());
         break;
     case glesv2debugger::Message_Prop_CaptureSwap:
-        LOGD("SetProp CaptureSwap %d", cmd.arg0());
+        ALOGD("SetProp CaptureSwap %d", cmd.arg0());
         dbg->captureSwap = cmd.arg0();
         break;
     default:
@@ -269,7 +269,7 @@
         case glesv2debugger::Message_Function_CONTINUE:
             ret = functionCall(&dbg->hooks->gl, msg);
             while (GLenum error = dbg->hooks->gl.glGetError())
-                LOGD("Function=%u glGetError() = 0x%.4X", function, error);
+                ALOGD("Function=%u glGetError() = 0x%.4X", function, error);
             if (!msg.has_time()) // some has output data copy, so time inside call
                 msg.set_time((systemTime(timeMode) - c0) * 1e-6f);
             msg.set_context_id(reinterpret_cast<int>(dbg));
diff --git a/opengl/libs/GLES2_dbg/src/vertex.cpp b/opengl/libs/GLES2_dbg/src/vertex.cpp
index 28a24206..70c3433 100644
--- a/opengl/libs/GLES2_dbg/src/vertex.cpp
+++ b/opengl/libs/GLES2_dbg/src/vertex.cpp
@@ -72,7 +72,7 @@
             if (dbg->captureDraw > 0) {
                 dbg->captureDraw--;
                 dbg->hooks->gl.glGetIntegerv(GL_VIEWPORT, viewport);
-//                LOGD("glDrawArrays CAPTURE: x=%d y=%d width=%d height=%d format=0x%.4X type=0x%.4X",
+//                ALOGD("glDrawArrays CAPTURE: x=%d y=%d width=%d height=%d format=0x%.4X type=0x%.4X",
 //                     viewport[0], viewport[1], viewport[2], viewport[3], readFormat, readType);
                 pixels = dbg->GetReadPixelsBuffer(viewport[2] * viewport[3] *
                                                   dbg->readBytesPerPixel);
diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp
index ee29f12..2d31a35 100644
--- a/opengl/libs/GLES_CM/gl.cpp
+++ b/opengl/libs/GLES_CM/gl.cpp
@@ -132,7 +132,7 @@
     
         #define CHECK_GL_ERRORS(_api) \
             do { GLint err = glGetError(); \
-                LOGE_IF(err != GL_NO_ERROR, "%s failed (0x%04X)", #_api, err); \
+                ALOGE_IF(err != GL_NO_ERROR, "%s failed (0x%04X)", #_api, err); \
             } while(false);
 
     #else
diff --git a/opengl/tests/gl2_jni/jni/gl_code.cpp b/opengl/tests/gl2_jni/jni/gl_code.cpp
index c2fabe6..fa6bd93 100644
--- a/opengl/tests/gl2_jni/jni/gl_code.cpp
+++ b/opengl/tests/gl2_jni/jni/gl_code.cpp
@@ -14,13 +14,13 @@
 
 static void printGLString(const char *name, GLenum s) {
     const char *v = (const char *) glGetString(s);
-    LOGI("GL %s = %s\n", name, v);
+    ALOGI("GL %s = %s\n", name, v);
 }
 
 static void checkGlError(const char* op) {
     for (GLint error = glGetError(); error; error
             = glGetError()) {
-        LOGI("after %s() glError (0x%x)\n", op, error);
+        ALOGI("after %s() glError (0x%x)\n", op, error);
     }
 }
 
@@ -48,7 +48,7 @@
                 char* buf = (char*) malloc(infoLen);
                 if (buf) {
                     glGetShaderInfoLog(shader, infoLen, NULL, buf);
-                    LOGE("Could not compile shader %d:\n%s\n",
+                    ALOGE("Could not compile shader %d:\n%s\n",
                             shaderType, buf);
                     free(buf);
                 }
@@ -87,7 +87,7 @@
                 char* buf = (char*) malloc(bufLength);
                 if (buf) {
                     glGetProgramInfoLog(program, bufLength, NULL, buf);
-                    LOGE("Could not link program:\n%s\n", buf);
+                    ALOGE("Could not link program:\n%s\n", buf);
                     free(buf);
                 }
             }
@@ -107,15 +107,15 @@
     printGLString("Renderer", GL_RENDERER);
     printGLString("Extensions", GL_EXTENSIONS);
 
-    LOGI("setupGraphics(%d, %d)", w, h);
+    ALOGI("setupGraphics(%d, %d)", w, h);
     gProgram = createProgram(gVertexShader, gFragmentShader);
     if (!gProgram) {
-        LOGE("Could not create program.");
+        ALOGE("Could not create program.");
         return false;
     }
     gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
     checkGlError("glGetAttribLocation");
-    LOGI("glGetAttribLocation(\"vPosition\") = %d\n",
+    ALOGI("glGetAttribLocation(\"vPosition\") = %d\n",
             gvPositionHandle);
 
     glViewport(0, 0, w, h);
diff --git a/opengl/tests/gl_jni/jni/gl_code.cpp b/opengl/tests/gl_jni/jni/gl_code.cpp
index ef66841..cf86020 100644
--- a/opengl/tests/gl_jni/jni/gl_code.cpp
+++ b/opengl/tests/gl_jni/jni/gl_code.cpp
@@ -18,7 +18,7 @@
 
 static void printGLString(const char *name, GLenum s) {
     const char *v = (const char *) glGetString(s);
-    LOGI("GL %s = %s\n", name, v);
+    ALOGI("GL %s = %s\n", name, v);
 }
 
 static void gluLookAt(float eyeX, float eyeY, float eyeZ,
diff --git a/opengl/tests/gl_perf/fill_common.cpp b/opengl/tests/gl_perf/fill_common.cpp
index a069f67..389381f 100644
--- a/opengl/tests/gl_perf/fill_common.cpp
+++ b/opengl/tests/gl_perf/fill_common.cpp
@@ -26,7 +26,7 @@
 static void checkGlError(const char* op) {
     for (GLint error = glGetError(); error; error
             = glGetError()) {
-        LOGE("after %s() glError (0x%x)\n", op, error);
+        ALOGE("after %s() glError (0x%x)\n", op, error);
     }
 }
 
@@ -44,7 +44,7 @@
                 char* buf = (char*) malloc(infoLen);
                 if (buf) {
                     glGetShaderInfoLog(shader, infoLen, NULL, buf);
-                    LOGE("Could not compile shader %d:\n%s\n", shaderType, buf);
+                    ALOGE("Could not compile shader %d:\n%s\n", shaderType, buf);
                     free(buf);
                 }
                 glDeleteShader(shader);
@@ -94,7 +94,7 @@
                 char* buf = (char*) malloc(bufLength);
                 if (buf) {
                     glGetProgramInfoLog(program, bufLength, NULL, buf);
-                    LOGE("Could not link program:\n%s\n", buf);
+                    ALOGE("Could not link program:\n%s\n", buf);
                     free(buf);
                 }
             }
@@ -132,7 +132,7 @@
     } else {
         printf("%s, %f, %f\n", gCurrentTestName, mpps, dc60);
     }
-    LOGI("%s, %f, %f\r\n", gCurrentTestName, mpps, dc60);
+    ALOGI("%s, %f, %f\r\n", gCurrentTestName, mpps, dc60);
 }
 
 
diff --git a/opengl/tests/gl_perfapp/jni/gl_code.cpp b/opengl/tests/gl_perfapp/jni/gl_code.cpp
index f993371..2f04183 100644
--- a/opengl/tests/gl_perfapp/jni/gl_code.cpp
+++ b/opengl/tests/gl_perfapp/jni/gl_code.cpp
@@ -43,7 +43,7 @@
     int texSize = ((stateClock >> 1) & 0x1) + 1;
 
     if (testNum >= gFragmentTestCount) {
-       LOGI("done\n");
+       ALOGI("done\n");
        if (fOut) {
            fclose(fOut);
            fOut = NULL;
@@ -52,7 +52,7 @@
        return;
     }
 
-    // LOGI("doTest %d %d %d\n", texCount, extraMath, testSubState);
+    // ALOGI("doTest %d %d %d\n", texCount, extraMath, testSubState);
 
 //        for (uint32_t num = 0; num < gFragmentTestCount; num++) {
     doSingleTest(testNum, texSize);
@@ -74,17 +74,17 @@
             genTextures();
             const char* fileName = "/sdcard/glperf.csv";
             if (fOut != NULL) {
-                 LOGI("Closing partially written output.n");
+                 ALOGI("Closing partially written output.n");
                  fclose(fOut);
                  fOut = NULL;
             }
-            LOGI("Writing to: %s\n",fileName);
+            ALOGI("Writing to: %s\n",fileName);
             fOut = fopen(fileName, "w");
             if (fOut == NULL) {
-                LOGE("Could not open: %s\n", fileName);
+                ALOGE("Could not open: %s\n", fileName);
             }
 
-            LOGI("\nvarColor, texCount, modulate, extraMath, texSize, blend, Mpps, DC60\n");
+            ALOGI("\nvarColor, texCount, modulate, extraMath, texSize, blend, Mpps, DC60\n");
             if (fOut) fprintf(fOut,"varColor, texCount, modulate, extraMath, texSize, blend, Mpps, DC60\r\n");
     }
 }
diff --git a/opengl/tests/gldual/jni/gl_code.cpp b/opengl/tests/gldual/jni/gl_code.cpp
index f1f0a1f..22867ed 100644
--- a/opengl/tests/gldual/jni/gl_code.cpp
+++ b/opengl/tests/gldual/jni/gl_code.cpp
@@ -14,13 +14,13 @@
 
 static void printGLString(const char *name, GLenum s) {
     const char *v = (const char *) glGetString(s);
-    LOGI("GL %s = %s\n", name, v);
+    ALOGI("GL %s = %s\n", name, v);
 }
 
 static void checkGlError(const char* op) {
     for (GLint error = glGetError(); error; error
             = glGetError()) {
-        LOGI("after %s() glError (0x%x)\n", op, error);
+        ALOGI("after %s() glError (0x%x)\n", op, error);
     }
 }
 
@@ -48,7 +48,7 @@
                 char* buf = (char*) malloc(infoLen);
                 if (buf) {
                     glGetShaderInfoLog(shader, infoLen, NULL, buf);
-                    LOGE("Could not compile shader %d:\n%s\n",
+                    ALOGE("Could not compile shader %d:\n%s\n",
                             shaderType, buf);
                     free(buf);
                 }
@@ -87,7 +87,7 @@
                 char* buf = (char*) malloc(bufLength);
                 if (buf) {
                     glGetProgramInfoLog(program, bufLength, NULL, buf);
-                    LOGE("Could not link program:\n%s\n", buf);
+                    ALOGE("Could not link program:\n%s\n", buf);
                     free(buf);
                 }
             }
@@ -107,15 +107,15 @@
     printGLString("Renderer", GL_RENDERER);
     printGLString("Extensions", GL_EXTENSIONS);
 
-    LOGI("setupGraphics(%d, %d)", w, h);
+    ALOGI("setupGraphics(%d, %d)", w, h);
     gProgram = createProgram(gVertexShader, gFragmentShader);
     if (!gProgram) {
-        LOGE("Could not create program.");
+        ALOGE("Could not create program.");
         return false;
     }
     gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
     checkGlError("glGetAttribLocation");
-    LOGI("glGetAttribLocation(\"vPosition\") = %d\n",
+    ALOGI("glGetAttribLocation(\"vPosition\") = %d\n",
             gvPositionHandle);
 
     glViewport(0, 0, w, h);
diff --git a/packages/DefaultContainerService/jni/com_android_defcontainer_MeasurementUtils.cpp b/packages/DefaultContainerService/jni/com_android_defcontainer_MeasurementUtils.cpp
index 6579f95..7390bb7 100644
--- a/packages/DefaultContainerService/jni/com_android_defcontainer_MeasurementUtils.cpp
+++ b/packages/DefaultContainerService/jni/com_android_defcontainer_MeasurementUtils.cpp
@@ -39,7 +39,7 @@
 
     int dirfd = open(path, O_DIRECTORY, O_RDONLY);
     if (dirfd < 0) {
-        LOGI("error opening: %s: %s", path, strerror(errno));
+        ALOGI("error opening: %s: %s", path, strerror(errno));
     } else {
         ret = calculate_dir_size(dirfd);
         close(dirfd);
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index ce701ca..5a46e44 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -100,14 +100,14 @@
 static bool recordingAllowed() {
     if (getpid() == IPCThreadState::self()->getCallingPid()) return true;
     bool ok = checkCallingPermission(String16("android.permission.RECORD_AUDIO"));
-    if (!ok) LOGE("Request requires android.permission.RECORD_AUDIO");
+    if (!ok) ALOGE("Request requires android.permission.RECORD_AUDIO");
     return ok;
 }
 
 static bool settingsAllowed() {
     if (getpid() == IPCThreadState::self()->getCallingPid()) return true;
     bool ok = checkCallingPermission(String16("android.permission.MODIFY_AUDIO_SETTINGS"));
-    if (!ok) LOGE("Request requires android.permission.MODIFY_AUDIO_SETTINGS");
+    if (!ok) ALOGE("Request requires android.permission.MODIFY_AUDIO_SETTINGS");
     return ok;
 }
 
@@ -117,7 +117,7 @@
         defaultServiceManager()->getService(String16("media.player"));
     sp<IMediaPlayerService> service = interface_cast<IMediaPlayerService>(binder);
     if (service.get() == NULL) {
-        LOGW("Cannot connect to the MediaPlayerService for battery tracking");
+        ALOGW("Cannot connect to the MediaPlayerService for battery tracking");
         return;
     }
 
@@ -134,7 +134,7 @@
         goto out;
 
     rc = audio_hw_device_open(*mod, dev);
-    LOGE_IF(rc, "couldn't open audio hw device in %s.%s (%s)",
+    ALOGE_IF(rc, "couldn't open audio hw device in %s.%s (%s)",
             AUDIO_HARDWARE_MODULE_ID, if_name, strerror(-rc));
     if (rc)
         goto out;
@@ -180,13 +180,13 @@
         if (rc)
             continue;
 
-        LOGI("Loaded %s audio interface from %s (%s)", audio_interfaces[i],
+        ALOGI("Loaded %s audio interface from %s (%s)", audio_interfaces[i],
              mod->name, mod->id);
         mAudioHwDevs.push(dev);
 
         if (!mPrimaryHardwareDev) {
             mPrimaryHardwareDev = dev;
-            LOGI("Using '%s' (%s.%s) as the primary audio interface",
+            ALOGI("Using '%s' (%s.%s) as the primary audio interface",
                  mod->name, mod->id, audio_interfaces[i]);
         }
     }
@@ -194,7 +194,7 @@
     mHardwareStatus = AUDIO_HW_INIT;
 
     if (!mPrimaryHardwareDev || mAudioHwDevs.size() == 0) {
-        LOGE("Primary audio interface not found");
+        ALOGE("Primary audio interface not found");
         return;
     }
 
@@ -395,7 +395,7 @@
     int lSessionId;
 
     if (streamType >= AUDIO_STREAM_CNT) {
-        LOGE("invalid stream type");
+        ALOGE("invalid stream type");
         lStatus = BAD_VALUE;
         goto Exit;
     }
@@ -405,7 +405,7 @@
         PlaybackThread *thread = checkPlaybackThread_l(output);
         PlaybackThread *effectThread = NULL;
         if (thread == NULL) {
-            LOGE("unknown output thread");
+            ALOGE("unknown output thread");
             lStatus = BAD_VALUE;
             goto Exit;
         }
@@ -419,7 +419,7 @@
             mClients.add(pid, client);
         }
 
-        LOGV("createTrack() sessionId: %d", (sessionId == NULL) ? -2 : *sessionId);
+        ALOGV("createTrack() sessionId: %d", (sessionId == NULL) ? -2 : *sessionId);
         if (sessionId != NULL && *sessionId != AUDIO_SESSION_OUTPUT_MIX) {
             for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
                 sp<PlaybackThread> t = mPlaybackThreads.valueAt(i);
@@ -444,7 +444,7 @@
                 *sessionId = lSessionId;
             }
         }
-        LOGV("createTrack() lSessionId: %d", lSessionId);
+        ALOGV("createTrack() lSessionId: %d", lSessionId);
 
         track = thread->createTrack_l(client, streamType, sampleRate, format,
                 channelMask, frameCount, sharedBuffer, lSessionId, &lStatus);
@@ -478,7 +478,7 @@
     Mutex::Autolock _l(mLock);
     PlaybackThread *thread = checkPlaybackThread_l(output);
     if (thread == NULL) {
-        LOGW("sampleRate() unknown thread %d", output);
+        ALOGW("sampleRate() unknown thread %d", output);
         return 0;
     }
     return thread->sampleRate();
@@ -489,7 +489,7 @@
     Mutex::Autolock _l(mLock);
     PlaybackThread *thread = checkPlaybackThread_l(output);
     if (thread == NULL) {
-        LOGW("channelCount() unknown thread %d", output);
+        ALOGW("channelCount() unknown thread %d", output);
         return 0;
     }
     return thread->channelCount();
@@ -500,7 +500,7 @@
     Mutex::Autolock _l(mLock);
     PlaybackThread *thread = checkPlaybackThread_l(output);
     if (thread == NULL) {
-        LOGW("format() unknown thread %d", output);
+        ALOGW("format() unknown thread %d", output);
         return 0;
     }
     return thread->format();
@@ -511,7 +511,7 @@
     Mutex::Autolock _l(mLock);
     PlaybackThread *thread = checkPlaybackThread_l(output);
     if (thread == NULL) {
-        LOGW("frameCount() unknown thread %d", output);
+        ALOGW("frameCount() unknown thread %d", output);
         return 0;
     }
     return thread->frameCount();
@@ -522,7 +522,7 @@
     Mutex::Autolock _l(mLock);
     PlaybackThread *thread = checkPlaybackThread_l(output);
     if (thread == NULL) {
-        LOGW("latency() unknown thread %d", output);
+        ALOGW("latency() unknown thread %d", output);
         return 0;
     }
     return thread->latency();
@@ -570,7 +570,7 @@
         return PERMISSION_DENIED;
     }
     if ((mode < 0) || (mode >= AUDIO_MODE_CNT)) {
-        LOGW("Illegal value: setMode(%d)", mode);
+        ALOGW("Illegal value: setMode(%d)", mode);
         return BAD_VALUE;
     }
 
@@ -736,7 +736,7 @@
 {
     status_t result;
 
-    LOGV("setParameters(): io %d, keyvalue %s, tid %d, calling tid %d",
+    ALOGV("setParameters(): io %d, keyvalue %s, tid %d, calling tid %d",
             ioHandle, keyValuePairs.string(), gettid(), IPCThreadState::self()->getCallingPid());
     // check calling permissions
     if (!settingsAllowed()) {
@@ -810,7 +810,7 @@
 
 String8 AudioFlinger::getParameters(int ioHandle, const String8& keys)
 {
-//    LOGV("getParameters() io %d, keys %s, tid %d, calling tid %d",
+//    ALOGV("getParameters() io %d, keys %s, tid %d, calling tid %d",
 //            ioHandle, keys.string(), gettid(), IPCThreadState::self()->getCallingPid());
 
     if (ioHandle == 0) {
@@ -907,7 +907,7 @@
         sp<NotificationClient> notificationClient = new NotificationClient(this,
                                                                             client,
                                                                             pid);
-        LOGV("registerClient() client %p, pid %d", notificationClient.get(), pid);
+        ALOGV("registerClient() client %p, pid %d", notificationClient.get(), pid);
 
         mNotificationClients.add(pid, notificationClient);
 
@@ -933,18 +933,18 @@
     int index = mNotificationClients.indexOfKey(pid);
     if (index >= 0) {
         sp <NotificationClient> client = mNotificationClients.valueFor(pid);
-        LOGV("removeNotificationClient() %p, pid %d", client.get(), pid);
+        ALOGV("removeNotificationClient() %p, pid %d", client.get(), pid);
         mNotificationClients.removeItem(pid);
     }
 
-    LOGV("%d died, releasing its sessions", pid);
+    ALOGV("%d died, releasing its sessions", pid);
     int num = mAudioSessionRefs.size();
     bool removed = false;
     for (int i = 0; i< num; i++) {
         AudioSessionRef *ref = mAudioSessionRefs.itemAt(i);
-        LOGV(" pid %d @ %d", ref->pid, i);
+        ALOGV(" pid %d @ %d", ref->pid, i);
         if (ref->pid == pid) {
-            LOGV(" removing entry for pid %d session %d", pid, ref->sessionid);
+            ALOGV(" removing entry for pid %d session %d", pid, ref->sessionid);
             mAudioSessionRefs.removeAt(i);
             delete ref;
             removed = true;
@@ -969,7 +969,7 @@
 // removeClient_l() must be called with AudioFlinger::mLock held
 void AudioFlinger::removeClient_l(pid_t pid)
 {
-    LOGV("removeClient_l() pid %d, tid %d, calling tid %d", pid, gettid(), IPCThreadState::self()->getCallingPid());
+    ALOGV("removeClient_l() pid %d, tid %d, calling tid %d", pid, gettid(), IPCThreadState::self()->getCallingPid());
     mClients.removeItem(pid);
 }
 
@@ -1003,7 +1003,7 @@
     // destroyed in the middle of requestExitAndWait()
     sp <ThreadBase> strongMe = this;
 
-    LOGV("ThreadBase::exit");
+    ALOGV("ThreadBase::exit");
     {
         AutoMutex lock(&mLock);
         mExiting = true;
@@ -1037,7 +1037,7 @@
 {
     status_t status;
 
-    LOGV("ThreadBase::setParameters() %s", keyValuePairs.string());
+    ALOGV("ThreadBase::setParameters() %s", keyValuePairs.string());
     Mutex::Autolock _l(mLock);
 
     mNewParameters.add(keyValuePairs);
@@ -1066,7 +1066,7 @@
     configEvent->mEvent = event;
     configEvent->mParam = param;
     mConfigEvents.add(configEvent);
-    LOGV("sendConfigEvent() num events %d event %d, param %d", mConfigEvents.size(), event, param);
+    ALOGV("sendConfigEvent() num events %d event %d, param %d", mConfigEvents.size(), event, param);
     mWaitWorkCV.signal();
 }
 
@@ -1074,7 +1074,7 @@
 {
     mLock.lock();
     while(!mConfigEvents.isEmpty()) {
-        LOGV("processConfigEvents() remaining events %d", mConfigEvents.size());
+        ALOGV("processConfigEvents() remaining events %d", mConfigEvents.size());
         ConfigEvent *configEvent = mConfigEvents[0];
         mConfigEvents.removeAt(0);
         // release mLock before locking AudioFlinger mLock: lock order is always
@@ -1174,7 +1174,7 @@
         sp<IBinder> binder =
             defaultServiceManager()->checkService(String16("power"));
         if (binder == 0) {
-            LOGW("Thread %s cannot connect to the power manager service", mName);
+            ALOGW("Thread %s cannot connect to the power manager service", mName);
         } else {
             mPowerManager = interface_cast<IPowerManager>(binder);
             binder->linkToDeath(mDeathRecipient);
@@ -1188,7 +1188,7 @@
         if (status == NO_ERROR) {
             mWakeLockToken = binder;
         }
-        LOGV("acquireWakeLock_l() %s status %d", mName, status);
+        ALOGV("acquireWakeLock_l() %s status %d", mName, status);
     }
 }
 
@@ -1201,7 +1201,7 @@
 void AudioFlinger::ThreadBase::releaseWakeLock_l()
 {
     if (mWakeLockToken != 0) {
-        LOGV("releaseWakeLock_l() %s", mName);
+        ALOGV("releaseWakeLock_l() %s", mName);
         if (mPowerManager != 0) {
             mPowerManager->releaseWakeLock(mWakeLockToken, 0);
         }
@@ -1222,7 +1222,7 @@
     if (thread != 0) {
         thread->clearPowerManager();
     }
-    LOGW("power manager service died !!!");
+    ALOGW("power manager service died !!!");
 }
 
 void AudioFlinger::ThreadBase::setEffectSuspended(
@@ -1264,7 +1264,7 @@
             if (sessionEffects.keyAt(i) == EffectChain::kKeyForSuspendAll) {
                 chain->setEffectSuspendedAll_l(true);
             } else {
-                LOGV("checkSuspendOnAddEffectChain_l() suspending effects %08x",
+                ALOGV("checkSuspendOnAddEffectChain_l() suspending effects %08x",
                      desc->mType.timeLow);
                 chain->setEffectSuspended_l(&desc->mType, true);
             }
@@ -1310,7 +1310,7 @@
                 memcpy(&desc->mType, type, sizeof(effect_uuid_t));
             }
             sessionEffects.add(key, desc);
-            LOGV("updateSuspendedSessions_l() suspend adding effect %08x", key);
+            ALOGV("updateSuspendedSessions_l() suspend adding effect %08x", key);
         }
         desc->mRefCount++;
     } else {
@@ -1319,10 +1319,10 @@
         }
         desc = sessionEffects.valueAt(index);
         if (--desc->mRefCount == 0) {
-            LOGV("updateSuspendedSessions_l() restore removing effect %08x", key);
+            ALOGV("updateSuspendedSessions_l() restore removing effect %08x", key);
             sessionEffects.removeItemsAt(index);
             if (sessionEffects.isEmpty()) {
-                LOGV("updateSuspendedSessions_l() restore removing session %d",
+                ALOGV("updateSuspendedSessions_l() restore removing session %d",
                                  sessionId);
                 mSuspendedSessions.removeItem(sessionId);
             }
@@ -1463,9 +1463,9 @@
 {
     status_t status = initCheck();
     if (status == NO_ERROR) {
-        LOGI("AudioFlinger's thread %p ready to run", this);
+        ALOGI("AudioFlinger's thread %p ready to run", this);
     } else {
-        LOGE("No working audio driver found.");
+        ALOGE("No working audio driver found.");
     }
     return status;
 }
@@ -1493,7 +1493,7 @@
     if (mType == DIRECT) {
         if ((format & AUDIO_FORMAT_MAIN_MASK) == AUDIO_FORMAT_PCM) {
             if (sampleRate != mSampleRate || format != mFormat || channelMask != mChannelMask) {
-                LOGE("createTrack_l() Bad parameter: sampleRate %d format %d, channelMask 0x%08x \""
+                ALOGE("createTrack_l() Bad parameter: sampleRate %d format %d, channelMask 0x%08x \""
                         "for output %p with format %d",
                         sampleRate, format, channelMask, mOutput, mFormat);
                 lStatus = BAD_VALUE;
@@ -1503,7 +1503,7 @@
     } else {
         // Resampler implementation limits input sampling rate to 2 x output sampling rate.
         if (sampleRate > mSampleRate*2) {
-            LOGE("Sample rate out of range: %d mSampleRate %d", sampleRate, mSampleRate);
+            ALOGE("Sample rate out of range: %d mSampleRate %d", sampleRate, mSampleRate);
             lStatus = BAD_VALUE;
             goto Exit;
         }
@@ -1511,7 +1511,7 @@
 
     lStatus = initCheck();
     if (lStatus != NO_ERROR) {
-        LOGE("Audio driver not initialized.");
+        ALOGE("Audio driver not initialized.");
         goto Exit;
     }
 
@@ -1544,7 +1544,7 @@
 
         sp<EffectChain> chain = getEffectChain_l(sessionId);
         if (chain != 0) {
-            LOGV("createTrack_l() setting main buffer %p", chain->inBuffer());
+            ALOGV("createTrack_l() setting main buffer %p", chain->inBuffer());
             track->setMainBuffer(chain->inBuffer());
             chain->setStrategy(AudioSystem::getStrategyForStream((audio_stream_type_t)track->type()));
             chain->incTrackCnt();
@@ -1553,7 +1553,7 @@
         // invalidate track immediately if the stream type was moved to another thread since
         // createTrack() was called by the client process.
         if (!mStreamTypes[streamType].valid) {
-            LOGW("createTrack_l() on thread %p: invalidating track on stream %d",
+            ALOGW("createTrack_l() on thread %p: invalidating track on stream %d",
                  this, streamType);
             android_atomic_or(CBLK_INVALID_ON, &track->mCblk->flags);
         }
@@ -1638,7 +1638,7 @@
         if (track->mainBuffer() != mMixBuffer) {
             sp<EffectChain> chain = getEffectChain_l(track->sessionId());
             if (chain != 0) {
-                LOGV("addTrack_l() starting track on chain %p for session %d", chain.get(), track->sessionId());
+                ALOGV("addTrack_l() starting track on chain %p for session %d", chain.get(), track->sessionId());
                 chain->incActiveTrackCnt();
             }
         }
@@ -1646,7 +1646,7 @@
         status = NO_ERROR;
     }
 
-    LOGV("mWaitWorkCV.broadcast");
+    ALOGV("mWaitWorkCV.broadcast");
     mWaitWorkCV.broadcast();
 
     return status;
@@ -1692,7 +1692,7 @@
     AudioSystem::OutputDescriptor desc;
     void *param2 = 0;
 
-    LOGV("PlaybackThread::audioConfigChanged_l, thread %p, event %d, param %d", this, event, param);
+    ALOGV("PlaybackThread::audioConfigChanged_l, thread %p, event %d, param %d", this, event, param);
 
     switch (event) {
     case AudioSystem::OUTPUT_OPENED:
@@ -1839,7 +1839,7 @@
 
     // FIXME - Current mixer implementation only supports stereo output
     if (mChannelCount == 1) {
-        LOGE("Invalid audio hardware channel count");
+        ALOGE("Invalid audio hardware channel count");
     }
 }
 
@@ -1889,7 +1889,7 @@
                 double minimum = stats.minimum();
                 double maximum = stats.maximum();
                 cpu.resetStatistics();
-                LOGI("CPU usage over past %.1f secs (%u mixer loops at %.1f mean ms per loop):\n  us per mix loop: mean=%.0f stddev=%.0f min=%.0f max=%.0f\n  %% of wall: mean=%.1f stddev=%.1f min=%.1f max=%.1f",
+                ALOGI("CPU usage over past %.1f secs (%u mixer loops at %.1f mean ms per loop):\n  us per mix loop: mean=%.0f stddev=%.0f min=%.0f max=%.0f\n  %% of wall: mean=%.1f stddev=%.1f min=%.1f max=%.1f",
                         elapsed * .000000001, n, perLoop * .000001,
                         mean * .001,
                         stddev * .001,
@@ -1926,7 +1926,7 @@
             if UNLIKELY((!activeTracks.size() && systemTime() > standbyTime) ||
                         mSuspended) {
                 if (!mStandby) {
-                    LOGV("Audio hardware entering standby, mixer %p, mSuspended %d\n", this, mSuspended);
+                    ALOGV("Audio hardware entering standby, mixer %p, mSuspended %d\n", this, mSuspended);
                     mOutput->stream->common.standby(&mOutput->stream->common);
                     mStandby = true;
                     mBytesWritten = 0;
@@ -1940,9 +1940,9 @@
 
                     releaseWakeLock_l();
                     // wait until we have something to do...
-                    LOGV("MixerThread %p TID %d going to sleep\n", this, gettid());
+                    ALOGV("MixerThread %p TID %d going to sleep\n", this, gettid());
                     mWaitWorkCV.wait(mLock);
-                    LOGV("MixerThread %p TID %d waking up\n", this, gettid());
+                    ALOGV("MixerThread %p TID %d waking up\n", this, gettid());
                     acquireWakeLock_l();
 
                     mPrevMixerStatus = MIXER_IDLE;
@@ -1950,7 +1950,7 @@
                         char value[PROPERTY_VALUE_MAX];
                         property_get("ro.audio.silent", value, "0");
                         if (atoi(value)) {
-                            LOGD("Silence is golden");
+                            ALOGD("Silence is golden");
                             setMasterMute(true);
                         }
                     }
@@ -2006,7 +2006,7 @@
                        (mixerStatus == MIXER_TRACKS_ENABLED && longStandbyExit)) {
                 memset (mMixBuffer, 0, mixBufferSize);
                 sleepTime = 0;
-                LOGV_IF((mBytesWritten == 0 && (mixerStatus == MIXER_TRACKS_ENABLED && longStandbyExit)), "anticipated start");
+                ALOGV_IF((mBytesWritten == 0 && (mixerStatus == MIXER_TRACKS_ENABLED && longStandbyExit)), "anticipated start");
             }
             // TODO add standby time extension fct of effect tail
         }
@@ -2034,7 +2034,7 @@
             if (!mStandby && delta > maxPeriod) {
                 mNumDelayedWrites++;
                 if ((now - lastWarning) > kWarningThrottle) {
-                    LOGW("write blocked for %llu msecs, %d delayed writes, thread %p",
+                    ALOGW("write blocked for %llu msecs, %d delayed writes, thread %p",
                             ns2ms(delta), mNumDelayedWrites, this);
                     lastWarning = now;
                 }
@@ -2065,7 +2065,7 @@
 
     releaseWakeLock();
 
-    LOGV("MixerThread %p exiting", this);
+    ALOGV("MixerThread %p exiting", this);
     return false;
 }
 
@@ -2129,7 +2129,7 @@
         if ((cblk->framesReady() >= minFrames) && track->isReady() &&
                 !track->isPaused() && !track->isTerminated())
         {
-            //LOGV("track %d u=%08x, s=%08x [OK] on thread %p", track->name(), cblk->user, cblk->server, this);
+            //ALOGV("track %d u=%08x, s=%08x [OK] on thread %p", track->name(), cblk->user, cblk->server, this);
 
             mixedTracks++;
 
@@ -2142,7 +2142,7 @@
                 if (chain != 0) {
                     tracksWithEffect++;
                 } else {
-                    LOGW("prepareTracks_l(): track %08x attached to effect but no chain found on session %d",
+                    ALOGW("prepareTracks_l(): track %08x attached to effect but no chain found on session %d",
                             track->name(), track->sessionId());
                 }
             }
@@ -2241,7 +2241,7 @@
                 mixerStatus = MIXER_TRACKS_READY;
             }
         } else {
-            //LOGV("track %d u=%08x, s=%08x [NOT READY] on thread %p", track->name(), cblk->user, cblk->server, this);
+            //ALOGV("track %d u=%08x, s=%08x [NOT READY] on thread %p", track->name(), cblk->user, cblk->server, this);
             if (track->isStopped()) {
                 track->reset();
             }
@@ -2253,7 +2253,7 @@
                 // No buffers for this track. Give it a few chances to
                 // fill a buffer, then remove it from active list.
                 if (--(track->mRetryCount) <= 0) {
-                    LOGV("BUFFER TIMEOUT: remove(%d) from active list on thread %p", track->name(), this);
+                    ALOGV("BUFFER TIMEOUT: remove(%d) from active list on thread %p", track->name(), this);
                     tracksToRemove->add(track);
                     // indicate to client process that the track was disabled because of underrun
                     android_atomic_or(CBLK_DISABLED_ON, &cblk->flags);
@@ -2278,7 +2278,7 @@
             if (track->mainBuffer() != mMixBuffer) {
                 chain = getEffectChain_l(track->sessionId());
                 if (chain != 0) {
-                    LOGV("stopping track on chain %p for session Id: %d", chain.get(), track->sessionId());
+                    ALOGV("stopping track on chain %p for session Id: %d", chain.get(), track->sessionId());
                     chain->decActiveTrackCnt();
                 }
             }
@@ -2301,7 +2301,7 @@
 
 void AudioFlinger::MixerThread::invalidateTracks(int streamType)
 {
-    LOGV ("MixerThread::invalidateTracks() mixer %p, streamType %d, mTracks.size %d",
+    ALOGV ("MixerThread::invalidateTracks() mixer %p, streamType %d, mTracks.size %d",
             this,  streamType, mTracks.size());
     Mutex::Autolock _l(mLock);
 
@@ -2317,7 +2317,7 @@
 
 void AudioFlinger::PlaybackThread::setStreamValid(int streamType, bool valid)
 {
-    LOGV ("PlaybackThread::setStreamValid() thread %p, streamType %d, valid %d",
+    ALOGV ("PlaybackThread::setStreamValid() thread %p, streamType %d, valid %d",
             this,  streamType, valid);
     Mutex::Autolock _l(mLock);
 
@@ -2333,7 +2333,7 @@
 // deleteTrackName_l() must be called with ThreadBase::mLock held
 void AudioFlinger::MixerThread::deleteTrackName_l(int name)
 {
-    LOGV("remove track (%d) and delete from mixer", name);
+    ALOGV("remove track (%d) and delete from mixer", name);
     mAudioMixer->deleteTrackName(name);
 }
 
@@ -2619,7 +2619,7 @@
                         mSuspended) {
                 // wait until we have something to do...
                 if (!mStandby) {
-                    LOGV("Audio hardware entering standby, mixer %p\n", this);
+                    ALOGV("Audio hardware entering standby, mixer %p\n", this);
                     mOutput->stream->common.standby(&mOutput->stream->common);
                     mStandby = true;
                     mBytesWritten = 0;
@@ -2632,16 +2632,16 @@
                     if (exitPending()) break;
 
                     releaseWakeLock_l();
-                    LOGV("DirectOutputThread %p TID %d going to sleep\n", this, gettid());
+                    ALOGV("DirectOutputThread %p TID %d going to sleep\n", this, gettid());
                     mWaitWorkCV.wait(mLock);
-                    LOGV("DirectOutputThread %p TID %d waking up in active mode\n", this, gettid());
+                    ALOGV("DirectOutputThread %p TID %d waking up in active mode\n", this, gettid());
                     acquireWakeLock_l();
 
                     if (mMasterMute == false) {
                         char value[PROPERTY_VALUE_MAX];
                         property_get("ro.audio.silent", value, "0");
                         if (atoi(value)) {
-                            LOGD("Silence is golden");
+                            ALOGD("Silence is golden");
                             setMasterMute(true);
                         }
                     }
@@ -2667,7 +2667,7 @@
                 if (cblk->framesReady() && track->isReady() &&
                         !track->isPaused() && !track->isTerminated())
                 {
-                    //LOGV("track %d u=%08x, s=%08x [OK]", track->name(), cblk->user, cblk->server);
+                    //ALOGV("track %d u=%08x, s=%08x [OK]", track->name(), cblk->user, cblk->server);
 
                     if (track->mFillingUpStatus == Track::FS_FILLED) {
                         track->mFillingUpStatus = Track::FS_ACTIVE;
@@ -2744,7 +2744,7 @@
                     activeTrack = t;
                     mixerStatus = MIXER_TRACKS_READY;
                 } else {
-                    //LOGV("track %d u=%08x, s=%08x [NOT READY]", track->name(), cblk->user, cblk->server);
+                    //ALOGV("track %d u=%08x, s=%08x [NOT READY]", track->name(), cblk->user, cblk->server);
                     if (track->isStopped()) {
                         track->reset();
                     }
@@ -2756,7 +2756,7 @@
                         // No buffers for this track. Give it a few chances to
                         // fill a buffer, then remove it from active list.
                         if (--(track->mRetryCount) <= 0) {
-                            LOGV("BUFFER TIMEOUT: remove(%d) from active list", track->name());
+                            ALOGV("BUFFER TIMEOUT: remove(%d) from active list", track->name());
                             trackToRemove = track;
                         } else {
                             mixerStatus = MIXER_TRACKS_ENABLED;
@@ -2769,7 +2769,7 @@
             if (UNLIKELY(trackToRemove != 0)) {
                 mActiveTracks.remove(trackToRemove);
                 if (!effectChains.isEmpty()) {
-                    LOGV("stopping track on chain %p for session Id: %d", effectChains[0].get(),
+                    ALOGV("stopping track on chain %p for session Id: %d", effectChains[0].get(),
                             trackToRemove->sessionId());
                     effectChains[0]->decActiveTrackCnt();
                 }
@@ -2856,7 +2856,7 @@
 
     releaseWakeLock();
 
-    LOGV("DirectOutputThread %p exiting", this);
+    ALOGV("DirectOutputThread %p exiting", this);
     return false;
 }
 
@@ -3026,9 +3026,9 @@
                     if (exitPending()) break;
 
                     releaseWakeLock_l();
-                    LOGV("DuplicatingThread %p TID %d going to sleep\n", this, gettid());
+                    ALOGV("DuplicatingThread %p TID %d going to sleep\n", this, gettid());
                     mWaitWorkCV.wait(mLock);
-                    LOGV("DuplicatingThread %p TID %d waking up\n", this, gettid());
+                    ALOGV("DuplicatingThread %p TID %d waking up\n", this, gettid());
                     acquireWakeLock_l();
 
                     mPrevMixerStatus = MIXER_IDLE;
@@ -3036,7 +3036,7 @@
                         char value[PROPERTY_VALUE_MAX];
                         property_get("ro.audio.silent", value, "0");
                         if (atoi(value)) {
-                            LOGD("Silence is golden");
+                            ALOGD("Silence is golden");
                             setMasterMute(true);
                         }
                     }
@@ -3135,7 +3135,7 @@
     if (outputTrack->cblk() != NULL) {
         thread->setStreamVolume(AUDIO_STREAM_CNT, 1.0f);
         mOutputTracks.add(outputTrack);
-        LOGV("addOutputTrack() track %p, on thread %p", outputTrack, thread);
+        ALOGV("addOutputTrack() track %p, on thread %p", outputTrack, thread);
         updateWaitTime();
     }
 }
@@ -3151,7 +3151,7 @@
             return;
         }
     }
-    LOGV("removeOutputTrack(): unkonwn thread: %p", thread);
+    ALOGV("removeOutputTrack(): unkonwn thread: %p", thread);
 }
 
 void AudioFlinger::DuplicatingThread::updateWaitTime()
@@ -3174,12 +3174,12 @@
     for (size_t i = 0; i < outputTracks.size(); i++) {
         sp <ThreadBase> thread = outputTracks[i]->thread().promote();
         if (thread == 0) {
-            LOGW("DuplicatingThread::outputsReady() could not promote thread on output track %p", outputTracks[i].get());
+            ALOGW("DuplicatingThread::outputsReady() could not promote thread on output track %p", outputTracks[i].get());
             return false;
         }
         PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
         if (playbackThread->standby() && !playbackThread->isSuspended()) {
-            LOGV("DuplicatingThread output track %p on thread %p Not Ready", outputTracks[i].get(), thread.get());
+            ALOGV("DuplicatingThread output track %p on thread %p Not Ready", outputTracks[i].get(), thread.get());
             return false;
         }
     }
@@ -3215,9 +3215,9 @@
         mFlags(flags & ~SYSTEM_FLAGS_MASK),
         mSessionId(sessionId)
 {
-    LOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size());
+    ALOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size());
 
-    // LOGD("Creating track with %d buffers @ %d bytes", bufferCount, bufferSize);
+    // ALOGD("Creating track with %d buffers @ %d bytes", bufferCount, bufferSize);
    size_t size = sizeof(audio_track_cblk_t);
    uint8_t channelCount = popcount(channelMask);
    size_t bufferSize = frameCount*channelCount*sizeof(int16_t);
@@ -3248,7 +3248,7 @@
                 mBufferEnd = (uint8_t *)mBuffer + bufferSize;
             }
         } else {
-            LOGE("not enough memory for AudioTrack size=%u", size);
+            ALOGE("not enough memory for AudioTrack size=%u", size);
             client->heap()->dump("AudioTrack");
             return;
         }
@@ -3300,7 +3300,7 @@
 
     result = cblk->stepServer(mFrameCount);
     if (!result) {
-        LOGV("stepServer failed acquiring cblk mutex");
+        ALOGV("stepServer failed acquiring cblk mutex");
         mFlags |= STEPSERVER_FAILED;
     }
     return result;
@@ -3314,7 +3314,7 @@
     cblk->userBase = 0;
     cblk->serverBase = 0;
     mFlags &= (uint32_t)(~SYSTEM_FLAGS_MASK);
-    LOGV("TrackBase::reset");
+    ALOGV("TrackBase::reset");
 }
 
 sp<IMemory> AudioFlinger::ThreadBase::TrackBase::getCblk() const
@@ -3342,7 +3342,7 @@
     // Check validity of returned pointer in case the track control block would have been corrupted.
     if (bufferStart < mBuffer || bufferStart > bufferEnd || bufferEnd > mBufferEnd ||
         ((unsigned long)bufferStart & (unsigned long)(cblk->frameSize - 1))) {
-        LOGE("TrackBase::getBuffer buffer out of range:\n    start: %p, end %p , mBuffer %p mBufferEnd %p\n    \
+        ALOGE("TrackBase::getBuffer buffer out of range:\n    start: %p, end %p , mBuffer %p mBufferEnd %p\n    \
                 server %d, serverBase %d, user %d, userBase %d",
                 bufferStart, bufferEnd, mBuffer, mBufferEnd,
                 cblk->server, cblk->serverBase, cblk->user, cblk->userBase);
@@ -3376,9 +3376,9 @@
             mName = playbackThread->getTrackName_l();
             mMainBuffer = playbackThread->mixBuffer();
         }
-        LOGV("Track constructor name %d, calling thread %d", mName, IPCThreadState::self()->getCallingPid());
+        ALOGV("Track constructor name %d, calling thread %d", mName, IPCThreadState::self()->getCallingPid());
         if (mName < 0) {
-            LOGE("no more track names available");
+            ALOGE("no more track names available");
         }
         mVolume[0] = 1.0f;
         mVolume[1] = 1.0f;
@@ -3391,7 +3391,7 @@
 
 AudioFlinger::PlaybackThread::Track::~Track()
 {
-    LOGV("PlaybackThread::Track destructor");
+    ALOGV("PlaybackThread::Track destructor");
     sp<ThreadBase> thread = mThread.promote();
     if (thread != 0) {
         Mutex::Autolock _l(thread->mLock);
@@ -3462,7 +3462,7 @@
      // Check if last stepServer failed, try to step now
      if (mFlags & TrackBase::STEPSERVER_FAILED) {
          if (!step())  goto getNextBuffer_exit;
-         LOGV("stepServer recovered");
+         ALOGV("stepServer recovered");
          mFlags &= ~TrackBase::STEPSERVER_FAILED;
      }
 
@@ -3490,7 +3490,7 @@
 getNextBuffer_exit:
      buffer->raw = 0;
      buffer->frameCount = 0;
-     LOGV("getNextBuffer() no more data for track %d on thread %p", mName, mThread.unsafe_get());
+     ALOGV("getNextBuffer() no more data for track %d on thread %p", mName, mThread.unsafe_get());
      return NOT_ENOUGH_DATA;
 }
 
@@ -3509,7 +3509,7 @@
 status_t AudioFlinger::PlaybackThread::Track::start()
 {
     status_t status = NO_ERROR;
-    LOGV("start(%d), calling thread %d session %d",
+    ALOGV("start(%d), calling thread %d session %d",
             mName, IPCThreadState::self()->getCallingPid(), mSessionId);
     sp<ThreadBase> thread = mThread.promote();
     if (thread != 0) {
@@ -3519,10 +3519,10 @@
         // in both cases "unstop" the track
         if (mState == PAUSED) {
             mState = TrackBase::RESUMING;
-            LOGV("PAUSED => RESUMING (%d) on thread %p", mName, this);
+            ALOGV("PAUSED => RESUMING (%d) on thread %p", mName, this);
         } else {
             mState = TrackBase::ACTIVE;
-            LOGV("? => ACTIVE (%d) on thread %p", mName, this);
+            ALOGV("? => ACTIVE (%d) on thread %p", mName, this);
         }
 
         if (!isOutputTrack() && state != ACTIVE && state != RESUMING) {
@@ -3551,7 +3551,7 @@
 
 void AudioFlinger::PlaybackThread::Track::stop()
 {
-    LOGV("stop(%d), calling thread %d", mName, IPCThreadState::self()->getCallingPid());
+    ALOGV("stop(%d), calling thread %d", mName, IPCThreadState::self()->getCallingPid());
     sp<ThreadBase> thread = mThread.promote();
     if (thread != 0) {
         Mutex::Autolock _l(thread->mLock);
@@ -3563,7 +3563,7 @@
             if (playbackThread->mActiveTracks.indexOf(this) < 0) {
                 reset();
             }
-            LOGV("(> STOPPED) => STOPPED (%d) on thread %p", mName, playbackThread);
+            ALOGV("(> STOPPED) => STOPPED (%d) on thread %p", mName, playbackThread);
         }
         if (!isOutputTrack() && (state == ACTIVE || state == RESUMING)) {
             thread->mLock.unlock();
@@ -3580,13 +3580,13 @@
 
 void AudioFlinger::PlaybackThread::Track::pause()
 {
-    LOGV("pause(%d), calling thread %d", mName, IPCThreadState::self()->getCallingPid());
+    ALOGV("pause(%d), calling thread %d", mName, IPCThreadState::self()->getCallingPid());
     sp<ThreadBase> thread = mThread.promote();
     if (thread != 0) {
         Mutex::Autolock _l(thread->mLock);
         if (mState == ACTIVE || mState == RESUMING) {
             mState = PAUSING;
-            LOGV("ACTIVE/RESUMING => PAUSING (%d) on thread %p", mName, thread.get());
+            ALOGV("ACTIVE/RESUMING => PAUSING (%d) on thread %p", mName, thread.get());
             if (!isOutputTrack()) {
                 thread->mLock.unlock();
                 AudioSystem::stopOutput(thread->id(),
@@ -3603,7 +3603,7 @@
 
 void AudioFlinger::PlaybackThread::Track::flush()
 {
-    LOGV("flush(%d)", mName);
+    ALOGV("flush(%d)", mName);
     sp<ThreadBase> thread = mThread.promote();
     if (thread != 0) {
         Mutex::Autolock _l(thread->mLock);
@@ -3683,7 +3683,7 @@
         mOverflow(false)
 {
     if (mCblk != NULL) {
-       LOGV("RecordTrack constructor, size %d", (int)mBufferEnd - (int)mBuffer);
+       ALOGV("RecordTrack constructor, size %d", (int)mBufferEnd - (int)mBuffer);
        if (format == AUDIO_FORMAT_PCM_16_BIT) {
            mCblk->frameSize = mChannelCount * sizeof(int16_t);
        } else if (format == AUDIO_FORMAT_PCM_8_BIT) {
@@ -3711,7 +3711,7 @@
      // Check if last stepServer failed, try to step now
     if (mFlags & TrackBase::STEPSERVER_FAILED) {
         if (!step()) goto getNextBuffer_exit;
-        LOGV("stepServer recovered");
+        ALOGV("stepServer recovered");
         mFlags &= ~TrackBase::STEPSERVER_FAILED;
     }
 
@@ -3800,12 +3800,12 @@
         mCblk->volume[0] = mCblk->volume[1] = 0x1000;
         mOutBuffer.frameCount = 0;
         playbackThread->mTracks.add(this);
-        LOGV("OutputTrack constructor mCblk %p, mBuffer %p, mCblk->buffers %p, " \
+        ALOGV("OutputTrack constructor mCblk %p, mBuffer %p, mCblk->buffers %p, " \
                 "mCblk->frameCount %d, mCblk->sampleRate %d, mChannelMask 0x%08x mBufferEnd %p",
                 mCblk, mBuffer, mCblk->buffers,
                 mCblk->frameCount, mCblk->sampleRate, mChannelMask, mBufferEnd);
     } else {
-        LOGW("Error creating output track on thread %p", playbackThread);
+        ALOGW("Error creating output track on thread %p", playbackThread);
     }
 }
 
@@ -3860,7 +3860,7 @@
                     memset(pInBuffer->raw, 0, startFrames * channelCount * sizeof(int16_t));
                     mBufferQueue.add(pInBuffer);
                 } else {
-                    LOGW ("OutputTrack::write() %p no more buffers in queue", this);
+                    ALOGW ("OutputTrack::write() %p no more buffers in queue", this);
                 }
             }
         }
@@ -3882,7 +3882,7 @@
             mOutBuffer.frameCount = pInBuffer->frameCount;
             nsecs_t startTime = systemTime();
             if (obtainBuffer(&mOutBuffer, waitTimeLeftMs) == (status_t)AudioTrack::NO_MORE_BUFFERS) {
-                LOGV ("OutputTrack::write() %p thread %p no more output buffers", this, mThread.unsafe_get());
+                ALOGV ("OutputTrack::write() %p thread %p no more output buffers", this, mThread.unsafe_get());
                 outputBufferFull = true;
                 break;
             }
@@ -3907,7 +3907,7 @@
                 mBufferQueue.removeAt(0);
                 delete [] pInBuffer->mBuffer;
                 delete pInBuffer;
-                LOGV("OutputTrack::write() %p thread %p released overflow buffer %d", this, mThread.unsafe_get(), mBufferQueue.size());
+                ALOGV("OutputTrack::write() %p thread %p released overflow buffer %d", this, mThread.unsafe_get(), mBufferQueue.size());
             } else {
                 break;
             }
@@ -3925,9 +3925,9 @@
                 pInBuffer->i16 = pInBuffer->mBuffer;
                 memcpy(pInBuffer->raw, inBuffer.raw, inBuffer.frameCount * channelCount * sizeof(int16_t));
                 mBufferQueue.add(pInBuffer);
-                LOGV("OutputTrack::write() %p thread %p adding overflow buffer %d", this, mThread.unsafe_get(), mBufferQueue.size());
+                ALOGV("OutputTrack::write() %p thread %p adding overflow buffer %d", this, mThread.unsafe_get(), mBufferQueue.size());
             } else {
-                LOGW("OutputTrack::write() %p thread %p no more overflow buffers", mThread.unsafe_get(), this);
+                ALOGW("OutputTrack::write() %p thread %p no more overflow buffers", mThread.unsafe_get(), this);
             }
         }
     }
@@ -3959,7 +3959,7 @@
     audio_track_cblk_t* cblk = mCblk;
     uint32_t framesReq = buffer->frameCount;
 
-//    LOGV("OutputTrack::obtainBuffer user %d, server %d", cblk->user, cblk->server);
+//    ALOGV("OutputTrack::obtainBuffer user %d, server %d", cblk->user, cblk->server);
     buffer->frameCount  = 0;
 
     uint32_t framesAvail = cblk->framesAvailable();
@@ -3971,7 +3971,7 @@
         while (framesAvail == 0) {
             active = mActive;
             if (UNLIKELY(!active)) {
-                LOGV("Not active and NO_MORE_BUFFERS");
+                ALOGV("Not active and NO_MORE_BUFFERS");
                 return AudioTrack::NO_MORE_BUFFERS;
             }
             result = cblk->cv.waitRelative(cblk->lock, milliseconds(waitTimeMs));
@@ -4213,12 +4213,12 @@
 }
 
 status_t AudioFlinger::RecordHandle::start() {
-    LOGV("RecordHandle::start()");
+    ALOGV("RecordHandle::start()");
     return mRecordTrack->start();
 }
 
 void AudioFlinger::RecordHandle::stop() {
-    LOGV("RecordHandle::stop()");
+    ALOGV("RecordHandle::stop()");
     mRecordTrack->stop();
 }
 
@@ -4270,7 +4270,7 @@
 status_t AudioFlinger::RecordThread::readyToRun()
 {
     status_t status = initCheck();
-    LOGW_IF(status != NO_ERROR,"RecordThread %p could not initialize", this);
+    ALOGW_IF(status != NO_ERROR,"RecordThread %p could not initialize", this);
     return status;
 }
 
@@ -4301,10 +4301,10 @@
                 if (exitPending()) break;
 
                 releaseWakeLock_l();
-                LOGV("RecordThread: loop stopping");
+                ALOGV("RecordThread: loop stopping");
                 // go to sleep
                 mWaitWorkCV.wait(mLock);
-                LOGV("RecordThread: loop starting");
+                ALOGV("RecordThread: loop starting");
                 acquireWakeLock_l();
                 continue;
             }
@@ -4390,7 +4390,7 @@
                                 mRsmpInIndex = 0;
                             }
                             if (mBytesRead < 0) {
-                                LOGE("Error reading audio input");
+                                ALOGE("Error reading audio input");
                                 if (mActiveTrack->mState == TrackBase::ACTIVE) {
                                     // Force input into standby so that it tries to
                                     // recover at next read attempt
@@ -4436,7 +4436,7 @@
                 if (!mActiveTrack->setOverflow()) {
                     nsecs_t now = systemTime();
                     if ((now - lastWarning) > kWarningThrottle) {
-                        LOGW("RecordThread: buffer overflow");
+                        ALOGW("RecordThread: buffer overflow");
                         lastWarning = now;
                     }
                 }
@@ -4460,7 +4460,7 @@
 
     releaseWakeLock();
 
-    LOGV("RecordThread %p exiting", this);
+    ALOGV("RecordThread %p exiting", this);
     return false;
 }
 
@@ -4480,7 +4480,7 @@
 
     lStatus = initCheck();
     if (lStatus != NO_ERROR) {
-        LOGE("Audio driver not initialized.");
+        ALOGE("Audio driver not initialized.");
         goto Exit;
     }
 
@@ -4513,7 +4513,7 @@
 
 status_t AudioFlinger::RecordThread::start(RecordThread::RecordTrack* recordTrack)
 {
-    LOGV("RecordThread::start");
+    ALOGV("RecordThread::start");
     sp <ThreadBase> strongMe = this;
     status_t status = NO_ERROR;
     {
@@ -4543,7 +4543,7 @@
         }
         mActiveTrack->mState = TrackBase::RESUMING;
         // signal thread to start
-        LOGV("Signal record thread");
+        ALOGV("Signal record thread");
         mWaitWorkCV.signal();
         // do not wait for mStartStopCond if exiting
         if (mExiting) {
@@ -4553,11 +4553,11 @@
         }
         mStartStopCond.wait(mLock);
         if (mActiveTrack == 0) {
-            LOGV("Record failed to start");
+            ALOGV("Record failed to start");
             status = BAD_VALUE;
             goto startError;
         }
-        LOGV("Record started OK");
+        ALOGV("Record started OK");
         return status;
     }
 startError:
@@ -4566,7 +4566,7 @@
 }
 
 void AudioFlinger::RecordThread::stop(RecordThread::RecordTrack* recordTrack) {
-    LOGV("RecordThread::stop");
+    ALOGV("RecordThread::stop");
     sp <ThreadBase> strongMe = this;
     {
         AutoMutex lock(&mLock);
@@ -4582,7 +4582,7 @@
                 mLock.unlock();
                 AudioSystem::stopInput(mId);
                 mLock.lock();
-                LOGV("Record stopped OK");
+                ALOGV("Record stopped OK");
             }
         }
     }
@@ -4636,7 +4636,7 @@
     if (framesReady == 0) {
         mBytesRead = mInput->stream->read(mInput->stream, mRsmpInBuffer, mInputBytes);
         if (mBytesRead < 0) {
-            LOGE("RecordThread::getNextBuffer() Error reading audio input");
+            ALOGE("RecordThread::getNextBuffer() Error reading audio input");
             if (mActiveTrack->mState == TrackBase::ACTIVE) {
                 // Force input into standby so that it tries to
                 // recover at next read attempt
@@ -4915,7 +4915,7 @@
     audio_stream_out_t *outStream;
     audio_hw_device_t *outHwDev;
 
-    LOGV("openOutput(), Device %x, SamplingRate %d, Format %d, Channels %x, flags %x",
+    ALOGV("openOutput(), Device %x, SamplingRate %d, Format %d, Channels %x, flags %x",
             pDevices ? *pDevices : 0,
             samplingRate,
             format,
@@ -4934,7 +4934,7 @@
 
     status = outHwDev->open_output_stream(outHwDev, *pDevices, (int *)&format,
                                           &channels, &samplingRate, &outStream);
-    LOGV("openOutput() openOutputStream returned output %p, SamplingRate %d, Format %d, Channels %x, status %d",
+    ALOGV("openOutput() openOutputStream returned output %p, SamplingRate %d, Format %d, Channels %x, status %d",
             outStream,
             samplingRate,
             format,
@@ -4950,10 +4950,10 @@
             (format != AUDIO_FORMAT_PCM_16_BIT) ||
             (channels != AUDIO_CHANNEL_OUT_STEREO)) {
             thread = new DirectOutputThread(this, output, id, *pDevices);
-            LOGV("openOutput() created direct output: ID %d thread %p", id, thread);
+            ALOGV("openOutput() created direct output: ID %d thread %p", id, thread);
         } else {
             thread = new MixerThread(this, output, id, *pDevices);
-            LOGV("openOutput() created mixer output: ID %d thread %p", id, thread);
+            ALOGV("openOutput() created mixer output: ID %d thread %p", id, thread);
         }
         mPlaybackThreads.add(id, thread);
 
@@ -4977,7 +4977,7 @@
     MixerThread *thread2 = checkMixerThread_l(output2);
 
     if (thread1 == NULL || thread2 == NULL) {
-        LOGW("openDuplicateOutput() wrong output mixer type for output %d or %d", output1, output2);
+        ALOGW("openDuplicateOutput() wrong output mixer type for output %d or %d", output1, output2);
         return 0;
     }
 
@@ -5002,7 +5002,7 @@
             return BAD_VALUE;
         }
 
-        LOGV("closeOutput() %d", output);
+        ALOGV("closeOutput() %d", output);
 
         if (thread->type() == ThreadBase::MIXER) {
             for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
@@ -5036,7 +5036,7 @@
         return BAD_VALUE;
     }
 
-    LOGV("suspendOutput() %d", output);
+    ALOGV("suspendOutput() %d", output);
     thread->suspend();
 
     return NO_ERROR;
@@ -5051,7 +5051,7 @@
         return BAD_VALUE;
     }
 
-    LOGV("restoreOutput() %d", output);
+    ALOGV("restoreOutput() %d", output);
 
     thread->restore();
 
@@ -5089,7 +5089,7 @@
                                         &channels, &samplingRate,
                                         (audio_in_acoustics_t)acoustics,
                                         &inStream);
-    LOGV("openInput() openInputStream returned input %p, SamplingRate %d, Format %d, Channels %x, acoustics %x, status %d",
+    ALOGV("openInput() openInputStream returned input %p, SamplingRate %d, Format %d, Channels %x, acoustics %x, status %d",
             inStream,
             samplingRate,
             format,
@@ -5104,7 +5104,7 @@
         reqFormat == format && format == AUDIO_FORMAT_PCM_16_BIT &&
         (samplingRate <= 2 * reqSamplingRate) &&
         (popcount(channels) < 3) && (popcount(reqChannels) < 3)) {
-        LOGV("openInput() reopening with proposed sampling rate and channels");
+        ALOGV("openInput() reopening with proposed sampling rate and channels");
         status = inHwDev->open_input_stream(inHwDev, *pDevices, (int *)&format,
                                             &channels, &samplingRate,
                                             (audio_in_acoustics_t)acoustics,
@@ -5126,7 +5126,7 @@
                                   id,
                                   device);
         mRecordThreads.add(id, thread);
-        LOGV("openInput() created record thread: ID %d thread %p", id, thread);
+        ALOGV("openInput() created record thread: ID %d thread %p", id, thread);
         if (pSamplingRate) *pSamplingRate = reqSamplingRate;
         if (pFormat) *pFormat = format;
         if (pChannels) *pChannels = reqChannels;
@@ -5153,7 +5153,7 @@
             return BAD_VALUE;
         }
 
-        LOGV("closeInput() %d", input);
+        ALOGV("closeInput() %d", input);
         void *param2 = 0;
         audioConfigChanged_l(AudioSystem::INPUT_CLOSED, input, param2);
         mRecordThreads.removeItem(input);
@@ -5173,11 +5173,11 @@
     Mutex::Autolock _l(mLock);
     MixerThread *dstThread = checkMixerThread_l(output);
     if (dstThread == NULL) {
-        LOGW("setStreamOutput() bad output id %d", output);
+        ALOGW("setStreamOutput() bad output id %d", output);
         return BAD_VALUE;
     }
 
-    LOGV("setStreamOutput() stream %d to output %d", stream, output);
+    ALOGV("setStreamOutput() stream %d to output %d", stream, output);
     audioConfigChanged_l(AudioSystem::STREAM_CONFIG_CHANGED, output, &stream);
 
     dstThread->setStreamValid(stream, true);
@@ -5205,13 +5205,13 @@
 {
     Mutex::Autolock _l(mLock);
     int caller = IPCThreadState::self()->getCallingPid();
-    LOGV("acquiring %d from %d", audioSession, caller);
+    ALOGV("acquiring %d from %d", audioSession, caller);
     int num = mAudioSessionRefs.size();
     for (int i = 0; i< num; i++) {
         AudioSessionRef *ref = mAudioSessionRefs.editItemAt(i);
         if (ref->sessionid == audioSession && ref->pid == caller) {
             ref->cnt++;
-            LOGV(" incremented refcount to %d", ref->cnt);
+            ALOGV(" incremented refcount to %d", ref->cnt);
             return;
         }
     }
@@ -5220,20 +5220,20 @@
     ref->pid = caller;
     ref->cnt = 1;
     mAudioSessionRefs.push(ref);
-    LOGV(" added new entry for %d", ref->sessionid);
+    ALOGV(" added new entry for %d", ref->sessionid);
 }
 
 void AudioFlinger::releaseAudioSessionId(int audioSession)
 {
     Mutex::Autolock _l(mLock);
     int caller = IPCThreadState::self()->getCallingPid();
-    LOGV("releasing %d from %d", audioSession, caller);
+    ALOGV("releasing %d from %d", audioSession, caller);
     int num = mAudioSessionRefs.size();
     for (int i = 0; i< num; i++) {
         AudioSessionRef *ref = mAudioSessionRefs.itemAt(i);
         if (ref->sessionid == audioSession && ref->pid == caller) {
             ref->cnt--;
-            LOGV(" decremented refcount to %d", ref->cnt);
+            ALOGV(" decremented refcount to %d", ref->cnt);
             if (ref->cnt == 0) {
                 mAudioSessionRefs.removeAt(i);
                 delete ref;
@@ -5242,12 +5242,12 @@
             return;
         }
     }
-    LOGW("session id %d not found for pid %d", audioSession, caller);
+    ALOGW("session id %d not found for pid %d", audioSession, caller);
 }
 
 void AudioFlinger::purgeStaleEffects_l() {
 
-    LOGV("purging stale effects");
+    ALOGV("purging stale effects");
 
     Vector< sp<EffectChain> > chains;
 
@@ -5280,7 +5280,7 @@
         for (size_t k = 0; k < numsessionrefs; k++) {
             AudioSessionRef *ref = mAudioSessionRefs.itemAt(k);
             if (ref->sessionid == sessionid) {
-                LOGV(" session %d still exists for %d with %d refs",
+                ALOGV(" session %d still exists for %d with %d refs",
                      sessionid, ref->pid, ref->cnt);
                 found = true;
                 break;
@@ -5410,7 +5410,7 @@
     sp<Client> client;
     wp<Client> wclient;
 
-    LOGV("createEffect pid %d, client %p, priority %d, sessionId %d, io %d",
+    ALOGV("createEffect pid %d, client %p, priority %d, sessionId %d, io %d",
             pid, effectClient.get(), priority, sessionId, io);
 
     if (pDesc == NULL) {
@@ -5453,14 +5453,14 @@
             // if uuid is specified, request effect descriptor
             lStatus = EffectGetDescriptor(&pDesc->uuid, &desc);
             if (lStatus < 0) {
-                LOGW("createEffect() error %d from EffectGetDescriptor", lStatus);
+                ALOGW("createEffect() error %d from EffectGetDescriptor", lStatus);
                 goto Exit;
             }
         } else {
             // if uuid is not specified, look for an available implementation
             // of the required type in effect factory
             if (EffectIsNullUuid(&pDesc->type)) {
-                LOGW("createEffect() no effect type");
+                ALOGW("createEffect() no effect type");
                 lStatus = BAD_VALUE;
                 goto Exit;
             }
@@ -5471,13 +5471,13 @@
 
             lStatus = EffectQueryNumberEffects(&numEffects);
             if (lStatus < 0) {
-                LOGW("createEffect() error %d from EffectQueryNumberEffects", lStatus);
+                ALOGW("createEffect() error %d from EffectQueryNumberEffects", lStatus);
                 goto Exit;
             }
             for (uint32_t i = 0; i < numEffects; i++) {
                 lStatus = EffectQueryEffect(i, &desc);
                 if (lStatus < 0) {
-                    LOGW("createEffect() error %d from EffectQueryEffect", lStatus);
+                    ALOGW("createEffect() error %d from EffectQueryEffect", lStatus);
                     continue;
                 }
                 if (memcmp(&desc.type, &pDesc->type, sizeof(effect_uuid_t)) == 0) {
@@ -5494,7 +5494,7 @@
             }
             if (!found) {
                 lStatus = BAD_VALUE;
-                LOGW("createEffect() effect not found");
+                ALOGW("createEffect() effect not found");
                 goto Exit;
             }
             // For same effect type, chose auxiliary version over insert version if
@@ -5549,13 +5549,13 @@
             if (io == 0 && mPlaybackThreads.size()) {
                 io = mPlaybackThreads.keyAt(0);
             }
-            LOGV("createEffect() got io %d for effect %s", io, desc.name);
+            ALOGV("createEffect() got io %d for effect %s", io, desc.name);
         }
         ThreadBase *thread = checkRecordThread_l(io);
         if (thread == NULL) {
             thread = checkPlaybackThread_l(io);
             if (thread == NULL) {
-                LOGE("createEffect() unknown output thread");
+                ALOGE("createEffect() unknown output thread");
                 lStatus = BAD_VALUE;
                 goto Exit;
             }
@@ -5587,21 +5587,21 @@
 
 status_t AudioFlinger::moveEffects(int sessionId, int srcOutput, int dstOutput)
 {
-    LOGV("moveEffects() session %d, srcOutput %d, dstOutput %d",
+    ALOGV("moveEffects() session %d, srcOutput %d, dstOutput %d",
             sessionId, srcOutput, dstOutput);
     Mutex::Autolock _l(mLock);
     if (srcOutput == dstOutput) {
-        LOGW("moveEffects() same dst and src outputs %d", dstOutput);
+        ALOGW("moveEffects() same dst and src outputs %d", dstOutput);
         return NO_ERROR;
     }
     PlaybackThread *srcThread = checkPlaybackThread_l(srcOutput);
     if (srcThread == NULL) {
-        LOGW("moveEffects() bad srcOutput %d", srcOutput);
+        ALOGW("moveEffects() bad srcOutput %d", srcOutput);
         return BAD_VALUE;
     }
     PlaybackThread *dstThread = checkPlaybackThread_l(dstOutput);
     if (dstThread == NULL) {
-        LOGW("moveEffects() bad dstOutput %d", dstOutput);
+        ALOGW("moveEffects() bad dstOutput %d", dstOutput);
         return BAD_VALUE;
     }
 
@@ -5618,12 +5618,12 @@
                                    AudioFlinger::PlaybackThread *dstThread,
                                    bool reRegister)
 {
-    LOGV("moveEffectChain_l() session %d from thread %p to thread %p",
+    ALOGV("moveEffectChain_l() session %d from thread %p to thread %p",
             sessionId, srcThread, dstThread);
 
     sp<EffectChain> chain = srcThread->getEffectChain_l(sessionId);
     if (chain == 0) {
-        LOGW("moveEffectChain_l() effect chain for session %d not on source thread %p",
+        ALOGW("moveEffectChain_l() effect chain for session %d not on source thread %p",
                 sessionId, srcThread);
         return INVALID_OPERATION;
     }
@@ -5653,7 +5653,7 @@
         if (dstChain == 0) {
             dstChain = effect->chain().promote();
             if (dstChain == 0) {
-                LOGW("moveEffectChain_l() cannot get chain from effect %p", effect.get());
+                ALOGW("moveEffectChain_l() cannot get chain from effect %p", effect.get());
                 srcThread->addEffect_l(effect);
                 return NO_INIT;
             }
@@ -5695,14 +5695,14 @@
 
     lStatus = initCheck();
     if (lStatus != NO_ERROR) {
-        LOGW("createEffect_l() Audio driver not initialized.");
+        ALOGW("createEffect_l() Audio driver not initialized.");
         goto Exit;
     }
 
     // Do not allow effects with session ID 0 on direct output or duplicating threads
     // TODO: add rule for hw accelerated effects on direct outputs with non PCM format
     if (sessionId == AUDIO_SESSION_OUTPUT_MIX && mType != MIXER) {
-        LOGW("createEffect_l() Cannot add auxiliary effect %s to session %d",
+        ALOGW("createEffect_l() Cannot add auxiliary effect %s to session %d",
                 desc->name, sessionId);
         lStatus = BAD_VALUE;
         goto Exit;
@@ -5712,13 +5712,13 @@
             (desc->flags & EFFECT_FLAG_TYPE_MASK) != EFFECT_FLAG_TYPE_PRE_PROC) ||
             (mType != RECORD &&
                     (desc->flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_PRE_PROC)) {
-        LOGW("createEffect_l() effect %s (flags %08x) created on wrong thread type %d",
+        ALOGW("createEffect_l() effect %s (flags %08x) created on wrong thread type %d",
                 desc->name, desc->flags, mType);
         lStatus = BAD_VALUE;
         goto Exit;
     }
 
-    LOGV("createEffect_l() thread %p effect %s on session %d", this, desc->name, sessionId);
+    ALOGV("createEffect_l() thread %p effect %s on session %d", this, desc->name, sessionId);
 
     { // scope for mLock
         Mutex::Autolock _l(mLock);
@@ -5727,7 +5727,7 @@
         chain = getEffectChain_l(sessionId);
         if (chain == 0) {
             // create a new chain for this session
-            LOGV("createEffect_l() new effect chain for session %d", sessionId);
+            ALOGV("createEffect_l() new effect chain for session %d", sessionId);
             chain = new EffectChain(this, sessionId);
             addEffectChain_l(chain);
             chain->setStrategy(getStrategyForSession_l(sessionId));
@@ -5736,7 +5736,7 @@
             effect = chain->getEffectFromDesc_l(desc);
         }
 
-        LOGV("createEffect_l() got effect %p on chain %p", effect == 0 ? 0 : effect.get(), chain.get());
+        ALOGV("createEffect_l() got effect %p on chain %p", effect == 0 ? 0 : effect.get(), chain.get());
 
         if (effect == 0) {
             int id = mAudioFlinger->nextUniqueId();
@@ -5812,16 +5812,16 @@
 
     if (chain == 0) {
         // create a new chain for this session
-        LOGV("addEffect_l() new effect chain for session %d", sessionId);
+        ALOGV("addEffect_l() new effect chain for session %d", sessionId);
         chain = new EffectChain(this, sessionId);
         addEffectChain_l(chain);
         chain->setStrategy(getStrategyForSession_l(sessionId));
         chainCreated = true;
     }
-    LOGV("addEffect_l() %p chain %p effect %p", this, chain.get(), effect.get());
+    ALOGV("addEffect_l() %p chain %p effect %p", this, chain.get(), effect.get());
 
     if (chain->getEffectFromId_l(effect->id()) != 0) {
-        LOGW("addEffect_l() %p effect %s already present in chain %p",
+        ALOGW("addEffect_l() %p effect %s already present in chain %p",
                 this, effect->desc().name, chain.get());
         return BAD_VALUE;
     }
@@ -5841,7 +5841,7 @@
 
 void AudioFlinger::ThreadBase::removeEffect_l(const sp<EffectModule>& effect) {
 
-    LOGV("removeEffect_l() %p effect %p", this, effect.get());
+    ALOGV("removeEffect_l() %p effect %p", this, effect.get());
     effect_descriptor_t desc = effect->desc();
     if ((desc.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_AUXILIARY) {
         detachAuxEffect_l(effect->id());
@@ -5854,7 +5854,7 @@
             removeEffectChain_l(chain);
         }
     } else {
-        LOGW("removeEffect_l() %p cannot promote chain for effect %p", this, effect.get());
+        ALOGW("removeEffect_l() %p cannot promote chain for effect %p", this, effect.get());
     }
 }
 
@@ -5909,7 +5909,7 @@
                                                     bool unpiniflast) {
 
     Mutex::Autolock _l(mLock);
-    LOGV("disconnectEffect() %p effect %p", this, effect.get());
+    ALOGV("disconnectEffect() %p effect %p", this, effect.get());
     // delete the effect module if removing last handle on it
     if (effect->removeHandle(handle) == 0) {
         if (!effect->isPinned() || unpiniflast) {
@@ -5925,7 +5925,7 @@
     int16_t *buffer = mMixBuffer;
     bool ownsBuffer = false;
 
-    LOGV("addEffectChain_l() %p on thread %p for session %d", chain.get(), this, session);
+    ALOGV("addEffectChain_l() %p on thread %p for session %d", chain.get(), this, session);
     if (session > 0) {
         // Only one effect chain can be present in direct output thread and it uses
         // the mix buffer as input
@@ -5933,7 +5933,7 @@
             size_t numSamples = mFrameCount * mChannelCount;
             buffer = new int16_t[numSamples];
             memset(buffer, 0, numSamples * sizeof(int16_t));
-            LOGV("addEffectChain_l() creating new input buffer %p session %d", buffer, session);
+            ALOGV("addEffectChain_l() creating new input buffer %p session %d", buffer, session);
             ownsBuffer = true;
         }
 
@@ -5941,7 +5941,7 @@
         for (size_t i = 0; i < mTracks.size(); ++i) {
             sp<Track> track = mTracks[i];
             if (session == track->sessionId()) {
-                LOGV("addEffectChain_l() track->setMainBuffer track %p buffer %p", track.get(), buffer);
+                ALOGV("addEffectChain_l() track->setMainBuffer track %p buffer %p", track.get(), buffer);
                 track->setMainBuffer(buffer);
                 chain->incTrackCnt();
             }
@@ -5952,7 +5952,7 @@
             sp<Track> track = mActiveTracks[i].promote();
             if (track == 0) continue;
             if (session == track->sessionId()) {
-                LOGV("addEffectChain_l() activating track %p on session %d", track.get(), session);
+                ALOGV("addEffectChain_l() activating track %p on session %d", track.get(), session);
                 chain->incActiveTrackCnt();
             }
         }
@@ -5985,7 +5985,7 @@
 {
     int session = chain->sessionId();
 
-    LOGV("removeEffectChain_l() %p from thread %p for session %d", chain.get(), this, session);
+    ALOGV("removeEffectChain_l() %p from thread %p for session %d", chain.get(), this, session);
 
     for (size_t i = 0; i < mEffectChains.size(); i++) {
         if (chain == mEffectChains[i]) {
@@ -5995,7 +5995,7 @@
                 sp<Track> track = mActiveTracks[i].promote();
                 if (track == 0) continue;
                 if (session == track->sessionId()) {
-                    LOGV("removeEffectChain_l(): stopping track on chain %p for session Id: %d",
+                    ALOGV("removeEffectChain_l(): stopping track on chain %p for session Id: %d",
                             chain.get(), session);
                     chain->decActiveTrackCnt();
                 }
@@ -6061,7 +6061,7 @@
     if (mEffectChains.size() != 0) {
         return INVALID_OPERATION;
     }
-    LOGV("addEffectChain_l() %p on thread %p", chain.get(), this);
+    ALOGV("addEffectChain_l() %p on thread %p", chain.get(), this);
 
     chain->setInBuffer(NULL);
     chain->setOutBuffer(NULL);
@@ -6075,8 +6075,8 @@
 
 size_t AudioFlinger::RecordThread::removeEffectChain_l(const sp<EffectChain>& chain)
 {
-    LOGV("removeEffectChain_l() %p from thread %p", chain.get(), this);
-    LOGW_IF(mEffectChains.size() != 1,
+    ALOGV("removeEffectChain_l() %p from thread %p", chain.get(), this);
+    ALOGW_IF(mEffectChains.size() != 1,
             "removeEffectChain_l() %p invalid chain size %d on thread %p",
             chain.get(), mEffectChains.size(), this);
     if (mEffectChains.size() == 1) {
@@ -6100,7 +6100,7 @@
     : mThread(wThread), mChain(chain), mId(id), mSessionId(sessionId), mEffectInterface(NULL),
       mStatus(NO_INIT), mState(IDLE), mSuspended(false)
 {
-    LOGV("Constructor %p", this);
+    ALOGV("Constructor %p", this);
     int lStatus;
     sp<ThreadBase> thread = mThread.promote();
     if (thread == 0) {
@@ -6124,17 +6124,17 @@
     if (mSessionId > AUDIO_SESSION_OUTPUT_MIX) {
         mPinned = true;
     }
-    LOGV("Constructor success name %s, Interface %p", mDescriptor.name, mEffectInterface);
+    ALOGV("Constructor success name %s, Interface %p", mDescriptor.name, mEffectInterface);
     return;
 Error:
     EffectRelease(mEffectInterface);
     mEffectInterface = NULL;
-    LOGV("Constructor Error %d", mStatus);
+    ALOGV("Constructor Error %d", mStatus);
 }
 
 AudioFlinger::EffectModule::~EffectModule()
 {
-    LOGV("Destructor %p", this);
+    ALOGV("Destructor %p", this);
     if (mEffectInterface != NULL) {
         if ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_PRE_PROC ||
                 (mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_POST_PROC) {
@@ -6178,7 +6178,7 @@
     } else {
         status = ALREADY_EXISTS;
     }
-    LOGV("addHandle() %p added handle %p in position %d", this, handle.get(), i);
+    ALOGV("addHandle() %p added handle %p in position %d", this, handle.get(), i);
     mHandles.insertAt(handle, i);
     return status;
 }
@@ -6194,12 +6194,12 @@
     if (i == size) {
         return size;
     }
-    LOGV("removeHandle() %p removed handle %p in position %d", this, handle.unsafe_get(), i);
+    ALOGV("removeHandle() %p removed handle %p in position %d", this, handle.unsafe_get(), i);
 
     bool enabled = false;
     EffectHandle *hdl = handle.unsafe_get();
     if (hdl) {
-        LOGV("removeHandle() unsafe_get OK");
+        ALOGV("removeHandle() unsafe_get OK");
         enabled = hdl->enabled();
     }
     mHandles.removeAt(i);
@@ -6234,7 +6234,7 @@
 
 void AudioFlinger::EffectModule::disconnect(const wp<EffectHandle>& handle, bool unpiniflast)
 {
-    LOGV("disconnect() %p handle %p ", this, handle.unsafe_get());
+    ALOGV("disconnect() %p handle %p ", this, handle.unsafe_get());
     // keep a strong reference on this EffectModule to avoid calling the
     // destructor before we exit
     sp<EffectModule> keep(this);
@@ -6394,7 +6394,7 @@
     mConfig.inputCfg.buffer.frameCount = thread->frameCount();
     mConfig.outputCfg.buffer.frameCount = mConfig.inputCfg.buffer.frameCount;
 
-    LOGV("configure() %p thread %p buffer %p framecount %d",
+    ALOGV("configure() %p thread %p buffer %p framecount %d",
             this, thread.get(), mConfig.inputCfg.buffer.raw, mConfig.inputCfg.buffer.frameCount);
 
     status_t cmdStatus;
@@ -6514,7 +6514,7 @@
                                              void *pReplyData)
 {
     Mutex::Autolock _l(mLock);
-//    LOGV("command(), cmdCode: %d, mEffectInterface: %p", cmdCode, mEffectInterface);
+//    ALOGV("command(), cmdCode: %d, mEffectInterface: %p", cmdCode, mEffectInterface);
 
     if (mState == DESTROYED || mEffectInterface == NULL) {
         return NO_INIT;
@@ -6541,7 +6541,7 @@
 {
 
     Mutex::Autolock _l(mLock);
-    LOGV("setEnabled %p enabled %d", this, enabled);
+    ALOGV("setEnabled %p enabled %d", this, enabled);
 
     if (enabled != isEnabled()) {
         status_t status = AudioSystem::setEffectEnabled(mId, enabled);
@@ -6823,7 +6823,7 @@
     mEffect(effect), mEffectClient(effectClient), mClient(client), mCblk(NULL),
     mPriority(priority), mHasControl(false), mEnabled(false)
 {
-    LOGV("constructor %p", this);
+    ALOGV("constructor %p", this);
 
     if (client == 0) {
         return;
@@ -6838,21 +6838,21 @@
             mBuffer = (uint8_t *)mCblk + bufOffset;
          }
     } else {
-        LOGE("not enough memory for Effect size=%u", EFFECT_PARAM_BUFFER_SIZE + sizeof(effect_param_cblk_t));
+        ALOGE("not enough memory for Effect size=%u", EFFECT_PARAM_BUFFER_SIZE + sizeof(effect_param_cblk_t));
         return;
     }
 }
 
 AudioFlinger::EffectHandle::~EffectHandle()
 {
-    LOGV("Destructor %p", this);
+    ALOGV("Destructor %p", this);
     disconnect(false);
-    LOGV("Destructor DONE %p", this);
+    ALOGV("Destructor DONE %p", this);
 }
 
 status_t AudioFlinger::EffectHandle::enable()
 {
-    LOGV("enable %p", this);
+    ALOGV("enable %p", this);
     if (!mHasControl) return INVALID_OPERATION;
     if (mEffect == 0) return DEAD_OBJECT;
 
@@ -6884,7 +6884,7 @@
 
 status_t AudioFlinger::EffectHandle::disable()
 {
-    LOGV("disable %p", this);
+    ALOGV("disable %p", this);
     if (!mHasControl) return INVALID_OPERATION;
     if (mEffect == 0) return DEAD_OBJECT;
 
@@ -6914,7 +6914,7 @@
 
 void AudioFlinger::EffectHandle::disconnect(bool unpiniflast)
 {
-    LOGV("disconnect(%s)", unpiniflast ? "true" : "false");
+    ALOGV("disconnect(%s)", unpiniflast ? "true" : "false");
     if (mEffect == 0) {
         return;
     }
@@ -6945,7 +6945,7 @@
                                              uint32_t *replySize,
                                              void *pReplyData)
 {
-//    LOGV("command(), cmdCode: %d, mHasControl: %d, mEffect: %p",
+//    ALOGV("command(), cmdCode: %d, mHasControl: %d, mEffect: %p",
 //              cmdCode, mHasControl, (mEffect == 0) ? 0 : mEffect.get());
 
     // only get parameter command is permitted for applications not controlling the effect
@@ -6973,12 +6973,12 @@
             int *p = (int *)(mBuffer + mCblk->serverIndex);
             int size = *p++;
             if (((uint8_t *)p + size) > mBuffer + mCblk->clientIndex) {
-                LOGW("command(): invalid parameter block size");
+                ALOGW("command(): invalid parameter block size");
                 break;
             }
             effect_param_t *param = (effect_param_t *)p;
             if (param->psize == 0 || param->vsize == 0) {
-                LOGW("command(): null parameter or value size");
+                ALOGW("command(): null parameter or value size");
                 mCblk->serverIndex += size;
                 continue;
             }
@@ -7021,7 +7021,7 @@
 
 void AudioFlinger::EffectHandle::setControl(bool hasControl, bool signal, bool enabled)
 {
-    LOGV("setControl %p control %d", this, hasControl);
+    ALOGV("setControl %p control %d", this, hasControl);
 
     mHasControl = hasControl;
     mEnabled = enabled;
@@ -7154,7 +7154,7 @@
 {
     sp<ThreadBase> thread = mThread.promote();
     if (thread == 0) {
-        LOGW("process_l(): cannot promote mixer thread");
+        ALOGW("process_l(): cannot promote mixer thread");
         return;
     }
     bool isGlobalSession = (mSessionId == AUDIO_SESSION_OUTPUT_MIX) ||
@@ -7250,7 +7250,7 @@
                 // check invalid effect chaining combinations
                 if (insertPref == EFFECT_FLAG_INSERT_EXCLUSIVE ||
                     iPref == EFFECT_FLAG_INSERT_EXCLUSIVE) {
-                    LOGW("addEffect_l() could not insert effect %s: exclusive conflict with %s", desc.name, d.name);
+                    ALOGW("addEffect_l() could not insert effect %s: exclusive conflict with %s", desc.name, d.name);
                     return INVALID_OPERATION;
                 }
                 // remember position of first insert effect and by default
@@ -7301,7 +7301,7 @@
         }
         mEffects.insertAt(effect, idx_insert);
 
-        LOGV("addEffect_l() effect %p, added in chain %p at rank %d", effect.get(), this, idx_insert);
+        ALOGV("addEffect_l() effect %p, added in chain %p at rank %d", effect.get(), this, idx_insert);
     }
     effect->configure();
     return NO_ERROR;
@@ -7333,7 +7333,7 @@
                 }
             }
             mEffects.removeAt(i);
-            LOGV("removeEffect_l() effect %p, removed from chain %p at rank %d", effect.get(), this, i);
+            ALOGV("removeEffect_l() effect %p, removed from chain %p at rank %d", effect.get(), this, i);
             break;
         }
     }
@@ -7470,7 +7470,7 @@
             desc = new SuspendedEffectDesc();
             memcpy(&desc->mType, type, sizeof(effect_uuid_t));
             mSuspendedEffects.add(type->timeLow, desc);
-            LOGV("setEffectSuspended_l() add entry for %08x", type->timeLow);
+            ALOGV("setEffectSuspended_l() add entry for %08x", type->timeLow);
         }
         if (desc->mRefCount++ == 0) {
             sp<EffectModule> effect = getEffectIfEnabled(type);
@@ -7486,11 +7486,11 @@
         }
         desc = mSuspendedEffects.valueAt(index);
         if (desc->mRefCount <= 0) {
-            LOGW("setEffectSuspended_l() restore refcount should not be 0 %d", desc->mRefCount);
+            ALOGW("setEffectSuspended_l() restore refcount should not be 0 %d", desc->mRefCount);
             desc->mRefCount = 1;
         }
         if (--desc->mRefCount == 0) {
-            LOGV("setEffectSuspended_l() remove entry for %08x", mSuspendedEffects.keyAt(index));
+            ALOGV("setEffectSuspended_l() remove entry for %08x", mSuspendedEffects.keyAt(index));
             if (desc->mEffect != 0) {
                 sp<EffectModule> effect = desc->mEffect.promote();
                 if (effect != 0) {
@@ -7519,7 +7519,7 @@
         } else {
             desc = new SuspendedEffectDesc();
             mSuspendedEffects.add((int)kKeyForSuspendAll, desc);
-            LOGV("setEffectSuspendedAll_l() add entry for 0");
+            ALOGV("setEffectSuspendedAll_l() add entry for 0");
         }
         if (desc->mRefCount++ == 0) {
             Vector< sp<EffectModule> > effects = getSuspendEligibleEffects();
@@ -7533,7 +7533,7 @@
         }
         desc = mSuspendedEffects.valueAt(index);
         if (desc->mRefCount <= 0) {
-            LOGW("setEffectSuspendedAll_l() restore refcount should not be 0 %d", desc->mRefCount);
+            ALOGW("setEffectSuspendedAll_l() restore refcount should not be 0 %d", desc->mRefCount);
             desc->mRefCount = 1;
         }
         if (--desc->mRefCount == 0) {
@@ -7547,7 +7547,7 @@
             for (size_t i = 0; i < types.size(); i++) {
                 setEffectSuspended_l(types[i], false);
             }
-            LOGV("setEffectSuspendedAll_l() remove entry for %08x", mSuspendedEffects.keyAt(index));
+            ALOGV("setEffectSuspendedAll_l() remove entry for %08x", mSuspendedEffects.keyAt(index));
             mSuspendedEffects.removeItem((int)kKeyForSuspendAll);
         }
     }
@@ -7613,11 +7613,11 @@
             setEffectSuspended_l(&effect->desc().type, enabled);
             index = mSuspendedEffects.indexOfKey(effect->desc().type.timeLow);
             if (index < 0) {
-                LOGW("checkSuspendOnEffectEnabled() Fx should be suspended here!");
+                ALOGW("checkSuspendOnEffectEnabled() Fx should be suspended here!");
                 return;
             }
         }
-        LOGV("checkSuspendOnEffectEnabled() enable suspending fx %08x",
+        ALOGV("checkSuspendOnEffectEnabled() enable suspending fx %08x",
              effect->desc().type.timeLow);
         sp<SuspendedEffectDesc> desc = mSuspendedEffects.valueAt(index);
         // if effect is requested to suspended but was not yet enabled, supend it now.
@@ -7630,7 +7630,7 @@
         if (index < 0) {
             return;
         }
-        LOGV("checkSuspendOnEffectEnabled() disable restoring fx %08x",
+        ALOGV("checkSuspendOnEffectEnabled() disable restoring fx %08x",
              effect->desc().type.timeLow);
         sp<SuspendedEffectDesc> desc = mSuspendedEffects.valueAt(index);
         desc->mEffect.clear();
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index 1200f75..9dda256 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -99,7 +99,7 @@
         n++;
     }
     if (mask) {
-        LOGV("add track (%d)", n);
+        ALOGV("add track (%d)", n);
         mTrackNames |= mask;
         return TRACK0 + n;
     }
@@ -118,7 +118,7 @@
  {
     name -= TRACK0;
     if (uint32_t(name) < MAX_NUM_TRACKS) {
-        LOGV("deleteTrackName(%d)", name);
+        ALOGV("deleteTrackName(%d)", name);
         track_t& track(mState.tracks[ name ]);
         if (track.enabled != 0) {
             track.enabled = 0;
@@ -143,7 +143,7 @@
         case MIXING: {
             if (mState.tracks[ mActiveTrack ].enabled != 1) {
                 mState.tracks[ mActiveTrack ].enabled = 1;
-                LOGV("enable(%d)", mActiveTrack);
+                ALOGV("enable(%d)", mActiveTrack);
                 invalidateState(1<<mActiveTrack);
             }
         } break;
@@ -159,7 +159,7 @@
         case MIXING: {
             if (mState.tracks[ mActiveTrack ].enabled != 0) {
                 mState.tracks[ mActiveTrack ].enabled = 0;
-                LOGV("disable(%d)", mActiveTrack);
+                ALOGV("disable(%d)", mActiveTrack);
                 invalidateState(1<<mActiveTrack);
             }
         } break;
@@ -192,7 +192,7 @@
                 if ((channelCount <= MAX_NUM_CHANNELS) && (channelCount)) {
                     mState.tracks[ mActiveTrack ].channelMask = mask;
                     mState.tracks[ mActiveTrack ].channelCount = channelCount;
-                    LOGV("setParameter(TRACK, CHANNEL_MASK, %x)", mask);
+                    ALOGV("setParameter(TRACK, CHANNEL_MASK, %x)", mask);
                     invalidateState(1<<mActiveTrack);
                     return NO_ERROR;
                 }
@@ -203,7 +203,7 @@
         if (name == MAIN_BUFFER) {
             if (mState.tracks[ mActiveTrack ].mainBuffer != valueBuf) {
                 mState.tracks[ mActiveTrack ].mainBuffer = valueBuf;
-                LOGV("setParameter(TRACK, MAIN_BUFFER, %p)", valueBuf);
+                ALOGV("setParameter(TRACK, MAIN_BUFFER, %p)", valueBuf);
                 invalidateState(1<<mActiveTrack);
             }
             return NO_ERROR;
@@ -211,7 +211,7 @@
         if (name == AUX_BUFFER) {
             if (mState.tracks[ mActiveTrack ].auxBuffer != valueBuf) {
                 mState.tracks[ mActiveTrack ].auxBuffer = valueBuf;
-                LOGV("setParameter(TRACK, AUX_BUFFER, %p)", valueBuf);
+                ALOGV("setParameter(TRACK, AUX_BUFFER, %p)", valueBuf);
                 invalidateState(1<<mActiveTrack);
             }
             return NO_ERROR;
@@ -223,7 +223,7 @@
             if (valueInt > 0) {
                 track_t& track = mState.tracks[ mActiveTrack ];
                 if (track.setResampler(uint32_t(valueInt), mSampleRate)) {
-                    LOGV("setParameter(RESAMPLE, SAMPLE_RATE, %u)",
+                    ALOGV("setParameter(RESAMPLE, SAMPLE_RATE, %u)",
                             uint32_t(valueInt));
                     invalidateState(1<<mActiveTrack);
                 }
@@ -242,7 +242,7 @@
         if ((uint32_t(name-VOLUME0) < MAX_NUM_CHANNELS)) {
             track_t& track = mState.tracks[ mActiveTrack ];
             if (track.volume[name-VOLUME0] != valueInt) {
-                LOGV("setParameter(VOLUME, VOLUME0/1: %04x)", valueInt);
+                ALOGV("setParameter(VOLUME, VOLUME0/1: %04x)", valueInt);
                 track.prevVolume[name-VOLUME0] = track.volume[name-VOLUME0] << 16;
                 track.volume[name-VOLUME0] = valueInt;
                 if (target == VOLUME) {
@@ -262,7 +262,7 @@
         } else if (name == AUXLEVEL) {
             track_t& track = mState.tracks[ mActiveTrack ];
             if (track.auxLevel != valueInt) {
-                LOGV("setParameter(VOLUME, AUXLEVEL: %04x)", valueInt);
+                ALOGV("setParameter(VOLUME, AUXLEVEL: %04x)", valueInt);
                 track.prevAuxLevel = track.auxLevel << 16;
                 track.auxLevel = valueInt;
                 if (target == VOLUME) {
@@ -365,7 +365,7 @@
 
 void AudioMixer::process__validate(state_t* state)
 {
-    LOGW_IF(!state->needsChanged,
+    ALOGW_IF(!state->needsChanged,
         "in process__validate() but nothing's invalid");
 
     uint32_t changed = state->needsChanged;
@@ -462,7 +462,7 @@
         }
     }
 
-    LOGV("mixer configuration change: %d activeTracks (%08x) "
+    ALOGV("mixer configuration change: %d activeTracks (%08x) "
         "all16BitsStereoNoResample=%d, resampling=%d, volumeRamp=%d",
         countActiveTracks, state->enabledTracks,
         all16BitsStereoNoResample, resampling, volumeRamp);
@@ -623,7 +623,7 @@
     const int32_t vlInc = t->volumeInc[0];
     const int32_t vrInc = t->volumeInc[1];
 
-    //LOGD("[0] %p: inc=%f, v0=%f, v1=%d, final=%f, count=%d",
+    //ALOGD("[0] %p: inc=%f, v0=%f, v1=%d, final=%f, count=%d",
     //        t, vlInc/65536.0f, vl/65536.0f, t->volume[0],
     //       (vl + vlInc*frameCount)/65536.0f, frameCount);
 
@@ -701,7 +701,7 @@
             const int32_t vlInc = t->volumeInc[0];
             const int32_t vrInc = t->volumeInc[1];
             const int32_t vaInc = t->auxInc;
-            // LOGD("[1] %p: inc=%f, v0=%f, v1=%d, final=%f, count=%d",
+            // ALOGD("[1] %p: inc=%f, v0=%f, v1=%d, final=%f, count=%d",
             //        t, vlInc/65536.0f, vl/65536.0f, t->volume[0],
             //        (vl + vlInc*frameCount)/65536.0f, frameCount);
 
@@ -745,7 +745,7 @@
             const int32_t vlInc = t->volumeInc[0];
             const int32_t vrInc = t->volumeInc[1];
 
-            // LOGD("[1] %p: inc=%f, v0=%f, v1=%d, final=%f, count=%d",
+            // ALOGD("[1] %p: inc=%f, v0=%f, v1=%d, final=%f, count=%d",
             //        t, vlInc/65536.0f, vl/65536.0f, t->volume[0],
             //        (vl + vlInc*frameCount)/65536.0f, frameCount);
 
@@ -790,7 +790,7 @@
             const int32_t vrInc = t->volumeInc[1];
             const int32_t vaInc = t->auxInc;
 
-            // LOGD("[2] %p: inc=%f, v0=%f, v1=%d, final=%f, count=%d",
+            // ALOGD("[2] %p: inc=%f, v0=%f, v1=%d, final=%f, count=%d",
             //         t, vlInc/65536.0f, vl/65536.0f, t->volume[0],
             //         (vl + vlInc*frameCount)/65536.0f, frameCount);
 
@@ -831,7 +831,7 @@
             const int32_t vlInc = t->volumeInc[0];
             const int32_t vrInc = t->volumeInc[1];
 
-            // LOGD("[2] %p: inc=%f, v0=%f, v1=%d, final=%f, count=%d",
+            // ALOGD("[2] %p: inc=%f, v0=%f, v1=%d, final=%f, count=%d",
             //         t, vlInc/65536.0f, vl/65536.0f, t->volume[0],
             //         (vl + vlInc*frameCount)/65536.0f, frameCount);
 
@@ -1099,7 +1099,7 @@
         // been enabled for mixing.
         if (in == NULL || ((unsigned long)in & 3)) {
             memset(out, 0, numFrames*MAX_NUM_CHANNELS*sizeof(int16_t));
-            LOGE_IF(((unsigned long)in & 3), "process stereo track: input buffer alignment pb: buffer %p track %d, channels %d, needs %08x",
+            ALOGE_IF(((unsigned long)in & 3), "process stereo track: input buffer alignment pb: buffer %p track %d, channels %d, needs %08x",
                     in, i, t.channelCount, t.needs);
             return;
         }
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp
index 8da5ca1..6be669b 100644
--- a/services/audioflinger/AudioPolicyService.cpp
+++ b/services/audioflinger/AudioPolicyService.cpp
@@ -53,7 +53,7 @@
 static bool checkPermission() {
     if (getpid() == IPCThreadState::self()->getCallingPid()) return true;
     bool ok = checkCallingPermission(String16("android.permission.MODIFY_AUDIO_SETTINGS"));
-    if (!ok) LOGE("Request requires android.permission.MODIFY_AUDIO_SETTINGS");
+    if (!ok) ALOGE("Request requires android.permission.MODIFY_AUDIO_SETTINGS");
     return ok;
 }
 
@@ -84,18 +84,18 @@
         return;
 
     rc = audio_policy_dev_open(module, &mpAudioPolicyDev);
-    LOGE_IF(rc, "couldn't open audio policy device (%s)", strerror(-rc));
+    ALOGE_IF(rc, "couldn't open audio policy device (%s)", strerror(-rc));
     if (rc)
         return;
 
     rc = mpAudioPolicyDev->create_audio_policy(mpAudioPolicyDev, &aps_ops, this,
                                                &mpAudioPolicy);
-    LOGE_IF(rc, "couldn't create audio policy (%s)", strerror(-rc));
+    ALOGE_IF(rc, "couldn't create audio policy (%s)", strerror(-rc));
     if (rc)
         return;
 
     rc = mpAudioPolicy->init_check(mpAudioPolicy);
-    LOGE_IF(rc, "couldn't init_check the audio policy (%s)", strerror(-rc));
+    ALOGE_IF(rc, "couldn't init_check the audio policy (%s)", strerror(-rc));
     if (rc)
         return;
 
@@ -103,7 +103,7 @@
     forced_val = strtol(value, NULL, 0);
     mpAudioPolicy->set_can_mute_enforced_audible(mpAudioPolicy, !forced_val);
 
-    LOGI("Loaded audio policy from %s (%s)", module->name, module->id);
+    ALOGI("Loaded audio policy from %s (%s)", module->name, module->id);
 
     // load audio pre processing modules
     if (access(AUDIO_EFFECT_VENDOR_CONFIG_FILE, R_OK) == 0) {
@@ -169,7 +169,7 @@
         return BAD_VALUE;
     }
 
-    LOGV("setDeviceConnectionState() tid %d", gettid());
+    ALOGV("setDeviceConnectionState() tid %d", gettid());
     Mutex::Autolock _l(mLock);
     return mpAudioPolicy->set_device_connection_state(mpAudioPolicy, device,
                                                       state, device_address);
@@ -198,7 +198,7 @@
         return BAD_VALUE;
     }
 
-    LOGV("setPhoneState() tid %d", gettid());
+    ALOGV("setPhoneState() tid %d", gettid());
 
     // TODO: check if it is more appropriate to do it in platform specific policy manager
     AudioSystem::setMode(state);
@@ -236,7 +236,7 @@
     if (config < 0 || config >= AUDIO_POLICY_FORCE_CFG_CNT) {
         return BAD_VALUE;
     }
-    LOGV("setForceUse() tid %d", gettid());
+    ALOGV("setForceUse() tid %d", gettid());
     Mutex::Autolock _l(mLock);
     mpAudioPolicy->set_force_use(mpAudioPolicy, usage, config);
     return NO_ERROR;
@@ -262,7 +262,7 @@
     if (mpAudioPolicy == NULL) {
         return 0;
     }
-    LOGV("getOutput() tid %d", gettid());
+    ALOGV("getOutput() tid %d", gettid());
     Mutex::Autolock _l(mLock);
     return mpAudioPolicy->get_output(mpAudioPolicy, stream, samplingRate, format, channels, flags);
 }
@@ -274,7 +274,7 @@
     if (mpAudioPolicy == NULL) {
         return NO_INIT;
     }
-    LOGV("startOutput() tid %d", gettid());
+    ALOGV("startOutput() tid %d", gettid());
     Mutex::Autolock _l(mLock);
     return mpAudioPolicy->start_output(mpAudioPolicy, output, stream, session);
 }
@@ -286,7 +286,7 @@
     if (mpAudioPolicy == NULL) {
         return NO_INIT;
     }
-    LOGV("stopOutput() tid %d", gettid());
+    ALOGV("stopOutput() tid %d", gettid());
     Mutex::Autolock _l(mLock);
     return mpAudioPolicy->stop_output(mpAudioPolicy, output, stream, session);
 }
@@ -296,7 +296,7 @@
     if (mpAudioPolicy == NULL) {
         return;
     }
-    LOGV("releaseOutput() tid %d", gettid());
+    ALOGV("releaseOutput() tid %d", gettid());
     Mutex::Autolock _l(mLock);
     mpAudioPolicy->release_output(mpAudioPolicy, output);
 }
@@ -339,7 +339,7 @@
         sp<AudioEffect> fx = new AudioEffect(NULL, &effect->mUuid, -1, 0, 0, audioSession, input);
         status_t status = fx->initCheck();
         if (status != NO_ERROR && status != ALREADY_EXISTS) {
-            LOGW("Failed to create Fx %s on input %d", effect->mName, input);
+            ALOGW("Failed to create Fx %s on input %d", effect->mName, input);
             // fx goes out of scope and strong ref on AudioEffect is released
             continue;
         }
@@ -534,7 +534,7 @@
 }
 
 void AudioPolicyService::binderDied(const wp<IBinder>& who) {
-    LOGW("binderDied() %p, tid %d, calling tid %d", who.unsafe_get(), gettid(),
+    ALOGW("binderDied() %p, tid %d, calling tid %d", who.unsafe_get(), gettid(),
             IPCThreadState::self()->getCallingPid());
 }
 
@@ -672,7 +672,7 @@
                 case START_TONE: {
                     mLock.unlock();
                     ToneData *data = (ToneData *)command->mParam;
-                    LOGV("AudioCommandThread() processing start tone %d on stream %d",
+                    ALOGV("AudioCommandThread() processing start tone %d on stream %d",
                             data->mType, data->mStream);
                     if (mpToneGenerator != NULL)
                         delete mpToneGenerator;
@@ -683,7 +683,7 @@
                     }break;
                 case STOP_TONE: {
                     mLock.unlock();
-                    LOGV("AudioCommandThread() processing stop tone");
+                    ALOGV("AudioCommandThread() processing stop tone");
                     if (mpToneGenerator != NULL) {
                         mpToneGenerator->stopTone();
                         delete mpToneGenerator;
@@ -693,7 +693,7 @@
                     }break;
                 case SET_VOLUME: {
                     VolumeData *data = (VolumeData *)command->mParam;
-                    LOGV("AudioCommandThread() processing set volume stream %d, \
+                    ALOGV("AudioCommandThread() processing set volume stream %d, \
                             volume %f, output %d", data->mStream, data->mVolume, data->mIO);
                     command->mStatus = AudioSystem::setStreamVolume(data->mStream,
                                                                     data->mVolume,
@@ -706,7 +706,7 @@
                     }break;
                 case SET_PARAMETERS: {
                      ParametersData *data = (ParametersData *)command->mParam;
-                     LOGV("AudioCommandThread() processing set parameters string %s, io %d",
+                     ALOGV("AudioCommandThread() processing set parameters string %s, io %d",
                              data->mKeyValuePairs.string(), data->mIO);
                      command->mStatus = AudioSystem::setParameters(data->mIO, data->mKeyValuePairs);
                      if (command->mWaitStatus) {
@@ -717,7 +717,7 @@
                      }break;
                 case SET_VOICE_VOLUME: {
                     VoiceVolumeData *data = (VoiceVolumeData *)command->mParam;
-                    LOGV("AudioCommandThread() processing set voice volume volume %f",
+                    ALOGV("AudioCommandThread() processing set voice volume volume %f",
                             data->mVolume);
                     command->mStatus = AudioSystem::setVoiceVolume(data->mVolume);
                     if (command->mWaitStatus) {
@@ -727,7 +727,7 @@
                     delete data;
                     }break;
                 default:
-                    LOGW("AudioCommandThread() unknown command %d", command->mCommand);
+                    ALOGW("AudioCommandThread() unknown command %d", command->mCommand);
                 }
                 delete command;
                 waitTime = INT64_MAX;
@@ -740,9 +740,9 @@
         if (mName != "" && mAudioCommands.isEmpty()) {
             release_wake_lock(mName.string());
         }
-        LOGV("AudioCommandThread() going to sleep");
+        ALOGV("AudioCommandThread() going to sleep");
         mWaitWorkCV.waitRelative(mLock, waitTime);
-        LOGV("AudioCommandThread() waking up");
+        ALOGV("AudioCommandThread() waking up");
     }
     mLock.unlock();
     return false;
@@ -793,7 +793,7 @@
     command->mWaitStatus = false;
     Mutex::Autolock _l(mLock);
     insertCommand_l(command);
-    LOGV("AudioCommandThread() adding tone start type %d, stream %d", type, stream);
+    ALOGV("AudioCommandThread() adding tone start type %d, stream %d", type, stream);
     mWaitWorkCV.signal();
 }
 
@@ -805,7 +805,7 @@
     command->mWaitStatus = false;
     Mutex::Autolock _l(mLock);
     insertCommand_l(command);
-    LOGV("AudioCommandThread() adding tone stop");
+    ALOGV("AudioCommandThread() adding tone stop");
     mWaitWorkCV.signal();
 }
 
@@ -830,7 +830,7 @@
     }
     Mutex::Autolock _l(mLock);
     insertCommand_l(command, delayMs);
-    LOGV("AudioCommandThread() adding set volume stream %d, volume %f, output %d",
+    ALOGV("AudioCommandThread() adding set volume stream %d, volume %f, output %d",
             stream, volume, output);
     mWaitWorkCV.signal();
     if (command->mWaitStatus) {
@@ -860,7 +860,7 @@
     }
     Mutex::Autolock _l(mLock);
     insertCommand_l(command, delayMs);
-    LOGV("AudioCommandThread() adding set parameter string %s, io %d ,delay %d",
+    ALOGV("AudioCommandThread() adding set parameter string %s, io %d ,delay %d",
             keyValuePairs, ioHandle, delayMs);
     mWaitWorkCV.signal();
     if (command->mWaitStatus) {
@@ -887,7 +887,7 @@
     }
     Mutex::Autolock _l(mLock);
     insertCommand_l(command, delayMs);
-    LOGV("AudioCommandThread() adding set voice volume volume %f", volume);
+    ALOGV("AudioCommandThread() adding set voice volume volume %f", volume);
     mWaitWorkCV.signal();
     if (command->mWaitStatus) {
         command->mCond.wait(mLock);
@@ -922,7 +922,7 @@
             ParametersData *data = (ParametersData *)command->mParam;
             ParametersData *data2 = (ParametersData *)command2->mParam;
             if (data->mIO != data2->mIO) break;
-            LOGV("Comparing parameter command %s to new command %s",
+            ALOGV("Comparing parameter command %s to new command %s",
                     data2->mKeyValuePairs.string(), data->mKeyValuePairs.string());
             AudioParameter param = AudioParameter(data->mKeyValuePairs);
             AudioParameter param2 = AudioParameter(data2->mKeyValuePairs);
@@ -936,7 +936,7 @@
                   param2.getAt(k, key2, value2);
                   if (key2 == key) {
                       param2.remove(key2);
-                      LOGV("Filtering out parameter %s", key2.string());
+                      ALOGV("Filtering out parameter %s", key2.string());
                       break;
                   }
                }
@@ -955,7 +955,7 @@
             VolumeData *data2 = (VolumeData *)command2->mParam;
             if (data->mIO != data2->mIO) break;
             if (data->mStream != data2->mStream) break;
-            LOGV("Filtering out volume command on output %d for stream %d",
+            ALOGV("Filtering out volume command on output %d for stream %d",
                     data->mIO, data->mStream);
             removedCommands.add(command2);
         } break;
@@ -971,7 +971,7 @@
         // removed commands always have time stamps greater than current command
         for (size_t k = i + 1; k < mAudioCommands.size(); k++) {
             if (mAudioCommands[k] == removedCommands[j]) {
-                LOGV("suppressing command: %d", mAudioCommands[k]->mCommand);
+                ALOGV("suppressing command: %d", mAudioCommands[k]->mCommand);
                 mAudioCommands.removeAt(k);
                 break;
             }
@@ -980,14 +980,14 @@
     removedCommands.clear();
 
     // insert command at the right place according to its time stamp
-    LOGV("inserting command: %d at index %d, num commands %d",
+    ALOGV("inserting command: %d at index %d, num commands %d",
             command->mCommand, (int)i+1, mAudioCommands.size());
     mAudioCommands.insertAt(command, i + 1);
 }
 
 void AudioPolicyService::AudioCommandThread::exit()
 {
-    LOGV("AudioCommandThread::exit");
+    ALOGV("AudioCommandThread::exit");
     {
         AutoMutex _l(mLock);
         requestExit();
@@ -1028,9 +1028,9 @@
                                   audio_stream_type_t stream)
 {
     if (tone != AUDIO_POLICY_TONE_IN_CALL_NOTIFICATION)
-        LOGE("startTone: illegal tone requested (%d)", tone);
+        ALOGE("startTone: illegal tone requested (%d)", tone);
     if (stream != AUDIO_STREAM_VOICE_CALL)
-        LOGE("startTone: illegal stream (%d) requested for tone %d", stream,
+        ALOGE("startTone: illegal stream (%d) requested for tone %d", stream,
              tone);
     mTonePlaybackThread->startToneCommand(ToneGenerator::TONE_SUP_CALL_WAITING,
                                           AUDIO_STREAM_VOICE_CALL);
@@ -1069,7 +1069,7 @@
     int i;
     for (i = AUDIO_SOURCE_MIC; i < AUDIO_SOURCE_CNT; i++) {
         if (strcmp(name, kInputSourceNames[i - AUDIO_SOURCE_MIC]) == 0) {
-            LOGV("inputSourceNameToEnum found source %s %d", name, i);
+            ALOGV("inputSourceNameToEnum found source %s %d", name, i);
             break;
         }
     }
@@ -1102,17 +1102,17 @@
     if (strncmp(node->name, SHORT_TAG, sizeof(SHORT_TAG) + 1) == 0) {
         size_t pos = growParamSize(param, sizeof(short), curSize, totSize);
         *(short *)((char *)param + pos) = (short)atoi(node->value);
-        LOGV("readParamValue() reading short %d", *(short *)((char *)param + pos));
+        ALOGV("readParamValue() reading short %d", *(short *)((char *)param + pos));
         return sizeof(short);
     } else if (strncmp(node->name, INT_TAG, sizeof(INT_TAG) + 1) == 0) {
         size_t pos = growParamSize(param, sizeof(int), curSize, totSize);
         *(int *)((char *)param + pos) = atoi(node->value);
-        LOGV("readParamValue() reading int %d", *(int *)((char *)param + pos));
+        ALOGV("readParamValue() reading int %d", *(int *)((char *)param + pos));
         return sizeof(int);
     } else if (strncmp(node->name, FLOAT_TAG, sizeof(FLOAT_TAG) + 1) == 0) {
         size_t pos = growParamSize(param, sizeof(float), curSize, totSize);
         *(float *)((char *)param + pos) = (float)atof(node->value);
-        LOGV("readParamValue() reading float %f",*(float *)((char *)param + pos));
+        ALOGV("readParamValue() reading float %f",*(float *)((char *)param + pos));
         return sizeof(float);
     } else if (strncmp(node->name, BOOL_TAG, sizeof(BOOL_TAG) + 1) == 0) {
         size_t pos = growParamSize(param, sizeof(bool), curSize, totSize);
@@ -1121,7 +1121,7 @@
         } else {
             *(bool *)((char *)param + pos) = true;
         }
-        LOGV("readParamValue() reading bool %s",*(bool *)((char *)param + pos) ? "true" : "false");
+        ALOGV("readParamValue() reading bool %s",*(bool *)((char *)param + pos) ? "true" : "false");
         return sizeof(bool);
     } else if (strncmp(node->name, STRING_TAG, sizeof(STRING_TAG) + 1) == 0) {
         size_t len = strnlen(node->value, EFFECT_STRING_LEN_MAX);
@@ -1132,10 +1132,10 @@
         strncpy(param + *curSize, node->value, len);
         *curSize += len;
         param[*curSize] = '\0';
-        LOGV("readParamValue() reading string %s", param + *curSize - len);
+        ALOGV("readParamValue() reading string %s", param + *curSize - len);
         return len;
     }
-    LOGW("readParamValue() unknown param type %s", node->name);
+    ALOGW("readParamValue() unknown param type %s", node->name);
     return 0;
 }
 
@@ -1156,7 +1156,7 @@
             // Note: that a pair of random strings is read as 0 0
             int *ptr = (int *)fx_param->data;
             int *ptr2 = (int *)((char *)param + sizeof(effect_param_t));
-            LOGW("loadEffectParameter() ptr %p ptr2 %p", ptr, ptr2);
+            ALOGW("loadEffectParameter() ptr %p ptr2 %p", ptr, ptr2);
             *ptr++ = atoi(param->name);
             *ptr = atoi(param->value);
             fx_param->psize = sizeof(int);
@@ -1165,14 +1165,14 @@
         }
     }
     if (param == NULL || value == NULL) {
-        LOGW("loadEffectParameter() invalid parameter description %s", root->name);
+        ALOGW("loadEffectParameter() invalid parameter description %s", root->name);
         goto error;
     }
 
     fx_param->psize = 0;
     param = param->first_child;
     while (param) {
-        LOGV("loadEffectParameter() reading param of type %s", param->name);
+        ALOGV("loadEffectParameter() reading param of type %s", param->name);
         size_t size = readParamValue(param, (char *)fx_param, &curSize, &totSize);
         if (size == 0) {
             goto error;
@@ -1187,7 +1187,7 @@
     fx_param->vsize = 0;
     value = value->first_child;
     while (value) {
-        LOGV("loadEffectParameter() reading value of type %s", value->name);
+        ALOGV("loadEffectParameter() reading value of type %s", value->name);
         size_t size = readParamValue(value, (char *)fx_param, &curSize, &totSize);
         if (size == 0) {
             goto error;
@@ -1207,7 +1207,7 @@
 {
     cnode *node = root->first_child;
     while (node) {
-        LOGV("loadEffectParameters() loading param %s", node->name);
+        ALOGV("loadEffectParameters() loading param %s", node->name);
         effect_param_t *param = loadEffectParameter(node);
         if (param == NULL) {
             node = node->next;
@@ -1224,7 +1224,7 @@
 {
     cnode *node = root->first_child;
     if (node == NULL) {
-        LOGW("loadInputSource() empty element %s", root->name);
+        ALOGW("loadInputSource() empty element %s", root->name);
         return NULL;
     }
     InputSourceDesc *source = new InputSourceDesc();
@@ -1232,23 +1232,23 @@
         size_t i;
         for (i = 0; i < effects.size(); i++) {
             if (strncmp(effects[i]->mName, node->name, EFFECT_STRING_LEN_MAX) == 0) {
-                LOGV("loadInputSource() found effect %s in list", node->name);
+                ALOGV("loadInputSource() found effect %s in list", node->name);
                 break;
             }
         }
         if (i == effects.size()) {
-            LOGV("loadInputSource() effect %s not in list", node->name);
+            ALOGV("loadInputSource() effect %s not in list", node->name);
             node = node->next;
             continue;
         }
         EffectDesc *effect = new EffectDesc(*effects[i]);
         loadEffectParameters(node, effect->mParams);
-        LOGV("loadInputSource() adding effect %s uuid %08x", effect->mName, effect->mUuid.timeLow);
+        ALOGV("loadInputSource() adding effect %s uuid %08x", effect->mName, effect->mUuid.timeLow);
         source->mEffects.add(effect);
         node = node->next;
     }
     if (source->mEffects.size() == 0) {
-        LOGW("loadInputSource() no valid effects found in source %s", root->name);
+        ALOGW("loadInputSource() no valid effects found in source %s", root->name);
         delete source;
         return NULL;
     }
@@ -1265,11 +1265,11 @@
     while (node) {
         audio_source_t source = inputSourceNameToEnum(node->name);
         if (source == AUDIO_SOURCE_CNT) {
-            LOGW("loadInputSources() invalid input source %s", node->name);
+            ALOGW("loadInputSources() invalid input source %s", node->name);
             node = node->next;
             continue;
         }
-        LOGV("loadInputSources() loading input source %s", node->name);
+        ALOGV("loadInputSources() loading input source %s", node->name);
         InputSourceDesc *desc = loadInputSource(node, effects);
         if (desc == NULL) {
             node = node->next;
@@ -1289,7 +1289,7 @@
     }
     effect_uuid_t uuid;
     if (AudioEffect::stringToGuid(node->value, &uuid) != NO_ERROR) {
-        LOGW("loadEffect() invalid uuid %s", node->value);
+        ALOGW("loadEffect() invalid uuid %s", node->value);
         return NULL;
     }
     EffectDesc *effect = new EffectDesc();
@@ -1307,7 +1307,7 @@
     }
     node = node->first_child;
     while (node) {
-        LOGV("loadEffects() loading effect %s", node->name);
+        ALOGV("loadEffects() loading effect %s", node->name);
         EffectDesc *effect = loadEffect(node);
         if (effect == NULL) {
             node = node->next;
@@ -1355,7 +1355,7 @@
 {
     sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
     if (af == NULL) {
-        LOGW("%s: could not get AudioFlinger", __func__);
+        ALOGW("%s: could not get AudioFlinger", __func__);
         return 0;
     }
 
@@ -1369,7 +1369,7 @@
 {
     sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
     if (af == NULL) {
-        LOGW("%s: could not get AudioFlinger", __func__);
+        ALOGW("%s: could not get AudioFlinger", __func__);
         return 0;
     }
     return af->openDuplicateOutput(output1, output2);
@@ -1388,7 +1388,7 @@
 {
     sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
     if (af == NULL) {
-        LOGW("%s: could not get AudioFlinger", __func__);
+        ALOGW("%s: could not get AudioFlinger", __func__);
         return PERMISSION_DENIED;
     }
 
@@ -1399,7 +1399,7 @@
 {
     sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
     if (af == NULL) {
-        LOGW("%s: could not get AudioFlinger", __func__);
+        ALOGW("%s: could not get AudioFlinger", __func__);
         return PERMISSION_DENIED;
     }
 
@@ -1415,7 +1415,7 @@
 {
     sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
     if (af == NULL) {
-        LOGW("%s: could not get AudioFlinger", __func__);
+        ALOGW("%s: could not get AudioFlinger", __func__);
         return 0;
     }
 
diff --git a/services/audioflinger/AudioResampler.cpp b/services/audioflinger/AudioResampler.cpp
index 9ee5a30..4586b54 100644
--- a/services/audioflinger/AudioResampler.cpp
+++ b/services/audioflinger/AudioResampler.cpp
@@ -87,7 +87,7 @@
     char value[PROPERTY_VALUE_MAX];
     if (property_get("af.resampler.quality", value, 0)) {
         quality = atoi(value);
-        LOGD("forcing AudioResampler quality to %d", quality);
+        ALOGD("forcing AudioResampler quality to %d", quality);
     }
 
     if (quality == DEFAULT)
@@ -96,15 +96,15 @@
     switch (quality) {
     default:
     case LOW_QUALITY:
-        LOGV("Create linear Resampler");
+        ALOGV("Create linear Resampler");
         resampler = new AudioResamplerOrder1(bitDepth, inChannelCount, sampleRate);
         break;
     case MED_QUALITY:
-        LOGV("Create cubic Resampler");
+        ALOGV("Create cubic Resampler");
         resampler = new AudioResamplerCubic(bitDepth, inChannelCount, sampleRate);
         break;
     case HIGH_QUALITY:
-        LOGV("Create sinc Resampler");
+        ALOGV("Create sinc Resampler");
         resampler = new AudioResamplerSinc(bitDepth, inChannelCount, sampleRate);
         break;
     }
@@ -121,9 +121,9 @@
             mPhaseFraction(0) {
     // sanity check on format
     if ((bitDepth != 16) ||(inChannelCount < 1) || (inChannelCount > 2)) {
-        LOGE("Unsupported sample format, %d bits, %d channels", bitDepth,
+        ALOGE("Unsupported sample format, %d bits, %d channels", bitDepth,
                 inChannelCount);
-        // LOG_ASSERT(0);
+        // ALOG_ASSERT(0);
     }
 
     // initialize common members
@@ -164,7 +164,7 @@
         AudioBufferProvider* provider) {
 
     // should never happen, but we overflow if it does
-    // LOG_ASSERT(outFrameCount < 32767);
+    // ALOG_ASSERT(outFrameCount < 32767);
 
     // select the appropriate resampler
     switch (mChannelCount) {
@@ -190,7 +190,7 @@
     size_t outputSampleCount = outFrameCount * 2;
     size_t inFrameCount = (outFrameCount*mInSampleRate)/mSampleRate;
 
-    // LOGE("starting resample %d frames, inputIndex=%d, phaseFraction=%d, phaseIncrement=%d\n",
+    // ALOGE("starting resample %d frames, inputIndex=%d, phaseFraction=%d, phaseIncrement=%d\n",
     //      outFrameCount, inputIndex, phaseFraction, phaseIncrement);
 
     while (outputIndex < outputSampleCount) {
@@ -203,7 +203,7 @@
                 goto resampleStereo16_exit;
             }
 
-            // LOGE("New buffer fetched: %d frames\n", mBuffer.frameCount);
+            // ALOGE("New buffer fetched: %d frames\n", mBuffer.frameCount);
             if (mBuffer.frameCount > inputIndex) break;
 
             inputIndex -= mBuffer.frameCount;
@@ -217,7 +217,7 @@
 
         // handle boundary case
         while (inputIndex == 0) {
-            // LOGE("boundary case\n");
+            // ALOGE("boundary case\n");
             out[outputIndex++] += vl * Interp(mX0L, in[0], phaseFraction);
             out[outputIndex++] += vr * Interp(mX0R, in[1], phaseFraction);
             Advance(&inputIndex, &phaseFraction, phaseIncrement);
@@ -226,7 +226,7 @@
         }
 
         // process input samples
-        // LOGE("general case\n");
+        // ALOGE("general case\n");
 
 #ifdef ASM_ARM_RESAMP1  // asm optimisation for ResamplerOrder1
         if (inputIndex + 2 < mBuffer.frameCount) {
@@ -248,24 +248,24 @@
             Advance(&inputIndex, &phaseFraction, phaseIncrement);
         }
 
-        // LOGE("loop done - outputIndex=%d, inputIndex=%d\n", outputIndex, inputIndex);
+        // ALOGE("loop done - outputIndex=%d, inputIndex=%d\n", outputIndex, inputIndex);
 
         // if done with buffer, save samples
         if (inputIndex >= mBuffer.frameCount) {
             inputIndex -= mBuffer.frameCount;
 
-            // LOGE("buffer done, new input index %d", inputIndex);
+            // ALOGE("buffer done, new input index %d", inputIndex);
 
             mX0L = mBuffer.i16[mBuffer.frameCount*2-2];
             mX0R = mBuffer.i16[mBuffer.frameCount*2-1];
             provider->releaseBuffer(&mBuffer);
 
             // verify that the releaseBuffer resets the buffer frameCount
-            // LOG_ASSERT(mBuffer.frameCount == 0);
+            // ALOG_ASSERT(mBuffer.frameCount == 0);
         }
     }
 
-    // LOGE("output buffer full - outputIndex=%d, inputIndex=%d\n", outputIndex, inputIndex);
+    // ALOGE("output buffer full - outputIndex=%d, inputIndex=%d\n", outputIndex, inputIndex);
 
 resampleStereo16_exit:
     // save state
@@ -286,7 +286,7 @@
     size_t outputSampleCount = outFrameCount * 2;
     size_t inFrameCount = (outFrameCount*mInSampleRate)/mSampleRate;
 
-    // LOGE("starting resample %d frames, inputIndex=%d, phaseFraction=%d, phaseIncrement=%d\n",
+    // ALOGE("starting resample %d frames, inputIndex=%d, phaseFraction=%d, phaseIncrement=%d\n",
     //      outFrameCount, inputIndex, phaseFraction, phaseIncrement);
     while (outputIndex < outputSampleCount) {
         // buffer is empty, fetch a new one
@@ -298,7 +298,7 @@
                 mPhaseFraction = phaseFraction;
                 goto resampleMono16_exit;
             }
-            // LOGE("New buffer fetched: %d frames\n", mBuffer.frameCount);
+            // ALOGE("New buffer fetched: %d frames\n", mBuffer.frameCount);
             if (mBuffer.frameCount >  inputIndex) break;
 
             inputIndex -= mBuffer.frameCount;
@@ -310,7 +310,7 @@
 
         // handle boundary case
         while (inputIndex == 0) {
-            // LOGE("boundary case\n");
+            // ALOGE("boundary case\n");
             int32_t sample = Interp(mX0L, in[0], phaseFraction);
             out[outputIndex++] += vl * sample;
             out[outputIndex++] += vr * sample;
@@ -320,7 +320,7 @@
         }
 
         // process input samples
-        // LOGE("general case\n");
+        // ALOGE("general case\n");
 
 #ifdef ASM_ARM_RESAMP1  // asm optimisation for ResamplerOrder1
         if (inputIndex + 2 < mBuffer.frameCount) {
@@ -343,23 +343,23 @@
         }
 
 
-        // LOGE("loop done - outputIndex=%d, inputIndex=%d\n", outputIndex, inputIndex);
+        // ALOGE("loop done - outputIndex=%d, inputIndex=%d\n", outputIndex, inputIndex);
 
         // if done with buffer, save samples
         if (inputIndex >= mBuffer.frameCount) {
             inputIndex -= mBuffer.frameCount;
 
-            // LOGE("buffer done, new input index %d", inputIndex);
+            // ALOGE("buffer done, new input index %d", inputIndex);
 
             mX0L = mBuffer.i16[mBuffer.frameCount-1];
             provider->releaseBuffer(&mBuffer);
 
             // verify that the releaseBuffer resets the buffer frameCount
-            // LOG_ASSERT(mBuffer.frameCount == 0);
+            // ALOG_ASSERT(mBuffer.frameCount == 0);
         }
     }
 
-    // LOGE("output buffer full - outputIndex=%d, inputIndex=%d\n", outputIndex, inputIndex);
+    // ALOGE("output buffer full - outputIndex=%d, inputIndex=%d\n", outputIndex, inputIndex);
 
 resampleMono16_exit:
     // save state
diff --git a/services/audioflinger/AudioResamplerCubic.cpp b/services/audioflinger/AudioResamplerCubic.cpp
index 4d721f6..47205ba 100644
--- a/services/audioflinger/AudioResamplerCubic.cpp
+++ b/services/audioflinger/AudioResamplerCubic.cpp
@@ -36,7 +36,7 @@
         AudioBufferProvider* provider) {
 
     // should never happen, but we overflow if it does
-    // LOG_ASSERT(outFrameCount < 32767);
+    // ALOG_ASSERT(outFrameCount < 32767);
 
     // select the appropriate resampler
     switch (mChannelCount) {
@@ -68,7 +68,7 @@
         provider->getNextBuffer(&mBuffer);
         if (mBuffer.raw == NULL)
             return;
-        // LOGW("New buffer: offset=%p, frames=%dn", mBuffer.raw, mBuffer.frameCount);
+        // ALOGW("New buffer: offset=%p, frames=%dn", mBuffer.raw, mBuffer.frameCount);
     }
     int16_t *in = mBuffer.i16;
 
@@ -99,7 +99,7 @@
                 if (mBuffer.raw == NULL)
                     goto save_state;  // ugly, but efficient
                 in = mBuffer.i16;
-                // LOGW("New buffer: offset=%p, frames=%d\n", mBuffer.raw, mBuffer.frameCount);
+                // ALOGW("New buffer: offset=%p, frames=%d\n", mBuffer.raw, mBuffer.frameCount);
             }
 
             // advance sample state
@@ -109,7 +109,7 @@
     }
 
 save_state:
-    // LOGW("Done: index=%d, fraction=%u", inputIndex, phaseFraction);
+    // ALOGW("Done: index=%d, fraction=%u", inputIndex, phaseFraction);
     mInputIndex = inputIndex;
     mPhaseFraction = phaseFraction;
 }
@@ -133,7 +133,7 @@
         provider->getNextBuffer(&mBuffer);
         if (mBuffer.raw == NULL)
             return;
-        // LOGW("New buffer: offset=%p, frames=%d\n", mBuffer.raw, mBuffer.frameCount);
+        // ALOGW("New buffer: offset=%p, frames=%d\n", mBuffer.raw, mBuffer.frameCount);
     }
     int16_t *in = mBuffer.i16;
 
@@ -163,7 +163,7 @@
                 provider->getNextBuffer(&mBuffer);
                 if (mBuffer.raw == NULL)
                     goto save_state;  // ugly, but efficient
-                // LOGW("New buffer: offset=%p, frames=%dn", mBuffer.raw, mBuffer.frameCount);
+                // ALOGW("New buffer: offset=%p, frames=%dn", mBuffer.raw, mBuffer.frameCount);
                 in = mBuffer.i16;
             }
 
@@ -173,7 +173,7 @@
     }
 
 save_state:
-    // LOGW("Done: index=%d, fraction=%u", inputIndex, phaseFraction);
+    // ALOGW("Done: index=%d, fraction=%u", inputIndex, phaseFraction);
     mInputIndex = inputIndex;
     mPhaseFraction = phaseFraction;
 }
diff --git a/services/camera/libcameraservice/CameraHardwareInterface.h b/services/camera/libcameraservice/CameraHardwareInterface.h
index c3ced4c2..34087b5 100644
--- a/services/camera/libcameraservice/CameraHardwareInterface.h
+++ b/services/camera/libcameraservice/CameraHardwareInterface.h
@@ -88,21 +88,21 @@
 
     ~CameraHardwareInterface()
     {
-        LOGI("Destroying camera %s", mName.string());
+        ALOGI("Destroying camera %s", mName.string());
         if(mDevice) {
             int rc = mDevice->common.close(&mDevice->common);
             if (rc != OK)
-                LOGE("Could not close camera %s: %d", mName.string(), rc);
+                ALOGE("Could not close camera %s: %d", mName.string(), rc);
         }
     }
 
     status_t initialize(hw_module_t *module)
     {
-        LOGI("Opening camera %s", mName.string());
+        ALOGI("Opening camera %s", mName.string());
         int rc = module->methods->open(module, mName.string(),
                                        (hw_device_t **)&mDevice);
         if (rc != OK) {
-            LOGE("Could not open camera %s: %d", mName.string(), rc);
+            ALOGE("Could not open camera %s: %d", mName.string(), rc);
             return rc;
         }
         initHalPreviewWindow();
@@ -112,12 +112,12 @@
     /** Set the ANativeWindow to which preview frames are sent */
     status_t setPreviewWindow(const sp<ANativeWindow>& buf)
     {
-        LOGV("%s(%s) buf %p", __FUNCTION__, mName.string(), buf.get());
+        ALOGV("%s(%s) buf %p", __FUNCTION__, mName.string(), buf.get());
 
         if (mDevice->ops->set_preview_window) {
             mPreviewWindow = buf;
             mHalPreviewWindow.user = this;
-            LOGV("%s &mHalPreviewWindow %p mHalPreviewWindow.user %p", __FUNCTION__,
+            ALOGV("%s &mHalPreviewWindow %p mHalPreviewWindow.user %p", __FUNCTION__,
                     &mHalPreviewWindow, mHalPreviewWindow.user);
             return mDevice->ops->set_preview_window(mDevice,
                     buf.get() ? &mHalPreviewWindow.nw : 0);
@@ -136,7 +136,7 @@
         mDataCbTimestamp = data_cb_timestamp;
         mCbUser = user;
 
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
 
         if (mDevice->ops->set_callbacks) {
             mDevice->ops->set_callbacks(mDevice,
@@ -159,7 +159,7 @@
      */
     void enableMsgType(int32_t msgType)
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->enable_msg_type)
             mDevice->ops->enable_msg_type(mDevice, msgType);
     }
@@ -176,7 +176,7 @@
      */
     void disableMsgType(int32_t msgType)
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->disable_msg_type)
             mDevice->ops->disable_msg_type(mDevice, msgType);
     }
@@ -188,7 +188,7 @@
      */
     int msgTypeEnabled(int32_t msgType)
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->msg_type_enabled)
             return mDevice->ops->msg_type_enabled(mDevice, msgType);
         return false;
@@ -199,7 +199,7 @@
      */
     status_t startPreview()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->start_preview)
             return mDevice->ops->start_preview(mDevice);
         return INVALID_OPERATION;
@@ -210,7 +210,7 @@
      */
     void stopPreview()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->stop_preview)
             mDevice->ops->stop_preview(mDevice);
     }
@@ -220,7 +220,7 @@
      */
     int previewEnabled()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->preview_enabled)
             return mDevice->ops->preview_enabled(mDevice);
         return false;
@@ -260,7 +260,7 @@
 
     status_t storeMetaDataInBuffers(int enable)
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->store_meta_data_in_buffers)
             return mDevice->ops->store_meta_data_in_buffers(mDevice, enable);
         return enable ? INVALID_OPERATION: OK;
@@ -277,7 +277,7 @@
      */
     status_t startRecording()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->start_recording)
             return mDevice->ops->start_recording(mDevice);
         return INVALID_OPERATION;
@@ -288,7 +288,7 @@
      */
     void stopRecording()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->stop_recording)
             mDevice->ops->stop_recording(mDevice);
     }
@@ -298,7 +298,7 @@
      */
     int recordingEnabled()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->recording_enabled)
             return mDevice->ops->recording_enabled(mDevice);
         return false;
@@ -316,7 +316,7 @@
      */
     void releaseRecordingFrame(const sp<IMemory>& mem)
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->release_recording_frame) {
             ssize_t offset;
             size_t size;
@@ -333,7 +333,7 @@
      */
     status_t autoFocus()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->auto_focus)
             return mDevice->ops->auto_focus(mDevice);
         return INVALID_OPERATION;
@@ -347,7 +347,7 @@
      */
     status_t cancelAutoFocus()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->cancel_auto_focus)
             return mDevice->ops->cancel_auto_focus(mDevice);
         return INVALID_OPERATION;
@@ -358,7 +358,7 @@
      */
     status_t takePicture()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->take_picture)
             return mDevice->ops->take_picture(mDevice);
         return INVALID_OPERATION;
@@ -370,7 +370,7 @@
      */
     status_t cancelPicture()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->cancel_picture)
             return mDevice->ops->cancel_picture(mDevice);
         return INVALID_OPERATION;
@@ -381,7 +381,7 @@
      * invalid or not supported. */
     status_t setParameters(const CameraParameters &params)
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->set_parameters)
             return mDevice->ops->set_parameters(mDevice,
                                                params.flatten().string());
@@ -391,7 +391,7 @@
     /** Return the camera parameters. */
     CameraParameters getParameters() const
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         CameraParameters parms;
         if (mDevice->ops->get_parameters) {
             char *temp = mDevice->ops->get_parameters(mDevice);
@@ -410,7 +410,7 @@
      */
     status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2)
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->send_command)
             return mDevice->ops->send_command(mDevice, cmd, arg1, arg2);
         return INVALID_OPERATION;
@@ -421,7 +421,7 @@
      * *not* done in the destructor.
      */
     void release() {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->release)
             mDevice->ops->release(mDevice);
     }
@@ -431,7 +431,7 @@
      */
     status_t dump(int fd, const Vector<String16>& args) const
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->dump)
             return mDevice->ops->dump(mDevice, fd);
         return OK; // It's fine if the HAL doesn't implement dump()
@@ -444,7 +444,7 @@
     static void __notify_cb(int32_t msg_type, int32_t ext1,
                             int32_t ext2, void *user)
     {
-        LOGV("%s", __FUNCTION__);
+        ALOGV("%s", __FUNCTION__);
         CameraHardwareInterface *__this =
                 static_cast<CameraHardwareInterface *>(user);
         __this->mNotifyCb(msg_type, ext1, ext2, __this->mCbUser);
@@ -455,12 +455,12 @@
                           camera_frame_metadata_t *metadata,
                           void *user)
     {
-        LOGV("%s", __FUNCTION__);
+        ALOGV("%s", __FUNCTION__);
         CameraHardwareInterface *__this =
                 static_cast<CameraHardwareInterface *>(user);
         sp<CameraHeapMemory> mem(static_cast<CameraHeapMemory *>(data->handle));
         if (index >= mem->mNumBufs) {
-            LOGE("%s: invalid buffer index %d, max allowed is %d", __FUNCTION__,
+            ALOGE("%s: invalid buffer index %d, max allowed is %d", __FUNCTION__,
                  index, mem->mNumBufs);
             return;
         }
@@ -471,7 +471,7 @@
                              const camera_memory_t *data, unsigned index,
                              void *user)
     {
-        LOGV("%s", __FUNCTION__);
+        ALOGV("%s", __FUNCTION__);
         CameraHardwareInterface *__this =
                 static_cast<CameraHardwareInterface *>(user);
         // Start refcounting the heap object from here on.  When the clients
@@ -479,7 +479,7 @@
         // MemoryHeapBase.
         sp<CameraHeapMemory> mem(static_cast<CameraHeapMemory *>(data->handle));
         if (index >= mem->mNumBufs) {
-            LOGE("%s: invalid buffer index %d, max allowed is %d", __FUNCTION__,
+            ALOGE("%s: invalid buffer index %d, max allowed is %d", __FUNCTION__,
                  index, mem->mNumBufs);
             return;
         }
diff --git a/services/camera/libcameraservice/CameraHardwareStub.cpp b/services/camera/libcameraservice/CameraHardwareStub.cpp
index 863f19e..cdfb2f5 100644
--- a/services/camera/libcameraservice/CameraHardwareStub.cpp
+++ b/services/camera/libcameraservice/CameraHardwareStub.cpp
@@ -57,7 +57,7 @@
     p.setPictureFormat(CameraParameters::PIXEL_FORMAT_JPEG);
 
     if (setParameters(p) != NO_ERROR) {
-        LOGE("Failed to set default parameters?!");
+        ALOGE("Failed to set default parameters?!");
     }
 }
 
@@ -70,7 +70,7 @@
 
     int preview_width, preview_height;
     mParameters.getPreviewSize(&preview_width, &preview_height);
-    LOGD("initHeapLocked: preview size=%dx%d", preview_width, preview_height);
+    ALOGD("initHeapLocked: preview size=%dx%d", preview_width, preview_height);
 
     // Note that we enforce yuv420sp in setParameters().
     int how_big = preview_width * preview_height * 3 / 2;
@@ -176,7 +176,7 @@
         uint8_t *frame = ((uint8_t *)base) + offset;
         fakeCamera->getNextFrameAsYuv420(frame);
 
-        //LOGV("previewThread: generated frame to buffer %d", mCurrentPreviewFrame);
+        //ALOGV("previewThread: generated frame to buffer %d", mCurrentPreviewFrame);
 
         // Notify the client of a new frame.
         if (mMsgEnabled & CAMERA_MSG_PREVIEW_FRAME)
@@ -340,20 +340,20 @@
 
     if (strcmp(params.getPreviewFormat(),
         CameraParameters::PIXEL_FORMAT_YUV420SP) != 0) {
-        LOGE("Only yuv420sp preview is supported");
+        ALOGE("Only yuv420sp preview is supported");
         return -1;
     }
 
     if (strcmp(params.getPictureFormat(),
         CameraParameters::PIXEL_FORMAT_JPEG) != 0) {
-        LOGE("Only jpeg still pictures are supported");
+        ALOGE("Only jpeg still pictures are supported");
         return -1;
     }
 
     int w, h;
     params.getPictureSize(&w, &h);
     if (w != kCannedJpegWidth && h != kCannedJpegHeight) {
-        LOGE("Still picture size must be size of canned JPEG (%dx%d)",
+        ALOGE("Still picture size must be size of canned JPEG (%dx%d)",
              kCannedJpegWidth, kCannedJpegHeight);
         return -1;
     }
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 52d9bf35..918f31e 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -47,8 +47,8 @@
 // Use "adb shell dumpsys media.camera -v 1" to change it.
 static volatile int32_t gLogLevel = 0;
 
-#define LOG1(...) LOGD_IF(gLogLevel >= 1, __VA_ARGS__);
-#define LOG2(...) LOGD_IF(gLogLevel >= 2, __VA_ARGS__);
+#define LOG1(...) ALOGD_IF(gLogLevel >= 1, __VA_ARGS__);
+#define LOG2(...) ALOGD_IF(gLogLevel >= 2, __VA_ARGS__);
 
 static void setLogLevel(int level) {
     android_atomic_write(level, &gLogLevel);
@@ -73,7 +73,7 @@
 CameraService::CameraService()
 :mSoundRef(0), mModule(0)
 {
-    LOGI("CameraService started (pid=%d)", getpid());
+    ALOGI("CameraService started (pid=%d)", getpid());
     gCameraService = this;
 }
 
@@ -83,13 +83,13 @@
 
     if (hw_get_module(CAMERA_HARDWARE_MODULE_ID,
                 (const hw_module_t **)&mModule) < 0) {
-        LOGE("Could not load camera HAL module");
+        ALOGE("Could not load camera HAL module");
         mNumberOfCameras = 0;
     }
     else {
         mNumberOfCameras = mModule->get_number_of_cameras();
         if (mNumberOfCameras > MAX_CAMERAS) {
-            LOGE("Number of cameras(%d) > MAX_CAMERAS(%d).",
+            ALOGE("Number of cameras(%d) > MAX_CAMERAS(%d).",
                     mNumberOfCameras, MAX_CAMERAS);
             mNumberOfCameras = MAX_CAMERAS;
         }
@@ -102,7 +102,7 @@
 CameraService::~CameraService() {
     for (int i = 0; i < mNumberOfCameras; i++) {
         if (mBusy[i]) {
-            LOGE("camera %d is still in use in destructor!", i);
+            ALOGE("camera %d is still in use in destructor!", i);
         }
     }
 
@@ -138,13 +138,13 @@
     LOG1("CameraService::connect E (pid %d, id %d)", callingPid, cameraId);
 
     if (!mModule) {
-        LOGE("Camera HAL module not loaded");
+        ALOGE("Camera HAL module not loaded");
         return NULL;
     }
 
     sp<Client> client;
     if (cameraId < 0 || cameraId >= mNumberOfCameras) {
-        LOGE("CameraService::connect X (pid %d) rejected (invalid cameraId %d).",
+        ALOGE("CameraService::connect X (pid %d) rejected (invalid cameraId %d).",
             callingPid, cameraId);
         return NULL;
     }
@@ -153,7 +153,7 @@
     property_get("sys.secpolicy.camera.disabled", value, "0");
     if (strcmp(value, "1") == 0) {
         // Camera is disabled by DevicePolicyManager.
-        LOGI("Camera is disabled. connect X (pid %d) rejected", callingPid);
+        ALOGI("Camera is disabled. connect X (pid %d) rejected", callingPid);
         return NULL;
     }
 
@@ -166,7 +166,7 @@
                     callingPid);
                 return client;
             } else {
-                LOGW("CameraService::connect X (pid %d) rejected (existing client).",
+                ALOGW("CameraService::connect X (pid %d) rejected (existing client).",
                     callingPid);
                 return NULL;
             }
@@ -175,14 +175,14 @@
     }
 
     if (mBusy[cameraId]) {
-        LOGW("CameraService::connect X (pid %d) rejected"
+        ALOGW("CameraService::connect X (pid %d) rejected"
              " (camera %d is still busy).", callingPid, cameraId);
         return NULL;
     }
 
     struct camera_info info;
     if (mModule->get_camera_info(cameraId, &info) != OK) {
-        LOGE("Invalid camera id %d", cameraId);
+        ALOGE("Invalid camera id %d", cameraId);
         return NULL;
     }
 
@@ -253,7 +253,7 @@
                 if (!checkCallingPermission(
                         String16("android.permission.CAMERA"))) {
                     const int uid = getCallingUid();
-                    LOGE("Permission Denial: "
+                    ALOGE("Permission Denial: "
                          "can't use the camera pid=%d, uid=%d", pid, uid);
                     return PERMISSION_DENIED;
                 }
@@ -288,7 +288,7 @@
         mp->setAudioStreamType(AUDIO_STREAM_ENFORCED_AUDIBLE);
         mp->prepare();
     } else {
-        LOGE("Failed to load CameraService sounds: %s", file);
+        ALOGE("Failed to load CameraService sounds: %s", file);
         return NULL;
     }
     return mp;
@@ -380,7 +380,7 @@
     int callingPid = getCallingPid();
     if (callingPid == mClientPid) return NO_ERROR;
 
-    LOGW("attempt to use a locked camera from a different process"
+    ALOGW("attempt to use a locked camera from a different process"
          " (old pid %d, new pid %d)", mClientPid, callingPid);
     return EBUSY;
 }
@@ -389,7 +389,7 @@
     status_t result = checkPid();
     if (result != NO_ERROR) return result;
     if (mHardware == 0) {
-        LOGE("attempt to use a camera after disconnect() (pid %d)", getCallingPid());
+        ALOGE("attempt to use a camera after disconnect() (pid %d)", getCallingPid());
         return INVALID_OPERATION;
     }
     return NO_ERROR;
@@ -419,7 +419,7 @@
     status_t result = checkPid();
     if (result == NO_ERROR) {
         if (mHardware->recordingEnabled()) {
-            LOGE("Not allowed to unlock camera during recording.");
+            ALOGE("Not allowed to unlock camera during recording.");
             return INVALID_OPERATION;
         }
         mClientPid = 0;
@@ -438,7 +438,7 @@
     Mutex::Autolock lock(mLock);
 
     if (mClientPid != 0 && checkPid() != NO_ERROR) {
-        LOGW("Tried to connect to a locked camera (old pid %d, new pid %d)",
+        ALOGW("Tried to connect to a locked camera (old pid %d, new pid %d)",
                 mClientPid, callingPid);
         return EBUSY;
     }
@@ -461,7 +461,7 @@
         status_t result = native_window_api_disconnect(window.get(),
                 NATIVE_WINDOW_API_CAMERA);
         if (result != NO_ERROR) {
-            LOGW("native_window_api_disconnect failed: %s (%d)", strerror(-result),
+            ALOGW("native_window_api_disconnect failed: %s (%d)", strerror(-result),
                     result);
         }
     }
@@ -473,7 +473,7 @@
     Mutex::Autolock lock(mLock);
 
     if (checkPid() != NO_ERROR) {
-        LOGW("different client - don't disconnect");
+        ALOGW("different client - don't disconnect");
         return;
     }
 
@@ -526,7 +526,7 @@
     if (window != 0) {
         result = native_window_api_connect(window.get(), NATIVE_WINDOW_API_CAMERA);
         if (result != NO_ERROR) {
-            LOGE("native_window_api_connect failed: %s (%d)", strerror(-result),
+            ALOGE("native_window_api_connect failed: %s (%d)", strerror(-result),
                     result);
             return result;
         }
@@ -624,7 +624,7 @@
             return startPreviewMode();
         case CAMERA_RECORDING_MODE:
             if (mSurface == 0 && mPreviewWindow == 0) {
-                LOGE("mSurface or mPreviewWindow must be set before startRecordingMode.");
+                ALOGE("mSurface or mPreviewWindow must be set before startRecordingMode.");
                 return INVALID_OPERATION;
             }
             return startRecordingMode();
@@ -676,7 +676,7 @@
     mCameraService->playSound(SOUND_RECORDING);
     result = mHardware->startRecording();
     if (result != NO_ERROR) {
-        LOGE("mHardware->startRecording() failed with status %d", result);
+        ALOGE("mHardware->startRecording() failed with status %d", result);
     }
     return result;
 }
@@ -770,7 +770,7 @@
 
     if ((msgType & CAMERA_MSG_RAW_IMAGE) &&
         (msgType & CAMERA_MSG_RAW_IMAGE_NOTIFY)) {
-        LOGE("CAMERA_MSG_RAW_IMAGE and CAMERA_MSG_RAW_IMAGE_NOTIFY"
+        ALOGE("CAMERA_MSG_RAW_IMAGE and CAMERA_MSG_RAW_IMAGE_NOTIFY"
                 " cannot be both enabled");
         return BAD_VALUE;
     }
@@ -831,7 +831,7 @@
         // Disabling shutter sound is not allowed. Deny if the current
         // process is not mediaserver.
         if (getCallingPid() != getpid()) {
-            LOGE("Failed to disable shutter sound. Permission denied (pid %d)", getCallingPid());
+            ALOGE("Failed to disable shutter sound. Permission denied (pid %d)", getCallingPid());
             return PERMISSION_DENIED;
         }
     }
@@ -907,7 +907,7 @@
         }
         usleep(CHECK_MESSAGE_INTERVAL * 1000);
     }
-    LOGW("lockIfMessageWanted(%d): dropped unwanted message", msgType);
+    ALOGW("lockIfMessageWanted(%d): dropped unwanted message", msgType);
     return false;
 }
 
@@ -926,12 +926,12 @@
 
     // The checks below are not necessary and are for debugging only.
     if (client->mCameraService.get() != gCameraService) {
-        LOGE("mismatch service!");
+        ALOGE("mismatch service!");
         return NULL;
     }
 
     if (client->mHardware == 0) {
-        LOGE("mHardware == 0: callback after disconnect()?");
+        ALOGE("mHardware == 0: callback after disconnect()?");
         return NULL;
     }
 
@@ -989,7 +989,7 @@
     if (!client->lockIfMessageWanted(msgType)) return;
 
     if (dataPtr == 0 && metadata == NULL) {
-        LOGE("Null data returned in data callback");
+        ALOGE("Null data returned in data callback");
         client->handleGenericNotify(CAMERA_MSG_ERROR, UNKNOWN_ERROR, 0);
         return;
     }
@@ -1022,7 +1022,7 @@
     if (!client->lockIfMessageWanted(msgType)) return;
 
     if (dataPtr == 0) {
-        LOGE("Null data returned in data with timestamp callback");
+        ALOGE("Null data returned in data with timestamp callback");
         client->handleGenericNotify(CAMERA_MSG_ERROR, UNKNOWN_ERROR, 0);
         return;
     }
@@ -1177,7 +1177,7 @@
         mPreviewBuffer = new MemoryHeapBase(size, 0, NULL);
     }
     if (mPreviewBuffer == 0) {
-        LOGE("failed to allocate space for preview buffer");
+        ALOGE("failed to allocate space for preview buffer");
         mLock.unlock();
         return;
     }
@@ -1187,7 +1187,7 @@
 
     sp<MemoryBase> frame = new MemoryBase(previewBuffer, 0, size);
     if (frame == 0) {
-        LOGE("failed to allocate space for frame callback");
+        ALOGE("failed to allocate space for frame callback");
         mLock.unlock();
         return;
     }
@@ -1213,7 +1213,7 @@
             return HAL_TRANSFORM_FLIP_V | HAL_TRANSFORM_ROT_90;
         }
     }
-    LOGE("Invalid setDisplayOrientation degrees=%d", degrees);
+    ALOGE("Invalid setDisplayOrientation degrees=%d", degrees);
     return -1;
 }
 
diff --git a/services/camera/tests/CameraServiceTest/CameraServiceTest.cpp b/services/camera/tests/CameraServiceTest/CameraServiceTest.cpp
index e390ae20..1055538 100644
--- a/services/camera/tests/CameraServiceTest/CameraServiceTest.cpp
+++ b/services/camera/tests/CameraServiceTest/CameraServiceTest.cpp
@@ -46,7 +46,7 @@
     do { \
         printf(__VA_ARGS__); \
         printf("\n"); \
-        LOGD(__VA_ARGS__); \
+        ALOGD(__VA_ARGS__); \
     } while(0)
 
 void assert_fail(const char *file, int line, const char *func, const char *expr) {
@@ -217,7 +217,7 @@
 
 void MCameraClient::assertTest(OP op, int v1, int v2) {
     if (!test(op, v1, v2)) {
-        LOGE("assertTest failed: op=%d, v1=%d, v2=%d", op, v1, v2);
+        ALOGE("assertTest failed: op=%d, v1=%d, v2=%d", op, v1, v2);
         ASSERT(0);
     }
 }
@@ -797,7 +797,7 @@
         int w, h;
         const char *s = param.get(CameraParameters::KEY_SUPPORTED_PICTURE_SIZES);
         while (getNextSize(&s, &w, &h)) {
-            LOGD("checking picture size %dx%d", w, h);
+            ALOGD("checking picture size %dx%d", w, h);
             checkOnePicture(w, h);
         }
     }
@@ -811,7 +811,7 @@
 
         // Try all flag combinations.
         for (int v = 0; v < 8; v++) {
-            LOGD("TestPreviewCallbackFlag: flag=%d", v);
+            ALOGD("TestPreviewCallbackFlag: flag=%d", v);
             usleep(100000); // sleep a while to clear the in-flight callbacks.
             cc->clearStat();
             c->setPreviewCallbackFlag(v);
@@ -875,7 +875,7 @@
         int w, h;
         const char *s = param.get(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES);
         while (getNextSize(&s, &w, &h)) {
-            LOGD("checking preview size %dx%d", w, h);
+            ALOGD("checking preview size %dx%d", w, h);
             checkOnePicture(w, h);
         }
     }
diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp
index 5289741..68bbb570 100644
--- a/services/input/EventHub.cpp
+++ b/services/input/EventHub.cpp
@@ -246,7 +246,7 @@
         if (device && test_bit(axis, device->absBitmask)) {
             struct input_absinfo info;
             if(ioctl(device->fd, EVIOCGABS(axis), &info)) {
-                LOGW("Error reading absolute controller %d for device %s fd %d, errno=%d",
+                ALOGW("Error reading absolute controller %d for device %s fd %d, errno=%d",
                      axis, device->identifier.name.string(), device->fd, errno);
                 return -errno;
             }
@@ -355,7 +355,7 @@
         if (device && test_bit(axis, device->absBitmask)) {
             struct input_absinfo info;
             if(ioctl(device->fd, EVIOCGABS(axis), &info)) {
-                LOGW("Error reading absolute controller %d for device %s fd %d, errno=%d",
+                ALOGW("Error reading absolute controller %d for device %s fd %d, errno=%d",
                      axis, device->identifier.name.string(), device->fd, errno);
                 return -errno;
             }
@@ -535,7 +535,7 @@
 }
 
 size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSize) {
-    LOG_ASSERT(bufferSize >= 1);
+    ALOG_ASSERT(bufferSize >= 1);
 
     AutoMutex _l(mLock);
 
@@ -551,7 +551,7 @@
         if (mNeedToReopenDevices) {
             mNeedToReopenDevices = false;
 
-            LOGI("Reopening all input devices due to a configuration change.");
+            ALOGI("Reopening all input devices due to a configuration change.");
 
             closeAllDevicesLocked();
             mNeedToScanDevices = true;
@@ -561,7 +561,7 @@
         // Report any devices that had last been added/removed.
         while (mClosingDevices) {
             Device* device = mClosingDevices;
-            LOGV("Reporting device closed: id=%d, name=%s\n",
+            ALOGV("Reporting device closed: id=%d, name=%s\n",
                  device->id, device->path.string());
             mClosingDevices = device->next;
             event->when = now;
@@ -583,7 +583,7 @@
 
         while (mOpeningDevices != NULL) {
             Device* device = mOpeningDevices;
-            LOGV("Reporting device opened: id=%d, name=%s\n",
+            ALOGV("Reporting device opened: id=%d, name=%s\n",
                  device->id, device->path.string());
             mOpeningDevices = device->next;
             event->when = now;
@@ -614,14 +614,14 @@
                 if (eventItem.events & EPOLLIN) {
                     mPendingINotify = true;
                 } else {
-                    LOGW("Received unexpected epoll event 0x%08x for INotify.", eventItem.events);
+                    ALOGW("Received unexpected epoll event 0x%08x for INotify.", eventItem.events);
                 }
                 continue;
             }
 
             if (eventItem.data.u32 == EPOLL_ID_WAKE) {
                 if (eventItem.events & EPOLLIN) {
-                    LOGV("awoken after wake()");
+                    ALOGV("awoken after wake()");
                     awoken = true;
                     char buffer[16];
                     ssize_t nRead;
@@ -629,7 +629,7 @@
                         nRead = read(mWakeReadPipeFd, buffer, sizeof(buffer));
                     } while ((nRead == -1 && errno == EINTR) || nRead == sizeof(buffer));
                 } else {
-                    LOGW("Received unexpected epoll event 0x%08x for wake read pipe.",
+                    ALOGW("Received unexpected epoll event 0x%08x for wake read pipe.",
                             eventItem.events);
                 }
                 continue;
@@ -637,7 +637,7 @@
 
             ssize_t deviceIndex = mDevices.indexOfKey(eventItem.data.u32);
             if (deviceIndex < 0) {
-                LOGW("Received unexpected epoll event 0x%08x for unknown device id %d.",
+                ALOGW("Received unexpected epoll event 0x%08x for unknown device id %d.",
                         eventItem.events, eventItem.data.u32);
                 continue;
             }
@@ -648,23 +648,23 @@
                         sizeof(struct input_event) * capacity);
                 if (readSize == 0 || (readSize < 0 && errno == ENODEV)) {
                     // Device was removed before INotify noticed.
-                    LOGW("could not get event, removed? (fd: %d size: %d bufferSize: %d capacity: %d errno: %d)\n",
+                    ALOGW("could not get event, removed? (fd: %d size: %d bufferSize: %d capacity: %d errno: %d)\n",
                          device->fd, readSize, bufferSize, capacity, errno);
                     deviceChanged = true;
                     closeDeviceLocked(device);
                 } else if (readSize < 0) {
                     if (errno != EAGAIN && errno != EINTR) {
-                        LOGW("could not get event (errno=%d)", errno);
+                        ALOGW("could not get event (errno=%d)", errno);
                     }
                 } else if ((readSize % sizeof(struct input_event)) != 0) {
-                    LOGE("could not get event (wrong size: %d)", readSize);
+                    ALOGE("could not get event (wrong size: %d)", readSize);
                 } else {
                     int32_t deviceId = device->id == mBuiltInKeyboardId ? 0 : device->id;
 
                     size_t count = size_t(readSize) / sizeof(struct input_event);
                     for (size_t i = 0; i < count; i++) {
                         const struct input_event& iev = readBuffer[i];
-                        LOGV("%s got: t0=%d, t1=%d, type=%d, code=%d, value=%d",
+                        ALOGV("%s got: t0=%d, t1=%d, type=%d, code=%d, value=%d",
                                 device->path.string(),
                                 (int) iev.time.tv_sec, (int) iev.time.tv_usec,
                                 iev.type, iev.code, iev.value);
@@ -683,7 +683,7 @@
                         // system call that also queries ktime_get_ts().
                         event->when = nsecs_t(iev.time.tv_sec) * 1000000000LL
                                 + nsecs_t(iev.time.tv_usec) * 1000LL;
-                        LOGV("event time %lld, now %lld", event->when, now);
+                        ALOGV("event time %lld, now %lld", event->when, now);
 #else
                         event->when = now;
 #endif
@@ -696,7 +696,7 @@
                         if (iev.type == EV_KEY && device->keyMap.haveKeyLayout()) {
                             status_t err = device->keyMap.keyLayoutMap->mapKey(iev.code,
                                         &event->keyCode, &event->flags);
-                            LOGV("iev.code=%d keyCode=%d flags=0x%08x err=%d\n",
+                            ALOGV("iev.code=%d keyCode=%d flags=0x%08x err=%d\n",
                                     iev.code, event->keyCode, event->flags, err);
                         }
                         event += 1;
@@ -710,7 +710,7 @@
                     }
                 }
             } else {
-                LOGW("Received unexpected epoll event 0x%08x for device %s.",
+                ALOGW("Received unexpected epoll event 0x%08x for device %s.",
                         eventItem.events, device->identifier.name.string());
             }
         }
@@ -768,7 +768,7 @@
             // Sleep after errors to avoid locking up the system.
             // Hopefully the error is transient.
             if (errno != EINTR) {
-                LOGW("poll failed (errno=%d)\n", errno);
+                ALOGW("poll failed (errno=%d)\n", errno);
                 usleep(100000);
             }
         } else {
@@ -795,7 +795,7 @@
 }
 
 void EventHub::wake() {
-    LOGV("wake() called");
+    ALOGV("wake() called");
 
     ssize_t nWrite;
     do {
@@ -803,14 +803,14 @@
     } while (nWrite == -1 && errno == EINTR);
 
     if (nWrite != 1 && errno != EAGAIN) {
-        LOGW("Could not write wake signal, errno=%d", errno);
+        ALOGW("Could not write wake signal, errno=%d", errno);
     }
 }
 
 void EventHub::scanDevicesLocked() {
     status_t res = scanDirLocked(DEVICE_PATH);
     if(res < 0) {
-        LOGE("scan dir failed for %s\n", DEVICE_PATH);
+        ALOGE("scan dir failed for %s\n", DEVICE_PATH);
     }
 }
 
@@ -843,11 +843,11 @@
 status_t EventHub::openDeviceLocked(const char *devicePath) {
     char buffer[80];
 
-    LOGV("Opening device: %s", devicePath);
+    ALOGV("Opening device: %s", devicePath);
 
     int fd = open(devicePath, O_RDWR);
     if(fd < 0) {
-        LOGE("could not open %s, %s\n", devicePath, strerror(errno));
+        ALOGE("could not open %s, %s\n", devicePath, strerror(errno));
         return -1;
     }
 
@@ -865,7 +865,7 @@
     for (size_t i = 0; i < mExcludedDevices.size(); i++) {
         const String8& item = mExcludedDevices.itemAt(i);
         if (identifier.name == item) {
-            LOGI("ignoring event id %s driver %s\n", devicePath, item.string());
+            ALOGI("ignoring event id %s driver %s\n", devicePath, item.string());
             close(fd);
             return -1;
         }
@@ -874,7 +874,7 @@
     // Get device driver version.
     int driverVersion;
     if(ioctl(fd, EVIOCGVERSION, &driverVersion)) {
-        LOGE("could not get driver version for %s, %s\n", devicePath, strerror(errno));
+        ALOGE("could not get driver version for %s, %s\n", devicePath, strerror(errno));
         close(fd);
         return -1;
     }
@@ -882,7 +882,7 @@
     // Get device identifier.
     struct input_id inputId;
     if(ioctl(fd, EVIOCGID, &inputId)) {
-        LOGE("could not get device input id for %s, %s\n", devicePath, strerror(errno));
+        ALOGE("could not get device input id for %s, %s\n", devicePath, strerror(errno));
         close(fd);
         return -1;
     }
@@ -909,7 +909,7 @@
 
     // Make file descriptor non-blocking for use with poll().
     if (fcntl(fd, F_SETFL, O_NONBLOCK)) {
-        LOGE("Error %d making device file descriptor non-blocking.", errno);
+        ALOGE("Error %d making device file descriptor non-blocking.", errno);
         close(fd);
         return -1;
     }
@@ -919,16 +919,16 @@
     Device* device = new Device(fd, deviceId, String8(devicePath), identifier);
 
 #if 0
-    LOGI("add device %d: %s\n", deviceId, devicePath);
-    LOGI("  bus:       %04x\n"
+    ALOGI("add device %d: %s\n", deviceId, devicePath);
+    ALOGI("  bus:       %04x\n"
          "  vendor     %04x\n"
          "  product    %04x\n"
          "  version    %04x\n",
         identifier.bus, identifier.vendor, identifier.product, identifier.version);
-    LOGI("  name:      \"%s\"\n", identifier.name.string());
-    LOGI("  location:  \"%s\"\n", identifier.location.string());
-    LOGI("  unique id: \"%s\"\n", identifier.uniqueId.string());
-    LOGI("  driver:    v%d.%d.%d\n",
+    ALOGI("  name:      \"%s\"\n", identifier.name.string());
+    ALOGI("  location:  \"%s\"\n", identifier.location.string());
+    ALOGI("  unique id: \"%s\"\n", identifier.uniqueId.string());
+    ALOGI("  driver:    v%d.%d.%d\n",
         driverVersion >> 16, (driverVersion >> 8) & 0xff, driverVersion & 0xff);
 #endif
 
@@ -1055,7 +1055,7 @@
 
     // If the device isn't recognized as something we handle, don't monitor it.
     if (device->classes == 0) {
-        LOGV("Dropping device: id=%d, path='%s', name='%s'",
+        ALOGV("Dropping device: id=%d, path='%s', name='%s'",
                 deviceId, devicePath, device->identifier.name.string());
         delete device;
         return -1;
@@ -1072,12 +1072,12 @@
     eventItem.events = EPOLLIN;
     eventItem.data.u32 = deviceId;
     if (epoll_ctl(mEpollFd, EPOLL_CTL_ADD, fd, &eventItem)) {
-        LOGE("Could not add device fd to epoll instance.  errno=%d", errno);
+        ALOGE("Could not add device fd to epoll instance.  errno=%d", errno);
         delete device;
         return -1;
     }
 
-    LOGI("New device: id=%d, fd=%d, path='%s', name='%s', classes=0x%x, "
+    ALOGI("New device: id=%d, fd=%d, path='%s', name='%s', classes=0x%x, "
             "configuration='%s', keyLayout='%s', keyCharacterMap='%s', builtinKeyboard=%s",
          deviceId, fd, devicePath, device->identifier.name.string(),
          device->classes,
@@ -1097,13 +1097,13 @@
     device->configurationFile = getInputDeviceConfigurationFilePathByDeviceIdentifier(
             device->identifier, INPUT_DEVICE_CONFIGURATION_FILE_TYPE_CONFIGURATION);
     if (device->configurationFile.isEmpty()) {
-        LOGD("No input device configuration file found for device '%s'.",
+        ALOGD("No input device configuration file found for device '%s'.",
                 device->identifier.name.string());
     } else {
         status_t status = PropertyMap::load(device->configurationFile,
                 &device->configuration);
         if (status) {
-            LOGE("Error loading input device configuration file for device '%s'.  "
+            ALOGE("Error loading input device configuration file for device '%s'.  "
                     "Using default configuration.",
                     device->identifier.name.string());
         }
@@ -1159,7 +1159,7 @@
         closeDeviceLocked(device);
         return 0;
     }
-    LOGV("Remove device: %s not found, device may already have been removed.", devicePath);
+    ALOGV("Remove device: %s not found, device may already have been removed.", devicePath);
     return -1;
 }
 
@@ -1170,18 +1170,18 @@
 }
 
 void EventHub::closeDeviceLocked(Device* device) {
-    LOGI("Removed device: path=%s name=%s id=%d fd=%d classes=0x%x\n",
+    ALOGI("Removed device: path=%s name=%s id=%d fd=%d classes=0x%x\n",
          device->path.string(), device->identifier.name.string(), device->id,
          device->fd, device->classes);
 
     if (device->id == mBuiltInKeyboardId) {
-        LOGW("built-in keyboard device %s (id=%d) is closing! the apps will not like this",
+        ALOGW("built-in keyboard device %s (id=%d) is closing! the apps will not like this",
                 device->path.string(), mBuiltInKeyboardId);
         mBuiltInKeyboardId = -1;
     }
 
     if (epoll_ctl(mEpollFd, EPOLL_CTL_DEL, device->fd, NULL)) {
-        LOGW("Could not remove device fd from epoll instance.  errno=%d", errno);
+        ALOGW("Could not remove device fd from epoll instance.  errno=%d", errno);
     }
 
     mDevices.removeItem(device->id);
@@ -1202,7 +1202,7 @@
         // Unlink the device from the opening devices list then delete it.
         // We don't need to tell the client that the device was closed because
         // it does not even know it was opened in the first place.
-        LOGI("Device %s was immediately closed after opening.", device->path.string());
+        ALOGI("Device %s was immediately closed after opening.", device->path.string());
         if (pred) {
             pred->next = device->next;
         } else {
@@ -1226,12 +1226,12 @@
     int event_pos = 0;
     struct inotify_event *event;
 
-    LOGV("EventHub::readNotify nfd: %d\n", mINotifyFd);
+    ALOGV("EventHub::readNotify nfd: %d\n", mINotifyFd);
     res = read(mINotifyFd, event_buf, sizeof(event_buf));
     if(res < (int)sizeof(*event)) {
         if(errno == EINTR)
             return 0;
-        LOGW("could not get event, %s\n", strerror(errno));
+        ALOGW("could not get event, %s\n", strerror(errno));
         return -1;
     }
     //printf("got %d bytes of event information\n", res);
@@ -1248,7 +1248,7 @@
             if(event->mask & IN_CREATE) {
                 openDeviceLocked(devname);
             } else {
-                LOGI("Removing device '%s' due to inotify event\n", devname);
+                ALOGI("Removing device '%s' due to inotify event\n", devname);
                 closeDeviceByPathLocked(devname);
             }
         }
@@ -1284,7 +1284,7 @@
 }
 
 void EventHub::requestReopenDevices() {
-    LOGV("requestReopenDevices() called");
+    ALOGV("requestReopenDevices() called");
 
     AutoMutex _l(mLock);
     mNeedToReopenDevices = true;
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp
index 7303392..0bef0db 100644
--- a/services/input/InputDispatcher.cpp
+++ b/services/input/InputDispatcher.cpp
@@ -121,7 +121,7 @@
 
 static bool validateKeyEvent(int32_t action) {
     if (! isValidKeyAction(action)) {
-        LOGE("Key event has invalid action code 0x%x", action);
+        ALOGE("Key event has invalid action code 0x%x", action);
         return false;
     }
     return true;
@@ -152,11 +152,11 @@
 static bool validateMotionEvent(int32_t action, size_t pointerCount,
         const PointerProperties* pointerProperties) {
     if (! isValidMotionAction(action, pointerCount)) {
-        LOGE("Motion event has invalid action code 0x%x", action);
+        ALOGE("Motion event has invalid action code 0x%x", action);
         return false;
     }
     if (pointerCount < 1 || pointerCount > MAX_POINTERS) {
-        LOGE("Motion event has invalid pointer count %d; value must be between 1 and %d.",
+        ALOGE("Motion event has invalid pointer count %d; value must be between 1 and %d.",
                 pointerCount, MAX_POINTERS);
         return false;
     }
@@ -164,12 +164,12 @@
     for (size_t i = 0; i < pointerCount; i++) {
         int32_t id = pointerProperties[i].id;
         if (id < 0 || id > MAX_POINTER_ID) {
-            LOGE("Motion event has invalid pointer id %d; value must be between 0 and %d",
+            ALOGE("Motion event has invalid pointer id %d; value must be between 0 and %d",
                     id, MAX_POINTER_ID);
             return false;
         }
         if (pointerIdBits.hasBit(id)) {
-            LOGE("Motion event has duplicate pointer id %d", id);
+            ALOGE("Motion event has duplicate pointer id %d", id);
             return false;
         }
         pointerIdBits.markBit(id);
@@ -224,7 +224,7 @@
 
 #if DEBUG_THROTTLING
     mThrottleState.originalSampleCount = 0;
-    LOGD("Throttling - Max events per second = %d", mConfig.maxEventsPerSecond);
+    ALOGD("Throttling - Max events per second = %d", mConfig.maxEventsPerSecond);
 #endif
 }
 
@@ -272,7 +272,7 @@
     // If dispatching is frozen, do not process timeouts or try to deliver any new events.
     if (mDispatchFrozen) {
 #if DEBUG_FOCUS
-        LOGD("Dispatch frozen.  Waiting some more.");
+        ALOGD("Dispatch frozen.  Waiting some more.");
 #endif
         return;
     }
@@ -342,7 +342,7 @@
                     if (currentTime < nextTime) {
                         // Throttle it!
 #if DEBUG_THROTTLING
-                        LOGD("Throttling - Delaying motion event for "
+                        ALOGD("Throttling - Delaying motion event for "
                                 "device %d, source 0x%08x by up to %0.3fms.",
                                 deviceId, source, (nextTime - currentTime) * 0.000001);
 #endif
@@ -360,7 +360,7 @@
 #if DEBUG_THROTTLING
                 if (mThrottleState.originalSampleCount != 0) {
                     uint32_t count = motionEntry->countSamples();
-                    LOGD("Throttling - Motion event sample count grew by %d from %d to %d.",
+                    ALOGD("Throttling - Motion event sample count grew by %d from %d to %d.",
                             count - mThrottleState.originalSampleCount,
                             mThrottleState.originalSampleCount, count);
                     mThrottleState.originalSampleCount = 0;
@@ -384,7 +384,7 @@
 
     // Now we have an event to dispatch.
     // All events are eventually dequeued and processed this way, even if we intend to drop them.
-    LOG_ASSERT(mPendingEvent != NULL);
+    ALOG_ASSERT(mPendingEvent != NULL);
     bool done = false;
     DropReason dropReason = DROP_REASON_NOT_DROPPED;
     if (!(mPendingEvent->policyFlags & POLICY_FLAG_PASS_TO_USER)) {
@@ -453,7 +453,7 @@
     }
 
     default:
-        LOG_ASSERT(false);
+        ALOG_ASSERT(false);
         break;
     }
 
@@ -469,7 +469,7 @@
 
 void InputDispatcher::dispatchIdleLocked() {
 #if DEBUG_FOCUS
-    LOGD("Dispatcher idle.  There are no pending events or active connections.");
+    ALOGD("Dispatcher idle.  There are no pending events or active connections.");
 #endif
 
     // Reset targets when idle, to release input channels and other resources
@@ -493,7 +493,7 @@
             } else if (keyEntry->action == AKEY_EVENT_ACTION_UP) {
                 if (mAppSwitchSawKeyDown) {
 #if DEBUG_APP_SWITCH
-                    LOGD("App switch is pending!");
+                    ALOGD("App switch is pending!");
 #endif
                     mAppSwitchDueTime = keyEntry->eventTime + APP_SWITCH_TIMEOUT;
                     mAppSwitchSawKeyDown = false;
@@ -567,30 +567,30 @@
     switch (dropReason) {
     case DROP_REASON_POLICY:
 #if DEBUG_INBOUND_EVENT_DETAILS
-        LOGD("Dropped event because policy consumed it.");
+        ALOGD("Dropped event because policy consumed it.");
 #endif
         reason = "inbound event was dropped because the policy consumed it";
         break;
     case DROP_REASON_DISABLED:
-        LOGI("Dropped event because input dispatch is disabled.");
+        ALOGI("Dropped event because input dispatch is disabled.");
         reason = "inbound event was dropped because input dispatch is disabled";
         break;
     case DROP_REASON_APP_SWITCH:
-        LOGI("Dropped event because of pending overdue app switch.");
+        ALOGI("Dropped event because of pending overdue app switch.");
         reason = "inbound event was dropped because of pending overdue app switch";
         break;
     case DROP_REASON_BLOCKED:
-        LOGI("Dropped event because the current application is not responding and the user "
+        ALOGI("Dropped event because the current application is not responding and the user "
                 "has started interacting with a different application.");
         reason = "inbound event was dropped because the current application is not responding "
                 "and the user has started interacting with a different application";
         break;
     case DROP_REASON_STALE:
-        LOGI("Dropped event because it is stale.");
+        ALOGI("Dropped event because it is stale.");
         reason = "inbound event was dropped because it is stale";
         break;
     default:
-        LOG_ASSERT(false);
+        ALOG_ASSERT(false);
         return;
     }
 
@@ -634,9 +634,9 @@
 
 #if DEBUG_APP_SWITCH
     if (handled) {
-        LOGD("App switch has arrived.");
+        ALOGD("App switch has arrived.");
     } else {
-        LOGD("App switch was abandoned.");
+        ALOGD("App switch was abandoned.");
     }
 #endif
 }
@@ -686,7 +686,7 @@
     InjectionState* injectionState = entry->injectionState;
     if (injectionState && injectionState->injectionResult == INPUT_EVENT_INJECTION_PENDING) {
 #if DEBUG_DISPATCH_CYCLE
-        LOGD("Injected inbound event was dropped.");
+        ALOGD("Injected inbound event was dropped.");
 #endif
         setInjectionResultLocked(entry, INPUT_EVENT_INJECTION_FAILED);
     }
@@ -738,7 +738,7 @@
 bool InputDispatcher::dispatchConfigurationChangedLocked(
         nsecs_t currentTime, ConfigurationChangedEntry* entry) {
 #if DEBUG_OUTBOUND_EVENT_DETAILS
-    LOGD("dispatchConfigurationChanged - eventTime=%lld", entry->eventTime);
+    ALOGD("dispatchConfigurationChanged - eventTime=%lld", entry->eventTime);
 #endif
 
     // Reset key repeating in case a keyboard device was added or removed or something.
@@ -754,7 +754,7 @@
 bool InputDispatcher::dispatchDeviceResetLocked(
         nsecs_t currentTime, DeviceResetEntry* entry) {
 #if DEBUG_OUTBOUND_EVENT_DETAILS
-    LOGD("dispatchDeviceReset - eventTime=%lld, deviceId=%d", entry->eventTime, entry->deviceId);
+    ALOGD("dispatchDeviceReset - eventTime=%lld, deviceId=%d", entry->eventTime, entry->deviceId);
 #endif
 
     CancelationOptions options(CancelationOptions::CANCEL_ALL_EVENTS,
@@ -868,7 +868,7 @@
 
 void InputDispatcher::logOutboundKeyDetailsLocked(const char* prefix, const KeyEntry* entry) {
 #if DEBUG_OUTBOUND_EVENT_DETAILS
-    LOGD("%seventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, "
+    ALOGD("%seventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, "
             "action=0x%x, flags=0x%x, keyCode=0x%x, scanCode=0x%x, metaState=0x%x, "
             "repeatCount=%d, downTime=%lld",
             prefix,
@@ -952,7 +952,7 @@
             }
 
 #if DEBUG_BATCHING
-            LOGD("Split batch of %d samples into two parts, first part has %d samples, "
+            ALOGD("Split batch of %d samples into two parts, first part has %d samples, "
                     "second part has %d samples.", originalSampleCount,
                     entry->countSamples(), nextEntry->countSamples());
 #endif
@@ -974,7 +974,7 @@
 
 void InputDispatcher::logOutboundMotionDetailsLocked(const char* prefix, const MotionEntry* entry) {
 #if DEBUG_OUTBOUND_EVENT_DETAILS
-    LOGD("%seventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, "
+    ALOGD("%seventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, "
             "action=0x%x, flags=0x%x, "
             "metaState=0x%x, buttonState=0x%x, "
             "edgeFlags=0x%x, xPrecision=%f, yPrecision=%f, downTime=%lld",
@@ -992,7 +992,7 @@
         sampleCount += 1;
     }
     for (uint32_t i = 0; i < entry->pointerCount; i++) {
-        LOGD("  Pointer %d: id=%d, toolType=%d, "
+        ALOGD("  Pointer %d: id=%d, toolType=%d, "
                 "x=%f, y=%f, pressure=%f, size=%f, "
                 "touchMajor=%f, touchMinor=%f, toolMajor=%f, toolMinor=%f, "
                 "orientation=%f",
@@ -1012,7 +1012,7 @@
     // Keep in mind that due to batching, it is possible for the number of samples actually
     // dispatched to change before the application finally consumed them.
     if (entry->action == AMOTION_EVENT_ACTION_MOVE) {
-        LOGD("  ... Total movement samples currently batched %d ...", sampleCount);
+        ALOGD("  ... Total movement samples currently batched %d ...", sampleCount);
     }
 #endif
 }
@@ -1020,12 +1020,12 @@
 void InputDispatcher::dispatchEventToCurrentInputTargetsLocked(nsecs_t currentTime,
         EventEntry* eventEntry, bool resumeWithAppendedMotionSample) {
 #if DEBUG_DISPATCH_CYCLE
-    LOGD("dispatchEventToCurrentInputTargets - "
+    ALOGD("dispatchEventToCurrentInputTargets - "
             "resumeWithAppendedMotionSample=%s",
             toString(resumeWithAppendedMotionSample));
 #endif
 
-    LOG_ASSERT(eventEntry->dispatchInProgress); // should already have been set to true
+    ALOG_ASSERT(eventEntry->dispatchInProgress); // should already have been set to true
 
     pokeUserActivityLocked(eventEntry);
 
@@ -1039,7 +1039,7 @@
                     resumeWithAppendedMotionSample);
         } else {
 #if DEBUG_FOCUS
-            LOGD("Dropping event delivery to target with channel '%s' because it "
+            ALOGD("Dropping event delivery to target with channel '%s' because it "
                     "is no longer registered with the input dispatcher.",
                     inputTarget.inputChannel->getName().string());
 #endif
@@ -1065,7 +1065,7 @@
     if (applicationHandle == NULL && windowHandle == NULL) {
         if (mInputTargetWaitCause != INPUT_TARGET_WAIT_CAUSE_SYSTEM_NOT_READY) {
 #if DEBUG_FOCUS
-            LOGD("Waiting for system to become ready for input.");
+            ALOGD("Waiting for system to become ready for input.");
 #endif
             mInputTargetWaitCause = INPUT_TARGET_WAIT_CAUSE_SYSTEM_NOT_READY;
             mInputTargetWaitStartTime = currentTime;
@@ -1076,7 +1076,7 @@
     } else {
         if (mInputTargetWaitCause != INPUT_TARGET_WAIT_CAUSE_APPLICATION_NOT_READY) {
 #if DEBUG_FOCUS
-            LOGD("Waiting for application to become ready for input: %s",
+            ALOGD("Waiting for application to become ready for input: %s",
                     getApplicationWindowLabelLocked(applicationHandle, windowHandle).string());
 #endif
             nsecs_t timeout;
@@ -1162,7 +1162,7 @@
 
 void InputDispatcher::resetANRTimeoutsLocked() {
 #if DEBUG_FOCUS
-        LOGD("Resetting ANR timeouts.");
+        ALOGD("Resetting ANR timeouts.");
 #endif
 
     // Reset input target wait timeout.
@@ -1181,7 +1181,7 @@
     if (mFocusedWindowHandle == NULL) {
         if (mFocusedApplicationHandle != NULL) {
 #if DEBUG_FOCUS
-            LOGD("Waiting because there is no focused window but there is a "
+            ALOGD("Waiting because there is no focused window but there is a "
                     "focused application that may eventually add a window: %s.",
                     getApplicationWindowLabelLocked(mFocusedApplicationHandle, NULL).string());
 #endif
@@ -1190,7 +1190,7 @@
             goto Unresponsive;
         }
 
-        LOGI("Dropping event because there is no focused window or focused application.");
+        ALOGI("Dropping event because there is no focused window or focused application.");
         injectionResult = INPUT_EVENT_INJECTION_FAILED;
         goto Failed;
     }
@@ -1204,7 +1204,7 @@
     // If the currently focused window is paused then keep waiting.
     if (mFocusedWindowHandle->getInfo()->paused) {
 #if DEBUG_FOCUS
-        LOGD("Waiting because focused window is paused.");
+        ALOGD("Waiting because focused window is paused.");
 #endif
         injectionResult = handleTargetsNotReadyLocked(currentTime, entry,
                 mFocusedApplicationHandle, mFocusedWindowHandle, nextWakeupTime);
@@ -1214,7 +1214,7 @@
     // If the currently focused window is still working on previous events then keep waiting.
     if (! isWindowFinishedWithPreviousInputLocked(mFocusedWindowHandle)) {
 #if DEBUG_FOCUS
-        LOGD("Waiting because focused window still processing previous input.");
+        ALOGD("Waiting because focused window still processing previous input.");
 #endif
         injectionResult = handleTargetsNotReadyLocked(currentTime, entry,
                 mFocusedApplicationHandle, mFocusedWindowHandle, nextWakeupTime);
@@ -1233,7 +1233,7 @@
     updateDispatchStatisticsLocked(currentTime, entry,
             injectionResult, timeSpentWaitingForApplication);
 #if DEBUG_FOCUS
-    LOGD("findFocusedWindow finished: injectionResult=%d, "
+    ALOGD("findFocusedWindow finished: injectionResult=%d, "
             "timeSpendWaitingForApplication=%0.1fms",
             injectionResult, timeSpentWaitingForApplication / 1000000.0);
 #endif
@@ -1302,7 +1302,7 @@
         bool down = maskedAction == AMOTION_EVENT_ACTION_DOWN;
         if (switchedDevice && mTouchState.down && !down) {
 #if DEBUG_FOCUS
-            LOGD("Dropping event because a pointer for a different device is already down.");
+            ALOGD("Dropping event because a pointer for a different device is already down.");
 #endif
             mTempTouchState.copyFrom(mTouchState);
             injectionResult = INPUT_EVENT_INJECTION_FAILED;
@@ -1376,7 +1376,7 @@
         // fact be in ANR state.
         if (topErrorWindowHandle != NULL && newTouchedWindowHandle != topErrorWindowHandle) {
 #if DEBUG_FOCUS
-            LOGD("Waiting because system error window is pending.");
+            ALOGD("Waiting because system error window is pending.");
 #endif
             injectionResult = handleTargetsNotReadyLocked(currentTime, entry,
                     NULL, NULL, nextWakeupTime);
@@ -1400,7 +1400,7 @@
         if (newTouchedWindowHandle == NULL) {
             if (mFocusedApplicationHandle != NULL) {
 #if DEBUG_FOCUS
-                LOGD("Waiting because there is no touched window but there is a "
+                ALOGD("Waiting because there is no touched window but there is a "
                         "focused application that may eventually add a new window: %s.",
                         getApplicationWindowLabelLocked(mFocusedApplicationHandle, NULL).string());
 #endif
@@ -1409,7 +1409,7 @@
                 goto Unresponsive;
             }
 
-            LOGI("Dropping event because there is no touched window or focused application.");
+            ALOGI("Dropping event because there is no touched window or focused application.");
             injectionResult = INPUT_EVENT_INJECTION_FAILED;
             goto Failed;
         }
@@ -1458,7 +1458,7 @@
         // If the pointer is not currently down, then ignore the event.
         if (! mTempTouchState.down) {
 #if DEBUG_FOCUS
-            LOGD("Dropping event because the pointer is not down or we previously "
+            ALOGD("Dropping event because the pointer is not down or we previously "
                     "dropped the pointer down event.");
 #endif
             injectionResult = INPUT_EVENT_INJECTION_FAILED;
@@ -1479,7 +1479,7 @@
             if (oldTouchedWindowHandle != newTouchedWindowHandle
                     && newTouchedWindowHandle != NULL) {
 #if DEBUG_FOCUS
-                LOGD("Touch is slipping out of window %s into window %s.",
+                ALOGD("Touch is slipping out of window %s into window %s.",
                         oldTouchedWindowHandle->getName().string(),
                         newTouchedWindowHandle->getName().string());
 #endif
@@ -1520,7 +1520,7 @@
         // Let the previous window know that the hover sequence is over.
         if (mLastHoverWindowHandle != NULL) {
 #if DEBUG_HOVER
-            LOGD("Sending hover exit event to window %s.",
+            ALOGD("Sending hover exit event to window %s.",
                     mLastHoverWindowHandle->getName().string());
 #endif
             mTempTouchState.addOrUpdateWindow(mLastHoverWindowHandle,
@@ -1530,7 +1530,7 @@
         // Let the new window know that the hover sequence is starting.
         if (newHoverWindowHandle != NULL) {
 #if DEBUG_HOVER
-            LOGD("Sending hover enter event to window %s.",
+            ALOGD("Sending hover enter event to window %s.",
                     newHoverWindowHandle->getName().string());
 #endif
             mTempTouchState.addOrUpdateWindow(newHoverWindowHandle,
@@ -1556,7 +1556,7 @@
         }
         if (! haveForegroundWindow) {
 #if DEBUG_FOCUS
-            LOGD("Dropping event because there is no touched foreground window to receive it.");
+            ALOGD("Dropping event because there is no touched foreground window to receive it.");
 #endif
             injectionResult = INPUT_EVENT_INJECTION_FAILED;
             goto Failed;
@@ -1591,7 +1591,7 @@
             // If the touched window is paused then keep waiting.
             if (touchedWindow.windowHandle->getInfo()->paused) {
 #if DEBUG_FOCUS
-                LOGD("Waiting because touched window is paused.");
+                ALOGD("Waiting because touched window is paused.");
 #endif
                 injectionResult = handleTargetsNotReadyLocked(currentTime, entry,
                         NULL, touchedWindow.windowHandle, nextWakeupTime);
@@ -1601,7 +1601,7 @@
             // If the touched window is still working on previous events then keep waiting.
             if (! isWindowFinishedWithPreviousInputLocked(touchedWindow.windowHandle)) {
 #if DEBUG_FOCUS
-                LOGD("Waiting because touched window still processing previous input.");
+                ALOGD("Waiting because touched window still processing previous input.");
 #endif
                 injectionResult = handleTargetsNotReadyLocked(currentTime, entry,
                         NULL, touchedWindow.windowHandle, nextWakeupTime);
@@ -1661,7 +1661,7 @@
         if (!wrongDevice) {
             if (switchedDevice) {
 #if DEBUG_FOCUS
-                LOGD("Conflicting pointer actions: Switched to a different device.");
+                ALOGD("Conflicting pointer actions: Switched to a different device.");
 #endif
                 *outConflictingPointerActions = true;
             }
@@ -1670,7 +1670,7 @@
                 // Started hovering, therefore no longer down.
                 if (mTouchState.down) {
 #if DEBUG_FOCUS
-                    LOGD("Conflicting pointer actions: Hover received while pointer was down.");
+                    ALOGD("Conflicting pointer actions: Hover received while pointer was down.");
 #endif
                     *outConflictingPointerActions = true;
                 }
@@ -1688,7 +1688,7 @@
                 // First pointer went down.
                 if (mTouchState.down) {
 #if DEBUG_FOCUS
-                    LOGD("Conflicting pointer actions: Down received while already down.");
+                    ALOGD("Conflicting pointer actions: Down received while already down.");
 #endif
                     *outConflictingPointerActions = true;
                 }
@@ -1724,7 +1724,7 @@
         }
     } else {
 #if DEBUG_FOCUS
-        LOGD("Not updating touch focus because injection was denied.");
+        ALOGD("Not updating touch focus because injection was denied.");
 #endif
     }
 
@@ -1736,7 +1736,7 @@
     updateDispatchStatisticsLocked(currentTime, entry,
             injectionResult, timeSpentWaitingForApplication);
 #if DEBUG_FOCUS
-    LOGD("findTouchedWindow finished: injectionResult=%d, injectionPermission=%d, "
+    ALOGD("findTouchedWindow finished: injectionResult=%d, injectionPermission=%d, "
             "timeSpentWaitingForApplication=%0.1fms",
             injectionResult, injectionPermission, timeSpentWaitingForApplication / 1000000.0);
 #endif
@@ -1778,13 +1778,13 @@
                     || windowHandle->getInfo()->ownerUid != injectionState->injectorUid)
             && !hasInjectionPermission(injectionState->injectorPid, injectionState->injectorUid)) {
         if (windowHandle != NULL) {
-            LOGW("Permission denied: injecting event from pid %d uid %d to window %s "
+            ALOGW("Permission denied: injecting event from pid %d uid %d to window %s "
                     "owned by uid %d",
                     injectionState->injectorPid, injectionState->injectorUid,
                     windowHandle->getName().string(),
                     windowHandle->getInfo()->ownerUid);
         } else {
-            LOGW("Permission denied: injecting event from pid %d uid %d",
+            ALOGW("Permission denied: injecting event from pid %d uid %d",
                     injectionState->injectorPid, injectionState->injectorUid);
         }
         return false;
@@ -1874,7 +1874,7 @@
         const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget,
         bool resumeWithAppendedMotionSample) {
 #if DEBUG_DISPATCH_CYCLE
-    LOGD("channel '%s' ~ prepareDispatchCycle - flags=0x%08x, "
+    ALOGD("channel '%s' ~ prepareDispatchCycle - flags=0x%08x, "
             "xOffset=%f, yOffset=%f, scaleFactor=%f, "
             "pointerIds=0x%x, "
             "resumeWithAppendedMotionSample=%s",
@@ -1886,13 +1886,13 @@
 
     // Make sure we are never called for streaming when splitting across multiple windows.
     bool isSplit = inputTarget->flags & InputTarget::FLAG_SPLIT;
-    LOG_ASSERT(! (resumeWithAppendedMotionSample && isSplit));
+    ALOG_ASSERT(! (resumeWithAppendedMotionSample && isSplit));
 
     // Skip this event if the connection status is not normal.
     // We don't want to enqueue additional outbound events if the connection is broken.
     if (connection->status != Connection::STATUS_NORMAL) {
 #if DEBUG_DISPATCH_CYCLE
-        LOGD("channel '%s' ~ Dropping event because the channel status is %s",
+        ALOGD("channel '%s' ~ Dropping event because the channel status is %s",
                 connection->getInputChannelName(), connection->getStatusLabel());
 #endif
         return;
@@ -1900,7 +1900,7 @@
 
     // Split a motion event if needed.
     if (isSplit) {
-        LOG_ASSERT(eventEntry->type == EventEntry::TYPE_MOTION);
+        ALOG_ASSERT(eventEntry->type == EventEntry::TYPE_MOTION);
 
         MotionEntry* originalMotionEntry = static_cast<MotionEntry*>(eventEntry);
         if (inputTarget->pointerIds.count() != originalMotionEntry->pointerCount) {
@@ -1910,7 +1910,7 @@
                 return; // split event was dropped
             }
 #if DEBUG_FOCUS
-            LOGD("channel '%s' ~ Split motion event.",
+            ALOGD("channel '%s' ~ Split motion event.",
                     connection->getInputChannelName());
             logOutboundMotionDetailsLocked("  ", splitMotionEntry);
 #endif
@@ -1944,7 +1944,7 @@
             // be dispatched later.
             if (! motionEventDispatchEntry->inProgress) {
 #if DEBUG_BATCHING
-                LOGD("channel '%s' ~ Not streaming because the motion event has "
+                ALOGD("channel '%s' ~ Not streaming because the motion event has "
                         "not yet been dispatched.  "
                         "(Waiting for earlier events to be consumed.)",
                         connection->getInputChannelName());
@@ -1959,7 +1959,7 @@
             // appended motion sample.
             if (motionEventDispatchEntry->tailMotionSample) {
 #if DEBUG_BATCHING
-                LOGD("channel '%s' ~ Not streaming because no new samples can "
+                ALOGD("channel '%s' ~ Not streaming because no new samples can "
                         "be appended to the motion event in this dispatch cycle.  "
                         "(Waiting for next dispatch cycle to start.)",
                         connection->getInputChannelName());
@@ -1971,7 +1971,7 @@
             if ((motionEventDispatchEntry->targetFlags & InputTarget::FLAG_DISPATCH_MASK)
                     != InputTarget::FLAG_DISPATCH_AS_IS) {
 #if DEBUG_BATCHING
-                LOGD("channel '%s' ~ Not streaming because the motion event was not "
+                ALOGD("channel '%s' ~ Not streaming because the motion event was not "
                         "being dispatched as-is.  "
                         "(Waiting for next dispatch cycle to start.)",
                         connection->getInputChannelName());
@@ -1999,7 +1999,7 @@
             }
             if (status == OK) {
 #if DEBUG_BATCHING
-                LOGD("channel '%s' ~ Successfully streamed new motion sample.",
+                ALOGD("channel '%s' ~ Successfully streamed new motion sample.",
                         connection->getInputChannelName());
 #endif
                 return;
@@ -2007,17 +2007,17 @@
 
 #if DEBUG_BATCHING
             if (status == NO_MEMORY) {
-                LOGD("channel '%s' ~ Could not append motion sample to currently "
+                ALOGD("channel '%s' ~ Could not append motion sample to currently "
                         "dispatched move event because the shared memory buffer is full.  "
                         "(Waiting for next dispatch cycle to start.)",
                         connection->getInputChannelName());
             } else if (status == status_t(FAILED_TRANSACTION)) {
-                LOGD("channel '%s' ~ Could not append motion sample to currently "
+                ALOGD("channel '%s' ~ Could not append motion sample to currently "
                         "dispatched move event because the event has already been consumed.  "
                         "(Waiting for next dispatch cycle to start.)",
                         connection->getInputChannelName());
             } else {
-                LOGD("channel '%s' ~ Could not append motion sample to currently "
+                ALOGD("channel '%s' ~ Could not append motion sample to currently "
                         "dispatched move event due to an error, status=%d.  "
                         "(Waiting for next dispatch cycle to start.)",
                         connection->getInputChannelName(), status);
@@ -2072,7 +2072,7 @@
     // to the list starting with the newly appended motion sample.
     if (resumeWithAppendedMotionSample) {
 #if DEBUG_BATCHING
-        LOGD("channel '%s' ~ Preparing a new dispatch cycle for additional motion samples "
+        ALOGD("channel '%s' ~ Preparing a new dispatch cycle for additional motion samples "
                 "that cannot be streamed because the motion event has already been consumed.",
                 connection->getInputChannelName());
 #endif
@@ -2090,7 +2090,7 @@
         if (!connection->inputState.trackKey(keyEntry,
                 dispatchEntry->resolvedAction, dispatchEntry->resolvedFlags)) {
 #if DEBUG_DISPATCH_CYCLE
-            LOGD("channel '%s' ~ enqueueDispatchEntryLocked: skipping inconsistent key event",
+            ALOGD("channel '%s' ~ enqueueDispatchEntryLocked: skipping inconsistent key event",
                     connection->getInputChannelName());
 #endif
             delete dispatchEntry;
@@ -2118,7 +2118,7 @@
                 && !connection->inputState.isHovering(
                         motionEntry->deviceId, motionEntry->source)) {
 #if DEBUG_DISPATCH_CYCLE
-        LOGD("channel '%s' ~ enqueueDispatchEntryLocked: filling in missing hover enter event",
+        ALOGD("channel '%s' ~ enqueueDispatchEntryLocked: filling in missing hover enter event",
                 connection->getInputChannelName());
 #endif
             dispatchEntry->resolvedAction = AMOTION_EVENT_ACTION_HOVER_ENTER;
@@ -2132,7 +2132,7 @@
         if (!connection->inputState.trackMotion(motionEntry,
                 dispatchEntry->resolvedAction, dispatchEntry->resolvedFlags)) {
 #if DEBUG_DISPATCH_CYCLE
-            LOGD("channel '%s' ~ enqueueDispatchEntryLocked: skipping inconsistent motion event",
+            ALOGD("channel '%s' ~ enqueueDispatchEntryLocked: skipping inconsistent motion event",
                     connection->getInputChannelName());
 #endif
             delete dispatchEntry;
@@ -2154,15 +2154,15 @@
 void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime,
         const sp<Connection>& connection) {
 #if DEBUG_DISPATCH_CYCLE
-    LOGD("channel '%s' ~ startDispatchCycle",
+    ALOGD("channel '%s' ~ startDispatchCycle",
             connection->getInputChannelName());
 #endif
 
-    LOG_ASSERT(connection->status == Connection::STATUS_NORMAL);
-    LOG_ASSERT(! connection->outboundQueue.isEmpty());
+    ALOG_ASSERT(connection->status == Connection::STATUS_NORMAL);
+    ALOG_ASSERT(! connection->outboundQueue.isEmpty());
 
     DispatchEntry* dispatchEntry = connection->outboundQueue.head;
-    LOG_ASSERT(! dispatchEntry->inProgress);
+    ALOG_ASSERT(! dispatchEntry->inProgress);
 
     // Mark the dispatch entry as in progress.
     dispatchEntry->inProgress = true;
@@ -2183,7 +2183,7 @@
                 keyEntry->eventTime);
 
         if (status) {
-            LOGE("channel '%s' ~ Could not publish key event, "
+            ALOGE("channel '%s' ~ Could not publish key event, "
                     "status=%d", connection->getInputChannelName(), status);
             abortBrokenDispatchCycleLocked(currentTime, connection, true /*notify*/);
             return;
@@ -2246,7 +2246,7 @@
                 usingCoords);
 
         if (status) {
-            LOGE("channel '%s' ~ Could not publish motion event, "
+            ALOGE("channel '%s' ~ Could not publish motion event, "
                     "status=%d", connection->getInputChannelName(), status);
             abortBrokenDispatchCycleLocked(currentTime, connection, true /*notify*/);
             return;
@@ -2271,14 +2271,14 @@
                         nextMotionSample->eventTime, usingCoords);
                 if (status == NO_MEMORY) {
 #if DEBUG_DISPATCH_CYCLE
-                    LOGD("channel '%s' ~ Shared memory buffer full.  Some motion samples will "
+                    ALOGD("channel '%s' ~ Shared memory buffer full.  Some motion samples will "
                             "be sent in the next dispatch cycle.",
                             connection->getInputChannelName());
 #endif
                     break;
                 }
                 if (status != OK) {
-                    LOGE("channel '%s' ~ Could not append motion sample "
+                    ALOGE("channel '%s' ~ Could not append motion sample "
                             "for a reason other than out of memory, status=%d",
                             connection->getInputChannelName(), status);
                     abortBrokenDispatchCycleLocked(currentTime, connection, true /*notify*/);
@@ -2294,14 +2294,14 @@
     }
 
     default: {
-        LOG_ASSERT(false);
+        ALOG_ASSERT(false);
     }
     }
 
     // Send the dispatch signal.
     status = connection->inputPublisher.sendDispatchSignal();
     if (status) {
-        LOGE("channel '%s' ~ Could not send dispatch signal, status=%d",
+        ALOGE("channel '%s' ~ Could not send dispatch signal, status=%d",
                 connection->getInputChannelName(), status);
         abortBrokenDispatchCycleLocked(currentTime, connection, true /*notify*/);
         return;
@@ -2318,7 +2318,7 @@
 void InputDispatcher::finishDispatchCycleLocked(nsecs_t currentTime,
         const sp<Connection>& connection, bool handled) {
 #if DEBUG_DISPATCH_CYCLE
-    LOGD("channel '%s' ~ finishDispatchCycle - %01.1fms since event, "
+    ALOGD("channel '%s' ~ finishDispatchCycle - %01.1fms since event, "
             "%01.1fms since dispatch, handled=%s",
             connection->getInputChannelName(),
             connection->getEventLatencyMillis(currentTime),
@@ -2336,7 +2336,7 @@
     // while waiting for the next dispatch cycle to begin.
     status_t status = connection->inputPublisher.reset();
     if (status) {
-        LOGE("channel '%s' ~ Could not reset publisher, status=%d",
+        ALOGE("channel '%s' ~ Could not reset publisher, status=%d",
                 connection->getInputChannelName(), status);
         abortBrokenDispatchCycleLocked(currentTime, connection, true /*notify*/);
         return;
@@ -2384,7 +2384,7 @@
 void InputDispatcher::abortBrokenDispatchCycleLocked(nsecs_t currentTime,
         const sp<Connection>& connection, bool notify) {
 #if DEBUG_DISPATCH_CYCLE
-    LOGD("channel '%s' ~ abortBrokenDispatchCycle - notify=%s",
+    ALOGD("channel '%s' ~ abortBrokenDispatchCycle - notify=%s",
             connection->getInputChannelName(), toString(notify));
 #endif
 
@@ -2423,7 +2423,7 @@
 
         ssize_t connectionIndex = d->mConnectionsByReceiveFd.indexOfKey(receiveFd);
         if (connectionIndex < 0) {
-            LOGE("Received spurious receive callback for unknown input channel.  "
+            ALOGE("Received spurious receive callback for unknown input channel.  "
                     "fd=%d, events=0x%x", receiveFd, events);
             return 0; // remove the callback
         }
@@ -2432,7 +2432,7 @@
         sp<Connection> connection = d->mConnectionsByReceiveFd.valueAt(connectionIndex);
         if (!(events & (ALOOPER_EVENT_ERROR | ALOOPER_EVENT_HANGUP))) {
             if (!(events & ALOOPER_EVENT_INPUT)) {
-                LOGW("channel '%s' ~ Received spurious callback for unhandled poll event.  "
+                ALOGW("channel '%s' ~ Received spurious callback for unhandled poll event.  "
                         "events=0x%x", connection->getInputChannelName(), events);
                 return 1;
             }
@@ -2446,7 +2446,7 @@
                 return 1;
             }
 
-            LOGE("channel '%s' ~ Failed to receive finished signal.  status=%d",
+            ALOGE("channel '%s' ~ Failed to receive finished signal.  status=%d",
                     connection->getInputChannelName(), status);
             notify = true;
         } else {
@@ -2455,7 +2455,7 @@
             // about them.
             notify = !connection->monitor;
             if (notify) {
-                LOGW("channel '%s' ~ Consumer closed input channel or an error occurred.  "
+                ALOGW("channel '%s' ~ Consumer closed input channel or an error occurred.  "
                         "events=0x%x", connection->getInputChannelName(), events);
             }
         }
@@ -2497,7 +2497,7 @@
 
     if (!mTempCancelationEvents.isEmpty()) {
 #if DEBUG_OUTBOUND_EVENT_DETAILS
-        LOGD("channel '%s' ~ Synthesized %d cancelation events to bring channel back in sync "
+        ALOGD("channel '%s' ~ Synthesized %d cancelation events to bring channel back in sync "
                 "with reality: %s, mode=%d.",
                 connection->getInputChannelName(), mTempCancelationEvents.size(),
                 options.reason, options.mode);
@@ -2544,7 +2544,7 @@
 
 InputDispatcher::MotionEntry*
 InputDispatcher::splitMotionEvent(const MotionEntry* originalMotionEntry, BitSet32 pointerIds) {
-    LOG_ASSERT(pointerIds.value != 0);
+    ALOG_ASSERT(pointerIds.value != 0);
 
     uint32_t splitPointerIndexMap[MAX_POINTERS];
     PointerProperties splitPointerProperties[MAX_POINTERS];
@@ -2573,7 +2573,7 @@
         // different pointer ids than we expected based on the previous ACTION_DOWN
         // or ACTION_POINTER_DOWN events that caused us to decide to split the pointers
         // in this way.
-        LOGW("Dropping split motion event because the pointer count is %d but "
+        ALOGW("Dropping split motion event because the pointer count is %d but "
                 "we expected there to be %d pointers.  This probably means we received "
                 "a broken sequence of pointer ids from the input device.",
                 splitPointerCount, pointerIds.count());
@@ -2645,7 +2645,7 @@
 
 void InputDispatcher::notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args) {
 #if DEBUG_INBOUND_EVENT_DETAILS
-    LOGD("notifyConfigurationChanged - eventTime=%lld", args->eventTime);
+    ALOGD("notifyConfigurationChanged - eventTime=%lld", args->eventTime);
 #endif
 
     bool needWake;
@@ -2663,7 +2663,7 @@
 
 void InputDispatcher::notifyKey(const NotifyKeyArgs* args) {
 #if DEBUG_INBOUND_EVENT_DETAILS
-    LOGD("notifyKey - eventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, action=0x%x, "
+    ALOGD("notifyKey - eventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, action=0x%x, "
             "flags=0x%x, keyCode=0x%x, scanCode=0x%x, metaState=0x%x, downTime=%lld",
             args->eventTime, args->deviceId, args->source, args->policyFlags,
             args->action, args->flags, args->keyCode, args->scanCode,
@@ -2741,14 +2741,14 @@
 
 void InputDispatcher::notifyMotion(const NotifyMotionArgs* args) {
 #if DEBUG_INBOUND_EVENT_DETAILS
-    LOGD("notifyMotion - eventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, "
+    ALOGD("notifyMotion - eventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, "
             "action=0x%x, flags=0x%x, metaState=0x%x, buttonState=0x%x, edgeFlags=0x%x, "
             "xPrecision=%f, yPrecision=%f, downTime=%lld",
             args->eventTime, args->deviceId, args->source, args->policyFlags,
             args->action, args->flags, args->metaState, args->buttonState,
             args->edgeFlags, args->xPrecision, args->yPrecision, args->downTime);
     for (uint32_t i = 0; i < args->pointerCount; i++) {
-        LOGD("  Pointer %d: id=%d, toolType=%d, "
+        ALOGD("  Pointer %d: id=%d, toolType=%d, "
                 "x=%f, y=%f, pressure=%f, size=%f, "
                 "touchMajor=%f, touchMinor=%f, toolMajor=%f, toolMinor=%f, "
                 "orientation=%f",
@@ -2910,7 +2910,7 @@
                     if (args->action == AMOTION_EVENT_ACTION_HOVER_MOVE) {
                         if (mLastHoverWindowHandle == NULL) {
 #if DEBUG_BATCHING
-                            LOGD("Not streaming hover move because there is no "
+                            ALOGD("Not streaming hover move because there is no "
                                     "last hovered window.");
 #endif
                             goto NoBatchingOrStreaming;
@@ -2921,7 +2921,7 @@
                                 args->pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_Y));
                         if (mLastHoverWindowHandle != hoverWindowHandle) {
 #if DEBUG_BATCHING
-                            LOGD("Not streaming hover move because the last hovered window "
+                            ALOGD("Not streaming hover move because the last hovered window "
                                     "is '%s' but the currently hovered window is '%s'.",
                                     mLastHoverWindowHandle->getName().string(),
                                     hoverWindowHandle != NULL
@@ -2935,7 +2935,7 @@
                     // that we can stream onto.  Append the motion sample and resume dispatch.
                     motionEntry->appendSample(args->eventTime, args->pointerCoords);
 #if DEBUG_BATCHING
-                    LOGD("Appended motion sample onto batch for most recently dispatched "
+                    ALOGD("Appended motion sample onto batch for most recently dispatched "
                             "motion event for this device and source in the outbound queues.  "
                             "Attempting to stream the motion sample.");
 #endif
@@ -2984,7 +2984,7 @@
         }
         lastSample->eventTime = eventTime;
 #if DEBUG_BATCHING
-        LOGD("Coalesced motion into last sample of batch for %s, events were %0.3f ms apart",
+        ALOGD("Coalesced motion into last sample of batch for %s, events were %0.3f ms apart",
                 eventDescription, interval * 0.000001f);
 #endif
         return;
@@ -2993,14 +2993,14 @@
     // Append the sample.
     entry->appendSample(eventTime, pointerCoords);
 #if DEBUG_BATCHING
-    LOGD("Appended motion sample onto batch for %s, events were %0.3f ms apart",
+    ALOGD("Appended motion sample onto batch for %s, events were %0.3f ms apart",
             eventDescription, interval * 0.000001f);
 #endif
 }
 
 void InputDispatcher::notifySwitch(const NotifySwitchArgs* args) {
 #if DEBUG_INBOUND_EVENT_DETAILS
-    LOGD("notifySwitch - eventTime=%lld, policyFlags=0x%x, switchCode=%d, switchValue=%d",
+    ALOGD("notifySwitch - eventTime=%lld, policyFlags=0x%x, switchCode=%d, switchValue=%d",
             args->eventTime, args->policyFlags,
             args->switchCode, args->switchValue);
 #endif
@@ -3013,7 +3013,7 @@
 
 void InputDispatcher::notifyDeviceReset(const NotifyDeviceResetArgs* args) {
 #if DEBUG_INBOUND_EVENT_DETAILS
-    LOGD("notifyDeviceReset - eventTime=%lld, deviceId=%d",
+    ALOGD("notifyDeviceReset - eventTime=%lld, deviceId=%d",
             args->eventTime, args->deviceId);
 #endif
 
@@ -3034,7 +3034,7 @@
         int32_t injectorPid, int32_t injectorUid, int32_t syncMode, int32_t timeoutMillis,
         uint32_t policyFlags) {
 #if DEBUG_INBOUND_EVENT_DETAILS
-    LOGD("injectInputEvent - eventType=%d, injectorPid=%d, injectorUid=%d, "
+    ALOGD("injectInputEvent - eventType=%d, injectorPid=%d, injectorUid=%d, "
             "syncMode=%d, timeoutMillis=%d, policyFlags=0x%08x",
             event->getType(), injectorPid, injectorUid, syncMode, timeoutMillis, policyFlags);
 #endif
@@ -3112,7 +3112,7 @@
     }
 
     default:
-        LOGW("Cannot inject event of type %d", event->getType());
+        ALOGW("Cannot inject event of type %d", event->getType());
         return INPUT_EVENT_INJECTION_FAILED;
     }
 
@@ -3147,7 +3147,7 @@
                 nsecs_t remainingTimeout = endTime - now();
                 if (remainingTimeout <= 0) {
 #if DEBUG_INJECTION
-                    LOGD("injectInputEvent - Timed out waiting for injection result "
+                    ALOGD("injectInputEvent - Timed out waiting for injection result "
                             "to become available.");
 #endif
                     injectionResult = INPUT_EVENT_INJECTION_TIMED_OUT;
@@ -3161,13 +3161,13 @@
                     && syncMode == INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISHED) {
                 while (injectionState->pendingForegroundDispatches != 0) {
 #if DEBUG_INJECTION
-                    LOGD("injectInputEvent - Waiting for %d pending foreground dispatches.",
+                    ALOGD("injectInputEvent - Waiting for %d pending foreground dispatches.",
                             injectionState->pendingForegroundDispatches);
 #endif
                     nsecs_t remainingTimeout = endTime - now();
                     if (remainingTimeout <= 0) {
 #if DEBUG_INJECTION
-                    LOGD("injectInputEvent - Timed out waiting for pending foreground "
+                    ALOGD("injectInputEvent - Timed out waiting for pending foreground "
                             "dispatches to finish.");
 #endif
                         injectionResult = INPUT_EVENT_INJECTION_TIMED_OUT;
@@ -3183,7 +3183,7 @@
     } // release lock
 
 #if DEBUG_INJECTION
-    LOGD("injectInputEvent - Finished with result %d.  "
+    ALOGD("injectInputEvent - Finished with result %d.  "
             "injectorPid=%d, injectorUid=%d",
             injectionResult, injectorPid, injectorUid);
 #endif
@@ -3200,7 +3200,7 @@
     InjectionState* injectionState = entry->injectionState;
     if (injectionState) {
 #if DEBUG_INJECTION
-        LOGD("Setting input event injection result to %d.  "
+        ALOGD("Setting input event injection result to %d.  "
                 "injectorPid=%d, injectorUid=%d",
                  injectionResult, injectionState->injectorPid, injectionState->injectorUid);
 #endif
@@ -3210,16 +3210,16 @@
             // Log the outcome since the injector did not wait for the injection result.
             switch (injectionResult) {
             case INPUT_EVENT_INJECTION_SUCCEEDED:
-                LOGV("Asynchronous input event injection succeeded.");
+                ALOGV("Asynchronous input event injection succeeded.");
                 break;
             case INPUT_EVENT_INJECTION_FAILED:
-                LOGW("Asynchronous input event injection failed.");
+                ALOGW("Asynchronous input event injection failed.");
                 break;
             case INPUT_EVENT_INJECTION_PERMISSION_DENIED:
-                LOGW("Asynchronous input event injection permission denied.");
+                ALOGW("Asynchronous input event injection permission denied.");
                 break;
             case INPUT_EVENT_INJECTION_TIMED_OUT:
-                LOGW("Asynchronous input event injection timed out.");
+                ALOGW("Asynchronous input event injection timed out.");
                 break;
             }
         }
@@ -3272,7 +3272,7 @@
 
 void InputDispatcher::setInputWindows(const Vector<sp<InputWindowHandle> >& inputWindowHandles) {
 #if DEBUG_FOCUS
-    LOGD("setInputWindows");
+    ALOGD("setInputWindows");
 #endif
     { // acquire lock
         AutoMutex _l(mLock);
@@ -3303,7 +3303,7 @@
         if (mFocusedWindowHandle != newFocusedWindowHandle) {
             if (mFocusedWindowHandle != NULL) {
 #if DEBUG_FOCUS
-                LOGD("Focus left window: %s",
+                ALOGD("Focus left window: %s",
                         mFocusedWindowHandle->getName().string());
 #endif
                 sp<InputChannel> focusedInputChannel = mFocusedWindowHandle->getInputChannel();
@@ -3316,7 +3316,7 @@
             }
             if (newFocusedWindowHandle != NULL) {
 #if DEBUG_FOCUS
-                LOGD("Focus entered window: %s",
+                ALOGD("Focus entered window: %s",
                         newFocusedWindowHandle->getName().string());
 #endif
             }
@@ -3327,7 +3327,7 @@
             TouchedWindow& touchedWindow = mTouchState.windows.editItemAt(i);
             if (!hasWindowHandleLocked(touchedWindow.windowHandle)) {
 #if DEBUG_FOCUS
-                LOGD("Touched window was removed: %s",
+                ALOGD("Touched window was removed: %s",
                         touchedWindow.windowHandle->getName().string());
 #endif
                 sp<InputChannel> touchedInputChannel =
@@ -3350,7 +3350,7 @@
             const sp<InputWindowHandle>& oldWindowHandle = oldWindowHandles.itemAt(i);
             if (!hasWindowHandleLocked(oldWindowHandle)) {
 #if DEBUG_FOCUS
-                LOGD("Window went away: %s", oldWindowHandle->getName().string());
+                ALOGD("Window went away: %s", oldWindowHandle->getName().string());
 #endif
                 oldWindowHandle->releaseInfo();
             }
@@ -3364,7 +3364,7 @@
 void InputDispatcher::setFocusedApplication(
         const sp<InputApplicationHandle>& inputApplicationHandle) {
 #if DEBUG_FOCUS
-    LOGD("setFocusedApplication");
+    ALOGD("setFocusedApplication");
 #endif
     { // acquire lock
         AutoMutex _l(mLock);
@@ -3394,7 +3394,7 @@
 
 void InputDispatcher::setInputDispatchMode(bool enabled, bool frozen) {
 #if DEBUG_FOCUS
-    LOGD("setInputDispatchMode: enabled=%d, frozen=%d", enabled, frozen);
+    ALOGD("setInputDispatchMode: enabled=%d, frozen=%d", enabled, frozen);
 #endif
 
     bool changed;
@@ -3430,7 +3430,7 @@
 
 void InputDispatcher::setInputFilterEnabled(bool enabled) {
 #if DEBUG_FOCUS
-    LOGD("setInputFilterEnabled: enabled=%d", enabled);
+    ALOGD("setInputFilterEnabled: enabled=%d", enabled);
 #endif
 
     { // acquire lock
@@ -3451,7 +3451,7 @@
 bool InputDispatcher::transferTouchFocus(const sp<InputChannel>& fromChannel,
         const sp<InputChannel>& toChannel) {
 #if DEBUG_FOCUS
-    LOGD("transferTouchFocus: fromChannel=%s, toChannel=%s",
+    ALOGD("transferTouchFocus: fromChannel=%s, toChannel=%s",
             fromChannel->getName().string(), toChannel->getName().string());
 #endif
     { // acquire lock
@@ -3461,13 +3461,13 @@
         sp<InputWindowHandle> toWindowHandle = getWindowHandleLocked(toChannel);
         if (fromWindowHandle == NULL || toWindowHandle == NULL) {
 #if DEBUG_FOCUS
-            LOGD("Cannot transfer focus because from or to window not found.");
+            ALOGD("Cannot transfer focus because from or to window not found.");
 #endif
             return false;
         }
         if (fromWindowHandle == toWindowHandle) {
 #if DEBUG_FOCUS
-            LOGD("Trivial transfer to same window.");
+            ALOGD("Trivial transfer to same window.");
 #endif
             return true;
         }
@@ -3493,7 +3493,7 @@
 
         if (! found) {
 #if DEBUG_FOCUS
-            LOGD("Focus transfer failed because from window did not have focus.");
+            ALOGD("Focus transfer failed because from window did not have focus.");
 #endif
             return false;
         }
@@ -3522,7 +3522,7 @@
 
 void InputDispatcher::resetAndDropEverythingLocked(const char* reason) {
 #if DEBUG_FOCUS
-    LOGD("Resetting and dropping all events (%s).", reason);
+    ALOGD("Resetting and dropping all events (%s).", reason);
 #endif
 
     CancelationOptions options(CancelationOptions::CANCEL_ALL_EVENTS, reason);
@@ -3548,7 +3548,7 @@
         if (*end == '\n') {
             *(end++) = '\0';
         }
-        LOGD("%s", start);
+        ALOGD("%s", start);
         start = end;
     }
 }
@@ -3653,7 +3653,7 @@
 status_t InputDispatcher::registerInputChannel(const sp<InputChannel>& inputChannel,
         const sp<InputWindowHandle>& inputWindowHandle, bool monitor) {
 #if DEBUG_REGISTRATION
-    LOGD("channel '%s' ~ registerInputChannel - monitor=%s", inputChannel->getName().string(),
+    ALOGD("channel '%s' ~ registerInputChannel - monitor=%s", inputChannel->getName().string(),
             toString(monitor));
 #endif
 
@@ -3661,7 +3661,7 @@
         AutoMutex _l(mLock);
 
         if (getConnectionIndexLocked(inputChannel) >= 0) {
-            LOGW("Attempted to register already registered input channel '%s'",
+            ALOGW("Attempted to register already registered input channel '%s'",
                     inputChannel->getName().string());
             return BAD_VALUE;
         }
@@ -3669,7 +3669,7 @@
         sp<Connection> connection = new Connection(inputChannel, inputWindowHandle, monitor);
         status_t status = connection->initialize();
         if (status) {
-            LOGE("Failed to initialize input publisher for input channel '%s', status=%d",
+            ALOGE("Failed to initialize input publisher for input channel '%s', status=%d",
                     inputChannel->getName().string(), status);
             return status;
         }
@@ -3690,7 +3690,7 @@
 
 status_t InputDispatcher::unregisterInputChannel(const sp<InputChannel>& inputChannel) {
 #if DEBUG_REGISTRATION
-    LOGD("channel '%s' ~ unregisterInputChannel", inputChannel->getName().string());
+    ALOGD("channel '%s' ~ unregisterInputChannel", inputChannel->getName().string());
 #endif
 
     { // acquire lock
@@ -3712,7 +3712,7 @@
         bool notify) {
     ssize_t connectionIndex = getConnectionIndexLocked(inputChannel);
     if (connectionIndex < 0) {
-        LOGW("Attempted to unregister already unregistered input channel '%s'",
+        ALOGW("Attempted to unregister already unregistered input channel '%s'",
                 inputChannel->getName().string());
         return BAD_VALUE;
     }
@@ -3788,7 +3788,7 @@
 
 void InputDispatcher::onDispatchCycleBrokenLocked(
         nsecs_t currentTime, const sp<Connection>& connection) {
-    LOGE("channel '%s' ~ Channel is unrecoverably broken and will be disposed!",
+    ALOGE("channel '%s' ~ Channel is unrecoverably broken and will be disposed!",
             connection->getInputChannelName());
 
     CommandEntry* commandEntry = postCommandLocked(
@@ -3800,7 +3800,7 @@
         nsecs_t currentTime, const sp<InputApplicationHandle>& applicationHandle,
         const sp<InputWindowHandle>& windowHandle,
         nsecs_t eventTime, nsecs_t waitStartTime) {
-    LOGI("Application is not responding: %s.  "
+    ALOGI("Application is not responding: %s.  "
             "%01.1fms since event, %01.1fms since wait started",
             getApplicationWindowLabelLocked(applicationHandle, windowHandle).string(),
             (currentTime - eventTime) / 1000000.0,
@@ -3933,7 +3933,7 @@
                     && keyEntry->repeatCount == 0;
             if (fallbackKeyCode == -1 && !initialDown) {
 #if DEBUG_OUTBOUND_EVENT_DETAILS
-                LOGD("Unhandled key event: Skipping unhandled key event processing "
+                ALOGD("Unhandled key event: Skipping unhandled key event processing "
                         "since this is not an initial down.  "
                         "keyCode=%d, action=%d, repeatCount=%d",
                         originalKeyCode, keyEntry->action, keyEntry->repeatCount);
@@ -3943,7 +3943,7 @@
 
             // Dispatch the unhandled key to the policy.
 #if DEBUG_OUTBOUND_EVENT_DETAILS
-            LOGD("Unhandled key event: Asking policy to perform fallback action.  "
+            ALOGD("Unhandled key event: Asking policy to perform fallback action.  "
                     "keyCode=%d, action=%d, repeatCount=%d",
                     keyEntry->keyCode, keyEntry->action, keyEntry->repeatCount);
 #endif
@@ -3962,7 +3962,7 @@
                 return true; // skip next cycle
             }
 
-            LOG_ASSERT(connection->outboundQueue.head == dispatchEntry);
+            ALOG_ASSERT(connection->outboundQueue.head == dispatchEntry);
 
             // Latch the fallback keycode for this key on an initial down.
             // The fallback keycode cannot change at any other point in the lifecycle.
@@ -3975,7 +3975,7 @@
                 connection->inputState.setFallbackKey(originalKeyCode, fallbackKeyCode);
             }
 
-            LOG_ASSERT(fallbackKeyCode != -1);
+            ALOG_ASSERT(fallbackKeyCode != -1);
 
             // Cancel the fallback key if the policy decides not to send it anymore.
             // We will continue to dispatch the key to the policy but we will no
@@ -3984,12 +3984,12 @@
                     && (!fallback || fallbackKeyCode != event.getKeyCode())) {
 #if DEBUG_OUTBOUND_EVENT_DETAILS
                 if (fallback) {
-                    LOGD("Unhandled key event: Policy requested to send key %d"
+                    ALOGD("Unhandled key event: Policy requested to send key %d"
                             "as a fallback for %d, but on the DOWN it had requested "
                             "to send %d instead.  Fallback canceled.",
                             event.getKeyCode(), originalKeyCode, fallbackKeyCode);
                 } else {
-                    LOGD("Unhandled key event: Policy did not request fallback for %d,"
+                    ALOGD("Unhandled key event: Policy did not request fallback for %d,"
                             "but on the DOWN it had requested to send %d.  "
                             "Fallback canceled.",
                             originalKeyCode, fallbackKeyCode);
@@ -4018,7 +4018,7 @@
                     msg.appendFormat(", %d->%d", fallbackKeys.keyAt(i),
                             fallbackKeys.valueAt(i));
                 }
-                LOGD("Unhandled key event: %d currently tracked fallback keys%s.",
+                ALOGD("Unhandled key event: %d currently tracked fallback keys%s.",
                         fallbackKeys.size(), msg.string());
             }
 #endif
@@ -4037,7 +4037,7 @@
                 keyEntry->syntheticRepeat = false;
 
 #if DEBUG_OUTBOUND_EVENT_DETAILS
-                LOGD("Unhandled key event: Dispatching fallback key.  "
+                ALOGD("Unhandled key event: Dispatching fallback key.  "
                         "originalKeyCode=%d, fallbackKeyCode=%d, fallbackMetaState=%08x",
                         originalKeyCode, fallbackKeyCode, keyEntry->metaState);
 #endif
@@ -4047,7 +4047,7 @@
                 return true; // already started next cycle
             } else {
 #if DEBUG_OUTBOUND_EVENT_DETAILS
-                LOGD("Unhandled key event: No fallback key.");
+                ALOGD("Unhandled key event: No fallback key.");
 #endif
             }
         }
@@ -4127,7 +4127,7 @@
     if (refCount == 0) {
         delete this;
     } else {
-        LOG_ASSERT(refCount > 0);
+        ALOG_ASSERT(refCount > 0);
     }
 }
 
@@ -4148,7 +4148,7 @@
     if (refCount == 0) {
         delete this;
     } else {
-        LOG_ASSERT(refCount > 0);
+        ALOG_ASSERT(refCount > 0);
     }
 }
 
@@ -4348,7 +4348,7 @@
          * So for now, allow inconsistent key up events to be dispatched.
          *
 #if DEBUG_OUTBOUND_EVENT_DETAILS
-        LOGD("Dropping inconsistent key up event: deviceId=%d, source=%08x, "
+        ALOGD("Dropping inconsistent key up event: deviceId=%d, source=%08x, "
                 "keyCode=%d, scanCode=%d",
                 entry->deviceId, entry->source, entry->keyCode, entry->scanCode);
 #endif
@@ -4383,7 +4383,7 @@
             return true;
         }
 #if DEBUG_OUTBOUND_EVENT_DETAILS
-        LOGD("Dropping inconsistent motion up or cancel event: deviceId=%d, source=%08x, "
+        ALOGD("Dropping inconsistent motion up or cancel event: deviceId=%d, source=%08x, "
                 "actionMasked=%d",
                 entry->deviceId, entry->source, actionMasked);
 #endif
@@ -4415,7 +4415,7 @@
             return true;
         }
 #if DEBUG_OUTBOUND_EVENT_DETAILS
-        LOGD("Dropping inconsistent motion pointer up/down or move event: "
+        ALOGD("Dropping inconsistent motion pointer up/down or move event: "
                 "deviceId=%d, source=%08x, actionMasked=%d",
                 entry->deviceId, entry->source, actionMasked);
 #endif
@@ -4429,7 +4429,7 @@
             return true;
         }
 #if DEBUG_OUTBOUND_EVENT_DETAILS
-        LOGD("Dropping inconsistent motion hover exit event: deviceId=%d, source=%08x",
+        ALOGD("Dropping inconsistent motion hover exit event: deviceId=%d, source=%08x",
                 entry->deviceId, entry->source);
 #endif
         return false;
diff --git a/services/input/InputManager.cpp b/services/input/InputManager.cpp
index 5dfa5d5..6a6547b 100644
--- a/services/input/InputManager.cpp
+++ b/services/input/InputManager.cpp
@@ -53,13 +53,13 @@
 status_t InputManager::start() {
     status_t result = mDispatcherThread->run("InputDispatcher", PRIORITY_URGENT_DISPLAY);
     if (result) {
-        LOGE("Could not start InputDispatcher thread due to error %d.", result);
+        ALOGE("Could not start InputDispatcher thread due to error %d.", result);
         return result;
     }
 
     result = mReaderThread->run("InputReader", PRIORITY_URGENT_DISPLAY);
     if (result) {
-        LOGE("Could not start InputReader thread due to error %d.", result);
+        ALOGE("Could not start InputReader thread due to error %d.", result);
 
         mDispatcherThread->requestExit();
         return result;
@@ -71,12 +71,12 @@
 status_t InputManager::stop() {
     status_t result = mReaderThread->requestExitAndWait();
     if (result) {
-        LOGW("Could not stop InputReader thread due to error %d.", result);
+        ALOGW("Could not stop InputReader thread due to error %d.", result);
     }
 
     result = mDispatcherThread->requestExitAndWait();
     if (result) {
-        LOGW("Could not stop InputDispatcher thread due to error %d.", result);
+        ALOGW("Could not stop InputDispatcher thread due to error %d.", result);
     }
 
     return OK;
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index b34ff25..8324d95 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -285,7 +285,7 @@
         if (!count || timeoutMillis == 0) {
             nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
 #if DEBUG_RAW_EVENTS
-            LOGD("Timeout expired, latency=%0.3fms", (now - mNextTimeout) * 0.000001f);
+            ALOGD("Timeout expired, latency=%0.3fms", (now - mNextTimeout) * 0.000001f);
 #endif
             mNextTimeout = LLONG_MAX;
             timeoutExpiredLocked(now);
@@ -316,7 +316,7 @@
                 batchSize += 1;
             }
 #if DEBUG_RAW_EVENTS
-            LOGD("BatchSize: %d Count: %d", batchSize, count);
+            ALOGD("BatchSize: %d Count: %d", batchSize, count);
 #endif
             processEventsForDeviceLocked(deviceId, rawEvent, batchSize);
         } else {
@@ -331,7 +331,7 @@
                 handleConfigurationChangedLocked(rawEvent->when);
                 break;
             default:
-                LOG_ASSERT(false); // can't happen
+                ALOG_ASSERT(false); // can't happen
                 break;
             }
         }
@@ -349,9 +349,9 @@
     device->reset(when);
 
     if (device->isIgnored()) {
-        LOGI("Device added: id=%d, name='%s' (ignored non-input device)", deviceId, name.string());
+        ALOGI("Device added: id=%d, name='%s' (ignored non-input device)", deviceId, name.string());
     } else {
-        LOGI("Device added: id=%d, name='%s', sources=0x%08x", deviceId, name.string(),
+        ALOGI("Device added: id=%d, name='%s', sources=0x%08x", deviceId, name.string(),
                 device->getSources());
     }
 
@@ -359,7 +359,7 @@
     if (deviceIndex < 0) {
         mDevices.add(deviceId, device);
     } else {
-        LOGW("Ignoring spurious device added event for deviceId %d.", deviceId);
+        ALOGW("Ignoring spurious device added event for deviceId %d.", deviceId);
         delete device;
         return;
     }
@@ -372,15 +372,15 @@
         device = mDevices.valueAt(deviceIndex);
         mDevices.removeItemsAt(deviceIndex, 1);
     } else {
-        LOGW("Ignoring spurious device removed event for deviceId %d.", deviceId);
+        ALOGW("Ignoring spurious device removed event for deviceId %d.", deviceId);
         return;
     }
 
     if (device->isIgnored()) {
-        LOGI("Device removed: id=%d, name='%s' (ignored non-input device)",
+        ALOGI("Device removed: id=%d, name='%s' (ignored non-input device)",
                 device->getId(), device->getName().string());
     } else {
-        LOGI("Device removed: id=%d, name='%s', sources=0x%08x",
+        ALOGI("Device removed: id=%d, name='%s', sources=0x%08x",
                 device->getId(), device->getName().string(), device->getSources());
     }
 
@@ -446,13 +446,13 @@
         const RawEvent* rawEvents, size_t count) {
     ssize_t deviceIndex = mDevices.indexOfKey(deviceId);
     if (deviceIndex < 0) {
-        LOGW("Discarding event for unknown deviceId %d.", deviceId);
+        ALOGW("Discarding event for unknown deviceId %d.", deviceId);
         return;
     }
 
     InputDevice* device = mDevices.valueAt(deviceIndex);
     if (device->isIgnored()) {
-        //LOGD("Discarding event for ignored deviceId %d.", deviceId);
+        //ALOGD("Discarding event for ignored deviceId %d.", deviceId);
         return;
     }
 
@@ -485,7 +485,7 @@
     mEventHub->setExcludedDevices(mConfig.excludedDeviceNames);
 
     if (changes) {
-        LOGI("Reconfiguring input devices.  changes=0x%08x", changes);
+        ALOGI("Reconfiguring input devices.  changes=0x%08x", changes);
         nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
 
         if (changes & InputReaderConfiguration::CHANGE_MUST_REOPEN) {
@@ -547,7 +547,7 @@
 bool InputReader::shouldDropVirtualKeyLocked(nsecs_t now,
         InputDevice* device, int32_t keyCode, int32_t scanCode) {
     if (now < mDisableVirtualKeysTimeout) {
-        LOGI("Dropping virtual key from device %s because virtual keys are "
+        ALOGI("Dropping virtual key from device %s because virtual keys are "
                 "temporarily disabled for the next %0.3fms.  keyCode=%d, scanCode=%d",
                 device->getName().string(),
                 (mDisableVirtualKeysTimeout - now) * 0.000001,
@@ -934,7 +934,7 @@
     size_t numMappers = mMappers.size();
     for (const RawEvent* rawEvent = rawEvents; count--; rawEvent++) {
 #if DEBUG_RAW_EVENTS
-        LOGD("Input event: device=%d type=0x%04x scancode=0x%04x "
+        ALOGD("Input event: device=%d type=0x%04x scancode=0x%04x "
                 "keycode=0x%04x value=0x%08x flags=0x%08x",
                 rawEvent->deviceId, rawEvent->type, rawEvent->scanCode, rawEvent->keyCode,
                 rawEvent->value, rawEvent->flags);
@@ -944,15 +944,15 @@
             if (rawEvent->type == EV_SYN && rawEvent->scanCode == SYN_REPORT) {
                 mDropUntilNextSync = false;
 #if DEBUG_RAW_EVENTS
-                LOGD("Recovered from input event buffer overrun.");
+                ALOGD("Recovered from input event buffer overrun.");
 #endif
             } else {
 #if DEBUG_RAW_EVENTS
-                LOGD("Dropped input event while waiting for next input sync.");
+                ALOGD("Dropped input event while waiting for next input sync.");
 #endif
             }
         } else if (rawEvent->type == EV_SYN && rawEvent->scanCode == SYN_DROPPED) {
-            LOGI("Detected input event buffer overrun for device %s.", mName.string());
+            ALOGI("Detected input event buffer overrun for device %s.", mName.string());
             mDropUntilNextSync = true;
             reset(rawEvent->when);
         } else {
@@ -1513,7 +1513,7 @@
         status_t status = device->getEventHub()->getAbsoluteAxisValue(device->getId(),
                 ABS_MT_SLOT, &initialSlot);
         if (status) {
-            LOGD("Could not retrieve current multitouch slot index.  status=%d", status);
+            ALOGD("Could not retrieve current multitouch slot index.  status=%d", status);
             initialSlot = -1;
         }
         clearSlots(initialSlot);
@@ -1546,7 +1546,7 @@
         if (mCurrentSlot < 0 || size_t(mCurrentSlot) >= mSlotCount) {
 #if DEBUG_POINTERS
             if (newSlot) {
-                LOGW("MultiTouch device emitted invalid slot index %d but it "
+                ALOGW("MultiTouch device emitted invalid slot index %d but it "
                         "should be between 0 and %d; ignoring this slot.",
                         mCurrentSlot, mSlotCount - 1);
             }
@@ -1897,7 +1897,7 @@
             mKeyDowns.removeAt(size_t(keyDownIndex));
         } else {
             // key was not actually down
-            LOGI("Dropping key up from device %s because the key was not down.  "
+            ALOGI("Dropping key up from device %s because the key was not down.  "
                     "keyCode=%d, scanCode=%d",
                     getDeviceName().string(), keyCode, scanCode);
             return;
@@ -2113,7 +2113,7 @@
         if (cursorModeString == "navigation") {
             mParameters.mode = Parameters::MODE_NAVIGATION;
         } else if (cursorModeString != "pointer" && cursorModeString != "default") {
-            LOGW("Invalid value for cursor.mode: '%s'", cursorModeString.string());
+            ALOGW("Invalid value for cursor.mode: '%s'", cursorModeString.string());
         }
     }
 
@@ -2140,7 +2140,7 @@
         dump.append(INDENT4 "Mode: navigation\n");
         break;
     default:
-        LOG_ASSERT(false);
+        ALOG_ASSERT(false);
     }
 
     dump.appendFormat(INDENT4 "OrientationAware: %s\n",
@@ -2522,7 +2522,7 @@
         } else if (gestureModeString == "spots") {
             mParameters.gestureMode = Parameters::GESTURE_MODE_SPOTS;
         } else if (gestureModeString != "default") {
-            LOGW("Invalid value for touch.gestureMode: '%s'", gestureModeString.string());
+            ALOGW("Invalid value for touch.gestureMode: '%s'", gestureModeString.string());
         }
     }
 
@@ -2552,7 +2552,7 @@
         } else if (deviceTypeString == "pointer") {
             mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER;
         } else if (deviceTypeString != "default") {
-            LOGW("Invalid value for touch.deviceType: '%s'", deviceTypeString.string());
+            ALOGW("Invalid value for touch.deviceType: '%s'", deviceTypeString.string());
         }
     }
 
@@ -2597,7 +2597,7 @@
         dump.append(INDENT4 "DeviceType: pointer\n");
         break;
     default:
-        LOG_ASSERT(false);
+        ALOG_ASSERT(false);
     }
 
     dump.appendFormat(INDENT4 "AssociatedDisplay: id=%d, isExternal=%s\n",
@@ -2646,7 +2646,7 @@
 
     // Ensure we have valid X and Y axes.
     if (!mRawPointerAxes.x.valid || !mRawPointerAxes.y.valid) {
-        LOGW(INDENT "Touch device '%s' did not report support for X or Y axis!  "
+        ALOGW(INDENT "Touch device '%s' did not report support for X or Y axis!  "
                 "The device will be inoperable.", getDeviceName().string());
         mDeviceMode = DEVICE_MODE_DISABLED;
         return;
@@ -2658,7 +2658,7 @@
                 mParameters.associatedDisplayIsExternal,
                 &mAssociatedDisplayWidth, &mAssociatedDisplayHeight,
                 &mAssociatedDisplayOrientation)) {
-            LOGI(INDENT "Touch device '%s' could not query the properties of its associated "
+            ALOGI(INDENT "Touch device '%s' could not query the properties of its associated "
                     "display %d.  The device will be inoperable until the display size "
                     "becomes available.",
                     getDeviceName().string(), mParameters.associatedDisplayId);
@@ -2704,7 +2704,7 @@
 
     bool sizeChanged = mSurfaceWidth != width || mSurfaceHeight != height;
     if (sizeChanged || deviceModeChanged) {
-        LOGI("Device reconfigured: id=%d, name='%s', surface size is now %dx%d, mode is %d",
+        ALOGI("Device reconfigured: id=%d, name='%s', surface size is now %dx%d, mode is %d",
                 getDeviceId(), getDeviceName().string(), width, height, mDeviceMode);
 
         mSurfaceWidth = width;
@@ -3002,7 +3002,7 @@
         uint32_t flags;
         if (getEventHub()->mapKey(getDeviceId(), virtualKey.scanCode,
                 & keyCode, & flags)) {
-            LOGW(INDENT "VirtualKey %d: could not obtain key code, ignoring",
+            ALOGW(INDENT "VirtualKey %d: could not obtain key code, ignoring",
                     virtualKey.scanCode);
             mVirtualKeys.pop(); // drop the key
             continue;
@@ -3058,7 +3058,7 @@
         } else if (sizeCalibrationString == "area") {
             out.sizeCalibration = Calibration::SIZE_CALIBRATION_AREA;
         } else if (sizeCalibrationString != "default") {
-            LOGW("Invalid value for touch.size.calibration: '%s'",
+            ALOGW("Invalid value for touch.size.calibration: '%s'",
                     sizeCalibrationString.string());
         }
     }
@@ -3081,7 +3081,7 @@
         } else if (pressureCalibrationString == "amplitude") {
             out.pressureCalibration = Calibration::PRESSURE_CALIBRATION_AMPLITUDE;
         } else if (pressureCalibrationString != "default") {
-            LOGW("Invalid value for touch.pressure.calibration: '%s'",
+            ALOGW("Invalid value for touch.pressure.calibration: '%s'",
                     pressureCalibrationString.string());
         }
     }
@@ -3100,7 +3100,7 @@
         } else if (orientationCalibrationString == "vector") {
             out.orientationCalibration = Calibration::ORIENTATION_CALIBRATION_VECTOR;
         } else if (orientationCalibrationString != "default") {
-            LOGW("Invalid value for touch.orientation.calibration: '%s'",
+            ALOGW("Invalid value for touch.orientation.calibration: '%s'",
                     orientationCalibrationString.string());
         }
     }
@@ -3114,7 +3114,7 @@
         } else if (distanceCalibrationString == "scaled") {
             out.distanceCalibration = Calibration::DISTANCE_CALIBRATION_SCALED;
         } else if (distanceCalibrationString != "default") {
-            LOGW("Invalid value for touch.distance.calibration: '%s'",
+            ALOGW("Invalid value for touch.distance.calibration: '%s'",
                     distanceCalibrationString.string());
         }
     }
@@ -3179,7 +3179,7 @@
         dump.append(INDENT4 "touch.size.calibration: area\n");
         break;
     default:
-        LOG_ASSERT(false);
+        ALOG_ASSERT(false);
     }
 
     if (mCalibration.haveSizeScale) {
@@ -3209,7 +3209,7 @@
         dump.append(INDENT4 "touch.pressure.calibration: amplitude\n");
         break;
     default:
-        LOG_ASSERT(false);
+        ALOG_ASSERT(false);
     }
 
     if (mCalibration.havePressureScale) {
@@ -3229,7 +3229,7 @@
         dump.append(INDENT4 "touch.orientation.calibration: vector\n");
         break;
     default:
-        LOG_ASSERT(false);
+        ALOG_ASSERT(false);
     }
 
     // Distance
@@ -3241,7 +3241,7 @@
         dump.append(INDENT4 "touch.distance.calibration: scaled\n");
         break;
     default:
-        LOG_ASSERT(false);
+        ALOG_ASSERT(false);
     }
 
     if (mCalibration.haveDistanceScale) {
@@ -3317,11 +3317,11 @@
 
 #if DEBUG_RAW_EVENTS
     if (!havePointerIds) {
-        LOGD("syncTouch: pointerCount %d -> %d, no pointer ids",
+        ALOGD("syncTouch: pointerCount %d -> %d, no pointer ids",
                 mLastRawPointerData.pointerCount,
                 mCurrentRawPointerData.pointerCount);
     } else {
-        LOGD("syncTouch: pointerCount %d -> %d, touching ids 0x%08x -> 0x%08x, "
+        ALOGD("syncTouch: pointerCount %d -> %d, touching ids 0x%08x -> 0x%08x, "
                 "hovering ids 0x%08x -> 0x%08x",
                 mLastRawPointerData.pointerCount,
                 mCurrentRawPointerData.pointerCount,
@@ -3472,7 +3472,7 @@
             mCurrentVirtualKey.down = false;
             if (!mCurrentVirtualKey.ignored) {
 #if DEBUG_VIRTUAL_KEYS
-                LOGD("VirtualKeys: Generating key up: keyCode=%d, scanCode=%d",
+                ALOGD("VirtualKeys: Generating key up: keyCode=%d, scanCode=%d",
                         mCurrentVirtualKey.keyCode, mCurrentVirtualKey.scanCode);
 #endif
                 dispatchVirtualKey(when, policyFlags,
@@ -3499,7 +3499,7 @@
         mCurrentVirtualKey.down = false;
         if (!mCurrentVirtualKey.ignored) {
 #if DEBUG_VIRTUAL_KEYS
-            LOGD("VirtualKeys: Canceling key: keyCode=%d, scanCode=%d",
+            ALOGD("VirtualKeys: Canceling key: keyCode=%d, scanCode=%d",
                     mCurrentVirtualKey.keyCode, mCurrentVirtualKey.scanCode);
 #endif
             dispatchVirtualKey(when, policyFlags,
@@ -3529,7 +3529,7 @@
 
                     if (!mCurrentVirtualKey.ignored) {
 #if DEBUG_VIRTUAL_KEYS
-                        LOGD("VirtualKeys: Generating key down: keyCode=%d, scanCode=%d",
+                        ALOGD("VirtualKeys: Generating key down: keyCode=%d, scanCode=%d",
                                 mCurrentVirtualKey.keyCode,
                                 mCurrentVirtualKey.scanCode);
 #endif
@@ -3635,7 +3635,7 @@
         // Although applications receive new locations as part of individual pointer up
         // events, they do not generally handle them except when presented in a move event.
         if (moveNeeded) {
-            LOG_ASSERT(moveIdBits.value == dispatchedIdBits.value);
+            ALOG_ASSERT(moveIdBits.value == dispatchedIdBits.value);
             dispatchMotion(when, policyFlags, mSource,
                     AMOTION_EVENT_ACTION_MOVE, 0, metaState, buttonState, 0,
                     mCurrentCookedPointerData.pointerProperties,
@@ -3746,7 +3746,7 @@
                 size = mRawPointerAxes.toolMinor.valid
                         ? avg(in.toolMajor, in.toolMinor) : in.toolMajor;
             } else {
-                LOG_ASSERT(false, "No touch or tool axes.  "
+                ALOG_ASSERT(false, "No touch or tool axes.  "
                         "Size calibration should have been resolved to NONE.");
                 touchMajor = 0;
                 touchMinor = 0;
@@ -4191,7 +4191,7 @@
     // Handle TAP timeout.
     if (isTimeout) {
 #if DEBUG_GESTURES
-        LOGD("Gestures: Processing timeout");
+        ALOGD("Gestures: Processing timeout");
 #endif
 
         if (mPointerGesture.lastGestureMode == PointerGesture::TAP) {
@@ -4202,7 +4202,7 @@
             } else {
                 // The tap is finished.
 #if DEBUG_GESTURES
-                LOGD("Gestures: TAP finished");
+                ALOGD("Gestures: TAP finished");
 #endif
                 *outFinishPreviousGesture = true;
 
@@ -4294,7 +4294,7 @@
     if (isQuietTime) {
         // Case 1: Quiet time. (QUIET)
 #if DEBUG_GESTURES
-        LOGD("Gestures: QUIET for next %0.3fms", (mPointerGesture.quietTime
+        ALOGD("Gestures: QUIET for next %0.3fms", (mPointerGesture.quietTime
                 + mConfig.pointerGestureQuietInterval - when) * 0.000001f);
 #endif
         if (mPointerGesture.lastGestureMode != PointerGesture::QUIET) {
@@ -4321,7 +4321,7 @@
         // finger to drag then the active pointer should switch to the finger that is
         // being dragged.
 #if DEBUG_GESTURES
-        LOGD("Gestures: BUTTON_CLICK_OR_DRAG activeTouchId=%d, "
+        ALOGD("Gestures: BUTTON_CLICK_OR_DRAG activeTouchId=%d, "
                 "currentFingerCount=%d", activeTouchId, currentFingerCount);
 #endif
         // Reset state when just starting.
@@ -4350,7 +4350,7 @@
                 mPointerGesture.activeTouchId = activeTouchId = bestId;
                 activeTouchChanged = true;
 #if DEBUG_GESTURES
-                LOGD("Gestures: BUTTON_CLICK_OR_DRAG switched pointers, "
+                ALOGD("Gestures: BUTTON_CLICK_OR_DRAG switched pointers, "
                         "bestId=%d, bestSpeed=%0.3f", bestId, bestSpeed);
 #endif
             }
@@ -4407,7 +4407,7 @@
                 if (fabs(x - mPointerGesture.tapX) <= mConfig.pointerGestureTapSlop
                         && fabs(y - mPointerGesture.tapY) <= mConfig.pointerGestureTapSlop) {
 #if DEBUG_GESTURES
-                    LOGD("Gestures: TAP");
+                    ALOGD("Gestures: TAP");
 #endif
 
                     mPointerGesture.tapUpTime = when;
@@ -4437,14 +4437,14 @@
                     tapped = true;
                 } else {
 #if DEBUG_GESTURES
-                    LOGD("Gestures: Not a TAP, deltaX=%f, deltaY=%f",
+                    ALOGD("Gestures: Not a TAP, deltaX=%f, deltaY=%f",
                             x - mPointerGesture.tapX,
                             y - mPointerGesture.tapY);
 #endif
                 }
             } else {
 #if DEBUG_GESTURES
-                LOGD("Gestures: Not a TAP, %0.3fms since down",
+                ALOGD("Gestures: Not a TAP, %0.3fms since down",
                         (when - mPointerGesture.tapDownTime) * 0.000001f);
 #endif
             }
@@ -4454,7 +4454,7 @@
 
         if (!tapped) {
 #if DEBUG_GESTURES
-            LOGD("Gestures: NEUTRAL");
+            ALOGD("Gestures: NEUTRAL");
 #endif
             mPointerGesture.activeGestureId = -1;
             mPointerGesture.currentGestureMode = PointerGesture::NEUTRAL;
@@ -4465,7 +4465,7 @@
         // The pointer follows the active touch point.
         // When in HOVER, emit HOVER_MOVE events at the pointer location.
         // When in TAP_DRAG, emit MOVE events at the pointer location.
-        LOG_ASSERT(activeTouchId >= 0);
+        ALOG_ASSERT(activeTouchId >= 0);
 
         mPointerGesture.currentGestureMode = PointerGesture::HOVER;
         if (mPointerGesture.lastGestureMode == PointerGesture::TAP) {
@@ -4477,14 +4477,14 @@
                     mPointerGesture.currentGestureMode = PointerGesture::TAP_DRAG;
                 } else {
 #if DEBUG_GESTURES
-                    LOGD("Gestures: Not a TAP_DRAG, deltaX=%f, deltaY=%f",
+                    ALOGD("Gestures: Not a TAP_DRAG, deltaX=%f, deltaY=%f",
                             x - mPointerGesture.tapX,
                             y - mPointerGesture.tapY);
 #endif
                 }
             } else {
 #if DEBUG_GESTURES
-                LOGD("Gestures: Not a TAP_DRAG, %0.3fms time since up",
+                ALOGD("Gestures: Not a TAP_DRAG, %0.3fms time since up",
                         (when - mPointerGesture.tapUpTime) * 0.000001f);
 #endif
             }
@@ -4515,12 +4515,12 @@
         bool down;
         if (mPointerGesture.currentGestureMode == PointerGesture::TAP_DRAG) {
 #if DEBUG_GESTURES
-            LOGD("Gestures: TAP_DRAG");
+            ALOGD("Gestures: TAP_DRAG");
 #endif
             down = true;
         } else {
 #if DEBUG_GESTURES
-            LOGD("Gestures: HOVER");
+            ALOGD("Gestures: HOVER");
 #endif
             if (mPointerGesture.lastGestureMode != PointerGesture::HOVER) {
                 *outFinishPreviousGesture = true;
@@ -4565,7 +4565,7 @@
         //
         // When the two fingers move enough or when additional fingers are added, we make
         // a decision to transition into SWIPE or FREEFORM mode accordingly.
-        LOG_ASSERT(activeTouchId >= 0);
+        ALOG_ASSERT(activeTouchId >= 0);
 
         bool settled = when >= mPointerGesture.firstTouchTime
                 + mConfig.pointerGestureMultitouchSettleInterval;
@@ -4577,7 +4577,7 @@
             // Additional pointers have gone down but not yet settled.
             // Reset the gesture.
 #if DEBUG_GESTURES
-            LOGD("Gestures: Resetting gesture since additional pointers went down for MULTITOUCH, "
+            ALOGD("Gestures: Resetting gesture since additional pointers went down for MULTITOUCH, "
                     "settle time remaining %0.3fms", (mPointerGesture.firstTouchTime
                             + mConfig.pointerGestureMultitouchSettleInterval - when)
                             * 0.000001f);
@@ -4596,7 +4596,7 @@
 
             // Use the centroid and pointer location as the reference points for the gesture.
 #if DEBUG_GESTURES
-            LOGD("Gestures: Using centroid as reference for MULTITOUCH, "
+            ALOGD("Gestures: Using centroid as reference for MULTITOUCH, "
                     "settle time remaining %0.3fms", (mPointerGesture.firstTouchTime
                             + mConfig.pointerGestureMultitouchSettleInterval - when)
                             * 0.000001f);
@@ -4659,7 +4659,7 @@
                 if (currentFingerCount > 2) {
                     // There are more than two pointers, switch to FREEFORM.
 #if DEBUG_GESTURES
-                    LOGD("Gestures: PRESS transitioned to FREEFORM, number of pointers %d > 2",
+                    ALOGD("Gestures: PRESS transitioned to FREEFORM, number of pointers %d > 2",
                             currentFingerCount);
 #endif
                     *outCancelPreviousGesture = true;
@@ -4676,7 +4676,7 @@
                         // There are two pointers but they are too far apart for a SWIPE,
                         // switch to FREEFORM.
 #if DEBUG_GESTURES
-                        LOGD("Gestures: PRESS transitioned to FREEFORM, distance %0.3f > %0.3f",
+                        ALOGD("Gestures: PRESS transitioned to FREEFORM, distance %0.3f > %0.3f",
                                 mutualDistance, mPointerGestureMaxSwipeWidth);
 #endif
                         *outCancelPreviousGesture = true;
@@ -4703,7 +4703,7 @@
                             if (cosine >= mConfig.pointerGestureSwipeTransitionAngleCosine) {
                                 // Pointers are moving in the same direction.  Switch to SWIPE.
 #if DEBUG_GESTURES
-                                LOGD("Gestures: PRESS transitioned to SWIPE, "
+                                ALOGD("Gestures: PRESS transitioned to SWIPE, "
                                         "dist1 %0.3f >= %0.3f, dist2 %0.3f >= %0.3f, "
                                         "cosine %0.3f >= %0.3f",
                                         dist1, mConfig.pointerGestureMultitouchMinDistance,
@@ -4714,7 +4714,7 @@
                             } else {
                                 // Pointers are moving in different directions.  Switch to FREEFORM.
 #if DEBUG_GESTURES
-                                LOGD("Gestures: PRESS transitioned to FREEFORM, "
+                                ALOGD("Gestures: PRESS transitioned to FREEFORM, "
                                         "dist1 %0.3f >= %0.3f, dist2 %0.3f >= %0.3f, "
                                         "cosine %0.3f < %0.3f",
                                         dist1, mConfig.pointerGestureMultitouchMinDistance,
@@ -4733,7 +4733,7 @@
             // Cancel previous gesture.
             if (currentFingerCount > 2) {
 #if DEBUG_GESTURES
-                LOGD("Gestures: SWIPE transitioned to FREEFORM, number of pointers %d > 2",
+                ALOGD("Gestures: SWIPE transitioned to FREEFORM, number of pointers %d > 2",
                         currentFingerCount);
 #endif
                 *outCancelPreviousGesture = true;
@@ -4770,11 +4770,11 @@
                 || mPointerGesture.currentGestureMode == PointerGesture::SWIPE) {
             // PRESS or SWIPE mode.
 #if DEBUG_GESTURES
-            LOGD("Gestures: PRESS or SWIPE activeTouchId=%d,"
+            ALOGD("Gestures: PRESS or SWIPE activeTouchId=%d,"
                     "activeGestureId=%d, currentTouchPointerCount=%d",
                     activeTouchId, mPointerGesture.activeGestureId, currentFingerCount);
 #endif
-            LOG_ASSERT(mPointerGesture.activeGestureId >= 0);
+            ALOG_ASSERT(mPointerGesture.activeGestureId >= 0);
 
             mPointerGesture.currentGestureIdBits.clear();
             mPointerGesture.currentGestureIdBits.markBit(mPointerGesture.activeGestureId);
@@ -4792,11 +4792,11 @@
         } else if (mPointerGesture.currentGestureMode == PointerGesture::FREEFORM) {
             // FREEFORM mode.
 #if DEBUG_GESTURES
-            LOGD("Gestures: FREEFORM activeTouchId=%d,"
+            ALOGD("Gestures: FREEFORM activeTouchId=%d,"
                     "activeGestureId=%d, currentTouchPointerCount=%d",
                     activeTouchId, mPointerGesture.activeGestureId, currentFingerCount);
 #endif
-            LOG_ASSERT(mPointerGesture.activeGestureId >= 0);
+            ALOG_ASSERT(mPointerGesture.activeGestureId >= 0);
 
             mPointerGesture.currentGestureIdBits.clear();
 
@@ -4835,7 +4835,7 @@
             }
 
 #if DEBUG_GESTURES
-            LOGD("Gestures: FREEFORM follow up "
+            ALOGD("Gestures: FREEFORM follow up "
                     "mappedTouchIdBits=0x%08x, usedGestureIdBits=0x%08x, "
                     "activeGestureId=%d",
                     mappedTouchIdBits.value, usedGestureIdBits.value,
@@ -4850,14 +4850,14 @@
                     gestureId = usedGestureIdBits.markFirstUnmarkedBit();
                     mPointerGesture.freeformTouchToGestureIdMap[touchId] = gestureId;
 #if DEBUG_GESTURES
-                    LOGD("Gestures: FREEFORM "
+                    ALOGD("Gestures: FREEFORM "
                             "new mapping for touch id %d -> gesture id %d",
                             touchId, gestureId);
 #endif
                 } else {
                     gestureId = mPointerGesture.freeformTouchToGestureIdMap[touchId];
 #if DEBUG_GESTURES
-                    LOGD("Gestures: FREEFORM "
+                    ALOGD("Gestures: FREEFORM "
                             "existing mapping for touch id %d -> gesture id %d",
                             touchId, gestureId);
 #endif
@@ -4890,7 +4890,7 @@
                 mPointerGesture.activeGestureId =
                         mPointerGesture.currentGestureIdBits.firstMarkedBit();
 #if DEBUG_GESTURES
-                LOGD("Gestures: FREEFORM new "
+                ALOGD("Gestures: FREEFORM new "
                         "activeGestureId=%d", mPointerGesture.activeGestureId);
 #endif
             }
@@ -4900,7 +4900,7 @@
     mPointerController->setButtonState(mCurrentButtonState);
 
 #if DEBUG_GESTURES
-    LOGD("Gestures: finishPreviousGesture=%s, cancelPreviousGesture=%s, "
+    ALOGD("Gestures: finishPreviousGesture=%s, cancelPreviousGesture=%s, "
             "currentGestureMode=%d, currentGestureIdBits=0x%08x, "
             "lastGestureMode=%d, lastGestureIdBits=0x%08x",
             toString(*outFinishPreviousGesture), toString(*outCancelPreviousGesture),
@@ -4911,7 +4911,7 @@
         uint32_t index = mPointerGesture.currentGestureIdToIndex[id];
         const PointerProperties& properties = mPointerGesture.currentGestureProperties[index];
         const PointerCoords& coords = mPointerGesture.currentGestureCoords[index];
-        LOGD("  currentGesture[%d]: index=%d, toolType=%d, "
+        ALOGD("  currentGesture[%d]: index=%d, toolType=%d, "
                 "x=%0.3f, y=%0.3f, pressure=%0.3f",
                 id, index, properties.toolType,
                 coords.getAxisValue(AMOTION_EVENT_AXIS_X),
@@ -4923,7 +4923,7 @@
         uint32_t index = mPointerGesture.lastGestureIdToIndex[id];
         const PointerProperties& properties = mPointerGesture.lastGestureProperties[index];
         const PointerCoords& coords = mPointerGesture.lastGestureCoords[index];
-        LOGD("  lastGesture[%d]: index=%d, toolType=%d, "
+        ALOGD("  lastGesture[%d]: index=%d, toolType=%d, "
                 "x=%0.3f, y=%0.3f, pressure=%0.3f",
                 id, index, properties.toolType,
                 coords.getAxisValue(AMOTION_EVENT_AXIS_X),
@@ -5164,7 +5164,7 @@
         pointerCount += 1;
     }
 
-    LOG_ASSERT(pointerCount != 0);
+    ALOG_ASSERT(pointerCount != 0);
 
     if (changedId >= 0 && pointerCount == 1) {
         // Replace initial down and final up action.
@@ -5176,7 +5176,7 @@
             action = AMOTION_EVENT_ACTION_UP;
         } else {
             // Can't happen.
-            LOG_ASSERT(false);
+            ALOG_ASSERT(false);
         }
     }
 
@@ -5232,7 +5232,7 @@
         const VirtualKey& virtualKey = mVirtualKeys[i];
 
 #if DEBUG_VIRTUAL_KEYS
-        LOGD("VirtualKeys: Hit test (%d, %d): keyCode=%d, scanCode=%d, "
+        ALOGD("VirtualKeys: Hit test (%d, %d): keyCode=%d, scanCode=%d, "
                 "left=%d, top=%d, right=%d, bottom=%d",
                 x, y,
                 virtualKey.keyCode, virtualKey.scanCode,
@@ -5337,9 +5337,9 @@
     }
 
 #if DEBUG_POINTER_ASSIGNMENT
-    LOGD("assignPointerIds - initial distance min-heap: size=%d", heapSize);
+    ALOGD("assignPointerIds - initial distance min-heap: size=%d", heapSize);
     for (size_t i = 0; i < heapSize; i++) {
-        LOGD("  heap[%d]: cur=%d, last=%d, distance=%lld",
+        ALOGD("  heap[%d]: cur=%d, last=%d, distance=%lld",
                 i, heap[i].currentPointerIndex, heap[i].lastPointerIndex,
                 heap[i].distance);
     }
@@ -5383,9 +5383,9 @@
                 }
 
 #if DEBUG_POINTER_ASSIGNMENT
-                LOGD("assignPointerIds - reduced distance min-heap: size=%d", heapSize);
+                ALOGD("assignPointerIds - reduced distance min-heap: size=%d", heapSize);
                 for (size_t i = 0; i < heapSize; i++) {
-                    LOGD("  heap[%d]: cur=%d, last=%d, distance=%lld",
+                    ALOGD("  heap[%d]: cur=%d, last=%d, distance=%lld",
                             i, heap[i].currentPointerIndex, heap[i].lastPointerIndex,
                             heap[i].distance);
                 }
@@ -5411,7 +5411,7 @@
             usedIdBits.markBit(id);
 
 #if DEBUG_POINTER_ASSIGNMENT
-            LOGD("assignPointerIds - matched: cur=%d, last=%d, id=%d, distance=%lld",
+            ALOGD("assignPointerIds - matched: cur=%d, last=%d, id=%d, distance=%lld",
                     lastPointerIndex, currentPointerIndex, id, heap[0].distance);
 #endif
             break;
@@ -5429,7 +5429,7 @@
                 mCurrentRawPointerData.isHovering(currentPointerIndex));
 
 #if DEBUG_POINTER_ASSIGNMENT
-        LOGD("assignPointerIds - assigned: cur=%d, id=%d",
+        ALOGD("assignPointerIds - assigned: cur=%d, id=%d",
                 currentPointerIndex, id);
 #endif
     }
@@ -5587,7 +5587,7 @@
 
         if (outCount >= MAX_POINTERS) {
 #if DEBUG_POINTERS
-            LOGD("MultiTouch device %s emitted more than maximum of %d pointers; "
+            ALOGD("MultiTouch device %s emitted more than maximum of %d pointers; "
                     "ignoring the rest.",
                     getDeviceName().string(), MAX_POINTERS);
 #endif
@@ -5678,7 +5678,7 @@
             && mRawPointerAxes.slot.minValue == 0 && mRawPointerAxes.slot.maxValue > 0) {
         size_t slotCount = mRawPointerAxes.slot.maxValue + 1;
         if (slotCount > MAX_SLOTS) {
-            LOGW("MultiTouch Device %s reported %d slots but the framework "
+            ALOGW("MultiTouch Device %s reported %d slots but the framework "
                     "only supports a maximum of %d slots at this time.",
                     getDeviceName().string(), slotCount, MAX_SLOTS);
             slotCount = MAX_SLOTS;
@@ -5814,7 +5814,7 @@
         // If there are too many axes, start dropping them.
         // Prefer to keep explicitly mapped axes.
         if (mAxes.size() > PointerCoords::MAX_AXES) {
-            LOGI("Joystick '%s' has %d axes but the framework only supports a maximum of %d.",
+            ALOGI("Joystick '%s' has %d axes but the framework only supports a maximum of %d.",
                     getDeviceName().string(), mAxes.size(), PointerCoords::MAX_AXES);
             pruneAxes(true);
             pruneAxes(false);
@@ -5835,7 +5835,7 @@
                     axis.axisInfo.axis = nextGenericAxisId;
                     nextGenericAxisId += 1;
                 } else {
-                    LOGI("Ignoring joystick '%s' axis %d because all of the generic axis ids "
+                    ALOGI("Ignoring joystick '%s' axis %d because all of the generic axis ids "
                             "have already been assigned to other axes.",
                             getDeviceName().string(), mAxes.keyAt(i));
                     mAxes.removeItemsAt(i--);
@@ -5865,7 +5865,7 @@
         if (ignoreExplicitlyMappedAxes && mAxes.valueAt(i).explicitlyMapped) {
             continue;
         }
-        LOGI("Discarding joystick '%s' axis %d because there are too many axes.",
+        ALOGI("Discarding joystick '%s' axis %d because there are too many axes.",
                 getDeviceName().string(), mAxes.keyAt(i));
         mAxes.removeItemsAt(i);
     }
diff --git a/services/input/PointerController.cpp b/services/input/PointerController.cpp
index 1d1730d..fc828a6 100644
--- a/services/input/PointerController.cpp
+++ b/services/input/PointerController.cpp
@@ -126,7 +126,7 @@
 
 void PointerController::move(float deltaX, float deltaY) {
 #if DEBUG_POINTER_UPDATES
-    LOGD("Move pointer by deltaX=%0.3f, deltaY=%0.3f", deltaX, deltaY);
+    ALOGD("Move pointer by deltaX=%0.3f, deltaY=%0.3f", deltaX, deltaY);
 #endif
     if (deltaX == 0.0f && deltaY == 0.0f) {
         return;
@@ -139,7 +139,7 @@
 
 void PointerController::setButtonState(int32_t buttonState) {
 #if DEBUG_POINTER_UPDATES
-    LOGD("Set button state 0x%08x", buttonState);
+    ALOGD("Set button state 0x%08x", buttonState);
 #endif
     AutoMutex _l(mLock);
 
@@ -156,7 +156,7 @@
 
 void PointerController::setPosition(float x, float y) {
 #if DEBUG_POINTER_UPDATES
-    LOGD("Set pointer position to x=%0.3f, y=%0.3f", x, y);
+    ALOGD("Set pointer position to x=%0.3f, y=%0.3f", x, y);
 #endif
     AutoMutex _l(mLock);
 
@@ -243,12 +243,12 @@
 void PointerController::setSpots(const PointerCoords* spotCoords,
         const uint32_t* spotIdToIndex, BitSet32 spotIdBits) {
 #if DEBUG_POINTER_UPDATES
-    LOGD("setSpots: idBits=%08x", spotIdBits.value);
+    ALOGD("setSpots: idBits=%08x", spotIdBits.value);
     for (BitSet32 idBits(spotIdBits); !idBits.isEmpty(); ) {
         uint32_t id = idBits.firstMarkedBit();
         idBits.clearBit(id);
         const PointerCoords& c = spotCoords[spotIdToIndex[id]];
-        LOGD(" spot %d: position=(%0.3f, %0.3f), pressure=%0.3f", id,
+        ALOGD(" spot %d: position=(%0.3f, %0.3f), pressure=%0.3f", id,
                 c.getAxisValue(AMOTION_EVENT_AXIS_X),
                 c.getAxisValue(AMOTION_EVENT_AXIS_Y),
                 c.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE));
@@ -290,7 +290,7 @@
 
 void PointerController::clearSpots() {
 #if DEBUG_POINTER_UPDATES
-    LOGD("clearSpots");
+    ALOGD("clearSpots");
 #endif
 
     AutoMutex _l(mLock);
diff --git a/services/input/SpriteController.cpp b/services/input/SpriteController.cpp
index 0ae2ab8..b15d4c8 100644
--- a/services/input/SpriteController.cpp
+++ b/services/input/SpriteController.cpp
@@ -160,7 +160,7 @@
 
                 status_t status = update.state.surfaceControl->setSize(desiredWidth, desiredHeight);
                 if (status) {
-                    LOGE("Error %d resizing sprite surface from %dx%d to %dx%d",
+                    ALOGE("Error %d resizing sprite surface from %dx%d to %dx%d",
                             status, update.state.surfaceWidth, update.state.surfaceHeight,
                             desiredWidth, desiredHeight);
                 } else {
@@ -172,7 +172,7 @@
                     if (update.state.surfaceVisible) {
                         status = update.state.surfaceControl->hide();
                         if (status) {
-                            LOGE("Error %d hiding sprite surface after resize.", status);
+                            ALOGE("Error %d hiding sprite surface after resize.", status);
                         } else {
                             update.state.surfaceVisible = false;
                         }
@@ -200,7 +200,7 @@
             Surface::SurfaceInfo surfaceInfo;
             status_t status = surface->lock(&surfaceInfo);
             if (status) {
-                LOGE("Error %d locking sprite surface before drawing.", status);
+                ALOGE("Error %d locking sprite surface before drawing.", status);
             } else {
                 SkBitmap surfaceBitmap;
                 ssize_t bpr = surfaceInfo.s * bytesPerPixel(surfaceInfo.format);
@@ -228,7 +228,7 @@
 
                 status = surface->unlockAndPost();
                 if (status) {
-                    LOGE("Error %d unlocking and posting sprite surface after drawing.", status);
+                    ALOGE("Error %d unlocking and posting sprite surface after drawing.", status);
                 } else {
                     update.state.surfaceDrawn = true;
                     update.surfaceChanged = surfaceChanged = true;
@@ -260,7 +260,7 @@
                     && (becomingVisible || (update.state.dirty & DIRTY_ALPHA))) {
                 status = update.state.surfaceControl->setAlpha(update.state.alpha);
                 if (status) {
-                    LOGE("Error %d setting sprite surface alpha.", status);
+                    ALOGE("Error %d setting sprite surface alpha.", status);
                 }
             }
 
@@ -271,7 +271,7 @@
                         update.state.positionX - update.state.icon.hotSpotX,
                         update.state.positionY - update.state.icon.hotSpotY);
                 if (status) {
-                    LOGE("Error %d setting sprite surface position.", status);
+                    ALOGE("Error %d setting sprite surface position.", status);
                 }
             }
 
@@ -284,7 +284,7 @@
                         update.state.transformationMatrix.dsdy,
                         update.state.transformationMatrix.dtdy);
                 if (status) {
-                    LOGE("Error %d setting sprite surface transformation matrix.", status);
+                    ALOGE("Error %d setting sprite surface transformation matrix.", status);
                 }
             }
 
@@ -293,14 +293,14 @@
                     && (becomingVisible || (update.state.dirty & DIRTY_LAYER))) {
                 status = update.state.surfaceControl->setLayer(surfaceLayer);
                 if (status) {
-                    LOGE("Error %d setting sprite surface layer.", status);
+                    ALOGE("Error %d setting sprite surface layer.", status);
                 }
             }
 
             if (becomingVisible) {
                 status = update.state.surfaceControl->show(surfaceLayer);
                 if (status) {
-                    LOGE("Error %d showing sprite surface.", status);
+                    ALOGE("Error %d showing sprite surface.", status);
                 } else {
                     update.state.surfaceVisible = true;
                     update.surfaceChanged = surfaceChanged = true;
@@ -308,7 +308,7 @@
             } else if (becomingHidden) {
                 status = update.state.surfaceControl->hide();
                 if (status) {
-                    LOGE("Error %d hiding sprite surface.", status);
+                    ALOGE("Error %d hiding sprite surface.", status);
                 } else {
                     update.state.surfaceVisible = false;
                     update.surfaceChanged = surfaceChanged = true;
@@ -372,7 +372,7 @@
             String8("Sprite"), 0, width, height, PIXEL_FORMAT_RGBA_8888);
     if (surfaceControl == NULL || !surfaceControl->isValid()
             || !surfaceControl->getSurface()->isValid()) {
-        LOGE("Error creating sprite surface.");
+        ALOGE("Error creating sprite surface.");
         return NULL;
     }
     return surfaceControl;
diff --git a/services/java/com/android/server/location/GpsLocationProvider.java b/services/java/com/android/server/location/GpsLocationProvider.java
index 00788ba..588fa93 100755
--- a/services/java/com/android/server/location/GpsLocationProvider.java
+++ b/services/java/com/android/server/location/GpsLocationProvider.java
@@ -1077,6 +1077,7 @@
             } else {
                 mLocation.removeAccuracy();
             }
+            mLocation.setExtras(mLocationExtras);
 
             try {
                 mLocationManager.reportLocation(mLocation, false);
diff --git a/services/jni/com_android_server_AlarmManagerService.cpp b/services/jni/com_android_server_AlarmManagerService.cpp
index e80dd04..c2f6151 100644
--- a/services/jni/com_android_server_AlarmManagerService.cpp
+++ b/services/jni/com_android_server_AlarmManagerService.cpp
@@ -46,10 +46,10 @@
 
     int result = settimeofday(NULL, &tz);
     if (result < 0) {
-        LOGE("Unable to set kernel timezone to %d: %s\n", minswest, strerror(errno));
+        ALOGE("Unable to set kernel timezone to %d: %s\n", minswest, strerror(errno));
         return -1;
     } else {
-        LOGD("Kernel timezone updated to %d minutes west of GMT\n", minswest);
+        ALOGD("Kernel timezone updated to %d minutes west of GMT\n", minswest);
     }
 
     return 0;
@@ -74,7 +74,7 @@
 	int result = ioctl(fd, ANDROID_ALARM_SET(type), &ts);
 	if (result < 0)
 	{
-        LOGE("Unable to set alarm to %lld.%09lld: %s\n", seconds, nanoseconds, strerror(errno));
+        ALOGE("Unable to set alarm to %lld.%09lld: %s\n", seconds, nanoseconds, strerror(errno));
     }
 }
 
@@ -89,7 +89,7 @@
 
 	if (result < 0)
 	{
-        LOGE("Unable to wait on alarm: %s\n", strerror(errno));
+        ALOGE("Unable to wait on alarm: %s\n", strerror(errno));
         return 0;
     }
 
diff --git a/services/jni/com_android_server_BatteryService.cpp b/services/jni/com_android_server_BatteryService.cpp
index 2ceb535..1cadc4e 100644
--- a/services/jni/com_android_server_BatteryService.cpp
+++ b/services/jni/com_android_server_BatteryService.cpp
@@ -93,7 +93,7 @@
         case 'U': return gConstants.statusUnknown;          // Unknown
             
         default: {
-            LOGW("Unknown battery status '%s'", status);
+            ALOGW("Unknown battery status '%s'", status);
             return gConstants.statusUnknown;
         }
     }
@@ -111,7 +111,7 @@
             } else if (strcmp(status, "Over voltage") == 0) {
                 return gConstants.healthOverVoltage;
             }
-            LOGW("Unknown battery health[1] '%s'", status);
+            ALOGW("Unknown battery health[1] '%s'", status);
             return gConstants.healthUnknown;
         }
         
@@ -125,7 +125,7 @@
         }
             
         default: {
-            LOGW("Unknown battery health[2] '%s'", status);
+            ALOGW("Unknown battery health[2] '%s'", status);
             return gConstants.healthUnknown;
         }
     }
@@ -137,7 +137,7 @@
         return -1;
     int fd = open(path, O_RDONLY, 0);
     if (fd == -1) {
-        LOGE("Could not open '%s'", path);
+        ALOGE("Could not open '%s'", path);
         return -1;
     }
     
@@ -232,7 +232,7 @@
 
     DIR* dir = opendir(POWER_SUPPLY_PATH);
     if (dir == NULL) {
-        LOGE("Could not open %s\n", POWER_SUPPLY_PATH);
+        ALOGE("Could not open %s\n", POWER_SUPPLY_PATH);
         return -1;
     }
     while ((entry = readdir(dir))) {
@@ -304,28 +304,28 @@
     closedir(dir);
 
     if (!gPaths.acOnlinePath)
-        LOGE("acOnlinePath not found");
+        ALOGE("acOnlinePath not found");
     if (!gPaths.usbOnlinePath)
-        LOGE("usbOnlinePath not found");
+        ALOGE("usbOnlinePath not found");
     if (!gPaths.batteryStatusPath)
-        LOGE("batteryStatusPath not found");
+        ALOGE("batteryStatusPath not found");
     if (!gPaths.batteryHealthPath)
-        LOGE("batteryHealthPath not found");
+        ALOGE("batteryHealthPath not found");
     if (!gPaths.batteryPresentPath)
-        LOGE("batteryPresentPath not found");
+        ALOGE("batteryPresentPath not found");
     if (!gPaths.batteryCapacityPath)
-        LOGE("batteryCapacityPath not found");
+        ALOGE("batteryCapacityPath not found");
     if (!gPaths.batteryVoltagePath)
-        LOGE("batteryVoltagePath not found");
+        ALOGE("batteryVoltagePath not found");
     if (!gPaths.batteryTemperaturePath)
-        LOGE("batteryTemperaturePath not found");
+        ALOGE("batteryTemperaturePath not found");
     if (!gPaths.batteryTechnologyPath)
-        LOGE("batteryTechnologyPath not found");
+        ALOGE("batteryTechnologyPath not found");
 
     jclass clazz = env->FindClass("com/android/server/BatteryService");
 
     if (clazz == NULL) {
-        LOGE("Can't find com/android/server/BatteryService");
+        ALOGE("Can't find com/android/server/BatteryService");
         return -1;
     }
     
@@ -352,7 +352,7 @@
     clazz = env->FindClass("android/os/BatteryManager");
     
     if (clazz == NULL) {
-        LOGE("Can't find android/os/BatteryManager");
+        ALOGE("Can't find android/os/BatteryManager");
         return -1;
     }
     
diff --git a/services/jni/com_android_server_InputManager.cpp b/services/jni/com_android_server_InputManager.cpp
index f259883..e163826 100644
--- a/services/jni/com_android_server_InputManager.cpp
+++ b/services/jni/com_android_server_InputManager.cpp
@@ -312,7 +312,7 @@
 
 bool NativeInputManager::checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {
     if (env->ExceptionCheck()) {
-        LOGE("An exception was thrown by callback '%s'.", methodName);
+        ALOGE("An exception was thrown by callback '%s'.", methodName);
         LOGE_EX(env);
         env->ExceptionClear();
         return true;
@@ -502,7 +502,7 @@
 void NativeInputManager::notifySwitch(nsecs_t when, int32_t switchCode,
         int32_t switchValue, uint32_t policyFlags) {
 #if DEBUG_INPUT_DISPATCHER_POLICY
-    LOGD("notifySwitch - when=%lld, switchCode=%d, switchValue=%d, policyFlags=0x%x",
+    ALOGD("notifySwitch - when=%lld, switchCode=%d, switchValue=%d, policyFlags=0x%x",
             when, switchCode, switchValue, policyFlags);
 #endif
 
@@ -519,7 +519,7 @@
 
 void NativeInputManager::notifyConfigurationChanged(nsecs_t when) {
 #if DEBUG_INPUT_DISPATCHER_POLICY
-    LOGD("notifyConfigurationChanged - when=%lld", when);
+    ALOGD("notifyConfigurationChanged - when=%lld", when);
 #endif
 
     JNIEnv* env = jniEnv();
@@ -531,7 +531,7 @@
 nsecs_t NativeInputManager::notifyANR(const sp<InputApplicationHandle>& inputApplicationHandle,
         const sp<InputWindowHandle>& inputWindowHandle) {
 #if DEBUG_INPUT_DISPATCHER_POLICY
-    LOGD("notifyANR");
+    ALOGD("notifyANR");
 #endif
 
     JNIEnv* env = jniEnv();
@@ -556,7 +556,7 @@
 
 void NativeInputManager::notifyInputChannelBroken(const sp<InputWindowHandle>& inputWindowHandle) {
 #if DEBUG_INPUT_DISPATCHER_POLICY
-    LOGD("notifyInputChannelBroken");
+    ALOGD("notifyInputChannelBroken");
 #endif
 
     JNIEnv* env = jniEnv();
@@ -686,7 +686,7 @@
             return;
         }
 
-        LOGI("Setting pointer speed to %d.", speed);
+        ALOGI("Setting pointer speed to %d.", speed);
         mLocked.pointerSpeed = speed;
     } // release lock
 
@@ -702,7 +702,7 @@
             return;
         }
 
-        LOGI("Setting show touches feature to %s.", enabled ? "enabled" : "disabled");
+        ALOGI("Setting show touches feature to %s.", enabled ? "enabled" : "disabled");
         mLocked.showTouches = enabled;
     } // release lock
 
@@ -736,7 +736,7 @@
     }
 
     if (!inputEventObj) {
-        LOGE("Failed to obtain input event object for filterInputEvent.");
+        ALOGE("Failed to obtain input event object for filterInputEvent.");
         return true; // dispatch the event normally
     }
 
@@ -774,7 +774,7 @@
             android_view_KeyEvent_recycle(env, keyEventObj);
             env->DeleteLocalRef(keyEventObj);
         } else {
-            LOGE("Failed to obtain key event object for interceptKeyBeforeQueueing.");
+            ALOGE("Failed to obtain key event object for interceptKeyBeforeQueueing.");
             wmActions = 0;
         }
 
@@ -829,14 +829,14 @@
         uint32_t& policyFlags) {
     if (wmActions & WM_ACTION_GO_TO_SLEEP) {
 #if DEBUG_INPUT_DISPATCHER_POLICY
-        LOGD("handleInterceptActions: Going to sleep.");
+        ALOGD("handleInterceptActions: Going to sleep.");
 #endif
         android_server_PowerManagerService_goToSleep(when);
     }
 
     if (wmActions & WM_ACTION_POKE_USER_ACTIVITY) {
 #if DEBUG_INPUT_DISPATCHER_POLICY
-        LOGD("handleInterceptActions: Poking user activity.");
+        ALOGD("handleInterceptActions: Poking user activity.");
 #endif
         android_server_PowerManagerService_userActivity(when, POWER_MANAGER_BUTTON_EVENT);
     }
@@ -845,7 +845,7 @@
         policyFlags |= POLICY_FLAG_PASS_TO_USER;
     } else {
 #if DEBUG_INPUT_DISPATCHER_POLICY
-        LOGD("handleInterceptActions: Not passing key to user.");
+        ALOGD("handleInterceptActions: Not passing key to user.");
 #endif
     }
 }
@@ -879,7 +879,7 @@
                 }
             }
         } else {
-            LOGE("Failed to obtain key event object for interceptKeyBeforeDispatching.");
+            ALOGE("Failed to obtain key event object for interceptKeyBeforeDispatching.");
         }
         env->DeleteLocalRef(inputWindowHandleObj);
     }
@@ -917,7 +917,7 @@
                 env->DeleteLocalRef(fallbackKeyEventObj);
             }
         } else {
-            LOGE("Failed to obtain key event object for dispatchUnhandledKey.");
+            ALOGE("Failed to obtain key event object for dispatchUnhandledKey.");
         }
         env->DeleteLocalRef(inputWindowHandleObj);
     }
@@ -958,7 +958,7 @@
 
 static bool checkInputManagerUnitialized(JNIEnv* env) {
     if (gNativeInputManager == NULL) {
-        LOGE("Input manager not initialized.");
+        ALOGE("Input manager not initialized.");
         jniThrowRuntimeException(env, "Input manager not initialized.");
         return true;
     }
@@ -971,7 +971,7 @@
         sp<Looper> looper = android_os_MessageQueue_getLooper(env, messageQueueObj);
         gNativeInputManager = new NativeInputManager(contextObj, callbacksObj, looper);
     } else {
-        LOGE("Input manager already initialized.");
+        ALOGE("Input manager already initialized.");
         jniThrowRuntimeException(env, "Input manager already initialized.");
     }
 }
@@ -1068,7 +1068,7 @@
 
 static void android_server_InputManager_handleInputChannelDisposed(JNIEnv* env,
         jobject inputChannelObj, const sp<InputChannel>& inputChannel, void* data) {
-    LOGW("Input channel object '%s' was disposed without first being unregistered with "
+    ALOGW("Input channel object '%s' was disposed without first being unregistered with "
             "the input manager!", inputChannel->getName().string());
 
     if (gNativeInputManager != NULL) {
diff --git a/services/jni/com_android_server_PowerManagerService.cpp b/services/jni/com_android_server_PowerManagerService.cpp
index a389c11..5005864 100644
--- a/services/jni/com_android_server_PowerManagerService.cpp
+++ b/services/jni/com_android_server_PowerManagerService.cpp
@@ -56,7 +56,7 @@
 
 static bool checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {
     if (env->ExceptionCheck()) {
-        LOGE("An exception was thrown by callback '%s'.", methodName);
+        ALOGE("An exception was thrown by callback '%s'.", methodName);
         LOGE_EX(env);
         env->ExceptionClear();
         return true;
diff --git a/services/jni/com_android_server_UsbDeviceManager.cpp b/services/jni/com_android_server_UsbDeviceManager.cpp
index 40f0dbd..0cd94b9 100644
--- a/services/jni/com_android_server_UsbDeviceManager.cpp
+++ b/services/jni/com_android_server_UsbDeviceManager.cpp
@@ -42,7 +42,7 @@
 
 static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {
     if (env->ExceptionCheck()) {
-        LOGE("An exception was thrown by callback '%s'.", methodName);
+        ALOGE("An exception was thrown by callback '%s'.", methodName);
         LOGE_EX(env);
         env->ExceptionClear();
     }
@@ -66,7 +66,7 @@
 {
     int fd = open(DRIVER_NAME, O_RDWR);
     if (fd < 0) {
-        LOGE("could not open %s", DRIVER_NAME);
+        ALOGE("could not open %s", DRIVER_NAME);
         return NULL;
     }
     jclass stringClass = env->FindClass("java/lang/String");
@@ -88,7 +88,7 @@
 {
     int fd = open(DRIVER_NAME, O_RDWR);
     if (fd < 0) {
-        LOGE("could not open %s", DRIVER_NAME);
+        ALOGE("could not open %s", DRIVER_NAME);
         return NULL;
     }
     jobject fileDescriptor = jniCreateFileDescriptor(env, fd);
@@ -103,7 +103,7 @@
 {
     int fd = open(DRIVER_NAME, O_RDWR);
     if (fd < 0) {
-        LOGE("could not open %s", DRIVER_NAME);
+        ALOGE("could not open %s", DRIVER_NAME);
         return false;
     }
     int result = ioctl(fd, ACCESSORY_IS_START_REQUESTED);
@@ -125,7 +125,7 @@
 {
     jclass clazz = env->FindClass("com/android/server/usb/UsbDeviceManager");
     if (clazz == NULL) {
-        LOGE("Can't find com/android/server/usb/UsbDeviceManager");
+        ALOGE("Can't find com/android/server/usb/UsbDeviceManager");
         return -1;
     }
 
diff --git a/services/jni/com_android_server_UsbHostManager.cpp b/services/jni/com_android_server_UsbHostManager.cpp
index f1abf56..d0a6cdf 100644
--- a/services/jni/com_android_server_UsbHostManager.cpp
+++ b/services/jni/com_android_server_UsbHostManager.cpp
@@ -45,7 +45,7 @@
 
 static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {
     if (env->ExceptionCheck()) {
-        LOGE("An exception was thrown by callback '%s'.", methodName);
+        ALOGE("An exception was thrown by callback '%s'.", methodName);
         LOGE_EX(env);
         env->ExceptionClear();
     }
@@ -57,7 +57,7 @@
 
     struct usb_device *device = usb_device_open(devname);
     if (!device) {
-        LOGE("usb_device_open failed\n");
+        ALOGE("usb_device_open failed\n");
         return 0;
     }
 
@@ -135,7 +135,7 @@
 {
     struct usb_host_context* context = usb_host_init();
     if (!context) {
-        LOGE("usb_host_init failed");
+        ALOGE("usb_host_init failed");
         return;
     }
     // this will never return so it is safe to pass thiz directly
@@ -175,17 +175,17 @@
 {
     jclass clazz = env->FindClass("com/android/server/usb/UsbHostManager");
     if (clazz == NULL) {
-        LOGE("Can't find com/android/server/usb/UsbHostManager");
+        ALOGE("Can't find com/android/server/usb/UsbHostManager");
         return -1;
     }
     method_usbDeviceAdded = env->GetMethodID(clazz, "usbDeviceAdded", "(Ljava/lang/String;IIIII[I[I)V");
     if (method_usbDeviceAdded == NULL) {
-        LOGE("Can't find usbDeviceAdded");
+        ALOGE("Can't find usbDeviceAdded");
         return -1;
     }
     method_usbDeviceRemoved = env->GetMethodID(clazz, "usbDeviceRemoved", "(Ljava/lang/String;)V");
     if (method_usbDeviceRemoved == NULL) {
-        LOGE("Can't find usbDeviceRemoved");
+        ALOGE("Can't find usbDeviceRemoved");
         return -1;
     }
 
diff --git a/services/jni/com_android_server_VibratorService.cpp b/services/jni/com_android_server_VibratorService.cpp
index 0912d43..2b3f74a 100644
--- a/services/jni/com_android_server_VibratorService.cpp
+++ b/services/jni/com_android_server_VibratorService.cpp
@@ -36,13 +36,13 @@
 
 static void vibratorOn(JNIEnv *env, jobject clazz, jlong timeout_ms)
 {
-    // LOGI("vibratorOn\n");
+    // ALOGI("vibratorOn\n");
     vibrator_on(timeout_ms);
 }
 
 static void vibratorOff(JNIEnv *env, jobject clazz)
 {
-    // LOGI("vibratorOff\n");
+    // ALOGI("vibratorOff\n");
     vibrator_off();
 }
 
diff --git a/services/jni/com_android_server_connectivity_Vpn.cpp b/services/jni/com_android_server_connectivity_Vpn.cpp
index d28a6b4..ab8c959 100644
--- a/services/jni/com_android_server_connectivity_Vpn.cpp
+++ b/services/jni/com_android_server_connectivity_Vpn.cpp
@@ -63,21 +63,21 @@
     // Allocate interface.
     ifr4.ifr_flags = IFF_TUN | IFF_NO_PI;
     if (ioctl(tun, TUNSETIFF, &ifr4)) {
-        LOGE("Cannot allocate TUN: %s", strerror(errno));
+        ALOGE("Cannot allocate TUN: %s", strerror(errno));
         goto error;
     }
 
     // Activate interface.
     ifr4.ifr_flags = IFF_UP;
     if (ioctl(inet4, SIOCSIFFLAGS, &ifr4)) {
-        LOGE("Cannot activate %s: %s", ifr4.ifr_name, strerror(errno));
+        ALOGE("Cannot activate %s: %s", ifr4.ifr_name, strerror(errno));
         goto error;
     }
 
     // Set MTU if it is specified.
     ifr4.ifr_mtu = mtu;
     if (mtu > 0 && ioctl(inet4, SIOCSIFMTU, &ifr4)) {
-        LOGE("Cannot set MTU on %s: %s", ifr4.ifr_name, strerror(errno));
+        ALOGE("Cannot set MTU on %s: %s", ifr4.ifr_name, strerror(errno));
         goto error;
     }
 
@@ -92,7 +92,7 @@
 {
     ifreq ifr4;
     if (ioctl(tun, TUNGETIFF, &ifr4)) {
-        LOGE("Cannot get interface name: %s", strerror(errno));
+        ALOGE("Cannot get interface name: %s", strerror(errno));
         return SYSTEM_ERROR;
     }
     strncpy(name, ifr4.ifr_name, IFNAMSIZ);
@@ -104,7 +104,7 @@
     ifreq ifr4;
     strncpy(ifr4.ifr_name, name, IFNAMSIZ);
     if (ioctl(inet4, SIOGIFINDEX, &ifr4)) {
-        LOGE("Cannot get index of %s: %s", name, strerror(errno));
+        ALOGE("Cannot get index of %s: %s", name, strerror(errno));
         return SYSTEM_ERROR;
     }
     return ifr4.ifr_ifindex;
@@ -171,16 +171,16 @@
                 break;
             }
         }
-        LOGD("Address added on %s: %s/%d", name, address, prefix);
+        ALOGD("Address added on %s: %s/%d", name, address, prefix);
         ++count;
     }
 
     if (count == BAD_ARGUMENT) {
-        LOGE("Invalid address: %s/%d", address, prefix);
+        ALOGE("Invalid address: %s/%d", address, prefix);
     } else if (count == SYSTEM_ERROR) {
-        LOGE("Cannot add address: %s/%d: %s", address, prefix, strerror(errno));
+        ALOGE("Cannot add address: %s/%d: %s", address, prefix, strerror(errno));
     } else if (*addresses) {
-        LOGE("Invalid address: %s", addresses);
+        ALOGE("Invalid address: %s", addresses);
         count = BAD_ARGUMENT;
     }
 
@@ -260,17 +260,17 @@
                 }
             }
         }
-        LOGD("Route added on %s: %s/%d", name, address, prefix);
+        ALOGD("Route added on %s: %s/%d", name, address, prefix);
         ++count;
     }
 
     if (count == BAD_ARGUMENT) {
-        LOGE("Invalid route: %s/%d", address, prefix);
+        ALOGE("Invalid route: %s/%d", address, prefix);
     } else if (count == SYSTEM_ERROR) {
-        LOGE("Cannot add route: %s/%d: %s",
+        ALOGE("Cannot add route: %s/%d: %s",
                 address, prefix, strerror(errno));
     } else if (*routes) {
-        LOGE("Invalid route: %s", routes);
+        ALOGE("Invalid route: %s", routes);
         count = BAD_ARGUMENT;
     }
 
@@ -284,7 +284,7 @@
     ifr4.ifr_flags = 0;
 
     if (ioctl(inet4, SIOCSIFFLAGS, &ifr4) && errno != ENODEV) {
-        LOGE("Cannot reset %s: %s", name, strerror(errno));
+        ALOGE("Cannot reset %s: %s", name, strerror(errno));
         return SYSTEM_ERROR;
     }
     return 0;
@@ -297,7 +297,7 @@
     ifr4.ifr_flags = 0;
 
     if (ioctl(inet4, SIOCGIFFLAGS, &ifr4) && errno != ENODEV) {
-        LOGE("Cannot check %s: %s", name, strerror(errno));
+        ALOGE("Cannot check %s: %s", name, strerror(errno));
     }
     return ifr4.ifr_flags;
 }
@@ -305,7 +305,7 @@
 static int bind_to_interface(int socket, const char *name)
 {
     if (setsockopt(socket, SOL_SOCKET, SO_BINDTODEVICE, name, strlen(name))) {
-        LOGE("Cannot bind socket to %s: %s", name, strerror(errno));
+        ALOGE("Cannot bind socket to %s: %s", name, strerror(errno));
         return SYSTEM_ERROR;
     }
     return 0;
diff --git a/services/jni/com_android_server_location_GpsLocationProvider.cpp b/services/jni/com_android_server_location_GpsLocationProvider.cpp
index c823da5..50bd46e 100755
--- a/services/jni/com_android_server_location_GpsLocationProvider.cpp
+++ b/services/jni/com_android_server_location_GpsLocationProvider.cpp
@@ -62,7 +62,7 @@
 
 static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {
     if (env->ExceptionCheck()) {
-        LOGE("An exception was thrown by callback '%s'.", methodName);
+        ALOGE("An exception was thrown by callback '%s'.", methodName);
         LOGE_EX(env);
         env->ExceptionClear();
     }
@@ -107,7 +107,7 @@
 
 static void set_capabilities_callback(uint32_t capabilities)
 {
-    LOGD("set_capabilities_callback: %ld\n", capabilities);
+    ALOGD("set_capabilities_callback: %ld\n", capabilities);
     JNIEnv* env = AndroidRuntime::getJNIEnv();
     env->CallVoidMethod(mCallbacksObj, method_setEngineCapabilities, capabilities);
     checkAndClearExceptionFromCallback(env, __FUNCTION__);
@@ -182,7 +182,7 @@
 
 static void gps_ni_notify_callback(GpsNiNotification *notification)
 {
-    LOGD("gps_ni_notify_callback\n");
+    ALOGD("gps_ni_notify_callback\n");
     JNIEnv* env = AndroidRuntime::getJNIEnv();
     jstring requestor_id = env->NewStringUTF(notification->requestor_id);
     jstring text = env->NewStringUTF(notification->text);
@@ -196,7 +196,7 @@
             notification->requestor_id_encoding,
             notification->text_encoding, extras);
     } else {
-        LOGE("out of memory in gps_ni_notify_callback\n");
+        ALOGE("out of memory in gps_ni_notify_callback\n");
     }
 
     if (requestor_id)
@@ -376,7 +376,7 @@
     AGpsRefLocation location;
 
     if (!sAGpsRilInterface) {
-        LOGE("no AGPS RIL interface in agps_set_reference_location_cellid");
+        ALOGE("no AGPS RIL interface in agps_set_reference_location_cellid");
         return;
     }
 
@@ -390,7 +390,7 @@
             location.u.cellID.cid = cid;
             break;
         default:
-            LOGE("Neither a GSM nor a UMTS cellid (%s:%d).",__FUNCTION__,__LINE__);
+            ALOGE("Neither a GSM nor a UMTS cellid (%s:%d).",__FUNCTION__,__LINE__);
             return;
             break;
     }
@@ -403,7 +403,7 @@
     size_t sz;
 
     if (!sAGpsRilInterface) {
-        LOGE("no AGPS RIL interface in send_ni_message");
+        ALOGE("no AGPS RIL interface in send_ni_message");
         return;
     }
     if (size < 0)
@@ -418,7 +418,7 @@
         jobject obj, jint type, jstring  setid_string)
 {
     if (!sAGpsRilInterface) {
-        LOGE("no AGPS RIL interface in agps_set_id");
+        ALOGE("no AGPS RIL interface in agps_set_id");
         return;
     }
 
@@ -463,7 +463,7 @@
         jbyteArray data, jint length)
 {
     if (!sGpsXtraInterface) {
-        LOGE("no XTRA interface in inject_xtra_data");
+        ALOGE("no XTRA interface in inject_xtra_data");
         return;
     }
 
@@ -475,7 +475,7 @@
 static void android_location_GpsLocationProvider_agps_data_conn_open(JNIEnv* env, jobject obj, jstring apn)
 {
     if (!sAGpsInterface) {
-        LOGE("no AGPS interface in agps_data_conn_open");
+        ALOGE("no AGPS interface in agps_data_conn_open");
         return;
     }
     if (apn == NULL) {
@@ -490,7 +490,7 @@
 static void android_location_GpsLocationProvider_agps_data_conn_closed(JNIEnv* env, jobject obj)
 {
     if (!sAGpsInterface) {
-        LOGE("no AGPS interface in agps_data_conn_open");
+        ALOGE("no AGPS interface in agps_data_conn_open");
         return;
     }
     sAGpsInterface->data_conn_closed();
@@ -499,7 +499,7 @@
 static void android_location_GpsLocationProvider_agps_data_conn_failed(JNIEnv* env, jobject obj)
 {
     if (!sAGpsInterface) {
-        LOGE("no AGPS interface in agps_data_conn_open");
+        ALOGE("no AGPS interface in agps_data_conn_open");
         return;
     }
     sAGpsInterface->data_conn_failed();
@@ -509,7 +509,7 @@
         jint type, jstring hostname, jint port)
 {
     if (!sAGpsInterface) {
-        LOGE("no AGPS interface in agps_data_conn_open");
+        ALOGE("no AGPS interface in agps_data_conn_open");
         return;
     }
     const char *c_hostname = env->GetStringUTFChars(hostname, NULL);
@@ -521,7 +521,7 @@
       jint notifId, jint response)
 {
     if (!sGpsNiInterface) {
-        LOGE("no NI interface in send_ni_response");
+        ALOGE("no NI interface in send_ni_response");
         return;
     }
 
diff --git a/services/jni/onload.cpp b/services/jni/onload.cpp
index 4178039..c7beb5f 100644
--- a/services/jni/onload.cpp
+++ b/services/jni/onload.cpp
@@ -43,10 +43,10 @@
     jint result = -1;
 
     if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
-        LOGE("GetEnv failed!");
+        ALOGE("GetEnv failed!");
         return result;
     }
-    LOG_ASSERT(env, "Could not retrieve the env!");
+    ALOG_ASSERT(env, "Could not retrieve the env!");
 
     register_android_server_PowerManagerService(env);
     register_android_server_InputApplicationHandle(env);
diff --git a/services/sensorservice/Fusion.cpp b/services/sensorservice/Fusion.cpp
index d76f19c..b724ce2 100644
--- a/services/sensorservice/Fusion.cpp
+++ b/services/sensorservice/Fusion.cpp
@@ -338,7 +338,7 @@
 
     if (!isPositiveSemidefinite(P[0][0], SYMMETRY_TOLERANCE) ||
         !isPositiveSemidefinite(P[1][1], SYMMETRY_TOLERANCE)) {
-        LOGW("Sensor fusion diverged; resetting state.");
+        ALOGW("Sensor fusion diverged; resetting state.");
         P = 0;
     }
 }
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp
index 7575ebd..2244a86 100644
--- a/services/sensorservice/SensorDevice.cpp
+++ b/services/sensorservice/SensorDevice.cpp
@@ -105,13 +105,13 @@
     status_t err = hw_get_module(SENSORS_HARDWARE_MODULE_ID,
             (hw_module_t const**)&mSensorModule);
 
-    LOGE_IF(err, "couldn't load %s module (%s)",
+    ALOGE_IF(err, "couldn't load %s module (%s)",
             SENSORS_HARDWARE_MODULE_ID, strerror(-err));
 
     if (mSensorModule) {
         err = sensors_open(&mSensorModule->common, &mSensorDevice);
 
-        LOGE_IF(err, "couldn't open device for module %s (%s)",
+        ALOGE_IF(err, "couldn't open device for module %s (%s)",
                 SENSORS_HARDWARE_MODULE_ID, strerror(-err));
 
         if (mSensorDevice) {
@@ -182,13 +182,13 @@
     Info& info( mActivationCount.editValueFor(handle) );
 
 
-    LOGD_IF(DEBUG_CONNECTIONS,
+    ALOGD_IF(DEBUG_CONNECTIONS,
             "SensorDevice::activate: ident=%p, handle=0x%08x, enabled=%d, count=%d",
             ident, handle, enabled, info.rates.size());
 
     if (enabled) {
         Mutex::Autolock _l(mLock);
-        LOGD_IF(DEBUG_CONNECTIONS, "... index=%ld",
+        ALOGD_IF(DEBUG_CONNECTIONS, "... index=%ld",
                 info.rates.indexOfKey(ident));
 
         if (info.rates.indexOfKey(ident) < 0) {
@@ -201,7 +201,7 @@
         }
     } else {
         Mutex::Autolock _l(mLock);
-        LOGD_IF(DEBUG_CONNECTIONS, "... index=%ld",
+        ALOGD_IF(DEBUG_CONNECTIONS, "... index=%ld",
                 info.rates.indexOfKey(ident));
 
         ssize_t idx = info.rates.removeItem(ident);
@@ -215,11 +215,11 @@
     }
 
     if (actuateHardware) {
-        LOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w");
+        ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w");
 
         err = mSensorDevice->activate(mSensorDevice, handle, enabled);
         if (enabled) {
-            LOGE_IF(err, "Error activating sensor %d (%s)", handle, strerror(-err));
+            ALOGE_IF(err, "Error activating sensor %d (%s)", handle, strerror(-err));
             if (err == 0) {
                 BatteryService::getInstance().enableSensor(handle);
             }
@@ -256,7 +256,7 @@
 {
     ssize_t index = rates.indexOfKey(ident);
     if (index < 0) {
-        LOGE("Info::setDelayForIdent(ident=%p, ns=%lld) failed (%s)",
+        ALOGE("Info::setDelayForIdent(ident=%p, ns=%lld) failed (%s)",
                 ident, ns, strerror(-index));
         return BAD_INDEX;
     }
diff --git a/services/sensorservice/SensorFusion.cpp b/services/sensorservice/SensorFusion.cpp
index 518a1bb7..d23906d 100644
--- a/services/sensorservice/SensorFusion.cpp
+++ b/services/sensorservice/SensorFusion.cpp
@@ -76,7 +76,7 @@
 
 status_t SensorFusion::activate(void* ident, bool enabled) {
 
-    LOGD_IF(DEBUG_CONNECTIONS,
+    ALOGD_IF(DEBUG_CONNECTIONS,
             "SensorFusion::activate(ident=%p, enabled=%d)",
             ident, enabled);
 
diff --git a/services/sensorservice/SensorInterface.cpp b/services/sensorservice/SensorInterface.cpp
index be8eaff..468aa61 100644
--- a/services/sensorservice/SensorInterface.cpp
+++ b/services/sensorservice/SensorInterface.cpp
@@ -34,7 +34,7 @@
     : mSensorDevice(SensorDevice::getInstance()),
       mSensor(&sensor)
 {
-    LOGI("%s", sensor.name);
+    ALOGI("%s", sensor.name);
 }
 
 HardwareSensor::~HardwareSensor() {
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 6202143..8659025 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -65,7 +65,7 @@
 
 void SensorService::onFirstRef()
 {
-    LOGD("nuSensorService starting...");
+    ALOGD("nuSensorService starting...");
 
     SensorDevice& dev(SensorDevice::getInstance());
 
@@ -222,7 +222,7 @@
 
 bool SensorService::threadLoop()
 {
-    LOGD("nuSensorService thread starting...");
+    ALOGD("nuSensorService thread starting...");
 
     const size_t numEventMax = 16 * (1 + mVirtualSensorList.size());
     sensors_event_t buffer[numEventMax];
@@ -234,7 +234,7 @@
     do {
         count = device.poll(buffer, numEventMax);
         if (count<0) {
-            LOGE("sensor poll failed (%s)", strerror(-count));
+            ALOGE("sensor poll failed (%s)", strerror(-count));
             break;
         }
 
@@ -286,7 +286,7 @@
         }
     } while (count >= 0 || Thread::exitPending());
 
-    LOGW("Exiting SensorService::threadLoop => aborting...");
+    ALOGW("Exiting SensorService::threadLoop => aborting...");
     abort();
     return false;
 }
@@ -363,25 +363,25 @@
     Mutex::Autolock _l(mLock);
     const wp<SensorEventConnection> connection(c);
     size_t size = mActiveSensors.size();
-    LOGD_IF(DEBUG_CONNECTIONS, "%d active sensors", size);
+    ALOGD_IF(DEBUG_CONNECTIONS, "%d active sensors", size);
     for (size_t i=0 ; i<size ; ) {
         int handle = mActiveSensors.keyAt(i);
         if (c->hasSensor(handle)) {
-            LOGD_IF(DEBUG_CONNECTIONS, "%i: disabling handle=0x%08x", i, handle);
+            ALOGD_IF(DEBUG_CONNECTIONS, "%i: disabling handle=0x%08x", i, handle);
             SensorInterface* sensor = mSensorMap.valueFor( handle );
-            LOGE_IF(!sensor, "mSensorMap[handle=0x%08x] is null!", handle);
+            ALOGE_IF(!sensor, "mSensorMap[handle=0x%08x] is null!", handle);
             if (sensor) {
                 sensor->activate(c, false);
             }
         }
         SensorRecord* rec = mActiveSensors.valueAt(i);
-        LOGE_IF(!rec, "mActiveSensors[%d] is null (handle=0x%08x)!", i, handle);
-        LOGD_IF(DEBUG_CONNECTIONS,
+        ALOGE_IF(!rec, "mActiveSensors[%d] is null (handle=0x%08x)!", i, handle);
+        ALOGD_IF(DEBUG_CONNECTIONS,
                 "removing connection %p for sensor[%d].handle=0x%08x",
                 c, i, handle);
 
         if (rec && rec->removeConnection(connection)) {
-            LOGD_IF(DEBUG_CONNECTIONS, "... and it was the last connection");
+            ALOGD_IF(DEBUG_CONNECTIONS, "... and it was the last connection");
             mActiveSensors.removeItemsAt(i, 1);
             mActiveVirtualSensors.removeItem(handle);
             delete rec;
@@ -528,7 +528,7 @@
 
 SensorService::SensorEventConnection::~SensorEventConnection()
 {
-    LOGD_IF(DEBUG_CONNECTIONS, "~SensorEventConnection(%p)", this);
+    ALOGD_IF(DEBUG_CONNECTIONS, "~SensorEventConnection(%p)", this);
     mService->cleanupConnection(this);
 }
 
@@ -594,11 +594,11 @@
     if (size == -EAGAIN) {
         // the destination doesn't accept events anymore, it's probably
         // full. For now, we just drop the events on the floor.
-        //LOGW("dropping %d events on the floor", count);
+        //ALOGW("dropping %d events on the floor", count);
         return size;
     }
 
-    //LOGE_IF(size<0, "dropping %d events on the floor (%s)",
+    //ALOGE_IF(size<0, "dropping %d events on the floor (%s)",
     //        count, strerror(-size));
 
     return size < 0 ? status_t(size) : status_t(NO_ERROR);
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
index f94d321..61096e5 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
+++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
@@ -53,7 +53,7 @@
         GLenum error = glGetError();
         if (error == GL_NO_ERROR)
             break;
-        LOGE("GL error 0x%04x", int(error));
+        ALOGE("GL error 0x%04x", int(error));
     } while(true);
 }
 
@@ -62,7 +62,7 @@
 {
     EGLint error = eglGetError();
     if (error && error != EGL_SUCCESS) {
-        LOGE("%s: EGL error 0x%04x (%s)",
+        ALOGE("%s: EGL error 0x%04x (%s)",
                 token, int(error), EGLUtils::strerror(error));
     }
 }
@@ -130,7 +130,7 @@
     mNativeWindow = new FramebufferNativeWindow();
     framebuffer_device_t const * fbDev = mNativeWindow->getDevice();
     if (!fbDev) {
-        LOGE("Display subsystem failed to initialize. check logs. exiting...");
+        ALOGE("Display subsystem failed to initialize. check logs. exiting...");
         exit(0);
     }
 
@@ -170,7 +170,7 @@
     char property[PROPERTY_VALUE_MAX];
     if (property_get("debug.sf.hw", property, NULL) > 0) {
         if (atoi(property) == 0) {
-            LOGW("H/W composition disabled");
+            ALOGW("H/W composition disabled");
             attribs[2] = EGL_CONFIG_CAVEAT;
             attribs[3] = EGL_SLOW_CONFIG;
         }
@@ -185,7 +185,7 @@
 
     EGLConfig config = NULL;
     err = selectConfigForPixelFormat(display, attribs, format, &config);
-    LOGE_IF(err, "couldn't find an EGLConfig matching the screen format");
+    ALOGE_IF(err, "couldn't find an EGLConfig matching the screen format");
     
     EGLint r,g,b,a;
     eglGetConfigAttrib(display, config, EGL_RED_SIZE,   &r);
@@ -228,7 +228,7 @@
      */
     if (property_get("qemu.sf.lcd_density", property, NULL) <= 0) {
         if (property_get("ro.sf.lcd_density", property, NULL) <= 0) {
-            LOGW("ro.sf.lcd_density not defined, using 160 dpi by default.");
+            ALOGW("ro.sf.lcd_density not defined, using 160 dpi by default.");
             strcpy(property, "160");
         }
     } else {
@@ -267,7 +267,7 @@
 
     result = eglMakeCurrent(display, surface, surface, context);
     if (!result) {
-        LOGE("Couldn't create a working GLES context. check logs. exiting...");
+        ALOGE("Couldn't create a working GLES context. check logs. exiting...");
         exit(0);
     }
 
@@ -284,22 +284,22 @@
     glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
     glGetIntegerv(GL_MAX_VIEWPORT_DIMS, mMaxViewportDims);
 
-    LOGI("EGL informations:");
-    LOGI("# of configs : %d", numConfigs);
-    LOGI("vendor    : %s", extensions.getEglVendor());
-    LOGI("version   : %s", extensions.getEglVersion());
-    LOGI("extensions: %s", extensions.getEglExtension());
-    LOGI("Client API: %s", eglQueryString(display, EGL_CLIENT_APIS)?:"Not Supported");
-    LOGI("EGLSurface: %d-%d-%d-%d, config=%p", r, g, b, a, config);
+    ALOGI("EGL informations:");
+    ALOGI("# of configs : %d", numConfigs);
+    ALOGI("vendor    : %s", extensions.getEglVendor());
+    ALOGI("version   : %s", extensions.getEglVersion());
+    ALOGI("extensions: %s", extensions.getEglExtension());
+    ALOGI("Client API: %s", eglQueryString(display, EGL_CLIENT_APIS)?:"Not Supported");
+    ALOGI("EGLSurface: %d-%d-%d-%d, config=%p", r, g, b, a, config);
 
-    LOGI("OpenGL informations:");
-    LOGI("vendor    : %s", extensions.getVendor());
-    LOGI("renderer  : %s", extensions.getRenderer());
-    LOGI("version   : %s", extensions.getVersion());
-    LOGI("extensions: %s", extensions.getExtension());
-    LOGI("GL_MAX_TEXTURE_SIZE = %d", mMaxTextureSize);
-    LOGI("GL_MAX_VIEWPORT_DIMS = %d x %d", mMaxViewportDims[0], mMaxViewportDims[1]);
-    LOGI("flags = %08x", mFlags);
+    ALOGI("OpenGL informations:");
+    ALOGI("vendor    : %s", extensions.getVendor());
+    ALOGI("renderer  : %s", extensions.getRenderer());
+    ALOGI("version   : %s", extensions.getVersion());
+    ALOGI("extensions: %s", extensions.getExtension());
+    ALOGI("GL_MAX_TEXTURE_SIZE = %d", mMaxTextureSize);
+    ALOGI("GL_MAX_VIEWPORT_DIMS = %d x %d", mMaxViewportDims[0], mMaxViewportDims[1]);
+    ALOGI("flags = %08x", mFlags);
 
     // Unbind the context from this thread
     eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp
index 3b7c09e..f4afeea 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp
+++ b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp
@@ -76,10 +76,10 @@
       err = read(fd, &buf, 1);
     } while (err < 0 && errno == EINTR);
     close(fd);
-    LOGW_IF(err<0, "ANDROID_WAIT_FOR_FB_SLEEP failed (%s)", strerror(errno));
+    ALOGW_IF(err<0, "ANDROID_WAIT_FOR_FB_SLEEP failed (%s)", strerror(errno));
     if (err >= 0) {
         sp<SurfaceFlinger> flinger = mFlinger.promote();
-        LOGD("About to give-up screen, flinger = %p", flinger.get());
+        ALOGD("About to give-up screen, flinger = %p", flinger.get());
         if (flinger != 0) {
             mBarrier.close();
             flinger->screenReleased(0);
@@ -91,10 +91,10 @@
       err = read(fd, &buf, 1);
     } while (err < 0 && errno == EINTR);
     close(fd);
-    LOGW_IF(err<0, "ANDROID_WAIT_FOR_FB_WAKE failed (%s)", strerror(errno));
+    ALOGW_IF(err<0, "ANDROID_WAIT_FOR_FB_WAKE failed (%s)", strerror(errno));
     if (err >= 0) {
         sp<SurfaceFlinger> flinger = mFlinger.promote();
-        LOGD("Screen about to return, flinger = %p", flinger.get());
+        ALOGD("Screen about to return, flinger = %p", flinger.get());
         if (flinger != 0)
             flinger->screenAcquired(0);
     }
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index be9b226..f17bf43 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -44,10 +44,10 @@
       mDpy(EGL_NO_DISPLAY), mSur(EGL_NO_SURFACE)
 {
     int err = hw_get_module(HWC_HARDWARE_MODULE_ID, &mModule);
-    LOGW_IF(err, "%s module not found", HWC_HARDWARE_MODULE_ID);
+    ALOGW_IF(err, "%s module not found", HWC_HARDWARE_MODULE_ID);
     if (err == 0) {
         err = hwc_open(mModule, &mHwc);
-        LOGE_IF(err, "%s device failed to initialize (%s)",
+        ALOGE_IF(err, "%s device failed to initialize (%s)",
                 HWC_HARDWARE_COMPOSER, strerror(-err));
         if (err == 0) {
             if (mHwc->registerProcs) {
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index d3b0dbf..d4c4b1f 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -350,7 +350,7 @@
 
     if (sizeChanged) {
         // the size changed, we need to ask our client to request a new buffer
-        LOGD_IF(DEBUG_RESIZE,
+        ALOGD_IF(DEBUG_RESIZE,
                 "doTransaction: "
                 "resize (layer=%p), requested (%dx%d), drawing (%d,%d), "
                 "scalingMode=%d",
@@ -485,7 +485,7 @@
                 recomputeVisibleRegions = true;
             }
 
-            LOGD_IF(DEBUG_RESIZE,
+            ALOGD_IF(DEBUG_RESIZE,
                     "lockPageFlip : "
                     "       (layer=%p), buffer (%ux%u, tr=%02x), "
                     "requested (%dx%d)",
diff --git a/services/surfaceflinger/LayerScreenshot.cpp b/services/surfaceflinger/LayerScreenshot.cpp
index 68e6660..c127fa6 100644
--- a/services/surfaceflinger/LayerScreenshot.cpp
+++ b/services/surfaceflinger/LayerScreenshot.cpp
@@ -93,7 +93,7 @@
             // we're going from hidden to visible
             status_t err = captureLocked();
             if (err != NO_ERROR) {
-                LOGW("createScreenshotSurface failed (%s)", strerror(-err));
+                ALOGW("createScreenshotSurface failed (%s)", strerror(-err));
             }
         }
     } else if (curr.flags & ISurfaceComposer::eLayerHidden) {
diff --git a/services/surfaceflinger/MessageQueue.cpp b/services/surfaceflinger/MessageQueue.cpp
index aebe1b8..9441019 100644
--- a/services/surfaceflinger/MessageQueue.cpp
+++ b/services/surfaceflinger/MessageQueue.cpp
@@ -111,7 +111,7 @@
             }
 
             if (nextEventTime >= 0) {
-                //LOGD("nextEventTime = %lld ms", nextEventTime);
+                //ALOGD("nextEventTime = %lld ms", nextEventTime);
                 if (nextEventTime > 0) {
                     // we're about to wait, flush the binder command buffer
                     IPCThreadState::self()->flushCommands();
@@ -121,7 +121,7 @@
                     }
                 }
             } else {
-                //LOGD("going to wait");
+                //ALOGD("going to wait");
                 // we're about to wait, flush the binder command buffer
                 IPCThreadState::self()->flushCommands();
                 mCondition.wait(mLock);
@@ -165,7 +165,7 @@
     message->when = systemTime() + relTime;
     mMessages.insert(message);
     
-    //LOGD("MessageQueue::queueMessage time = %lld ms", message->when);
+    //ALOGD("MessageQueue::queueMessage time = %lld ms", message->when);
     //dumpLocked(message);
 
     mCondition.signal();
@@ -185,7 +185,7 @@
     int c = 0;
     while (cur != end) {
         const char tick = (*cur == message) ? '>' : ' ';
-        LOGD("%c %d: msg{.what=%08x, when=%lld}",
+        ALOGD("%c %d: msg{.what=%08x, when=%lld}",
                 tick, c, (*cur)->what, (*cur)->when);
         ++cur;
         c++;
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 24bd2a6..98277b4 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -106,7 +106,7 @@
 
 void SurfaceFlinger::init()
 {
-    LOGI("SurfaceFlinger is starting");
+    ALOGI("SurfaceFlinger is starting");
 
     // debugging stuff...
     char value[PROPERTY_VALUE_MAX];
@@ -123,9 +123,9 @@
         DdmConnection::start(getServiceName());
     }
 
-    LOGI_IF(mDebugRegion,       "showupdates enabled");
-    LOGI_IF(mDebugBackground,   "showbackground enabled");
-    LOGI_IF(mDebugDDMS,         "DDMS debugging enabled");
+    ALOGI_IF(mDebugRegion,       "showupdates enabled");
+    ALOGI_IF(mDebugBackground,   "showbackground enabled");
+    ALOGI_IF(mDebugDDMS,         "DDMS debugging enabled");
 }
 
 SurfaceFlinger::~SurfaceFlinger()
@@ -157,7 +157,7 @@
 
 const GraphicPlane& SurfaceFlinger::graphicPlane(int dpy) const
 {
-    LOGE_IF(uint32_t(dpy) >= DISPLAY_COUNT, "Invalid DisplayID %d", dpy);
+    ALOGE_IF(uint32_t(dpy) >= DISPLAY_COUNT, "Invalid DisplayID %d", dpy);
     const GraphicPlane& plane(mGraphicPlanes[dpy]);
     return plane;
 }
@@ -172,7 +172,7 @@
 {
     const nsecs_t now = systemTime();
     const nsecs_t duration = now - mBootTime;
-    LOGI("Boot is finished (%ld ms)", long(ns2ms(duration)) );
+    ALOGI("Boot is finished (%ld ms)", long(ns2ms(duration)) );
     mBootFinished = true;
 
     // wait patiently for the window manager death
@@ -211,7 +211,7 @@
 
 status_t SurfaceFlinger::readyToRun()
 {
-    LOGI(   "SurfaceFlinger's main thread ready to run. "
+    ALOGI(   "SurfaceFlinger's main thread ready to run. "
             "Initializing graphics H/W...");
 
     // we only support one display currently
@@ -227,10 +227,10 @@
     // create the shared control-block
     mServerHeap = new MemoryHeapBase(4096,
             MemoryHeapBase::READ_ONLY, "SurfaceFlinger read-only heap");
-    LOGE_IF(mServerHeap==0, "can't create shared memory dealer");
+    ALOGE_IF(mServerHeap==0, "can't create shared memory dealer");
 
     mServerCblk = static_cast<surface_flinger_cblk_t*>(mServerHeap->getBase());
-    LOGE_IF(mServerCblk==0, "can't get to shared control block's address");
+    ALOGE_IF(mServerCblk==0, "can't get to shared control block's address");
 
     new(mServerCblk) surface_flinger_cblk_t;
 
@@ -454,7 +454,7 @@
 {
     // this should never happen. we do the flip anyways so we don't
     // risk to cause a deadlock with hwc
-    LOGW_IF(mSwapRegion.isEmpty(), "mSwapRegion is empty");
+    ALOGW_IF(mSwapRegion.isEmpty(), "mSwapRegion is empty");
     const DisplayHardware& hw(graphicPlane(0).displayHardware());
     const nsecs_t now = systemTime();
     mDebugInSwapBuffers = now;
@@ -870,7 +870,7 @@
     const Vector< sp<LayerBase> >& layers(mVisibleLayersSortedByZ);
     size_t count = layers.size();
 
-    LOGE_IF(hwc.getNumLayers() != count,
+    ALOGE_IF(hwc.getNumLayers() != count,
             "HAL number of layers (%d) doesn't match surfaceflinger (%d)",
             hwc.getNumLayers(), count);
 
@@ -889,7 +889,7 @@
     }
     const size_t fbLayerCount = hwc.getLayerCount(HWC_FRAMEBUFFER);
     status_t err = hwc.prepare();
-    LOGE_IF(err, "HWComposer::prepare failed (%s)", strerror(-err));
+    ALOGE_IF(err, "HWComposer::prepare failed (%s)", strerror(-err));
 
     if (err == NO_ERROR) {
         // what's happening here is tricky.
@@ -1216,7 +1216,7 @@
             mCurrentState.orientation = orientation;
             transactionFlags |= eTransactionNeeded;
         } else if (orientation != eOrientationUnchanged) {
-            LOGW("setTransactionState: ignoring unrecognized orientation: %d",
+            ALOGW("setTransactionState: ignoring unrecognized orientation: %d",
                     orientation);
         }
     }
@@ -1242,7 +1242,7 @@
             if (CC_UNLIKELY(err != NO_ERROR)) {
                 // just in case something goes wrong in SF, return to the
                 // called after a few seconds.
-                LOGW_IF(err == TIMED_OUT, "closeGlobalTransaction timed out!");
+                ALOGW_IF(err == TIMED_OUT, "closeGlobalTransaction timed out!");
                 mTransationPending = false;
                 break;
             }
@@ -1281,12 +1281,12 @@
     sp<ISurface> surfaceHandle;
 
     if (int32_t(w|h) < 0) {
-        LOGE("createSurface() failed, w or h is negative (w=%d, h=%d)",
+        ALOGE("createSurface() failed, w or h is negative (w=%d, h=%d)",
                 int(w), int(h));
         return surfaceHandle;
     }
 
-    //LOGD("createSurface for pid %d (%d x %d)", pid, w, h);
+    //ALOGD("createSurface for pid %d (%d x %d)", pid, w, h);
     sp<Layer> normalLayer;
     switch (flags & eFXSurfaceMask) {
         case eFXSurfaceNormal:
@@ -1353,7 +1353,7 @@
     sp<Layer> layer = new Layer(this, display, client);
     status_t err = layer->setBuffers(w, h, format, flags);
     if (LIKELY(err != NO_ERROR)) {
-        LOGE("createNormalSurfaceLocked() failed (%s)", strerror(-err));
+        ALOGE("createNormalSurfaceLocked() failed (%s)", strerror(-err));
         layer.clear();
     }
     return layer;
@@ -1411,10 +1411,10 @@
             // removed already, which means it is in the purgatory,
             // and need to be removed from there.
             ssize_t idx = mLayerPurgatory.remove(l);
-            LOGE_IF(idx < 0,
+            ALOGE_IF(idx < 0,
                     "layer=%p is not in the purgatory list", l.get());
         }
-        LOGE_IF(err<0 && err != NAME_NOT_FOUND,
+        ALOGE_IF(err<0 && err != NAME_NOT_FOUND,
                 "error removing layer=%p (%s)", l.get(), strerror(-err));
     }
     return err;
@@ -1640,7 +1640,7 @@
             const int uid = ipc->getCallingUid();
             if ((uid != AID_GRAPHICS) &&
                     !PermissionCache::checkPermission(sAccessSurfaceFlinger, pid, uid)) {
-                LOGE("Permission Denial: "
+                ALOGE("Permission Denial: "
                         "can't access SurfaceFlinger pid=%d, uid=%d", pid, uid);
                 return PERMISSION_DENIED;
             }
@@ -1654,7 +1654,7 @@
             const int uid = ipc->getCallingUid();
             if ((uid != AID_GRAPHICS) &&
                     !PermissionCache::checkPermission(sReadFramebuffer, pid, uid)) {
-                LOGE("Permission Denial: "
+                ALOGE("Permission Denial: "
                         "can't read framebuffer pid=%d, uid=%d", pid, uid);
                 return PERMISSION_DENIED;
             }
@@ -1669,7 +1669,7 @@
             IPCThreadState* ipc = IPCThreadState::self();
             const int pid = ipc->getCallingPid();
             const int uid = ipc->getCallingUid();
-            LOGE("Permission Denial: "
+            ALOGE("Permission Denial: "
                     "can't access SurfaceFlinger pid=%d, uid=%d", pid, uid);
             return PERMISSION_DENIED;
         }
@@ -2268,7 +2268,7 @@
     sh = (!sh) ? hw_h : sh;
     const size_t size = sw * sh * 4;
 
-    //LOGD("screenshot: sw=%d, sh=%d, minZ=%d, maxZ=%d",
+    //ALOGD("screenshot: sw=%d, sh=%d, minZ=%d, maxZ=%d",
     //        sw, sh, minLayerZ, maxLayerZ);
 
     // make sure to clear all GL error flags
@@ -2359,7 +2359,7 @@
 
     hw.compositionComplete();
 
-    // LOGD("screenshot: result = %s", result<0 ? strerror(result) : "OK");
+    // ALOGD("screenshot: result = %s", result<0 ? strerror(result) : "OK");
 
     return result;
 }
@@ -2486,7 +2486,7 @@
     wp<LayerBaseClient> layer(mLayers.valueFor(i));
     if (layer != 0) {
         lbc = layer.promote();
-        LOGE_IF(lbc==0, "getLayerUser(name=%d) is dead", int(i));
+        ALOGE_IF(lbc==0, "getLayerUser(name=%d) is dead", int(i));
     }
     return lbc;
 }
@@ -2504,7 +2504,7 @@
          // we're called from a different process, do the real check
          if (!PermissionCache::checkCallingPermission(sAccessSurfaceFlinger))
          {
-             LOGE("Permission Denial: "
+             ALOGE("Permission Denial: "
                      "can't openGlobalTransaction pid=%d, uid=%d", pid, uid);
              return PERMISSION_DENIED;
          }
@@ -2576,7 +2576,7 @@
         if (err == NO_MEMORY) {
             GraphicBuffer::dumpAllocationsToSystemLog();
         }
-        LOGE("GraphicBufferAlloc::createGraphicBuffer(w=%d, h=%d) "
+        ALOGE("GraphicBufferAlloc::createGraphicBuffer(w=%d, h=%d) "
              "failed (%s), handle=%p",
                 w, h, strerror(-err), graphicBuffer->handle);
         return 0;
diff --git a/services/surfaceflinger/SurfaceTextureLayer.cpp b/services/surfaceflinger/SurfaceTextureLayer.cpp
index 5020e00..259b937 100644
--- a/services/surfaceflinger/SurfaceTextureLayer.cpp
+++ b/services/surfaceflinger/SurfaceTextureLayer.cpp
@@ -37,7 +37,7 @@
 
 status_t SurfaceTextureLayer::setDefaultBufferSize(uint32_t w, uint32_t h)
 {
-    //LOGD("%s, w=%u, h=%u", __PRETTY_FUNCTION__, w, h);
+    //ALOGD("%s, w=%u, h=%u", __PRETTY_FUNCTION__, w, h);
     return SurfaceTexture::setDefaultBufferSize(w, h);
 }
 
@@ -73,7 +73,7 @@
         if (format == 0)
             format = mDefaultFormat;
         uint32_t effectiveUsage = layer->getEffectiveUsage(usage);
-        //LOGD("%s, w=%u, h=%u, format=%u, usage=%08x, effectiveUsage=%08x",
+        //ALOGD("%s, w=%u, h=%u, format=%u, usage=%08x, effectiveUsage=%08x",
         //        __PRETTY_FUNCTION__, w, h, format, usage, effectiveUsage);
         res = SurfaceTexture::dequeueBuffer(buf, w, h, format, effectiveUsage);
     }
diff --git a/services/surfaceflinger/Transform.cpp b/services/surfaceflinger/Transform.cpp
index ba345ce..ca3fa6e 100644
--- a/services/surfaceflinger/Transform.cpp
+++ b/services/surfaceflinger/Transform.cpp
@@ -344,10 +344,10 @@
     if (mType&TRANSLATE)
         type.append("TRANSLATE ");
 
-    LOGD("%s 0x%08x (%s, %s)", name, mType, flags.string(), type.string());
-    LOGD("%.4f  %.4f  %.4f", m[0][0], m[1][0], m[2][0]);
-    LOGD("%.4f  %.4f  %.4f", m[0][1], m[1][1], m[2][1]);
-    LOGD("%.4f  %.4f  %.4f", m[0][2], m[1][2], m[2][2]);
+    ALOGD("%s 0x%08x (%s, %s)", name, mType, flags.string(), type.string());
+    ALOGD("%.4f  %.4f  %.4f", m[0][0], m[1][0], m[2][0]);
+    ALOGD("%.4f  %.4f  %.4f", m[0][1], m[1][1], m[2][1]);
+    ALOGD("%.4f  %.4f  %.4f", m[0][2], m[1][2], m[2][2]);
 }
 
 // ---------------------------------------------------------------------------
diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp
index afafd8a..396a3fd 100644
--- a/services/surfaceflinger/tests/Transaction_test.cpp
+++ b/services/surfaceflinger/tests/Transaction_test.cpp
@@ -204,11 +204,11 @@
         sc->checkPixel(145, 145,  63,  63, 195);
     }
 
-    LOGD("resizing");
+    ALOGD("resizing");
     SurfaceComposerClient::openGlobalTransaction();
     ASSERT_EQ(NO_ERROR, mFGSurfaceControl->setSize(128, 128));
     SurfaceComposerClient::closeGlobalTransaction(true);
-    LOGD("resized");
+    ALOGD("resized");
     {
         // This should not reflect the new size or color because SurfaceFlinger
         // has not yet received a buffer of the correct size.
@@ -219,10 +219,10 @@
         sc->checkPixel(145, 145,  63,  63, 195);
     }
 
-    LOGD("drawing");
+    ALOGD("drawing");
     fillSurfaceRGBA8(mFGSurfaceControl, 63, 195, 63);
     waitForPostedBuffers();
-    LOGD("drawn");
+    ALOGD("drawn");
     {
         // This should reflect the new size and the new color.
         SCOPED_TRACE("after redraw");
diff --git a/tools/aapt/ZipEntry.cpp b/tools/aapt/ZipEntry.cpp
index a0b54c2..b575988 100644
--- a/tools/aapt/ZipEntry.cpp
+++ b/tools/aapt/ZipEntry.cpp
@@ -42,12 +42,12 @@
     long posn;
     bool hasDD;
 
-    //LOGV("initFromCDE ---\n");
+    //ALOGV("initFromCDE ---\n");
 
     /* read the CDE */
     result = mCDE.read(fp);
     if (result != NO_ERROR) {
-        LOGD("mCDE.read failed\n");
+        ALOGD("mCDE.read failed\n");
         return result;
     }
 
@@ -56,14 +56,14 @@
     /* using the info in the CDE, go load up the LFH */
     posn = ftell(fp);
     if (fseek(fp, mCDE.mLocalHeaderRelOffset, SEEK_SET) != 0) {
-        LOGD("local header seek failed (%ld)\n",
+        ALOGD("local header seek failed (%ld)\n",
             mCDE.mLocalHeaderRelOffset);
         return UNKNOWN_ERROR;
     }
 
     result = mLFH.read(fp);
     if (result != NO_ERROR) {
-        LOGD("mLFH.read failed\n");
+        ALOGD("mLFH.read failed\n");
         return result;
     }
 
@@ -81,7 +81,7 @@
     hasDD = (mLFH.mGPBitFlag & kUsesDataDescr) != 0;
     if (hasDD) {
         // do something clever
-        //LOGD("+++ has data descriptor\n");
+        //ALOGD("+++ has data descriptor\n");
     }
 
     /*
@@ -90,7 +90,7 @@
      * prefer the CDE values.)
      */
     if (!hasDD && !compareHeaders()) {
-        LOGW("warning: header mismatch\n");
+        ALOGW("warning: header mismatch\n");
         // keep going?
     }
 
@@ -200,7 +200,7 @@
     if (padding <= 0)
         return INVALID_OPERATION;
 
-    //LOGI("HEY: adding %d pad bytes to existing %d in %s\n",
+    //ALOGI("HEY: adding %d pad bytes to existing %d in %s\n",
     //    padding, mLFH.mExtraFieldLength, mCDE.mFileName);
 
     if (mLFH.mExtraFieldLength > 0) {
@@ -280,50 +280,50 @@
 bool ZipEntry::compareHeaders(void) const
 {
     if (mCDE.mVersionToExtract != mLFH.mVersionToExtract) {
-        LOGV("cmp: VersionToExtract\n");
+        ALOGV("cmp: VersionToExtract\n");
         return false;
     }
     if (mCDE.mGPBitFlag != mLFH.mGPBitFlag) {
-        LOGV("cmp: GPBitFlag\n");
+        ALOGV("cmp: GPBitFlag\n");
         return false;
     }
     if (mCDE.mCompressionMethod != mLFH.mCompressionMethod) {
-        LOGV("cmp: CompressionMethod\n");
+        ALOGV("cmp: CompressionMethod\n");
         return false;
     }
     if (mCDE.mLastModFileTime != mLFH.mLastModFileTime) {
-        LOGV("cmp: LastModFileTime\n");
+        ALOGV("cmp: LastModFileTime\n");
         return false;
     }
     if (mCDE.mLastModFileDate != mLFH.mLastModFileDate) {
-        LOGV("cmp: LastModFileDate\n");
+        ALOGV("cmp: LastModFileDate\n");
         return false;
     }
     if (mCDE.mCRC32 != mLFH.mCRC32) {
-        LOGV("cmp: CRC32\n");
+        ALOGV("cmp: CRC32\n");
         return false;
     }
     if (mCDE.mCompressedSize != mLFH.mCompressedSize) {
-        LOGV("cmp: CompressedSize\n");
+        ALOGV("cmp: CompressedSize\n");
         return false;
     }
     if (mCDE.mUncompressedSize != mLFH.mUncompressedSize) {
-        LOGV("cmp: UncompressedSize\n");
+        ALOGV("cmp: UncompressedSize\n");
         return false;
     }
     if (mCDE.mFileNameLength != mLFH.mFileNameLength) {
-        LOGV("cmp: FileNameLength\n");
+        ALOGV("cmp: FileNameLength\n");
         return false;
     }
 #if 0       // this seems to be used for padding, not real data
     if (mCDE.mExtraFieldLength != mLFH.mExtraFieldLength) {
-        LOGV("cmp: ExtraFieldLength\n");
+        ALOGV("cmp: ExtraFieldLength\n");
         return false;
     }
 #endif
     if (mCDE.mFileName != NULL) {
         if (strcmp((char*) mCDE.mFileName, (char*) mLFH.mFileName) != 0) {
-            LOGV("cmp: FileName\n");
+            ALOGV("cmp: FileName\n");
             return false;
         }
     }
@@ -413,7 +413,7 @@
     }
 
     if (ZipEntry::getLongLE(&buf[0x00]) != kSignature) {
-        LOGD("whoops: didn't find expected signature\n");
+        ALOGD("whoops: didn't find expected signature\n");
         result = UNKNOWN_ERROR;
         goto bail;
     }
@@ -506,17 +506,17 @@
  */
 void ZipEntry::LocalFileHeader::dump(void) const
 {
-    LOGD(" LocalFileHeader contents:\n");
-    LOGD("  versToExt=%u gpBits=0x%04x compression=%u\n",
+    ALOGD(" LocalFileHeader contents:\n");
+    ALOGD("  versToExt=%u gpBits=0x%04x compression=%u\n",
         mVersionToExtract, mGPBitFlag, mCompressionMethod);
-    LOGD("  modTime=0x%04x modDate=0x%04x crc32=0x%08lx\n",
+    ALOGD("  modTime=0x%04x modDate=0x%04x crc32=0x%08lx\n",
         mLastModFileTime, mLastModFileDate, mCRC32);
-    LOGD("  compressedSize=%lu uncompressedSize=%lu\n",
+    ALOGD("  compressedSize=%lu uncompressedSize=%lu\n",
         mCompressedSize, mUncompressedSize);
-    LOGD("  filenameLen=%u extraLen=%u\n",
+    ALOGD("  filenameLen=%u extraLen=%u\n",
         mFileNameLength, mExtraFieldLength);
     if (mFileName != NULL)
-        LOGD("  filename: '%s'\n", mFileName);
+        ALOGD("  filename: '%s'\n", mFileName);
 }
 
 
@@ -549,7 +549,7 @@
     }
 
     if (ZipEntry::getLongLE(&buf[0x00]) != kSignature) {
-        LOGD("Whoops: didn't find expected signature\n");
+        ALOGD("Whoops: didn't find expected signature\n");
         result = UNKNOWN_ERROR;
         goto bail;
     }
@@ -675,22 +675,22 @@
  */
 void ZipEntry::CentralDirEntry::dump(void) const
 {
-    LOGD(" CentralDirEntry contents:\n");
-    LOGD("  versMadeBy=%u versToExt=%u gpBits=0x%04x compression=%u\n",
+    ALOGD(" CentralDirEntry contents:\n");
+    ALOGD("  versMadeBy=%u versToExt=%u gpBits=0x%04x compression=%u\n",
         mVersionMadeBy, mVersionToExtract, mGPBitFlag, mCompressionMethod);
-    LOGD("  modTime=0x%04x modDate=0x%04x crc32=0x%08lx\n",
+    ALOGD("  modTime=0x%04x modDate=0x%04x crc32=0x%08lx\n",
         mLastModFileTime, mLastModFileDate, mCRC32);
-    LOGD("  compressedSize=%lu uncompressedSize=%lu\n",
+    ALOGD("  compressedSize=%lu uncompressedSize=%lu\n",
         mCompressedSize, mUncompressedSize);
-    LOGD("  filenameLen=%u extraLen=%u commentLen=%u\n",
+    ALOGD("  filenameLen=%u extraLen=%u commentLen=%u\n",
         mFileNameLength, mExtraFieldLength, mFileCommentLength);
-    LOGD("  diskNumStart=%u intAttr=0x%04x extAttr=0x%08lx relOffset=%lu\n",
+    ALOGD("  diskNumStart=%u intAttr=0x%04x extAttr=0x%08lx relOffset=%lu\n",
         mDiskNumberStart, mInternalAttrs, mExternalAttrs,
         mLocalHeaderRelOffset);
 
     if (mFileName != NULL)
-        LOGD("  filename: '%s'\n", mFileName);
+        ALOGD("  filename: '%s'\n", mFileName);
     if (mFileComment != NULL)
-        LOGD("  comment: '%s'\n", mFileComment);
+        ALOGD("  comment: '%s'\n", mFileComment);
 }
 
diff --git a/tools/aapt/ZipFile.cpp b/tools/aapt/ZipFile.cpp
index 62c9383..0705be3 100644
--- a/tools/aapt/ZipFile.cpp
+++ b/tools/aapt/ZipFile.cpp
@@ -78,7 +78,7 @@
         newArchive = (access(zipFileName, F_OK) != 0);
         if (!(flags & kOpenCreate) && newArchive) {
             /* not creating, must already exist */
-            LOGD("File %s does not exist", zipFileName);
+            ALOGD("File %s does not exist", zipFileName);
             return NAME_NOT_FOUND;
         }
     }
@@ -96,7 +96,7 @@
     mZipFp = fopen(zipFileName, openflags);
     if (mZipFp == NULL) {
         int err = errno;
-        LOGD("fopen failed: %d\n", err);
+        ALOGD("fopen failed: %d\n", err);
         return errnoToStatus(err);
     }
 
@@ -215,14 +215,14 @@
 
     /* too small to be a ZIP archive? */
     if (fileLength < EndOfCentralDir::kEOCDLen) {
-        LOGD("Length is %ld -- too small\n", (long)fileLength);
+        ALOGD("Length is %ld -- too small\n", (long)fileLength);
         result = INVALID_OPERATION;
         goto bail;
     }
 
     buf = new unsigned char[EndOfCentralDir::kMaxEOCDSearch];
     if (buf == NULL) {
-        LOGD("Failure allocating %d bytes for EOCD search",
+        ALOGD("Failure allocating %d bytes for EOCD search",
              EndOfCentralDir::kMaxEOCDSearch);
         result = NO_MEMORY;
         goto bail;
@@ -236,14 +236,14 @@
         readAmount = (long) fileLength;
     }
     if (fseek(mZipFp, seekStart, SEEK_SET) != 0) {
-        LOGD("Failure seeking to end of zip at %ld", (long) seekStart);
+        ALOGD("Failure seeking to end of zip at %ld", (long) seekStart);
         result = UNKNOWN_ERROR;
         goto bail;
     }
 
     /* read the last part of the file into the buffer */
     if (fread(buf, 1, readAmount, mZipFp) != (size_t) readAmount) {
-        LOGD("short file? wanted %ld\n", readAmount);
+        ALOGD("short file? wanted %ld\n", readAmount);
         result = UNKNOWN_ERROR;
         goto bail;
     }
@@ -253,12 +253,12 @@
         if (buf[i] == 0x50 &&
             ZipEntry::getLongLE(&buf[i]) == EndOfCentralDir::kSignature)
         {
-            LOGV("+++ Found EOCD at buf+%d\n", i);
+            ALOGV("+++ Found EOCD at buf+%d\n", i);
             break;
         }
     }
     if (i < 0) {
-        LOGD("EOCD not found, not Zip\n");
+        ALOGD("EOCD not found, not Zip\n");
         result = INVALID_OPERATION;
         goto bail;
     }
@@ -266,7 +266,7 @@
     /* extract eocd values */
     result = mEOCD.readBuf(buf + i, readAmount - i);
     if (result != NO_ERROR) {
-        LOGD("Failure reading %ld bytes of EOCD values", readAmount - i);
+        ALOGD("Failure reading %ld bytes of EOCD values", readAmount - i);
         goto bail;
     }
     //mEOCD.dump();
@@ -274,7 +274,7 @@
     if (mEOCD.mDiskNumber != 0 || mEOCD.mDiskWithCentralDir != 0 ||
         mEOCD.mNumEntries != mEOCD.mTotalNumEntries)
     {
-        LOGD("Archive spanning not supported\n");
+        ALOGD("Archive spanning not supported\n");
         result = INVALID_OPERATION;
         goto bail;
     }
@@ -294,7 +294,7 @@
      * we're hoping to preserve.
      */
     if (fseek(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0) {
-        LOGD("Failure seeking to central dir offset %ld\n",
+        ALOGD("Failure seeking to central dir offset %ld\n",
              mEOCD.mCentralDirOffset);
         result = UNKNOWN_ERROR;
         goto bail;
@@ -303,14 +303,14 @@
     /*
      * Loop through and read the central dir entries.
      */
-    LOGV("Scanning %d entries...\n", mEOCD.mTotalNumEntries);
+    ALOGV("Scanning %d entries...\n", mEOCD.mTotalNumEntries);
     int entry;
     for (entry = 0; entry < mEOCD.mTotalNumEntries; entry++) {
         ZipEntry* pEntry = new ZipEntry;
 
         result = pEntry->initFromCDE(mZipFp);
         if (result != NO_ERROR) {
-            LOGD("initFromCDE failed\n");
+            ALOGD("initFromCDE failed\n");
             delete pEntry;
             goto bail;
         }
@@ -325,16 +325,16 @@
     {
         unsigned char checkBuf[4];
         if (fread(checkBuf, 1, 4, mZipFp) != 4) {
-            LOGD("EOCD check read failed\n");
+            ALOGD("EOCD check read failed\n");
             result = INVALID_OPERATION;
             goto bail;
         }
         if (ZipEntry::getLongLE(checkBuf) != EndOfCentralDir::kSignature) {
-            LOGD("EOCD read check failed\n");
+            ALOGD("EOCD read check failed\n");
             result = UNKNOWN_ERROR;
             goto bail;
         }
-        LOGV("+++ EOCD read check passed\n");
+        ALOGV("+++ EOCD read check passed\n");
     }
 
 bail:
@@ -416,7 +416,7 @@
             bool failed = false;
             result = compressFpToFp(mZipFp, inputFp, data, size, &crc);
             if (result != NO_ERROR) {
-                LOGD("compression failed, storing\n");
+                ALOGD("compression failed, storing\n");
                 failed = true;
             } else {
                 /*
@@ -427,7 +427,7 @@
                 long src = inputFp ? ftell(inputFp) : size;
                 long dst = ftell(mZipFp) - startPosn;
                 if (dst + (dst / 10) > src) {
-                    LOGD("insufficient compression (src=%ld dst=%ld), storing\n",
+                    ALOGD("insufficient compression (src=%ld dst=%ld), storing\n",
                         src, dst);
                     failed = true;
                 }
@@ -449,7 +449,7 @@
             }
             if (result != NO_ERROR) {
                 // don't need to truncate; happens in CDE rewrite
-                LOGD("failed copying data in\n");
+                ALOGD("failed copying data in\n");
                 goto bail;
             }
         }
@@ -468,14 +468,14 @@
         scanResult = ZipUtils::examineGzip(inputFp, &method, &uncompressedLen,
                         &compressedLen, &crc);
         if (!scanResult || method != ZipEntry::kCompressDeflated) {
-            LOGD("this isn't a deflated gzip file?");
+            ALOGD("this isn't a deflated gzip file?");
             result = UNKNOWN_ERROR;
             goto bail;
         }
 
         result = copyPartialFpToFp(mZipFp, inputFp, compressedLen, NULL);
         if (result != NO_ERROR) {
-            LOGD("failed copying gzip data in\n");
+            ALOGD("failed copying gzip data in\n");
             goto bail;
         }
     } else {
@@ -603,7 +603,7 @@
     if (copyPartialFpToFp(mZipFp, pSourceZip->mZipFp, copyLen, NULL)
         != NO_ERROR)
     {
-        LOGW("copy of '%s' failed\n", pEntry->mCDE.mFileName);
+        ALOGW("copy of '%s' failed\n", pEntry->mCDE.mFileName);
         result = UNKNOWN_ERROR;
         goto bail;
     }
@@ -660,7 +660,7 @@
         *pCRC32 = crc32(*pCRC32, tmpBuf, count);
 
         if (fwrite(tmpBuf, 1, count, dstFp) != count) {
-            LOGD("fwrite %d bytes failed\n", (int) count);
+            ALOGD("fwrite %d bytes failed\n", (int) count);
             return UNKNOWN_ERROR;
         }
     }
@@ -682,7 +682,7 @@
     if (size > 0) {
         *pCRC32 = crc32(*pCRC32, (const unsigned char*)data, size);
         if (fwrite(data, 1, size, dstFp) != size) {
-            LOGD("fwrite %d bytes failed\n", (int) size);
+            ALOGD("fwrite %d bytes failed\n", (int) size);
             return UNKNOWN_ERROR;
         }
     }
@@ -716,7 +716,7 @@
 
         count = fread(tmpBuf, 1, readSize, srcFp);
         if ((long) count != readSize) {     // error or unexpected EOF
-            LOGD("fread %d bytes failed\n", (int) readSize);
+            ALOGD("fread %d bytes failed\n", (int) readSize);
             return UNKNOWN_ERROR;
         }
 
@@ -724,7 +724,7 @@
             *pCRC32 = crc32(*pCRC32, tmpBuf, count);
 
         if (fwrite(tmpBuf, 1, count, dstFp) != count) {
-            LOGD("fwrite %d bytes failed\n", (int) count);
+            ALOGD("fwrite %d bytes failed\n", (int) count);
             return UNKNOWN_ERROR;
         }
 
@@ -780,10 +780,10 @@
     if (zerr != Z_OK) {
         result = UNKNOWN_ERROR;
         if (zerr == Z_VERSION_ERROR) {
-            LOGE("Installed zlib is not compatible with linked version (%s)\n",
+            ALOGE("Installed zlib is not compatible with linked version (%s)\n",
                 ZLIB_VERSION);
         } else {
-            LOGD("Call to deflateInit2 failed (zerr=%d)\n", zerr);
+            ALOGD("Call to deflateInit2 failed (zerr=%d)\n", zerr);
         }
         goto bail;
     }
@@ -799,7 +799,7 @@
 
         /* only read if the input buffer is empty */
         if (zstream.avail_in == 0 && !atEof) {
-            LOGV("+++ reading %d bytes\n", (int)kBufSize);
+            ALOGV("+++ reading %d bytes\n", (int)kBufSize);
             if (data) {
                 getSize = size > kBufSize ? kBufSize : size;
                 memcpy(inBuf, data, getSize);
@@ -808,12 +808,12 @@
             } else {
                 getSize = fread(inBuf, 1, kBufSize, srcFp);
                 if (ferror(srcFp)) {
-                    LOGD("deflate read failed (errno=%d)\n", errno);
+                    ALOGD("deflate read failed (errno=%d)\n", errno);
                     goto z_bail;
                 }
             }
             if (getSize < kBufSize) {
-                LOGV("+++  got %d bytes, EOF reached\n",
+                ALOGV("+++  got %d bytes, EOF reached\n",
                     (int)getSize);
                 atEof = true;
             }
@@ -831,7 +831,7 @@
 
         zerr = deflate(&zstream, flush);
         if (zerr != Z_OK && zerr != Z_STREAM_END) {
-            LOGD("zlib deflate call failed (zerr=%d)\n", zerr);
+            ALOGD("zlib deflate call failed (zerr=%d)\n", zerr);
             result = UNKNOWN_ERROR;
             goto z_bail;
         }
@@ -840,11 +840,11 @@
         if (zstream.avail_out == 0 ||
             (zerr == Z_STREAM_END && zstream.avail_out != (uInt) kBufSize))
         {
-            LOGV("+++ writing %d bytes\n", (int) (zstream.next_out - outBuf));
+            ALOGV("+++ writing %d bytes\n", (int) (zstream.next_out - outBuf));
             if (fwrite(outBuf, 1, zstream.next_out - outBuf, dstFp) !=
                 (size_t)(zstream.next_out - outBuf))
             {
-                LOGD("write %d failed in deflate\n",
+                ALOGD("write %d failed in deflate\n",
                     (int) (zstream.next_out - outBuf));
                 goto z_bail;
             }
@@ -931,7 +931,7 @@
      * of wasted space at the end of the file.  Remove it now.
      */
     if (ftruncate(fileno(mZipFp), ftell(mZipFp)) != 0) {
-        LOGW("ftruncate failed %ld: %s\n", ftell(mZipFp), strerror(errno));
+        ALOGW("ftruncate failed %ld: %s\n", ftell(mZipFp), strerror(errno));
         // not fatal
     }
 
@@ -1019,7 +1019,7 @@
                         pEntry->getLFHOffset(), span);
             if (result != NO_ERROR) {
                 /* this is why you use a temp file */
-                LOGE("error during crunch - archive is toast\n");
+                ALOGE("error during crunch - archive is toast\n");
                 return result;
             }
 
@@ -1061,23 +1061,23 @@
                 getSize = n;
 
             if (fseek(fp, (long) src, SEEK_SET) != 0) {
-                LOGD("filemove src seek %ld failed\n", (long) src);
+                ALOGD("filemove src seek %ld failed\n", (long) src);
                 return UNKNOWN_ERROR;
             }
 
             if (fread(readBuf, 1, getSize, fp) != getSize) {
-                LOGD("filemove read %ld off=%ld failed\n",
+                ALOGD("filemove read %ld off=%ld failed\n",
                     (long) getSize, (long) src);
                 return UNKNOWN_ERROR;
             }
 
             if (fseek(fp, (long) dst, SEEK_SET) != 0) {
-                LOGD("filemove dst seek %ld failed\n", (long) dst);
+                ALOGD("filemove dst seek %ld failed\n", (long) dst);
                 return UNKNOWN_ERROR;
             }
 
             if (fwrite(readBuf, 1, getSize, fp) != getSize) {
-                LOGD("filemove write %ld off=%ld failed\n",
+                ALOGD("filemove write %ld off=%ld failed\n",
                     (long) getSize, (long) dst);
                 return UNKNOWN_ERROR;
             }
@@ -1104,7 +1104,7 @@
     struct stat sb;
 
     if (fstat(fd, &sb) < 0) {
-        LOGD("HEY: fstat on fd %d failed\n", fd);
+        ALOGD("HEY: fstat on fd %d failed\n", fd);
         return (time_t) -1;
     }
 
@@ -1129,7 +1129,7 @@
     int fd;
     fd = dup(fileno(mZipFp));
     if (fd < 0) {
-        LOGD("didn't work, errno=%d\n", errno);
+        ALOGD("didn't work, errno=%d\n", errno);
     }
 
     return fd;
@@ -1224,7 +1224,7 @@
 
     if (len < kEOCDLen) {
         /* looks like ZIP file got truncated */
-        LOGD(" Zip EOCD: expected >= %d bytes, found %d\n",
+        ALOGD(" Zip EOCD: expected >= %d bytes, found %d\n",
             kEOCDLen, len);
         return INVALID_OPERATION;
     }
@@ -1245,7 +1245,7 @@
 
     if (mCommentLen > 0) {
         if (kEOCDLen + mCommentLen > len) {
-            LOGD("EOCD(%d) + comment(%d) exceeds len (%d)\n",
+            ALOGD("EOCD(%d) + comment(%d) exceeds len (%d)\n",
                 kEOCDLen, mCommentLen, len);
             return UNKNOWN_ERROR;
         }
@@ -1288,10 +1288,10 @@
  */
 void ZipFile::EndOfCentralDir::dump(void) const
 {
-    LOGD(" EndOfCentralDir contents:\n");
-    LOGD("  diskNum=%u diskWCD=%u numEnt=%u totalNumEnt=%u\n",
+    ALOGD(" EndOfCentralDir contents:\n");
+    ALOGD("  diskNum=%u diskWCD=%u numEnt=%u totalNumEnt=%u\n",
         mDiskNumber, mDiskWithCentralDir, mNumEntries, mTotalNumEntries);
-    LOGD("  centDirSize=%lu centDirOff=%lu commentLen=%u\n",
+    ALOGD("  centDirSize=%lu centDirOff=%lu commentLen=%u\n",
         mCentralDirSize, mCentralDirOffset, mCommentLen);
 }
 
diff --git a/voip/jni/rtp/AudioGroup.cpp b/voip/jni/rtp/AudioGroup.cpp
index 459756d..4db5738 100644
--- a/voip/jni/rtp/AudioGroup.cpp
+++ b/voip/jni/rtp/AudioGroup.cpp
@@ -159,7 +159,7 @@
     close(mSocket);
     delete mCodec;
     delete [] mBuffer;
-    LOGD("stream[%d] is dead", mSocket);
+    ALOGD("stream[%d] is dead", mSocket);
 }
 
 bool AudioStream::set(int mode, int socket, sockaddr_storage *remote,
@@ -218,7 +218,7 @@
         }
     }
 
-    LOGD("stream[%d] is configured as %s %dkHz %dms mode %d", mSocket,
+    ALOGD("stream[%d] is configured as %s %dkHz %dms mode %d", mSocket,
         (codec ? codec->name : "RAW"), mSampleRate, mInterval, mMode);
     return true;
 }
@@ -269,7 +269,7 @@
         mTick += skipped * mInterval;
         mSequence += skipped;
         mTimestamp += skipped * mSampleCount;
-        LOGV("stream[%d] skips %d packets", mSocket, skipped);
+        ALOGV("stream[%d] skips %d packets", mSocket, skipped);
     }
 
     tick = mTick;
@@ -334,7 +334,7 @@
         memset(samples, 0, sizeof(samples));
 
         if (mMode != RECEIVE_ONLY) {
-            LOGV("stream[%d] no data", mSocket);
+            ALOGV("stream[%d] no data", mSocket);
         }
     }
 
@@ -350,7 +350,7 @@
     buffer[2] = mSsrc;
     int length = mCodec->encode(&buffer[3], samples);
     if (length <= 0) {
-        LOGV("stream[%d] encoder error", mSocket);
+        ALOGV("stream[%d] encoder error", mSocket);
         return;
     }
     sendto(mSocket, buffer, length + 12, MSG_DONTWAIT, (sockaddr *)&mRemote,
@@ -386,7 +386,7 @@
         mLatencyScore = score;
         mLatencyTimer = tick;
     } else if (tick - mLatencyTimer >= MEASURE_PERIOD) {
-        LOGV("stream[%d] reduces latency of %dms", mSocket, mLatencyScore);
+        ALOGV("stream[%d] reduces latency of %dms", mSocket, mLatencyScore);
         mBufferTail -= mLatencyScore;
         mLatencyScore = -1;
     }
@@ -394,7 +394,7 @@
     int count = (BUFFER_SIZE - (mBufferTail - mBufferHead)) * mSampleRate;
     if (count < mSampleCount) {
         // Buffer overflow. Drop the packet.
-        LOGV("stream[%d] buffer overflow", mSocket);
+        ALOGV("stream[%d] buffer overflow", mSocket);
         recv(mSocket, &c, 1, MSG_DONTWAIT);
         return;
     }
@@ -417,7 +417,7 @@
         // reliable but at least they can be used to identify duplicates?
         if (length < 12 || length > (int)sizeof(buffer) ||
             (ntohl(*(uint32_t *)buffer) & 0xC07F0000) != mCodecMagic) {
-            LOGV("stream[%d] malformed packet", mSocket);
+            ALOGV("stream[%d] malformed packet", mSocket);
             return;
         }
         int offset = 12 + ((buffer[0] & 0x0F) << 2);
@@ -438,13 +438,13 @@
         count = length;
     }
     if (count <= 0) {
-        LOGV("stream[%d] decoder error", mSocket);
+        ALOGV("stream[%d] decoder error", mSocket);
         return;
     }
 
     if (tick - mBufferTail > 0) {
         // Buffer underrun. Reset the jitter buffer.
-        LOGV("stream[%d] buffer underrun", mSocket);
+        ALOGV("stream[%d] buffer underrun", mSocket);
         if (mBufferTail - mBufferHead <= 0) {
             mBufferHead = tick + mInterval;
             mBufferTail = mBufferHead;
@@ -510,7 +510,7 @@
         bool start()
         {
             if (run("Network", ANDROID_PRIORITY_AUDIO) != NO_ERROR) {
-                LOGE("cannot start network thread");
+                ALOGE("cannot start network thread");
                 return false;
             }
             return true;
@@ -530,7 +530,7 @@
         bool start()
         {
             if (run("Device", ANDROID_PRIORITY_AUDIO) != NO_ERROR) {
-                LOGE("cannot start device thread");
+                ALOGE("cannot start device thread");
                 return false;
             }
             return true;
@@ -566,14 +566,14 @@
         delete mChain;
         mChain = next;
     }
-    LOGD("group[%d] is dead", mDeviceSocket);
+    ALOGD("group[%d] is dead", mDeviceSocket);
 }
 
 bool AudioGroup::set(int sampleRate, int sampleCount)
 {
     mEventQueue = epoll_create(2);
     if (mEventQueue == -1) {
-        LOGE("epoll_create: %s", strerror(errno));
+        ALOGE("epoll_create: %s", strerror(errno));
         return false;
     }
 
@@ -583,7 +583,7 @@
     // Create device socket.
     int pair[2];
     if (socketpair(AF_UNIX, SOCK_DGRAM, 0, pair)) {
-        LOGE("socketpair: %s", strerror(errno));
+        ALOGE("socketpair: %s", strerror(errno));
         return false;
     }
     mDeviceSocket = pair[0];
@@ -593,7 +593,7 @@
     if (!mChain->set(AudioStream::NORMAL, pair[1], NULL, NULL,
         sampleRate, sampleCount, -1, -1)) {
         close(pair[1]);
-        LOGE("cannot initialize device stream");
+        ALOGE("cannot initialize device stream");
         return false;
     }
 
@@ -602,7 +602,7 @@
     tv.tv_sec = 0;
     tv.tv_usec = 1000 * sampleCount / sampleRate * 500;
     if (setsockopt(pair[0], SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv))) {
-        LOGE("setsockopt: %s", strerror(errno));
+        ALOGE("setsockopt: %s", strerror(errno));
         return false;
     }
 
@@ -611,12 +611,12 @@
     event.events = EPOLLIN;
     event.data.ptr = mChain;
     if (epoll_ctl(mEventQueue, EPOLL_CTL_ADD, pair[1], &event)) {
-        LOGE("epoll_ctl: %s", strerror(errno));
+        ALOGE("epoll_ctl: %s", strerror(errno));
         return false;
     }
 
     // Anything else?
-    LOGD("stream[%d] joins group[%d]", pair[1], pair[0]);
+    ALOGD("stream[%d] joins group[%d]", pair[1], pair[0]);
     return true;
 }
 
@@ -639,7 +639,7 @@
     }
 
     mDeviceThread->requestExitAndWait();
-    LOGD("group[%d] switches from mode %d to %d", mDeviceSocket, mMode, mode);
+    ALOGD("group[%d] switches from mode %d to %d", mDeviceSocket, mMode, mode);
     mMode = mode;
     return (mode == ON_HOLD) || mDeviceThread->start();
 }
@@ -675,7 +675,7 @@
     event.events = EPOLLIN;
     event.data.ptr = stream;
     if (epoll_ctl(mEventQueue, EPOLL_CTL_ADD, stream->mSocket, &event)) {
-        LOGE("epoll_ctl: %s", strerror(errno));
+        ALOGE("epoll_ctl: %s", strerror(errno));
         return false;
     }
 
@@ -687,7 +687,7 @@
         return false;
     }
 
-    LOGD("stream[%d] joins group[%d]", stream->mSocket, mDeviceSocket);
+    ALOGD("stream[%d] joins group[%d]", stream->mSocket, mDeviceSocket);
     return true;
 }
 
@@ -699,11 +699,11 @@
         AudioStream *target = stream->mNext;
         if (target->mSocket == socket) {
             if (epoll_ctl(mEventQueue, EPOLL_CTL_DEL, socket, NULL)) {
-                LOGE("epoll_ctl: %s", strerror(errno));
+                ALOGE("epoll_ctl: %s", strerror(errno));
                 return false;
             }
             stream->mNext = target->mNext;
-            LOGD("stream[%d] leaves group[%d]", socket, mDeviceSocket);
+            ALOGD("stream[%d] leaves group[%d]", socket, mDeviceSocket);
             delete target;
             break;
         }
@@ -749,7 +749,7 @@
     epoll_event events[count];
     count = epoll_wait(mGroup->mEventQueue, events, count, deadline);
     if (count == -1) {
-        LOGE("epoll_wait: %s", strerror(errno));
+        ALOGE("epoll_wait: %s", strerror(errno));
         return false;
     }
     for (int i = 0; i < count; ++i) {
@@ -792,10 +792,10 @@
         sampleRate) != NO_ERROR || output <= 0 ||
         AudioRecord::getMinFrameCount(&input, sampleRate,
         AUDIO_FORMAT_PCM_16_BIT, 1) != NO_ERROR || input <= 0) {
-        LOGE("cannot compute frame count");
+        ALOGE("cannot compute frame count");
         return false;
     }
-    LOGD("reported frame count: output %d, input %d", output, input);
+    ALOGD("reported frame count: output %d, input %d", output, input);
 
     if (output < sampleCount * 2) {
         output = sampleCount * 2;
@@ -803,7 +803,7 @@
     if (input < sampleCount * 2) {
         input = sampleCount * 2;
     }
-    LOGD("adjusted frame count: output %d, input %d", output, input);
+    ALOGD("adjusted frame count: output %d, input %d", output, input);
 
     // Initialize AudioTrack and AudioRecord.
     AudioTrack track;
@@ -812,10 +812,10 @@
         AUDIO_CHANNEL_OUT_MONO, output) != NO_ERROR || record.set(
         AUDIO_SOURCE_VOICE_COMMUNICATION, sampleRate, AUDIO_FORMAT_PCM_16_BIT,
         AUDIO_CHANNEL_IN_MONO, input) != NO_ERROR) {
-        LOGE("cannot initialize audio device");
+        ALOGE("cannot initialize audio device");
         return false;
     }
-    LOGD("latency: output %d, input %d", track.latency(), record.latency());
+    ALOGD("latency: output %d, input %d", track.latency(), record.latency());
 
     // Give device socket a reasonable buffer size.
     setsockopt(deviceSocket, SOL_SOCKET, SO_RCVBUF, &output, sizeof(output));
@@ -884,7 +884,7 @@
                     toWrite -= buffer.frameCount;
                     track.releaseBuffer(&buffer);
                 } else if (status != TIMED_OUT && status != WOULD_BLOCK) {
-                    LOGE("cannot write to AudioTrack");
+                    ALOGE("cannot write to AudioTrack");
                     goto exit;
                 }
             }
@@ -900,20 +900,20 @@
                     toRead -= buffer.frameCount;
                     record.releaseBuffer(&buffer);
                 } else if (status != TIMED_OUT && status != WOULD_BLOCK) {
-                    LOGE("cannot read from AudioRecord");
+                    ALOGE("cannot read from AudioRecord");
                     goto exit;
                 }
             }
         }
 
         if (chances <= 0) {
-            LOGW("device loop timeout");
+            ALOGW("device loop timeout");
             while (recv(deviceSocket, &c, 1, MSG_DONTWAIT) == 1);
         }
 
         if (mode != MUTED) {
             if (echo != NULL) {
-                LOGV("echo->run()");
+                ALOGV("echo->run()");
                 echo->run(output, input);
             }
             send(deviceSocket, input, sizeof(input), MSG_DONTWAIT);
@@ -1051,7 +1051,7 @@
 {
     gRandom = open("/dev/urandom", O_RDONLY);
     if (gRandom == -1) {
-        LOGE("urandom: %s", strerror(errno));
+        ALOGE("urandom: %s", strerror(errno));
         return -1;
     }
 
@@ -1060,7 +1060,7 @@
         (gNative = env->GetFieldID(clazz, "mNative", "I")) == NULL ||
         (gMode = env->GetFieldID(clazz, "mMode", "I")) == NULL ||
         env->RegisterNatives(clazz, gMethods, NELEM(gMethods)) < 0) {
-        LOGE("JNI registration failed");
+        ALOGE("JNI registration failed");
         return -1;
     }
     return 0;
diff --git a/voip/jni/rtp/EchoSuppressor.cpp b/voip/jni/rtp/EchoSuppressor.cpp
index 6127d3c..e223136 100644
--- a/voip/jni/rtp/EchoSuppressor.cpp
+++ b/voip/jni/rtp/EchoSuppressor.cpp
@@ -177,7 +177,7 @@
             }
         }
     }
-    //LOGI("corr^2 %.5f, var %8.0f %8.0f, latency %d", corr2, varX, varY,
+    //ALOGI("corr^2 %.5f, var %8.0f %8.0f, latency %d", corr2, varX, varY,
     //        latency * mScale);
 
     // Do echo suppression.
diff --git a/voip/jni/rtp/RtpStream.cpp b/voip/jni/rtp/RtpStream.cpp
index f5efc17..6540099 100644
--- a/voip/jni/rtp/RtpStream.cpp
+++ b/voip/jni/rtp/RtpStream.cpp
@@ -116,7 +116,7 @@
     if ((clazz = env->FindClass("android/net/rtp/RtpStream")) == NULL ||
         (gNative = env->GetFieldID(clazz, "mNative", "I")) == NULL ||
         env->RegisterNatives(clazz, gMethods, NELEM(gMethods)) < 0) {
-        LOGE("JNI registration failed");
+        ALOGE("JNI registration failed");
         return -1;
     }
     return 0;
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 82abe3a..4539c6b 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -1621,6 +1621,10 @@
     private void handleNetworkDisconnect() {
         if (DBG) log("Stopping DHCP and clearing IP");
 
+        /* In case we were in middle of DHCP operation
+           restore back powermode */
+        handlePostDhcpSetup();
+
         /*
          * stop DHCP
          */