Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a1648e2 authored by Calin Juravle's avatar Calin Juravle
Browse files

Extract profile files in their dedicated folder

Current profiles (the ones which have not been used for
compilation) are stored in /data/misc/profiles/cur/0/pkgname/.

Reference profiles (the merged of all user profiles, used for
compilation) are stored in /data/misc/profiles/ref/pkgname.

The profile analysis flow has been changed to use profman
before calling dex2oat. profman decides if there is a need
for compilation and does the merging.

Bug: 26719109
Bug: 26563023
Bug: 26881016

Change-Id: I5a86ed5fd07a28e2e580f9c108428527ba7993b6
parent 4318b9c8
Loading
Loading
Loading
Loading
+327 −157

File changed.

Preview size limit exceeded, changes collapsed.

+6 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ dir_rec_t android_asec_dir;
dir_rec_t android_data_dir;
dir_rec_t android_media_dir;
dir_rec_t android_mnt_expand_dir;
dir_rec_t android_profiles_dir;

dir_rec_array_t android_system_dirs;

@@ -99,6 +100,11 @@ bool init_globals_from_data_and_root(const char* data, const char* root) {
        return false;
    }

    // Get the android profiles directory.
    if (copy_and_append(&android_profiles_dir, &android_data_dir, PROFILES_SUBDIR) < 0) {
        return false;
    }

    // Take note of the system and vendor directories.
    android_system_dirs.count = 4;

+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ extern dir_rec_t android_asec_dir;
extern dir_rec_t android_data_dir;
extern dir_rec_t android_media_dir;
extern dir_rec_t android_mnt_expand_dir;
extern dir_rec_t android_profiles_dir;

extern dir_rec_array_t android_system_dirs;

+3 −1
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ constexpr const char* APP_LIB_SUBDIR = "app-lib/"; // sub-directory under ANDROI

constexpr const char* MEDIA_SUBDIR = "media/"; // sub-directory under ANDROID_DATA

constexpr const char* PROFILES_SUBDIR = "misc/profiles"; // sub-directory under ANDROID_DATA

/* other handy constants */

constexpr const char* PRIVATE_APP_SUBDIR = "app-private/"; // sub-directory under ANDROID_DATA
+22 −9
Original line number Diff line number Diff line
@@ -59,6 +59,11 @@ static bool is_valid_filename(const std::string& name) {
    }
}

static void check_package_name(const char* package_name) {
    CHECK(is_valid_filename(package_name));
    CHECK(is_valid_package_name(package_name) == 0);
}

/**
 * Create the path name where package app contents should be stored for
 * the given volume UUID and package name.  An empty UUID is assumed to
@@ -66,9 +71,7 @@ static bool is_valid_filename(const std::string& name) {
 */
std::string create_data_app_package_path(const char* volume_uuid,
        const char* package_name) {
    CHECK(is_valid_filename(package_name));
    CHECK(is_valid_package_name(package_name) == 0);

    check_package_name(package_name);
    return StringPrintf("%s/%s",
            create_data_app_path(volume_uuid).c_str(), package_name);
}
@@ -80,18 +83,14 @@ std::string create_data_app_package_path(const char* volume_uuid,
 */
std::string create_data_user_package_path(const char* volume_uuid,
        userid_t user, const char* package_name) {
    CHECK(is_valid_filename(package_name));
    CHECK(is_valid_package_name(package_name) == 0);

    check_package_name(package_name);
    return StringPrintf("%s/%s",
            create_data_user_path(volume_uuid, user).c_str(), package_name);
}

std::string create_data_user_de_package_path(const char* volume_uuid,
        userid_t user, const char* package_name) {
    CHECK(is_valid_filename(package_name));
    CHECK(is_valid_package_name(package_name) == 0);

    check_package_name(package_name);
    return StringPrintf("%s/%s",
            create_data_user_de_path(volume_uuid, user).c_str(), package_name);
}
@@ -161,6 +160,20 @@ std::string create_data_media_path(const char* volume_uuid, userid_t userid) {
    return StringPrintf("%s/media/%u", create_data_path(volume_uuid).c_str(), userid);
}

std::string create_data_user_profiles_path(userid_t userid) {
    return StringPrintf("%s/cur/%u", android_profiles_dir.path, userid);
}

std::string create_data_user_profile_package_path(userid_t user, const char* package_name) {
    check_package_name(package_name);
    return StringPrintf("%s/%s",create_data_user_profiles_path(user).c_str(), package_name);
}

std::string create_data_ref_profile_package_path(const char* package_name) {
    check_package_name(package_name);
    return StringPrintf("%s/ref/%s", android_profiles_dir.path, package_name);
}

std::vector<userid_t> get_known_users(const char* volume_uuid) {
    std::vector<userid_t> users;

Loading