diff options
Diffstat (limited to 'cmds')
| -rw-r--r-- | cmds/app_process/app_main.cpp | 6 | ||||
| -rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 10 | ||||
| -rw-r--r-- | cmds/bootanimation/bootanimation_main.cpp | 2 | ||||
| -rw-r--r-- | cmds/dumpstate/dumpstate.c | 14 | ||||
| -rw-r--r-- | cmds/dumpsys/dumpsys.cpp | 2 | ||||
| -rw-r--r-- | cmds/installd/commands.c | 150 | ||||
| -rw-r--r-- | cmds/installd/installd.c | 38 | ||||
| -rw-r--r-- | cmds/installd/utils.c | 48 | ||||
| -rw-r--r-- | cmds/ip-up-vpn/ip-up-vpn.c | 16 | ||||
| -rw-r--r-- | cmds/keystore/keystore.cpp | 14 | ||||
| -rw-r--r-- | cmds/screencap/screencap.cpp | 5 | ||||
| -rw-r--r-- | cmds/screenshot/screenshot.c | 12 | ||||
| -rw-r--r-- | cmds/servicemanager/binder.c | 12 | ||||
| -rw-r--r-- | cmds/servicemanager/service_manager.c | 22 | ||||
| -rw-r--r-- | cmds/stagefright/record.cpp | 2 | ||||
| -rw-r--r-- | cmds/stagefright/sf2.cpp | 4 | ||||
| -rw-r--r-- | cmds/stagefright/stream.cpp | 4 | ||||
| -rw-r--r-- | cmds/system_server/library/system_init.cpp | 14 | ||||
| -rw-r--r-- | cmds/system_server/system_main.cpp | 4 |
19 files changed, 191 insertions, 188 deletions
diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp index f2be29fbe374..6fe358c7ee54 100644 --- a/cmds/app_process/app_main.cpp +++ b/cmds/app_process/app_main.cpp @@ -72,7 +72,7 @@ public: char* slashClassName = toSlashClassName(mClassName); mClass = env->FindClass(slashClassName); if (mClass == NULL) { - LOGE("ERROR: could not find class '%s'\n", mClassName); + ALOGE("ERROR: could not find class '%s'\n", mClassName); } free(slashClassName); @@ -82,7 +82,7 @@ public: virtual void onStarted() { sp<ProcessState> proc = ProcessState::self(); - LOGV("App process: starting thread pool.\n"); + ALOGV("App process: starting thread pool.\n"); proc->startThreadPool(); AndroidRuntime* ar = AndroidRuntime::getRuntime(); @@ -94,7 +94,7 @@ public: virtual void onZygoteInit() { sp<ProcessState> proc = ProcessState::self(); - LOGV("App process: starting thread pool.\n"); + ALOGV("App process: starting thread pool.\n"); proc->startThreadPool(); } diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 154dbb873575..0d5b4caa91b4 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -69,7 +69,7 @@ BootAnimation::~BootAnimation() { void BootAnimation::onFirstRef() { status_t err = mSession->linkToComposerDeath(this); - LOGE_IF(err, "linkToComposerDeath failed (%s) ", strerror(-err)); + ALOGE_IF(err, "linkToComposerDeath failed (%s) ", strerror(-err)); if (err == NO_ERROR) { run("BootAnimation", PRIORITY_DISPLAY); } @@ -83,7 +83,7 @@ sp<SurfaceComposerClient> BootAnimation::session() const { void BootAnimation::binderDied(const wp<IBinder>& who) { // woah, surfaceflinger died! - LOGD("SurfaceFlinger died, exiting..."); + ALOGD("SurfaceFlinger died, exiting..."); // calling requestExit() is not enough here because the Surface code // might be blocked on a condition variable that will never be updated. @@ -374,7 +374,7 @@ bool BootAnimation::movie() size_t numEntries = zip.getNumEntries(); ZipEntryRO desc = zip.findEntryByName("desc.txt"); FileMap* descMap = zip.createEntryFileMap(desc); - LOGE_IF(!descMap, "descMap is null"); + ALOGE_IF(!descMap, "descMap is null"); if (!descMap) { return false; } @@ -394,13 +394,13 @@ bool BootAnimation::movie() int fps, width, height, count, pause; char path[256]; if (sscanf(l, "%d %d %d", &width, &height, &fps) == 3) { - //LOGD("> w=%d, h=%d, fps=%d", fps, width, height); + //ALOGD("> w=%d, h=%d, fps=%d", fps, width, height); animation.width = width; animation.height = height; animation.fps = fps; } if (sscanf(l, "p %d %d %s", &count, &pause, path) == 3) { - //LOGD("> count=%d, pause=%d, path=%s", count, pause, path); + //ALOGD("> count=%d, pause=%d, path=%s", count, pause, path); Animation::Part part; part.count = count; part.pause = pause; diff --git a/cmds/bootanimation/bootanimation_main.cpp b/cmds/bootanimation/bootanimation_main.cpp index 5f8b7441f4dc..ff809d369fb3 100644 --- a/cmds/bootanimation/bootanimation_main.cpp +++ b/cmds/bootanimation/bootanimation_main.cpp @@ -47,7 +47,7 @@ int main(int argc, char** argv) char value[PROPERTY_VALUE_MAX]; property_get("debug.sf.nobootanimation", value, "0"); int noBootAnimation = atoi(value); - LOGI_IF(noBootAnimation, "boot animation disabled"); + ALOGI_IF(noBootAnimation, "boot animation disabled"); if (!noBootAnimation) { sp<ProcessState> proc(ProcessState::self()); diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c index 395c28bbd89a..afa4f4db10a0 100644 --- a/cmds/dumpstate/dumpstate.c +++ b/cmds/dumpstate/dumpstate.c @@ -84,9 +84,9 @@ static void dumpstate() { dump_file("BUDDYINFO", "/proc/buddyinfo"); if (screenshot_path[0]) { - LOGI("taking screenshot\n"); + ALOGI("taking screenshot\n"); run_command(NULL, 5, "su", "root", "screenshot", screenshot_path, NULL); - LOGI("wrote screenshot: %s\n", screenshot_path); + ALOGI("wrote screenshot: %s\n", screenshot_path); } run_command("SYSTEM LOG", 20, "logcat", "-v", "threadtime", "-d", "*:v", NULL); @@ -271,7 +271,7 @@ int main(int argc, char *argv[]) { int use_socket = 0; int do_fb = 0; - LOGI("begin\n"); + ALOGI("begin\n"); /* set as high priority, and protect from OOM killer */ setpriority(PRIO_PROCESS, 0, -20); @@ -317,15 +317,15 @@ int main(int argc, char *argv[]) { /* 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; } } @@ -386,7 +386,7 @@ int main(int argc, char *argv[]) { fprintf(stderr, "rename(%s, %s): %s\n", tmp_path, path, strerror(errno)); } - LOGI("done\n"); + ALOGI("done\n"); return 0; } diff --git a/cmds/dumpsys/dumpsys.cpp b/cmds/dumpsys/dumpsys.cpp index fdc5d5d63ecf..7dad6b625b6a 100644 --- a/cmds/dumpsys/dumpsys.cpp +++ b/cmds/dumpsys/dumpsys.cpp @@ -31,7 +31,7 @@ int main(int argc, char* const argv[]) 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 4ede33f73daf..dd92bbe499bc 100644 --- a/cmds/installd/commands.c +++ b/cmds/installd/commands.c @@ -30,47 +30,47 @@ int install(const char *pkgname, uid_t uid, gid_t gid) 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 @@ int renamepkg(const char *oldpkgname, const char *newpkgname) 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 @@ int make_user_data(const char *pkgname, uid_t uid, uid_t persona) 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 @@ static int64_t disk_free() if (statfs(android_data_dir.path, &sfs) == 0) { return sfs.f_bavail * sfs.f_bsize; } else { - LOGE("Couldn't statfs %s: %s\n", android_data_dir.path, strerror(errno)); + ALOGE("Couldn't statfs %s: %s\n", android_data_dir.path, strerror(errno)); return -1; } } @@ -189,17 +189,17 @@ int free_cache(int64_t free_size) avail = disk_free(); if (avail < 0) return -1; - LOGI("free_cache(%" PRId64 ") avail %" PRId64 "\n", free_size, avail); + ALOGI("free_cache(%" PRId64 ") avail %" PRId64 "\n", free_size, avail); if (avail >= free_size) return 0; if (create_persona_path(datadir, 0)) { - LOGE("couldn't get directory for persona 0"); + ALOGE("couldn't get directory for persona 0"); return -1; } d = opendir(datadir); if (d == NULL) { - LOGE("cannot open %s: %s\n", datadir, strerror(errno)); + ALOGE("cannot open %s: %s\n", datadir, strerror(errno)); return -1; } dfd = dirfd(d); @@ -243,9 +243,9 @@ int move_dex(const char *src, const char *dst) if (create_cache_path(src_dex, src)) return -1; if (create_cache_path(dst_dex, dst)) return -1; - LOGV("move %s -> %s\n", src_dex, dst_dex); + ALOGV("move %s -> %s\n", src_dex, dst_dex); if (rename(src_dex, dst_dex) < 0) { - LOGE("Couldn't move %s: %s\n", src_dex, strerror(errno)); + ALOGE("Couldn't move %s: %s\n", src_dex, strerror(errno)); return -1; } else { return 0; @@ -259,9 +259,9 @@ int rm_dex(const char *path) if (validate_apk_path(path)) return -1; if (create_cache_path(dex_path, path)) return -1; - LOGV("unlink %s\n", dex_path); + ALOGV("unlink %s\n", dex_path); if (unlink(dex_path) < 0) { - LOGE("Couldn't unlink %s: %s\n", dex_path, strerror(errno)); + ALOGE("Couldn't unlink %s: %s\n", dex_path, strerror(errno)); return -1; } else { return 0; @@ -281,12 +281,12 @@ int protect(char *pkgname, gid_t gid) 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 @@ static void run_dexopt(int zip_fd, int odex_fd, const char* input_file_name, execl(DEX_OPT_BIN, DEX_OPT_BIN, "--zip", zip_num, odex_num, input_file_name, dexopt_flags, (char*) NULL); - LOGE("execl(%s) failed: %s\n", DEX_OPT_BIN, strerror(errno)); + ALOGE("execl(%s) failed: %s\n", DEX_OPT_BIN, strerror(errno)); } static int wait_dexopt(pid_t pid, const char* apk_path) @@ -463,16 +463,16 @@ static int wait_dexopt(pid_t pid, const char* apk_path) } } if (got_pid != pid) { - LOGW("waitpid failed: wanted %d, got %d: %s\n", + ALOGW("waitpid failed: wanted %d, got %d: %s\n", (int) pid, (int) got_pid, strerror(errno)); return 1; } if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { - LOGV("DexInv: --- END '%s' (success) ---\n", apk_path); + ALOGV("DexInv: --- END '%s' (success) ---\n", apk_path); return 0; } else { - LOGW("DexInv: --- END '%s' --- status=0x%04x, process failed\n", + ALOGW("DexInv: --- END '%s' --- status=0x%04x, process failed\n", apk_path, status); return status; /* always nonzero */ } @@ -515,43 +515,43 @@ int dexopt(const char *apk_path, uid_t uid, int is_public) zip_fd = open(apk_path, O_RDONLY, 0); if (zip_fd < 0) { - LOGE("dexopt cannot open '%s' for input\n", apk_path); + ALOGE("dexopt cannot open '%s' for input\n", apk_path); return -1; } unlink(dex_path); odex_fd = open(dex_path, O_RDWR | O_CREAT | O_EXCL, 0644); if (odex_fd < 0) { - LOGE("dexopt cannot open '%s' for output\n", dex_path); + ALOGE("dexopt cannot open '%s' for output\n", dex_path); goto fail; } if (fchown(odex_fd, AID_SYSTEM, uid) < 0) { - LOGE("dexopt cannot chown '%s'\n", dex_path); + ALOGE("dexopt cannot chown '%s'\n", dex_path); goto fail; } if (fchmod(odex_fd, S_IRUSR|S_IWUSR|S_IRGRP | (is_public ? S_IROTH : 0)) < 0) { - LOGE("dexopt cannot chmod '%s'\n", dex_path); + ALOGE("dexopt cannot chmod '%s'\n", dex_path); goto fail; } - LOGV("DexInv: --- BEGIN '%s' ---\n", apk_path); + ALOGV("DexInv: --- BEGIN '%s' ---\n", apk_path); pid_t pid; pid = fork(); if (pid == 0) { /* child -- drop privileges before continuing */ if (setgid(uid) != 0) { - LOGE("setgid(%d) failed during dexopt\n", uid); + ALOGE("setgid(%d) failed during dexopt\n", uid); exit(64); } if (setuid(uid) != 0) { - LOGE("setuid(%d) during dexopt\n", uid); + ALOGE("setuid(%d) during dexopt\n", uid); exit(65); } if (flock(odex_fd, LOCK_EX | LOCK_NB) != 0) { - LOGE("flock(%s) failed: %s\n", dex_path, strerror(errno)); + ALOGE("flock(%s) failed: %s\n", dex_path, strerror(errno)); exit(66); } @@ -560,7 +560,7 @@ int dexopt(const char *apk_path, uid_t uid, int is_public) } else { res = wait_dexopt(pid, apk_path); if (res != 0) { - LOGE("dexopt failed on '%s' res = %d\n", dex_path, res); + ALOGE("dexopt failed on '%s' res = %d\n", dex_path, res); goto fail; } } @@ -591,11 +591,11 @@ void mkinnerdirs(char* path, int basepos, mode_t mode, int uid, int gid, if (path[basepos] == '/') { path[basepos] = 0; if (lstat(path, statbuf) < 0) { - LOGV("Making directory: %s\n", path); + ALOGV("Making directory: %s\n", path); if (mkdir(path, mode) == 0) { chown(path, uid, gid); } else { - LOGW("Unable to make directory %s: %s\n", path, strerror(errno)); + ALOGW("Unable to make directory %s: %s\n", path, strerror(errno)); } } path[basepos] = '/'; @@ -616,22 +616,22 @@ int movefileordir(char* srcpath, char* dstpath, int dstbasepos, int dstend = strlen(dstpath); if (lstat(srcpath, statbuf) < 0) { - LOGW("Unable to stat %s: %s\n", srcpath, strerror(errno)); + ALOGW("Unable to stat %s: %s\n", srcpath, strerror(errno)); return 1; } if ((statbuf->st_mode&S_IFDIR) == 0) { mkinnerdirs(dstpath, dstbasepos, S_IRWXU|S_IRWXG|S_IXOTH, dstuid, dstgid, statbuf); - LOGV("Renaming %s to %s (uid %d)\n", srcpath, dstpath, dstuid); + ALOGV("Renaming %s to %s (uid %d)\n", srcpath, dstpath, dstuid); if (rename(srcpath, dstpath) >= 0) { if (chown(dstpath, dstuid, dstgid) < 0) { - LOGE("cannot chown %s: %s\n", dstpath, strerror(errno)); + ALOGE("cannot chown %s: %s\n", dstpath, strerror(errno)); unlink(dstpath); return 1; } } else { - LOGW("Unable to rename %s to %s: %s\n", + ALOGW("Unable to rename %s to %s: %s\n", srcpath, dstpath, strerror(errno)); return 1; } @@ -640,7 +640,7 @@ int movefileordir(char* srcpath, char* dstpath, int dstbasepos, 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 @@ int movefileordir(char* srcpath, char* dstpath, int dstbasepos, } 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 @@ int movefiles() } else { subfd = openat(dfd, name, O_RDONLY); if (subfd < 0) { - LOGW("Unable to open update commands at %s%s\n", + ALOGW("Unable to open update commands at %s%s\n", UPDATE_COMMANDS_DIR_PREFIX, name); continue; } @@ -732,7 +732,7 @@ int movefiles() } if (bufi < bufe) { buf[bufi] = 0; - LOGV("Processing line: %s\n", buf+bufp); + ALOGV("Processing line: %s\n", buf+bufp); hasspace = 0; while (bufp < bufi && isspace(buf[bufp])) { hasspace = 1; @@ -742,12 +742,12 @@ int movefiles() // skip comments and empty lines. } else if (hasspace) { if (dstpkg[0] == 0) { - LOGW("Path before package line in %s%s: %s\n", + ALOGW("Path before package line in %s%s: %s\n", UPDATE_COMMANDS_DIR_PREFIX, name, buf+bufp); } else if (srcpkg[0] == 0) { // Skip -- source package no longer exists. } else { - LOGV("Move file: %s (from %s to %s)\n", buf+bufp, srcpkg, dstpkg); + ALOGV("Move file: %s (from %s to %s)\n", buf+bufp, srcpkg, dstpkg); if (!create_move_path(srcpath, srcpkg, buf+bufp, 0) && !create_move_path(dstpath, dstpkg, buf+bufp, 0)) { movefileordir(srcpath, dstpath, @@ -758,7 +758,7 @@ int movefiles() } 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 @@ int movefiles() 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 @@ int movefiles() } } else { srcpkg[0] = 0; - LOGW("Can't create path %s in %s%s\n", + ALOGW("Can't create path %s in %s%s\n", div, UPDATE_COMMANDS_DIR_PREFIX, name); } if (srcpkg[0] != 0) { @@ -802,11 +802,11 @@ int movefiles() } } else { srcpkg[0] = 0; - LOGW("Can't create path %s in %s%s\n", + ALOGW("Can't create path %s in %s%s\n", div, UPDATE_COMMANDS_DIR_PREFIX, name); } } - LOGV("Transfering from %s to %s: uid=%d\n", + ALOGV("Transfering from %s to %s: uid=%d\n", srcpkg, dstpkg, dstuid); } } @@ -815,7 +815,7 @@ int movefiles() } 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 @@ int movefiles() } readlen = read(subfd, buf+bufe, PKG_PATH_MAX-bufe); if (readlen < 0) { - LOGW("Failure reading update commands in %s%s: %s\n", + ALOGW("Failure reading update commands in %s%s: %s\n", UPDATE_COMMANDS_DIR_PREFIX, name, strerror(errno)); break; } else if (readlen == 0) { @@ -833,7 +833,7 @@ int movefiles() } bufe += readlen; buf[bufe] = 0; - LOGV("Read buf: %s\n", buf); + ALOGV("Read buf: %s\n", buf); } } close(subfd); @@ -852,30 +852,30 @@ int linklib(const char* dataDir, const char* asecLibDir) 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 @@ int linklib(const char* dataDir, const char* asecLibDir) } 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 @@ int linklib(const char* dataDir, const char* asecLibDir) 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 @@ int unlinklib(const char* dataDir) } 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 @@ int unlinklib(const char* dataDir) } 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 @@ int unlinklib(const char* dataDir) 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 feb6b927dd9b..569b491be012 100644 --- a/cmds/installd/installd.c +++ b/cmds/installd/installd.c @@ -157,11 +157,11 @@ static int readx(int s, void *_buf, int count) 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 @@ static int writex(int s, const void *_buf, int count) r = write(s, buf + n, count - n); if (r < 0) { if (errno == EINTR) continue; - LOGE("write error: %s\n", strerror(errno)); + ALOGE("write error: %s\n", strerror(errno)); return -1; } n += r; @@ -200,7 +200,7 @@ static int execute(int s, char cmd[BUFFER_MAX]) unsigned short count; int ret = -1; -// LOGI("execute('%s')\n", cmd); +// ALOGI("execute('%s')\n", cmd); /* default reply is "" */ reply[0] = 0; @@ -213,7 +213,7 @@ static int execute(int s, char cmd[BUFFER_MAX]) n++; arg[n] = cmd; if (n == TOKEN_MAX) { - LOGE("too many arguments\n"); + ALOGE("too many arguments\n"); goto done; } } @@ -223,7 +223,7 @@ static int execute(int s, char cmd[BUFFER_MAX]) 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 @@ static int execute(int s, char cmd[BUFFER_MAX]) goto done; } } - LOGE("unsupported command '%s'\n", arg[0]); + ALOGE("unsupported command '%s'\n", arg[0]); done: if (reply[0]) { @@ -242,7 +242,7 @@ done: if (n > BUFFER_MAX) n = BUFFER_MAX; count = n; -// LOGI("reply: '%s'\n", cmd); +// ALOGI("reply: '%s'\n", cmd); if (writex(s, &count, sizeof(count))) return -1; if (writex(s, cmd, count)) return -1; return 0; @@ -290,7 +290,7 @@ int initialize_globals() { 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 main(const int argc, const char *argv[]) { int lsocket, s, count; if (initialize_globals() < 0) { - LOGE("Could not initialize globals; exiting.\n"); + ALOGE("Could not initialize globals; exiting.\n"); exit(1); } if (initialize_directories() < 0) { - LOGE("Could not create directories; exiting.\n"); + ALOGE("Could not create directories; exiting.\n"); exit(1); } lsocket = android_get_control_socket(SOCKET_PATH); if (lsocket < 0) { - LOGE("Failed to get socket from environment: %s\n", strerror(errno)); + ALOGE("Failed to get socket from environment: %s\n", strerror(errno)); exit(1); } if (listen(lsocket, 5)) { - LOGE("Listen on socket failed: %s\n", strerror(errno)); + ALOGE("Listen on socket failed: %s\n", strerror(errno)); exit(1); } fcntl(lsocket, F_SETFD, FD_CLOEXEC); @@ -375,30 +375,30 @@ int main(const int argc, const char *argv[]) { alen = sizeof(addr); s = accept(lsocket, &addr, &alen); if (s < 0) { - LOGE("Accept failed: %s\n", strerror(errno)); + ALOGE("Accept failed: %s\n", strerror(errno)); continue; } fcntl(s, F_SETFD, FD_CLOEXEC); - LOGI("new connection\n"); + ALOGI("new connection\n"); for (;;) { unsigned short count; if (readx(s, &count, sizeof(count))) { - LOGE("failed to read size\n"); + ALOGE("failed to read size\n"); break; } if ((count < 1) || (count >= BUFFER_MAX)) { - LOGE("invalid size %d\n", count); + ALOGE("invalid size %d\n", count); break; } if (readx(s, buf, count)) { - LOGE("failed to read command\n"); + ALOGE("failed to read command\n"); break; } buf[count] = 0; if (execute(s, buf)) break; } - LOGI("closing connection\n"); + ALOGI("closing connection\n"); close(s); } diff --git a/cmds/installd/utils.c b/cmds/installd/utils.c index a53a93ce1073..52ec9e86a44a 100644 --- a/cmds/installd/utils.c +++ b/cmds/installd/utils.c @@ -42,7 +42,7 @@ int create_pkg_path_in_dir(char path[PKG_PATH_MAX], 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 @@ int create_pkg_path(char path[PKG_PATH_MAX], 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 @@ int create_persona_path(char path[PKG_PATH_MAX], 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 @@ int is_valid_package_name(const char* pkgname) { } 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 @@ int is_valid_package_name(const char* pkgname) { 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 @@ int is_valid_package_name(const char* pkgname) { 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 @@ static int _delete_dir_contents(DIR *d, const char *ignore) 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 @@ static int _delete_dir_contents(DIR *d, const char *ignore) } 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 @@ int delete_dir_contents(const char *pathname, 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 @@ int delete_dir_contents_fd(int dfd, const char *name) 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 @@ int validate_system_app_path(const char* path) { 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 @@ int get_path_from_env(dir_rec_t* rec, const char* var) { 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 @@ int get_path_from_string(dir_rec_t* rec, const char* path) { 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 @@ int copy_and_append(dir_rec_t* dst, const dir_rec_t* src, const char* suffix) { 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 @@ int validate_apk_path(const char *path) 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 @@ int validate_apk_path(const char *path) ++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 @@ int validate_apk_path(const char *path) */ 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 0e6286f9279c..9fcc950c229a 100644 --- a/cmds/ip-up-vpn/ip-up-vpn.c +++ b/cmds/ip-up-vpn/ip-up-vpn.c @@ -67,7 +67,7 @@ int main(int argc, char **argv) { 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 @@ int main(int argc, char **argv) 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 @@ int main(int argc, char **argv) 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 @@ int main(int argc, char **argv) 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 @@ int main(int argc, char **argv) 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 4b4b9b9d4adb..05f77e5326d9 100644 --- a/cmds/keystore/keystore.cpp +++ b/cmds/keystore/keystore.cpp @@ -133,7 +133,7 @@ public: 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 @@ static ResponseCode process(KeyStore* keyStore, int sock, uid_t uid, int8_t code 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 @@ int main(int argc, char* argv[]) { return 1; } if (listen(controlSocket, 3) == -1) { - LOGE("listen: %s", strerror(errno)); + ALOGE("listen: %s", strerror(errno)); return 1; } @@ -785,7 +785,7 @@ int main(int argc, char* argv[]) { socklen_t size = sizeof(cred); int credResult = getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &cred, &size); if (credResult != 0) { - LOGW("getsockopt: %s", strerror(errno)); + ALOGW("getsockopt: %s", strerror(errno)); } else { int8_t request; if (recv_code(sock, &request)) { @@ -796,7 +796,7 @@ int main(int argc, char* argv[]) { } else { send_code(sock, response); } - LOGI("uid: %d action: %c -> %d state: %d -> %d retry: %d", + ALOGI("uid: %d action: %c -> %d state: %d -> %d retry: %d", cred.uid, request, response, old_state, keyStore.getState(), @@ -805,6 +805,6 @@ int main(int argc, char* argv[]) { } close(sock); } - LOGE("accept: %s", strerror(errno)); + ALOGE("accept: %s", strerror(errno)); return 1; } diff --git a/cmds/screencap/screencap.cpp b/cmds/screencap/screencap.cpp index 7a599e93e73b..bee5880ac4cc 100644 --- a/cmds/screencap/screencap.cpp +++ b/cmds/screencap/screencap.cpp @@ -28,6 +28,7 @@ #include <SkImageEncoder.h> #include <SkBitmap.h> +#include <SkData.h> #include <SkStream.h> using namespace android; @@ -168,7 +169,9 @@ int main(int argc, char** argv) SkDynamicMemoryWStream stream; SkImageEncoder::EncodeStream(&stream, b, SkImageEncoder::kPNG_Type, SkImageEncoder::kDefaultQuality); - write(fd, stream.getStream(), stream.getOffset()); + SkData* streamData = stream.copyToData(); + write(fd, streamData->data(), streamData->size()); + streamData->unref(); } else { write(fd, &w, 4); write(fd, &h, 4); diff --git a/cmds/screenshot/screenshot.c b/cmds/screenshot/screenshot.c index 048636c64e53..cca80c3c1abd 100644 --- a/cmds/screenshot/screenshot.c +++ b/cmds/screenshot/screenshot.c @@ -26,20 +26,20 @@ void take_screenshot(FILE *fb_in, FILE *fb_out) { 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 @@ void take_screenshot(FILE *fb_in, FILE *fb_out) { 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 @@ void take_screenshot(FILE *fb_in, FILE *fb_out) { 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 b03b62040b2f..918d4d4e9633 100644 --- a/cmds/servicemanager/binder.c +++ b/cmds/servicemanager/binder.c @@ -219,7 +219,7 @@ int binder_parse(struct binder_state *bs, struct binder_io *bio, 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 @@ int binder_parse(struct binder_state *bs, struct binder_io *bio, 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 @@ int binder_parse(struct binder_state *bs, struct binder_io *bio, r = -1; break; default: - LOGE("parse: OOPS %d\n", cmd); + ALOGE("parse: OOPS %d\n", cmd); return -1; } } @@ -375,17 +375,17 @@ void binder_loop(struct binder_state *bs, binder_handler func) 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 2df450f34def..42d8977339ee 100644 --- a/cmds/servicemanager/service_manager.c +++ b/cmds/servicemanager/service_manager.c @@ -11,8 +11,8 @@ #include "binder.h" #if 0 -#define LOGI(x...) fprintf(stderr, "svcmgr: " x) -#define LOGE(x...) fprintf(stderr, "svcmgr: " x) +#define ALOGI(x...) fprintf(stderr, "svcmgr: " x) +#define ALOGE(x...) fprintf(stderr, "svcmgr: " x) #else #define LOG_TAG "ServiceManager" #include <cutils/log.h> @@ -115,7 +115,7 @@ struct svcinfo *find_svc(uint16_t *s16, unsigned len) void svcinfo_death(struct binder_state *bs, void *ptr) { struct svcinfo *si = ptr; - LOGI("service '%s' died\n", str8(si->name)); + ALOGI("service '%s' died\n", str8(si->name)); if (si->ptr) { binder_release(bs, si->ptr); si->ptr = 0; @@ -133,7 +133,7 @@ void *do_find_service(struct binder_state *bs, uint16_t *s, unsigned len) struct svcinfo *si; si = find_svc(s, len); -// LOGI("check_service('%s') ptr = %p\n", str8(s), si ? si->ptr : 0); +// ALOGI("check_service('%s') ptr = %p\n", str8(s), si ? si->ptr : 0); if (si && si->ptr) { return si->ptr; } else { @@ -146,13 +146,13 @@ int do_add_service(struct binder_state *bs, void *ptr, unsigned uid) { struct svcinfo *si; -// LOGI("add_service('%s',%p) uid=%d\n", str8(s), ptr, uid); +// ALOGI("add_service('%s',%p) uid=%d\n", str8(s), ptr, uid); if (!ptr || (len == 0) || (len > 127)) return -1; if (!svc_can_register(uid, s)) { - LOGE("add_service('%s',%p) uid=%d - PERMISSION DENIED\n", + ALOGE("add_service('%s',%p) uid=%d - PERMISSION DENIED\n", str8(s), ptr, uid); return -1; } @@ -160,7 +160,7 @@ int do_add_service(struct binder_state *bs, 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 @@ int do_add_service(struct binder_state *bs, } else { si = malloc(sizeof(*si) + (len + 1) * sizeof(uint16_t)); if (!si) { - LOGE("add_service('%s',%p) uid=%d - OUT OF MEMORY\n", + ALOGE("add_service('%s',%p) uid=%d - OUT OF MEMORY\n", str8(s), ptr, uid); return -1; } @@ -198,7 +198,7 @@ int svcmgr_handler(struct binder_state *bs, void *ptr; uint32_t strict_policy; -// LOGI("target=%p code=%d pid=%d uid=%d\n", +// ALOGI("target=%p code=%d pid=%d uid=%d\n", // txn->target, txn->code, txn->sender_pid, txn->sender_euid); if (txn->target != svcmgr_handle) @@ -246,7 +246,7 @@ int svcmgr_handler(struct binder_state *bs, return -1; } default: - LOGE("unknown code %d\n", txn->code); + ALOGE("unknown code %d\n", txn->code); return -1; } @@ -262,7 +262,7 @@ int main(int argc, char **argv) bs = binder_open(128*1024); if (binder_become_context_manager(bs)) { - LOGE("cannot become context manager (%s)\n", strerror(errno)); + ALOGE("cannot become context manager (%s)\n", strerror(errno)); return -1; } diff --git a/cmds/stagefright/record.cpp b/cmds/stagefright/record.cpp index b7182991eaea..613435df15e8 100644 --- a/cmds/stagefright/record.cpp +++ b/cmds/stagefright/record.cpp @@ -96,7 +96,7 @@ public: ++mNumFramesOutput; // printf("DummySource::read - returning buffer\n"); - // LOGI("DummySource::read - returning buffer"); + // ALOGI("DummySource::read - returning buffer"); return OK; } diff --git a/cmds/stagefright/sf2.cpp b/cmds/stagefright/sf2.cpp index f547e019171c..ae80f8804992 100644 --- a/cmds/stagefright/sf2.cpp +++ b/cmds/stagefright/sf2.cpp @@ -454,7 +454,7 @@ private: if (sizeNeeded > sizeLeft) { if (outBuffer->size() == 0) { - LOGE("Unable to fit even a single input buffer of size %d.", + ALOGE("Unable to fit even a single input buffer of size %d.", sizeNeeded); } CHECK_GT(outBuffer->size(), 0u); @@ -500,7 +500,7 @@ private: break; // Don't coalesce } - LOGV("coalesced %d input buffers", n); + ALOGV("coalesced %d input buffers", n); if (outBuffer->size() == 0) { CHECK_NE(mFinalResult, (status_t)OK); diff --git a/cmds/stagefright/stream.cpp b/cmds/stagefright/stream.cpp index bd430d182d53..0d6c738292da 100644 --- a/cmds/stagefright/stream.cpp +++ b/cmds/stagefright/stream.cpp @@ -90,7 +90,7 @@ void MyStreamSource::onBufferAvailable(size_t index) { #if 0 if (mNumPacketsSent >= 20000) { - LOGI("signalling discontinuity now"); + ALOGI("signalling discontinuity now"); off64_t offset = 0; CHECK((offset % 188) == 0); @@ -308,7 +308,7 @@ int main(int argc, char **argv) { ssize_t displayWidth = composerClient->getDisplayWidth(0); ssize_t displayHeight = composerClient->getDisplayHeight(0); - LOGV("display is %d x %d\n", displayWidth, displayHeight); + ALOGV("display is %d x %d\n", displayWidth, displayHeight); sp<SurfaceControl> control = composerClient->createSurface( diff --git a/cmds/system_server/library/system_init.cpp b/cmds/system_server/library/system_init.cpp index 59360d3c6287..bfbc13870717 100644 --- a/cmds/system_server/library/system_init.cpp +++ b/cmds/system_server/library/system_init.cpp @@ -42,7 +42,7 @@ public: virtual void binderDied(const wp<IBinder>& who) { - LOGI("Grim Reaper killing system_server..."); + ALOGI("Grim Reaper killing system_server..."); kill(getpid(), SIGKILL); } }; @@ -53,12 +53,12 @@ public: extern "C" status_t system_init() { - LOGI("Entered system_init()"); + ALOGI("Entered system_init()"); sp<ProcessState> proc(ProcessState::self()); sp<IServiceManager> sm = defaultServiceManager(); - LOGI("ServiceManager: %p\n", sm.get()); + ALOGI("ServiceManager: %p\n", sm.get()); sp<GrimReaper> grim = new GrimReaper(); sm->asBinder()->linkToDeath(grim, grim.get(), 0); @@ -82,10 +82,10 @@ extern "C" status_t system_init() // All other servers should just start the Android runtime at // the beginning of their processes's main(), before calling // the init function. - LOGI("System server: starting Android runtime.\n"); + ALOGI("System server: starting Android runtime.\n"); AndroidRuntime* runtime = AndroidRuntime::getRuntime(); - LOGI("System server: starting Android services.\n"); + ALOGI("System server: starting Android services.\n"); JNIEnv* env = runtime->getJNIEnv(); if (env == NULL) { return UNKNOWN_ERROR; @@ -100,10 +100,10 @@ extern "C" status_t system_init() } env->CallStaticVoidMethod(clazz, methodId); - LOGI("System server: entering thread pool.\n"); + ALOGI("System server: entering thread pool.\n"); ProcessState::self()->startThreadPool(); IPCThreadState::self()->joinThreadPool(); - LOGI("System server: exiting thread pool.\n"); + ALOGI("System server: exiting thread pool.\n"); return NO_ERROR; } diff --git a/cmds/system_server/system_main.cpp b/cmds/system_server/system_main.cpp index d67329d63f17..ddff065c916d 100644 --- a/cmds/system_server/system_main.cpp +++ b/cmds/system_server/system_main.cpp @@ -44,12 +44,12 @@ static void blockSignals() int main(int argc, const char* const argv[]) { - LOGI("System server is starting with pid=%d.\n", getpid()); + ALOGI("System server is starting with pid=%d.\n", getpid()); blockSignals(); // You can trust me, honestly! - LOGW("*** Current priority: %d\n", getpriority(PRIO_PROCESS, 0)); + ALOGW("*** Current priority: %d\n", getpriority(PRIO_PROCESS, 0)); setpriority(PRIO_PROCESS, 0, -1); system_init(); |