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

Commit 49bf66ba authored by Marin Shalamanov's avatar Marin Shalamanov
Browse files

SF: Clean up Scheduler::registerLayer

Test: presubmit
Bug: 159590486
Change-Id: I8787dcca0576549a7f04e7446f8aec700859c1f3
parent d26cd28b
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -564,21 +564,23 @@ void Scheduler::setIgnorePresentFences(bool ignore) {
void Scheduler::registerLayer(Layer* layer) {
    if (!mLayerHistory) return;

    scheduler::LayerHistory::LayerVoteType voteType;

    if (layer->getWindowType() == InputWindowInfo::Type::STATUS_BAR) {
        mLayerHistory->registerLayer(layer, scheduler::LayerHistory::LayerVoteType::NoVote);
        voteType = scheduler::LayerHistory::LayerVoteType::NoVote;
    } else if (!mOptions.useContentDetection) {
        // If the content detection feature is off, all layers are registered at Max. We still keep
        // the layer history, since we use it for other features (like Frame Rate API), so layers
        // still need to be registered.
        mLayerHistory->registerLayer(layer, scheduler::LayerHistory::LayerVoteType::Max);
    } else {
        if (layer->getWindowType() == InputWindowInfo::Type::WALLPAPER) {
        voteType = scheduler::LayerHistory::LayerVoteType::Max;
    } else if (layer->getWindowType() == InputWindowInfo::Type::WALLPAPER) {
        // Running Wallpaper at Min is considered as part of content detection.
            mLayerHistory->registerLayer(layer, scheduler::LayerHistory::LayerVoteType::Min);
        voteType = scheduler::LayerHistory::LayerVoteType::Min;
    } else {
            mLayerHistory->registerLayer(layer, scheduler::LayerHistory::LayerVoteType::Heuristic);
        }
        voteType = scheduler::LayerHistory::LayerVoteType::Heuristic;
    }

    mLayerHistory->registerLayer(layer, voteType);
}

void Scheduler::recordLayerHistory(Layer* layer, nsecs_t presentTime,