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

Commit d1eff571 authored by leozwang@google.com's avatar leozwang@google.com Committed by Leo Wang
Browse files

Output more detailed error message if loading library fails

Bug: 9805979

Change-Id: I77b19d6a65ff9fb72e7428ce79b117628e4c8658
parent ce177bb3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -134,7 +134,6 @@ void Crypto::findFactoryForScheme(const uint8_t uuid[16]) {
        return;
    }

    ALOGE("Failed to find crypto plugin");
    mInitCheck = ERROR_UNSUPPORTED;
}

@@ -151,6 +150,7 @@ bool Crypto::loadLibraryForScheme(const String8 &path, const uint8_t uuid[16]) {
    if (!mLibrary.get()) {
        mLibrary = new SharedLibrary(path);
        if (!*mLibrary) {
            ALOGE("loadLibraryForScheme failed:%s", mLibrary->lastError());
            return false;
        }

@@ -165,6 +165,7 @@ bool Crypto::loadLibraryForScheme(const String8 &path, const uint8_t uuid[16]) {
    if (createCryptoFactory == NULL ||
        (mFactory = createCryptoFactory()) == NULL ||
        !mFactory->isCryptoSchemeSupported(uuid)) {
        ALOGE("createCryptoFactory failed:%s", mLibrary->lastError());
        closeFactory();
        return false;
    }
+6 −0
Original line number Diff line number Diff line
@@ -46,4 +46,10 @@ namespace android {
        }
        return dlsym(mLibHandle, symbol);
    }

    const char *SharedLibrary::lastError() const {
        const char *error = dlerror();
        return error ? error : "No errors or unknown error";
    }

};
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ namespace android {

        bool operator!() const;
        void *lookup(const char *symbol) const;
        const char *lastError() const;

    private:
        void *mLibHandle;