Merge "Now utilizing ability to bind constants. Fixing small copy/paste typo." into graphics-dev
diff --git a/api/15.txt b/api/15.txt
index ddf5baf..68fb4bc 100644
--- a/api/15.txt
+++ b/api/15.txt
@@ -6611,6 +6611,7 @@
     method public int getDimensionPixelSize(int) throws android.content.res.Resources.NotFoundException;
     method public android.util.DisplayMetrics getDisplayMetrics();
     method public android.graphics.drawable.Drawable getDrawable(int) throws android.content.res.Resources.NotFoundException;
+    method public android.graphics.drawable.Drawable getDrawableForDensity(int, int) throws android.content.res.Resources.NotFoundException;
     method public float getFraction(int, int, int);
     method public int getIdentifier(java.lang.String, java.lang.String, java.lang.String);
     method public int[] getIntArray(int) throws android.content.res.Resources.NotFoundException;
@@ -6633,6 +6634,7 @@
     method public java.lang.CharSequence[] getTextArray(int) throws android.content.res.Resources.NotFoundException;
     method public void getValue(int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
     method public void getValue(java.lang.String, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
+    method public void getValueForDensity(int, int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
     method public android.content.res.XmlResourceParser getXml(int) throws android.content.res.Resources.NotFoundException;
     method public final android.content.res.Resources.Theme newTheme();
     method public android.content.res.TypedArray obtainAttributes(android.util.AttributeSet, int[]);
diff --git a/api/current.txt b/api/current.txt
index 1f6ba1b..9285a15 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -6613,6 +6613,7 @@
     method public int getDimensionPixelSize(int) throws android.content.res.Resources.NotFoundException;
     method public android.util.DisplayMetrics getDisplayMetrics();
     method public android.graphics.drawable.Drawable getDrawable(int) throws android.content.res.Resources.NotFoundException;
+    method public android.graphics.drawable.Drawable getDrawableForDensity(int, int) throws android.content.res.Resources.NotFoundException;
     method public float getFraction(int, int, int);
     method public int getIdentifier(java.lang.String, java.lang.String, java.lang.String);
     method public int[] getIntArray(int) throws android.content.res.Resources.NotFoundException;
@@ -6635,6 +6636,7 @@
     method public java.lang.CharSequence[] getTextArray(int) throws android.content.res.Resources.NotFoundException;
     method public void getValue(int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
     method public void getValue(java.lang.String, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
+    method public void getValueForDensity(int, int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
     method public android.content.res.XmlResourceParser getXml(int) throws android.content.res.Resources.NotFoundException;
     method public final android.content.res.Resources.Theme newTheme();
     method public android.content.res.TypedArray obtainAttributes(android.util.AttributeSet, int[]);
diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp
index 12d1669..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);
 
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index f250367..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);
     }
@@ -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;
     }
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index fa06582..83c881a 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -329,22 +329,22 @@
 
     if (getuid() == 0) {
         if (prctl(PR_SET_KEEPCAPS, 1) < 0) {
-            LOGE("prctl(PR_SET_KEEPCAPS) failed: %s\n", strerror(errno));
+            ALOGE("prctl(PR_SET_KEEPCAPS) failed: %s\n", strerror(errno));
             return -1;
         }
 
         /* 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;
         }
 
@@ -361,7 +361,7 @@
         capdata[1].inheritable = 0;
 
         if (capset(&capheader, &capdata[0]) < 0) {
-            LOGE("capset failed: %s\n", strerror(errno));
+            ALOGE("capset failed: %s\n", strerror(errno));
             return -1;
         }
     }
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 988fee3..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;
     }
 }
@@ -193,13 +193,13 @@
     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);
@@ -245,7 +245,7 @@
 
     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;
@@ -261,7 +261,7 @@
 
     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,7 +463,7 @@
         }
     }
     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;
     }
@@ -472,7 +472,7 @@
         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,24 +515,24 @@
 
     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;
     }
 
@@ -543,15 +543,15 @@
     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;
         }
     }
@@ -595,7 +595,7 @@
                 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,7 +616,7 @@
     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;
     }
     
@@ -626,12 +626,12 @@
         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;
             }
@@ -742,7 +742,7 @@
                         // 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.
@@ -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,7 +802,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);
                                     }
                                 }
@@ -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) {
@@ -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 159bccb..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;
@@ -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]) {
@@ -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,7 +375,7 @@
         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);
@@ -384,15 +384,15 @@
         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;
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 d8380a5..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)) {
@@ -805,6 +805,6 @@
         }
         close(sock);
     }
-    LOGE("accept: %s", strerror(errno));
+    ALOGE("accept: %s", strerror(errno));
     return 1;
 }
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 6ad114a..42d8977 100644
--- a/cmds/servicemanager/service_manager.c
+++ b/cmds/servicemanager/service_manager.c
@@ -12,7 +12,7 @@
 
 #if 0
 #define ALOGI(x...) fprintf(stderr, "svcmgr: " x)
-#define LOGE(x...) fprintf(stderr, "svcmgr: " x)
+#define ALOGE(x...) fprintf(stderr, "svcmgr: " x)
 #else
 #define LOG_TAG "ServiceManager"
 #include <cutils/log.h>
@@ -152,7 +152,7 @@
         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;
         }
@@ -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/sf2.cpp b/cmds/stagefright/sf2.cpp
index 7551d31..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);
diff --git a/cmds/system_server/system_main.cpp b/cmds/system_server/system_main.cpp
index de00326..ddff065 100644
--- a/cmds/system_server/system_main.cpp
+++ b/cmds/system_server/system_main.cpp
@@ -49,7 +49,7 @@
     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/res/Resources.java b/core/java/android/content/res/Resources.java
index d38b8da..2af58be 100755
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -683,7 +683,6 @@
      * @throws NotFoundException Throws NotFoundException if the given ID does
      *             not exist.
      * @return Drawable An object that can be used to draw this resource.
-     * @hide
      */
     public Drawable getDrawableForDensity(int id, int density) throws NotFoundException {
         synchronized (mTmpValue) {
@@ -1032,7 +1031,6 @@
      * @throws NotFoundException Throws NotFoundException if the given ID does
      *             not exist.
      * @see #getValue(String, TypedValue, boolean)
-     * @hide
      */
     public void getValueForDensity(int id, int density, TypedValue outValue, boolean resolveRefs)
             throws NotFoundException {
diff --git a/core/java/android/hardware/CameraSound.java b/core/java/android/hardware/CameraSound.java
index 32de0cd..dc97ff09 100644
--- a/core/java/android/hardware/CameraSound.java
+++ b/core/java/android/hardware/CameraSound.java
@@ -110,7 +110,6 @@
 
     private static class CameraSoundPlayer implements Runnable {
         private int mSoundId;
-        private int mAudioStreamType;
         private MediaPlayer mPlayer;
         private Thread mThread;
         private boolean mExit;
@@ -147,7 +146,7 @@
             }
             mPlayer = new MediaPlayer();
             try {
-                mPlayer.setAudioStreamType(mAudioStreamType);
+                mPlayer.setAudioStreamType(AudioManager.STREAM_SYSTEM_ENFORCED);
                 mPlayer.setDataSource(soundFilePath);
                 mPlayer.setLooping(false);
                 mPlayer.prepare();
@@ -179,11 +178,6 @@
 
         public CameraSoundPlayer(int soundId) {
             mSoundId = soundId;
-            if (SystemProperties.get("ro.camera.sound.forced", "0").equals("0")) {
-                mAudioStreamType = AudioManager.STREAM_MUSIC;
-            } else {
-                mAudioStreamType = AudioManager.STREAM_SYSTEM_ENFORCED;
-            }
         }
 
         public void play() {
diff --git a/core/java/android/util/LocaleUtil.java b/core/java/android/util/LocaleUtil.java
index 763af73..4d773f6 100644
--- a/core/java/android/util/LocaleUtil.java
+++ b/core/java/android/util/LocaleUtil.java
@@ -39,8 +39,6 @@
      */
     public static final int TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE = 1;
 
-    private static final char UNDERSCORE_CHAR = '_';
-
     private static String ARAB_SCRIPT_SUBTAG = "Arab";
     private static String HEBR_SCRIPT_SUBTAG = "Hebr";
 
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index de3f00f..64f862a 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -2626,7 +2626,7 @@
     /**
      * Text direction is using "first strong algorithm". The first strong directional character
      * determines the paragraph direction. If there is no strong directional character, the
-     * paragraph direction is the view's resolved ayout direction.
+     * paragraph direction is the view's resolved layout direction.
      *
      * @hide
      */
@@ -2656,6 +2656,13 @@
     public static final int TEXT_DIRECTION_RTL = 4;
 
     /**
+     * Text direction is coming from the system Locale.
+     *
+     * @hide
+     */
+    public static final int TEXT_DIRECTION_LOCALE = 5;
+
+    /**
      * Default text direction is inherited
      *
      * @hide
@@ -2672,13 +2679,14 @@
             @ViewDebug.IntToString(from = TEXT_DIRECTION_FIRST_STRONG, to = "FIRST_STRONG"),
             @ViewDebug.IntToString(from = TEXT_DIRECTION_ANY_RTL, to = "ANY_RTL"),
             @ViewDebug.IntToString(from = TEXT_DIRECTION_LTR, to = "LTR"),
-            @ViewDebug.IntToString(from = TEXT_DIRECTION_RTL, to = "RTL")
+            @ViewDebug.IntToString(from = TEXT_DIRECTION_RTL, to = "RTL"),
+            @ViewDebug.IntToString(from = TEXT_DIRECTION_LOCALE, to = "LOCALE")
     })
     private int mTextDirection = DEFAULT_TEXT_DIRECTION;
 
     /**
      * The resolved text direction.  This needs resolution if the value is
-     * TEXT_DIRECTION_INHERIT.  The resolution matches mTextDirection if that is
+     * TEXT_DIRECTION_INHERIT.  The resolution matches mTextDirection if it is
      * not TEXT_DIRECTION_INHERIT, otherwise resolution proceeds up the parent
      * chain of the view.
      *
@@ -2689,7 +2697,8 @@
             @ViewDebug.IntToString(from = TEXT_DIRECTION_FIRST_STRONG, to = "FIRST_STRONG"),
             @ViewDebug.IntToString(from = TEXT_DIRECTION_ANY_RTL, to = "ANY_RTL"),
             @ViewDebug.IntToString(from = TEXT_DIRECTION_LTR, to = "LTR"),
-            @ViewDebug.IntToString(from = TEXT_DIRECTION_RTL, to = "RTL")
+            @ViewDebug.IntToString(from = TEXT_DIRECTION_RTL, to = "RTL"),
+            @ViewDebug.IntToString(from = TEXT_DIRECTION_LOCALE, to = "LOCALE")
     })
     private int mResolvedTextDirection = TEXT_DIRECTION_INHERIT;
 
@@ -13791,6 +13800,7 @@
      * {@link #TEXT_DIRECTION_ANY_RTL},
      * {@link #TEXT_DIRECTION_LTR},
      * {@link #TEXT_DIRECTION_RTL},
+     * {@link #TEXT_DIRECTION_LOCALE},
      *
      * @hide
      */
@@ -13808,6 +13818,7 @@
      * {@link #TEXT_DIRECTION_ANY_RTL},
      * {@link #TEXT_DIRECTION_LTR},
      * {@link #TEXT_DIRECTION_RTL},
+     * {@link #TEXT_DIRECTION_LOCALE},
      *
      * @hide
      */
@@ -13828,6 +13839,7 @@
      * {@link #TEXT_DIRECTION_ANY_RTL},
      * {@link #TEXT_DIRECTION_LTR},
      * {@link #TEXT_DIRECTION_RTL},
+     * {@link #TEXT_DIRECTION_LOCALE},
      *
      * @hide
      */
diff --git a/core/java/android/webkit/WebCoreThreadWatchdog.java b/core/java/android/webkit/WebCoreThreadWatchdog.java
new file mode 100644
index 0000000..d100260
--- /dev/null
+++ b/core/java/android/webkit/WebCoreThreadWatchdog.java
@@ -0,0 +1,241 @@
+/*
+ * 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.
+ */
+
+package android.webkit;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.os.Process;
+import android.webkit.WebViewCore.EventHub;
+
+// A Runnable that will monitor if the WebCore thread is still
+// processing messages by pinging it every so often. It is safe
+// to call the public methods of this class from any thread.
+class WebCoreThreadWatchdog implements Runnable {
+
+    // A message with this id is sent by the WebCore thread to notify the
+    // Watchdog that the WebCore thread is still processing messages
+    // (i.e. everything is OK).
+    private static final int IS_ALIVE = 100;
+
+    // This message is placed in the Watchdog's queue and removed when we
+    // receive an IS_ALIVE. If it is ever processed, we consider the
+    // WebCore thread unresponsive.
+    private static final int TIMED_OUT = 101;
+
+    // Message to tell the Watchdog thread to terminate.
+    private static final int QUIT = 102;
+
+    // Wait 10s after hearing back from the WebCore thread before checking it's still alive.
+    private static final int HEARTBEAT_PERIOD = 10 * 1000;
+
+    // If there's no callback from the WebCore thread for 30s, prompt the user the page has
+    // become unresponsive.
+    private static final int TIMEOUT_PERIOD = 30 * 1000;
+
+    // After the first timeout, use a shorter period before re-prompting the user.
+    private static final int SUBSEQUENT_TIMEOUT_PERIOD = 15 * 1000;
+
+    private Context mContext;
+    private Handler mWebCoreThreadHandler;
+    private Handler mHandler;
+    private boolean mPaused;
+    private boolean mPendingQuit;
+
+    private static WebCoreThreadWatchdog sInstance;
+
+    public synchronized static WebCoreThreadWatchdog start(Context context,
+            Handler webCoreThreadHandler) {
+        if (sInstance == null) {
+            sInstance = new WebCoreThreadWatchdog(context, webCoreThreadHandler);
+            new Thread(sInstance, "WebCoreThreadWatchdog").start();
+        }
+        return sInstance;
+    }
+
+    public synchronized static void updateContext(Context context) {
+        if (sInstance != null) {
+            sInstance.setContext(context);
+        }
+    }
+
+    public synchronized static void pause() {
+        if (sInstance != null) {
+            sInstance.pauseWatchdog();
+        }
+    }
+
+    public synchronized static void resume() {
+        if (sInstance != null) {
+            sInstance.resumeWatchdog();
+        }
+    }
+
+    public synchronized static void quit() {
+        if (sInstance != null) {
+            sInstance.quitWatchdog();
+        }
+    }
+
+    private void setContext(Context context) {
+        mContext = context;
+    }
+
+    private WebCoreThreadWatchdog(Context context, Handler webCoreThreadHandler) {
+        mContext = context;
+        mWebCoreThreadHandler = webCoreThreadHandler;
+    }
+
+    private void quitWatchdog() {
+        if (mHandler == null) {
+            // The thread hasn't started yet, so set a flag to stop it starting.
+            mPendingQuit = true;
+            return;
+        }
+        // Clear any pending messages, and then post a quit to the WatchDog handler.
+        mHandler.removeMessages(TIMED_OUT);
+        mHandler.removeMessages(IS_ALIVE);
+        mWebCoreThreadHandler.removeMessages(EventHub.HEARTBEAT);
+        mHandler.obtainMessage(QUIT).sendToTarget();
+    }
+
+    private void pauseWatchdog() {
+        mPaused = true;
+
+        if (mHandler == null) {
+            return;
+        }
+
+        mHandler.removeMessages(TIMED_OUT);
+        mHandler.removeMessages(IS_ALIVE);
+        mWebCoreThreadHandler.removeMessages(EventHub.HEARTBEAT);
+    }
+
+    private void resumeWatchdog() {
+        if (!mPaused) {
+            // Do nothing if we get a call to resume without being paused.
+            // This can happen during the initialisation of the WebView.
+            return;
+        }
+
+        mPaused = false;
+
+        if (mHandler == null) {
+            return;
+        }
+
+        mWebCoreThreadHandler.obtainMessage(EventHub.HEARTBEAT,
+                mHandler.obtainMessage(IS_ALIVE)).sendToTarget();
+        mHandler.sendMessageDelayed(mHandler.obtainMessage(TIMED_OUT), TIMEOUT_PERIOD);
+    }
+
+    private boolean createHandler() {
+        synchronized (WebCoreThreadWatchdog.class) {
+            if (mPendingQuit) {
+                return false;
+            }
+
+            mHandler = new Handler() {
+                @Override
+                public void handleMessage(Message msg) {
+                    switch (msg.what) {
+                    case IS_ALIVE:
+                        synchronized(WebCoreThreadWatchdog.class) {
+                            if (mPaused) {
+                                return;
+                            }
+
+                            // The WebCore thread still seems alive. Reset the countdown timer.
+                            removeMessages(TIMED_OUT);
+                            sendMessageDelayed(obtainMessage(TIMED_OUT), TIMEOUT_PERIOD);
+                            mWebCoreThreadHandler.sendMessageDelayed(
+                                    mWebCoreThreadHandler.obtainMessage(EventHub.HEARTBEAT,
+                                            mHandler.obtainMessage(IS_ALIVE)),
+                                    HEARTBEAT_PERIOD);
+                        }
+                        break;
+
+                    case TIMED_OUT:
+                        new AlertDialog.Builder(mContext)
+                            .setMessage(com.android.internal.R.string.webpage_unresponsive)
+                            .setPositiveButton(com.android.internal.R.string.force_close,
+                                    new DialogInterface.OnClickListener() {
+                                        @Override
+                                        public void onClick(DialogInterface dialog, int which) {
+                                        // User chose to force close.
+                                        Process.killProcess(Process.myPid());
+                                    }
+                                })
+                            .setNegativeButton(com.android.internal.R.string.wait,
+                                    new DialogInterface.OnClickListener() {
+                                        @Override
+                                        public void onClick(DialogInterface dialog, int which) {
+                                            // The user chose to wait. The last HEARTBEAT message
+                                            // will still be in the WebCore thread's queue, so all
+                                            // we need to do is post another TIMED_OUT so that the
+                                            // user will get prompted again if the WebCore thread
+                                            // doesn't sort itself out.
+                                            sendMessageDelayed(obtainMessage(TIMED_OUT),
+                                                    SUBSEQUENT_TIMEOUT_PERIOD);
+                                       }
+                                    })
+                            .setOnCancelListener(new DialogInterface.OnCancelListener() {
+                                    @Override
+                                    public void onCancel(DialogInterface dialog) {
+                                        sendMessageDelayed(obtainMessage(TIMED_OUT),
+                                                SUBSEQUENT_TIMEOUT_PERIOD);
+                                    }
+                            })
+                            .setIcon(android.R.drawable.ic_dialog_alert)
+                            .show();
+                        break;
+
+                    case QUIT:
+                        Looper.myLooper().quit();
+                        break;
+                    }
+                }
+            };
+
+            return true;
+        }
+    }
+
+    @Override
+    public void run() {
+        Looper.prepare();
+
+        if (!createHandler()) {
+            return;
+        }
+
+        // Send the initial control to WebViewCore and start the timeout timer as long as we aren't
+        // paused.
+        synchronized (WebCoreThreadWatchdog.class) {
+            if (!mPaused) {
+                mWebCoreThreadHandler.obtainMessage(EventHub.HEARTBEAT,
+                        mHandler.obtainMessage(IS_ALIVE)).sendToTarget();
+                mHandler.sendMessageDelayed(mHandler.obtainMessage(TIMED_OUT), TIMEOUT_PERIOD);
+            }
+        }
+
+        Looper.loop();
+    }
+}
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 617584b..08d94e2 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -142,7 +142,7 @@
     }
 
     // TODO: Keep this up to date
-    private static final String PREVIOUS_VERSION = "3.1";
+    private static final String PREVIOUS_VERSION = "4.0.3";
 
     // WebView associated with this WebSettings.
     private WebView mWebView;
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 29af64e..20936e8 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -27,7 +27,6 @@
 import android.content.DialogInterface.OnCancelListener;
 import android.content.Intent;
 import android.content.IntentFilter;
-import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.res.Configuration;
 import android.database.DataSetObserver;
@@ -57,9 +56,9 @@
 import android.os.Looper;
 import android.os.Message;
 import android.os.StrictMode;
+import android.os.SystemClock;
 import android.provider.Settings;
 import android.speech.tts.TextToSpeech;
-import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.util.EventLog;
 import android.util.Log;
@@ -84,6 +83,7 @@
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityManager;
 import android.view.accessibility.AccessibilityNodeInfo;
+import android.view.inputmethod.BaseInputConnection;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputConnection;
 import android.view.inputmethod.InputMethodManager;
@@ -126,7 +126,8 @@
 import javax.microedition.khronos.egl.EGL10;
 import javax.microedition.khronos.egl.EGLContext;
 import javax.microedition.khronos.egl.EGLDisplay;
-import static javax.microedition.khronos.egl.EGL10.*;
+
+import static javax.microedition.khronos.egl.EGL10.EGL_DEFAULT_DISPLAY;
 
 /**
  * <p>A View that displays web pages. This class is the basis upon which you
@@ -333,6 +334,7 @@
         ViewGroup.OnHierarchyChangeListener {
 
     private class InnerGlobalLayoutListener implements ViewTreeObserver.OnGlobalLayoutListener {
+        @Override
         public void onGlobalLayout() {
             if (isShown()) {
                 setGLRectViewport();
@@ -341,6 +343,7 @@
     }
 
     private class InnerScrollChangedListener implements ViewTreeObserver.OnScrollChangedListener {
+        @Override
         public void onScrollChanged() {
             if (isShown()) {
                 setGLRectViewport();
@@ -348,6 +351,43 @@
         }
     }
 
+    /**
+     * InputConnection used for ContentEditable. This captures the 'delete'
+     * commands and sends delete key presses.
+     */
+    private class WebViewInputConnection extends BaseInputConnection {
+        public WebViewInputConnection() {
+            super(WebView.this, false);
+        }
+
+        private void sendKeyPress(int keyCode) {
+            long eventTime = SystemClock.uptimeMillis();
+            sendKeyEvent(new KeyEvent(eventTime, eventTime,
+                    KeyEvent.ACTION_DOWN, keyCode, 0, 0,
+                    KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
+                    KeyEvent.FLAG_SOFT_KEYBOARD));
+            sendKeyEvent(new KeyEvent(SystemClock.uptimeMillis(), eventTime,
+                    KeyEvent.ACTION_UP, keyCode, 0, 0,
+                    KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
+                    KeyEvent.FLAG_SOFT_KEYBOARD));
+        }
+
+        @Override
+        public boolean deleteSurroundingText(int leftLength, int rightLength) {
+            // Look for one-character delete and send it as a key press.
+            if (leftLength == 1 && rightLength == 0) {
+                sendKeyPress(KeyEvent.KEYCODE_DEL);
+            } else if (leftLength == 0 && rightLength == 1){
+                sendKeyPress(KeyEvent.KEYCODE_FORWARD_DEL);
+            } else if (mWebViewCore != null) {
+                mWebViewCore.sendMessage(EventHub.DELETE_SURROUNDING_TEXT,
+                        leftLength, rightLength);
+            }
+            return super.deleteSurroundingText(leftLength, rightLength);
+        }
+    }
+
+
     // The listener to capture global layout change event.
     private InnerGlobalLayoutListener mGlobalLayoutListener = null;
 
@@ -372,6 +412,8 @@
     private final Rect mViewRectViewport = new Rect();
     private final RectF mVisibleContentRect = new RectF();
     private boolean mGLViewportEmpty = false;
+    WebViewInputConnection mInputConnection = new WebViewInputConnection();
+
 
     /**
      *  Transportation object for returning WebView across thread boundaries.
@@ -1242,7 +1284,7 @@
                 PackageManager pm = mContext.getPackageManager();
                 for (String name : sGoogleApps) {
                     try {
-                        PackageInfo pInfo = pm.getPackageInfo(name,
+                        pm.getPackageInfo(name,
                                 PackageManager.GET_ACTIVITIES | PackageManager.GET_SERVICES);
                         installedPackages.add(name);
                     } catch (PackageManager.NameNotFoundException e) {
@@ -1414,23 +1456,27 @@
                     .setMessage(com.android.internal.R.string.save_password_message)
                     .setPositiveButton(com.android.internal.R.string.save_password_notnow,
                     new DialogInterface.OnClickListener() {
+                        @Override
                         public void onClick(DialogInterface dialog, int which) {
                             resumeMsg.sendToTarget();
                         }
                     })
                     .setNeutralButton(com.android.internal.R.string.save_password_remember,
                     new DialogInterface.OnClickListener() {
+                        @Override
                         public void onClick(DialogInterface dialog, int which) {
                             remember.sendToTarget();
                         }
                     })
                     .setNegativeButton(com.android.internal.R.string.save_password_never,
                     new DialogInterface.OnClickListener() {
+                        @Override
                         public void onClick(DialogInterface dialog, int which) {
                             neverRemember.sendToTarget();
                         }
                     })
                     .setOnCancelListener(new OnCancelListener() {
+                        @Override
                         public void onCancel(DialogInterface dialog) {
                             resumeMsg.sendToTarget();
                         }
@@ -1516,6 +1562,7 @@
      *
      * @deprecated This method is now obsolete.
      */
+    @Deprecated
     public int getVisibleTitleHeight() {
         checkThread();
         return getVisibleTitleHeightImpl();
@@ -1854,6 +1901,7 @@
         // contains valid data.
         final File temp = new File(dest.getPath() + ".writing");
         new Thread(new Runnable() {
+            @Override
             public void run() {
                 FileOutputStream out = null;
                 try {
@@ -1923,6 +1971,7 @@
             final FileInputStream in = new FileInputStream(src);
             final Bundle copy = new Bundle(b);
             new Thread(new Runnable() {
+                @Override
                 public void run() {
                     try {
                         final Picture p = Picture.createFromStream(in);
@@ -1930,6 +1979,7 @@
                             // Post a runnable on the main thread to update the
                             // history picture fields.
                             mPrivateHandler.post(new Runnable() {
+                                @Override
                                 public void run() {
                                     restoreHistoryPictureFields(p, copy);
                                 }
@@ -2658,8 +2708,8 @@
                 int slop = viewToContentDimension(mNavSlop);
                 cursorBounds.inset(-slop, -slop);
                 if (cursorBounds.contains(contentX, contentY)) {
-                    contentX = (int) cursorBounds.centerX();
-                    contentY = (int) cursorBounds.centerY();
+                    contentX = cursorBounds.centerX();
+                    contentY = cursorBounds.centerY();
                 }
             }
         }
@@ -3308,6 +3358,7 @@
             }
 
             cancelSelectDialog();
+            WebCoreThreadWatchdog.pause();
         }
     }
 
@@ -3340,6 +3391,15 @@
                 nativeSetPauseDrawing(mNativeClass, false);
             }
         }
+        // Ensure that the watchdog has a currently valid Context to be able to display
+        // a prompt dialog. For example, if the Activity was finished whilst the WebCore
+        // thread was blocked and the Activity is started again, we may reuse the blocked
+        // thread, but we'll have a new Activity.
+        WebCoreThreadWatchdog.updateContext(mContext);
+        // We get a call to onResume for new WebViews (i.e. mIsPaused will be false). We need
+        // to ensure that the Watchdog thread is running for the new WebView, so call
+        // it outside the if block above.
+        WebCoreThreadWatchdog.resume();
     }
 
     /**
@@ -4856,10 +4916,16 @@
     }
 
     @Override
+    public boolean onCheckIsTextEditor() {
+        return true;
+    }
+
+    @Override
     public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
-      InputConnection connection = super.onCreateInputConnection(outAttrs);
-      outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_FULLSCREEN;
-      return connection;
+        outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN
+                | EditorInfo.TYPE_CLASS_TEXT
+                | EditorInfo.TYPE_TEXT_VARIATION_NORMAL;
+        return mInputConnection;
     }
 
     /**
@@ -5054,6 +5120,7 @@
             mWebSettings = getSettings();
         }
 
+        @Override
         public void run() {
             ArrayList<String> pastEntries = new ArrayList<String>();
 
@@ -5716,6 +5783,7 @@
      * @deprecated WebView no longer needs to implement
      * ViewGroup.OnHierarchyChangeListener.  This method does nothing now.
      */
+    @Override
     // Cannot add @hide as this can always be accessed via the interface.
     @Deprecated
     public void onChildViewAdded(View parent, View child) {}
@@ -5724,6 +5792,7 @@
      * @deprecated WebView no longer needs to implement
      * ViewGroup.OnHierarchyChangeListener.  This method does nothing now.
      */
+    @Override
     // Cannot add @hide as this can always be accessed via the interface.
     @Deprecated
     public void onChildViewRemoved(View p, View child) {}
@@ -5732,6 +5801,7 @@
      * @deprecated WebView should not have implemented
      * ViewTreeObserver.OnGlobalFocusChangeListener. This method does nothing now.
      */
+    @Override
     // Cannot add @hide as this can always be accessed via the interface.
     @Deprecated
     public void onGlobalFocusChanged(View oldFocus, View newFocus) {
@@ -6168,9 +6238,10 @@
                         }
                         if (DEBUG_TOUCH_HIGHLIGHT) {
                             if (getSettings().getNavDump()) {
-                                mTouchHighlightX = (int) x + mScrollX;
-                                mTouchHighlightY = (int) y + mScrollY;
+                                mTouchHighlightX = x + mScrollX;
+                                mTouchHighlightY = y + mScrollY;
                                 mPrivateHandler.postDelayed(new Runnable() {
+                                    @Override
                                     public void run() {
                                         mTouchHighlightX = mTouchHighlightY = 0;
                                         invalidate();
@@ -6762,8 +6833,6 @@
             int oldY = mScrollY;
             int rangeX = computeMaxScrollX();
             int rangeY = computeMaxScrollY();
-            int overscrollDistance = mOverscrollDistance;
-
             // Check for the original scrolling layer in case we change
             // directions.  mTouchMode might be TOUCH_DRAG_MODE if we have
             // reached the edge of a layer but mScrollingLayer will be non-zero
@@ -7476,8 +7545,8 @@
             return false;
         }
         mDragFromTextInput = true;
-        event.offsetLocation((float) (mWebTextView.getLeft() - mScrollX),
-                (float) (mWebTextView.getTop() - mScrollY));
+        event.offsetLocation((mWebTextView.getLeft() - mScrollX),
+                (mWebTextView.getTop() - mScrollY));
         boolean result = onTouchEvent(event);
         mDragFromTextInput = false;
         return result;
@@ -9032,7 +9101,7 @@
                 if (position < 0 || position >= getCount()) {
                     return null;
                 }
-                return (Container) getItem(position);
+                return getItem(position);
             }
 
             @Override
@@ -9131,6 +9200,7 @@
             }
         }
 
+        @Override
         public void run() {
             final ListView listView = (ListView) LayoutInflater.from(mContext)
                     .inflate(com.android.internal.R.layout.select_dialog, null);
@@ -9141,6 +9211,7 @@
 
             if (mMultiple) {
                 b.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+                    @Override
                     public void onClick(DialogInterface dialog, int which) {
                         mWebViewCore.sendMessage(
                                 EventHub.LISTBOX_CHOICES,
@@ -9149,6 +9220,7 @@
                     }});
                 b.setNegativeButton(android.R.string.cancel,
                         new DialogInterface.OnClickListener() {
+                    @Override
                     public void onClick(DialogInterface dialog, int which) {
                         mWebViewCore.sendMessage(
                                 EventHub.SINGLE_LISTBOX_CHOICE, -2, 0);
@@ -9172,6 +9244,7 @@
                 }
             } else {
                 listView.setOnItemClickListener(new OnItemClickListener() {
+                    @Override
                     public void onItemClick(AdapterView<?> parent, View v,
                             int position, long id) {
                         // Rather than sending the message right away, send it
@@ -9192,6 +9265,7 @@
                 }
             }
             mListBoxDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
+                @Override
                 public void onCancel(DialogInterface dialog) {
                     mWebViewCore.sendMessage(
                                 EventHub.SINGLE_LISTBOX_CHOICE, -2, 0);
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index d99e264..95533c6 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -37,18 +37,14 @@
 import android.view.MotionEvent;
 import android.view.SurfaceView;
 import android.view.View;
-import android.webkit.DeviceMotionService;
-import android.webkit.DeviceMotionAndOrientationManager;
-import android.webkit.DeviceOrientationService;
-import android.webkit.JniUtil;
+
+import junit.framework.Assert;
 
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Map;
 import java.util.Set;
 
-import junit.framework.Assert;
-
 /**
  * @hide
  */
@@ -170,6 +166,10 @@
                            "creation.");
                     Log.e(LOGTAG, Log.getStackTraceString(e));
                 }
+
+                // Start the singleton watchdog which will monitor the WebCore thread
+                // to verify it's still processing messages.
+                WebCoreThreadWatchdog.start(context, sWebCoreHandler);
             }
         }
         // Create an EventHub to handle messages before and after the thread is
@@ -382,8 +382,9 @@
         mCallbackProxy.onExceededDatabaseQuota(url, databaseIdentifier,
                 currentQuota, estimatedSize, getUsedQuota(),
                 new WebStorage.QuotaUpdater() {
+                        @Override
                         public void updateQuota(long quota) {
-                            nativeSetNewStorageLimit(quota);
+                            nativeSetNewStorageLimit(mNativeClass, quota);
                         }
                 });
     }
@@ -396,14 +397,16 @@
     protected void reachedMaxAppCacheSize(long spaceNeeded) {
         mCallbackProxy.onReachedMaxAppCacheSize(spaceNeeded, getUsedQuota(),
                 new WebStorage.QuotaUpdater() {
+                    @Override
                     public void updateQuota(long quota) {
-                        nativeSetNewStorageLimit(quota);
+                        nativeSetNewStorageLimit(mNativeClass, quota);
                     }
                 });
     }
 
     protected void populateVisitedLinks() {
         ValueCallback callback = new ValueCallback<String[]>() {
+            @Override
             public void onReceiveValue(String[] value) {
                 sendMessage(EventHub.POPULATE_VISITED_LINKS, (Object)value);
             }
@@ -420,14 +423,15 @@
     protected void geolocationPermissionsShowPrompt(String origin) {
         mCallbackProxy.onGeolocationPermissionsShowPrompt(origin,
                 new GeolocationPermissions.Callback() {
-          public void invoke(String origin, boolean allow, boolean remember) {
-            GeolocationPermissionsData data = new GeolocationPermissionsData();
-            data.mOrigin = origin;
-            data.mAllow = allow;
-            data.mRemember = remember;
-            // Marshall to WebCore thread.
-            sendMessage(EventHub.GEOLOCATION_PERMISSIONS_PROVIDE, data);
-          }
+            @Override
+            public void invoke(String origin, boolean allow, boolean remember) {
+                GeolocationPermissionsData data = new GeolocationPermissionsData();
+                data.mOrigin = origin;
+                data.mAllow = allow;
+                data.mRemember = remember;
+                // Marshall to WebCore thread.
+                sendMessage(EventHub.GEOLOCATION_PERMISSIONS_PROVIDE, data);
+            }
         });
     }
 
@@ -501,7 +505,7 @@
      * Clear the picture set. To be called only on the WebCore thread.
      */
     /* package */ void clearContent() {
-        nativeClearContent();
+        nativeClearContent(mNativeClass);
     }
 
     //-------------------------------------------------------------------------
@@ -513,15 +517,16 @@
     /**
      * Empty the picture set.
      */
-    private native void nativeClearContent();
+    private native void nativeClearContent(int nativeClass);
 
-    private native void nativeContentInvalidateAll();
+    private native void nativeContentInvalidateAll(int nativeClass);
 
     /**
      * Redraw a portion of the picture set. The Point wh returns the
      * width and height of the overall picture.
      */
-    private native int nativeRecordContent(Region invalRegion, Point wh);
+    private native int nativeRecordContent(int nativeClass, Region invalRegion,
+            Point wh);
 
     /**
      * Update the layers' content
@@ -533,25 +538,27 @@
      */
     private native void nativeNotifyAnimationStarted(int nativeClass);
 
-    private native boolean nativeFocusBoundsChanged();
+    private native boolean nativeFocusBoundsChanged(int nativeClass);
 
     /**
      * Splits slow parts of the picture set. Called from the webkit thread after
      * WebView.nativeDraw() returns content to be split.
      */
-    private native void nativeSplitContent(int content);
+    private native void nativeSplitContent(int nativeClass, int content);
 
-    private native boolean nativeKey(int keyCode, int unichar,
-            int repeatCount, boolean isShift, boolean isAlt, boolean isSym,
-            boolean isDown);
+    private native boolean nativeKey(int nativeClass, int keyCode,
+            int unichar, int repeatCount, boolean isShift, boolean isAlt,
+            boolean isSym, boolean isDown);
 
-    private native void nativeClick(int framePtr, int nodePtr, boolean fake);
+    private native void nativeClick(int nativeClass, int framePtr, int nodePtr,
+            boolean fake);
 
-    private native void nativeSendListBoxChoices(boolean[] choices, int size);
+    private native void nativeSendListBoxChoices(int nativeClass,
+            boolean[] choices, int size);
 
-    private native void nativeSendListBoxChoice(int choice);
+    private native void nativeSendListBoxChoice(int nativeClass, int choice);
 
-    private native void nativeCloseIdleConnections();
+    private native void nativeCloseIdleConnections(int nativeClass);
 
     /*  Tell webkit what its width and height are, for the purposes
         of layout/line-breaking. These coordinates are in document space,
@@ -561,75 +568,96 @@
         fixed size, textWrapWidth can be different from width with zooming.
         should this be called nativeSetViewPortSize?
     */
-    private native void nativeSetSize(int width, int height, int textWrapWidth,
-            float scale, int screenWidth, int screenHeight, int anchorX,
-            int anchorY, boolean ignoreHeight);
+    private native void nativeSetSize(int nativeClass, int width, int height,
+            int textWrapWidth, float scale, int screenWidth, int screenHeight,
+            int anchorX, int anchorY, boolean ignoreHeight);
 
-    private native int nativeGetContentMinPrefWidth();
+    private native int nativeGetContentMinPrefWidth(int nativeClass);
 
     // Start: functions that deal with text editing
     private native void nativeReplaceTextfieldText(
-            int oldStart, int oldEnd, String replace, int newStart, int newEnd,
-            int textGeneration);
+            int nativeClass, int oldStart, int oldEnd, String replace,
+            int newStart, int newEnd, int textGeneration);
 
-    private native void passToJs(int gen,
-            String currentText, int keyCode, int keyValue, boolean down,
-            boolean cap, boolean fn, boolean sym);
+    private native void passToJs(int nativeClass,
+            int gen, String currentText, int keyCode, int keyValue,
+            boolean down, boolean cap, boolean fn, boolean sym);
 
-    private native void nativeSetFocusControllerActive(boolean active);
+    private native void nativeSetFocusControllerActive(int nativeClass,
+            boolean active);
 
-    private native void nativeSaveDocumentState(int frame);
+    private native void nativeSaveDocumentState(int nativeClass, int frame);
 
-    private native void nativeMoveFocus(int framePtr, int nodePointer);
-    private native void nativeMoveMouse(int framePtr, int x, int y);
+    private native void nativeMoveFocus(int nativeClass, int framePtr,
+            int nodePointer);
+    private native void nativeMoveMouse(int nativeClass, int framePtr, int x,
+            int y);
 
-    private native void nativeMoveMouseIfLatest(int moveGeneration,
-            int framePtr, int x, int y);
+    private native void nativeMoveMouseIfLatest(int nativeClass,
+            int moveGeneration, int framePtr, int x, int y);
 
-    private native String nativeRetrieveHref(int x, int y);
-    private native String nativeRetrieveAnchorText(int x, int y);
-    private native String nativeRetrieveImageSource(int x, int y);
-    private native void nativeStopPaintingCaret();
-    private native void nativeTouchUp(int touchGeneration,
-            int framePtr, int nodePtr, int x, int y);
+    private native String nativeRetrieveHref(int nativeClass, int x, int y);
+    private native String nativeRetrieveAnchorText(int nativeClass,
+            int x, int y);
+    private native String nativeRetrieveImageSource(int nativeClass,
+            int x, int y);
+    private native void nativeStopPaintingCaret(int nativeClass);
+    private native void nativeTouchUp(int nativeClass,
+            int touchGeneration, int framePtr, int nodePtr, int x, int y);
 
-    private native boolean nativeHandleTouchEvent(int action, int[] idArray,
-            int[] xArray, int[] yArray, int count, int actionIndex, int metaState);
+    private native boolean nativeHandleTouchEvent(int nativeClass, int action,
+            int[] idArray, int[] xArray, int[] yArray, int count,
+            int actionIndex, int metaState);
 
-    private native void nativeUpdateFrameCache();
+    private native void nativeUpdateFrameCache(int nativeClass);
 
-    private native void nativeSetBackgroundColor(int color);
+    private native void nativeSetBackgroundColor(int nativeClass, int color);
 
-    private native void nativeDumpDomTree(boolean useFile);
+    private native void nativeDumpDomTree(int nativeClass, boolean useFile);
 
-    private native void nativeDumpRenderTree(boolean useFile);
+    private native void nativeDumpRenderTree(int nativeClass, boolean useFile);
 
-    private native void nativeDumpNavTree();
+    private native void nativeDumpNavTree(int nativeClass);
 
-    private native void nativeSetJsFlags(String flags);
+    private native void nativeSetJsFlags(int nativeClass, String flags);
 
     /**
      *  Delete text from start to end in the focused textfield. If there is no
      *  focus, or if start == end, silently fail.  If start and end are out of
      *  order, swap them.
-     *  @param  start   Beginning of selection to delete.
-     *  @param  end     End of selection to delete.
-     *  @param  textGeneration Text generation number when delete was pressed.
+     * @param  nativeClass Pointer to the C++ WebViewCore object mNativeClass
+     * @param  start   Beginning of selection to delete.
+     * @param  end     End of selection to delete.
+     * @param  textGeneration Text generation number when delete was pressed.
      */
-    private native void nativeDeleteSelection(int start, int end,
-            int textGeneration);
+    private native void nativeDeleteSelection(int nativeClass, int start,
+            int end, int textGeneration);
+
+    /**
+     * Delete text near the cursor.
+     * @param nativeClass The pointer to the native class (mNativeClass)
+     * @param leftLength The number of characters to the left of the cursor to
+     * delete
+     * @param rightLength The number of characters to the right of the cursor
+     * to delete.
+     */
+    private native void nativeDeleteSurroundingText(int nativeClass,
+            int leftLength,
+            int rightLength);
 
     /**
      *  Set the selection to (start, end) in the focused textfield. If start and
      *  end are out of order, swap them.
-     *  @param  start   Beginning of selection.
-     *  @param  end     End of selection.
+     * @param  nativeClass Pointer to the C++ WebViewCore object mNativeClass
+     * @param  start   Beginning of selection.
+     * @param  end     End of selection.
      */
-    private native void nativeSetSelection(int start, int end);
+    private native void nativeSetSelection(int nativeClass, int start, int end);
 
     // Register a scheme to be treated as local scheme so that it can access
     // local asset files for resources
-    private native void nativeRegisterURLSchemeAsLocal(String scheme);
+    private native void nativeRegisterURLSchemeAsLocal(int nativeClass,
+            String scheme);
 
     /*
      * Inform webcore that the user has decided whether to allow or deny new
@@ -637,34 +665,39 @@
      * the main thread should wake up now.
      * @param limit Is the new quota for an origin or new app cache max size.
      */
-    private native void nativeSetNewStorageLimit(long limit);
+    private native void nativeSetNewStorageLimit(int nativeClass, long limit);
 
     /**
      * Provide WebCore with a Geolocation permission state for the specified
      * origin.
+     * @param nativeClass Pointer to the C++ WebViewCore object mNativeClass
      * @param origin The origin for which Geolocation permissions are provided.
      * @param allow Whether Geolocation permissions are allowed.
      * @param remember Whether this decision should be remembered beyond the
      *     life of the current page.
      */
-    private native void nativeGeolocationPermissionsProvide(String origin, boolean allow, boolean remember);
+    private native void nativeGeolocationPermissionsProvide(int nativeClass,
+            String origin, boolean allow, boolean remember);
 
     /**
      * Provide WebCore with the previously visted links from the history database
+     * @param nativeClass TODO
      */
-    private native void nativeProvideVisitedHistory(String[] history);
+    private native void nativeProvideVisitedHistory(int nativeClass,
+            String[] history);
 
     /**
      * Modifies the current selection.
      *
      * Note: Accessibility support.
-     *
+     * @param nativeClass Pointer to the C++ WebViewCore object mNativeClass
      * @param direction The direction in which to alter the selection.
      * @param granularity The granularity of the selection modification.
      *
      * @return The selection string.
      */
-    private native String nativeModifySelection(int direction, int granularity);
+    private native String nativeModifySelection(int nativeClass, int direction,
+            int granularity);
 
     // EventHub for processing messages
     private final EventHub mEventHub;
@@ -677,6 +710,7 @@
         private static final int REDUCE_PRIORITY = 1;
         private static final int RESUME_PRIORITY = 2;
 
+        @Override
         public void run() {
             Looper.prepare();
             Assert.assertNull(sWebCoreHandler);
@@ -725,6 +759,13 @@
                                 }
                                 BrowserFrame.sJavaBridge.updateProxy((ProxyProperties)msg.obj);
                                 break;
+
+                            case EventHub.HEARTBEAT:
+                                // Ping back the watchdog to let it know we're still processing
+                                // messages.
+                                Message m = (Message)msg.obj;
+                                m.sendToTarget();
+                                break;
                         }
                     }
                 };
@@ -963,6 +1004,8 @@
         static final int SET_BACKGROUND_COLOR = 126;
         static final int SET_MOVE_FOCUS = 127;
         static final int SAVE_DOCUMENT_STATE = 128;
+        static final int DELETE_SURROUNDING_TEXT = 129;
+
 
         static final int WEBKIT_DRAW = 130;
         static final int POST_URL = 132;
@@ -1046,6 +1089,8 @@
 
         static final int NOTIFY_ANIMATION_STARTED = 196;
 
+        static final int HEARTBEAT = 197;
+
         // private message ids
         private static final int DESTROY =     200;
 
@@ -1124,18 +1169,19 @@
                                 mSettings.onDestroyed();
                                 mNativeClass = 0;
                                 mWebView = null;
+                                WebCoreThreadWatchdog.quit();
                             }
                             break;
 
                         case REVEAL_SELECTION:
-                            nativeRevealSelection();
+                            nativeRevealSelection(mNativeClass);
                             break;
 
                         case REQUEST_LABEL:
                             if (mWebView != null) {
                                 int nodePointer = msg.arg2;
-                                String label = nativeRequestLabel(msg.arg1,
-                                        nodePointer);
+                                String label = nativeRequestLabel(mNativeClass,
+                                        msg.arg1, nodePointer);
                                 if (label != null && label.length() > 0) {
                                     Message.obtain(mWebView.mPrivateHandler,
                                             WebView.RETURN_LABEL, nodePointer,
@@ -1145,7 +1191,7 @@
                             break;
 
                         case UPDATE_FRAME_CACHE_IF_LOADING:
-                            nativeUpdateFrameCacheIfLoading();
+                            nativeUpdateFrameCacheIfLoading(mNativeClass);
                             break;
 
                         case SCROLL_TEXT_INPUT:
@@ -1155,7 +1201,7 @@
                             } else {
                                 xPercent = ((Float) msg.obj).floatValue();
                             }
-                            nativeScrollFocusedTextInput(xPercent, msg.arg2);
+                            nativeScrollFocusedTextInput(mNativeClass, xPercent, msg.arg2);
                             break;
 
                         case LOAD_URL: {
@@ -1190,7 +1236,8 @@
                                             !scheme.startsWith("ftp") &&
                                             !scheme.startsWith("about") &&
                                             !scheme.startsWith("javascript")) {
-                                        nativeRegisterURLSchemeAsLocal(scheme);
+                                        nativeRegisterURLSchemeAsLocal(mNativeClass,
+                                                scheme);
                                     }
                                 }
                             }
@@ -1199,7 +1246,7 @@
                                     loadParams.mMimeType,
                                     loadParams.mEncoding,
                                     loadParams.mHistoryUrl);
-                            nativeContentInvalidateAll();
+                            nativeContentInvalidateAll(mNativeClass);
                             break;
 
                         case STOP_LOADING:
@@ -1228,11 +1275,11 @@
                             break;
 
                         case FAKE_CLICK:
-                            nativeClick(msg.arg1, msg.arg2, true);
+                            nativeClick(mNativeClass, msg.arg1, msg.arg2, true);
                             break;
 
                         case CLICK:
-                            nativeClick(msg.arg1, msg.arg2, false);
+                            nativeClick(mNativeClass, msg.arg1, msg.arg2, false);
                             break;
 
                         case VIEW_SIZE_CHANGED: {
@@ -1243,14 +1290,14 @@
                             // note: these are in document coordinates
                             // (inv-zoom)
                             Point pt = (Point) msg.obj;
-                            nativeSetScrollOffset(msg.arg1, msg.arg2 == 1,
-                                    pt.x, pt.y);
+                            nativeSetScrollOffset(mNativeClass, msg.arg1,
+                                    msg.arg2 == 1, pt.x, pt.y);
                             break;
 
                         case SET_GLOBAL_BOUNDS:
                             Rect r = (Rect) msg.obj;
-                            nativeSetGlobalBounds(r.left, r.top, r.width(),
-                                r.height());
+                            nativeSetGlobalBounds(mNativeClass, r.left, r.top,
+                                r.width(), r.height());
                             break;
 
                         case GO_BACK_FORWARD:
@@ -1279,7 +1326,7 @@
                                 WebViewWorker.getHandler().sendEmptyMessage(
                                         WebViewWorker.MSG_PAUSE_CACHE_TRANSACTION);
                             } else {
-                                nativeCloseIdleConnections();
+                                nativeCloseIdleConnections(mNativeClass);
                             }
                             break;
 
@@ -1293,16 +1340,16 @@
                             break;
 
                         case ON_PAUSE:
-                            nativePause();
+                            nativePause(mNativeClass);
                             break;
 
                         case ON_RESUME:
-                            nativeResume();
+                            nativeResume(mNativeClass);
                             break;
 
                         case FREE_MEMORY:
                             clearCache(false);
-                            nativeFreeMemory();
+                            nativeFreeMemory(mNativeClass);
                             break;
 
                         case SET_NETWORK_STATE:
@@ -1335,9 +1382,9 @@
 
                         case REPLACE_TEXT:
                             ReplaceTextData rep = (ReplaceTextData) msg.obj;
-                            nativeReplaceTextfieldText(msg.arg1, msg.arg2,
-                                    rep.mReplace, rep.mNewStart, rep.mNewEnd,
-                                    rep.mTextGeneration);
+                            nativeReplaceTextfieldText(mNativeClass, msg.arg1,
+                                    msg.arg2, rep.mReplace, rep.mNewStart,
+                                    rep.mNewEnd, rep.mTextGeneration);
                             break;
 
                         case PASS_TO_JS: {
@@ -1346,19 +1393,19 @@
                             int keyCode = evt.getKeyCode();
                             int keyValue = evt.getUnicodeChar();
                             int generation = msg.arg1;
-                            passToJs(generation,
+                            passToJs(mNativeClass,
+                                    generation,
                                     jsData.mCurrentText,
                                     keyCode,
                                     keyValue,
-                                    evt.isDown(),
-                                    evt.isShiftPressed(), evt.isAltPressed(),
-                                    evt.isSymPressed());
+                                    evt.isDown(), evt.isShiftPressed(),
+                                    evt.isAltPressed(), evt.isSymPressed());
                             break;
                         }
 
                         case SAVE_DOCUMENT_STATE: {
                             CursorData cDat = (CursorData) msg.obj;
-                            nativeSaveDocumentState(cDat.mFrame);
+                            nativeSaveDocumentState(mNativeClass, cDat.mFrame);
                             break;
                         }
 
@@ -1367,7 +1414,7 @@
                                 // FIXME: This will not work for connections currently in use, as
                                 // they cache the certificate responses. See http://b/5324235.
                                 SslCertLookupTable.getInstance().clear();
-                                nativeCloseIdleConnections();
+                                nativeCloseIdleConnections(mNativeClass);
                             } else {
                                 Network.getInstance(mContext).clearUserSslPrefTable();
                             }
@@ -1376,10 +1423,12 @@
                         case TOUCH_UP:
                             TouchUpData touchUpData = (TouchUpData) msg.obj;
                             if (touchUpData.mNativeLayer != 0) {
-                                nativeScrollLayer(touchUpData.mNativeLayer,
+                                nativeScrollLayer(mNativeClass,
+                                        touchUpData.mNativeLayer,
                                         touchUpData.mNativeLayerRect);
                             }
-                            nativeTouchUp(touchUpData.mMoveGeneration,
+                            nativeTouchUp(mNativeClass,
+                                    touchUpData.mMoveGeneration,
                                     touchUpData.mFrame, touchUpData.mNode,
                                     touchUpData.mX, touchUpData.mY);
                             break;
@@ -1394,11 +1443,13 @@
                                 yArray[c] = ted.mPoints[c].y;
                             }
                             if (ted.mNativeLayer != 0) {
-                                nativeScrollLayer(ted.mNativeLayer,
-                                        ted.mNativeLayerRect);
+                                nativeScrollLayer(mNativeClass,
+                                        ted.mNativeLayer, ted.mNativeLayerRect);
                             }
-                            ted.mNativeResult = nativeHandleTouchEvent(ted.mAction, ted.mIds,
-                                    xArray, yArray, count, ted.mActionIndex, ted.mMetaState);
+                            ted.mNativeResult = nativeHandleTouchEvent(
+                                    mNativeClass, ted.mAction, ted.mIds, xArray,
+                                    yArray, count, ted.mActionIndex,
+                                    ted.mMetaState);
                             Message.obtain(
                                     mWebView.mPrivateHandler,
                                     WebView.PREVENT_TOUCH_ID,
@@ -1409,7 +1460,7 @@
                         }
 
                         case SET_ACTIVE:
-                            nativeSetFocusControllerActive(msg.arg1 == 1);
+                            nativeSetFocusControllerActive(mNativeClass, msg.arg1 == 1);
                             break;
 
                         case ADD_JS_INTERFACE:
@@ -1435,39 +1486,39 @@
 
                         case SET_MOVE_FOCUS:
                             CursorData focusData = (CursorData) msg.obj;
-                            nativeMoveFocus(focusData.mFrame, focusData.mNode);
+                            nativeMoveFocus(mNativeClass, focusData.mFrame, focusData.mNode);
                             break;
 
                         case SET_MOVE_MOUSE:
                             CursorData cursorData = (CursorData) msg.obj;
-                            nativeMoveMouse(cursorData.mFrame,
-                                     cursorData.mX, cursorData.mY);
+                            nativeMoveMouse(mNativeClass,
+                                     cursorData.mFrame, cursorData.mX, cursorData.mY);
                             break;
 
                         case SET_MOVE_MOUSE_IF_LATEST:
                             CursorData cData = (CursorData) msg.obj;
-                            nativeMoveMouseIfLatest(cData.mMoveGeneration,
-                                    cData.mFrame,
-                                    cData.mX, cData.mY);
+                            nativeMoveMouseIfLatest(mNativeClass,
+                                    cData.mMoveGeneration,
+                                    cData.mFrame, cData.mX, cData.mY);
                             if (msg.arg1 == 1) {
-                                nativeStopPaintingCaret();
+                                nativeStopPaintingCaret(mNativeClass);
                             }
                             break;
 
                         case REQUEST_CURSOR_HREF: {
                             Message hrefMsg = (Message) msg.obj;
                             hrefMsg.getData().putString("url",
-                                    nativeRetrieveHref(msg.arg1, msg.arg2));
+                                    nativeRetrieveHref(mNativeClass, msg.arg1, msg.arg2));
                             hrefMsg.getData().putString("title",
-                                    nativeRetrieveAnchorText(msg.arg1, msg.arg2));
+                                    nativeRetrieveAnchorText(mNativeClass, msg.arg1, msg.arg2));
                             hrefMsg.getData().putString("src",
-                                    nativeRetrieveImageSource(msg.arg1, msg.arg2));
+                                    nativeRetrieveImageSource(mNativeClass, msg.arg1, msg.arg2));
                             hrefMsg.sendToTarget();
                             break;
                         }
 
                         case UPDATE_CACHE_AND_TEXT_ENTRY:
-                            nativeUpdateFrameCache();
+                            nativeUpdateFrameCache(mNativeClass);
                             // FIXME: this should provide a minimal rectangle
                             if (mWebView != null) {
                                 mWebView.postInvalidate();
@@ -1485,17 +1536,23 @@
                         case DELETE_SELECTION:
                             TextSelectionData deleteSelectionData
                                     = (TextSelectionData) msg.obj;
-                            nativeDeleteSelection(deleteSelectionData.mStart,
-                                    deleteSelectionData.mEnd, msg.arg1);
+                            nativeDeleteSelection(mNativeClass,
+                                    deleteSelectionData.mStart, deleteSelectionData.mEnd, msg.arg1);
+                            break;
+
+                        case DELETE_SURROUNDING_TEXT:
+                            nativeDeleteSurroundingText(mNativeClass,
+                                    msg.arg1, msg.arg2);
                             break;
 
                         case SET_SELECTION:
-                            nativeSetSelection(msg.arg1, msg.arg2);
+                            nativeSetSelection(mNativeClass, msg.arg1, msg.arg2);
                             break;
 
                         case MODIFY_SELECTION:
-                            String modifiedSelectionString = nativeModifySelection(msg.arg1,
-                                    msg.arg2);
+                            String modifiedSelectionString = 
+                                nativeModifySelection(mNativeClass, msg.arg1,
+                                        msg.arg2);
                             mWebView.mPrivateHandler.obtainMessage(WebView.SELECTION_STRING_CHANGED,
                                     modifiedSelectionString).sendToTarget();
                             break;
@@ -1508,36 +1565,36 @@
                             for (int c = 0; c < choicesSize; c++) {
                                 choicesArray[c] = choices.get(c);
                             }
-                            nativeSendListBoxChoices(choicesArray,
-                                    choicesSize);
+                            nativeSendListBoxChoices(mNativeClass,
+                                    choicesArray, choicesSize);
                             break;
 
                         case SINGLE_LISTBOX_CHOICE:
-                            nativeSendListBoxChoice(msg.arg1);
+                            nativeSendListBoxChoice(mNativeClass, msg.arg1);
                             break;
 
                         case SET_BACKGROUND_COLOR:
-                            nativeSetBackgroundColor(msg.arg1);
+                            nativeSetBackgroundColor(mNativeClass, msg.arg1);
                             break;
 
                         case DUMP_DOMTREE:
-                            nativeDumpDomTree(msg.arg1 == 1);
+                            nativeDumpDomTree(mNativeClass, msg.arg1 == 1);
                             break;
 
                         case DUMP_RENDERTREE:
-                            nativeDumpRenderTree(msg.arg1 == 1);
+                            nativeDumpRenderTree(mNativeClass, msg.arg1 == 1);
                             break;
 
                         case DUMP_NAVTREE:
-                            nativeDumpNavTree();
+                            nativeDumpNavTree(mNativeClass);
                             break;
 
                         case SET_JS_FLAGS:
-                            nativeSetJsFlags((String)msg.obj);
+                            nativeSetJsFlags(mNativeClass, (String)msg.obj);
                             break;
 
                         case CONTENT_INVALIDATE_ALL:
-                            nativeContentInvalidateAll();
+                            nativeContentInvalidateAll(mNativeClass);
                             break;
 
                         case SAVE_WEBARCHIVE:
@@ -1552,12 +1609,12 @@
                         case GEOLOCATION_PERMISSIONS_PROVIDE:
                             GeolocationPermissionsData data =
                                     (GeolocationPermissionsData) msg.obj;
-                            nativeGeolocationPermissionsProvide(data.mOrigin,
-                                    data.mAllow, data.mRemember);
+                            nativeGeolocationPermissionsProvide(mNativeClass,
+                                    data.mOrigin, data.mAllow, data.mRemember);
                             break;
 
                         case SPLIT_PICTURE_SET:
-                            nativeSplitContent(msg.arg1);
+                            nativeSplitContent(mNativeClass, msg.arg1);
                             mWebView.mPrivateHandler.obtainMessage(
                                     WebView.REPLACE_BASE_CONTENT, msg.arg1, 0);
                             mSplitPictureIsScheduled = false;
@@ -1575,15 +1632,15 @@
                             break;
 
                         case POPULATE_VISITED_LINKS:
-                            nativeProvideVisitedHistory((String[])msg.obj);
+                            nativeProvideVisitedHistory(mNativeClass, (String[])msg.obj);
                             break;
 
                         case VALID_NODE_BOUNDS: {
                             MotionUpData motionUpData = (MotionUpData) msg.obj;
                             if (!nativeValidNodeAndBounds(
-                                    motionUpData.mFrame, motionUpData.mNode,
-                                    motionUpData.mBounds)) {
-                                nativeUpdateFrameCache();
+                                    mNativeClass, motionUpData.mFrame,
+                                    motionUpData.mNode, motionUpData.mBounds)) {
+                                nativeUpdateFrameCache(mNativeClass);
                             }
                             Message message = mWebView.mPrivateHandler
                                     .obtainMessage(WebView.DO_MOTION_UP,
@@ -1594,11 +1651,11 @@
                         }
 
                         case HIDE_FULLSCREEN:
-                            nativeFullScreenPluginHidden(msg.arg1);
+                            nativeFullScreenPluginHidden(mNativeClass, msg.arg1);
                             break;
 
                         case PLUGIN_SURFACE_READY:
-                            nativePluginSurfaceReady();
+                            nativePluginSurfaceReady(mNativeClass);
                             break;
 
                         case NOTIFY_ANIMATION_STARTED:
@@ -1617,11 +1674,11 @@
                         case GET_TOUCH_HIGHLIGHT_RECTS:
                             TouchHighlightData d = (TouchHighlightData) msg.obj;
                             if (d.mNativeLayer != 0) {
-                                nativeScrollLayer(d.mNativeLayer,
-                                        d.mNativeLayerRect);
+                                nativeScrollLayer(mNativeClass,
+                                        d.mNativeLayer, d.mNativeLayerRect);
                             }
                             ArrayList<Rect> rects = nativeGetTouchHighlightRects
-                                    (d.mX, d.mY, d.mSlop);
+                                    (mNativeClass, d.mX, d.mY, d.mSlop);
                             mWebView.mPrivateHandler.obtainMessage(
                                     WebView.SET_TOUCH_HIGHLIGHT_RECTS, rects)
                                     .sendToTarget();
@@ -1632,7 +1689,7 @@
                             break;
 
                         case AUTOFILL_FORM:
-                            nativeAutoFillForm(msg.arg1);
+                            nativeAutoFillForm(mNativeClass, msg.arg1);
                             mWebView.mPrivateHandler.obtainMessage(WebView.AUTOFILL_COMPLETE, null)
                                     .sendToTarget();
                             break;
@@ -1853,9 +1910,9 @@
             unicodeChar = evt.getCharacters().codePointAt(0);
         }
 
-        if (!nativeKey(keyCode, unicodeChar, evt.getRepeatCount(), evt.isShiftPressed(),
-                evt.isAltPressed(), evt.isSymPressed(),
-                isDown) && keyCode != KeyEvent.KEYCODE_ENTER) {
+        if (!nativeKey(mNativeClass, keyCode, unicodeChar, evt.getRepeatCount(),
+                evt.isShiftPressed(), evt.isAltPressed(),
+                evt.isSymPressed(), isDown) && keyCode != KeyEvent.KEYCODE_ENTER) {
             if (keyCode >= KeyEvent.KEYCODE_DPAD_UP
                     && keyCode <= KeyEvent.KEYCODE_DPAD_RIGHT) {
                 if (DebugFlags.WEB_VIEW_CORE) {
@@ -1901,9 +1958,9 @@
             float ratio = (heightWidthRatio > 0) ? heightWidthRatio : (float) h / w;
             height = Math.round(ratio * width);
         }
-        nativeSetSize(width, height, textwrapWidth, scale, w,
-                data.mActualViewHeight > 0 ? data.mActualViewHeight : h,
-                data.mAnchorX, data.mAnchorY, data.mIgnoreHeight);
+        int screenHeight = data.mActualViewHeight > 0 ? data.mActualViewHeight : h;
+        nativeSetSize(mNativeClass, width, height, textwrapWidth, scale,
+                w, screenHeight, data.mAnchorX, data.mAnchorY, data.mIgnoreHeight);
         // Remember the current width and height
         boolean needInvalidate = (mCurrentViewWidth == 0);
         mCurrentViewWidth = w;
@@ -2039,7 +2096,8 @@
         mDrawIsScheduled = false;
         DrawData draw = new DrawData();
         if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw start");
-        draw.mBaseLayer = nativeRecordContent(draw.mInvalRegion, draw.mContentSize);
+        draw.mBaseLayer = nativeRecordContent(mNativeClass, draw.mInvalRegion,
+                draw.mContentSize);
         if (draw.mBaseLayer == 0) {
             if (mWebView != null && !mWebView.isPaused()) {
                 if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw abort, resending draw message");
@@ -2055,14 +2113,14 @@
 
     private void webkitDraw(DrawData draw) {
         if (mWebView != null) {
-            draw.mFocusSizeChanged = nativeFocusBoundsChanged();
+            draw.mFocusSizeChanged = nativeFocusBoundsChanged(mNativeClass);
             draw.mViewSize = new Point(mCurrentViewWidth, mCurrentViewHeight);
             if (mSettings.getUseWideViewPort()) {
                 draw.mMinPrefWidth = Math.max(
                         mViewportWidth == -1 ? WebView.DEFAULT_VIEWPORT_WIDTH
                                 : (mViewportWidth == 0 ? mCurrentViewWidth
                                         : mViewportWidth),
-                        nativeGetContentMinPrefWidth());
+                        nativeGetContentMinPrefWidth(mNativeClass));
             }
             if (mInitialViewState != null) {
                 draw.mViewState = mInitialViewState;
@@ -2113,7 +2171,7 @@
                     Log.w(LOGTAG, "Cannot pauseUpdatePicture, core destroyed or not initialized!");
                     return;
                 }
-                core.nativeSetIsPaused(true);
+                core.nativeSetIsPaused(core.mNativeClass, true);
                 core.mDrawIsPaused = true;
             }
         }
@@ -2131,7 +2189,7 @@
                     Log.w(LOGTAG, "Cannot resumeUpdatePicture, core destroyed!");
                     return;
                 }
-                core.nativeSetIsPaused(false);
+                core.nativeSetIsPaused(core.mNativeClass, false);
                 core.mDrawIsPaused = false;
                 // always redraw on resume to reenable gif animations
                 core.mDrawIsScheduled = false;
@@ -2255,7 +2313,7 @@
         return mWebView;
     }
 
-    private native void setViewportSettingsFromNative();
+    private native void setViewportSettingsFromNative(int nativeClass);
 
     // called by JNI
     private void didFirstLayout(boolean standardLoad) {
@@ -2300,7 +2358,7 @@
             return;
         }
         // set the viewport settings from WebKit
-        setViewportSettingsFromNative();
+        setViewportSettingsFromNative(mNativeClass);
 
         // clamp initial scale
         if (mViewportInitialScale > 0) {
@@ -2338,11 +2396,7 @@
         // adjust the default scale to match the densityDpi
         float adjust = 1.0f;
         if (mViewportDensityDpi == -1) {
-            // convert default zoom scale to a integer (percentage) to avoid any
-            // issues with floating point comparisons
-            if (mWebView != null && (int)(mWebView.getDefaultZoomScale() * 100) != 100) {
-                adjust = mWebView.getDefaultZoomScale();
-            }
+            adjust = mContext.getResources().getDisplayMetrics().density;
         } else if (mViewportDensityDpi > 0) {
             adjust = (float) mContext.getResources().getDisplayMetrics().densityDpi
                     / mViewportDensityDpi;
@@ -2614,18 +2668,22 @@
                 WebView.FIND_AGAIN).sendToTarget();
     }
 
-    private native void nativeUpdateFrameCacheIfLoading();
-    private native void nativeRevealSelection();
-    private native String nativeRequestLabel(int framePtr, int nodePtr);
+    private native void nativeUpdateFrameCacheIfLoading(int nativeClass);
+    private native void nativeRevealSelection(int nativeClass);
+    private native String nativeRequestLabel(int nativeClass, int framePtr,
+            int nodePtr);
     /**
      * Scroll the focused textfield to (xPercent, y) in document space
      */
-    private native void nativeScrollFocusedTextInput(float xPercent, int y);
+    private native void nativeScrollFocusedTextInput(int nativeClass,
+            float xPercent, int y);
 
     // these must be in document space (i.e. not scaled/zoomed).
-    private native void nativeSetScrollOffset(int gen, boolean sendScrollEvent, int dx, int dy);
+    private native void nativeSetScrollOffset(int nativeClass, int gen,
+            boolean sendScrollEvent, int dx, int dy);
 
-    private native void nativeSetGlobalBounds(int x, int y, int w, int h);
+    private native void nativeSetGlobalBounds(int nativeClass, int x, int y,
+            int w, int h);
 
     // called by JNI
     private void requestListBox(String[] array, int[] enabledArray,
@@ -2860,18 +2918,18 @@
         return mDeviceOrientationService;
     }
 
-    private native void nativeSetIsPaused(boolean isPaused);
-    private native void nativePause();
-    private native void nativeResume();
-    private native void nativeFreeMemory();
-    private native void nativeFullScreenPluginHidden(int npp);
-    private native void nativePluginSurfaceReady();
-    private native boolean nativeValidNodeAndBounds(int frame, int node,
-            Rect bounds);
+    private native void nativeSetIsPaused(int nativeClass, boolean isPaused);
+    private native void nativePause(int nativeClass);
+    private native void nativeResume(int nativeClass);
+    private native void nativeFreeMemory(int nativeClass);
+    private native void nativeFullScreenPluginHidden(int nativeClass, int npp);
+    private native void nativePluginSurfaceReady(int nativeClass);
+    private native boolean nativeValidNodeAndBounds(int nativeClass, int frame,
+            int node, Rect bounds);
 
-    private native ArrayList<Rect> nativeGetTouchHighlightRects(int x, int y,
-            int slop);
+    private native ArrayList<Rect> nativeGetTouchHighlightRects(int nativeClass,
+            int x, int y, int slop);
 
-    private native void nativeAutoFillForm(int queryId);
-    private native void nativeScrollLayer(int layer, Rect rect);
+    private native void nativeAutoFillForm(int nativeClass, int queryId);
+    private native void nativeScrollLayer(int nativeClass, int layer, Rect rect);
 }
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index 12a93ac..a452fec 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -18,10 +18,10 @@
 
 import com.android.internal.R;
 
+import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Comparator;
-import java.util.HashSet;
-import java.util.LinkedList;
+import java.util.HashMap;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
@@ -151,6 +151,15 @@
 
     private static final int VERB_COUNT              = 16;
 
+
+    private static final int[] RULES_VERTICAL = {
+            ABOVE, BELOW, ALIGN_BASELINE, ALIGN_TOP, ALIGN_BOTTOM
+    };
+
+    private static final int[] RULES_HORIZONTAL = {
+            LEFT_OF, RIGHT_OF, ALIGN_LEFT, ALIGN_RIGHT
+    };
+
     private View mBaselineView = null;
     private boolean mHasBaselineAlignedChild;
 
@@ -284,14 +293,13 @@
 
         if (DEBUG_GRAPH) {
             d(LOG_TAG, "=== Sorted vertical children");
-            graph.log(getResources(), ABOVE, BELOW, ALIGN_BASELINE, ALIGN_TOP, ALIGN_BOTTOM);
+            graph.log(getResources(), RULES_VERTICAL);
             d(LOG_TAG, "=== Sorted horizontal children");
-            graph.log(getResources(), LEFT_OF, RIGHT_OF, ALIGN_LEFT, ALIGN_RIGHT);
+            graph.log(getResources(), RULES_HORIZONTAL);
         }
 
-        graph.getSortedViews(mSortedVerticalChildren, ABOVE, BELOW, ALIGN_BASELINE,
-                ALIGN_TOP, ALIGN_BOTTOM);
-        graph.getSortedViews(mSortedHorizontalChildren, LEFT_OF, RIGHT_OF, ALIGN_LEFT, ALIGN_RIGHT);
+        graph.getSortedViews(mSortedVerticalChildren, RULES_VERTICAL);
+        graph.getSortedViews(mSortedHorizontalChildren, RULES_HORIZONTAL);
 
         if (DEBUG_GRAPH) {
             d(LOG_TAG, "=== Ordered list of vertical children");
@@ -1216,7 +1224,7 @@
          * Temporary data structure used to build the list of roots
          * for this graph.
          */
-        private LinkedList<Node> mRoots = new LinkedList<Node>();
+        private ArrayDeque<Node> mRoots = new ArrayDeque<Node>();
 
         /**
          * Clears the graph.
@@ -1261,18 +1269,18 @@
          * @param rules The list of rules to take into account.
          */
         void getSortedViews(View[] sorted, int... rules) {
-            final LinkedList<Node> roots = findRoots(rules);
+            final ArrayDeque<Node> roots = findRoots(rules);
             int index = 0;
 
-            while (roots.size() > 0) {
-                final Node node = roots.removeFirst();
+            Node node;
+            while ((node = roots.pollLast()) != null) {
                 final View view = node.view;
                 final int key = view.getId();
 
                 sorted[index++] = view;
 
-                final HashSet<Node> dependents = node.dependents;
-                for (Node dependent : dependents) {
+                final HashMap<Node, DependencyGraph> dependents = node.dependents;
+                for (Node dependent : dependents.keySet()) {
                     final SparseArray<Node> dependencies = dependent.dependencies;
 
                     dependencies.remove(key);
@@ -1297,7 +1305,7 @@
          *
          * @return A list of node, each being a root of the graph
          */
-        private LinkedList<Node> findRoots(int[] rulesFilter) {
+        private ArrayDeque<Node> findRoots(int[] rulesFilter) {
             final SparseArray<Node> keyNodes = mKeyNodes;
             final ArrayList<Node> nodes = mNodes;
             final int count = nodes.size();
@@ -1330,20 +1338,20 @@
                             continue;
                         }
                         // Add the current node as a dependent
-                        dependency.dependents.add(node);
+                        dependency.dependents.put(node, this);
                         // Add a dependency to the current node
                         node.dependencies.put(rule, dependency);
                     }
                 }
             }
 
-            final LinkedList<Node> roots = mRoots;
+            final ArrayDeque<Node> roots = mRoots;
             roots.clear();
 
             // Finds all the roots in the graph: all nodes with no dependencies
             for (int i = 0; i < count; i++) {
                 final Node node = nodes.get(i);
-                if (node.dependencies.size() == 0) roots.add(node);
+                if (node.dependencies.size() == 0) roots.addLast(node);
             }
 
             return roots;
@@ -1356,7 +1364,7 @@
          * @param rules The list of rules to take into account.
          */
         void log(Resources resources, int... rules) {
-            final LinkedList<Node> roots = findRoots(rules);
+            final ArrayDeque<Node> roots = findRoots(rules);
             for (Node node : roots) {
                 printNode(resources, node);
             }
@@ -1382,7 +1390,7 @@
             if (node.dependents.size() == 0) {
                 printViewId(resources, node.view);
             } else {
-                for (Node dependent : node.dependents) {
+                for (Node dependent : node.dependents.keySet()) {
                     StringBuilder buffer = new StringBuilder();
                     appendViewId(resources, node, buffer);
                     printdependents(resources, dependent, buffer);
@@ -1397,7 +1405,7 @@
             if (node.dependents.size() == 0) {
                 d(LOG_TAG, buffer.toString());
             } else {
-                for (Node dependent : node.dependents) {
+                for (Node dependent : node.dependents.keySet()) {
                     StringBuilder subBuffer = new StringBuilder(buffer);
                     printdependents(resources, dependent, subBuffer);
                 }
@@ -1420,7 +1428,7 @@
              * The list of dependents for this node; a dependent is a node
              * that needs this node to be processed first.
              */
-            final HashSet<Node> dependents = new HashSet<Node>();
+            final HashMap<Node, DependencyGraph> dependents = new HashMap<Node, DependencyGraph>();
 
             /**
              * The list of dependencies for this node.
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 81fc069..3dd7a9f 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -11378,6 +11378,9 @@
             case TEXT_DIRECTION_RTL:
                 mTextDir = TextDirectionHeuristics.RTL;
                 break;
+            case TEXT_DIRECTION_LOCALE:
+                mTextDir = TextDirectionHeuristics.LOCALE;
+                break;
         }
     }
 
diff --git a/core/java/android/widget/VideoView.java b/core/java/android/widget/VideoView.java
index 8e438ff..64fdf34 100644
--- a/core/java/android/widget/VideoView.java
+++ b/core/java/android/widget/VideoView.java
@@ -380,7 +380,6 @@
                 }
 
                 new AlertDialog.Builder(mContext)
-                        .setTitle(com.android.internal.R.string.VideoView_error_title)
                         .setMessage(messageId)
                         .setPositiveButton(com.android.internal.R.string.VideoView_error_button,
                                 new DialogInterface.OnClickListener() {
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index b689f53..517ce4e 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -300,6 +300,7 @@
         mProgressView = new ProgressBar(mContext, null, 0, mProgressStyle);
         mProgressView.setId(R.id.progress_horizontal);
         mProgressView.setMax(10000);
+        mProgressView.setVisibility(GONE);
         addView(mProgressView);
     }
 
@@ -307,6 +308,7 @@
         mIndeterminateProgressView = new ProgressBar(mContext, null, 0,
                 mIndeterminateProgressStyle);
         mIndeterminateProgressView.setId(R.id.progress_circular);
+        mIndeterminateProgressView.setVisibility(GONE);
         addView(mIndeterminateProgressView);
     }
 
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index adb0ac9..905a171 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -117,6 +117,8 @@
             = "lockscreen.biometric_weak_fallback";
     public final static String BIOMETRIC_WEAK_EVER_CHOSEN_KEY
             = "lockscreen.biometricweakeverchosen";
+    public final static String LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS
+            = "lockscreen.power_button_instantly_locks";
 
     private final static String PASSWORD_HISTORY_KEY = "lockscreen.passwordhistory";
 
@@ -335,7 +337,7 @@
      * @return True if the user has ever chosen a pattern.
      */
     public boolean isPatternEverChosen() {
-        return getBoolean(PATTERN_EVER_CHOSEN_KEY);
+        return getBoolean(PATTERN_EVER_CHOSEN_KEY, false);
     }
 
     /**
@@ -345,7 +347,7 @@
      * @return True if the user has ever chosen biometric weak.
      */
     public boolean isBiometricWeakEverChosen() {
-        return getBoolean(BIOMETRIC_WEAK_EVER_CHOSEN_KEY);
+        return getBoolean(BIOMETRIC_WEAK_EVER_CHOSEN_KEY, false);
     }
 
     /**
@@ -845,7 +847,7 @@
                 getLong(PASSWORD_TYPE_ALTERNATE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING)
                 == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
 
-        return getBoolean(Settings.Secure.LOCK_PATTERN_ENABLED)
+        return getBoolean(Settings.Secure.LOCK_PATTERN_ENABLED, false)
                 && (getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING)
                         == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING ||
                         (usingBiometricWeak() && backupEnabled));
@@ -891,7 +893,7 @@
      * @return Whether the visible pattern is enabled.
      */
     public boolean isVisiblePatternEnabled() {
-        return getBoolean(Settings.Secure.LOCK_PATTERN_VISIBLE);
+        return getBoolean(Settings.Secure.LOCK_PATTERN_VISIBLE, false);
     }
 
     /**
@@ -905,7 +907,7 @@
      * @return Whether tactile feedback for the pattern is enabled.
      */
     public boolean isTactileFeedbackEnabled() {
-        return getBoolean(Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
+        return getBoolean(Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, false);
     }
 
     /**
@@ -946,7 +948,7 @@
      *   attempts.
      */
     public boolean isPermanentlyLocked() {
-        return getBoolean(LOCKOUT_PERMANENT_KEY);
+        return getBoolean(LOCKOUT_PERMANENT_KEY, false);
     }
 
     /**
@@ -989,9 +991,10 @@
         return nextAlarm;
     }
 
-    private boolean getBoolean(String secureSettingKey) {
+    private boolean getBoolean(String secureSettingKey, boolean defaultValue) {
         return 1 ==
-                android.provider.Settings.Secure.getInt(mContentResolver, secureSettingKey, 0);
+                android.provider.Settings.Secure.getInt(mContentResolver, secureSettingKey,
+                        defaultValue ? 1 : 0);
     }
 
     private void setBoolean(String secureSettingKey, boolean enabled) {
@@ -1092,4 +1095,12 @@
         mContext.startActivity(intent);
     }
 
+    public void setPowerButtonInstantlyLocks(boolean enabled) {
+        setBoolean(LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS, enabled);
+    }
+
+    public boolean getPowerButtonInstantlyLocks() {
+        return getBoolean(LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS, true);
+    }
+
 }
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 274121a..c006615 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -294,7 +294,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;
     }
 
@@ -396,7 +396,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");
 }
 
 /*
@@ -765,7 +765,7 @@
      * JNI calls.
      */
     if (JNI_CreateJavaVM(pJavaVM, pEnv, &initArgs) < 0) {
-        LOGE("JNI_CreateJavaVM failed\n");
+        ALOGE("JNI_CreateJavaVM failed\n");
         goto bail;
     }
 
@@ -837,7 +837,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;
     }
 
@@ -868,13 +868,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);
@@ -889,9 +889,9 @@
 
     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)
@@ -960,7 +960,7 @@
 
     result = vm->DetachCurrentThread();
     if (result != JNI_OK)
-        LOGE("ERROR: thread detach failed\n");
+        ALOGE("ERROR: thread detach failed\n");
     return result;
 }
 
diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp
index 8d05e28..4aa13f9 100644
--- a/core/jni/android/graphics/Canvas.cpp
+++ b/core/jni/android/graphics/Canvas.cpp
@@ -762,7 +762,7 @@
         value = TextLayoutCache::getInstance().getValue(paint, textArray, start, count,
                 contextCount, flags);
         if (value == NULL) {
-            LOGE("Cannot get TextLayoutCache value for text = '%s'",
+            ALOGE("Cannot get TextLayoutCache value for text = '%s'",
                     String8(textArray + start, count).string());
             return ;
         }
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/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 5099510..2d83851 100644
--- a/core/jni/android/graphics/TextLayout.cpp
+++ b/core/jni/android/graphics/TextLayout.cpp
@@ -64,7 +64,7 @@
             reinterpret_cast<const UChar*>(text), 0, len, len, bidiFlags);
 #endif
     if (value == NULL) {
-        LOGE("Cannot get TextLayoutCache value for text = '%s'",
+        ALOGE("Cannot get TextLayoutCache value for text = '%s'",
                 String8(text, len).string());
         return ;
     }
@@ -88,7 +88,7 @@
             reinterpret_cast<const UChar*>(chars), start, count, contextCount, dirFlags);
 #endif
     if (value == NULL) {
-        LOGE("Cannot get TextLayoutCache value for text = '%s'",
+        ALOGE("Cannot get TextLayoutCache value for text = '%s'",
                 String8(chars + start, count).string());
         return ;
     }
@@ -136,7 +136,7 @@
             reinterpret_cast<const UChar*>(text), 0, count, count, bidiFlags);
 #endif
     if (value == NULL) {
-        LOGE("Cannot get TextLayoutCache value for text = '%s'",
+        ALOGE("Cannot get TextLayoutCache value for text = '%s'",
                 String8(text, count).string());
         return ;
     }
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp
index 75251c9..1b7623d 100644
--- a/core/jni/android/graphics/TextLayoutCache.cpp
+++ b/core/jni/android/graphics/TextLayoutCache.cpp
@@ -423,7 +423,7 @@
                         isRTL = (paraDir == 1);
                         useSingleRun = true;
                     } else if (!U_SUCCESS(status) || rc < 1) {
-                        LOGW("Need to force to single run -- string = '%s',"
+                        ALOGW("Need to force to single run -- string = '%s',"
                                 " status = %d, rc = %d",
                                 String8(chars + start, count).string(), status, int(rc));
                         isRTL = (paraDir == 1);
@@ -438,7 +438,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("Visual run is not valid");
+                                ALOGW("Visual run is not valid");
                                 outGlyphs->clear();
                                 outAdvances->clear();
                                 *outTotalAdvance = 0;
@@ -475,13 +475,13 @@
                         }
                     }
                 } else {
-                    LOGW("Cannot set Para");
+                    ALOGW("Cannot set Para");
                     useSingleRun = true;
                     isRTL = (bidiReq = 1) || (bidiReq = UBIDI_DEFAULT_RTL);
                 }
                 ubidi_close(bidi);
             } else {
-                LOGW("Cannot ubidi_open()");
+                ALOGW("Cannot ubidi_open()");
                 useSingleRun = true;
                 isRTL = (bidiReq = 1) || (bidiReq = UBIDI_DEFAULT_RTL);
             }
diff --git a/core/jni/android/opengl/util.cpp b/core/jni/android/opengl/util.cpp
index 93717f3..929df540 100644
--- a/core/jni/android/opengl/util.cpp
+++ b/core/jni/android/opengl/util.cpp
@@ -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 15bb543..ac4fe5b 100644
--- a/core/jni/android_app_NativeActivity.cpp
+++ b/core/jni/android_app_NativeActivity.cpp
@@ -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;
         }
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_BackupHelperDispatcher.cpp b/core/jni/android_backup_BackupHelperDispatcher.cpp
index 1f188ff..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);
@@ -94,14 +94,14 @@
 
     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 3a1a13a..3b8fb79 100755
--- a/core/jni/android_bluetooth_BluetoothAudioGateway.cpp
+++ b/core/jni/android_bluetooth_BluetoothAudioGateway.cpp
@@ -127,7 +127,7 @@
 #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;
     }
 
@@ -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);
@@ -244,7 +244,7 @@
              ag_fd,
              FD_ISSET(ag_fd, &rset));
         if (ag_fd >= 0 && !FD_ISSET(ag_fd, &rset)) {
-            LOGE("WTF???");
+            ALOGE("WTF???");
             return -1;
         }
     }
@@ -271,7 +271,7 @@
         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);
@@ -284,7 +284,7 @@
             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);
@@ -322,7 +322,7 @@
         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;
     }
 
@@ -348,7 +348,7 @@
 
     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);
         }
@@ -388,13 +388,13 @@
         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);
         }
@@ -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;
     }
@@ -517,14 +517,14 @@
 
     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_HeadsetBase.cpp b/core/jni/android_bluetooth_HeadsetBase.cpp
index 8dd3116..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;
@@ -148,7 +148,7 @@
                 goto again;
             }
             *err = errno;
-            LOGE("read() error %s (%d)", strerror(errno), errno);
+            ALOGE("read() error %s (%d)", strerror(errno), errno);
             return NULL;
         }
 
@@ -195,7 +195,7 @@
 #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;
     }
 
@@ -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;
@@ -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,7 +306,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 -1;
         }
@@ -343,7 +343,7 @@
                 }
                 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;
@@ -410,7 +410,7 @@
 
         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;
@@ -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);
@@ -456,7 +456,7 @@
             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;
diff --git a/core/jni/android_bluetooth_common.cpp b/core/jni/android_bluetooth_common.cpp
index c8dc9c2..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;
     }
 
@@ -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;
     }
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 a916ef5..857267a 100644
--- a/core/jni/android_database_SQLiteCompiledSql.cpp
+++ b/core/jni/android_database_SQLiteCompiledSql.cpp
@@ -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 cf4cbb8..28c421d 100644
--- a/core/jni/android_database_SQLiteDatabase.cpp
+++ b/core/jni/android_database_SQLiteDatabase.cpp
@@ -92,7 +92,7 @@
     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;
         }
@@ -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);
@@ -244,7 +244,7 @@
         } 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();
     }
@@ -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;
@@ -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 ea4200a..da7ccf0 100644
--- a/core/jni/android_database_SQLiteQuery.cpp
+++ b/core/jni/android_database_SQLiteQuery.cpp
@@ -122,7 +122,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");
             result = CPR_ERROR;
             break;
@@ -153,7 +153,7 @@
         startPos = requiredPos;
         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;
         }
@@ -167,7 +167,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;
     }
@@ -216,7 +216,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 {
@@ -237,7 +237,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);
     }
     jlong result = jlong(startPos) << 32 | jlong(totalRows);
     return result;
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_debug_JNITest.cpp b/core/jni/android_debug_JNITest.cpp
index e0f61fb..9147284 100644
--- a/core/jni/android_debug_JNITest.cpp
+++ b/core/jni/android_debug_JNITest.cpp
@@ -46,7 +46,7 @@
     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;
     }
 
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 953da79..b89273b 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -173,7 +173,7 @@
     // 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();
@@ -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;
@@ -254,13 +254,13 @@
             }
 
             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;
     }
 
@@ -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;
     }
 
@@ -419,7 +419,7 @@
             }
         }
     } else {
-       LOGE("Null byte array!");
+       ALOGE("Null byte array!");
     }
 }
 
@@ -899,13 +899,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;
         }
 
@@ -940,21 +940,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 f53e2f7..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);
     }
 
@@ -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 6e1d443..1398968 100644
--- a/core/jni/android_hardware_UsbRequest.cpp
+++ b/core/jni/android_hardware_UsbRequest.cpp
@@ -46,7 +46,7 @@
 
     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;
     }
 
@@ -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 ca13c18..3052553 100644
--- a/core/jni/android_media_AudioRecord.cpp
+++ b/core/jni/android_media_AudioRecord.cpp
@@ -134,7 +134,7 @@
     //     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()
@@ -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;
     }
 
@@ -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;
     }
     //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;
     } 
 
@@ -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 2573aa6d..4067324 100644
--- a/core/jni/android_media_AudioTrack.cpp
+++ b/core/jni/android_media_AudioTrack.cpp
@@ -176,11 +176,11 @@
     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;
     }
 
@@ -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
@@ -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;
     }
 
@@ -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 66421a98..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;
     }
 }
@@ -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;
@@ -140,7 +140,7 @@
 
     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;
     }
 
@@ -152,7 +152,7 @@
         //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;
     }
@@ -182,7 +182,7 @@
         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;
     }
@@ -204,7 +204,7 @@
         //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;
     }
 }
@@ -226,7 +226,7 @@
         //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;
     }
@@ -253,7 +253,7 @@
             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;
     }
@@ -279,7 +279,7 @@
         //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;
     }
 
@@ -325,7 +325,7 @@
         //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;
     }
@@ -350,7 +350,7 @@
         //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;
     }
 
@@ -394,7 +394,7 @@
         //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;
     }
@@ -420,7 +420,7 @@
         //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;
     }
@@ -444,7 +444,7 @@
         //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;
     }
@@ -467,7 +467,7 @@
         //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 965afae..49be1c7 100644
--- a/core/jni/android_media_ToneGenerator.cpp
+++ b/core/jni/android_media_ToneGenerator.cpp
@@ -86,14 +86,14 @@
     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;
     }
     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;
     }
@@ -133,13 +133,13 @@
 
     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;
     }
     ALOGV("register_android_media_ToneGenerator ToneGenerator fields.context: %x", (unsigned int)fields.context);
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_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_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index d9908ce..9586717 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -517,14 +517,14 @@
     /* 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;
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 2bab4b5..d065a9e 100644
--- a/core/jni/android_server_BluetoothA2dpService.cpp
+++ b/core/jni/android_server_BluetoothA2dpService.cpp
@@ -65,7 +65,7 @@
 #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;
     }
@@ -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;
@@ -268,7 +268,7 @@
         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__);
@@ -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 d146e27..9292fc0 100644
--- a/core/jni/android_server_BluetoothEventLoop.cpp
+++ b/core/jni/android_server_BluetoothEventLoop.cpp
@@ -161,7 +161,7 @@
 #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);
@@ -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);
         }
@@ -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);
@@ -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;
     }
 
@@ -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,7 +1126,7 @@
                                    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;
         }
 
@@ -1145,7 +1145,7 @@
         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;
         }
 
@@ -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,7 +1277,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);
@@ -1354,7 +1354,7 @@
             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;
         }
     }
@@ -1445,7 +1445,7 @@
         !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);
     }
 
diff --git a/core/jni/android_server_BluetoothService.cpp b/core/jni/android_server_BluetoothService.cpp
index 9dbe774..c475261 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;
@@ -113,7 +113,7 @@
 #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;
     }
@@ -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;
     }
@@ -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 {
@@ -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;
@@ -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;
@@ -564,7 +564,7 @@
         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;
@@ -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;
@@ -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;
         }
@@ -654,7 +654,7 @@
         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;
@@ -685,7 +685,7 @@
         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;
@@ -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);
@@ -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);
@@ -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;
@@ -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;
@@ -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);
@@ -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,
@@ -1198,7 +1198,7 @@
                                        jstring dstRole) {
     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 =
@@ -1230,7 +1230,7 @@
                                      jstring path) {
     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 =
@@ -1260,7 +1260,7 @@
                                                 jstring iface) {
     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 =
@@ -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;
         }
 
@@ -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;
         }
 
@@ -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) {
@@ -1647,7 +1647,7 @@
 
         int flags = fcntl(fd, F_GETFL);
         if (flags < 0) {
-           LOGE("Can't get flags with fcntl(): %s (%d)",
+           ALOGE("Can't get flags with fcntl(): %s (%d)",
                                 strerror(errno), errno);
            releaseChannelFdNative(env, object, channelPath);
            close(fd);
@@ -1657,7 +1657,7 @@
         flags &= ~O_NONBLOCK;
         int status = fcntl(fd, F_SETFL, flags);
         if (status < 0) {
-           LOGE("Can't set flags with fcntl(): %s (%d)",
+           ALOGE("Can't set flags with fcntl(): %s (%d)",
                strerror(errno), errno);
            releaseChannelFdNative(env, object, channelPath);
            close(fd);
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 cf52833..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));
     }
 }
 
@@ -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_Binder.cpp b/core/jni/android_util_Binder.cpp
index b2ecf62..990a617 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -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;
     }
@@ -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();
             }
         }
@@ -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.
@@ -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;
     }
@@ -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;
     }
 
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 8660668..2c494ac 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -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;
         }
 
@@ -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;
             }
@@ -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;
@@ -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;
@@ -521,7 +521,7 @@
 
         free(buffer);
     } else {
-        LOGW("Unable to open %s", file.string());
+        ALOGW("Unable to open %s", file.string());
     }
 
     //ALOGI("Done!");
@@ -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;
diff --git a/core/jni/android_view_DisplayEventReceiver.cpp b/core/jni/android_view_DisplayEventReceiver.cpp
index f61795d..25397b5 100644
--- a/core/jni/android_view_DisplayEventReceiver.cpp
+++ b/core/jni/android_view_DisplayEventReceiver.cpp
@@ -84,7 +84,7 @@
 status_t NativeDisplayEventReceiver::initialize() {
     status_t result = mReceiver.initCheck();
     if (result) {
-        LOGW("Failed to initialize display event receiver, status=%d", result);
+        ALOGW("Failed to initialize display event receiver, status=%d", result);
         return result;
     }
 
@@ -103,13 +103,13 @@
         }
 
         if (n < 0) {
-            LOGW("Failed to drain events from display event receiver, status=%d", status_t(n));
+            ALOGW("Failed to drain events from display event receiver, status=%d", status_t(n));
             return status_t(n);
         }
 
         status_t status = mReceiver.requestNextVsync();
         if (status) {
-            LOGW("Failed to request next vsync, status=%d", status);
+            ALOGW("Failed to request next vsync, status=%d", status);
             return status;
         }
 
@@ -131,14 +131,14 @@
     sp<NativeDisplayEventReceiver> r = static_cast<NativeDisplayEventReceiver*>(data);
 
     if (events & (ALOOPER_EVENT_ERROR | ALOOPER_EVENT_HANGUP)) {
-        LOGE("Display event receiver pipe was closed or an error occurred.  "
+        ALOGE("Display event receiver pipe was closed or an error occurred.  "
                 "events=0x%x", events);
         r->mFdCallbackRegistered = false;
         return 0; // remove the callback
     }
 
     if (!(events & ALOOPER_EVENT_INPUT)) {
-        LOGW("Received spurious callback for unhandled poll event.  "
+        ALOGW("Received spurious callback for unhandled poll event.  "
                 "events=0x%x", events);
         return 1; // keep the callback
     }
@@ -177,7 +177,7 @@
     ALOGV("receiver %p ~ Returned from vsync handler.", this);
 
     if (env->ExceptionCheck()) {
-        LOGE("An exception occurred while dispatching a vsync event.");
+        ALOGE("An exception occurred while dispatching a vsync event.");
         LOGE_EX(env);
         env->ExceptionClear();
     }
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 383d5ae..23ad154 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -491,7 +491,7 @@
 #if USE_TEXT_LAYOUT_CACHE
     value = TextLayoutCache::getInstance().getValue(paint, text, 0, count, count, flags);
     if (value == NULL) {
-        LOGE("Cannot get TextLayoutCache value for text = '%s'",
+        ALOGE("Cannot get TextLayoutCache value for text = '%s'",
                 String8(text, count).string());
         return;
     }
@@ -513,7 +513,7 @@
 #if USE_TEXT_LAYOUT_CACHE
     value = TextLayoutCache::getInstance().getValue(paint, text, start, count, contextCount, flags);
     if (value == NULL) {
-        LOGE("Cannot get TextLayoutCache value for text = '%s'",
+        ALOGE("Cannot get TextLayoutCache value for text = '%s'",
                 String8(text + start, count).string());
         return;
     }
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_InputEventReceiver.cpp b/core/jni/android_view_InputEventReceiver.cpp
index c8f1f51..ed0acce 100644
--- a/core/jni/android_view_InputEventReceiver.cpp
+++ b/core/jni/android_view_InputEventReceiver.cpp
@@ -95,7 +95,7 @@
 status_t NativeInputEventReceiver::initialize() {
     status_t result = mInputConsumer.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",
                 getInputChannelName(), result);
         return result;
     }
@@ -114,12 +114,12 @@
 
         status_t status = mInputConsumer.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",
                     getInputChannelName(), status);
         }
         return status;
     } else {
-        LOGW("Ignoring attempt to finish input event while no event is in progress.");
+        ALOGW("Ignoring attempt to finish input event while no event is in progress.");
         return OK;
     }
 }
@@ -128,26 +128,26 @@
     sp<NativeInputEventReceiver> r = static_cast<NativeInputEventReceiver*>(data);
 
     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", r->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", r->getInputChannelName(), events);
         return 1;
     }
 
     status_t status = r->mInputConsumer.receiveDispatchSignal();
     if (status) {
-        LOGE("channel '%s' ~ Failed to receive dispatch signal.  status=%d",
+        ALOGE("channel '%s' ~ Failed to receive dispatch signal.  status=%d",
                 r->getInputChannelName(), status);
         return 0; // remove the callback
     }
 
     if (r->mEventInProgress) {
-        LOGW("channel '%s' ~ Publisher sent spurious dispatch signal.",
+        ALOGW("channel '%s' ~ Publisher sent spurious dispatch signal.",
                 r->getInputChannelName());
         return 1;
     }
@@ -155,7 +155,7 @@
     InputEvent* inputEvent;
     status = r->mInputConsumer.consume(&r->mInputEventFactory, &inputEvent);
     if (status) {
-        LOGW("channel '%s' ~ Failed to consume input event.  status=%d",
+        ALOGW("channel '%s' ~ Failed to consume input event.  status=%d",
                 r->getInputChannelName(), status);
         r->mInputConsumer.sendFinishedSignal(false);
         return 1;
@@ -188,7 +188,7 @@
     }
 
     if (!inputEventObj) {
-        LOGW("channel '%s' ~ Failed to obtain event object.",
+        ALOGW("channel '%s' ~ Failed to obtain event object.",
                 r->getInputChannelName());
         r->mInputConsumer.sendFinishedSignal(false);
         return 1;
@@ -206,7 +206,7 @@
 #endif
 
     if (env->ExceptionCheck()) {
-        LOGE("channel '%s' ~ An exception occurred while dispatching an event.",
+        ALOGE("channel '%s' ~ An exception occurred while dispatching an event.",
                 r->getInputChannelName());
         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_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/res/res/drawable-large-nodpi/default_wallpaper.jpg b/core/res/res/drawable-large-nodpi/default_wallpaper.jpg
index 7d7cdbb..355286e 100644
--- a/core/res/res/drawable-large-nodpi/default_wallpaper.jpg
+++ b/core/res/res/drawable-large-nodpi/default_wallpaper.jpg
Binary files differ
diff --git a/core/res/res/drawable-nodpi/default_wallpaper.jpg b/core/res/res/drawable-nodpi/default_wallpaper.jpg
index 5ba522f..7e92243 100644
--- a/core/res/res/drawable-nodpi/default_wallpaper.jpg
+++ b/core/res/res/drawable-nodpi/default_wallpaper.jpg
Binary files differ
diff --git a/core/res/res/drawable-xlarge-nodpi/default_wallpaper.jpg b/core/res/res/drawable-xlarge-nodpi/default_wallpaper.jpg
index 7d7cdbb..355286e 100644
--- a/core/res/res/drawable-xlarge-nodpi/default_wallpaper.jpg
+++ b/core/res/res/drawable-xlarge-nodpi/default_wallpaper.jpg
Binary files differ
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index af59198..fea8523 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2066,6 +2066,8 @@
             <enum name="ltr" value="4" />
             <!-- The paragraph direction is right to left. -->
             <enum name="rtl" value="5" />
+            <!-- The paragraph direction is coming from the system Locale. -->
+            <enum name="locale" value="6" />
         </attr>
     </declare-styleable>
 
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 80aef215..dc45c408 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2568,6 +2568,8 @@
     <string name="report">Report</string>
     <!-- Button allowing the user to choose to wait for an application that is not responding to become responsive again. -->
     <string name="wait">Wait</string>
+    <!-- Text of the alert that is displayed when a web page is not responding. [CHAR-LIMIT=NONE] -->
+    <string name="webpage_unresponsive">The page has become unresponsive.\n\nDo you want to close it?</string>
     <!-- [CHAR LIMIT=25] Title of the alert when application launches on top of another. -->
     <string name="launch_warning_title">App redirected</string>
     <!-- [CHAR LIMIT=50] Title of the alert when application launches on top of another. -->
diff --git a/core/tests/coretests/src/android/widget/TextViewTest.java b/core/tests/coretests/src/android/widget/TextViewTest.java
index 5f65faf..d4dbced 100644
--- a/core/tests/coretests/src/android/widget/TextViewTest.java
+++ b/core/tests/coretests/src/android/widget/TextViewTest.java
@@ -86,6 +86,9 @@
 
         tv.setTextDirection(View.TEXT_DIRECTION_RTL);
         assertEquals(View.TEXT_DIRECTION_RTL, tv.getTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_LOCALE);
+        assertEquals(View.TEXT_DIRECTION_LOCALE, tv.getTextDirection());
     }
 
     @SmallTest
@@ -93,81 +96,13 @@
         TextView tv = new TextView(getActivity());
         tv.setText("this is a test");
 
-        tv.setTextDirection(View.TEXT_DIRECTION_FIRST_STRONG);
-        assertEquals(View.TEXT_DIRECTION_LTR, tv.getResolvedTextDirection());
-
-        tv.setTextDirection(View.TEXT_DIRECTION_ANY_RTL);
-        assertEquals(View.TEXT_DIRECTION_LTR, tv.getResolvedTextDirection());
-
-        tv.setTextDirection(View.TEXT_DIRECTION_INHERIT);
-        assertEquals(View.TEXT_DIRECTION_LTR, tv.getResolvedTextDirection());
-
-        tv.setTextDirection(View.TEXT_DIRECTION_LTR);
-        assertEquals(View.TEXT_DIRECTION_LTR, tv.getResolvedTextDirection());
-
-        tv.setTextDirection(View.TEXT_DIRECTION_RTL);
-        assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
-    }
-
-    @SmallTest
-    public void testGetResolvedTextDirectionLtrWithInheritance() {
-        LinearLayout ll = new LinearLayout(getActivity());
-        ll.setTextDirection(View.TEXT_DIRECTION_RTL);
-
-        TextView tv = new TextView(getActivity());
-        tv.setText("this is a test");
-        ll.addView(tv);
+        assertEquals(View.TEXT_DIRECTION_FIRST_STRONG, tv.getResolvedTextDirection());
 
         tv.setTextDirection(View.TEXT_DIRECTION_FIRST_STRONG);
-        assertEquals(View.TEXT_DIRECTION_LTR, tv.getResolvedTextDirection());
+        assertEquals(View.TEXT_DIRECTION_FIRST_STRONG, tv.getResolvedTextDirection());
 
         tv.setTextDirection(View.TEXT_DIRECTION_ANY_RTL);
-        assertEquals(View.TEXT_DIRECTION_LTR, tv.getResolvedTextDirection());
-
-        tv.setTextDirection(View.TEXT_DIRECTION_INHERIT);
-        assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
-
-        tv.setTextDirection(View.TEXT_DIRECTION_LTR);
-        assertEquals(View.TEXT_DIRECTION_LTR, tv.getResolvedTextDirection());
-
-        tv.setTextDirection(View.TEXT_DIRECTION_RTL);
-        assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
-    }
-
-    @SmallTest
-    public void testGetResolvedTextDirectionRtl() {
-        TextView tv = new TextView(getActivity());
-        tv.setText("\u05DD\u05DE"); // hebrew
-
-        tv.setTextDirection(View.TEXT_DIRECTION_FIRST_STRONG);
-        assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
-
-        tv.setTextDirection(View.TEXT_DIRECTION_ANY_RTL);
-        assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
-
-        tv.setTextDirection(View.TEXT_DIRECTION_INHERIT);
-        assertEquals(View.TEXT_DIRECTION_LTR, tv.getResolvedTextDirection());
-
-        tv.setTextDirection(View.TEXT_DIRECTION_LTR);
-        assertEquals(View.TEXT_DIRECTION_LTR, tv.getResolvedTextDirection());
-
-        tv.setTextDirection(View.TEXT_DIRECTION_RTL);
-        assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
-    }
-
-    @SmallTest
-    public void testGetResolvedTextDirectionRtlWithInheritance() {
-        LinearLayout ll = new LinearLayout(getActivity());
-
-        TextView tv = new TextView(getActivity());
-        tv.setText("\u05DD\u05DE"); // hebrew
-        ll.addView(tv);
-
-        tv.setTextDirection(View.TEXT_DIRECTION_FIRST_STRONG);
-        assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
-
-        tv.setTextDirection(View.TEXT_DIRECTION_ANY_RTL);
-        assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
+        assertEquals(View.TEXT_DIRECTION_ANY_RTL, tv.getResolvedTextDirection());
 
         tv.setTextDirection(View.TEXT_DIRECTION_INHERIT);
         assertEquals(View.TEXT_DIRECTION_FIRST_STRONG, tv.getResolvedTextDirection());
@@ -178,14 +113,99 @@
         tv.setTextDirection(View.TEXT_DIRECTION_RTL);
         assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
 
+        tv.setTextDirection(View.TEXT_DIRECTION_LOCALE);
+        assertEquals(View.TEXT_DIRECTION_LOCALE, tv.getResolvedTextDirection());
+    }
+
+    @SmallTest
+    public void testGetResolvedTextDirectionLtrWithInheritance() {
+        LinearLayout ll = new LinearLayout(getActivity());
+        ll.setTextDirection(View.TEXT_DIRECTION_ANY_RTL);
+
+        TextView tv = new TextView(getActivity());
+        tv.setText("this is a test");
+        ll.addView(tv);
+
+        tv.setTextDirection(View.TEXT_DIRECTION_FIRST_STRONG);
+        assertEquals(View.TEXT_DIRECTION_FIRST_STRONG, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_ANY_RTL);
+        assertEquals(View.TEXT_DIRECTION_ANY_RTL, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_INHERIT);
+        assertEquals(View.TEXT_DIRECTION_ANY_RTL, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_LTR);
+        assertEquals(View.TEXT_DIRECTION_LTR, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_RTL);
+        assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_LOCALE);
+        assertEquals(View.TEXT_DIRECTION_LOCALE, tv.getResolvedTextDirection());
+    }
+
+    @SmallTest
+    public void testGetResolvedTextDirectionRtl() {
+        TextView tv = new TextView(getActivity());
+        tv.setText("\u05DD\u05DE"); // hebrew
+
+        assertEquals(View.TEXT_DIRECTION_FIRST_STRONG, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_FIRST_STRONG);
+        assertEquals(View.TEXT_DIRECTION_FIRST_STRONG, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_ANY_RTL);
+        assertEquals(View.TEXT_DIRECTION_ANY_RTL, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_INHERIT);
+        assertEquals(View.TEXT_DIRECTION_FIRST_STRONG, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_LTR);
+        assertEquals(View.TEXT_DIRECTION_LTR, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_RTL);
+        assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_LOCALE);
+        assertEquals(View.TEXT_DIRECTION_LOCALE, tv.getResolvedTextDirection());
+    }
+
+    @SmallTest
+    public void testGetResolvedTextDirectionRtlWithInheritance() {
+        LinearLayout ll = new LinearLayout(getActivity());
+        ll.setTextDirection(View.TEXT_DIRECTION_FIRST_STRONG);
+
+        TextView tv = new TextView(getActivity());
+        tv.setText("\u05DD\u05DE"); // hebrew
+        ll.addView(tv);
+
+        tv.setTextDirection(View.TEXT_DIRECTION_FIRST_STRONG);
+        assertEquals(View.TEXT_DIRECTION_FIRST_STRONG, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_ANY_RTL);
+        assertEquals(View.TEXT_DIRECTION_ANY_RTL, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_INHERIT);
+        assertEquals(View.TEXT_DIRECTION_FIRST_STRONG, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_LTR);
+        assertEquals(View.TEXT_DIRECTION_LTR, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_RTL);
+        assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_LOCALE);
+        assertEquals(View.TEXT_DIRECTION_LOCALE, tv.getResolvedTextDirection());
+
         // Force to RTL text direction on the layout
         ll.setTextDirection(View.TEXT_DIRECTION_RTL);
 
         tv.setTextDirection(View.TEXT_DIRECTION_FIRST_STRONG);
-        assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
+        assertEquals(View.TEXT_DIRECTION_FIRST_STRONG, tv.getResolvedTextDirection());
 
         tv.setTextDirection(View.TEXT_DIRECTION_ANY_RTL);
-        assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
+        assertEquals(View.TEXT_DIRECTION_ANY_RTL, tv.getResolvedTextDirection());
 
         tv.setTextDirection(View.TEXT_DIRECTION_INHERIT);
         assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
@@ -195,6 +215,9 @@
 
         tv.setTextDirection(View.TEXT_DIRECTION_RTL);
         assertEquals(View.TEXT_DIRECTION_RTL, tv.getResolvedTextDirection());
+
+        tv.setTextDirection(View.TEXT_DIRECTION_LOCALE);
+        assertEquals(View.TEXT_DIRECTION_LOCALE, tv.getResolvedTextDirection());
     }
 
     @SmallTest
diff --git a/docs/html/guide/appendix/api-levels.jd b/docs/html/guide/appendix/api-levels.jd
index 7d119ca..cc98f8f 100644
--- a/docs/html/guide/appendix/api-levels.jd
+++ b/docs/html/guide/appendix/api-levels.jd
@@ -154,7 +154,7 @@
     <td>2</td>
     <td>{@link android.os.Build.VERSION_CODES#BASE_1_1}</td><td></td></tr>
     
-  <tr><td><a href="{@docRoot}sdk/android-1.0.html">Android 1.0</td>
+  <tr><td>Android 1.0</td>
     <td>1</td>
     <td>{@link android.os.Build.VERSION_CODES#BASE}</td>
     <td></td></tr>
diff --git a/docs/html/guide/developing/device.jd b/docs/html/guide/developing/device.jd
index 62ebfee..c4d08ed 100644
--- a/docs/html/guide/developing/device.jd
+++ b/docs/html/guide/developing/device.jd
@@ -79,10 +79,8 @@
   <a href="{@docRoot}sdk/oem-usb.html">OEM USB Drivers</a> document.</li>
       <li>If you're developing on Mac OS X, it just works. Skip this step.</li>
       
-      <li>If you're developing on Ubuntu Linux, you need to add a <a
-href="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html">
-<code>udev</code></a> 
-rules file that contains a USB configuration for each type of device
+      <li>If you're developing on Ubuntu Linux, you need to add a
+<code>udev</code> rules file that contains a USB configuration for each type of device
 you want to use for development. In the rules file, each device manufacturer
 is identified by a unique vendor ID, as specified by the
 <code>ATTR{idVendor}</code> property. For a list of vendor IDs, see  <a
diff --git a/docs/html/guide/developing/devices/emulator.jd b/docs/html/guide/developing/devices/emulator.jd
index 8211275..02dcb68 100644
--- a/docs/html/guide/developing/devices/emulator.jd
+++ b/docs/html/guide/developing/devices/emulator.jd
@@ -480,7 +480,7 @@
   <td>Enable the root shell (as in <code>-shell</code> and specify the QEMU character 
   device to use for communication with the shell.</td>
   <td>&lt;device&gt; must be a QEMU device type. See the documentation for '-serial <em>dev</em>' at 
-  <a href="http://www.nongnu.org/qemu/qemu-doc.html#SEC10">http://www.bellard.org/qemu/qemu-doc.html#SEC10</a> 
+  <a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a> 
   for a list of device types.
 
 <p>Here are some examples: </p>
@@ -619,7 +619,7 @@
   <td>Use this command to emulate an NMEA-compatible GPS unit connected to
   an external character device or socket. The format of <code>&lt;device&gt;</code> must be QEMU-specific 
   serial device specification. See the documentation for 'serial -dev' at 
-  <a href="http://www.bellard.org/qemu/qemu-doc.html#SEC10">http://www.bellard.org/qemu/qemu-doc.html#SEC10</a>.
+  <a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>.
 </td>
 </tr>
 <tr>
@@ -638,7 +638,7 @@
   <td>Redirect radio mode to the specified character device.</td>
   <td>The format of <code>&lt;device&gt;</code> must be QEMU-specific 
   serial device specification. See the documentation for 'serial -dev' at 
-<a href="http://www.bellard.org/qemu/qemu-doc.html#SEC10">http://www.bellard.org/qemu/qemu-doc.html#SEC10</a>.
+<a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>.
 </td>
 </tr>
 <tr>
diff --git a/docs/html/guide/practices/screens-support-1.5.jd b/docs/html/guide/practices/screens-support-1.5.jd
index 9f033b4..4c6fb99 100644
--- a/docs/html/guide/practices/screens-support-1.5.jd
+++ b/docs/html/guide/practices/screens-support-1.5.jd
@@ -46,7 +46,7 @@
 default, an application written for Android 1.5 or below that does not set the <a
 href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
 android:targetSdkVersion}</a> set to {@code "4"} or higher runs in <a
-href="screen-compat-mode">screen compatibility mode</a> when on a device with a screen larger than
+href="screen-compat-mode.html">screen compatibility mode</a> when on a device with a screen larger than
 the
 <em>normal</em> screen size (basically, the system displays the application in a small window
 that is roughly the size of the normal screen size).</p>
diff --git a/docs/html/guide/practices/security.jd b/docs/html/guide/practices/security.jd
index 476c301..eeaac44 100644
--- a/docs/html/guide/practices/security.jd
+++ b/docs/html/guide/practices/security.jd
@@ -126,8 +126,8 @@
 <p>Use of <a
 href="{@docRoot}reference/android/content/Context.html#MODE_WORLD_WRITEABLE">
 world writable</a> or <a
-href="{@docRoot}reference/android/content/Context.html#MODE_WORLD_READABLE
-">world readable</a> files for IPC is discouraged because it does not provide
+href="{@docRoot}reference/android/content/Context.html#MODE_WORLD_READABLE">world
+readable</a> files for IPC is discouraged because it does not provide
 the ability to limit data access to particular applications, nor does it
 provide any control on data format. As an alternative, you might consider using
 a ContentProvider which provides read and write permissions, and can make
@@ -199,10 +199,10 @@
 <p>ContentProviders can also provide more granular access by declaring the <a
 href="{@docRoot}guide/topics/manifest/provider-element.html#gprmsn">
 grantUriPermissions</a> element and using the <code><a
-href="{@docRoot}reference/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMIS
-SION">FLAG_GRANT_READ_URI_PERMISSION</a></code> and <code><a
-href="{@docRoot}reference/android/content/Intent.html#FLAG_GRANT_WRITE_URI_PERMI
-SSION">FLAG_GRANT_WRITE_URI_PERMISSION</a></code> flags in the Intent object
+href="{@docRoot}reference/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMISSION">FLAG_GRANT_READ_URI_PERMISSION</a></code>
+and <code><a
+href="{@docRoot}reference/android/content/Intent.html#FLAG_GRANT_WRITE_URI_PERMISSION">FLAG_GRANT_WRITE_URI_PERMISSION</a></code>
+flags in the Intent object
 that activates the component.  The scope of these permissions can be further
 limited by the <code><a
 href="{@docRoot}guide/topics/manifest/grant-uri-permission-element.html">
@@ -211,14 +211,9 @@
 <p>When accessing a <code>
 <a href="{@docRoot}reference/android/content/ContentProvider.html">
 ContentProvider</a></code>, use parameterized query methods such as <code>
-<a href="{@docRoot}reference/android/content/ContentProvider.html#query(android.net
-.Uri,%20java.lang.String[],%20java.lang.String,%20java.lang.String[],%20java.lan
-g.String)">query()</a></code>, <code><a
-href="{@docRoot}reference/android/content/ContentProvider.html#update(android.ne
-t.Uri,%20android.content.ContentValues,%20java.lang.String,%20java.lang.String[]
-)">update()</a></code>, and <code><a
-href="{@docRoot}reference/android/content/ContentProvider.html#delete(android.ne
-t.Uri,%20java.lang.String,%20java.lang.String[])">delete()</a></code> to avoid
+<a href="{@docRoot}reference/android/content/ContentProvider.html#query(android.net.Uri,%20java.lang.String[],%20java.lang.String,%20java.lang.String[],%20java.lang.String)">query()</a></code>, <code><a
+href="{@docRoot}reference/android/content/ContentProvider.html#update(android.net.Uri,%20android.content.ContentValues,%20java.lang.String,%20java.lang.String[])">update()</a></code>, and <code><a
+href="{@docRoot}reference/android/content/ContentProvider.html#delete(android.net.Uri,%20java.lang.String,%20java.lang.String[])">delete()</a></code> to avoid
 potential <a href="http://en.wikipedia.org/wiki/SQL_injection">SQL
 Injection</a> from untrusted data. Note that using parameterized methods is not
 sufficient if the <code>selection</code> is built by concatenating user data
@@ -249,8 +244,9 @@
 Activities</a>, and <a
 href="{@docRoot}reference/android/R.styleable.html#AndroidManifestService">
 Services</a> are all declared in the application manifest.  If your IPC mechanism is
-not intended for use by other applications, set the android:exported property
-to false.  This is useful for applications that consist of multiple processes
+not intended for use by other applications, set the <a
+href="{@docRoot}guide/topics/manifest/service-element.html#exported">{@code android:exported}</a>
+property to false.  This is useful for applications that consist of multiple processes
 within the same UID, or if you decide late in development that you do not
 actually want to expose functionality as IPC but you don’t want to rewrite
 the code.</p>
@@ -276,11 +272,10 @@
 
 <p>Intents are the preferred mechanism for asynchronous IPC in Android.
 Depending on your application requirements, you might use <code><a
-href="{@docRoot}reference/android/content/Context.html#sendBroadcast(android.con
-tent.Intent)">sendBroadcast()</a></code>, <code><a
-href="{@docRoot}reference/android/content/Context.html#sendOrderedBroadcast(andr
-oid.content.Intent,%20java.lang.String)">sendOrderedBroadcast()</a></code>, or
-direct an intent to a specific application component.</p>
+href="{@docRoot}reference/android/content/Context.html#sendBroadcast(android.content.Intent)">sendBroadcast()</a></code>, 
+<code><a
+href="{@docRoot}reference/android/content/Context.html#sendOrderedBroadcast(android.content.Intent,%20java.lang.String)">sendOrderedBroadcast()</a></code>,
+or direct an intent to a specific application component.</p>
 
 <p>Note that ordered broadcasts can be “consumed” by a recipient, so they
 may not be delivered to all applications.  If you are sending an Intent where
@@ -311,14 +306,13 @@
 explicitly added as code in the interface.</p>
 
 <p>If providing an interface that does require access controls, use <code><a
-href="{@docRoot}reference/android/content/Context.html#checkCallingPermission(ja
-va.lang.String)">checkCallingPermission()</a></code> to verify whether the
+href="{@docRoot}reference/android/content/Context.html#checkCallingPermission(java.lang.String)">checkCallingPermission()</a></code>
+to verify whether the
 caller of the Binder has a required permission. This is especially important
 before accessing a Service on behalf of the caller, as the identify of your
 application is passed to other interfaces.  If invoking an interface provided
 by a Service, the <code><a
-href="{@docRoot}reference/android/content/Context.html#bindService(android.conte
-nt.Intent,%20android.content.ServiceConnection,%20int)">bindService()</a></code>
+href="{@docRoot}reference/android/content/Context.html#bindService(android.content.Intent,%20android.content.ServiceConnection,%20int)">bindService()</a></code>
  invocation may fail if you do not have permission to access the given Service.
  If calling an interface provided locally by your own application, it may be
 useful to use the <code><a
@@ -332,14 +326,14 @@
 
 <p>By default, receivers are exported and can be invoked by any other
 application. If your <code><a
-href={@docRoot}reference/android/content/BroadcastReceiver.html">
+href="{@docRoot}reference/android/content/BroadcastReceiver.html">
 BroadcastReceivers</a></code> is intended for use by other applications, you
 may want to apply security permissions to receivers using the <code><a
-href="{@docRoot}reference/android/R.styleable.html#AndroidManifestReceiver">
+href="{@docRoot}guide/topics/manifest/receiver-element.html">
 &lt;receiver&gt;</a></code> element within the application manifest.  This will
 prevent applications without appropriate permissions from sending an intent to
 the <code><a
-href={@docRoot}reference/android/content/BroadcastReceiver.html">
+href="{@docRoot}reference/android/content/BroadcastReceiver.html">
 BroadcastReceivers</a></code>.</p>
 
 <h3>Using Services</h3>
@@ -349,19 +343,21 @@
 package's AndroidManifest.xml.</p>
 
 <p>By default, Services are exported and can be invoked by any other
-application.  Services can be protected using the android:permission attribute
+application.  Services can be protected using the <a
+href="{@docRoot}guide/topics/manifest/service-element.html#prmsn">{@code android:permission}</a>
+attribute
 within the manifest’s <code><a
-href="{@docRoot}reference/android/R.styleable.html#AndroidManifestService">
+href="{@docRoot}guide/topics/manifest/service-element.html">
 &lt;service&gt;</a></code> tag. By doing so, other applications will need to declare
 a corresponding <code><a
-href="{@docRoot}reference/android/R.styleable.html#AndroidManifestService_permis
-sion">&lt;uses-permission&gt;</a></code> element in their own manifest to be
+href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a>
+</code> element in their own manifest to be
 able to start, stop, or bind to the service.</p>
 
 <p>A Service can protect individual IPC calls into it with permissions, by
 calling <code><a
-href="{@docRoot}reference/android/content/Context.html#checkCallingPermission(ja
-va.lang.String)">checkCallingPermission()</a></code>before executing
+href="{@docRoot}reference/android/content/Context.html#checkCallingPermission(java.lang.String)">checkCallingPermission()</a></code>
+before executing
 the implementation of that call.  We generally recommend using the
 declarative permissions in the manifest, since those are less prone to
 oversight.</p>
@@ -376,9 +372,9 @@
 functionality that is not intended for use by other applications.</p>
 
 <p>If you do expose an Activity for purposes of IPC, the  <code><a
-href="{@docRoot}reference/android/R.styleable.html#AndroidManifestActivity_permi
-ssion">android:permission</a></code> attribute in the  <code><a
-href="{@docRoot}reference/android/R.styleable.html#AndroidManifestActivity">
+href="{@docRoot}guide/topics/manifest/activity-element.html#prmsn">android:permission</a></code>
+attribute in the  <code><a
+href="{@docRoot}guide/topics/manifest/activity-element.html">
 &lt;activity&gt;</a></code> declaration in the application manifest can be used to
 restrict access to only those applications which have the stated
 permissions.</p>
@@ -432,8 +428,8 @@
 <p>Generally, you should strive to create as few permissions as possible while
 satisfying your security requirements.  Creating a new permission is relatively
 uncommon for most applications, since <a
-href="{@docRoot}reference/android/Manifest.permission.html">
-system-defined permissions</a> cover many situations.  Where appropriate,
+href="{@docRoot}reference/android/Manifest.permission.html">system-defined
+permissions</a> cover many situations.  Where appropriate,
 perform access checks using existing permissions.</p>
 
 <p>If you must create a new permission, consider whether you can accomplish
@@ -560,17 +556,14 @@
 not execute JavaScript so cross-site-scripting is not possible.</p>
 
 <p>Use <code><a
-href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(jav
-a.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> with
+href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> with
 particular care because it allows JavaScript to invoke operations that are
 normally reserved for Android applications.  Only expose <code><a
-href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(jav
-a.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> to
+href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> to
 sources from which all input is trustworthy.  If untrusted input is allowed,
 untrusted JavaScript may be able to invoke Android methods.  In general, we
 recommend only exposing <code><a
-href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(jav
-a.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> to
+href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> to
 JavaScript that is contained within your application APK.</p>
 
 <p>Do not trust information downloaded over HTTP, use HTTPS instead.  Even if
@@ -578,13 +571,11 @@
 subject to <a
 href="http://en.wikipedia.org/wiki/Man-in-the-middle_attack">MiTM</a> attacks
 and interception of data.  Sensitive capabilities using <code><a
-href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(jav
-a.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> should
+href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> should
 not ever be exposed to unverified script downloaded over HTTP. Note that even
 with the use of HTTPS,
 <code><a
-href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(jav
-a.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code>
+href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code>
 increases the attack surface of your application to include the server
 infrastructure and all CAs trusted by the Android-powered device.</p>
 
@@ -683,8 +674,7 @@
 <p>If a GUID is required, create a large, unique number and store it.  Do not
 use phone identifiers such as the phone number or IMEI which may be associated
 with personal information.  This topic is discussed in more detail in the <a
-href="http://android-developers.blogspot.com/2011/03/identifying-app-installatio
-ns.html">Android Developer Blog</a>.</p>
+href="http://android-developers.blogspot.com/2011/03/identifying-app-installations.html">Android Developer Blog</a>.</p>
 
 <p>Application developers should be careful writing to on-device logs.
 In Android, logs are a shared resource, and are available
@@ -724,9 +714,8 @@
 <p>If credentials are to be used only by applications that you create, then you
 can verify the application which accesses the <code><a
 href="{@docRoot}reference/android/accounts/AccountManager.html">
-AccountManager</a></code> using <code><a href="<code><a
-href="{@docRoot}h/reference/android/content/pm/PackageManager.html#checkSignatur
-es(java.lang.String,%20java.lang.String)">checkSignature()</a></code>.
+AccountManager</a></code> using <code><a
+href="{@docRoot}reference/android/content/pm/PackageManager.html#checkSignatures(java.lang.String,%20java.lang.String)">checkSignature()</a></code>.
 Alternatively, if only one application will use the credential, you might use a
 <code><a
 href={@docRoot}reference/java/security/KeyStore.html">KeyStore</a></code> for
@@ -756,15 +745,15 @@
 href="{@docRoot}reference/javax/crypto/Cipher.html">Cipher</a></code> class.</p>
 
 <p>Use a secure random number generator (
-<a href="http://developer.android.com/reference/java/security/SecureRandom.html">
+<a href="{@docRoot}reference/java/security/SecureRandom.html">
 <code>SecureRandom</code></a>) to initialize any cryptographic keys (<a
-href="http://developer.android.com/reference/javax/crypto/KeyGenerator.html">
+href="{@docRoot}reference/javax/crypto/KeyGenerator.html">
 <code>KeyGenerator</code></a>). Use of a key that is not generated with a secure random
 number generator significantly weakens the strength of the algorithm, and may
 allow offline attacks.</p>
 
 <p>If you need to store a key for repeated use, use a mechanism like <code><a
-href={@docRoot}reference/java/security/KeyStore.html">KeyStore</a></code> that
+href="{@docRoot}reference/java/security/KeyStore.html">KeyStore</a></code> that
 provides a mechanism for long term storage and retrieval of cryptographic
 keys.</p>
 
diff --git a/docs/html/guide/practices/tablets-and-handsets.jd b/docs/html/guide/practices/tablets-and-handsets.jd
index dc35801..3f4aaa9 100644
--- a/docs/html/guide/practices/tablets-and-handsets.jd
+++ b/docs/html/guide/practices/tablets-and-handsets.jd
@@ -481,7 +481,7 @@
 information in each list item based on the available space. That is, you can create alternative
 layouts to be used by the items in your list adapter such that a large screen might display more
 detail for each item.</li>
-  <li>Create <a href="{@docRoot}guide/topics/resources/more-resources.html ">alternative resource
+  <li>Create <a href="{@docRoot}guide/topics/resources/more-resources.html">alternative resource
 files</a> for values such as integers, dimensions, and even booleans. Using size qualifiers for
 these resources, you can easily apply different layout sizes, font sizes, or enable/disable features
 based on the current screen size.</li>
diff --git a/docs/html/guide/publishing/preparing.jd b/docs/html/guide/publishing/preparing.jd
index 5ed55fe..4d3bffa 100644
--- a/docs/html/guide/publishing/preparing.jd
+++ b/docs/html/guide/publishing/preparing.jd
@@ -120,8 +120,8 @@
 <p>You may also have to obtain other release keys if your application accesses a service or uses a
 third-party library that requires you to use a key that is based on your private key. For example,
 if your application uses the <a
-href="http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/ MapView.
-html">MapView</a> class, which is part of the <a
+href="http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/MapView.html">MapView</a>
+class, which is part of the <a
 href="http://code.google.com/android/add-ons/google-apis/maps-overview.html">Google Maps external
 library</a>, you will need to register your application with the Google Maps service and obtain
 a Maps API key. For information about getting a Maps API key, see <a
diff --git a/docs/html/guide/publishing/publishing_overview.jd b/docs/html/guide/publishing/publishing_overview.jd
index a0f6ae3..e30360b 100755
--- a/docs/html/guide/publishing/publishing_overview.jd
+++ b/docs/html/guide/publishing/publishing_overview.jd
@@ -21,7 +21,7 @@
   </ol>
   <h2>See also</h2>
   <ol>
-    <li><a href="{@docRoot}guide/publishing/publishing_preparing.html">Preparing for
+    <li><a href="{@docRoot}guide/publishing/preparing.html">Preparing for
     Release</a></li>
     <li><a href="{@docRoot}guide/publishing/publishing.html">Publishing on Android Market</a></li>
   </ol>
diff --git a/docs/html/guide/topics/appwidgets/index.jd b/docs/html/guide/topics/appwidgets/index.jd
index 7b869a0..ba7b67c 100644
--- a/docs/html/guide/topics/appwidgets/index.jd
+++ b/docs/html/guide/topics/appwidgets/index.jd
@@ -518,15 +518,12 @@
 to the App Widget without worrying about the AppWidgetProvider closing down due
 to an <a href="{@docRoot}guide/practices/design/responsiveness.html">Application
 Not Responding</a> (ANR) error. See the <a
-href="http://code.google.com/p/wiktionary-android/source/browse/trunk/Wiktionary
-/src/com/example/android/wiktionary/WordWidget.java">Wiktionary sample's
-AppWidgetProvider</a> for an example of an App Widget running a {@link
+href="http://code.google.com/p/wiktionary-android/source/browse/trunk/Wiktionary/src/com/example/android/wiktionary/WordWidget.java">Wiktionary sample's AppWidgetProvider</a> for an example of an App Widget running a {@link
 android.app.Service}.</p>
 
 <p>Also see the <a 
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/
-appwidget/ExampleAppWidgetProvider.html">
-ExampleAppWidgetProvider.java</a> sample class.</p>
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/appwidget/ExampleAppWidgetProvider.html">ExampleAppWidgetProvider.java</a>
+sample class.</p>
 
 
 <h3 id="ProviderBroadcasts">Receiving App Widget broadcast Intents</h3>
@@ -683,9 +680,8 @@
 App Widget will not be added.</p>
 
 <p>See the <a 
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/
-appwidget/ExampleAppWidgetConfigure.html">
-ExampleAppWidgetConfigure.java</a> sample class in ApiDemos for an example.</p>
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/appwidget/ExampleAppWidgetConfigure.html">ExampleAppWidgetConfigure.java</a>
+sample class in ApiDemos for an example.</p>
 
 <h2 id="preview">Setting a Preview Image</h2>
 
diff --git a/docs/html/guide/topics/manifest/activity-element.jd b/docs/html/guide/topics/manifest/activity-element.jd
index e23fb0ec..e76a6be 100644
--- a/docs/html/guide/topics/manifest/activity-element.jd
+++ b/docs/html/guide/topics/manifest/activity-element.jd
@@ -59,7 +59,7 @@
 
 <dt>attributes:</dt>
 <dd><dl class="attr">
-<dt><a href name="reparent"></a>{@code android:allowTaskReparenting}</dt>
+<dt><a name="reparent"></a>{@code android:allowTaskReparenting}</dt>
 <dd>Whether or not the activity can move from the task that started it to 
 the task it has an affinity for when that task is next brought to the 
 front &mdash; "{@code true}" if it can move, and "{@code false}" if it 
diff --git a/docs/html/guide/topics/manifest/application-element.jd b/docs/html/guide/topics/manifest/application-element.jd
index 4f1964c..df6f61a 100644
--- a/docs/html/guide/topics/manifest/application-element.jd
+++ b/docs/html/guide/topics/manifest/application-element.jd
@@ -249,7 +249,7 @@
 applications, reducing resource usage.
 </p></dd>
 
-<dt><a href name="restoreany"></a>{@code android:restoreAnyVersion}</dt>
+<dt><a name="restoreany"></a>{@code android:restoreAnyVersion}</dt>
 <dd>Indicate that the application is prepared to attempt a restore of any
 backed-up data set, even if the backup was stored by a newer version
 of the application than is currently installed on the device.  Setting
@@ -260,7 +260,7 @@
 <p>The default value of this attribute is {@code false}.
 </p></dd>
 
-<dt><a href name="aff"></a>{@code android:taskAffinity}</dt>
+<dt><a name="aff"></a>{@code android:taskAffinity}</dt>
 <dd>An affinity name that applies to all activities within the application,
 except for those that set a different affinity with their own
 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html#aff">taskAffinity</a></code> 
diff --git a/docs/html/guide/topics/media/mediaplayer.jd b/docs/html/guide/topics/media/mediaplayer.jd
index b3ca7dd..002d113 100644
--- a/docs/html/guide/topics/media/mediaplayer.jd
+++ b/docs/html/guide/topics/media/mediaplayer.jd
@@ -251,7 +251,7 @@
 "background media" even when the user leaves your activity, much in the same
 way that the built-in Music application behaves. In this case, what you need is
 a {@link android.media.MediaPlayer MediaPlayer} controlled by a {@link android.app.Service}, as
-discussed in <a href="mpandservices">Using a Service with MediaPlayer</a>.</p>
+discussed in <a href="#mpandservices">Using a Service with MediaPlayer</a>.</p>
 
 <h2 id="mpandservices">Using a Service with MediaPlayer</h2>
 
diff --git a/docs/html/guide/topics/nfc/nfc.jd b/docs/html/guide/topics/nfc/nfc.jd
index 175bc7cc..83873c3 100644
--- a/docs/html/guide/topics/nfc/nfc.jd
+++ b/docs/html/guide/topics/nfc/nfc.jd
@@ -666,7 +666,7 @@
 potentially handling specific tags that you have deployed. AARs are only supported at the
 application level, because of the package name constraint, and not at the Activity level as with
 intent filtering. If you want to handle an intent at the Activity level, <a
-href="filtering-intents">use intent filters</a>.
+href="#filtering-intents">use intent filters</a>.
 </p>
 
 
@@ -795,8 +795,8 @@
 
 <p>The following sample shows how a simple activity calls {@link
 android.nfc.NfcAdapter.CreateNdefMessageCallback} in the <code>onCreate()</code> method of an
-activity (see <a href="{@docRoot}resources/samples/AndroidBeam/index.html"></a> for the
-complete sample). This example also has methods to help you create a MIME record:</p>
+activity (see <a href="{@docRoot}resources/samples/AndroidBeamDemo/index.html">AndroidBeamDemo</a>
+for the complete sample). This example also has methods to help you create a MIME record:</p>
 
 <pre id="code-example">
 package com.example.android.beam;
diff --git a/docs/html/guide/topics/renderscript/index.jd b/docs/html/guide/topics/renderscript/index.jd
index 148705c..63f341a 100644
--- a/docs/html/guide/topics/renderscript/index.jd
+++ b/docs/html/guide/topics/renderscript/index.jd
@@ -376,7 +376,7 @@
   you call the constructor for the {@link android.renderscript.Script.FieldBase} class and specify
   the amount of structures that you want to allocate memory for. To allocate memory for a primitive
   type pointer, you must build an allocation manually, using the memory management classes
-  described in <a href="mem-mgmt-table">Table 1</a>. The example below allocates memory for both
+  described in <a href="#mem-mgmt-table">Table 1</a>. The example below allocates memory for both
   the <code>intPointer</code> and <code>touchPoints</code> pointer and binds it to the
   RenderScript:</p>
   <pre>
diff --git a/docs/html/guide/topics/resources/animation-resource.jd b/docs/html/guide/topics/resources/animation-resource.jd
index eaa698f..6473155 100644
--- a/docs/html/guide/topics/resources/animation-resource.jd
+++ b/docs/html/guide/topics/resources/animation-resource.jd
@@ -335,7 +335,7 @@
 <dd>
 <ul>
   <li><a href="{@docRoot}guide/topics/graphics/animation.html">Property Animation</a></li>
-  <li><a href="http://zoso:8080/resources/samples/ApiDemos/src/com/example/android/apis/animation/index.html">API Demos</a> for examples
+  <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/animation/index.html">API Demos</a> for examples
   on how to use the property animation system.</li>
 </ul>
 </dd>
diff --git a/docs/html/guide/topics/sensors/sensors_motion.jd b/docs/html/guide/topics/sensors/sensors_motion.jd
index 3f712b2..b6c3cb4 100644
--- a/docs/html/guide/topics/sensors/sensors_motion.jd
+++ b/docs/html/guide/topics/sensors/sensors_motion.jd
@@ -28,7 +28,7 @@
 href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/os/RotationVectorDemo.html">
 API Demos (OS - RotationVectorDemo)</a></li>
       <li><a
-href="{@docRoot}/resources/samples/ApiDemos/src/com/example/android/apis/os/RotationVectorDemo.html"
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/os/RotationVectorDemo.html"
 >API Demos (OS - Sensors)</a></li>
     </ol>
     <h2>See also</h2>
diff --git a/docs/html/guide/topics/testing/testing_android.jd b/docs/html/guide/topics/testing/testing_android.jd
index c8a3f6e..adbc59d 100755
--- a/docs/html/guide/topics/testing/testing_android.jd
+++ b/docs/html/guide/topics/testing/testing_android.jd
@@ -318,7 +318,7 @@
     A useful general test case class, especially if you are
     just starting out with Android testing, is {@link android.test.AndroidTestCase}. It extends
     both {@link junit.framework.TestCase} and {@link junit.framework.Assert}. It provides the
-    JUnit-standard <code>setUp()</code> and <code>tearDown()</code> methods, as well as well as
+    JUnit-standard <code>setUp()</code> and <code>tearDown()</code> methods, as well as
     all of JUnit's Assert methods. In addition, it provides methods for testing permissions, and a
     method that guards against memory leaks by clearing out certain class references.
 </p>
@@ -401,7 +401,7 @@
     Mock objects isolate tests from a running system by stubbing out or overriding
     normal operations. For example, a {@link android.test.mock.MockContentResolver}
     replaces the normal resolver framework with its own local framework, which is isolated
-    from the rest of the system. MockContentResolver also also stubs out the
+    from the rest of the system. MockContentResolver also stubs out the
     {@link android.content.ContentResolver#notifyChange(Uri, ContentObserver, boolean)} method
     so that observer objects outside the test environment are not accidentally triggered.
 </p>
diff --git a/docs/html/guide/topics/ui/actionbar.jd b/docs/html/guide/topics/ui/actionbar.jd
index 3c0ef26..1bb4fa4 100644
--- a/docs/html/guide/topics/ui/actionbar.jd
+++ b/docs/html/guide/topics/ui/actionbar.jd
@@ -642,7 +642,7 @@
   <p>Adding this value requires that you set your build target to Android 4.0 or higher in order to
 compile. Older versions of Android ignore the {@code "collapseActionView"} value because they don't
 understand it. Just be sure not to use other APIs in your source code that are not supported in the
-version declared by your <a href="{@docRoot}guide/topics/manifest/uses-sdk-elementl.html#min">{@code
+version declared by your <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
 minSdkVersion}</a>, unless you add the appropriate version check at runtime.</p>
 </div>
 </div>
@@ -843,8 +843,8 @@
 android.app.Activity#onOptionsItemSelected onOptionsItemSelected()} callback method.</p>
 
 <p>For a sample using the share action provider, see
-<a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/ActionBarActionProviderActivity.html"
->ActionBarActionProviderActivity</a>.
+<a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/ActionBarShareActionProviderActivity.html"
+>ActionBarShareActionProviderActivity</a>.
 
 
 
diff --git a/docs/html/guide/topics/usb/accessory.jd b/docs/html/guide/topics/usb/accessory.jd
index b0f4881..8b74bc0 100644
--- a/docs/html/guide/topics/usb/accessory.jd
+++ b/docs/html/guide/topics/usb/accessory.jd
@@ -169,8 +169,9 @@
     include a <code>&lt;uses-feature&gt;</code> element that declares that your application uses
     the <code>android.hardware.usb.accessory</code> feature.</li>
 
-    <li>If you are using the <a href="addon">add-on library</a>, add the
-    <code>&lt;uses-library&gt;</code> element specifying
+    <li>If you are using the 
+    <a href="http://code.google.com/android/add-ons/google-apis/index.html">add-on library</a>,
+    add the <code>&lt;uses-library&gt;</code> element specifying
     <code>com.android.future.usb.accessory</code> for the library.</li>
 
     <li>Set the minimum SDK of the application to API Level 10 if you are using the add-on library
diff --git a/docs/html/guide/topics/usb/adk.jd b/docs/html/guide/topics/usb/adk.jd
index 6c7ab0d..99c5f92 100644
--- a/docs/html/guide/topics/usb/adk.jd
+++ b/docs/html/guide/topics/usb/adk.jd
@@ -699,7 +699,7 @@
 </pre>If this method returns false, the board waits until a new device is connected. If it is
 successful, the device displays itself on the USB bus as being in accessory mode when the ADK board
 re-enumerates the bus. When the device is in accessory mode, the accessory then <a href=
-"establish-adk">establishes communication with the device</a>.
+"#establish-adk">establishes communication with the device</a>.
 
   <h3 id="establish-adk">Establish communication with the device</h3>
 
diff --git a/docs/html/guide/topics/wireless/bluetooth.jd b/docs/html/guide/topics/wireless/bluetooth.jd
index 0af1d2c..e4c6e1b 100644
--- a/docs/html/guide/topics/wireless/bluetooth.jd
+++ b/docs/html/guide/topics/wireless/bluetooth.jd
@@ -902,8 +902,9 @@
 <p>Here are the basic steps for working with a profile:</p> 
 <ol> 
 
-  <li>Get the default adapter, as described in <a href="{@docRoot}guide/topics/wireless/bluetooth.
-html#SettingUp">Setting Up Bluetooth</a>.</li> 
+  <li>Get the default adapter, as described in
+    <a href="{@docRoot}guide/topics/wireless/bluetooth.html#SettingUp">Setting Up
+      Bluetooth</a>.</li> 
 
   <li>Use {@link
 android.bluetooth.BluetoothAdapter#getProfileProxy(android.content.Context,
diff --git a/docs/html/sdk/RELEASENOTES.jd b/docs/html/sdk/RELEASENOTES.jd
index bf091e9..91eb57f4 100644
--- a/docs/html/sdk/RELEASENOTES.jd
+++ b/docs/html/sdk/RELEASENOTES.jd
@@ -657,8 +657,8 @@
 <p><strong>T-Mobile G1 Compatibility</strong></p>
 
 <p>This version of the SDK has been tested for compatibility with the first 
-Android-powered mobile device, the <a href="http://www.t-mobileg1.com">T-Mobile
-G1</a>. </p>
+Android-powered mobile device, the T-Mobile
+G1. </p>
 
 <p><strong>MapView API Key</strong></p>
 
diff --git a/docs/html/sdk/android-1.1.jd b/docs/html/sdk/android-1.1.jd
index 8123fa8..b61f186 100644
--- a/docs/html/sdk/android-1.1.jd
+++ b/docs/html/sdk/android-1.1.jd
@@ -106,7 +106,7 @@
 <p>The Android 1.1 system image was tested for compatability with the
 Android-powered devices listed below:</p>
 	<ul>
-	<li><a href="http://www.t-mobileg1.com">T-Mobile G1</a></li>
+	<li>T-Mobile G1</li>
 	</ul>
 
 <h2 id="apps">Built-in Applications</h2>
diff --git a/docs/html/sdk/android-3.0.jd b/docs/html/sdk/android-3.0.jd
index 7b04446..96b92d9 100644
--- a/docs/html/sdk/android-3.0.jd
+++ b/docs/html/sdk/android-3.0.jd
@@ -262,8 +262,8 @@
 
 <p>For more information, read the <a href="{@docRoot}guide/topics/clipboard/copy-paste.html">Copy
 and Paste</a> documentation. You can also see a simple implementation of copy and paste in the <a
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.
-html">API Demos</a> and a more complete implementation in the <a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.html">API Demos</a>
+and a more complete implementation in the <a
 href="{@docRoot}resources/samples/NotePad/index.html">Note Pad</a> application.</p>
 
 
@@ -386,7 +386,7 @@
 <p>For more information, read the <a
 href="{@docRoot}guide/topics/fundamentals/loaders.html">Loaders</a> documentation. You can also see
 example code using loaders in the <a
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/FragmentListCursorLoader.html">FragmentListCursorLoader</a>
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/LoaderCursor.html">LoaderCursor</a>
 and <a
 href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/LoaderThrottle.html">
 LoaderThrottle</a> samples.</p>
diff --git a/docs/html/sdk/android-3.1.jd b/docs/html/sdk/android-3.1.jd
index 0d2d7f8..78f265d 100644
--- a/docs/html/sdk/android-3.1.jd
+++ b/docs/html/sdk/android-3.1.jd
@@ -422,10 +422,9 @@
 
 <p class="note">To look at a sample application that uses joystick motion
 events, see <a
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/
-GameControllerInput.html">GameControllerInput</a> and <a
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/
-GameView.html">GameView</a>.</p>
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/GameControllerInput.html">GameControllerInput</a> 
+and <a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/GameView.html">GameView</a>.</p>
 
 <h3>RTP API</h3>
 
@@ -931,7 +930,7 @@
 href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code
 &lt;uses-feature&gt;}</a> manifest elements. For more information about
 declaring features in an application manifest, read <a
-href="{docRoot}guide/appendix/market-filters.html">Android Market
+href="{@docRoot}guide/appendix/market-filters.html">Android Market
 Filters</a>.</p>
 
 
diff --git a/docs/html/sdk/android-4.0.jd b/docs/html/sdk/android-4.0.jd
index 7161b03..5f55947 100644
--- a/docs/html/sdk/android-4.0.jd
+++ b/docs/html/sdk/android-4.0.jd
@@ -1292,9 +1292,9 @@
 }
 </pre>
 
-<p>For an example using the {@link android.widget.ShareActionProvider}, see the <a
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/ActionBarActionProviderActivity.html"
->ActionBarActionProviderActivity</a> class in ApiDemos.</p>
+<p>For an example using the {@link android.widget.ShareActionProvider}, see <a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/ActionBarShareActionProviderActivity.html"
+>ActionBarShareActionProviderActivity</a> in ApiDemos.</p>
 
 
 <h4>Collapsible action views</h4>
diff --git a/docs/html/training/id-auth/authenticate.jd b/docs/html/training/id-auth/authenticate.jd
index 4eba87b..592fe1c 100644
--- a/docs/html/training/id-auth/authenticate.jd
+++ b/docs/html/training/id-auth/authenticate.jd
@@ -63,8 +63,8 @@
 strings that identify your app to the service. You need to obtain these strings
 directly from the service owner. Google has a self-service system for obtaining
 client ids and secrets. The article <a
-href="http://code.google.com/apis/tasks/articles/oauth-and-tasks-on-android.
-html">Getting Started with the Tasks API and OAuth 2.0 on Android</a> explains
+href="http://code.google.com/apis/tasks/articles/oauth-and-tasks-on-android.html">Getting
+Started with the Tasks API and OAuth 2.0 on Android</a> explains
 how to use this system to obtain these values for use with the Google Tasks
 API.</li>
 </ul>
diff --git a/docs/html/training/monitoring-device-state/manifest-receivers.jd b/docs/html/training/monitoring-device-state/manifest-receivers.jd
index 556a733..0b79ce6 100644
--- a/docs/html/training/monitoring-device-state/manifest-receivers.jd
+++ b/docs/html/training/monitoring-device-state/manifest-receivers.jd
@@ -14,7 +14,7 @@
 
 <h2>This lesson teaches you to</h2>
 <ol>
-  <li><a href="ToggleReceivers">Toggle and Cascade State Change Receivers to Improve
+  <li><a href="#ToggleReceivers">Toggle and Cascade State Change Receivers to Improve
 Efficiency</a></li>
 </ol>
 
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/jni/android_drm_DrmManagerClient.cpp b/drm/jni/android_drm_DrmManagerClient.cpp
index e34046fe..dfc7fb2 100644
--- a/drm/jni/android_drm_DrmManagerClient.cpp
+++ b/drm/jni/android_drm_DrmManagerClient.cpp
@@ -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;
     }
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/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
index 7799040..0273a4b 100644
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
+++ b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
@@ -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/graphics/java/android/graphics/PathMeasure.java b/graphics/java/android/graphics/PathMeasure.java
index 98f7821..7062824 100644
--- a/graphics/java/android/graphics/PathMeasure.java
+++ b/graphics/java/android/graphics/PathMeasure.java
@@ -17,6 +17,7 @@
 package android.graphics;
 
 public class PathMeasure {
+    private Path mPath;
 
     /**
      * Create an empty PathMeasure object. To uses this to measure the length
@@ -28,6 +29,7 @@
      * is used. If the path is modified, you must call setPath with the path.
      */
     public PathMeasure() {
+        mPath = null;
         native_instance = native_create(0, false);
     }
     
@@ -46,8 +48,8 @@
      *        even if its contour was not explicitly closed.
      */
     public PathMeasure(Path path, boolean forceClosed) {
-        // note: the native side makes a copy of path, so we don't need a java
-        // reference to it here, since it's fine if it gets GC'd
+        // The native implementation does not copy the path, prevent it from being GC'd
+        mPath = path;
         native_instance = native_create(path != null ? path.ni() : 0,
                                         forceClosed);
     }
@@ -56,8 +58,7 @@
      * Assign a new path, or null to have none.
      */
     public void setPath(Path path, boolean forceClosed) {
-        // note: the native side makes a copy of path, so we don't need a java
-        // reference to it here, since it's fine if it gets GC'd
+        mPath = path;
         native_setPath(native_instance,
                        path != null ? path.ni() : 0,
                        forceClosed);
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 2856437..19521b0 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;
@@ -1345,13 +1345,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/media/AudioTrack.h b/include/media/AudioTrack.h
index b106042..98b2c70 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -445,6 +445,7 @@
             status_t setLoop_l(uint32_t loopStart, uint32_t loopEnd, int loopCount);
             audio_io_handle_t getOutput_l();
             status_t restoreTrack_l(audio_track_cblk_t*& cblk, bool fromStart);
+            bool stopped_l() const { return !mActive; }
 
     sp<IAudioTrack>         mAudioTrack;
     sp<IMemory>             mCblkMemory;
@@ -464,7 +465,7 @@
     status_t                mStatus;
     uint32_t                mLatency;
 
-    volatile int32_t        mActive;
+    bool                    mActive;                // protected by mLock
 
     callback_t              mCbf;
     void*                   mUserData;
@@ -481,7 +482,7 @@
     uint32_t                mFlags;
     int                     mSessionId;
     int                     mAuxEffectId;
-    Mutex                   mLock;
+    mutable Mutex           mLock;
     status_t                mRestoreStatus;
     int                     mPreviousPriority;          // before start()
     int                     mPreviousSchedulingGroup;
diff --git a/include/utils/GenerationCache.h b/include/utils/GenerationCache.h
index da85a9a..40722d1 100644
--- a/include/utils/GenerationCache.h
+++ b/include/utils/GenerationCache.h
@@ -205,7 +205,7 @@
             removeAt(index);
             return true;
         }
-        LOGE("GenerationCache: removeOldest failed to find the item in the cache "
+        ALOGE("GenerationCache: removeOldest failed to find the item in the cache "
                 "with the given key, but we know it must be in there.  "
                 "Is the key comparator kaput?");
     }
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 e8fb1d9..47a62db 100644
--- a/libs/binder/BpBinder.cpp
+++ b/libs/binder/BpBinder.cpp
@@ -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;
     }
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 2111fe8..cd2451a 100644
--- a/libs/binder/IMemory.cpp
+++ b/libs/binder/IMemory.cpp
@@ -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 {
@@ -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());
         }
     }
 }
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp
index 1c1b546..33b305d 100644
--- a/libs/binder/IServiceManager.cpp
+++ b/libs/binder/IServiceManager.cpp
@@ -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;
             }
diff --git a/libs/binder/MemoryDealer.cpp b/libs/binder/MemoryDealer.cpp
index f299924..8d0e0a7 100644
--- a/libs/binder/MemoryDealer.cpp
+++ b/libs/binder/MemoryDealer.cpp
@@ -210,7 +210,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
@@ -348,7 +348,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!!!");
 
diff --git a/libs/binder/MemoryHeapBase.cpp b/libs/binder/MemoryHeapBase.cpp
index e171374..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,7 +127,7 @@
         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;
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 e455980..dea14bb 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -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;
@@ -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;
     }
@@ -1018,7 +1018,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();
 }
 
@@ -1216,7 +1216,7 @@
                 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;
@@ -1511,7 +1511,7 @@
         
         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;
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index f06a59e..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;
@@ -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 eef1dd2..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;
 }
 
@@ -72,7 +72,7 @@
 {
      ALOGV("create");
      if (camera == 0) {
-         LOGE("camera remote is a NULL pointer");
+         ALOGE("camera remote is a NULL pointer");
          return 0;
      }
 
@@ -397,13 +397,13 @@
     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);
 }
 
@@ -411,7 +411,7 @@
     ALOGV("binderDied");
     Mutex::Autolock _l(Camera::mLock);
     Camera::mCameraService.clear();
-    LOGW("Camera server died!");
+    ALOGW("Camera server died!");
 }
 
 sp<ICameraRecordingProxy> Camera::getRecordingProxy() {
diff --git a/libs/camera/CameraParameters.cpp b/libs/camera/CameraParameters.cpp
index 209d84a..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));
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/BitTube.cpp b/libs/gui/BitTube.cpp
index fa8d0ea..785da39 100644
--- a/libs/gui/BitTube.cpp
+++ b/libs/gui/BitTube.cpp
@@ -40,7 +40,7 @@
         fcntl(mSendFd, F_SETFL, O_NONBLOCK);
     } else {
         mReceiveFd = -errno;
-        LOGE("BitTube: pipe creation failed (%s)", strerror(-mReceiveFd));
+        ALOGE("BitTube: pipe creation failed (%s)", strerror(-mReceiveFd));
     }
 }
 
@@ -52,7 +52,7 @@
         fcntl(mReceiveFd, F_SETFL, O_NONBLOCK);
     } else {
         mReceiveFd = -errno;
-        LOGE("BitTube(Parcel): can't dup filedescriptor (%s)",
+        ALOGE("BitTube(Parcel): can't dup filedescriptor (%s)",
                 strerror(-mReceiveFd));
     }
 }
diff --git a/libs/gui/DisplayEventReceiver.cpp b/libs/gui/DisplayEventReceiver.cpp
index fee1feb..3b3ccaa 100644
--- a/libs/gui/DisplayEventReceiver.cpp
+++ b/libs/gui/DisplayEventReceiver.cpp
@@ -81,7 +81,7 @@
 ssize_t DisplayEventReceiver::getEvents(DisplayEventReceiver::Event* events,
         size_t count) {
     ssize_t size = mDataChannel->read(events, sizeof(events[0])*count);
-    LOGE_IF(size<0,
+    ALOGE_IF(size<0,
             "DisplayEventReceiver::getEvents error (%s)",
             strerror(-size));
     if (size >= 0) {
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index ca7c8f8..95b2379 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;
         }
@@ -188,7 +188,7 @@
                 BnSurfaceComposer::CREATE_DISPLAY_EVENT_CONNECTION,
                 data, &reply);
         if (err != NO_ERROR) {
-            LOGE("ISurfaceComposer::createDisplayEventConnection: error performing "
+            ALOGE("ISurfaceComposer::createDisplayEventConnection: error performing "
                     "transaction: %s (%d)", strerror(-err), -err);
             return result;
         }
diff --git a/libs/gui/SensorEventQueue.cpp b/libs/gui/SensorEventQueue.cpp
index ee21c45..b95dd902 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("SensorEventQueue::waitForEvent error (errno=%d)", errno);
+            ALOGE("SensorEventQueue::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 104cefb..3abe84a 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -65,8 +65,8 @@
 #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, ...) LOGW("[%s] "x, mName.string(), ##__VA_ARGS__)
-#define ST_LOGE(x, ...) LOGE("[%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 {
 
@@ -352,7 +352,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);
 
@@ -493,9 +493,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);
     }
@@ -804,7 +804,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;
                 }
@@ -992,7 +992,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++) {
@@ -1001,7 +1001,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 b6f3c11..d0934ba 100644
--- a/libs/gui/SurfaceTextureClient.cpp
+++ b/libs/gui/SurfaceTextureClient.cpp
@@ -157,7 +157,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;
         }
@@ -202,7 +202,7 @@
             return i;
         }
     }
-    LOGE("getSlotFromBufferLocked: unknown buffer: %p", buffer->handle);
+    ALOGE("getSlotFromBufferLocked: unknown buffer: %p", buffer->handle);
     return BAD_VALUE;
 }
 
@@ -230,7 +230,7 @@
     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;
 }
@@ -452,7 +452,7 @@
     }
 
     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;
 }
@@ -463,7 +463,7 @@
     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) {
@@ -488,7 +488,7 @@
     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;
 }
@@ -512,7 +512,7 @@
     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;
@@ -553,11 +553,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());
@@ -600,7 +600,7 @@
         ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds)
 {
     if (mLockedBuffer != 0) {
-        LOGE("Surface::lock failed, already locked");
+        ALOGE("Surface::lock failed, already locked");
         return INVALID_OPERATION;
     }
 
@@ -615,11 +615,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);
@@ -663,7 +663,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;
@@ -680,15 +680,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/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index fa1e9b8..d1af1a3 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -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);
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index 8462307..790c143 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -150,7 +150,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];
@@ -191,7 +191,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);
@@ -475,7 +475,7 @@
     cachedGlyph->mIsValid = false;
     // If the glyph is too tall, don't cache it
     if (glyph.fHeight + TEXTURE_BORDER_SIZE > 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;
     }
@@ -871,7 +871,7 @@
     checkInit();
 
     if (!mCurrentFont) {
-        LOGE("No font set");
+        ALOGE("No font set");
         return false;
     }
 
diff --git a/libs/hwui/GradientCache.cpp b/libs/hwui/GradientCache.cpp
index a88a59a..3678788 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/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index f122396..e320eb2 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -185,14 +185,14 @@
     Caches& caches = Caches::getInstance();
     GLuint fbo = caches.fboCache.get();
     if (!fbo) {
-        LOGW("Could not obtain an FBO");
+        ALOGW("Could not obtain an FBO");
         return NULL;
     }
 
     caches.activeTexture(0);
     Layer* layer = caches.layerCache.get(width, height);
     if (!layer) {
-        LOGW("Could not obtain a layer");
+        ALOGW("Could not obtain a layer");
         return NULL;
     }
 
@@ -360,7 +360,7 @@
 
         GLuint fbo = caches.fboCache.get();
         if (!fbo) {
-            LOGW("Could not obtain an FBO");
+            ALOGW("Could not obtain an FBO");
             return false;
         }
 
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 9101953..12ed205 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -172,7 +172,7 @@
         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;
         }
     }
@@ -538,7 +538,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();
@@ -569,7 +569,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/Program.cpp b/libs/hwui/Program.cpp
index 701314d..984461c 100644
--- a/libs/hwui/Program.cpp
+++ b/libs/hwui/Program.cpp
@@ -55,13 +55,13 @@
             GLint status;
             glGetProgramiv(mProgramId, GL_LINK_STATUS, &status);
             if (status != GL_TRUE) {
-                LOGE("Error while linking shaders:");
+                ALOGE("Error while linking shaders:");
                 GLint infoLen = 0;
                 glGetProgramiv(mProgramId, GL_INFO_LOG_LENGTH, &infoLen);
                 if (infoLen > 1) {
                     GLchar log[infoLen];
                     glGetProgramInfoLog(mProgramId, infoLen, 0, &log[0]);
-                    LOGE("%s", log);
+                    ALOGE("%s", log);
                 }
 
                 glDetachShader(mProgramId, mVertexShader);
@@ -142,7 +142,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/ShapeCache.h b/libs/hwui/ShapeCache.h
index 2c0f3ab..30ce690 100644
--- a/libs/hwui/ShapeCache.h
+++ b/libs/hwui/ShapeCache.h
@@ -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 (%dx%d, max=%dx%d)",
+        ALOGW("Shape %s too large to be rendered into a texture (%dx%d, max=%dx%d)",
                 mName, width, height, mMaxTextureSize, mMaxTextureSize);
         return NULL;
     }
@@ -571,7 +571,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/TextureCache.cpp b/libs/hwui/TextureCache.cpp
index 237911b..cc09aae 100644
--- a/libs/hwui/TextureCache.cpp
+++ b/libs/hwui/TextureCache.cpp
@@ -125,7 +125,7 @@
 
     if (!texture) {
         if (bitmap->width() > mMaxTextureSize || bitmap->height() > mMaxTextureSize) {
-            LOGW("Bitmap too large to be uploaded into a texture (%dx%d, max=%dx%d)",
+            ALOGW("Bitmap too large to be uploaded into a texture (%dx%d, max=%dx%d)",
                     bitmap->width(), bitmap->height(), mMaxTextureSize, mMaxTextureSize);
             return NULL;
         }
@@ -202,7 +202,7 @@
     SkAutoLockPixels alp(*bitmap);
 
     if (!bitmap->readyToDraw()) {
-        LOGE("Cannot generate texture from bitmap");
+        ALOGE("Cannot generate texture from bitmap");
         return;
     }
 
@@ -249,7 +249,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/rs/driver/rsdAllocation.cpp b/libs/rs/driver/rsdAllocation.cpp
index e072dab..cc79366 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;
     }
@@ -463,7 +463,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 917b419..24bb288 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);
 
@@ -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;
     }
 
@@ -234,8 +234,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);
@@ -265,8 +265,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);
@@ -372,7 +372,7 @@
             rsdLaunchThreads(mrsc, wc_x, &mtls);
         }
 
-        //LOGE("launch 1");
+        //ALOGE("launch 1");
     } else {
         RsForEachStubParamStruct p;
         memset(&p, 0, sizeof(p));
@@ -380,7 +380,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++) {
@@ -432,7 +432,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))
@@ -444,7 +444,7 @@
                            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) {
@@ -458,7 +458,7 @@
 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) {
@@ -472,7 +472,7 @@
 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) {
diff --git a/libs/rs/driver/rsdCore.cpp b/libs/rs/driver/rsdCore.cpp
index a65e23b..b934895 100644
--- a/libs/rs/driver/rsdCore.cpp
+++ b/libs/rs/driver/rsdCore.cpp
@@ -154,7 +154,7 @@
 
     int status = pthread_setspecific(rsdgThreadTLSKey, &dc->mTlsStruct);
     if (status) {
-        LOGE("pthread_setspecific %i", status);
+        ALOGE("pthread_setspecific %i", status);
     }
 
 #if 0
@@ -164,7 +164,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) {
@@ -199,7 +199,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;
@@ -208,7 +208,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;
         }
@@ -222,7 +222,7 @@
     dc->mTlsStruct.mScript = NULL;
     int status = pthread_setspecific(rsdgThreadTLSKey, &dc->mTlsStruct);
     if (status) {
-        LOGE("pthread_setspecific %i", status);
+        ALOGE("pthread_setspecific %i", status);
     }
 
 
@@ -244,7 +244,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;
     }
 
@@ -252,7 +252,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 d4deefb..b53a68cf 100644
--- a/libs/rs/driver/rsdGL.cpp
+++ b/libs/rs/driver/rsdGL.cpp
@@ -107,14 +107,14 @@
 }
 
 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);
 
     ALOGV("MAX Textures %i, %i  %i", dc->gl.gl.maxVertexTextureUnits,
          dc->gl.gl.maxFragmentTextureImageUnits, dc->gl.gl.maxTextureImageUnits);
@@ -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);
@@ -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;
@@ -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/rsdProgramStore.cpp b/libs/rs/driver/rsdProgramStore.cpp
index 8c7301c..c1295e8 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;
     }
 
diff --git a/libs/rs/driver/rsdRuntimeMath.cpp b/libs/rs/driver/rsdRuntimeMath.cpp
index b927ed2..e315539 100644
--- a/libs/rs/driver/rsdRuntimeMath.cpp
+++ b/libs/rs/driver/rsdRuntimeMath.cpp
@@ -122,7 +122,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 38bd48f..44bfb1c 100644
--- a/libs/rs/driver/rsdRuntimeStubs.cpp
+++ b/libs/rs/driver/rsdRuntimeStubs.cpp
@@ -711,7 +711,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 3120bbf..8bf3207 100644
--- a/libs/rs/driver/rsdShader.cpp
+++ b/libs/rs/driver/rsdShader.cpp
@@ -186,7 +186,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);
@@ -279,9 +279,9 @@
                 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);
     }
 }
 
@@ -396,7 +396,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;
@@ -414,7 +414,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);
@@ -442,7 +442,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;
diff --git a/libs/rs/driver/rsdShaderCache.cpp b/libs/rs/driver/rsdShaderCache.cpp
index 2871a12..f6236e7 100644
--- a/libs/rs/driver/rsdShaderCache.cpp
+++ b/libs/rs/driver/rsdShaderCache.cpp
@@ -135,7 +135,7 @@
     }
 
     //ALOGV("RsdShaderCache miss");
-    //LOGE("e0 %x", glGetError());
+    //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);
                 }
             }
@@ -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);
                 }
             }
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 2c360fb..d7e8933 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -76,7 +76,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;
@@ -91,10 +91,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;
     }
@@ -113,20 +113,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;
     }
@@ -140,19 +140,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;
     }
@@ -160,7 +160,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;
     }
@@ -300,7 +300,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;
     }
 
@@ -322,7 +322,7 @@
     uint32_t packedSize = alloc->getPackedSize();
     if (dataSize != type->getSizeBytes() &&
         dataSize != packedSize) {
-        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(alloc);
         ObjectBase::checkDelete(type);
         return NULL;
@@ -410,7 +410,7 @@
 }
 
 void Allocation::resize2D(Context *rsc, uint32_t dimX, uint32_t dimY) {
-    LOGE("not implemented");
+    ALOGE("not implemented");
 }
 
 /////////////////
@@ -588,7 +588,7 @@
     RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, vtype, mips, usages, 0);
     Allocation *texAlloc = static_cast<Allocation *>(vTexAlloc);
     if (texAlloc == NULL) {
-        LOGE("Memory allocation failure");
+        ALOGE("Memory allocation failure");
         return NULL;
     }
 
@@ -612,7 +612,7 @@
     RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, vtype, mips, usages, 0);
     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/rsContext.cpp b/libs/rs/rsContext.cpp
index 293fc3a..ad2ff0f 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;
     }
 
@@ -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);
@@ -322,10 +322,10 @@
 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;
     }
 
@@ -602,12 +602,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);
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////
@@ -628,7 +628,7 @@
     Sampler *s = static_cast<Sampler *>(vs);
 
     if (slot > RS_MAX_SAMPLER_SLOT) {
-        LOGE("Invalid sampler slot");
+        ALOGE("Invalid sampler slot");
         return;
     }
 
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 9f8cc4a..2989c53 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -51,13 +51,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 24c8738..fb2892c 100644
--- a/libs/rs/rsElement.cpp
+++ b/libs/rs/rsElement.cpp
@@ -114,7 +114,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 530e79e..ac658c8 100644
--- a/libs/rs/rsFileA3D.cpp
+++ b/libs/rs/rsFileA3D.cpp
@@ -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,7 +364,7 @@
 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;
     }
 
@@ -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 7b3aa70..4f21b3b 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);
 
@@ -659,9 +659,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 ce69a60..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;
     }
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 addf932..6a64582 100644
--- a/libs/rs/rsObjectBase.cpp
+++ b/libs/rs/rsObjectBase.cpp
@@ -204,14 +204,14 @@
     // 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);
         }
     }
 
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 7fc128e..357dbe3 100644
--- a/libs/rs/rsScript.cpp
+++ b/libs/rs/rsScript.cpp
@@ -41,9 +41,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;
     }
 
@@ -56,21 +56,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);
 }
 
@@ -87,7 +87,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) {
@@ -96,7 +96,7 @@
     // freeing/duplicating the actual string for the environment.
     char *tz = (char *) malloc(length + 1);
     if (!tz) {
-        LOGE("Couldn't allocate memory for timezone buffer");
+        ALOGE("Couldn't allocate memory for timezone buffer");
         return;
     }
     strncpy(tz, timeZone, length);
@@ -104,7 +104,7 @@
     if (setenv("TZ", tz, 1) == 0) {
         tzset();
     } else {
-        LOGE("Error setting timezone");
+        ALOGE("Error setting timezone");
     }
     free(tz);
 }
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index ce3c643..afc8ba0 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -72,7 +72,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;
     }
@@ -83,7 +83,7 @@
             return mSlots[ct].get();
         }
     }
-    LOGE("ScriptC::ptrToAllocation, failed to find %p", ptr);
+    ALOGE("ScriptC::ptrToAllocation, failed to find %p", ptr);
     return NULL;
 }
 
@@ -181,7 +181,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;
 }
 */
@@ -197,12 +197,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;
     }
 
@@ -223,7 +223,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;
@@ -247,12 +247,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;
         }
 
@@ -264,7 +264,7 @@
                 mEnviroment.mVertex.clear();
                 continue;
             }
-            LOGE("Unrecognized value %s passed to stateVertex", value);
+            ALOGE("Unrecognized value %s passed to stateVertex", value);
             return false;
         }
 
@@ -276,7 +276,7 @@
                 mEnviroment.mRaster.clear();
                 continue;
             }
-            LOGE("Unrecognized value %s passed to stateRaster", value);
+            ALOGE("Unrecognized value %s passed to stateRaster", value);
             return false;
         }
 
@@ -288,7 +288,7 @@
                 mEnviroment.mFragment.clear();
                 continue;
             }
-            LOGE("Unrecognized value %s passed to stateFragment", value);
+            ALOGE("Unrecognized value %s passed to stateFragment", value);
             return false;
         }
 
@@ -300,7 +300,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 643cd8e..97469d3 100644
--- a/libs/rs/rsScriptC_LibGL.cpp
+++ b/libs/rs/rsScriptC_LibGL.cpp
@@ -159,11 +159,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};
@@ -208,7 +208,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 13e789d..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) {
@@ -149,7 +149,7 @@
 
         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 039714e..70ab7b7 100644
--- a/libs/rs/rsType.cpp
+++ b/libs/rs/rsType.cpp
@@ -170,7 +170,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..db6f5920 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/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 b2b70c1..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);
     }
@@ -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 267a9f7..263c8d9 100644
--- a/libs/ui/Input.cpp
+++ b/libs/ui/Input.cpp
@@ -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));
 }
 
diff --git a/libs/ui/InputTransport.cpp b/libs/ui/InputTransport.cpp
index 00716d7..09cbb31 100644
--- a/libs/ui/InputTransport.cpp
+++ b/libs/ui/InputTransport.cpp
@@ -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;
@@ -220,7 +220,7 @@
     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;
     }
@@ -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;
     }
@@ -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;
     }
@@ -444,7 +444,7 @@
 #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;
@@ -478,7 +478,7 @@
 #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;
         }
@@ -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;
     }
@@ -559,7 +559,7 @@
     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;
     }
@@ -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;
     }
@@ -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 e1d5e8b..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
@@ -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,7 +535,7 @@
     } 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;
     }
@@ -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,7 +564,7 @@
     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;
     }
@@ -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,7 +688,7 @@
         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;
             }
@@ -699,7 +699,7 @@
             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;
             }
@@ -711,7 +711,7 @@
         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;
                 }
@@ -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 7ba654a57..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
@@ -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;
         }
@@ -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,12 +316,12 @@
             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;
         }
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 d9ad863..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()
@@ -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);
@@ -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;
     }
diff --git a/libs/ui/VirtualKeyMap.cpp b/libs/ui/VirtualKeyMap.cpp
index 90c092d..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
@@ -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,7 +116,7 @@
                         && 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;
                 }
@@ -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/utils/Asset.cpp b/libs/utils/Asset.cpp
index 07693bb..50e701a 100644
--- a/libs/utils/Asset.cpp
+++ b/libs/utils/Asset.cpp
@@ -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;
     }
@@ -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,7 +581,7 @@
 
         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;
         }
 
@@ -590,7 +590,7 @@
             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;
             }
@@ -658,7 +658,7 @@
             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 77db3d4..47a2b99 100644
--- a/libs/utils/AssetManager.cpp
+++ b/libs/utils/AssetManager.cpp
@@ -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;
         }
@@ -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];
@@ -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;
         }
@@ -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();
     }
@@ -727,7 +727,7 @@
         if (ass) {
             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;
@@ -1074,13 +1074,13 @@
     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;
     }
 
@@ -1096,7 +1096,7 @@
     }
     if (pAsset == NULL) {
         /* unexpected */
-        LOGW("create from segment failed\n");
+        ALOGW("create from segment failed\n");
     }
 
     return pAsset;
@@ -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());
diff --git a/libs/utils/BackupHelpers.cpp b/libs/utils/BackupHelpers.cpp
index 882bf71..f77a891 100644
--- a/libs/utils/BackupHelpers.cpp
+++ b/libs/utils/BackupHelpers.cpp
@@ -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;
@@ -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 4970828..e52cf2f 100644
--- a/libs/utils/BlobCache.cpp
+++ b/libs/utils/BlobCache.cpp
@@ -69,11 +69,11 @@
         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;
     }
 
@@ -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/FileMap.cpp b/libs/utils/FileMap.cpp
index b2a61f1..9ce370e 100644
--- a/libs/utils/FileMap.cpp
+++ b/libs/utils/FileMap.cpp
@@ -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;
     }
@@ -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 1bc92cf..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;
@@ -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;
     }
@@ -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;
@@ -468,7 +468,7 @@
 
     if (nWrite != 1) {
         if (errno != EAGAIN) {
-            LOGW("Could not write wake signal, errno=%d", errno);
+            ALOGW("Could not write wake signal, errno=%d", errno);
         }
     }
 }
@@ -520,12 +520,12 @@
 
     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);
@@ -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;
         }
 
diff --git a/libs/utils/ObbFile.cpp b/libs/utils/ObbFile.cpp
index 11fe1e97..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,7 +172,7 @@
 
     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;
     }
 
@@ -192,7 +192,7 @@
 
     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;
@@ -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 99603ab..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
@@ -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 0b7dd92..ad0939e 100644
--- a/libs/utils/RefBase.cpp
+++ b/libs/utils/RefBase.cpp
@@ -98,7 +98,7 @@
 #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) {
@@ -116,7 +116,7 @@
 #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) {
@@ -129,7 +129,7 @@
             }
         }
         if (dumpStack) {
-            LOGE("above errors at:");
+            ALOGE("above errors at:");
             CallStack stack;
             stack.update();
             stack.dump();
@@ -205,7 +205,7 @@
                 close(rc);
                 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,7 +263,7 @@
                     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);
 
diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp
index 3569e32..15b83bb 100644
--- a/libs/utils/ResourceTypes.cpp
+++ b/libs/utils/ResourceTypes.cpp
@@ -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);
@@ -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;
         }
@@ -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;
@@ -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();
@@ -1888,13 +1888,13 @@
                                   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));
@@ -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;
     }
@@ -2353,7 +2353,7 @@
                     //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;
             }
@@ -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;
                 }
 
@@ -3935,7 +3935,7 @@
     }
 
     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);
             }
@@ -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;
             }
 
diff --git a/libs/utils/StreamingZipInflater.cpp b/libs/utils/StreamingZipInflater.cpp
index 59a46f9..8512170a 100644
--- a/libs/utils/StreamingZipInflater.cpp
+++ b/libs/utils/StreamingZipInflater.cpp
@@ -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();
@@ -165,7 +165,7 @@
             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;
@@ -195,7 +195,7 @@
             //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/SystemClock.cpp b/libs/utils/SystemClock.cpp
index 89a052f..8b8ac10 100644
--- a/libs/utils/SystemClock.cpp
+++ b/libs/utils/SystemClock.cpp
@@ -69,20 +69,20 @@
 #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 fe4b8e6..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;
@@ -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/Tokenizer.cpp b/libs/utils/Tokenizer.cpp
index 68752b4..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 {
diff --git a/libs/utils/ZipFileRO.cpp b/libs/utils/ZipFileRO.cpp
index 6ca9a28..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,7 +203,7 @@
      * 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;
     }
@@ -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;
@@ -290,12 +290,12 @@
 
     // 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;
     }
 
@@ -304,12 +304,12 @@
 
     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,7 +367,7 @@
 
         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;
         }
@@ -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,10 +754,10 @@
     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 {
@@ -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 cc5c68a..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;
     }
@@ -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;
     }
@@ -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/java/android/media/AudioFormat.java b/media/java/android/media/AudioFormat.java
index 8990fe5..49f498e 100644
--- a/media/java/android/media/AudioFormat.java
+++ b/media/java/android/media/AudioFormat.java
@@ -31,10 +31,11 @@
     public static final int ENCODING_INVALID = 0;
     /** Default audio data format */
     public static final int ENCODING_DEFAULT = 1;
+    // These two values must be kept in sync with JNI code for AudioTrack, AudioRecord
     /** Audio data format: PCM 16 bit per sample. Guaranteed to be supported by devices. */
-    public static final int ENCODING_PCM_16BIT = 2; // accessed by native code
+    public static final int ENCODING_PCM_16BIT = 2;
     /** Audio data format: PCM 8 bit per sample. Not guaranteed to be supported by devices. */
-    public static final int ENCODING_PCM_8BIT = 3;  // accessed by native code
+    public static final int ENCODING_PCM_8BIT = 3;
 
     /** Invalid audio channel configuration */
     /** @deprecated use CHANNEL_INVALID instead  */
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 093b108..72876d7 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -145,7 +145,8 @@
     private SettingsObserver mSettingsObserver;
 
     private int mMode;
-    private Object mSettingsLock = new Object();
+    // protects mRingerMode
+    private final Object mSettingsLock = new Object();
     private boolean mMediaServerOk;
 
     private SoundPool mSoundPool;
@@ -236,6 +237,7 @@
      * {@link AudioManager#RINGER_MODE_SILENT}, or
      * {@link AudioManager#RINGER_MODE_VIBRATE}.
      */
+    // protected by mSettingsLock
     private int mRingerMode;
 
     /** @see System#MODE_RINGER_STREAMS_AFFECTED */
@@ -442,12 +444,15 @@
     private void readPersistedSettings() {
         final ContentResolver cr = mContentResolver;
 
-        mRingerMode = System.getInt(cr, System.MODE_RINGER, AudioManager.RINGER_MODE_NORMAL);
+        int ringerMode = System.getInt(cr, System.MODE_RINGER, AudioManager.RINGER_MODE_NORMAL);
         // sanity check in case the settings are restored from a device with incompatible
         // ringer modes
-        if (!AudioManager.isValidRingerMode(mRingerMode)) {
-            mRingerMode = AudioManager.RINGER_MODE_NORMAL;
-            System.putInt(cr, System.MODE_RINGER, mRingerMode);
+        if (!AudioManager.isValidRingerMode(ringerMode)) {
+            ringerMode = AudioManager.RINGER_MODE_NORMAL;
+            System.putInt(cr, System.MODE_RINGER, ringerMode);
+        }
+        synchronized(mSettingsLock) {
+            mRingerMode = ringerMode;
         }
 
         mVibrateSetting = System.getInt(cr, System.VIBRATE_ON, 0);
@@ -473,7 +478,7 @@
         // Each stream will read its own persisted settings
 
         // Broadcast the sticky intent
-        broadcastRingerMode();
+        broadcastRingerMode(ringerMode);
 
         // Broadcast vibrate settings
         broadcastVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER);
@@ -538,8 +543,9 @@
         if (((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0) ||
                 streamTypeAlias == AudioSystem.STREAM_RING ||
                 (!mVoiceCapable && streamTypeAlias == AudioSystem.STREAM_MUSIC)) {
+            int ringerMode = getRingerMode();
             // do not vibrate if already in vibrate mode
-            if (mRingerMode == AudioManager.RINGER_MODE_VIBRATE) {
+            if (ringerMode == AudioManager.RINGER_MODE_VIBRATE) {
                 flags &= ~AudioManager.FLAG_VIBRATE;
             }
             // Check if the ringer mode changes with this volume adjustment. If
@@ -599,7 +605,7 @@
         // setting ring or notifications volume to 0 on voice capable devices enters silent mode
         if (mVoiceCapable && (((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0) ||
                 (STREAM_VOLUME_ALIAS[streamType] == AudioSystem.STREAM_RING))) {
-            int newRingerMode = mRingerMode;
+            int newRingerMode;
             if (index == 0) {
                 newRingerMode = System.getInt(mContentResolver, System.VIBRATE_IN_SILENT, 1) == 1
                     ? AudioManager.RINGER_MODE_VIBRATE
@@ -608,9 +614,7 @@
             } else {
                 newRingerMode = AudioManager.RINGER_MODE_NORMAL;
             }
-            if (newRingerMode != mRingerMode) {
-                setRingerMode(newRingerMode);
-            }
+            setRingerMode(newRingerMode);
         }
 
         index = rescaleIndex(index * 10, streamType, STREAM_VOLUME_ALIAS[streamType]);
@@ -722,22 +726,31 @@
 
     /** @see AudioManager#getRingerMode() */
     public int getRingerMode() {
-        return mRingerMode;
+        synchronized(mSettingsLock) {
+            return mRingerMode;
+        }
+    }
+
+    private void ensureValidRingerMode(int ringerMode) {
+        if (!AudioManager.isValidRingerMode(ringerMode)) {
+            throw new IllegalArgumentException("Bad ringer mode " + ringerMode);
+        }
     }
 
     /** @see AudioManager#setRingerMode(int) */
     public void setRingerMode(int ringerMode) {
-        synchronized (mSettingsLock) {
-            if (ringerMode != mRingerMode) {
-                setRingerModeInt(ringerMode, true);
-                // Send sticky broadcast
-                broadcastRingerMode();
-            }
+        ensureValidRingerMode(ringerMode);
+        if (ringerMode != getRingerMode()) {
+            setRingerModeInt(ringerMode, true);
+            // Send sticky broadcast
+            broadcastRingerMode(ringerMode);
         }
     }
 
     private void setRingerModeInt(int ringerMode, boolean persist) {
-        mRingerMode = ringerMode;
+        synchronized(mSettingsLock) {
+            mRingerMode = ringerMode;
+        }
 
         // Mute stream if not previously muted by ringer mode and ringer mode
         // is not RINGER_MODE_NORMAL and stream is affected by ringer mode.
@@ -747,7 +760,7 @@
         for (int streamType = numStreamTypes - 1; streamType >= 0; streamType--) {
             if (isStreamMutedByRingerMode(streamType)) {
                 if (!isStreamAffectedByRingerMode(streamType) ||
-                    mRingerMode == AudioManager.RINGER_MODE_NORMAL) {
+                    ringerMode == AudioManager.RINGER_MODE_NORMAL) {
                     // ring and notifications volume should never be 0 when not silenced
                     // on voice capable devices
                     if (mVoiceCapable &&
@@ -760,7 +773,7 @@
                 }
             } else {
                 if (isStreamAffectedByRingerMode(streamType) &&
-                    mRingerMode != AudioManager.RINGER_MODE_NORMAL) {
+                    ringerMode != AudioManager.RINGER_MODE_NORMAL) {
                    mStreamStates[streamType].mute(null, true);
                    mRingerModeMutedStreams |= (1 << streamType);
                }
@@ -780,10 +793,10 @@
         switch (getVibrateSetting(vibrateType)) {
 
             case AudioManager.VIBRATE_SETTING_ON:
-                return mRingerMode != AudioManager.RINGER_MODE_SILENT;
+                return getRingerMode() != AudioManager.RINGER_MODE_SILENT;
 
             case AudioManager.VIBRATE_SETTING_ONLY_SILENT:
-                return mRingerMode == AudioManager.RINGER_MODE_VIBRATE;
+                return getRingerMode() == AudioManager.RINGER_MODE_VIBRATE;
 
             case AudioManager.VIBRATE_SETTING_OFF:
                 // return false, even for incoming calls
@@ -1035,7 +1048,7 @@
 
     /**
      * Loads samples into the soundpool.
-     * This method must be called at when sound effects are enabled
+     * This method must be called at first when sound effects are enabled
      */
     public boolean loadSoundEffects() {
         int status;
@@ -1688,11 +1701,12 @@
      */
     private boolean checkForRingerModeChange(int oldIndex, int direction, int streamType) {
         boolean adjustVolumeIndex = true;
-        int newRingerMode = mRingerMode;
+        int ringerMode = getRingerMode();
+        int newRingerMode = ringerMode;
         int uiIndex = (oldIndex + 5) / 10;
         boolean vibeInSilent = System.getInt(mContentResolver, System.VIBRATE_IN_SILENT, 1) == 1;
 
-        if (mRingerMode == RINGER_MODE_NORMAL) {
+        if (ringerMode == RINGER_MODE_NORMAL) {
             if ((direction == AudioManager.ADJUST_LOWER) && (uiIndex <= 1)) {
                 // enter silent mode if current index is the last audible one and not repeating a
                 // volume key down
@@ -1707,7 +1721,7 @@
                     adjustVolumeIndex = false;
                 }
             }
-        } else if (mRingerMode == RINGER_MODE_VIBRATE) {
+        } else if (ringerMode == RINGER_MODE_VIBRATE) {
             if ((direction == AudioManager.ADJUST_LOWER)) {
                 // Set it to silent, if it wasn't a long-press
                 if (mPrevVolDirection != AudioManager.ADJUST_LOWER) {
@@ -1726,9 +1740,7 @@
             adjustVolumeIndex = false;
         }
 
-        if (newRingerMode != mRingerMode) {
-            setRingerMode(newRingerMode);
-        }
+        setRingerMode(newRingerMode);
 
         mPrevVolDirection = direction;
 
@@ -1818,10 +1830,10 @@
         }
     }
 
-    private void broadcastRingerMode() {
+    private void broadcastRingerMode(int ringerMode) {
         // Send sticky broadcast
         Intent broadcast = new Intent(AudioManager.RINGER_MODE_CHANGED_ACTION);
-        broadcast.putExtra(AudioManager.EXTRA_RINGER_MODE, mRingerMode);
+        broadcast.putExtra(AudioManager.EXTRA_RINGER_MODE, ringerMode);
         broadcast.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
                 | Intent.FLAG_RECEIVER_REPLACE_PENDING);
         long origCallerIdentityToken = Binder.clearCallingIdentity();
@@ -2013,7 +2025,8 @@
                                 if (muteCount() == 0) {
                                     // If the stream is not muted any more, restore it's volume if
                                     // ringer mode allows it
-                                    if (!isStreamAffectedByRingerMode(mStreamType) || mRingerMode == AudioManager.RINGER_MODE_NORMAL) {
+                                    if (!isStreamAffectedByRingerMode(mStreamType) ||
+                                            getRingerMode() == AudioManager.RINGER_MODE_NORMAL) {
                                         setIndex(mLastAudibleIndex, false);
                                         sendMsg(mAudioHandler, MSG_SET_SYSTEM_VOLUME, SENDMSG_NOOP, 0, 0,
                                                 VolumeStreamState.this, 0);
@@ -2131,8 +2144,8 @@
             }
         }
 
-        private void persistRingerMode() {
-            System.putInt(mContentResolver, System.MODE_RINGER, mRingerMode);
+        private void persistRingerMode(int ringerMode) {
+            System.putInt(mContentResolver, System.MODE_RINGER, ringerMode);
         }
 
         private void persistVibrateSetting() {
@@ -2219,7 +2232,9 @@
                     break;
 
                 case MSG_PERSIST_RINGER_MODE:
-                    persistRingerMode();
+                    // note that the value persisted is the current ringer mode, not the
+                    // value of ringer mode as of the time the request was made to persist
+                    persistRingerMode(getRingerMode());
                     break;
 
                 case MSG_PERSIST_VIBRATE_SETTING:
@@ -2335,6 +2350,10 @@
         @Override
         public void onChange(boolean selfChange) {
             super.onChange(selfChange);
+            // FIXME This synchronized is not necessary if mSettingsLock only protects mRingerMode.
+            //       However there appear to be some missing locks around mRingerModeMutedStreams
+            //       and mRingerModeAffectedStreams, so will leave this synchronized for now.
+            //       mRingerModeMutedStreams and mMuteAffectedStreams are safe (only accessed once).
             synchronized (mSettingsLock) {
                 int ringerModeAffectedStreams = Settings.System.getInt(mContentResolver,
                        Settings.System.MODE_RINGER_STREAMS_AFFECTED,
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index 95d93b2..474a842 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -27,7 +27,7 @@
  */
 public class AudioSystem
 {
-    /* FIXME: Need to finalize this and correlate with native layer */
+    /* These values must be kept in sync with AudioSystem.h */
     /*
      * If these are modified, please also update Settings.System.VOLUME_SETTINGS
      * and attrs.xml and AudioManager.java.
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index c5d17eb..7b2f1b7 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -29,7 +29,7 @@
 
 /**
  * The AudioTrack class manages and plays a single audio resource for Java applications.
- * It allows to stream PCM audio buffers to the audio hardware for playback. This is
+ * It allows streaming PCM audio buffers to the audio hardware for playback. This is
  * achieved by "pushing" the data to the AudioTrack object using one of the
  *  {@link #write(byte[], int, int)} and {@link #write(short[], int, int)} methods.
  *
@@ -46,7 +46,7 @@
  *   <li>received or generated while previously queued audio is playing.</li>
  * </ul>
  *
- * The static mode is to be chosen when dealing with short sounds that fit in memory and
+ * The static mode should be chosen when dealing with short sounds that fit in memory and
  * that need to be played with the smallest latency possible. The static mode will
  * therefore be preferred for UI and game sounds that are played often, and with the
  * smallest overhead possible.
@@ -57,7 +57,7 @@
  * For an AudioTrack using the static mode, this size is the maximum size of the sound that can
  * be played from it.<br>
  * For the streaming mode, data will be written to the hardware in chunks of
- * sizes inferior to the total buffer size.
+ * sizes less than or equal to the total buffer size.
  */
 public class AudioTrack
 {
@@ -76,6 +76,7 @@
     /** indicates AudioTrack state is playing */
     public static final int PLAYSTATE_PLAYING = 3;  // matches SL_PLAYSTATE_PLAYING
 
+    // keep these values in sync with android_media_AudioTrack.cpp
     /**
      * Creation mode where audio data is transferred from Java to the native layer
      * only once before the audio starts playing.
@@ -180,7 +181,7 @@
     /**
      * The audio data sampling rate in Hz.
      */
-    private int mSampleRate = 22050;
+    private int mSampleRate; // initialized by all constructors
     /**
      * The number of audio output channels (1 is mono, 2 is stereo).
      */
@@ -193,8 +194,9 @@
     /**
      * The type of the audio stream to play. See
      *   {@link AudioManager#STREAM_VOICE_CALL}, {@link AudioManager#STREAM_SYSTEM},
-     *   {@link AudioManager#STREAM_RING}, {@link AudioManager#STREAM_MUSIC} and
-     *   {@link AudioManager#STREAM_ALARM}
+     *   {@link AudioManager#STREAM_RING}, {@link AudioManager#STREAM_MUSIC},
+     *   {@link AudioManager#STREAM_ALARM}, {@link AudioManager#STREAM_NOTIFICATION}, and
+     *   {@link AudioManager#STREAM_DTMF}.
      */
     private int mStreamType = AudioManager.STREAM_MUSIC;
     /**
@@ -240,10 +242,9 @@
      * Class constructor.
      * @param streamType the type of the audio stream. See
      *   {@link AudioManager#STREAM_VOICE_CALL}, {@link AudioManager#STREAM_SYSTEM},
-     *   {@link AudioManager#STREAM_RING}, {@link AudioManager#STREAM_MUSIC} and
-     *   {@link AudioManager#STREAM_ALARM}
-     * @param sampleRateInHz the sample rate expressed in Hertz. Examples of rates are (but
-     *   not limited to) 44100, 22050 and 11025.
+     *   {@link AudioManager#STREAM_RING}, {@link AudioManager#STREAM_MUSIC},
+     *   {@link AudioManager#STREAM_ALARM}, and {@link AudioManager#STREAM_NOTIFICATION}.
+     * @param sampleRateInHz the sample rate expressed in Hertz.
      * @param channelConfig describes the configuration of the audio channels.
      *   See {@link AudioFormat#CHANNEL_OUT_MONO} and
      *   {@link AudioFormat#CHANNEL_OUT_STEREO}
@@ -275,14 +276,15 @@
      * and media players in the same session and not to the output mix.
      * When an AudioTrack is created without specifying a session, it will create its own session
      * which can be retreived by calling the {@link #getAudioSessionId()} method.
-     * If a session ID is provided, this AudioTrack will share effects attached to this session
-     * with all other media players or audio tracks in the same session.
+     * If a non-zero session ID is provided, this AudioTrack will share effects attached to this
+     * session
+     * with all other media players or audio tracks in the same session, otherwise a new session
+     * will be created for this track if none is supplied.
      * @param streamType the type of the audio stream. See
      *   {@link AudioManager#STREAM_VOICE_CALL}, {@link AudioManager#STREAM_SYSTEM},
-     *   {@link AudioManager#STREAM_RING}, {@link AudioManager#STREAM_MUSIC} and
-     *   {@link AudioManager#STREAM_ALARM}
-     * @param sampleRateInHz the sample rate expressed in Hertz. Examples of rates are (but
-     *   not limited to) 44100, 22050 and 11025.
+     *   {@link AudioManager#STREAM_RING}, {@link AudioManager#STREAM_MUSIC},
+     *   {@link AudioManager#STREAM_ALARM}, and {@link AudioManager#STREAM_NOTIFICATION}.
+     * @param sampleRateInHz the sample rate expressed in Hertz.
      * @param channelConfig describes the configuration of the audio channels.
      *   See {@link AudioFormat#CHANNEL_OUT_MONO} and
      *   {@link AudioFormat#CHANNEL_OUT_STEREO}
@@ -304,8 +306,8 @@
             int bufferSizeInBytes, int mode, int sessionId)
     throws IllegalArgumentException {
         mState = STATE_UNINITIALIZED;
-        
-        // remember which looper is associated with the AudioTrack instanciation
+
+        // remember which looper is associated with the AudioTrack instantiation
         if ((mInitializationLooper = Looper.myLooper()) == null) {
             mInitializationLooper = Looper.getMainLooper();
         }
@@ -365,7 +367,7 @@
         }
 
         //--------------
-        // sample rate
+        // sample rate, note these values are subject to change
         if ( (sampleRateInHz < 4000) || (sampleRateInHz > 48000) ) {
             throw (new IllegalArgumentException(sampleRateInHz
                     + "Hz is not a supported sample rate."));
@@ -508,7 +510,8 @@
      * Returns the type of audio stream this AudioTrack is configured for.
      * Compare the result against {@link AudioManager#STREAM_VOICE_CALL},
      * {@link AudioManager#STREAM_SYSTEM}, {@link AudioManager#STREAM_RING},
-     * {@link AudioManager#STREAM_MUSIC} or {@link AudioManager#STREAM_ALARM}
+     * {@link AudioManager#STREAM_MUSIC}, {@link AudioManager#STREAM_ALARM},
+     * {@link AudioManager#STREAM_NOTIFICATION}, or {@link AudioManager#STREAM_DTMF}.
      */
     public int getStreamType() {
         return mStreamType;
@@ -630,6 +633,7 @@
             return AudioTrack.ERROR_BAD_VALUE;
         }
 
+        // sample rate, note these values are subject to change
         if ( (sampleRateInHz < 4000) || (sampleRateInHz > 48000) ) {
             loge("getMinBufferSize(): " + sampleRateInHz +"Hz is not a supported sample rate.");
             return AudioTrack.ERROR_BAD_VALUE;
@@ -728,7 +732,7 @@
      * the audio data will be consumed and played back, not the original sampling rate of the
      * content. Setting it to half the sample rate of the content will cause the playback to
      * last twice as long, but will also result in a negative pitch shift.
-     * The valid sample rate range if from 1Hz to twice the value returned by
+     * The valid sample rate range is from 1Hz to twice the value returned by
      * {@link #getNativeOutputSampleRate(int)}.
      * @param sampleRateInHz the sample rate expressed in Hz
      * @return error code or success, see {@link #SUCCESS}, {@link #ERROR_BAD_VALUE},
@@ -906,7 +910,7 @@
      *    the parameters don't resolve to valid data and indexes.
      */
 
-    public int write(byte[] audioData,int offsetInBytes, int sizeInBytes) {
+    public int write(byte[] audioData, int offsetInBytes, int sizeInBytes) {
         if ((mDataLoadMode == MODE_STATIC)
                 && (mState == STATE_NO_STATIC_DATA)
                 && (sizeInBytes > 0)) {
@@ -1012,8 +1016,8 @@
      * <p>Note that the passed level value is a raw scalar. UI controls should be scaled
      * logarithmically: the gain applied by audio framework ranges from -72dB to 0dB,
      * so an appropriate conversion from linear UI input x to level is:
-     * x == 0 -> level = 0
-     * 0 < x <= R -> level = 10^(72*(x-R)/20/R)
+     * x == 0 -&gt; level = 0
+     * 0 &lt; x &lt;= R -&gt; level = 10^(72*(x-R)/20/R)
      *
      * @param level send level scalar
      * @return error code or success, see {@link #SUCCESS},
@@ -1062,7 +1066,7 @@
     /**
      * Helper class to handle the forwarding of native events to the appropriate listener
      * (potentially) handled in a different thread
-     */  
+     */
     private class NativeEventHandlerDelegate {
         private final AudioTrack mAudioTrack;
         private final Handler mHandler;
diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp
index f749d51..0dc3b65 100644
--- a/media/jni/android_media_MediaMetadataRetriever.cpp
+++ b/media/jni/android_media_MediaMetadataRetriever.cpp
@@ -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;
@@ -238,7 +238,7 @@
         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;
     }
 
@@ -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) {
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 0272a03..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;
     }
@@ -405,7 +405,7 @@
     }
     int w;
     if (0 != mp->getVideoWidth(&w)) {
-        LOGE("getVideoWidth failed");
+        ALOGE("getVideoWidth failed");
         w = 0;
     }
     ALOGV("getVideoWidth: %d", w);
@@ -422,7 +422,7 @@
     }
     int h;
     if (0 != mp->getVideoHeight(&h)) {
-        LOGE("getVideoHeight failed");
+        ALOGE("getVideoHeight failed");
         h = 0;
     }
     ALOGV("getVideoHeight: %d", h);
@@ -659,7 +659,7 @@
     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);
 }
@@ -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_MediaRecorder.cpp b/media/jni/android_media_MediaRecorder.cpp
index 3fc75ed..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;
     }
@@ -229,7 +229,7 @@
     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;
     }
 
@@ -323,7 +323,7 @@
         // 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;
         }
diff --git a/media/jni/android_media_MediaScanner.cpp b/media/jni/android_media_MediaScanner.cpp
index 67c85cc..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;
@@ -118,7 +118,7 @@
                 env->FindClass(kClassMediaScannerClient);
 
         if (mediaScannerClientInterface == NULL) {
-            LOGE("Class %s not found", kClassMediaScannerClient);
+            ALOGE("Class %s not found", kClassMediaScannerClient);
         } else {
             mScanFileMethodID = env->GetMethodID(
                                     mediaScannerClientInterface,
@@ -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);
 }
@@ -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) {
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 c71410b..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();
     }
@@ -142,7 +142,7 @@
     }
     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;
     }
@@ -433,193 +433,193 @@
 
     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 d517a58..3b325b7 100644
--- a/media/jni/audioeffect/android_media_AudioEffect.cpp
+++ b/media/jni/audioeffect/android_media_AudioEffect.cpp
@@ -112,14 +112,14 @@
             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;
@@ -128,7 +128,7 @@
         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;
@@ -137,7 +137,7 @@
         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,7 +149,7 @@
         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);
@@ -159,7 +159,7 @@
         ALOGV("EVENT_PARAMETER_CHANGED");
        break;
     case AudioEffect::EVENT_ERROR:
-        LOGW("EVENT_ERROR");
+        ALOGW("EVENT_ERROR");
         break;
     }
 
@@ -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;
     }
 }
@@ -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;
     }
 
@@ -305,7 +305,7 @@
             &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;
     }
 
@@ -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;
         }
     }
@@ -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;
         }
 
@@ -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 b64505c..ecd4d07 100644
--- a/media/jni/audioeffect/android_media_Visualizer.cpp
+++ b/media/jni/audioeffect/android_media_Visualizer.cpp
@@ -113,7 +113,7 @@
             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;
     }
 
@@ -185,7 +185,7 @@
     // 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;
     }
 
@@ -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;
     }
 
@@ -248,7 +248,7 @@
             &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;
     }
diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp
index 7083a91c..c84a883 100755
--- a/media/jni/mediaeditor/VideoEditorMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorMain.cpp
@@ -441,7 +441,7 @@
                 if (extPos != NULL) {
                     *extPos = '\0';
                 } else {
-                    LOGE("ERROR the overlay file is incorrect");
+                    ALOGE("ERROR the overlay file is incorrect");
                 }
 
                 strcat(pContext->mOverlayFileName, ".png");
@@ -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");
@@ -1510,7 +1510,7 @@
 
     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;
     }
@@ -2904,7 +2904,7 @@
                 // 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 */
diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp
index 40db37f..14a5309 100644
--- a/media/jni/soundpool/SoundPool.cpp
+++ b/media/jni/soundpool/SoundPool.cpp
@@ -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;
@@ -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;
     }
 
@@ -508,19 +508,19 @@
         mFd = -1;
     }
     if (p == 0) {
-        LOGE("Unable to load sample: %s", mUrl);
+        ALOGE("Unable to load sample: %s", mUrl);
         return -1;
     }
     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;
     }
 
@@ -616,7 +616,7 @@
         oldTrack = mAudioTrack;
         status = newTrack->initCheck();
         if (status != NO_ERROR) {
-            LOGE("Error creating AudioTrack");
+            ALOGE("Error creating AudioTrack");
             goto exit;
         }
         ALOGV("setVolume %p", newTrack);
diff --git a/media/jni/soundpool/SoundPoolThread.cpp b/media/jni/soundpool/SoundPoolThread.cpp
index bbb56ff..ba3b482 100644
--- a/media/jni/soundpool/SoundPoolThread.cpp
+++ b/media/jni/soundpool/SoundPoolThread.cpp
@@ -91,7 +91,7 @@
             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 f86892f..fe1c20a 100644
--- a/media/jni/soundpool/android_media_SoundPool.cpp
+++ b/media/jni/soundpool/android_media_SoundPool.cpp
@@ -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/libeffects/factory/EffectsFactory.c b/media/libeffects/factory/EffectsFactory.c
index ee2279a..9f6599f 100644
--- a/media/libeffects/factory/EffectsFactory.c
+++ b/media/libeffects/factory/EffectsFactory.c
@@ -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;
     }
 
@@ -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);
@@ -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;
     }
 
@@ -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,7 +551,7 @@
     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;
     }
@@ -562,7 +562,7 @@
 #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;
     }
diff --git a/media/libeffects/preprocessing/PreProcessing.cpp b/media/libeffects/preprocessing/PreProcessing.cpp
index c99552b..e988e06 100755
--- a/media/libeffects/preprocessing/PreProcessing.cpp
+++ b/media/libeffects/preprocessing/PreProcessing.cpp
@@ -240,7 +240,7 @@
     webrtc::GainControl *agc = effect->session->apm->gain_control();
     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;
     }
@@ -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;
     }
@@ -344,7 +344,7 @@
         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;
     }
@@ -403,7 +403,7 @@
     webrtc::EchoControlMobile *aec = effect->session->apm->echo_control_mobile();
     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);
@@ -429,7 +429,7 @@
         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;
     }
@@ -449,7 +449,7 @@
         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;
     }
@@ -522,7 +522,7 @@
     webrtc::NoiseSuppression *ns = effect->session->apm->noise_suppression();
     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);
@@ -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:
@@ -730,7 +730,7 @@
     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;
@@ -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);
@@ -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;
@@ -1105,7 +1105,7 @@
 
     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;
     }
 
@@ -1443,13 +1443,13 @@
     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;
     }
 
@@ -1585,14 +1585,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;
     }
 
diff --git a/media/libeffects/testlibs/EffectEqualizer.cpp b/media/libeffects/testlibs/EffectEqualizer.cpp
index 52fbf79..5241660 100644
--- a/media/libeffects/testlibs/EffectEqualizer.cpp
+++ b/media/libeffects/testlibs/EffectEqualizer.cpp
@@ -165,7 +165,7 @@
 
     ret = Equalizer_init(pContext);
     if (ret < 0) {
-        LOGW("EffectLibCreateEffect() init failed");
+        ALOGW("EffectLibCreateEffect() init failed");
         delete pContext;
         return ret;
     }
@@ -735,7 +735,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;
     }
 
diff --git a/media/libeffects/testlibs/EffectReverb.c b/media/libeffects/testlibs/EffectReverb.c
index 419a41c..ebb72c1 100644
--- a/media/libeffects/testlibs/EffectReverb.c
+++ b/media/libeffects/testlibs/EffectReverb.c
@@ -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;
     }
@@ -405,7 +405,7 @@
         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;
     }
 
diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp
index b2a7a35..5d70a9b 100644
--- a/media/libeffects/visualizer/EffectVisualizer.cpp
+++ b/media/libeffects/visualizer/EffectVisualizer.cpp
@@ -212,7 +212,7 @@
 
     ret = Visualizer_init(pContext);
     if (ret < 0) {
-        LOGW("VisualizerLib_Create() init failed");
+        ALOGW("VisualizerLib_Create() init failed");
         delete pContext;
         return ret;
     }
@@ -472,7 +472,7 @@
         break;
 
     default:
-        LOGW("Visualizer_command invalid command %d",cmdCode);
+        ALOGW("Visualizer_command invalid command %d",cmdCode);
         return -EINVAL;
     }
 
diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp
index 6e53a15..6639d06 100644
--- a/media/libmedia/AudioEffect.cpp
+++ b/media/libmedia/AudioEffect.cpp
@@ -101,18 +101,18 @@
     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;
     }
 
@@ -340,7 +340,7 @@
 
 void AudioEffect::binderDied()
 {
-    LOGW("IEffect died");
+    ALOGW("IEffect died");
     mStatus = NO_INIT;
     if (mCbf) {
         status_t status = DEAD_OBJECT;
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index dd1c6a5..2674070 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -54,12 +54,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;
     }
@@ -153,7 +153,7 @@
     }
     // validate parameters
     if (!audio_is_valid_format(format)) {
-        LOGE("Invalid format");
+        ALOGE("Invalid format");
         return BAD_VALUE;
     }
 
@@ -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;
     }
 
@@ -292,7 +292,7 @@
     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;
             }
         }
@@ -472,12 +472,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();
@@ -535,7 +535,7 @@
             if (CC_UNLIKELY(result != NO_ERROR)) {
                 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();
@@ -546,7 +546,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;
                     }
@@ -626,7 +626,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;
     }
@@ -709,7 +709,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;
@@ -764,7 +764,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();
@@ -787,13 +787,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();
         }
@@ -810,7 +810,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 61d0dad..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;
 }
@@ -383,7 +383,7 @@
     if (gAudioErrorCallback) {
         gAudioErrorCallback(DEAD_OBJECT);
     }
-    LOGW("AudioFlinger server died!");
+    ALOGW("AudioFlinger server died!");
 }
 
 void AudioSystem::AudioFlingerClient::ioConfigChanged(int event, int ioHandle, void *param2) {
@@ -419,7 +419,7 @@
         } break;
     case OUTPUT_CLOSED: {
         if (gOutputs.indexOfKey(ioHandle) < 0) {
-            LOGW("ioConfigChanged() closing unknow output! %d", ioHandle);
+            ALOGW("ioConfigChanged() closing unknow output! %d", ioHandle);
             break;
         }
         ALOGV("ioConfigChanged() output %d closed", ioHandle);
@@ -435,7 +435,7 @@
     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;
@@ -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) {
@@ -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 e0c6ca5..191fbaf 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -158,7 +158,7 @@
 
     AutoMutex lock(mLock);
     if (mAudioTrack != 0) {
-        LOGE("Track already in use");
+        ALOGE("Track already in use");
         return INVALID_OPERATION;
     }
 
@@ -188,7 +188,7 @@
 
     // validate parameters
     if (!audio_is_valid_format(format)) {
-        LOGE("Invalid format");
+        ALOGE("Invalid format");
         return BAD_VALUE;
     }
 
@@ -198,7 +198,7 @@
     }
 
     if (!audio_is_output_channel(channelMask)) {
-        LOGE("Invalid channel mask");
+        ALOGE("Invalid channel mask");
         return BAD_VALUE;
     }
     uint32_t channelCount = popcount(channelMask);
@@ -209,7 +209,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;
     }
 
@@ -239,7 +239,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;
         }
     }
@@ -252,7 +252,7 @@
     mChannelCount = channelCount;
     mSharedBuffer = sharedBuffer;
     mMuted = false;
-    mActive = 0;
+    mActive = false;
     mCbf = cbf;
     mUserData = user;
     mLoopCount = 0;
@@ -324,7 +324,7 @@
     if (t != 0) {
         if (t->exitPending()) {
             if (t->requestExitAndWait() == WOULD_BLOCK) {
-                LOGE("AudioTrack::start called from thread");
+                ALOGE("AudioTrack::start called from thread");
                 return;
             }
         }
@@ -338,9 +338,9 @@
     sp <IMemory> iMem = mCblkMemory;
     audio_track_cblk_t* cblk = mCblk;
 
-    if (mActive == 0) {
+    if (!mActive) {
         mFlushed = false;
-        mActive = 1;
+        mActive = true;
         mNewPosition = cblk->server + mUpdatePeriod;
         cblk->lock.lock();
         cblk->bufferTimeoutMs = MAX_STARTUP_TIMEOUT_MS;
@@ -369,7 +369,7 @@
         cblk->lock.unlock();
         if (status != NO_ERROR) {
             ALOGV("start() failed");
-            mActive = 0;
+            mActive = false;
             if (t != 0) {
                 t->requestExit();
             } else {
@@ -394,8 +394,8 @@
     }
 
     AutoMutex lock(mLock);
-    if (mActive == 1) {
-        mActive = 0;
+    if (mActive) {
+        mActive = false;
         mCblk->cv.signal();
         mAudioTrack->stop();
         // Cancel loops (If we are in the middle of a loop, playback
@@ -424,7 +424,8 @@
 
 bool AudioTrack::stopped() const
 {
-    return !mActive;
+    AutoMutex lock(mLock);
+    return stopped_l();
 }
 
 void AudioTrack::flush()
@@ -456,8 +457,8 @@
 {
     ALOGV("pause");
     AutoMutex lock(mLock);
-    if (mActive == 1) {
-        mActive = 0;
+    if (mActive) {
+        mActive = false;
         mAudioTrack->pause();
     }
 }
@@ -566,12 +567,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;
     }
@@ -647,9 +648,10 @@
 status_t AudioTrack::setPosition(uint32_t position)
 {
     AutoMutex lock(mLock);
-    Mutex::Autolock _l(mCblk->lock);
 
-    if (!stopped()) return INVALID_OPERATION;
+    if (!stopped_l()) return INVALID_OPERATION;
+
+    Mutex::Autolock _l(mCblk->lock);
 
     if (position > mCblk->user) return BAD_VALUE;
 
@@ -672,7 +674,7 @@
 {
     AutoMutex lock(mLock);
 
-    if (!stopped()) return INVALID_OPERATION;
+    if (!stopped_l()) return INVALID_OPERATION;
 
     flush_l();
 
@@ -726,7 +728,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;
     }
 
@@ -769,7 +771,7 @@
             }
             if (frameCount < minFrameCount) {
                 if (enforceFrameCount) {
-                    LOGE("Invalid buffer size: minFrameCount %d, frameCount %d", minFrameCount, frameCount);
+                    ALOGE("Invalid buffer size: minFrameCount %d, frameCount %d", minFrameCount, frameCount);
                     return BAD_VALUE;
                 } else {
                     frameCount = minFrameCount;
@@ -779,7 +781,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);
@@ -799,12 +801,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 = track;
@@ -832,7 +834,7 @@
 status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, int32_t waitCount)
 {
     AutoMutex lock(mLock);
-    int active;
+    bool active;
     status_t result = NO_ERROR;
     audio_track_cblk_t* cblk = mCblk;
     uint32_t framesReq = audioBuffer->frameCount;
@@ -868,7 +870,7 @@
                 result = cblk->cv.waitRelative(cblk->lock, milliseconds(waitTimeMs));
                 cblk->lock.unlock();
                 mLock.lock();
-                if (mActive == 0) {
+                if (!mActive) {
                     return status_t(STOPPED);
                 }
                 cblk->lock.lock();
@@ -883,7 +885,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();
@@ -895,7 +897,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;
                         }
@@ -918,7 +920,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();
     }
 
@@ -964,7 +966,7 @@
 
     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;
     }
@@ -1035,10 +1037,11 @@
     sp <IAudioTrack> audioTrack = mAudioTrack;
     sp <IMemory> iMem = mCblkMemory;
     audio_track_cblk_t* cblk = mCblk;
+    bool active = mActive;
     mLock.unlock();
 
     // Manage underrun callback
-    if (mActive && (cblk->framesAvailable() == cblk->frameCount)) {
+    if (active && (cblk->framesAvailable() == cblk->frameCount)) {
         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);
@@ -1096,7 +1099,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;
@@ -1164,7 +1167,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
@@ -1220,7 +1223,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;
@@ -1228,7 +1231,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
@@ -1236,7 +1239,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) {
@@ -1245,7 +1248,7 @@
             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();
         }
@@ -1259,7 +1262,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;
 }
@@ -1328,7 +1331,7 @@
             bufferTimeoutMs = MAX_RUN_TIMEOUT_MS;
         }
     } else if (u > server) {
-        LOGW("stepServer occurred after track reset");
+        ALOGW("stepServer occurred after track reset");
         u = server;
     }
 
@@ -1349,7 +1352,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;
     }
 
@@ -1367,13 +1370,13 @@
         // stepServer() is called After the flush() has reset u & s and
         // we have s > u
         if (s > user) {
-            LOGW("stepServer occurred after track reset");
+            ALOGW("stepServer occurred after track reset");
             s = 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;
@@ -1428,7 +1431,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 bedf8d3..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) {
@@ -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();
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/IMediaDeathNotifier.cpp b/media/libmedia/IMediaDeathNotifier.cpp
index da33edb..8525482 100644
--- a/media/libmedia/IMediaDeathNotifier.cpp
+++ b/media/libmedia/IMediaDeathNotifier.cpp
@@ -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,7 +54,7 @@
     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;
 }
 
@@ -76,7 +76,7 @@
 
 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;
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 afa84b7..188e582 100644
--- a/media/libmedia/JetPlayer.cpp
+++ b/media/libmedia/JetPlayer.cpp
@@ -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;
     }
@@ -109,7 +109,7 @@
         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;
     }
@@ -169,7 +169,7 @@
     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;
     }
 
@@ -210,7 +210,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);
@@ -229,14 +229,14 @@
 
         // 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
         //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;
         }
 
@@ -469,7 +469,7 @@
 //-------------------------------------------------------------------------------------------------
 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)
@@ -479,7 +479,7 @@
                 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 109f294..c905762 100644
--- a/media/libmedia/MediaProfiles.cpp
+++ b/media/libmedia/MediaProfiles.cpp
@@ -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;
@@ -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,7 +976,7 @@
     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(
@@ -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,7 +1001,7 @@
     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
@@ -1009,7 +1009,7 @@
     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;
 }
 
@@ -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;
 }
 
@@ -1103,7 +1103,7 @@
 
     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;
 }
 
diff --git a/media/libmedia/MediaScanner.cpp b/media/libmedia/MediaScanner.cpp
index cda185f..79cab74 100644
--- a/media/libmedia/MediaScanner.cpp
+++ b/media/libmedia/MediaScanner.cpp
@@ -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;
     }
 
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 28b54b5..35dfbb8 100644
--- a/media/libmedia/ToneGenerator.cpp
+++ b/media/libmedia/ToneGenerator.cpp
@@ -805,7 +805,7 @@
     mState = TONE_IDLE;
 
     if (AudioSystem::getOutputSamplingRate(&mSamplingRate, streamType) != NO_ERROR) {
-        LOGE("Unable to marshal AudioFlinger");
+        ALOGE("Unable to marshal AudioFlinger");
         return;
     }
     mThreadCanCallJava = threadCanCallJava;
@@ -906,7 +906,7 @@
         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;
@@ -925,7 +925,7 @@
                 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;
                 }
@@ -943,14 +943,14 @@
             }
             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();
 
     ALOGV_IF(lResult, "Tone started, time %d\n", (unsigned int)(systemTime()/1000000));
-    LOGW_IF(!lResult, "Tone start failed!!!, time %d\n", (unsigned int)(systemTime()/1000000));
+    ALOGW_IF(!lResult, "Tone start failed!!!, time %d\n", (unsigned int)(systemTime()/1000000));
 
     return lResult;
 }
@@ -979,7 +979,7 @@
         if (lStatus == NO_ERROR) {
             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,7 +1018,7 @@
    // 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;
     }
     ALOGV("Create Track: %p\n", mpAudioTrack);
@@ -1036,7 +1036,7 @@
                       mThreadCanCallJava);
 
     if (mpAudioTrack->initCheck() != NO_ERROR) {
-        LOGE("AudioTrack->initCheck failed");
+        ALOGE("AudioTrack->initCheck failed");
         goto initAudioTrack_exit;
     }
 
@@ -1261,7 +1261,7 @@
                 // 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
diff --git a/media/libmedia/Visualizer.cpp b/media/libmedia/Visualizer.cpp
index de40f98..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,7 +116,7 @@
     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;
         }
     }
diff --git a/media/libmedia/mediametadataretriever.cpp b/media/libmedia/mediametadataretriever.cpp
index fd8c065..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,7 +52,7 @@
         binder->linkToDeath(sDeathNotifier);
         sService = interface_cast<IMediaPlayerService>(binder);
     }
-    LOGE_IF(sService == 0, "no MediaPlayerService!?");
+    ALOGE_IF(sService == 0, "no MediaPlayerService!?");
     return sService;
 }
 
@@ -61,12 +61,12 @@
     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;
 }
@@ -98,11 +98,11 @@
     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;
     }
     ALOGV("data source (%s)", srcUrl);
@@ -114,11 +114,11 @@
     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);
@@ -129,7 +129,7 @@
     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);
@@ -140,7 +140,7 @@
     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);
@@ -151,7 +151,7 @@
     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 695c4a8..2284927 100644
--- a/media/libmedia/mediaplayer.cpp
+++ b/media/libmedia/mediaplayer.cpp
@@ -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");
         }
     }
 
@@ -195,7 +195,7 @@
          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;
 }
 
@@ -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;
 }
 
@@ -298,7 +298,7 @@
         }
         return ret;
     }
-    LOGE("start called in state %d", mCurrentState);
+    ALOGE("start called in state %d", mCurrentState);
     return INVALID_OPERATION;
 }
 
@@ -317,7 +317,7 @@
         }
         return ret;
     }
-    LOGE("stop called in state %d", mCurrentState);
+    ALOGE("stop called in state %d", mCurrentState);
     return INVALID_OPERATION;
 }
 
@@ -336,7 +336,7 @@
         }
         return ret;
     }
-    LOGE("pause called in state %d", mCurrentState);
+    ALOGE("pause called in state %d", mCurrentState);
     return INVALID_OPERATION;
 }
 
@@ -348,7 +348,7 @@
         mPlayer->isPlaying(&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;
@@ -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;
 }
 
@@ -417,10 +417,10 @@
     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
@@ -435,7 +435,7 @@
             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;
@@ -486,7 +486,7 @@
     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
@@ -532,7 +532,7 @@
     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) {
@@ -570,7 +570,7 @@
     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;
     }
 
@@ -641,7 +641,7 @@
     case MEDIA_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,7 +651,7 @@
         // 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)
         {
@@ -666,7 +666,7 @@
         // 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:
@@ -717,7 +717,7 @@
     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;
 
@@ -737,7 +737,7 @@
     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 ec62978..8d947d8 100644
--- a/media/libmedia/mediarecorder.cpp
+++ b/media/libmedia/mediarecorder.cpp
@@ -33,11 +33,11 @@
 {
     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;
     }
 
@@ -54,15 +54,15 @@
 {
     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;
     }
 
@@ -79,11 +79,11 @@
 {
     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;
     }
 
@@ -109,11 +109,11 @@
 {
     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) {
@@ -124,7 +124,7 @@
         }
     }
     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;
     }
 
@@ -144,7 +144,7 @@
 {
     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) {
@@ -155,11 +155,11 @@
         }
     }
     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;
     }
 
@@ -177,21 +177,21 @@
 {
     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;
     }
@@ -203,19 +203,19 @@
 {
     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;
     }
 
@@ -233,19 +233,19 @@
 {
     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;
     }
 
@@ -263,15 +263,15 @@
 {
     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;
     }
 
@@ -289,15 +289,15 @@
 {
     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,7 +308,7 @@
     // 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;
     }
 
@@ -326,21 +326,21 @@
 {
     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;
 }
@@ -369,21 +369,21 @@
 {
     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;
     }
@@ -393,7 +393,7 @@
 status_t MediaRecorder::setParameters(const String8& params) {
     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.
@@ -421,34 +421,34 @@
 {
     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;
     }
@@ -460,17 +460,17 @@
 {
     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;
     }
@@ -481,17 +481,17 @@
 {
     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;
     }
@@ -503,17 +503,17 @@
 {
     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;
     }
@@ -531,7 +531,7 @@
 {
     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;
         }
     }
@@ -567,12 +567,12 @@
 {
     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 {
@@ -586,7 +586,7 @@
     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 {
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index 487c433..f5cb019e 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;
 }
 
@@ -630,7 +630,7 @@
             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;
 }
@@ -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
@@ -713,7 +713,7 @@
         if (mStatus == NO_ERROR) {
             mPlayer = p;
         } else {
-            LOGE("  error: %d", mStatus);
+            ALOGE("  error: %d", mStatus);
         }
         return mStatus;
     }
@@ -725,7 +725,7 @@
     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;
     }
 
@@ -736,7 +736,7 @@
     ALOGV("st_size = %llu", sb.st_size);
 
     if (offset >= sb.st_size) {
-        LOGE("offset error");
+        ALOGE("offset error");
         ::close(fd);
         return UNKNOWN_ERROR;
     }
@@ -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);
         }
     }
@@ -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;
     }
 
@@ -975,7 +975,7 @@
     if (ret == NO_ERROR) {
         ALOGV("[%d] getCurrentPosition = %d", mConnId, *msec);
     } else {
-        LOGE("getCurrentPosition returned %d", ret);
+        ALOGE("getCurrentPosition returned %d", ret);
     }
     return ret;
 }
@@ -989,7 +989,7 @@
     if (ret == NO_ERROR) {
         ALOGV("[%d] getDuration = %d", mConnId, *msec);
     } else {
-        LOGE("getDuration returned %d", ret);
+        ALOGE("getDuration returned %d", ret);
     }
     return ret;
 }
@@ -1394,7 +1394,7 @@
     }
 
     if ((t == 0) || (t->initCheck() != NO_ERROR)) {
-        LOGE("Unable to create audio track");
+        ALOGE("Unable to create audio track");
         delete t;
         return NO_INIT;
     }
@@ -1652,7 +1652,7 @@
     p += mSize;
     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);
@@ -1687,7 +1687,7 @@
     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:
@@ -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 ca92c77..d219fc2 100644
--- a/media/libmediaplayerservice/MediaRecorderClient.cpp
+++ b/media/libmediaplayerservice/MediaRecorderClient.cpp
@@ -54,7 +54,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;
 }
 
@@ -64,7 +64,7 @@
     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();
@@ -78,7 +78,7 @@
     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);
@@ -89,7 +89,7 @@
     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);
@@ -103,7 +103,7 @@
     }
     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);
@@ -117,7 +117,7 @@
     }
     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);
@@ -128,7 +128,7 @@
     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);
@@ -139,7 +139,7 @@
     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);
@@ -150,7 +150,7 @@
     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);
@@ -161,7 +161,7 @@
     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);
@@ -172,7 +172,7 @@
     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);
@@ -183,7 +183,7 @@
     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);
@@ -194,7 +194,7 @@
     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);
@@ -204,7 +204,7 @@
     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);
@@ -215,7 +215,7 @@
     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();
@@ -227,7 +227,7 @@
     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);
@@ -238,7 +238,7 @@
     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();
@@ -250,7 +250,7 @@
     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();
@@ -261,7 +261,7 @@
     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();
@@ -272,7 +272,7 @@
     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();
@@ -284,7 +284,7 @@
     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();
@@ -322,7 +322,7 @@
     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 f945c6a3..7dbb57f 100644
--- a/media/libmediaplayerservice/MetadataRetrieverClient.cpp
+++ b/media/libmediaplayerservice/MetadataRetrieverClient.cpp
@@ -98,11 +98,11 @@
         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;
 }
@@ -131,7 +131,7 @@
     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;
     }
     ALOGV("st_dev  = %llu", sb.st_dev);
@@ -141,7 +141,7 @@
     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;
     }
@@ -169,24 +169,24 @@
     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;
     }
@@ -210,24 +210,24 @@
     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;
     }
@@ -244,7 +244,7 @@
     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 4946956..7cb8c29 100644
--- a/media/libmediaplayerservice/MidiFile.cpp
+++ b/media/libmediaplayerservice/MidiFile.cpp
@@ -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;
     }
 
@@ -134,7 +134,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;
     }
@@ -162,7 +162,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;
     }
@@ -181,7 +181,7 @@
     }
     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();
@@ -237,7 +237,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;
         }
     }
@@ -258,7 +258,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);
@@ -293,11 +293,11 @@
 {
     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;
@@ -422,7 +422,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;
@@ -439,7 +439,7 @@
     // 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;
     }
 
@@ -473,7 +473,7 @@
         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);
@@ -495,7 +495,7 @@
         // Write data to the audio hardware
         // 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;
         }
 
@@ -519,7 +519,7 @@
             }
             case EAS_STATE_ERROR:
             {
-                LOGE("MidiFile::render - error");
+                ALOGE("MidiFile::render - error");
                 sendEvent(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN);
                 break;
             }
diff --git a/media/libmediaplayerservice/MidiMetadataRetriever.cpp b/media/libmediaplayerservice/MidiMetadataRetriever.cpp
index bb65ed4..465209f 100644
--- a/media/libmediaplayerservice/MidiMetadataRetriever.cpp
+++ b/media/libmediaplayerservice/MidiMetadataRetriever.cpp
@@ -63,7 +63,7 @@
     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,7 +72,7 @@
             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);
@@ -82,7 +82,7 @@
             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/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index 2be0ae2..4632016 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -97,7 +97,7 @@
     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;
     }
 
@@ -114,7 +114,7 @@
     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;
     }
 
@@ -131,7 +131,7 @@
     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;
     }
 
@@ -148,7 +148,7 @@
     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;
     }
 
@@ -165,7 +165,7 @@
     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;
     }
 
@@ -181,7 +181,7 @@
 status_t StagefrightRecorder::setVideoSize(int width, int 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;
     }
 
@@ -196,7 +196,7 @@
     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;
     }
 
@@ -210,11 +210,11 @@
                                         const sp<ICameraRecordingProxy> &proxy) {
     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;
     }
 
@@ -231,7 +231,7 @@
 }
 
 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.
 
@@ -245,7 +245,7 @@
     CHECK_EQ(length, 0);
 
     if (fd < 0) {
-        LOGE("Invalid file descriptor: %d", fd);
+        ALOGE("Invalid file descriptor: %d", fd);
         return -EBADF;
     }
 
@@ -315,7 +315,7 @@
 status_t StagefrightRecorder::setParamAudioSamplingRate(int32_t 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;
     }
 
@@ -327,7 +327,7 @@
 status_t StagefrightRecorder::setParamAudioNumberOfChannels(int32_t 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;
     }
 
@@ -339,7 +339,7 @@
 status_t StagefrightRecorder::setParamAudioEncodingBitRate(int32_t 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;
     }
 
@@ -354,7 +354,7 @@
 status_t StagefrightRecorder::setParamVideoEncodingBitRate(int32_t 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;
     }
 
@@ -370,7 +370,7 @@
 status_t StagefrightRecorder::setParamVideoRotation(int32_t 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;
@@ -382,15 +382,15 @@
 
     // 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;
@@ -401,16 +401,16 @@
 
     // 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;
@@ -423,13 +423,13 @@
         // 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;
@@ -464,7 +464,7 @@
 status_t StagefrightRecorder::setParamTrackTimeStatus(int64_t 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;
@@ -495,7 +495,7 @@
     // 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;
@@ -508,7 +508,7 @@
     // 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;
@@ -520,7 +520,7 @@
 
     // 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;
@@ -545,7 +545,7 @@
 
     // 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;
     }
 
@@ -683,7 +683,7 @@
                     1000LL * timeBetweenTimeLapseFrameCaptureMs);
         }
     } else {
-        LOGE("setParameter: failed to find key %s", key.string());
+        ALOGE("setParameter: failed to find key %s", key.string());
     }
     return BAD_VALUE;
 }
@@ -695,13 +695,13 @@
     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;
     }
 
@@ -1022,11 +1022,11 @@
     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;
     }
@@ -1039,11 +1039,11 @@
     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;
     }
@@ -1056,11 +1056,11 @@
     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;
     }
@@ -1151,7 +1151,7 @@
             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,7 +1160,7 @@
             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;
     }
@@ -1173,7 +1173,7 @@
             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,7 +1182,7 @@
             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;
     }
@@ -1195,7 +1195,7 @@
             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,7 +1204,7 @@
             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;
     }
@@ -1217,11 +1217,11 @@
     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;
     }
@@ -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;
     }
 
@@ -1667,7 +1667,7 @@
     ALOGV("getMaxAmplitude");
 
     if (max == NULL) {
-        LOGE("Null pointer argument");
+        ALOGE("Null pointer argument");
         return BAD_VALUE;
     }
 
diff --git a/media/libmediaplayerservice/TestPlayerStub.cpp b/media/libmediaplayerservice/TestPlayerStub.cpp
index 169e49a..0f0ff65 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;
     }
diff --git a/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp b/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp
index 1612df0..22b8847 100644
--- a/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp
@@ -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 9ef9237..b731d0f 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -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);
@@ -417,7 +417,7 @@
                 if (finalResult == ERROR_END_OF_STREAM) {
                     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(
diff --git a/media/libmediaplayerservice/nuplayer/StreamingSource.cpp b/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
index c997942..7c9bc5e 100644
--- a/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
@@ -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 03fb33b..1673ccd 100644
--- a/media/libstagefright/AACWriter.cpp
+++ b/media/libstagefright/AACWriter.cpp
@@ -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;
     }
 
@@ -216,7 +216,7 @@
         }
     }
 
-    LOGE("Sampling rate %d bps is not supported", sampleRate);
+    ALOGE("Sampling rate %d bps is not supported", sampleRate);
     return false;
 }
 
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index ebf5fab..ca44ea3 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -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,7 +499,7 @@
             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;
     }
@@ -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,7 +528,7 @@
         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;
         }
@@ -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);
         }
     }
@@ -1367,7 +1367,7 @@
         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);
 
@@ -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;
@@ -1874,7 +1874,7 @@
 
     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);
 
@@ -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);
 
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/AVIExtractor.cpp b/media/libstagefright/AVIExtractor.cpp
index 142fa5b..a3187b7 100644
--- a/media/libstagefright/AVIExtractor.cpp
+++ b/media/libstagefright/AVIExtractor.cpp
@@ -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]);
@@ -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/AudioSource.cpp b/media/libstagefright/AudioSource.cpp
index 3fae957..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:
@@ -259,7 +259,7 @@
     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;
     }
 
@@ -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;
         }
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 6fce890..7a2d7b3 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;
         }
@@ -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;
     }
 
@@ -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;
         }
     }
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp
index 966b457..1850c9c 100755
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -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");
@@ -301,7 +301,7 @@
     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.
@@ -330,7 +330,7 @@
         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;
         }
@@ -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;
@@ -425,14 +425,14 @@
     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;
     }
@@ -489,7 +489,7 @@
     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());
@@ -579,7 +579,7 @@
     ALOGV("start");
     CHECK(!mStarted);
     if (mInitCheck != OK) {
-        LOGE("CameraSource is not initialized yet");
+        ALOGE("CameraSource is not initialized yet");
         return mInitCheck;
     }
 
@@ -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());
         }
     }
@@ -666,7 +666,7 @@
     }
 
     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);
@@ -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);
             }
         }
diff --git a/media/libstagefright/CameraSourceTimeLapse.cpp b/media/libstagefright/CameraSourceTimeLapse.cpp
index 8bf18b2..263ab50 100644
--- a/media/libstagefright/CameraSourceTimeLapse.cpp
+++ b/media/libstagefright/CameraSourceTimeLapse.cpp
@@ -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;
         }
     }
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 1b225fa..4a0c35c 100644
--- a/media/libstagefright/ESDS.cpp
+++ b/media/libstagefright/ESDS.cpp
@@ -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 a0c08e2..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;
 }
 
@@ -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,13 +603,13 @@
     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;
         }
         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;
         }
     }
@@ -620,13 +620,13 @@
     // 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);
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 5950b37..d7eea3f 100644
--- a/media/libstagefright/HTTPBase.cpp
+++ b/media/libstagefright/HTTPBase.cpp
@@ -111,7 +111,7 @@
     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;
     }
 
@@ -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 cb82deb..2215c07 100644
--- a/media/libstagefright/MP3Extractor.cpp
+++ b/media/libstagefright/MP3Extractor.cpp
@@ -487,7 +487,7 @@
 
         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/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index 26b8a42..bc88015 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -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;
             }
 
@@ -1519,7 +1519,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;
     }
 
@@ -1751,7 +1751,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;
     }
 
@@ -2123,7 +2123,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;
@@ -2187,7 +2187,7 @@
                 }
 
                 if (isMalFormed) {
-                    LOGE("Video is malformed");
+                    ALOGE("Video is malformed");
                     mBuffer->release();
                     mBuffer = NULL;
                     return ERROR_MALFORMED;
@@ -2422,7 +2422,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 b808cc0..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());
@@ -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;
@@ -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);
@@ -1525,7 +1525,7 @@
 status_t MPEG4Writer::Track::stop() {
     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;
     }
 
@@ -1596,14 +1596,14 @@
     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;
             }
         }
@@ -1632,7 +1632,7 @@
     // 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;
     }
 
@@ -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;
     }
 
@@ -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;
     }
 
@@ -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;
         }
     }
@@ -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.");
     }
 
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/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp
index 6e5f8ab..249c298 100644
--- a/media/libstagefright/NuCachedSource2.cpp
+++ b/media/libstagefright/NuCachedSource2.cpp
@@ -317,7 +317,7 @@
     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) {
@@ -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;
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 2dc19fd..60d9bb7 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -181,7 +181,7 @@
 
 #define CODEC_LOGI(x, ...) ALOGI("[%s] "x, mComponentName, ##__VA_ARGS__)
 #define CODEC_LOGV(x, ...) ALOGV("[%s] "x, mComponentName, ##__VA_ARGS__)
-#define CODEC_LOGE(x, ...) LOGE("[%s] "x, mComponentName, ##__VA_ARGS__)
+#define CODEC_LOGE(x, ...) ALOGE("[%s] "x, mComponentName, ##__VA_ARGS__)
 
 struct OMXCodecObserver : public BnOMXObserver {
     OMXCodecObserver() {
@@ -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);
 
@@ -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)) {
@@ -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,11 +1881,11 @@
                 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;
         }
     }
@@ -1894,7 +1894,7 @@
     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);
             }
 
@@ -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 ////////////////////
diff --git a/media/libstagefright/OggExtractor.cpp b/media/libstagefright/OggExtractor.cpp
index b7a9fafe..73efc27 100644
--- a/media/libstagefright/OggExtractor.cpp
+++ b/media/libstagefright/OggExtractor.cpp
@@ -899,7 +899,7 @@
     uint8_t *flac = DecodeBase64((const char *)data, size, &flacSize);
 
     if (flac == NULL) {
-        LOGE("malformed base64 encoded data.");
+        ALOGE("malformed base64 encoded data.");
         return;
     }
 
diff --git a/media/libstagefright/SampleIterator.cpp b/media/libstagefright/SampleIterator.cpp
index 7b8e008..81ec5c1 100644
--- a/media/libstagefright/SampleIterator.cpp
+++ b/media/libstagefright/SampleIterator.cpp
@@ -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 305c9bb..d9858d76 100644
--- a/media/libstagefright/SampleTable.cpp
+++ b/media/libstagefright/SampleTable.cpp
@@ -634,7 +634,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;
         }
         left = left - 1;
diff --git a/media/libstagefright/StagefrightMediaScanner.cpp b/media/libstagefright/StagefrightMediaScanner.cpp
index 4345184..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;
diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp
index 2634da0..43bfd9e 100644
--- a/media/libstagefright/StagefrightMetadataRetriever.cpp
+++ b/media/libstagefright/StagefrightMetadataRetriever.cpp
@@ -127,7 +127,7 @@
 
     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;
     }
 
@@ -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;
@@ -292,7 +292,7 @@
 
     int32_t drm = 0;
     if (fileMeta->findInt32(kKeyIsDRM, &drm) && drm != 0) {
-        LOGE("frame grab not allowed.");
+        ALOGE("frame grab not allowed.");
         return NULL;
     }
 
diff --git a/media/libstagefright/SurfaceMediaSource.cpp b/media/libstagefright/SurfaceMediaSource.cpp
index 2f807d0..2233d1b 100644
--- a/media/libstagefright/SurfaceMediaSource.cpp
+++ b/media/libstagefright/SurfaceMediaSource.cpp
@@ -112,7 +112,7 @@
 status_t SurfaceMediaSource::setBufferCount(int bufferCount) {
     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;
     }
 
@@ -120,7 +120,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;
         }
     }
@@ -155,7 +155,7 @@
     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;
     }
@@ -183,7 +183,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;
         }
@@ -284,7 +284,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;
@@ -346,7 +346,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) {
@@ -363,13 +363,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;
     }
 
@@ -390,7 +390,7 @@
     Mutex::Autolock lock(mMutex);
 
     if (mStopped) {
-        LOGE("Connect: SurfaceMediaSource has been stopped!");
+        ALOGE("Connect: SurfaceMediaSource has been stopped!");
         return NO_INIT;
     }
 
@@ -431,7 +431,7 @@
     Mutex::Autolock lock(mMutex);
 
     if (mStopped) {
-        LOGE("disconnect: SurfaceMediaSoource is already stopped!");
+        ALOGE("disconnect: SurfaceMediaSoource is already stopped!");
         return NO_INIT;
     }
 
@@ -467,15 +467,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;
     }
@@ -561,11 +561,11 @@
     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;
     }
@@ -814,7 +814,7 @@
         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;
diff --git a/media/libstagefright/TimedEventQueue.cpp b/media/libstagefright/TimedEventQueue.cpp
index 43511ec..12c9c36 100644
--- a/media/libstagefright/TimedEventQueue.cpp
+++ b/media/libstagefright/TimedEventQueue.cpp
@@ -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/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/codecs/aacdec/SoftAAC.cpp b/media/libstagefright/codecs/aacdec/SoftAAC.cpp
index c408b2c..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;
     }
 
@@ -326,7 +326,7 @@
                 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 2b15b75..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,7 +106,7 @@
         }
     }
 
-    LOGE("Sampling rate %d bps is not supported", sampleRate);
+    ALOGE("Sampling rate %d bps is not supported", sampleRate);
     return UNKNOWN_ERROR;
 }
 
@@ -117,7 +117,7 @@
     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/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/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/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/avc/enc/AVCEncoder.cpp b/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp
index 37df634..e202a2b 100644
--- a/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp
+++ b/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp
@@ -41,7 +41,7 @@
             *pvProfile = AVC_BASELINE;
             return OK;
         default:
-            LOGE("Unsupported omx profile: %d", omxProfile);
+            ALOGE("Unsupported omx profile: %d", omxProfile);
     }
     return BAD_VALUE;
 }
@@ -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;
@@ -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;
     }
@@ -336,14 +336,14 @@
     }
 
     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;
     }
 
@@ -368,7 +368,7 @@
 status_t AVCEncoder::stop() {
     ALOGV("stop");
     if (!mStarted) {
-        LOGW("Call stop() when encoder has not started");
+        ALOGW("Call stop() when encoder has not started");
         return OK;
     }
 
@@ -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;
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 bedfc58..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;
diff --git a/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp b/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp
index 1188780..d538603 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp
+++ b/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp
@@ -43,16 +43,16 @@
         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;
         }
     }
@@ -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;
     }
 
@@ -314,12 +314,12 @@
     }
 
     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;
     }
 
@@ -341,7 +341,7 @@
 status_t M4vH263Encoder::stop() {
     ALOGV("stop");
     if (!mStarted) {
-        LOGW("Call stop() when encoder has not started");
+        ALOGW("Call stop() when encoder has not started");
         return OK;
     }
 
@@ -386,7 +386,7 @@
     // 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;
         }
         ALOGV("Output VOL header: %d bytes", dataLength);
@@ -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 43fb30a..ad55295 100644
--- a/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
+++ b/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
@@ -223,10 +223,10 @@
 
             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 c5fe199..bf9ab3a 100644
--- a/media/libstagefright/codecs/on2/dec/SoftVPX.cpp
+++ b/media/libstagefright/codecs/on2/dec/SoftVPX.cpp
@@ -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 47dbd5c..ac88107 100644
--- a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
+++ b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
@@ -353,14 +353,14 @@
 
         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;
             }
         }
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..0a6776ef 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/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 ee76bcdb..0cddd2e7 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -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;
@@ -360,7 +360,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;
     }
@@ -531,7 +531,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;
             }
@@ -659,7 +659,7 @@
 
             // 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);
@@ -693,7 +693,7 @@
     sp<ABuffer> buffer;
     status_t err = fetchFile(uri.c_str(), &buffer, range_offset, range_length);
     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;
     }
@@ -703,7 +703,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;
@@ -712,7 +712,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);
 
@@ -796,13 +796,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;
     }
 
@@ -844,7 +844,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;
         }
 
@@ -853,7 +853,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;
     }
 
@@ -863,7 +863,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;
         }
 
@@ -872,7 +872,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 f7bbc3e..7d3cf05 100644
--- a/media/libstagefright/httplive/M3UParser.cpp
+++ b/media/libstagefright/httplive/M3UParser.cpp
@@ -451,7 +451,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 943a937..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;
     }
 
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp
index f215f52..4fbf47e 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.cpp
+++ b/media/libstagefright/matroska/MatroskaExtractor.cpp
@@ -245,7 +245,7 @@
             if (res < 0) {
                 // I/O error
 
-                LOGE("Cluster::Parse returned result %ld", res);
+                ALOGE("Cluster::Parse returned result %ld", res);
 
                 mCluster = NULL;
                 break;
diff --git a/media/libstagefright/mpeg2ts/ATSParser.cpp b/media/libstagefright/mpeg2ts/ATSParser.cpp
index 576693a..3f4de1f 100644
--- a/media/libstagefright/mpeg2ts/ATSParser.cpp
+++ b/media/libstagefright/mpeg2ts/ATSParser.cpp
@@ -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);
 
diff --git a/media/libstagefright/mpeg2ts/ESQueue.cpp b/media/libstagefright/mpeg2ts/ESQueue.cpp
index 05c87fd..7fd99a8 100644
--- a/media/libstagefright/mpeg2ts/ESQueue.cpp
+++ b/media/libstagefright/mpeg2ts/ESQueue.cpp
@@ -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;
diff --git a/media/libstagefright/mpeg2ts/MPEG2PSExtractor.cpp b/media/libstagefright/mpeg2ts/MPEG2PSExtractor.cpp
index 727c931..dd714c9 100644
--- a/media/libstagefright/mpeg2ts/MPEG2PSExtractor.cpp
+++ b/media/libstagefright/mpeg2ts/MPEG2PSExtractor.cpp
@@ -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);
 
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 802c429..8938e33 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -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;
                 }
@@ -179,7 +179,7 @@
                    && 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;
                 }
@@ -209,7 +209,7 @@
     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);
@@ -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/SoftOMXPlugin.cpp b/media/libstagefright/omx/SoftOMXPlugin.cpp
index 8aeb763..da3ae42 100644
--- a/media/libstagefright/omx/SoftOMXPlugin.cpp
+++ b/media/libstagefright/omx/SoftOMXPlugin.cpp
@@ -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 3a15a5e..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) \
diff --git a/media/libstagefright/rtsp/ARTPConnection.cpp b/media/libstagefright/rtsp/ARTPConnection.cpp
index 853ea14..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;
             }
@@ -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);
@@ -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;
             }
diff --git a/media/libstagefright/rtsp/ARTPSession.cpp b/media/libstagefright/rtsp/ARTPSession.cpp
index 5783beb..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;
         }
 
diff --git a/media/libstagefright/rtsp/ARTPSource.cpp b/media/libstagefright/rtsp/ARTPSource.cpp
index dc5f17e..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;
     }
 
@@ -212,7 +212,7 @@
 
 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/ARTSPConnection.cpp b/media/libstagefright/rtsp/ARTSPConnection.cpp
index 12cca13..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();
@@ -250,7 +250,7 @@
 
     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);
 
@@ -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;
@@ -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/MyHandler.h b/media/libstagefright/rtsp/MyHandler.h
index 53691d1..2391c5c 100644
--- a/media/libstagefright/rtsp/MyHandler.h
+++ b/media/libstagefright/rtsp/MyHandler.h
@@ -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;
@@ -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,7 +338,7 @@
                 (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;
         }
 
@@ -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 {
@@ -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);
 
@@ -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);
@@ -988,7 +988,7 @@
                 }
 
                 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();
                     }
                 }
@@ -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);
diff --git a/media/libstagefright/rtsp/UDPPusher.cpp b/media/libstagefright/rtsp/UDPPusher.cpp
index 6a4c87b..47ea6f1 100644
--- a/media/libstagefright/rtsp/UDPPusher.cpp
+++ b/media/libstagefright/rtsp/UDPPusher.cpp
@@ -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;
     }
 
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 fbb606d..ac37b28 100644
--- a/media/libstagefright/tests/DummyRecorder.cpp
+++ b/media/libstagefright/tests/DummyRecorder.cpp
@@ -47,7 +47,7 @@
     pthread_attr_destroy(&attr);
 
     if (err) {
-        LOGE("Error creating thread!");
+        ALOGE("Error creating thread!");
         return -ENODEV;
     }
     return OK;
diff --git a/media/libstagefright/tests/SurfaceMediaSource_test.cpp b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
index 6be5e9a..76b507f 100644
--- a/media/libstagefright/tests/SurfaceMediaSource_test.cpp
+++ b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
@@ -731,7 +731,7 @@
     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);
 
@@ -861,7 +861,7 @@
     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);
 
@@ -904,7 +904,7 @@
     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);
 
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/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 2fc6ba8..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;
     }
 
@@ -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;
 }
 
@@ -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);
@@ -669,7 +669,7 @@
     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);
diff --git a/media/mtp/MtpPacket.cpp b/media/mtp/MtpPacket.cpp
index 39815d4..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;
@@ -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 d06f214..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;
         }
     }
@@ -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 838c13e..56061872 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -179,7 +179,7 @@
         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;
@@ -200,7 +200,7 @@
                 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;
@@ -214,7 +214,7 @@
             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;
@@ -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;
     }
@@ -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;
     }
@@ -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));
     }
 }
 
@@ -1098,7 +1098,7 @@
 
     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;
     }
 
@@ -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/tests/omxjpegdecoder/omx_jpeg_decoder.cpp b/media/tests/omxjpegdecoder/omx_jpeg_decoder.cpp
index 2735a55..42df66c 100644
--- a/media/tests/omxjpegdecoder/omx_jpeg_decoder.cpp
+++ b/media/tests/omxjpegdecoder/omx_jpeg_decoder.cpp
@@ -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/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 5e05045..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;
         }
 
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/egl.cpp b/opengl/libagl/egl.cpp
index 9ceb5e9..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; 
 }
 
@@ -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/mipmap.cpp b/opengl/libagl/mipmap.cpp
index ccd77b7..e142a58d 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 561862b..2fc6125 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -278,7 +278,7 @@
     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;
     }
 
@@ -287,7 +287,7 @@
     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 da1b397..e053589 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -141,7 +141,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");
@@ -287,7 +287,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 fb61397..664f258 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -352,7 +352,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);
         }
@@ -363,7 +363,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);
@@ -674,7 +674,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;
@@ -886,7 +886,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 ad5bdfc..53eaf9a 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -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 6946ecd..41cfae1 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/GLES2_dbg/src/dbgcontext.cpp b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
index e525d02..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...
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/libs/GLES_trace/src/gltrace_eglapi.cpp b/opengl/libs/GLES_trace/src/gltrace_eglapi.cpp
index 0fe97ce..c237d75 100644
--- a/opengl/libs/GLES_trace/src/gltrace_eglapi.cpp
+++ b/opengl/libs/GLES_trace/src/gltrace_eglapi.cpp
@@ -84,7 +84,7 @@
 
     int clientSocket = gltrace::acceptClientConnection(port);
     if (clientSocket < 0) {
-        LOGE("Error creating GLTrace server socket. Quitting application.");
+        ALOGE("Error creating GLTrace server socket. Quitting application.");
         exit(-1);
     }
 
diff --git a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp
index 5a439e3..5220aa4 100644
--- a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp
+++ b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp
@@ -51,7 +51,7 @@
     case GL_UNSIGNED_BYTE:
         break;
     default:
-        LOGE("GetBytesPerPixel: unknown type %x", type);
+        ALOGE("GetBytesPerPixel: unknown type %x", type);
     }
 
     switch (format) {
@@ -66,7 +66,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...
@@ -139,7 +139,7 @@
     if (data != NULL) {
         arg_data->add_rawbytes(data, bytesPerTexel * width * height);
     } else {
-        LOGE("fixup_glTexImage2D: image data is NULL.\n");
+        ALOGE("fixup_glTexImage2D: image data is NULL.\n");
         arg_data->set_type(GLMessage::DataType::VOID);
         // FIXME:
         // This will create the texture, but it will be uninitialized. 
diff --git a/opengl/libs/GLES_trace/src/gltrace_transport.cpp b/opengl/libs/GLES_trace/src/gltrace_transport.cpp
index 7758e48..ce3fae5 100644
--- a/opengl/libs/GLES_trace/src/gltrace_transport.cpp
+++ b/opengl/libs/GLES_trace/src/gltrace_transport.cpp
@@ -31,7 +31,7 @@
 int acceptClientConnection(int serverPort) {
     int serverSocket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
     if (serverSocket < 0) {
-        LOGE("Error (%d) while creating socket. Check if app has network permissions.",
+        ALOGE("Error (%d) while creating socket. Check if app has network permissions.",
                                                                             serverSocket);
         return -1;
     }
@@ -45,13 +45,13 @@
     socklen_t sockaddr_len = sizeof(sockaddr_in);
     if (bind(serverSocket, (struct sockaddr *) &server, sizeof(server)) < 0) {
         close(serverSocket);
-        LOGE("Failed to bind the server socket");
+        ALOGE("Failed to bind the server socket");
         return -1;
     }
 
     if (listen(serverSocket, 1) < 0) {
         close(serverSocket);
-        LOGE("Failed to listen on server socket");
+        ALOGE("Failed to listen on server socket");
         return -1;
     }
 
@@ -60,7 +60,7 @@
     int clientSocket = accept(serverSocket, (struct sockaddr *)&client, &sockaddr_len);
     if (clientSocket < 0) {
         close(serverSocket);
-        LOGE("Failed to accept client connection");
+        ALOGE("Failed to accept client connection");
         return -1;
     }
 
diff --git a/opengl/tests/gl2_jni/jni/gl_code.cpp b/opengl/tests/gl2_jni/jni/gl_code.cpp
index f7e7f8d..fa6bd93 100644
--- a/opengl/tests/gl2_jni/jni/gl_code.cpp
+++ b/opengl/tests/gl2_jni/jni/gl_code.cpp
@@ -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);
                 }
             }
@@ -110,7 +110,7 @@
     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");
diff --git a/opengl/tests/gl_perf/fill_common.cpp b/opengl/tests/gl_perf/fill_common.cpp
index 2a425f7a..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);
                 }
             }
diff --git a/opengl/tests/gl_perfapp/jni/gl_code.cpp b/opengl/tests/gl_perfapp/jni/gl_code.cpp
index c8e4ad5..2f04183 100644
--- a/opengl/tests/gl_perfapp/jni/gl_code.cpp
+++ b/opengl/tests/gl_perfapp/jni/gl_code.cpp
@@ -81,7 +81,7 @@
             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);
             }
 
             ALOGI("\nvarColor, texCount, modulate, extraMath, texSize, blend, Mpps, DC60\n");
diff --git a/opengl/tests/gldual/jni/gl_code.cpp b/opengl/tests/gldual/jni/gl_code.cpp
index 7ba0571..22867ed 100644
--- a/opengl/tests/gldual/jni/gl_code.cpp
+++ b/opengl/tests/gldual/jni/gl_code.cpp
@@ -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);
                 }
             }
@@ -110,7 +110,7 @@
     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");
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
index 2232995..c4a92f7 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
@@ -358,7 +358,15 @@
             dims[0] = Math.abs(dims[0]);
             dims[1] = Math.abs(dims[1]);
         }
+
+        // Take the screenshot
         mScreenBitmap = Surface.screenshot((int) dims[0], (int) dims[1]);
+        if (mScreenBitmap == null) {
+            notifyScreenshotError(mContext, mNotificationManager);
+            finisher.run();
+            return;
+        }
+
         if (requiresRotation) {
             // Rotate the screenshot to the current orientation
             Bitmap ss = Bitmap.createBitmap(mDisplayMetrics.widthPixels,
@@ -372,13 +380,6 @@
             mScreenBitmap = ss;
         }
 
-        // If we couldn't take the screenshot, notify the user
-        if (mScreenBitmap == null) {
-            notifyScreenshotError(mContext, mNotificationManager);
-            finisher.run();
-            return;
-        }
-
         // Optimizations
         mScreenBitmap.setHasAlpha(false);
         mScreenBitmap.prepareToDraw();
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index b514689..52d6d24 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -350,6 +350,12 @@
             mScreenOn = false;
             if (DEBUG) Log.d(TAG, "onScreenTurnedOff(" + why + ")");
 
+            // Lock immediately based on setting if secure (user has a pin/pattern/password).
+            // This also "locks" the device when not secure to provide easy access to the
+            // camera while preventing unwanted input.
+            final boolean lockImmediately =
+                mLockPatternUtils.getPowerButtonInstantlyLocks() || !mLockPatternUtils.isSecure();
+
             if (mExitSecureCallback != null) {
                 if (DEBUG) Log.d(TAG, "pending exit secure callback cancelled");
                 mExitSecureCallback.onKeyguardExitResult(false);
@@ -360,8 +366,10 @@
             } else if (mShowing) {
                 notifyScreenOffLocked();
                 resetStateLocked();
-            } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT) {
-                // if the screen turned off because of timeout, set an alarm
+            } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT
+                   || (why == WindowManagerPolicy.OFF_BECAUSE_OF_USER && !lockImmediately)) {
+                // if the screen turned off because of timeout or the user hit the power button
+                // and we don't need to lock immediately, set an alarm
                 // to enable it a little bit later (i.e, give the user a chance
                 // to turn the screen back on within a certain window without
                 // having to unlock the screen)
@@ -400,8 +408,7 @@
                     intent.putExtra("seq", mDelayedShowingSequence);
                     PendingIntent sender = PendingIntent.getBroadcast(mContext,
                             0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
-                    mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, when,
-                            sender);
+                    mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, when, sender);
                     if (DEBUG) Log.d(TAG, "setting alarm to turn off keyguard, seq = "
                                      + mDelayedShowingSequence);
                 }
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index ab94bb8..72525cd 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -40,6 +40,7 @@
 #include <media/AudioTrack.h>
 #include <media/AudioRecord.h>
 #include <media/IMediaPlayerService.h>
+#include <media/IMediaDeathNotifier.h>
 
 #include <private/media/AudioTrackShared.h>
 #include <private/media/AudioEffectShared.h>
@@ -105,24 +106,22 @@
 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;
 }
 
 // To collect the amplifier usage
 static void addBatteryData(uint32_t params) {
-    sp<IBinder> binder =
-        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");
+    sp<IMediaPlayerService> service = IMediaDeathNotifier::getMediaPlayerService();
+    if (service == NULL) {
+        // it already logged
         return;
     }
 
@@ -139,7 +138,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;
@@ -199,7 +198,7 @@
     mHardwareStatus = AUDIO_HW_INIT;
 
     if (!mPrimaryHardwareDev || mAudioHwDevs.size() == 0) {
-        LOGE("Primary audio interface not found");
+        ALOGE("Primary audio interface not found");
         return;
     }
 
@@ -400,7 +399,7 @@
     int lSessionId;
 
     if (streamType >= AUDIO_STREAM_CNT) {
-        LOGE("createTrack() invalid stream type %d", streamType);
+        ALOGE("createTrack() invalid stream type %d", streamType);
         lStatus = BAD_VALUE;
         goto Exit;
     }
@@ -410,7 +409,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;
         }
@@ -432,7 +431,7 @@
                     // prevent same audio session on different output threads
                     uint32_t sessions = t->hasAudioSession(*sessionId);
                     if (sessions & PlaybackThread::TRACK_SESSION) {
-                        LOGE("createTrack() session ID %d already in use", *sessionId);
+                        ALOGE("createTrack() session ID %d already in use", *sessionId);
                         lStatus = BAD_VALUE;
                         goto Exit;
                     }
@@ -484,7 +483,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();
@@ -495,7 +494,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();
@@ -506,7 +505,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();
@@ -517,7 +516,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();
@@ -528,7 +527,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();
@@ -576,7 +575,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;
     }
 
@@ -663,7 +662,7 @@
     }
 
     if (stream < 0 || uint32_t(stream) >= AUDIO_STREAM_CNT) {
-        LOGE("setStreamVolume() invalid stream %d", stream);
+        ALOGE("setStreamVolume() invalid stream %d", stream);
         return BAD_VALUE;
     }
 
@@ -698,7 +697,7 @@
 
     if (stream < 0 || uint32_t(stream) >= AUDIO_STREAM_CNT ||
         uint32_t(stream) == AUDIO_STREAM_ENFORCED_AUDIBLE) {
-        LOGE("setStreamMute() invalid stream %d", stream);
+        ALOGE("setStreamMute() invalid stream %d", stream);
         return BAD_VALUE;
     }
 
@@ -1180,7 +1179,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);
@@ -1228,7 +1227,7 @@
     if (thread != 0) {
         thread->clearPowerManager();
     }
-    LOGW("power manager service died !!!");
+    ALOGW("power manager service died !!!");
 }
 
 void AudioFlinger::ThreadBase::setEffectSuspended(
@@ -1471,7 +1470,7 @@
     if (status == NO_ERROR) {
         ALOGI("AudioFlinger's thread %p ready to run", this);
     } else {
-        LOGE("No working audio driver found.");
+        ALOGE("No working audio driver found.");
     }
     return status;
 }
@@ -1499,7 +1498,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;
@@ -1509,7 +1508,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;
         }
@@ -1517,7 +1516,7 @@
 
     lStatus = initCheck();
     if (lStatus != NO_ERROR) {
-        LOGE("Audio driver not initialized.");
+        ALOGE("Audio driver not initialized.");
         goto Exit;
     }
 
@@ -1534,7 +1533,7 @@
             if (t != 0) {
                 uint32_t actual = AudioSystem::getStrategyForStream((audio_stream_type_t)t->type());
                 if (sessionId == t->sessionId() && strategy != actual) {
-                    LOGE("createTrack_l() mismatched strategy; expected %u but found %u",
+                    ALOGE("createTrack_l() mismatched strategy; expected %u but found %u",
                             strategy, actual);
                     lStatus = BAD_VALUE;
                     goto Exit;
@@ -1561,7 +1560,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);
         }
@@ -1847,7 +1846,7 @@
 
     // FIXME - Current mixer implementation only supports stereo output
     if (mChannelCount == 1) {
-        LOGE("Invalid audio hardware channel count");
+        ALOGE("Invalid audio hardware channel count");
     }
 }
 
@@ -2038,7 +2037,7 @@
             if (!mStandby && delta > maxPeriod) {
                 mNumDelayedWrites++;
                 if ((now - lastWarning) > kWarningThrottleNs) {
-                    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;
                 }
@@ -2147,7 +2146,7 @@
                 if (chain != 0) {
                     tracksWithEffect++;
                 } else {
-                    LOGW("prepareTracks_l(): track %d attached to effect but no chain found on session %d",
+                    ALOGW("prepareTracks_l(): track %d attached to effect but no chain found on session %d",
                             name, track->sessionId());
                 }
             }
@@ -3164,7 +3163,7 @@
     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();
@@ -3238,7 +3237,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;
         }
@@ -3332,7 +3331,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);
@@ -3368,7 +3367,7 @@
         }
         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;
@@ -3795,7 +3794,7 @@
                 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);
     }
 }
 
@@ -3850,7 +3849,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);
                 }
             }
         }
@@ -3917,7 +3916,7 @@
                 mBufferQueue.add(pInBuffer);
                 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);
             }
         }
     }
@@ -4260,7 +4259,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;
 }
 
@@ -4380,7 +4379,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
@@ -4426,7 +4425,7 @@
                 if (!mActiveTrack->setOverflow()) {
                     nsecs_t now = systemTime();
                     if ((now - lastWarning) > kWarningThrottleNs) {
-                        LOGW("RecordThread: buffer overflow");
+                        ALOGW("RecordThread: buffer overflow");
                         lastWarning = now;
                     }
                 }
@@ -4470,7 +4469,7 @@
 
     lStatus = initCheck();
     if (lStatus != NO_ERROR) {
-        LOGE("Audio driver not initialized.");
+        ALOGE("Audio driver not initialized.");
         goto Exit;
     }
 
@@ -4626,7 +4625,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
@@ -4967,7 +4966,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;
     }
 
@@ -5163,7 +5162,7 @@
     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;
     }
 
@@ -5232,7 +5231,7 @@
             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() {
@@ -5443,14 +5442,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;
             }
@@ -5461,13 +5460,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) {
@@ -5484,7 +5483,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
@@ -5545,7 +5544,7 @@
         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;
             }
@@ -5581,17 +5580,17 @@
             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;
     }
 
@@ -5613,7 +5612,7 @@
 
     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;
     }
@@ -5643,7 +5642,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;
             }
@@ -5685,14 +5684,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;
@@ -5702,7 +5701,7 @@
             (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;
@@ -5811,7 +5810,7 @@
     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;
     }
@@ -5844,7 +5843,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());
     }
 }
 
@@ -6066,7 +6065,7 @@
 size_t AudioFlinger::RecordThread::removeEffectChain_l(const sp<EffectChain>& chain)
 {
     ALOGV("removeEffectChain_l() %p from thread %p", chain.get(), this);
-    LOGW_IF(mEffectChains.size() != 1,
+    ALOGW_IF(mEffectChains.size() != 1,
             "removeEffectChain_l() %p invalid chain size %d on thread %p",
             chain.get(), mEffectChains.size(), this);
     if (mEffectChains.size() == 1) {
@@ -6708,7 +6707,8 @@
     Mutex::Autolock _l(mLock);
     mSuspended = suspended;
 }
-bool AudioFlinger::EffectModule::suspended()
+
+bool AudioFlinger::EffectModule::suspended() const
 {
     Mutex::Autolock _l(mLock);
     return mSuspended;
@@ -6828,7 +6828,7 @@
             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;
     }
 }
@@ -6963,12 +6963,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;
             }
@@ -7144,7 +7144,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) ||
@@ -7240,7 +7240,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
@@ -7476,7 +7476,7 @@
         }
         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) {
@@ -7523,7 +7523,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) {
@@ -7603,7 +7603,7 @@
             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;
             }
         }
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 7baa8fc..ff8dedb 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -63,7 +63,7 @@
 {
     friend class BinderService<AudioFlinger>;
 public:
-    static char const* getServiceName() { return "media.audio_flinger"; }
+    static const char* getServiceName() { return "media.audio_flinger"; }
 
     virtual     status_t    dump(int fd, const Vector<String16>& args);
 
@@ -730,7 +730,7 @@
 
                     void        suspend() { mSuspended++; }
                     void        restore() { if (mSuspended) mSuspended--; }
-                    bool        isSuspended() { return (mSuspended != 0); }
+                    bool        isSuspended() const { return (mSuspended != 0); }
         virtual     String8     getParameters(const String8& keys);
         virtual     void        audioConfigChanged_l(int event, int param = 0);
         virtual     status_t    getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames);
@@ -1115,7 +1115,7 @@
         status_t         start();
         status_t         stop();
         void             setSuspended(bool suspended);
-        bool             suspended();
+        bool             suspended() const;
 
         sp<EffectHandle> controlHandle();
 
@@ -1138,7 +1138,7 @@
         status_t start_l();
         status_t stop_l();
 
-        Mutex               mLock;      // mutex for process, commands and handles list protection
+mutable Mutex               mLock;      // mutex for process, commands and handles list protection
         wp<ThreadBase>      mThread;    // parent thread
         wp<EffectChain>     mChain;     // parent effect chain
         int                 mId;        // this instance unique ID
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index c9c61a5..8df4605 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -95,16 +95,11 @@
 
 int AudioMixer::getTrackName()
 {
-    uint32_t names = mTrackNames;
-    uint32_t mask = 1;
-    int n = 0;
-    while (names & mask) {
-        mask <<= 1;
-        n++;
-    }
-    if (mask) {
+    uint32_t names = ~mTrackNames;
+    if (names != 0) {
+        int n = __builtin_ctz(names);
         ALOGV("add track (%d)", n);
-        mTrackNames |= mask;
+        mTrackNames |= 1 << n;
         return TRACK0 + n;
     }
     return -1;
@@ -365,7 +360,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;
@@ -606,7 +601,7 @@
 
 void AudioMixer::track__16BitsStereo(track_t* t, int32_t* out, size_t frameCount, int32_t* temp, int32_t* aux)
 {
-    int16_t const *in = static_cast<int16_t const *>(t->in);
+    const int16_t *in = static_cast<const int16_t *>(t->in);
 
     if (CC_UNLIKELY(aux != NULL)) {
         int32_t l;
@@ -645,7 +640,7 @@
             const uint32_t vrl = t->volumeRL;
             const int16_t va = (int16_t)t->auxLevel;
             do {
-                uint32_t rl = *reinterpret_cast<uint32_t const *>(in);
+                uint32_t rl = *reinterpret_cast<const uint32_t *>(in);
                 int16_t a = (int16_t)(((int32_t)in[0] + in[1]) >> 1);
                 in += 2;
                 out[0] = mulAddRL(1, rl, vrl, out[0]);
@@ -683,7 +678,7 @@
         else {
             const uint32_t vrl = t->volumeRL;
             do {
-                uint32_t rl = *reinterpret_cast<uint32_t const *>(in);
+                uint32_t rl = *reinterpret_cast<const uint32_t *>(in);
                 in += 2;
                 out[0] = mulAddRL(1, rl, vrl, out[0]);
                 out[1] = mulAddRL(0, rl, vrl, out[1]);
@@ -696,7 +691,7 @@
 
 void AudioMixer::track__16BitsMono(track_t* t, int32_t* out, size_t frameCount, int32_t* temp, int32_t* aux)
 {
-    int16_t const *in = static_cast<int16_t const *>(t->in);
+    const int16_t *in = static_cast<int16_t const *>(t->in);
 
     if (CC_UNLIKELY(aux != NULL)) {
         // ramp gain
@@ -918,6 +913,7 @@
 // generic code with resampling
 void AudioMixer::process__genericResampling(state_t* state)
 {
+    // this const just means that local variable outTemp doesn't change
     int32_t* const outTemp = state->outputTemp;
     const size_t size = sizeof(int32_t) * MAX_NUM_CHANNELS * state->frameCount;
 
@@ -998,13 +994,13 @@
     while (numFrames) {
         b.frameCount = numFrames;
         t.bufferProvider->getNextBuffer(&b);
-        int16_t const *in = b.i16;
+        const int16_t *in = b.i16;
 
         // in == NULL can happen if the track was flushed just after having
         // 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;
         }
@@ -1014,7 +1010,7 @@
             // volume is boosted, so we might need to clamp even though
             // we process only one track.
             do {
-                uint32_t rl = *reinterpret_cast<uint32_t const *>(in);
+                uint32_t rl = *reinterpret_cast<const uint32_t *>(in);
                 in += 2;
                 int32_t l = mulRL(1, rl, vrl) >> 12;
                 int32_t r = mulRL(0, rl, vrl) >> 12;
@@ -1025,7 +1021,7 @@
             } while (--outFrames);
         } else {
             do {
-                uint32_t rl = *reinterpret_cast<uint32_t const *>(in);
+                uint32_t rl = *reinterpret_cast<const uint32_t *>(in);
                 in += 2;
                 int32_t l = mulRL(1, rl, vrl) >> 12;
                 int32_t r = mulRL(0, rl, vrl) >> 12;
@@ -1055,12 +1051,12 @@
     const track_t& t1 = state->tracks[i];
     AudioBufferProvider::Buffer& b1(t1.buffer);
 
-    int16_t const *in0;
+    const int16_t *in0;
     const int16_t vl0 = t0.volume[0];
     const int16_t vr0 = t0.volume[1];
     size_t frameCount0 = 0;
 
-    int16_t const *in1;
+    const int16_t *in1;
     const int16_t vl1 = t1.volume[0];
     const int16_t vr1 = t1.volume[1];
     size_t frameCount1 = 0;
@@ -1068,7 +1064,7 @@
     //FIXME: only works if two tracks use same buffer
     int32_t* out = t0.mainBuffer;
     size_t numFrames = state->frameCount;
-    int16_t const *buff = NULL;
+    const int16_t *buff = NULL;
 
 
     while (numFrames) {
diff --git a/services/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h
index 4ba6845..84f6330 100644
--- a/services/audioflinger/AudioMixer.h
+++ b/services/audioflinger/AudioMixer.h
@@ -145,7 +145,7 @@
         mutable AudioBufferProvider::Buffer buffer;
 
         hook_t      hook;
-        void const* in;             // current location in buffer
+        const void* in;             // current location in buffer
 
         AudioResampler*     resampler;
         uint32_t            sampleRate;
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp
index d99f66a..f572fce 100644
--- a/services/audioflinger/AudioPolicyService.cpp
+++ b/services/audioflinger/AudioPolicyService.cpp
@@ -52,7 +52,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;
 }
 
@@ -83,18 +83,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;
 
@@ -338,7 +338,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;
         }
@@ -533,7 +533,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());
 }
 
@@ -726,7 +726,7 @@
                     delete data;
                     }break;
                 default:
-                    LOGW("AudioCommandThread() unknown command %d", command->mCommand);
+                    ALOGW("AudioCommandThread() unknown command %d", command->mCommand);
                 }
                 delete command;
                 waitTime = INT64_MAX;
@@ -1027,9 +1027,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);
@@ -1134,7 +1134,7 @@
         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;
 }
 
@@ -1155,7 +1155,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);
@@ -1164,7 +1164,7 @@
         }
     }
     if (param == NULL || value == NULL) {
-        LOGW("loadEffectParameter() invalid parameter description %s", root->name);
+        ALOGW("loadEffectParameter() invalid parameter description %s", root->name);
         goto error;
     }
 
@@ -1223,7 +1223,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();
@@ -1247,7 +1247,7 @@
         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;
     }
@@ -1264,7 +1264,7 @@
     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;
         }
@@ -1288,7 +1288,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();
@@ -1354,7 +1354,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;
     }
 
@@ -1368,7 +1368,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);
@@ -1387,7 +1387,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;
     }
 
@@ -1398,7 +1398,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;
     }
 
@@ -1414,7 +1414,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 7205045..fbdcb62 100644
--- a/services/audioflinger/AudioResampler.cpp
+++ b/services/audioflinger/AudioResampler.cpp
@@ -121,7 +121,7 @@
             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);
     }
@@ -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,13 +248,13 @@
             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];
@@ -265,7 +265,7 @@
         }
     }
 
-    // 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,13 +343,13 @@
         }
 
 
-        // 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);
@@ -359,7 +359,7 @@
         }
     }
 
-    // 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..587c7be 100644
--- a/services/audioflinger/AudioResamplerCubic.cpp
+++ b/services/audioflinger/AudioResamplerCubic.cpp
@@ -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/audioflinger/AudioResamplerSinc.cpp b/services/audioflinger/AudioResamplerSinc.cpp
index 9e5e254..d012433 100644
--- a/services/audioflinger/AudioResamplerSinc.cpp
+++ b/services/audioflinger/AudioResamplerSinc.cpp
@@ -284,7 +284,7 @@
 **/
 void AudioResamplerSinc::read(
         int16_t*& impulse, uint32_t& phaseFraction,
-        int16_t const* in, size_t inputIndex)
+        const int16_t* in, size_t inputIndex)
 {
     const uint32_t phaseIndex = phaseFraction >> kNumPhaseBits;
     impulse += CHANNELS;
@@ -302,7 +302,7 @@
 
 template<int CHANNELS>
 void AudioResamplerSinc::filterCoefficient(
-        int32_t& l, int32_t& r, uint32_t phase, int16_t const *samples)
+        int32_t& l, int32_t& r, uint32_t phase, const int16_t *samples)
 {
     // compute the index of the coefficient on the positive side and
     // negative side
@@ -317,9 +317,9 @@
 
     l = 0;
     r = 0;
-    int32_t const* coefs = mFirCoefs;
-    int16_t const *sP = samples;
-    int16_t const *sN = samples+CHANNELS;
+    const int32_t* coefs = mFirCoefs;
+    const int16_t *sP = samples;
+    const int16_t *sN = samples+CHANNELS;
     for (unsigned int i=0 ; i<halfNumCoefs/4 ; i++) {
         interpolate<CHANNELS>(l, r, coefs+indexP, lerpP, sP);
         interpolate<CHANNELS>(l, r, coefs+indexN, lerpN, sN);
@@ -339,13 +339,13 @@
 template<int CHANNELS>
 void AudioResamplerSinc::interpolate(
         int32_t& l, int32_t& r,
-        int32_t const* coefs, int16_t lerp, int16_t const* samples)
+        const int32_t* coefs, int16_t lerp, const int16_t* samples)
 {
     int32_t c0 = coefs[0];
     int32_t c1 = coefs[1];
     int32_t sinc = mulAdd(lerp, (c1-c0)<<1, c0);
     if (CHANNELS == 2) {
-        uint32_t rl = *reinterpret_cast<uint32_t const*>(samples);
+        uint32_t rl = *reinterpret_cast<const uint32_t*>(samples);
         l = mulAddRL(1, rl, sinc, l);
         r = mulAddRL(0, rl, sinc, r);
     } else {
diff --git a/services/audioflinger/AudioResamplerSinc.h b/services/audioflinger/AudioResamplerSinc.h
index e6cb90b..0e1bc44 100644
--- a/services/audioflinger/AudioResamplerSinc.h
+++ b/services/audioflinger/AudioResamplerSinc.h
@@ -44,22 +44,22 @@
 
     template<int CHANNELS>
     inline void filterCoefficient(
-            int32_t& l, int32_t& r, uint32_t phase, int16_t const *samples);
+            int32_t& l, int32_t& r, uint32_t phase, const int16_t *samples);
 
     template<int CHANNELS>
     inline void interpolate(
             int32_t& l, int32_t& r,
-            int32_t const* coefs, int16_t lerp, int16_t const* samples);
+            const int32_t* coefs, int16_t lerp, const int16_t* samples);
 
     template<int CHANNELS>
     inline void read(int16_t*& impulse, uint32_t& phaseFraction,
-            int16_t const* in, size_t inputIndex);
+            const int16_t* in, size_t inputIndex);
 
     int16_t *mState;
     int16_t *mImpulse;
     int16_t *mRingFull;
 
-    int32_t const * mFirCoefs;
+    const int32_t * mFirCoefs;
     static const int32_t mFirCoefsDown[];
     static const int32_t mFirCoefsUp[];
 
diff --git a/services/camera/libcameraservice/CameraHardwareInterface.h b/services/camera/libcameraservice/CameraHardwareInterface.h
index 44b9de8..34087b5 100644
--- a/services/camera/libcameraservice/CameraHardwareInterface.h
+++ b/services/camera/libcameraservice/CameraHardwareInterface.h
@@ -92,7 +92,7 @@
         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);
         }
     }
 
@@ -102,7 +102,7 @@
         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();
@@ -460,7 +460,7 @@
                 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;
         }
@@ -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 f922630..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?!");
     }
 }
 
@@ -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 7b4b4ac..06fc708 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -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;
         }
@@ -97,22 +97,12 @@
             setCameraFree(i);
         }
     }
-
-    // Read the system property to determine if we have to use the
-    // AUDIO_STREAM_ENFORCED_AUDIBLE type.
-    char value[PROPERTY_VALUE_MAX];
-    property_get("ro.camera.sound.forced", value, "0");
-    if (strcmp(value, "0") != 0) {
-        mAudioStreamType = AUDIO_STREAM_ENFORCED_AUDIBLE;
-    } else {
-        mAudioStreamType = AUDIO_STREAM_MUSIC;
-    }
 }
 
 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);
         }
     }
 
@@ -148,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;
     }
@@ -176,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;
             }
@@ -185,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;
     }
 
@@ -263,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;
                 }
@@ -295,10 +285,10 @@
 MediaPlayer* CameraService::newMediaPlayer(const char *file) {
     MediaPlayer* mp = new MediaPlayer();
     if (mp->setDataSource(file, NULL) == NO_ERROR) {
-        mp->setAudioStreamType(mAudioStreamType);
+        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;
@@ -390,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;
 }
@@ -399,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;
@@ -429,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;
@@ -448,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;
     }
@@ -471,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);
         }
     }
@@ -483,7 +473,7 @@
     Mutex::Autolock lock(mLock);
 
     if (checkPid() != NO_ERROR) {
-        LOGW("different client - don't disconnect");
+        ALOGW("different client - don't disconnect");
         return;
     }
 
@@ -536,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;
         }
@@ -634,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();
@@ -686,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;
 }
@@ -780,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;
     }
@@ -841,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;
         }
     }
@@ -917,7 +907,7 @@
         }
         usleep(CHECK_MESSAGE_INTERVAL * 1000);
     }
-    LOGW("lockIfMessageWanted(%d): dropped unwanted message", msgType);
+    ALOGW("lockIfMessageWanted(%d): dropped unwanted message", msgType);
     return false;
 }
 
@@ -936,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;
     }
 
@@ -999,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;
     }
@@ -1032,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;
     }
@@ -1187,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;
     }
@@ -1197,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;
     }
@@ -1223,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/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index cdfbc56..bad41f5 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -76,7 +76,6 @@
     void                setCameraFree(int cameraId);
 
     // sounds
-    audio_stream_type_t mAudioStreamType;
     MediaPlayer*        newMediaPlayer(const char *file);
 
     Mutex               mSoundLock;
diff --git a/services/camera/tests/CameraServiceTest/CameraServiceTest.cpp b/services/camera/tests/CameraServiceTest/CameraServiceTest.cpp
index 69f60ca..1055538 100644
--- a/services/camera/tests/CameraServiceTest/CameraServiceTest.cpp
+++ b/services/camera/tests/CameraServiceTest/CameraServiceTest.cpp
@@ -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);
     }
 }
diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp
index 85ff964..6db750ee 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;
             }
@@ -614,7 +614,7 @@
                 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;
             }
@@ -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,16 +648,16 @@
                         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;
 
@@ -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 {
@@ -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);
     }
 }
 
@@ -847,7 +847,7 @@
 
     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;
     }
 
@@ -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;
     }
@@ -1072,7 +1072,7 @@
     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;
     }
@@ -1103,7 +1103,7 @@
         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());
         }
@@ -1175,13 +1175,13 @@
          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);
@@ -1231,7 +1231,7 @@
     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);
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp
index b896a82..f2994abc2 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);
@@ -1770,13 +1770,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;
@@ -2160,7 +2160,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;
@@ -2223,7 +2223,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;
@@ -2255,7 +2255,7 @@
                     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*/);
@@ -2278,7 +2278,7 @@
     // 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;
@@ -2313,7 +2313,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;
@@ -2400,7 +2400,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
         }
@@ -2409,7 +2409,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;
             }
@@ -2423,7 +2423,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 {
@@ -2432,7 +2432,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);
             }
         }
@@ -2547,7 +2547,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());
@@ -3086,7 +3086,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;
     }
 
@@ -3187,13 +3187,13 @@
                 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;
             }
         }
@@ -3635,7 +3635,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;
         }
@@ -3643,7 +3643,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;
         }
@@ -3686,7 +3686,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;
     }
@@ -3762,7 +3762,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(
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 6f19950..bc17272 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -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,7 +372,7 @@
         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;
     }
 
@@ -446,7 +446,7 @@
         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;
     }
 
@@ -1554,7 +1554,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);
             }
@@ -2121,7 +2121,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());
         }
     }
 
@@ -2530,7 +2530,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());
         }
     }
 
@@ -2560,7 +2560,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());
         }
     }
 
@@ -2654,7 +2654,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;
@@ -3010,7 +3010,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;
@@ -3066,7 +3066,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());
         }
     }
@@ -3089,7 +3089,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());
         }
     }
@@ -3108,7 +3108,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());
         }
     }
@@ -3122,7 +3122,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());
         }
     }
@@ -5686,7 +5686,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;
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/pm/Settings.java b/services/java/com/android/server/pm/Settings.java
index 36442a0..32aa7a4 100644
--- a/services/java/com/android/server/pm/Settings.java
+++ b/services/java/com/android/server/pm/Settings.java
@@ -713,8 +713,7 @@
             mBackupStoppedPackagesFilename.delete();
             FileUtils.setPermissions(mStoppedPackagesFilename.toString(),
                     FileUtils.S_IRUSR|FileUtils.S_IWUSR
-                    |FileUtils.S_IRGRP|FileUtils.S_IWGRP
-                    |FileUtils.S_IROTH,
+                    |FileUtils.S_IRGRP|FileUtils.S_IWGRP,
                     -1, -1);
 
             // Done, all is good!
@@ -951,8 +950,7 @@
             mBackupSettingsFilename.delete();
             FileUtils.setPermissions(mSettingsFilename.toString(),
                     FileUtils.S_IRUSR|FileUtils.S_IWUSR
-                    |FileUtils.S_IRGRP|FileUtils.S_IWGRP
-                    |FileUtils.S_IROTH,
+                    |FileUtils.S_IRGRP|FileUtils.S_IWGRP,
                     -1, -1);
 
             // Write package list file now, use a JournaledFile.
@@ -1007,8 +1005,7 @@
 
             FileUtils.setPermissions(mPackageListFilename.toString(),
                     FileUtils.S_IRUSR|FileUtils.S_IWUSR
-                    |FileUtils.S_IRGRP|FileUtils.S_IWGRP
-                    |FileUtils.S_IROTH,
+                    |FileUtils.S_IRGRP|FileUtils.S_IWGRP,
                     -1, -1);
 
             writeStoppedLPr();
diff --git a/services/jni/com_android_server_AlarmManagerService.cpp b/services/jni/com_android_server_AlarmManagerService.cpp
index 5f189a2..c2f6151 100644
--- a/services/jni/com_android_server_AlarmManagerService.cpp
+++ b/services/jni/com_android_server_AlarmManagerService.cpp
@@ -46,7 +46,7 @@
 
     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 {
         ALOGD("Kernel timezone updated to %d minutes west of GMT\n", minswest);
@@ -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 b8b5d77..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;
@@ -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;
         }
 
@@ -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 08650e1..d2b3118 100644
--- a/services/jni/com_android_server_PowerManagerService.cpp
+++ b/services/jni/com_android_server_PowerManagerService.cpp
@@ -58,7 +58,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_connectivity_Vpn.cpp b/services/jni/com_android_server_connectivity_Vpn.cpp
index d9b8a14..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;
@@ -176,11 +176,11 @@
     }
 
     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;
     }
 
@@ -265,12 +265,12 @@
     }
 
     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 2e5b5d6..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();
     }
@@ -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..286ae91 100644
--- a/services/jni/onload.cpp
+++ b/services/jni/onload.cpp
@@ -43,7 +43,7 @@
     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!");
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 8f23506..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) {
@@ -219,7 +219,7 @@
 
         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/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 3e4a2f5..dd6c426 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -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;
 }
@@ -369,13 +369,13 @@
         if (c->hasSensor(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);
+        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);
@@ -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 2ffbd1e..cf131b1 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);
     }
 
@@ -173,7 +173,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;
         }
@@ -188,7 +188,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);
@@ -231,7 +231,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 {
@@ -270,7 +270,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);
     }
 
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp
index 174dcd7..f4afeea 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp
+++ b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp
@@ -76,7 +76,7 @@
       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();
         ALOGD("About to give-up screen, flinger = %p", flinger.get());
@@ -91,7 +91,7 @@
       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();
         ALOGD("Screen about to return, flinger = %p", flinger.get());
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/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 85845c9..cbd530c 100644
--- a/services/surfaceflinger/MessageQueue.cpp
+++ b/services/surfaceflinger/MessageQueue.cpp
@@ -70,12 +70,12 @@
                 continue;
 
             case ALOOPER_POLL_ERROR:
-                LOGE("ALOOPER_POLL_ERROR");
+                ALOGE("ALOOPER_POLL_ERROR");
                 continue;
 
             default:
                 // should not happen
-                LOGE("Looper::pollOnce() returned unknown status %d", ret);
+                ALOGE("Looper::pollOnce() returned unknown status %d", ret);
                 continue;
         }
     } while (true);
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index e77f08f..bbb30b0 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -161,7 +161,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;
 }
@@ -231,10 +231,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;
 
@@ -458,7 +458,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;
@@ -874,7 +874,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);
 
@@ -893,7 +893,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.
@@ -1220,7 +1220,7 @@
             mCurrentState.orientation = orientation;
             transactionFlags |= eTransactionNeeded;
         } else if (orientation != eOrientationUnchanged) {
-            LOGW("setTransactionState: ignoring unrecognized orientation: %d",
+            ALOGW("setTransactionState: ignoring unrecognized orientation: %d",
                     orientation);
         }
     }
@@ -1246,7 +1246,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;
             }
@@ -1285,7 +1285,7 @@
     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;
     }
@@ -1357,7 +1357,7 @@
     sp<Layer> layer = new Layer(this, display, client);
     status_t err = layer->setBuffers(w, h, format, flags);
     if (CC_LIKELY(err != NO_ERROR)) {
-        LOGE("createNormalSurfaceLocked() failed (%s)", strerror(-err));
+        ALOGE("createNormalSurfaceLocked() failed (%s)", strerror(-err));
         layer.clear();
     }
     return layer;
@@ -1415,10 +1415,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;
@@ -1651,7 +1651,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;
             }
@@ -1665,7 +1665,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;
             }
@@ -1680,7 +1680,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;
         }
@@ -2497,7 +2497,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;
 }
@@ -2515,7 +2515,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;
          }
@@ -2587,7 +2587,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/telephony/java/com/android/internal/telephony/DataConnection.java b/telephony/java/com/android/internal/telephony/DataConnection.java
index 4619899..ffe848d 100644
--- a/telephony/java/com/android/internal/telephony/DataConnection.java
+++ b/telephony/java/com/android/internal/telephony/DataConnection.java
@@ -134,7 +134,8 @@
         // specified here
         UNKNOWN(0x10000),
         RADIO_NOT_AVAILABLE(0x10001),
-        UNACCEPTABLE_NETWORK_PARAMETER(0x10002);
+        UNACCEPTABLE_NETWORK_PARAMETER(0x10002),
+        CONNECTION_TO_DATACONNECTIONAC_BROKEN(0x10003);
 
         private final int mErrorCode;
         private static final HashMap<Integer, FailCause> sErrorCodeToFailCauseMap;
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index 26967a0..dab72a9 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -559,14 +559,23 @@
     }
 
     protected ApnSetting fetchDunApn() {
+        if (SystemProperties.getBoolean("net.tethering.noprovisioning", false)) {
+            log("fetchDunApn: net.tethering.noprovisioning=true ret: null");
+            return null;
+        }
         Context c = mPhone.getContext();
         String apnData = Settings.Secure.getString(c.getContentResolver(),
                 Settings.Secure.TETHER_DUN_APN);
         ApnSetting dunSetting = ApnSetting.fromString(apnData);
-        if (dunSetting != null) return dunSetting;
+        if (dunSetting != null) {
+            if (VDBG) log("fetchDunApn: secure TETHER_DUN_APN dunSetting=" + dunSetting);
+            return dunSetting;
+        }
 
         apnData = c.getResources().getString(R.string.config_tether_apndata);
-        return ApnSetting.fromString(apnData);
+        dunSetting = ApnSetting.fromString(apnData);
+        if (VDBG) log("fetchDunApn: config_tether_apndata dunSetting=" + dunSetting);
+        return dunSetting;
     }
 
     public String[] getActiveApnTypes() {
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index 93a723e..6096cb0 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -76,6 +76,7 @@
  */
 public final class GsmDataConnectionTracker extends DataConnectionTracker {
     protected final String LOG_TAG = "GSM";
+    private static final boolean RADIO_TESTS = false;
 
     /**
      * Handles changes to the APN db.
@@ -1401,7 +1402,7 @@
         sent = mDataStallTxRxSum.txPkts - preTxRxSum.txPkts;
         received = mDataStallTxRxSum.rxPkts - preTxRxSum.rxPkts;
 
-        if (VDBG) {
+        if (RADIO_TESTS) {
             if (SystemProperties.getBoolean("radio.test.data.stall", false)) {
                 log("updateDataStallInfo: radio.test.data.stall true received = 0;");
                 received = 0;
@@ -1906,6 +1907,8 @@
     @Override
     protected void onDataSetupComplete(AsyncResult ar) {
 
+        DataConnection.FailCause cause = DataConnection.FailCause.UNKNOWN;
+        boolean handleError = false;
         ApnContext apnContext = null;
 
         if(ar.userObj instanceof ApnContext){
@@ -1916,52 +1919,73 @@
 
         if (isDataSetupCompleteOk(ar)) {
             DataConnectionAc dcac = apnContext.getDataConnectionAc();
+
+            if (RADIO_TESTS) {
+                // Note: To change radio.test.onDSC.null.dcac from command line you need to
+                // adb root and adb remount and from the command line you can only change the
+                // value to 1 once. To change it a second time you can reboot or execute
+                // adb shell stop and then adb shell start. The command line to set the value is:
+                //   adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db "insert into system (name,value) values ('radio.test.onDSC.null.dcac', '1');"
+                ContentResolver cr = mPhone.getContext().getContentResolver();
+                String radioTestProperty = "radio.test.onDSC.null.dcac";
+                if (Settings.System.getInt(cr, radioTestProperty, 0) == 1) {
+                    log("onDataSetupComplete: " + radioTestProperty +
+                            " is true, set dcac to null and reset property to false");
+                    dcac = null;
+                    Settings.System.putInt(cr, radioTestProperty, 0);
+                    log("onDataSetupComplete: " + radioTestProperty + "=" +
+                            Settings.System.getInt(mPhone.getContext().getContentResolver(),
+                                    radioTestProperty, -1));
+                }
+            }
             if (dcac == null) {
-                throw new RuntimeException("onDataSetupCompete: No dcac");
-            }
-            DataConnection dc = apnContext.getDataConnection();
+                log("onDataSetupComplete: no connection to DC, handle as error");
+                cause = DataConnection.FailCause.CONNECTION_TO_DATACONNECTIONAC_BROKEN;
+                handleError = true;
+            } else {
+                DataConnection dc = apnContext.getDataConnection();
 
-            if (DBG) {
-                // TODO We may use apnContext.getApnSetting() directly
-                // instead of getWaitingApns().get(0)
-                String apnStr = "<unknown>";
-                if (apnContext.getWaitingApns() != null
-                        && !apnContext.getWaitingApns().isEmpty()){
-                    apnStr = apnContext.getWaitingApns().get(0).apn;
+                if (DBG) {
+                    // TODO We may use apnContext.getApnSetting() directly
+                    // instead of getWaitingApns().get(0)
+                    String apnStr = "<unknown>";
+                    if (apnContext.getWaitingApns() != null
+                            && !apnContext.getWaitingApns().isEmpty()){
+                        apnStr = apnContext.getWaitingApns().get(0).apn;
+                    }
+                    log("onDataSetupComplete: success apn=" + apnStr);
                 }
-                log("onDataSetupComplete: success apn=" + apnStr);
-            }
-            ApnSetting apn = apnContext.getApnSetting();
-            if (apn.proxy != null && apn.proxy.length() != 0) {
-                try {
-                    String port = apn.port;
-                    if (TextUtils.isEmpty(port)) port = "8080";
-                    ProxyProperties proxy = new ProxyProperties(apn.proxy,
-                            Integer.parseInt(port), null);
-                    dcac.setLinkPropertiesHttpProxySync(proxy);
-                } catch (NumberFormatException e) {
-                    loge("onDataSetupComplete: NumberFormatException making ProxyProperties (" +
-                            apn.port + "): " + e);
-                }
-            }
-
-            // everything is setup
-            if(TextUtils.equals(apnContext.getApnType(),Phone.APN_TYPE_DEFAULT)) {
-                SystemProperties.set("gsm.defaultpdpcontext.active", "true");
-                if (canSetPreferApn && mPreferredApn == null) {
-                    if (DBG) log("onDataSetupComplete: PREFERED APN is null");
-                    mPreferredApn = apnContext.getApnSetting();
-                    if (mPreferredApn != null) {
-                        setPreferredApn(mPreferredApn.id);
+                ApnSetting apn = apnContext.getApnSetting();
+                if (apn.proxy != null && apn.proxy.length() != 0) {
+                    try {
+                        String port = apn.port;
+                        if (TextUtils.isEmpty(port)) port = "8080";
+                        ProxyProperties proxy = new ProxyProperties(apn.proxy,
+                                Integer.parseInt(port), null);
+                        dcac.setLinkPropertiesHttpProxySync(proxy);
+                    } catch (NumberFormatException e) {
+                        loge("onDataSetupComplete: NumberFormatException making ProxyProperties (" +
+                                apn.port + "): " + e);
                     }
                 }
-            } else {
-                SystemProperties.set("gsm.defaultpdpcontext.active", "false");
+
+                // everything is setup
+                if(TextUtils.equals(apnContext.getApnType(),Phone.APN_TYPE_DEFAULT)) {
+                    SystemProperties.set("gsm.defaultpdpcontext.active", "true");
+                    if (canSetPreferApn && mPreferredApn == null) {
+                        if (DBG) log("onDataSetupComplete: PREFERED APN is null");
+                        mPreferredApn = apnContext.getApnSetting();
+                        if (mPreferredApn != null) {
+                            setPreferredApn(mPreferredApn.id);
+                        }
+                    }
+                } else {
+                    SystemProperties.set("gsm.defaultpdpcontext.active", "false");
+                }
+                notifyDefaultData(apnContext);
             }
-            notifyDefaultData(apnContext);
         } else {
             String apnString;
-            DataConnection.FailCause cause;
 
             cause = (DataConnection.FailCause) (ar.result);
             if (DBG) {
@@ -1989,7 +2013,10 @@
                         apnContext.getWaitingApns().size(),
                         apnContext.getWaitingApnsPermFailCount()));
             }
+            handleError = true;
+        }
 
+        if (handleError) {
             // See if there are more APN's to try
             if (apnContext.getWaitingApns().isEmpty()) {
                 if (apnContext.getWaitingApnsPermFailCount() == 0) {
@@ -2001,9 +2028,6 @@
 
                     apnContext.setDataConnection(null);
                     apnContext.setDataConnectionAc(null);
-                    if (DBG) {
-                        log("onDataSetupComplete: permanent error apn=%s" + apnString );
-                    }
                 } else {
                     if (DBG) log("onDataSetupComplete: Not all permanent failures, retry");
                     // check to see if retry should be overridden for this failure.
diff --git a/tests/RenderScriptTests/PerfTest/res/raw/singletexfm.glsl b/tests/RenderScriptTests/PerfTest/res/raw/singletexfm.glsl
new file mode 100644
index 0000000..656961c
--- /dev/null
+++ b/tests/RenderScriptTests/PerfTest/res/raw/singletexfm.glsl
@@ -0,0 +1,8 @@
+varying vec2 varTex0;
+
+void main() {
+   lowp vec3 col0 = texture2D(UNI_Tex0, varTex0).rgb;
+   gl_FragColor.xyz = col0 * UNI_modulate.rgb;
+   gl_FragColor.w = UNI_modulate.a;
+}
+
diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/FillTest.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/FillTest.java
index ba70c71..41f664a 100644
--- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/FillTest.java
+++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/FillTest.java
@@ -35,18 +35,22 @@
     // Custom shaders
     private ProgramFragment mProgFragmentMultitex;
     private ProgramFragment mProgFragmentSingletex;
+    private ProgramFragment mProgFragmentSingletexModulate;
     private final BitmapFactory.Options mOptionsARGB = new BitmapFactory.Options();
     int mBenchmarkDimX;
     int mBenchmarkDimY;
 
     private ScriptC_fill_test mFillScript;
     ScriptField_TestScripts_s.Item[] mTests;
+    ScriptField_FillTestFragData_s mFragData;
 
     private final String[] mNames = {
         "Fill screen 10x singletexture",
         "Fill screen 10x 3tex multitexture",
         "Fill screen 10x blended singletexture",
-        "Fill screen 10x blended 3tex multitexture"
+        "Fill screen 10x blended 3tex multitexture",
+        "Fill screen 3x modulate blended singletexture",
+        "Fill screen 1x modulate blended singletexture",
     };
 
     public FillTest() {
@@ -88,6 +92,8 @@
         addTest(index++, 0 /*testId*/, 0 /*blend*/, 10 /*quadCount*/);
         addTest(index++, 1 /*testId*/, 1 /*blend*/, 10 /*quadCount*/);
         addTest(index++, 0 /*testId*/, 1 /*blend*/, 10 /*quadCount*/);
+        addTest(index++, 2 /*testId*/, 1 /*blend*/, 3 /*quadCount*/);
+        addTest(index++, 2 /*testId*/, 1 /*blend*/, 1 /*quadCount*/);
 
         return true;
     }
@@ -112,6 +118,14 @@
         pfbCustom.setShader(mRes, R.raw.singletexf);
         pfbCustom.addTexture(Program.TextureType.TEXTURE_2D);
         mProgFragmentSingletex = pfbCustom.create();
+
+        pfbCustom = new ProgramFragment.Builder(mRS);
+        pfbCustom.setShader(mRes, R.raw.singletexfm);
+        pfbCustom.addTexture(Program.TextureType.TEXTURE_2D);
+        mFragData = new ScriptField_FillTestFragData_s(mRS, 1);
+        pfbCustom.addConstant(mFragData.getType());
+        mProgFragmentSingletexModulate = pfbCustom.create();
+        mProgFragmentSingletexModulate.bindConstants(mFragData.getAllocation(), 0);
     }
 
     private Allocation loadTextureARGB(int id) {
@@ -140,6 +154,7 @@
         mFillScript.set_gProgVertex(progVertex);
 
         mFillScript.set_gProgFragmentTexture(mProgFragmentSingletex);
+        mFillScript.set_gProgFragmentTextureModulate(mProgFragmentSingletexModulate);
         mFillScript.set_gProgFragmentMultitex(mProgFragmentMultitex);
         mFillScript.set_gProgStoreBlendNone(ProgramStore.BLEND_NONE_DEPTH_NONE(mRS));
         mFillScript.set_gProgStoreBlendAlpha(ProgramStore.BLEND_ALPHA_DEPTH_NONE(mRS));
@@ -150,5 +165,7 @@
         mFillScript.set_gTexOpaque(loadTextureRGB(R.drawable.data));
         mFillScript.set_gTexTransparent(loadTextureARGB(R.drawable.leaf));
         mFillScript.set_gTexChecker(loadTextureRGB(R.drawable.checker));
+
+        mFillScript.bind_gFragData(mFragData);
     }
 }
diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/fill_test.rs b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/fill_test.rs
index 23832d3..281f830 100644
--- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/fill_test.rs
+++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/fill_test.rs
@@ -21,6 +21,7 @@
 
 rs_program_vertex gProgVertex;
 rs_program_fragment gProgFragmentTexture;
+rs_program_fragment gProgFragmentTextureModulate;
 rs_program_fragment gProgFragmentMultitex;
 
 rs_program_store gProgStoreBlendNone;
@@ -41,6 +42,11 @@
 } FillTestData;
 FillTestData *gData;
 
+typedef struct FillTestFragData_s {
+    float4 modulate;
+} FillTestFragData;
+FillTestFragData *gFragData;
+
 static float gDt = 0.0f;
 
 void init() {
@@ -58,7 +64,7 @@
     rsgProgramVertexLoadProjectionMatrix(&proj);
 }
 
-static void displaySingletexFill(bool blend, int quadCount) {
+static void displaySingletexFill(bool blend, int quadCount, bool modulate) {
     bindProgramVertexOrtho();
     rs_matrix4x4 matrix;
     rsMatrixLoadIdentity(&matrix);
@@ -70,9 +76,21 @@
     } else {
         rsgBindProgramStore(gProgStoreBlendAlpha);
     }
-    rsgBindProgramFragment(gProgFragmentTexture);
-    rsgBindSampler(gProgFragmentTexture, 0, gLinearClamp);
-    rsgBindTexture(gProgFragmentTexture, 0, gTexOpaque);
+    if (modulate) {
+        rsgBindProgramFragment(gProgFragmentTextureModulate);
+        rsgBindSampler(gProgFragmentTextureModulate, 0, gLinearClamp);
+        rsgBindTexture(gProgFragmentTextureModulate, 0, gTexOpaque);
+
+        gFragData->modulate.r = 0.8f;
+        gFragData->modulate.g = 0.7f;
+        gFragData->modulate.b = 0.8f;
+        gFragData->modulate.a = 0.5f;
+        rsgAllocationSyncAll(rsGetAllocation(gFragData));
+    } else {
+        rsgBindProgramFragment(gProgFragmentTexture);
+        rsgBindSampler(gProgFragmentTexture, 0, gLinearClamp);
+        rsgBindTexture(gProgFragmentTexture, 0, gTexOpaque);
+    }
 
     for (int i = 0; i < quadCount; i ++) {
         float startX = 5 * i, startY = 5 * i;
@@ -128,7 +146,10 @@
             displayMultitextureSample(gData->blend == 1 ? true : false, gData->quadCount);
             break;
         case 1:
-            displaySingletexFill(gData->blend == 1 ? true : false, gData->quadCount);
+            displaySingletexFill(gData->blend == 1 ? true : false, gData->quadCount, false);
+            break;
+        case 2:
+            displaySingletexFill(gData->blend == 1 ? true : false, gData->quadCount, true);
             break;
         default:
             rsDebug("Wrong test number", 0);
diff --git a/tests/TileBenchmark/Android.mk b/tests/TileBenchmark/Android.mk
index 430f0f1..5851113 100644
--- a/tests/TileBenchmark/Android.mk
+++ b/tests/TileBenchmark/Android.mk
@@ -21,12 +21,8 @@
 
 LOCAL_PACKAGE_NAME := TileBenchmark
 
-include $(BUILD_PACKAGE)
+LOCAL_MODULE_TAGS := tests
 
-##################################################
-include $(CLEAR_VARS)
+LOCAL_JAVA_LIBRARIES := android.test.runner
 
-include $(BUILD_MULTI_PREBUILT)
-
-# Use the folloing include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
+include $(BUILD_PACKAGE)
\ No newline at end of file
diff --git a/tests/TileBenchmark/AndroidManifest.xml b/tests/TileBenchmark/AndroidManifest.xml
index ab61a9e..f125c70 100644
--- a/tests/TileBenchmark/AndroidManifest.xml
+++ b/tests/TileBenchmark/AndroidManifest.xml
@@ -18,5 +18,9 @@
                   android:label="@string/playback_activity"
                   android:theme="@android:style/Theme.Holo.NoActionBar">
         </activity>
+        <uses-library android:name="android.test.runner" />
     </application>
+    <instrumentation android:name="android.test.InstrumentationTestRunner"
+                     android:targetPackage="com.test.tilebenchmark"
+                     android:label="Tests for WebView Tiles."/>
 </manifest>
diff --git a/tests/TileBenchmark/tests/src/com/test/tilebenchmark/PerformanceTest.java b/tests/TileBenchmark/src/com/test/tilebenchmark/PerformanceTest.java
similarity index 98%
rename from tests/TileBenchmark/tests/src/com/test/tilebenchmark/PerformanceTest.java
rename to tests/TileBenchmark/src/com/test/tilebenchmark/PerformanceTest.java
index 6bf6f6b..cc39b75 100644
--- a/tests/TileBenchmark/tests/src/com/test/tilebenchmark/PerformanceTest.java
+++ b/tests/TileBenchmark/src/com/test/tilebenchmark/PerformanceTest.java
@@ -80,7 +80,7 @@
     private static final String URL_POSTFIX = "/index.html?skip=true";
     private static final int MAX_ITERATIONS = 4;
     private static final String TEST_DIRS[] = {
-        "intl1"//, "alexa_us", "android", "dom", "intl2", "moz", "moz2"
+        "alexa25_2011"//, "alexa_us", "android", "dom", "intl2", "moz", "moz2"
     };
 
     public PerformanceTest() {
diff --git a/tests/TileBenchmark/tests/Android.mk b/tests/TileBenchmark/tests/Android.mk
deleted file mode 100644
index 8b235ec..0000000
--- a/tests/TileBenchmark/tests/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-
-# Include all test java files.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := TileBenchmarkTests
-
-LOCAL_INSTRUMENTATION_FOR := TileBenchmark
-
-include $(BUILD_PACKAGE)
diff --git a/tests/TileBenchmark/tests/AndroidManifest.xml b/tests/TileBenchmark/tests/AndroidManifest.xml
deleted file mode 100644
index 703b152..0000000
--- a/tests/TileBenchmark/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.test.tilebenchmark.tests">
-
-    <application>
-        <uses-library android:name="android.test.runner" />
-    </application>
-
-    <instrumentation android:name="android.test.InstrumentationTestRunner"
-                     android:targetPackage="com.test.tilebenchmark"
-                     android:label="Tests for WebView Tiles."/>
-</manifest>
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index d7ac15e..89942de 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -425,6 +425,7 @@
 /*
  * Handle the "dump" command, to extract select data from an archive.
  */
+extern char CONSOLE_DATA[2925]; // see EOF
 int doDump(Bundle* bundle)
 {
     status_t result = UNKNOWN_ERROR;
@@ -1380,6 +1381,8 @@
                 }
                 delete dir;
             }
+        } else if (strcmp("badger", option) == 0) {
+            printf(CONSOLE_DATA);
         } else if (strcmp("configurations", option) == 0) {
             Vector<ResTable_config> configs;
             res.getConfigurations(&configs);
@@ -1728,3 +1731,169 @@
 
     return NO_ERROR;
 }
+
+char CONSOLE_DATA[2925] = {
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 95, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 61, 63,
+    86, 35, 40, 46, 46, 95, 95, 95, 95, 97, 97, 44, 32, 46, 124, 42, 33, 83,
+    62, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 58, 46, 58, 59, 61, 59, 61, 81,
+    81, 81, 81, 66, 96, 61, 61, 58, 46, 46, 46, 58, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 46, 61, 59, 59, 59, 58, 106, 81, 81, 81, 81, 102, 59, 61, 59,
+    59, 61, 61, 61, 58, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 61, 59, 59,
+    59, 58, 109, 81, 81, 81, 81, 61, 59, 59, 59, 59, 59, 58, 59, 59, 46, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 46, 61, 59, 59, 59, 60, 81, 81, 81, 81, 87,
+    58, 59, 59, 59, 59, 59, 59, 61, 119, 44, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 46,
+    47, 61, 59, 59, 58, 100, 81, 81, 81, 81, 35, 58, 59, 59, 59, 59, 59, 58,
+    121, 81, 91, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 46, 109, 58, 59, 59, 61, 81, 81,
+    81, 81, 81, 109, 58, 59, 59, 59, 59, 61, 109, 81, 81, 76, 46, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 41, 87, 59, 61, 59, 41, 81, 81, 81, 81, 81, 81, 59, 61, 59,
+    59, 58, 109, 81, 81, 87, 39, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 60, 81, 91, 59,
+    59, 61, 81, 81, 81, 81, 81, 87, 43, 59, 58, 59, 60, 81, 81, 81, 76, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 52, 91, 58, 45, 59, 87, 81, 81, 81, 81,
+    70, 58, 58, 58, 59, 106, 81, 81, 81, 91, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 93, 40, 32, 46, 59, 100, 81, 81, 81, 81, 40, 58, 46, 46, 58, 100, 81,
+    81, 68, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 46, 46, 46, 32, 46, 46, 46, 32, 46, 32, 46, 45, 91, 59, 61, 58, 109,
+    81, 81, 81, 87, 46, 58, 61, 59, 60, 81, 81, 80, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32,
+    32, 32, 32, 32, 32, 32, 32, 46, 46, 61, 59, 61, 61, 61, 59, 61, 61, 59,
+    59, 59, 58, 58, 46, 46, 41, 58, 59, 58, 81, 81, 81, 81, 69, 58, 59, 59,
+    60, 81, 81, 68, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 58, 59,
+    61, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 61, 61, 46,
+    61, 59, 93, 81, 81, 81, 81, 107, 58, 59, 58, 109, 87, 68, 96, 32, 32, 32,
+    46, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 10, 32, 32, 32, 46, 60, 61, 61, 59, 59, 59, 59, 59, 59, 59, 59,
+    59, 59, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 115, 109, 68, 41, 36, 81,
+    109, 46, 61, 61, 81, 69, 96, 46, 58, 58, 46, 58, 46, 46, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 46, 32, 95, 81,
+    67, 61, 61, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
+    59, 59, 59, 59, 58, 68, 39, 61, 105, 61, 63, 81, 119, 58, 106, 80, 32, 58,
+    61, 59, 59, 61, 59, 61, 59, 61, 46, 95, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 10, 32, 32, 36, 81, 109, 105, 59, 61, 59, 59, 59,
+    59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 46, 58, 37,
+    73, 108, 108, 62, 52, 81, 109, 34, 32, 61, 59, 59, 59, 59, 59, 59, 59, 59,
+    59, 61, 59, 61, 61, 46, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10,
+    32, 46, 45, 57, 101, 43, 43, 61, 61, 59, 59, 59, 59, 59, 59, 61, 59, 59,
+    59, 59, 59, 59, 59, 59, 59, 58, 97, 46, 61, 108, 62, 126, 58, 106, 80, 96,
+    46, 61, 61, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 61, 61,
+    97, 103, 97, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 45, 46, 32,
+    46, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 45, 58, 59, 59, 59, 59, 61,
+    119, 81, 97, 124, 105, 124, 124, 39, 126, 95, 119, 58, 61, 58, 59, 59, 59,
+    59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 61, 119, 81, 81, 99, 32, 32,
+    32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 58, 59, 59, 58, 106, 81, 81, 81, 109, 119,
+    119, 119, 109, 109, 81, 81, 122, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59,
+    59, 59, 59, 59, 59, 58, 115, 81, 87, 81, 102, 32, 32, 32, 32, 32, 32, 10,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 61, 58, 59, 61, 81, 81, 81, 81, 81, 81, 87, 87, 81, 81, 81, 81,
+    81, 58, 59, 59, 59, 59, 59, 59, 59, 59, 58, 45, 45, 45, 59, 59, 59, 41,
+    87, 66, 33, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 58, 59, 59, 93, 81,
+    81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 40, 58, 59, 59, 59, 58,
+    45, 32, 46, 32, 32, 32, 32, 32, 46, 32, 126, 96, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 58, 61, 59, 58, 81, 81, 81, 81, 81, 81, 81, 81,
+    81, 81, 81, 81, 81, 40, 58, 59, 59, 59, 58, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 58,
+    59, 59, 58, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 40, 58,
+    59, 59, 59, 46, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 58, 61, 59, 60, 81, 81, 81, 81,
+    81, 81, 81, 81, 81, 81, 81, 81, 81, 59, 61, 59, 59, 61, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 58, 59, 59, 93, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
+    81, 81, 40, 59, 59, 59, 59, 32, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 58, 61, 58, 106,
+    81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 76, 58, 59, 59, 59,
+    32, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 61, 58, 58, 81, 81, 81, 81, 81, 81, 81, 81,
+    81, 81, 81, 81, 81, 87, 58, 59, 59, 59, 59, 32, 46, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    58, 59, 61, 41, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 87, 59,
+    61, 58, 59, 59, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 58, 61, 58, 61, 81, 81, 81,
+    81, 81, 81, 81, 81, 81, 81, 81, 81, 107, 58, 59, 59, 59, 59, 58, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 58, 59, 59, 58, 51, 81, 81, 81, 81, 81, 81, 81, 81, 81,
+    81, 102, 94, 59, 59, 59, 59, 59, 61, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 58, 61, 59,
+    59, 59, 43, 63, 36, 81, 81, 81, 87, 64, 86, 102, 58, 59, 59, 59, 59, 59,
+    59, 59, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 46, 61, 59, 59, 59, 59, 59, 59, 59, 43, 33,
+    58, 126, 126, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 32, 46, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 46,
+    61, 59, 59, 59, 58, 45, 58, 61, 59, 58, 58, 58, 61, 59, 59, 59, 59, 59,
+    59, 59, 59, 59, 59, 59, 59, 58, 32, 46, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 46, 61, 59, 59, 59, 59, 59, 58, 95,
+    32, 45, 61, 59, 61, 59, 59, 59, 59, 59, 59, 59, 45, 58, 59, 59, 59, 59,
+    61, 58, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 58, 61, 59, 59, 59, 59, 59, 61, 59, 61, 46, 46, 32, 45, 45, 45,
+    59, 58, 45, 45, 46, 58, 59, 59, 59, 59, 59, 59, 61, 46, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 46, 58, 59, 59, 59, 59,
+    59, 59, 59, 59, 59, 61, 59, 46, 32, 32, 46, 32, 46, 32, 58, 61, 59, 59,
+    59, 59, 59, 59, 59, 59, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 45, 59, 59, 59, 59, 59, 59, 59, 59, 58, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 61, 59, 59, 59, 59, 59, 59, 59, 58, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    46, 61, 59, 59, 59, 59, 59, 59, 59, 32, 46, 32, 32, 32, 32, 32, 32, 61,
+    46, 61, 59, 59, 59, 59, 59, 59, 58, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 61, 59, 59, 59, 59, 59, 59,
+    59, 59, 32, 46, 32, 32, 32, 32, 32, 32, 32, 46, 61, 58, 59, 59, 59, 59,
+    59, 58, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 58, 59, 59, 59, 59, 59, 59, 59, 59, 46, 46, 32, 32, 32,
+    32, 32, 32, 32, 61, 59, 59, 59, 59, 59, 59, 59, 45, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 46, 32, 45, 61,
+    59, 59, 59, 59, 59, 58, 32, 46, 32, 32, 32, 32, 32, 32, 32, 58, 59, 59,
+    59, 59, 59, 58, 45, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 45, 45, 32, 46, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 45, 61, 59, 58, 45, 45, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 46, 32, 32, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10
+  };
diff --git a/tools/aapt/ZipEntry.cpp b/tools/aapt/ZipEntry.cpp
index 1f3c93c..b575988 100644
--- a/tools/aapt/ZipEntry.cpp
+++ b/tools/aapt/ZipEntry.cpp
@@ -90,7 +90,7 @@
      * prefer the CDE values.)
      */
     if (!hasDD && !compareHeaders()) {
-        LOGW("warning: header mismatch\n");
+        ALOGW("warning: header mismatch\n");
         // keep going?
     }
 
diff --git a/tools/aapt/ZipFile.cpp b/tools/aapt/ZipFile.cpp
index a2d5b80..0705be3 100644
--- a/tools/aapt/ZipFile.cpp
+++ b/tools/aapt/ZipFile.cpp
@@ -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;
     }
@@ -780,7 +780,7 @@
     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 {
             ALOGD("Call to deflateInit2 failed (zerr=%d)\n", zerr);
@@ -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;
             }
 
diff --git a/voip/jni/rtp/AudioGroup.cpp b/voip/jni/rtp/AudioGroup.cpp
index 270b494..4db5738 100644
--- a/voip/jni/rtp/AudioGroup.cpp
+++ b/voip/jni/rtp/AudioGroup.cpp
@@ -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;
@@ -573,7 +573,7 @@
 {
     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,7 +611,7 @@
     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;
     }
 
@@ -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;
     }
 
@@ -699,7 +699,7 @@
         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;
@@ -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,7 +792,7 @@
         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;
     }
     ALOGD("reported frame count: output %d, input %d", output, input);
@@ -812,7 +812,7 @@
         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;
     }
     ALOGD("latency: output %d, input %d", track.latency(), record.latency());
@@ -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,14 +900,14 @@
                     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);
         }
 
@@ -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/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;