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

Commit 3f79c649 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by android-build-merger
Browse files

Merge "Remove ~1/3 of the installd calls at boot."

am: ed04f3c7

Change-Id: Id68b901ea2c12815df1d4c6e83e789101663870c
parents 36e86c37 ed04f3c7
Loading
Loading
Loading
Loading
+12 −26
Original line number Diff line number Diff line
@@ -86,10 +86,6 @@ static binder::Status ok() {
    return binder::Status::ok();
}

static binder::Status exception(uint32_t code) {
    return binder::Status::fromExceptionCode(code);
}

static binder::Status exception(uint32_t code, const std::string& msg) {
    return binder::Status::fromExceptionCode(code, String8(msg.c_str()));
}
@@ -265,7 +261,7 @@ static int prepare_app_dir(const std::string& parent, const char* name, mode_t t

binder::Status InstalldNativeService::createAppData(const std::unique_ptr<std::string>& uuid,
        const std::string& packageName, int32_t userId, int32_t flags, int32_t appId,
        const std::string& seInfo, int32_t targetSdkVersion) {
        const std::string& seInfo, int32_t targetSdkVersion, int64_t* _aidl_return) {
    ENFORCE_UID(AID_SYSTEM);
    CHECK_ARGUMENT_UUID(uuid);
    CHECK_ARGUMENT_PACKAGE_NAME(packageName);
@@ -273,6 +269,9 @@ binder::Status InstalldNativeService::createAppData(const std::unique_ptr<std::s
    const char* uuid_ = uuid ? uuid->c_str() : nullptr;
    const char* pkgname = packageName.c_str();

    // Assume invalid inode unless filled in below
    if (_aidl_return != nullptr) *_aidl_return = -1;

    uid_t uid = multiuser_get_uid(userId, appId);
    mode_t target_mode = targetSdkVersion >= MIN_RESTRICTED_HOME_SDK_VERSION ? 0700 : 0751;
    if (flags & FLAG_STORAGE_CE) {
@@ -296,6 +295,13 @@ binder::Status InstalldNativeService::createAppData(const std::unique_ptr<std::s
                write_path_inode(path, "code_cache", kXattrInodeCodeCache)) {
            return error("Failed to write_path_inode for " + path);
        }

        // And return the CE inode of the top-level data directory so we can
        // clear contents while CE storage is locked
        if ((_aidl_return != nullptr)
                && get_path_inode(path, reinterpret_cast<ino_t*>(_aidl_return)) != 0) {
            return error("Failed to get_path_inode for " + path);
        }
    }
    if (flags & FLAG_STORAGE_DE) {
        auto path = create_data_user_de_package_path(uuid_, userId, pkgname);
@@ -558,7 +564,7 @@ binder::Status InstalldNativeService::moveCompleteApp(const std::unique_ptr<std:
        }

        if (!createAppData(toUuid, packageName, user, FLAG_STORAGE_CE | FLAG_STORAGE_DE, appId,
                seInfo, targetSdkVersion).isOk()) {
                seInfo, targetSdkVersion, nullptr).isOk()) {
            res = error("Failed to create package target");
            goto fail;
        }
@@ -857,26 +863,6 @@ binder::Status InstalldNativeService::getAppSize(const std::unique_ptr<std::stri
    return ok();
}

binder::Status InstalldNativeService::getAppDataInode(const std::unique_ptr<std::string>& uuid,
        const std::string& packageName, int32_t userId, int32_t flags, int64_t* _aidl_return) {
    ENFORCE_UID(AID_SYSTEM);
    CHECK_ARGUMENT_UUID(uuid);
    CHECK_ARGUMENT_PACKAGE_NAME(packageName);

    const char* uuid_ = uuid ? uuid->c_str() : nullptr;
    const char* pkgname = packageName.c_str();

    if (flags & FLAG_STORAGE_CE) {
        auto path = create_data_user_ce_package_path(uuid_, userId, pkgname);
        if (get_path_inode(path, reinterpret_cast<ino_t*>(_aidl_return)) == 0) {
            return ok();
        } else {
            return error("Failed to get_path_inode for " + path);
        }
    }
    return exception(binder::Status::EX_UNSUPPORTED_OPERATION);
}

// Dumps the contents of a profile file, using pkgname's dex files for pretty
// printing the result.
binder::Status InstalldNativeService::dumpProfiles(int32_t uid, const std::string& packageName,
+1 −3
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ public:

    binder::Status createAppData(const std::unique_ptr<std::string>& uuid,
            const std::string& packageName, int32_t userId, int32_t flags, int32_t appId,
            const std::string& seInfo, int32_t targetSdkVersion);
            const std::string& seInfo, int32_t targetSdkVersion, int64_t* _aidl_return);
    binder::Status restoreconAppData(const std::unique_ptr<std::string>& uuid,
            const std::string& packageName, int32_t userId, int32_t flags, int32_t appId,
            const std::string& seInfo);
@@ -55,8 +55,6 @@ public:
            const std::string& packageName, int32_t userId, int32_t flags, int64_t ceDataInode);
    binder::Status destroyAppData(const std::unique_ptr<std::string>& uuid,
            const std::string& packageName, int32_t userId, int32_t flags, int64_t ceDataInode);
    binder::Status getAppDataInode(const std::unique_ptr<std::string>& uuid,
            const std::string& packageName, int32_t userId, int32_t flags, int64_t* _aidl_return);
    binder::Status getAppSize(const std::unique_ptr<std::string>& uuid,
            const std::string& packageName, int32_t userId, int32_t flags, int64_t ceDataInode,
            const std::string& codePath, std::vector<int64_t>* _aidl_return);
+1 −3
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ interface IInstalld {
    void createUserData(@nullable @utf8InCpp String uuid, int userId, int userSerial, int flags);
    void destroyUserData(@nullable @utf8InCpp String uuid, int userId, int flags);

    void createAppData(@nullable @utf8InCpp String uuid, in @utf8InCpp String packageName,
    long createAppData(@nullable @utf8InCpp String uuid, in @utf8InCpp String packageName,
            int userId, int flags, int appId, in @utf8InCpp String seInfo, int targetSdkVersion);
    void restoreconAppData(@nullable @utf8InCpp String uuid, @utf8InCpp String packageName,
            int userId, int flags, int appId, @utf8InCpp String seInfo);
@@ -31,8 +31,6 @@ interface IInstalld {
            int userId, int flags, long ceDataInode);
    void destroyAppData(@nullable @utf8InCpp String uuid, @utf8InCpp String packageName,
            int userId, int flags, long ceDataInode);
    long getAppDataInode(@nullable @utf8InCpp String uuid, @utf8InCpp String packageName,
            int userId, int flags);
    long[] getAppSize(@nullable @utf8InCpp String uuid, @utf8InCpp String packageName,
            int userId, int flags, long ceDataInode, @utf8InCpp String codePath);