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

Commit 3088766a authored by Selim Cinek's avatar Selim Cinek
Browse files

Added logging to debug the notification view hierarchy

Adding more logging to the systemUI tree to get useful
state to debug visual issues.

Test: grab bugreport
Bug: 80525283
Change-Id: Ia500dea632bc66f08c1ce350914ead033aba7383
parent 8736e952
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -94,6 +94,9 @@ import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
import com.android.systemui.statusbar.notification.stack.NotificationChildrenContainer;
import com.android.systemui.statusbar.notification.stack.StackScrollState;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BooleanSupplier;
@@ -3017,6 +3020,36 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        boolean onClick(View v, int x, int y, MenuItem item);
    }

    @Override
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        super.dump(fd, pw, args);
        pw.println("  Notification: " + getStatusBarNotification().getKey());
        pw.print("    visibility: " + getVisibility());
        pw.print(", alpha: " + getAlpha());
        pw.print(", translation: " + getTranslation());
        pw.print(", removed: " + isRemoved());
        pw.print(", privateShowing: " + (getShowingLayout() == mPrivateLayout));
        pw.println();
        pw.print("    ");
        if (mNotificationViewState != null) {
            mNotificationViewState.dump(fd, pw, args);
        } else {
            pw.print("no viewState!!!");
        }
        pw.println();
        pw.println();
        if (mIsSummaryWithChildren) {
            List<ExpandableNotificationRow> notificationChildren = getNotificationChildren();
            pw.println("  Children: " + notificationChildren.size());
            pw.println("  {");
            for(ExpandableNotificationRow child : notificationChildren) {
                child.dump(fd, pw, args);
            }
            pw.println("  }");
            pw.println();
        }
    }

    /**
     * Background task for executing IPCs to check if the notification is a system notification. The
     * output is used for both the blocking helper and the notification info.
+8 −1
Original line number Diff line number Diff line
@@ -25,16 +25,19 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import com.android.systemui.Dumpable;
import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.notification.stack.StackScrollState;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;

/**
 * An abstract view for expandable views.
 */
public abstract class ExpandableView extends FrameLayout {
public abstract class ExpandableView extends FrameLayout implements Dumpable {

    public static final float NO_ROUNDNESS = -1;
    protected OnHeightChangedListener mOnHeightChangedListener;
@@ -559,6 +562,10 @@ public abstract class ExpandableView extends FrameLayout {
        return false;
    }

    @Override
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    }

    /**
     * A listener notifying when {@link #getActualHeight} changes.
     */
+28 −0
Original line number Diff line number Diff line
@@ -4912,6 +4912,34 @@ public class NotificationStackScrollLayout extends ViewGroup
                mMaxTopPadding,
                mShouldShowShelfOnly ? "T" : "f",
                mQsExpansionFraction));
        int childCount = getChildCount();
        pw.println("  Number of children: " + childCount);
        pw.println();

        for (int i = 0; i < childCount; i++) {
            ExpandableView child = (ExpandableView) getChildAt(i);
            child.dump(fd, pw, args);
            if (!(child instanceof ExpandableNotificationRow)) {
                pw.println("  " + child.getClass().getSimpleName());
                // Notifications dump it's viewstate as part of their dump to support children
                ExpandableViewState viewState = mCurrentStackScrollState.getViewStateForView(
                        child);
                if (viewState == null) {
                    pw.println("    no viewState!!!");
                } else {
                    pw.print("    ");
                    viewState.dump(fd, pw, args);
                    pw.println();
                    pw.println();
                }
            }
        }
        pw.println("  Transient Views: " + childCount);
        int transientViewCount = getTransientViewCount();
        for (int i = 0; i < transientViewCount; i++) {
            ExpandableView child = (ExpandableView) getTransientView(i);
            child.dump(fd, pw, args);
        }
    }

    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
+42 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.util.Property;
import android.view.View;
import android.view.animation.Interpolator;

import com.android.systemui.Dumpable;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.statusbar.notification.row.ExpandableView;
@@ -32,12 +33,17 @@ import com.android.systemui.statusbar.notification.AnimatableProperty;
import com.android.systemui.statusbar.notification.PropertyAnimator;
import com.android.systemui.statusbar.policy.HeadsUpUtil;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

/**
 * A state of a view. This can be used to apply a set of view properties to a view with
 * {@link com.android.systemui.statusbar.notification.stack.StackScrollState} or start
 * animations with {@link com.android.systemui.statusbar.notification.stack.StackStateAnimator}.
*/
public class ViewState {
public class ViewState implements Dumpable {

    /**
     * Some animation properties that can be used to update running animations but not creating
@@ -710,4 +716,39 @@ public class ViewState {
            animator.cancel();
        }
    }

    @Override
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        StringBuilder result = new StringBuilder();
        result.append("ViewState { ");

        boolean first = true;
        Class currentClass = this.getClass();
        while (currentClass != null) {
            Field[] fields = currentClass.getDeclaredFields();
            // Print field names paired with their values
            for (Field field : fields) {
                int modifiers = field.getModifiers();
                if (Modifier.isStatic(modifiers) || field.isSynthetic()
                        || Modifier.isTransient(modifiers)) {
                    continue;
                }
                if (!first) {
                    result.append(", ");
                }
                try {
                    result.append(field.getName());
                    result.append(": ");
                    //requires access to private field:
                    field.setAccessible(true);
                    result.append(field.get(this));
                } catch (IllegalAccessException ex) {
                }
                first = false;
            }
            currentClass = currentClass.getSuperclass();
        }
        result.append(" }");
        pw.print(result);
    }
}