summaryrefslogtreecommitdiff
path: root/cmds
diff options
context:
space:
mode:
Diffstat (limited to 'cmds')
-rw-r--r--cmds/dumpstate/dumpstate.c2
-rw-r--r--cmds/dumpstate/utils.c3
-rw-r--r--cmds/installd/commands.c115
-rw-r--r--cmds/installd/installd.c24
-rw-r--r--cmds/installd/installd.h19
-rw-r--r--cmds/servicemanager/service_manager.c1
-rw-r--r--cmds/stagefright/sf2.cpp1
7 files changed, 44 insertions, 121 deletions
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index b1b7715a8aab..f74e3c83b2cd 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -143,7 +143,7 @@ static void dumpstate() {
dump_file("BINDER STATS", "/sys/kernel/debug/binder/stats");
dump_file("BINDER STATE", "/sys/kernel/debug/binder/state");
- run_command("FILESYSTEMS & FREE SPACE", 10, "df", NULL);
+ run_command("FILESYSTEMS & FREE SPACE", 10, "su", "root", "df", NULL);
dump_file("PACKAGE SETTINGS", "/data/system/packages.xml");
dump_file("PACKAGE UID ERRORS", "/data/system/uiderrors.txt");
diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c
index f92acbbbf332..b2f9e800dca7 100644
--- a/cmds/dumpstate/utils.c
+++ b/cmds/dumpstate/utils.c
@@ -167,6 +167,7 @@ int run_command(const char *title, int timeout_seconds, const char *command, ...
execvp(command, (char**) args);
printf("*** exec(%s): %s\n", command, strerror(errno));
+ fflush(stdout);
_exit(-1);
}
@@ -178,7 +179,7 @@ int run_command(const char *title, int timeout_seconds, const char *command, ...
if (p == pid) {
if (WIFSIGNALED(status)) {
printf("*** %s: Killed by signal %d\n", command, WTERMSIG(status));
- } else if (WEXITSTATUS(status) > 0) {
+ } else if (WIFEXITED(status) && WEXITSTATUS(status) > 0) {
printf("*** %s: Exit code %d\n", command, WEXITSTATUS(status));
}
if (title) printf("[%s: %.1fs elapsed]\n\n", command, elapsed);
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index cde1573743c1..4d49c30501f5 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -17,7 +17,7 @@
#include "installd.h"
#include <diskusage/dirsize.h>
-int install(const char *pkgname, int encrypted_fs_flag, uid_t uid, gid_t gid)
+int install(const char *pkgname, uid_t uid, gid_t gid)
{
char pkgdir[PKG_PATH_MAX];
char libdir[PKG_PATH_MAX];
@@ -27,17 +27,10 @@ int install(const char *pkgname, int encrypted_fs_flag, uid_t uid, gid_t gid)
return -1;
}
- if (encrypted_fs_flag == USE_UNENCRYPTED_FS) {
- if (create_pkg_path(pkgdir, PKG_DIR_PREFIX, pkgname, PKG_DIR_POSTFIX))
- return -1;
- if (create_pkg_path(libdir, PKG_LIB_PREFIX, pkgname, PKG_LIB_POSTFIX))
- return -1;
- } else {
- if (create_pkg_path(pkgdir, PKG_SEC_DIR_PREFIX, pkgname, PKG_DIR_POSTFIX))
- return -1;
- if (create_pkg_path(libdir, PKG_SEC_LIB_PREFIX, pkgname, PKG_LIB_POSTFIX))
- return -1;
- }
+ if (create_pkg_path(pkgdir, PKG_DIR_PREFIX, pkgname, PKG_DIR_POSTFIX))
+ return -1;
+ if (create_pkg_path(libdir, PKG_LIB_PREFIX, pkgname, PKG_LIB_POSTFIX))
+ return -1;
if (mkdir(pkgdir, 0751) < 0) {
LOGE("cannot create dir '%s': %s\n", pkgdir, strerror(errno));
@@ -62,38 +55,26 @@ int install(const char *pkgname, int encrypted_fs_flag, uid_t uid, gid_t gid)
return 0;
}
-int uninstall(const char *pkgname, int encrypted_fs_flag)
+int uninstall(const char *pkgname)
{
char pkgdir[PKG_PATH_MAX];
- if (encrypted_fs_flag == USE_UNENCRYPTED_FS) {
- if (create_pkg_path(pkgdir, PKG_DIR_PREFIX, pkgname, PKG_DIR_POSTFIX))
- return -1;
- } else {
- if (create_pkg_path(pkgdir, PKG_SEC_DIR_PREFIX, pkgname, PKG_DIR_POSTFIX))
- return -1;
- }
+ if (create_pkg_path(pkgdir, PKG_DIR_PREFIX, pkgname, PKG_DIR_POSTFIX))
+ return -1;
/* delete contents AND directory, no exceptions */
return delete_dir_contents(pkgdir, 1, 0);
}
-int renamepkg(const char *oldpkgname, const char *newpkgname, int encrypted_fs_flag)
+int renamepkg(const char *oldpkgname, const char *newpkgname)
{
char oldpkgdir[PKG_PATH_MAX];
char newpkgdir[PKG_PATH_MAX];
- if (encrypted_fs_flag == USE_UNENCRYPTED_FS) {
- if (create_pkg_path(oldpkgdir, PKG_DIR_PREFIX, oldpkgname, PKG_DIR_POSTFIX))
- return -1;
- if (create_pkg_path(newpkgdir, PKG_DIR_PREFIX, newpkgname, PKG_DIR_POSTFIX))
- return -1;
- } else {
- if (create_pkg_path(oldpkgdir, PKG_SEC_DIR_PREFIX, oldpkgname, PKG_DIR_POSTFIX))
- return -1;
- if (create_pkg_path(newpkgdir, PKG_SEC_DIR_PREFIX, newpkgname, PKG_DIR_POSTFIX))
- return -1;
- }
+ if (create_pkg_path(oldpkgdir, PKG_DIR_PREFIX, oldpkgname, PKG_DIR_POSTFIX))
+ return -1;
+ if (create_pkg_path(newpkgdir, PKG_DIR_PREFIX, newpkgname, PKG_DIR_POSTFIX))
+ return -1;
if (rename(oldpkgdir, newpkgdir) < 0) {
LOGE("cannot rename dir '%s' to '%s': %s\n", oldpkgdir, newpkgdir, strerror(errno));
@@ -102,41 +83,28 @@ int renamepkg(const char *oldpkgname, const char *newpkgname, int encrypted_fs_f
return 0;
}
-int delete_user_data(const char *pkgname, int encrypted_fs_flag)
+int delete_user_data(const char *pkgname)
{
char pkgdir[PKG_PATH_MAX];
- if (encrypted_fs_flag == USE_UNENCRYPTED_FS) {
- if (create_pkg_path(pkgdir, PKG_DIR_PREFIX, pkgname, PKG_DIR_POSTFIX))
- return -1;
- } else {
- if (create_pkg_path(pkgdir, PKG_SEC_DIR_PREFIX, pkgname, PKG_DIR_POSTFIX))
- return -1;
- }
+ if (create_pkg_path(pkgdir, PKG_DIR_PREFIX, pkgname, PKG_DIR_POSTFIX))
+ return -1;
/* delete contents, excluding "lib", but not the directory itself */
return delete_dir_contents(pkgdir, 0, "lib");
}
-int delete_cache(const char *pkgname, int encrypted_fs_flag)
+int delete_cache(const char *pkgname)
{
char cachedir[PKG_PATH_MAX];
- if (encrypted_fs_flag == USE_UNENCRYPTED_FS) {
- if (create_pkg_path(cachedir, CACHE_DIR_PREFIX, pkgname, CACHE_DIR_POSTFIX))
- return -1;
- } else {
- if (create_pkg_path(cachedir, CACHE_SEC_DIR_PREFIX, pkgname, CACHE_DIR_POSTFIX))
- return -1;
- }
+ if (create_pkg_path(cachedir, CACHE_DIR_PREFIX, pkgname, CACHE_DIR_POSTFIX))
+ return -1;
/* delete contents, not the directory, no exceptions */
return delete_dir_contents(cachedir, 0, 0);
}
-/* TODO(oam): depending on use case (ecryptfs or dmcrypt)
- * change implementation
- */
static int64_t disk_free()
{
struct statfs sfs;
@@ -169,39 +137,6 @@ int free_cache(int64_t free_size)
LOGI("free_cache(%" PRId64 ") avail %" PRId64 "\n", free_size, avail);
if (avail >= free_size) return 0;
- /* First try encrypted dir */
- d = opendir(PKG_SEC_DIR_PREFIX);
- if (d == NULL) {
- LOGE("cannot open %s: %s\n", PKG_SEC_DIR_PREFIX, strerror(errno));
- } else {
- dfd = dirfd(d);
-
- while ((de = readdir(d))) {
- if (de->d_type != DT_DIR) continue;
- name = de->d_name;
-
- /* always skip "." and ".." */
- if (name[0] == '.') {
- if (name[1] == 0) continue;
- if ((name[1] == '.') && (name[2] == 0)) continue;
- }
-
- subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY);
- if (subfd < 0) continue;
-
- delete_dir_contents_fd(subfd, "cache");
- close(subfd);
-
- avail = disk_free();
- if (avail >= free_size) {
- closedir(d);
- return 0;
- }
- }
- closedir(d);
- }
-
- /* Next try unencrypted dir... */
d = opendir(PKG_DIR_PREFIX);
if (d == NULL) {
LOGE("cannot open %s: %s\n", PKG_DIR_PREFIX, strerror(errno));
@@ -330,7 +265,7 @@ int protect(char *pkgname, gid_t gid)
int get_size(const char *pkgname, const char *apkpath,
const char *fwdlock_apkpath,
- int64_t *_codesize, int64_t *_datasize, int64_t *_cachesize, int encrypted_fs_flag)
+ int64_t *_codesize, int64_t *_datasize, int64_t *_cachesize)
{
DIR *d;
int dfd;
@@ -365,14 +300,8 @@ int get_size(const char *pkgname, const char *apkpath,
}
}
- if (encrypted_fs_flag == 0) {
- if (create_pkg_path(path, PKG_DIR_PREFIX, pkgname, PKG_DIR_POSTFIX)) {
- goto done;
- }
- } else {
- if (create_pkg_path(path, PKG_SEC_DIR_PREFIX, pkgname, PKG_DIR_POSTFIX)) {
- goto done;
- }
+ if (create_pkg_path(path, PKG_DIR_PREFIX, pkgname, PKG_DIR_POSTFIX)) {
+ goto done;
}
d = opendir(path);
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index 9ba6402f1e95..d2b2f7f9fc60 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -29,7 +29,7 @@ static int do_ping(char **arg, char reply[REPLY_MAX])
static int do_install(char **arg, char reply[REPLY_MAX])
{
- return install(arg[0], atoi(arg[1]), atoi(arg[2]), atoi(arg[3])); /* pkgname, uid, gid */
+ return install(arg[0], atoi(arg[1]), atoi(arg[2])); /* pkgname, uid, gid */
}
static int do_dexopt(char **arg, char reply[REPLY_MAX])
@@ -50,12 +50,12 @@ static int do_rm_dex(char **arg, char reply[REPLY_MAX])
static int do_remove(char **arg, char reply[REPLY_MAX])
{
- return uninstall(arg[0], atoi(arg[1])); /* pkgname */
+ return uninstall(arg[0]); /* pkgname */
}
static int do_rename(char **arg, char reply[REPLY_MAX])
{
- return renamepkg(arg[0], arg[1], atoi(arg[2])); /* oldpkgname, newpkgname */
+ return renamepkg(arg[0], arg[1]); /* oldpkgname, newpkgname */
}
static int do_free_cache(char **arg, char reply[REPLY_MAX]) /* TODO int:free_size */
@@ -65,7 +65,7 @@ static int do_free_cache(char **arg, char reply[REPLY_MAX]) /* TODO int:free_siz
static int do_rm_cache(char **arg, char reply[REPLY_MAX])
{
- return delete_cache(arg[0], atoi(arg[1])); /* pkgname */
+ return delete_cache(arg[0]); /* pkgname */
}
static int do_protect(char **arg, char reply[REPLY_MAX])
@@ -81,7 +81,7 @@ static int do_get_size(char **arg, char reply[REPLY_MAX])
int res = 0;
/* pkgdir, apkpath */
- res = get_size(arg[0], arg[1], arg[2], &codesize, &datasize, &cachesize, atoi(arg[3]));
+ res = get_size(arg[0], arg[1], arg[2], &codesize, &datasize, &cachesize);
/*
* Each int64_t can take up 22 characters printed out. Make sure it
@@ -93,7 +93,7 @@ static int do_get_size(char **arg, char reply[REPLY_MAX])
static int do_rm_user_data(char **arg, char reply[REPLY_MAX])
{
- return delete_user_data(arg[0], atoi(arg[1])); /* pkgname */
+ return delete_user_data(arg[0]); /* pkgname */
}
static int do_movefiles(char **arg, char reply[REPLY_MAX])
@@ -119,17 +119,17 @@ struct cmdinfo {
struct cmdinfo cmds[] = {
{ "ping", 0, do_ping },
- { "install", 4, do_install },
+ { "install", 3, do_install },
{ "dexopt", 3, do_dexopt },
{ "movedex", 2, do_move_dex },
{ "rmdex", 1, do_rm_dex },
- { "remove", 2, do_remove },
- { "rename", 3, do_rename },
+ { "remove", 1, do_remove },
+ { "rename", 2, do_rename },
{ "freecache", 1, do_free_cache },
- { "rmcache", 2, do_rm_cache },
+ { "rmcache", 1, do_rm_cache },
{ "protect", 2, do_protect },
- { "getsize", 4, do_get_size },
- { "rmuserdata", 2, do_rm_user_data },
+ { "getsize", 3, do_get_size },
+ { "rmuserdata", 1, do_rm_user_data },
{ "movefiles", 0, do_movefiles },
{ "linklib", 2, do_linklib },
{ "unlinklib", 1, do_unlinklib },
diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h
index 59475e96cfda..77b58ec10692 100644
--- a/cmds/installd/installd.h
+++ b/cmds/installd/installd.h
@@ -50,23 +50,16 @@
/* elements combined with a valid package name to form paths */
#define PKG_DIR_PREFIX "/data/data/"
-#define PKG_SEC_DIR_PREFIX "/data/secure/data/"
#define PKG_DIR_POSTFIX ""
#define PKG_LIB_PREFIX "/data/data/"
-#define PKG_SEC_LIB_PREFIX "/data/secure/data/"
#define PKG_LIB_POSTFIX "/lib"
#define CACHE_DIR_PREFIX "/data/data/"
-#define CACHE_SEC_DIR_PREFIX "/data/secure/data/"
#define CACHE_DIR_POSTFIX "/cache"
#define APK_DIR_PREFIX "/data/app/"
-/* Encrypted File SYstems constants */
-#define USE_ENCRYPTED_FS 1
-#define USE_UNENCRYPTED_FS 0
-
/* other handy constants */
#define PROTECTED_DIR_PREFIX "/data/app-private/"
@@ -98,16 +91,16 @@ int delete_dir_contents_fd(int dfd, const char *name);
/* commands.c */
-int install(const char *pkgname, int encrypted_fs_flag, uid_t uid, gid_t gid);
-int uninstall(const char *pkgname, int encrypted_fs_flag);
-int renamepkg(const char *oldpkgname, const char *newpkgname, int encrypted_fs_flag);
-int delete_user_data(const char *pkgname, int encrypted_fs_flag);
-int delete_cache(const char *pkgname, int encrypted_fs_flag);
+int install(const char *pkgname, uid_t uid, gid_t gid);
+int uninstall(const char *pkgname);
+int renamepkg(const char *oldpkgname, const char *newpkgname);
+int delete_user_data(const char *pkgname);
+int delete_cache(const char *pkgname);
int move_dex(const char *src, const char *dst);
int rm_dex(const char *path);
int protect(char *pkgname, gid_t gid);
int get_size(const char *pkgname, const char *apkpath, const char *fwdlock_apkpath,
- int64_t *codesize, int64_t *datasize, int64_t *cachesize, int encrypted_fs_flag);
+ int64_t *codesize, int64_t *datasize, int64_t *cachesize);
int free_cache(int64_t free_size);
int dexopt(const char *apk_path, uid_t uid, int is_public);
int movefiles();
diff --git a/cmds/servicemanager/service_manager.c b/cmds/servicemanager/service_manager.c
index ba7f807eb6ac..2df450f34def 100644
--- a/cmds/servicemanager/service_manager.c
+++ b/cmds/servicemanager/service_manager.c
@@ -34,7 +34,6 @@ static struct {
{ AID_MEDIA, "media.player" },
{ AID_MEDIA, "media.camera" },
{ AID_MEDIA, "media.audio_policy" },
- { AID_DRMIO, "drm.drmIOService" },
{ AID_DRM, "drm.drmManager" },
{ AID_NFC, "nfc" },
{ AID_RADIO, "radio.phone" },
diff --git a/cmds/stagefright/sf2.cpp b/cmds/stagefright/sf2.cpp
index 1dc08ea2dc1d..74649a9bf36e 100644
--- a/cmds/stagefright/sf2.cpp
+++ b/cmds/stagefright/sf2.cpp
@@ -170,6 +170,7 @@ protected:
mCodec->signalResume();
(new AMessage(kWhatSeek, id()))->post(5000000ll);
+ } else if (what == ACodec::kWhatOutputFormatChanged) {
} else {
CHECK_EQ(what, (int32_t)ACodec::kWhatShutdownCompleted);