summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-03-10 22:04:23 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-03-10 22:04:23 +0000
commit7ecaa009878259292c614acd6a81699d4738baf1 (patch)
treee44d70be911342a409cc667d6e8b9c1eb58a36bc /cmds
parent35283ef01b53c6fce3be11158100dd950780f19e (diff)
parent53cab935d54b6ca013c6a236e09d9160a6aa7f54 (diff)
downloadframeworks_native-7ecaa009878259292c614acd6a81699d4738baf1.zip
frameworks_native-7ecaa009878259292c614acd6a81699d4738baf1.tar.gz
frameworks_native-7ecaa009878259292c614acd6a81699d4738baf1.tar.bz2
am 53cab935: am 1fc747d2: am 5a25a63d: Merge "Installd: Pass debuggable flag"
* commit '53cab935d54b6ca013c6a236e09d9160a6aa7f54': Installd: Pass debuggable flag
Diffstat (limited to 'cmds')
-rw-r--r--cmds/installd/commands.c17
-rw-r--r--cmds/installd/installd.c13
-rw-r--r--cmds/installd/installd.h2
3 files changed, 23 insertions, 9 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 44c4988..d9376e1 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -699,7 +699,7 @@ static void run_patchoat(int input_fd, int oat_fd, const char* input_file_name,
static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
const char* output_file_name, int swap_fd, const char *pkgname, const char *instruction_set,
- bool vm_safe_mode)
+ bool vm_safe_mode, bool debuggable)
{
static const unsigned int MAX_INSTRUCTION_SET_LEN = 7;
@@ -817,6 +817,13 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
sprintf(dex2oat_compiler_filter_arg, "--compiler-filter=%s", dex2oat_compiler_filter_flag);
}
+ // Check whether all apps should be compiled debuggable.
+ if (!debuggable) {
+ debuggable =
+ (property_get("dalvik.vm.always_debuggable", prop_buf, "0") > 0) &&
+ (prop_buf[0] == '1');
+ }
+
ALOGV("Running %s in=%s out=%s\n", DEX2OAT_BIN, input_file_name, output_file_name);
const char* argv[7 // program name, mandatory arguments and the final NULL
@@ -829,6 +836,7 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
+ (have_dex2oat_compiler_filter_flag ? 1 : 0)
+ (have_dex2oat_swap_fd ? 1 : 0)
+ (have_dex2oat_relocation_skip_flag ? 2 : 0)
+ + (debuggable ? 1 : 0)
+ dex2oat_flags_count];
int i = 0;
argv[i++] = DEX2OAT_BIN;
@@ -863,6 +871,9 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
if (have_dex2oat_swap_fd) {
argv[i++] = dex2oat_swap_fd;
}
+ if (debuggable) {
+ argv[i++] = "--debuggable";
+ }
if (dex2oat_flags_count) {
i += split(dex2oat_flags, argv + i);
}
@@ -922,7 +933,7 @@ static bool ShouldUseSwapFileForDexopt() {
int dexopt(const char *apk_path, uid_t uid, bool is_public,
const char *pkgname, const char *instruction_set,
- bool vm_safe_mode, bool is_patchoat)
+ bool vm_safe_mode, bool is_patchoat, bool debuggable)
{
struct utimbuf ut;
struct stat input_stat, dex_stat;
@@ -1074,7 +1085,7 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public,
run_patchoat(input_fd, out_fd, input_file, out_path, pkgname, instruction_set);
} else {
run_dex2oat(input_fd, out_fd, input_file, out_path, swap_fd, pkgname, instruction_set,
- vm_safe_mode);
+ vm_safe_mode, debuggable);
}
exit(68); /* only get here on exec failure */
} else {
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index 4dd83ae..8f94170 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -38,8 +38,10 @@ static int do_install(char **arg, char reply[REPLY_MAX] __unused)
static int do_dexopt(char **arg, char reply[REPLY_MAX] __unused)
{
- /* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate */
- return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), 0);
+ /* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate,
+ debuggable */
+ return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), 0,
+ atoi(arg[6]));
}
static int do_mark_boot_complete(char **arg, char reply[REPLY_MAX] __unused)
@@ -151,8 +153,9 @@ static int do_restorecon_data(char **arg, char reply[REPLY_MAX] __attribute__((u
}
static int do_patchoat(char **arg, char reply[REPLY_MAX] __unused) {
- /* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate */
- return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], 0, 1);
+ /* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate,
+ debuggable */
+ return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], 0, 1, 0);
}
struct cmdinfo {
@@ -164,7 +167,7 @@ struct cmdinfo {
struct cmdinfo cmds[] = {
{ "ping", 0, do_ping },
{ "install", 4, do_install },
- { "dexopt", 6, do_dexopt },
+ { "dexopt", 7, do_dexopt },
{ "markbootcomplete", 1, do_mark_boot_complete },
{ "movedex", 3, do_move_dex },
{ "rmdex", 2, do_rm_dex },
diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h
index a9a1999..47577d6 100644
--- a/cmds/installd/installd.h
+++ b/cmds/installd/installd.h
@@ -220,7 +220,7 @@ int get_size(const char *pkgname, userid_t userid, const char *apkpath, const ch
int64_t *codesize, int64_t *datasize, int64_t *cachesize, int64_t *asecsize);
int free_cache(int64_t free_size);
int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgName,
- const char *instruction_set, bool vm_safe_mode, bool should_relocate);
+ const char *instruction_set, bool vm_safe_mode, bool should_relocate, bool debuggable);
int mark_boot_complete(const char *instruction_set);
int movefiles();
int linklib(const char* target, const char* source, int userId);