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

Commit dba2e61e authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Migrate from android::String path functions to std::filesystem" into...

Merge "Migrate from android::String path functions to std::filesystem" into main am: 5da74818 am: 01cd27f9 am: 68adab63

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2729280



Change-Id: I818ef5052434d9bd3dae9e24c0b5c7851da226dd
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 708a35a6 68adab63
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -78,6 +78,9 @@ drmserver_cc_binary {
        "libselinux",
        "libstagefright_foundation",
    ],
    whole_static_libs: [
        "libc++fs",
    ],

    cflags: [
        "-Wall",
@@ -124,6 +127,7 @@ cc_fuzz {
    ],

    static_libs: [
        "libc++fs",
        "libmediautils",
        "liblog",
        "libdrmframeworkcommon",
+5 −4
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
#include "ReadWriteUtils.h"

#include <algorithm>
#include <filesystem>

#define DECRYPT_FILE_ERROR (-1)

@@ -114,7 +115,7 @@ void DrmManager::recordEngineMetrics(
    std::unique_ptr<DrmSupportInfo> info(engine.getSupportInfo(0));

    uid_t callingUid = IPCThreadState::self()->getCallingUid();
    std::string plugInId(plugInId8.getPathLeaf().getBasePath().c_str());
    std::string plugInId = std::filesystem::path(plugInId8.c_str()).stem();
    ALOGV("%d calling %s %s", callingUid, plugInId.c_str(), func);

    Mutex::Autolock _l(mMetricsLock);
@@ -316,8 +317,8 @@ bool DrmManager::canHandle(int uniqueId, const String8& path, const String8& mim
            IDrmEngine& rDrmEngine = mPlugInManager.getPlugIn(plugInId);
            result = rDrmEngine.canHandle(uniqueId, path);
        } else {
            String8 extension = path.getPathExtension();
            if (String8("") != extension) {
            const auto extension = std::filesystem::path(path.c_str()).extension();
            if (!extension.empty()) {
                result = canHandle(uniqueId, path);
            }
        }
@@ -745,7 +746,7 @@ String8 DrmManager::getSupportedPlugInId(const String8& mimeType) {

String8 DrmManager::getSupportedPlugInIdFromPath(int uniqueId, const String8& path) {
    String8 plugInId("");
    const String8 fileSuffix = path.getPathExtension();
    const String8 fileSuffix(std::filesystem::path(path.c_str()).extension().c_str());

    for (size_t index = 0; index < mSupportInfoToPlugInIdMap.size(); index++) {
        const DrmSupportInfo& drmSupportInfo = mSupportInfoToPlugInIdMap.keyAt(index);
+4 −3
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@
#include <utils/Vector.h>
#include <utils/KeyedVector.h>

#include <filesystem>

namespace android {

const char* const PLUGIN_MANAGER_CREATE = "create";
@@ -227,10 +229,9 @@ private:
     * True if the input name denotes plug-in
     */
    bool isPlugIn(const struct dirent* pEntry) const {
        String8 sName(pEntry->d_name);
        String8 extension(sName.getPathExtension());
        const auto extension = std::filesystem::path(pEntry->d_name).extension();
        // Note that the plug-in extension must exactly match case
        return extension == String8(PLUGIN_EXTENSION);
        return extension.string() == PLUGIN_EXTENSION;
    }

    /**
+4 −0
Original line number Diff line number Diff line
@@ -64,6 +64,10 @@ cc_library_shared {
        "libfwdlock-decoder",
    ],

    whole_static_libs: [
        "libc++fs",
    ],

    local_include_dirs: ["include"],

    relative_install_path: "drm",
+3 −1
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@
#include "FwdLockGlue.h"
#include "MimeTypeUtil.h"

#include <filesystem>

#undef LOG_TAG
#define LOG_TAG "FwdLockEngine"

@@ -227,7 +229,7 @@ DrmSupportInfo* FwdLockEngine::onGetSupportInfo(int /* uniqueId */) {
bool FwdLockEngine::onCanHandle(int /* uniqueId */, const String8& path) {
    bool result = false;

    String8 extString = path.getPathExtension();
    String8 extString(std::filesystem::path(path.c_str()).extension().c_str());
    return IsFileSuffixSupported(extString);
}

Loading