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

Commit 8fe29b6e authored by Oleg Petšjonkin's avatar Oleg Petšjonkin Committed by Android (Google) Code Review
Browse files

Merge "Adding tracing to VoteStorage updates" into udc-qpr-dev

parents 4b1f9fa5 d43c18c5
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.display.mode;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.Trace;
import android.util.Slog;
import android.util.SparseArray;

@@ -104,6 +105,9 @@ class VotesStorage {
                votes.remove(priority);
            }
        }
        Trace.traceCounter(Trace.TRACE_TAG_POWER,
                TAG + "." + displayId + ":" + Vote.priorityToString(priority),
                getMaxPhysicalRefreshRate(vote));
        if (mLoggingEnabled) {
            Slog.i(TAG, "Updated votes for display=" + displayId + " votes=" + votes);
        }
@@ -146,6 +150,15 @@ class VotesStorage {
        }
    }

    private int getMaxPhysicalRefreshRate(@Nullable Vote vote) {
        if (vote == null) {
            return -1;
        } else if (vote.refreshRateRanges.physical.max == Float.POSITIVE_INFINITY) {
            return 1000; // for visualisation, otherwise e.g. -1 -> 60 will be unnoticeable
        }
        return (int) vote.refreshRateRanges.physical.max;
    }

    interface Listener {
        void onChanged();
    }