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

Commit 81b4dff2 authored by Jeff Tinker's avatar Jeff Tinker Committed by Android (Google) Code Review
Browse files

Merge "Fix missing check of hidl return status"

parents d2ce2b80 7dfe28f2
Loading
Loading
Loading
Loading
+27 −34
Original line number Diff line number Diff line
@@ -261,20 +261,39 @@ DrmHal::DrmHal()
}

void DrmHal::closeOpenSessions() {
    if (mPlugin != NULL) {
        for (size_t i = 0; i < mOpenSessions.size(); i++) {
            mPlugin->closeSession(toHidlVec(mOpenSessions[i]));
            DrmSessionManager::Instance()->removeSession(mOpenSessions[i]);
        }
    Mutex::Autolock autoLock(mLock);
    auto openSessions = mOpenSessions;
    for (size_t i = 0; i < openSessions.size(); i++) {
        mLock.unlock();
        closeSession(openSessions[i]);
        mLock.lock();
    }
    mOpenSessions.clear();
}

DrmHal::~DrmHal() {
    closeOpenSessions();
    DrmSessionManager::Instance()->removeDrm(mDrmSessionClient);
}

void DrmHal::cleanup() {
    closeOpenSessions();

    Mutex::Autolock autoLock(mLock);
    reportPluginMetrics();
    reportFrameworkMetrics();

    setListener(NULL);
    mInitCheck = NO_INIT;

    if (mPlugin != NULL) {
        if (!mPlugin->setListener(NULL).isOk()) {
            mInitCheck = DEAD_OBJECT;
        }
    }
    mPlugin.clear();
    mPluginV1_1.clear();
}

Vector<sp<IDrmFactory>> DrmHal::makeDrmFactories() {
    Vector<sp<IDrmFactory>> factories;

@@ -512,22 +531,7 @@ status_t DrmHal::createPlugin(const uint8_t uuid[16],
}

status_t DrmHal::destroyPlugin() {
    Mutex::Autolock autoLock(mLock);
    INIT_CHECK();

    closeOpenSessions();
    reportPluginMetrics();
    reportFrameworkMetrics();
    setListener(NULL);
    mInitCheck = NO_INIT;

    if (mPlugin != NULL) {
        if (!mPlugin->setListener(NULL).isOk()) {
            mInitCheck = DEAD_OBJECT;
        }
    }
    mPlugin.clear();
    mPluginV1_1.clear();
    cleanup();
    return OK;
}

@@ -633,7 +637,6 @@ status_t DrmHal::closeSession(Vector<uint8_t> const &sessionId) {
        status_t response = toStatusT(status);
        mMetrics.SetSessionEnd(sessionId);
        mMetrics.mCloseSessionCounter.Increment(response);
        reportPluginMetrics();
        return response;
    }
    mMetrics.mCloseSessionCounter.Increment(DEAD_OBJECT);
@@ -1267,17 +1270,7 @@ status_t DrmHal::signRSA(Vector<uint8_t> const &sessionId,

void DrmHal::binderDied(const wp<IBinder> &the_late_who __unused)
{
    Mutex::Autolock autoLock(mLock);
    closeOpenSessions();
    setListener(NULL);
    mInitCheck = NO_INIT;

    if (mPlugin != NULL) {
        if (!mPlugin->setListener(NULL).isOk()) {
            mInitCheck = DEAD_OBJECT;
        }
    }
    mPlugin.clear();
    cleanup();
}

void DrmHal::writeByteArray(Parcel &obj, hidl_vec<uint8_t> const &vec)
+1 −0
Original line number Diff line number Diff line
@@ -188,6 +188,7 @@ private:

    Vector<Vector<uint8_t>> mOpenSessions;
    void closeOpenSessions();
    void cleanup();

    /**
     * mInitCheck is: