From 911c7f3338fb1737dae3daddbf3735cc84786e11 Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Sat, 7 Nov 2015 17:52:50 -0800 Subject: [PATCH] installd: Consider bundled app dir as a valid apk path Change-Id: I92db56f21bf91e0816b63faffcfbb270ca2d8fca --- cmds/installd/commands.cpp | 1 + cmds/installd/installd.cpp | 6 ++++++ cmds/installd/installd.h | 3 +++ cmds/installd/utils.cpp | 2 ++ 4 files changed, 12 insertions(+) diff --git a/cmds/installd/commands.cpp b/cmds/installd/commands.cpp index 55cdabced..322d537ee 100644 --- a/cmds/installd/commands.cpp +++ b/cmds/installd/commands.cpp @@ -39,6 +39,7 @@ dir_rec_t android_app_private_dir; dir_rec_t android_app_lib_dir; dir_rec_t android_media_dir; dir_rec_t android_mnt_expand_dir; +dir_rec_t android_prebundled_dir; dir_rec_array_t android_system_dirs; static const char* kCpPath = "/system/bin/cp"; diff --git a/cmds/installd/installd.cpp b/cmds/installd/installd.cpp index d0e17475d..c92bed020 100644 --- a/cmds/installd/installd.cpp +++ b/cmds/installd/installd.cpp @@ -385,6 +385,12 @@ int initialize_globals() { return -1; } + // Get the android external app directory. + if (get_path_from_string(&android_prebundled_dir, PREBUNDLED_APP_PREFIX) < 0) { + return -1; + } + + // Take note of the system and vendor directories. android_system_dirs.count = 4; diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h index 2745ba0f3..70e5e16c8 100644 --- a/cmds/installd/installd.h +++ b/cmds/installd/installd.h @@ -92,6 +92,8 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) +#define PREBUNDLED_APP_PREFIX "/vendor/bundled-app/" + /* data structures */ typedef struct { @@ -111,6 +113,7 @@ extern dir_rec_t android_data_dir; extern dir_rec_t android_asec_dir; extern dir_rec_t android_media_dir; extern dir_rec_t android_mnt_expand_dir; +extern dir_rec_t android_prebundled_dir; extern dir_rec_array_t android_system_dirs; typedef struct cache_dir_struct { diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp index 7db3fb90c..a32d1a08c 100644 --- a/cmds/installd/utils.cpp +++ b/cmds/installd/utils.cpp @@ -1061,6 +1061,8 @@ static int validate_apk_path_internal(const char *path, int maxSubdirs) { if (maxSubdirs < 2) { maxSubdirs = 2; } + } else if (!strncmp(path, android_prebundled_dir.path, android_prebundled_dir.len)) { + dir = &android_prebundled_dir; } else { return -1; }