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

Commit 40e122da authored by Huihong Luo's avatar Huihong Luo Committed by Automerger Merge Worker
Browse files

Merge "Skip caching if any layer has protected contents" into sc-dev am: 963026b8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15053550

Change-Id: Ia99c5ec624a6581b4032b493d0a8d0d7b64c4134
parents 99edce19 963026b8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -378,10 +378,14 @@ void CachedSet::dump(std::string& result) const {
    if (mLayers.size() == 1) {
        base::StringAppendF(&result, "    Layer [%s]\n", mLayers[0].getName().c_str());
        base::StringAppendF(&result, "    Buffer %p", mLayers[0].getBuffer().get());
        base::StringAppendF(&result, "    Protected [%s]",
                            mLayers[0].getState()->isProtected() ? "true" : "false");
    } else {
        result.append("    Cached set of:");
        for (const Layer& layer : mLayers) {
            base::StringAppendF(&result, "\n      Layer [%s]", layer.getName().c_str());
            base::StringAppendF(&result, "\n      Protected [%s]",
                                layer.getState()->isProtected() ? "true" : "false");
        }
    }

+9 −1
Original line number Diff line number Diff line
@@ -420,7 +420,7 @@ std::vector<Flattener::Run> Flattener::findCandidateRuns(time_point now) const {
        const bool layerIsInactive = now - currentSet->getLastUpdate() > mActiveLayerTimeout;
        const bool layerHasBlur = currentSet->hasBlurBehind();
        if (layerIsInactive && (firstLayer || runHasFirstLayer || !layerHasBlur) &&
            !currentSet->hasHdrLayers() && !currentSet->hasProtectedLayers()) {
            !currentSet->hasHdrLayers()) {
            if (isPartOfRun) {
                builder.append(currentSet->getLayerCount());
            } else {
@@ -491,6 +491,14 @@ void Flattener::buildCachedSets(time_point now) {
        return;
    }

    for (const CachedSet& layer : mLayers) {
        // TODO (b/191997217): make it less aggressive, and sync with findCandidateRuns
        if (layer.hasProtectedLayers()) {
            ATRACE_NAME("layer->hasProtectedLayers()");
            return;
        }
    }

    std::vector<Run> runs = findCandidateRuns(now);

    std::optional<Run> bestRun = findBestRun(runs);