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

Commit 3a24dfc5 authored by leozwang@google.com's avatar leozwang@google.com Committed by Android (Google) Code Review
Browse files

Merge "Output more detailed error message if loading library fails"

parents ee5e8d3e d1eff571
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -134,7 +134,6 @@ void Crypto::findFactoryForScheme(const uint8_t uuid[16]) {
        return;
        return;
    }
    }


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


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


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


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


    private:
    private:
        void *mLibHandle;
        void *mLibHandle;