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

Commit 5c6944c3 authored by Mårten Kongstad's avatar Mårten Kongstad Committed by Adam Lesinski
Browse files

installd: add command 'removeIdmap'

Add an installd command to remove an idmap file. This is the inverse of
the 'idmap' command and is intended for clean-up once an idmap file is
no longer needed because an APK was removed, etc.

This commit depends on a corresponding commit in frameworks/base (with
the same Change-Id).

Bug: 31052947
Test: run tests from 'OMS: tests for OverlayManagerService'
Change-Id: Iae19a519803f0c172b02a32faa283ef36f43863c
parent 1bb1f85d
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1890,6 +1890,22 @@ fail:
    return error();
}

binder::Status InstalldNativeService::removeIdmap(const std::string& overlayApkPath) {
    const char* overlay_apk = overlayApkPath.c_str();
    char idmap_path[PATH_MAX];

    if (flatten_path(IDMAP_PREFIX, IDMAP_SUFFIX, overlay_apk,
                idmap_path, sizeof(idmap_path)) == -1) {
        ALOGE("idmap cannot generate idmap path for overlay %s\n", overlay_apk);
        return error();
    }
    if (unlink(idmap_path) < 0) {
        ALOGE("couldn't unlink idmap file %s\n", idmap_path);
        return error();
    }
    return ok();
}

binder::Status InstalldNativeService::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) {
+1 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ public:

    binder::Status idmap(const std::string& targetApkPath, const std::string& overlayApkPath,
            int32_t uid);
    binder::Status removeIdmap(const std::string& overlayApkPath);
    binder::Status rmPackageDir(const std::string& packageDir);
    binder::Status markBootComplete(const std::string& instructionSet);
    binder::Status freeCache(const std::unique_ptr<std::string>& uuid, int64_t freeStorageSize,
+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ interface IInstalld {
    void destroyAppProfiles(@utf8InCpp String packageName);

    void idmap(@utf8InCpp String targetApkPath, @utf8InCpp String overlayApkPath, int uid);
    void removeIdmap(@utf8InCpp String overlayApkPath);
    void rmPackageDir(@utf8InCpp String packageDir);
    void markBootComplete(@utf8InCpp String instructionSet);
    void freeCache(@nullable @utf8InCpp String uuid, long freeStorageSize, int flags);