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

Commit df50d86d authored by petsjonkin's avatar petsjonkin Committed by Oleg Petšjonkin
Browse files

Adding tracing to VoteStorage updates

Bug: b/297933745
Test: maunal testing, see comment 11
Change-Id: I7f19e092f9f747e89e36bc756606b380953cea93
parent 0d8faee4
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();
    }