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

Commit 4c36d80d authored by Danae Savvidi's avatar Danae Savvidi
Browse files

Add dumpsys logging for DisplayInfoProxy fields

Log the mDisplayInfoGroupsChanged and mDisplayInfoChangeSource of mInfo (DisplayInfoProxy) in LogicalDisplay dumpsys.

Bug: 444192387
Flag: NONE does not change anything related to a flag
Test: atest LogicalDisplayTest
Change-Id: I0d3cfb9a8fc8b2926446a9e3a74b40dae24a643e
parent bcf1d66f
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -969,6 +969,20 @@ public final class DisplayInfo implements Parcelable {
        public int getMask() {
            return mMask;
        }

        /** Convert bitmask to a string of group names. */
        public static String displayInfoGroupsToString(int changedGroups) {
            StringBuilder sb = new StringBuilder();
            for (DisplayInfo.DisplayInfoGroup group : DisplayInfo.DisplayInfoGroup.values()) {
                if ((changedGroups & group.getMask()) != 0) {
                    if (sb.length() > 0) {
                        sb.append(", ");
                    }
                    sb.append(group);
                }
            }
            return sb.length() == 0 ? "NONE" : sb.toString();
        }
    }

    /**
+11 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.server.display;

import static android.view.DisplayInfo.DisplayInfoGroup.displayInfoGroupsToString;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.hardware.display.DisplayManagerGlobal;
@@ -23,6 +25,8 @@ import android.view.DisplayInfo;

import androidx.annotation.IntRange;

import java.io.PrintWriter;

/**
 * A proxy class for {@link DisplayInfo} objects.
 * This class wraps access to {@link DisplayInfo} objects by {@link LogicalDisplay} to allow
@@ -114,4 +118,11 @@ public class DisplayInfoProxy {
    public DisplayInfo.DisplayInfoChangeSource getDisplayInfoChangeSource() {
        return mDisplayInfoChangeSource;
    }

    /** Dump the state of this object for debugging purposes. */
    public void dumpLocked(PrintWriter pw) {
        pw.println("mDisplayInfoGroupsChanged="
                + displayInfoGroupsToString(mDisplayInfoGroupsChanged));
        pw.println("mDisplayInfoChangeSource=" + mDisplayInfoChangeSource);
    }
}
 No newline at end of file
+7 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.graphics.Rect;
import android.hardware.display.DisplayManagerInternal;
import android.util.ArraySet;
import android.util.DisplayMetrics;
import android.util.IndentingPrintWriter;
import android.util.Slog;
import android.util.SparseArray;
import android.view.Display;
@@ -1296,6 +1297,12 @@ final class LogicalDisplay {
        pw.println("mLayoutLimitedRefreshRate=" + mLayoutLimitedRefreshRate);
        pw.println("mThermalRefreshRateThrottling=" + mThermalRefreshRateThrottling);
        pw.println("mPowerThrottlingDataId=" + mPowerThrottlingDataId);

        IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "  ");
        ipw.println("DisplayInfoProxy (mInfo):");
        ipw.increaseIndent();
        mInfo.dumpLocked(ipw);
        ipw.decreaseIndent();
    }

    @Override