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

Commit 1ecb1d6a authored by Jeff DeCew's avatar Jeff DeCew Committed by Automerger Merge Worker
Browse files

Merge "Logging improvements for notification views" into udc-dev am: 9b5ba6f2

parents f6c80579 9b5ba6f2
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -733,12 +733,16 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        super.dump(pw, args);
        if (DUMP_VERBOSE) {
            DumpUtilsKt.withIncreasedIndent(pw, () -> {
                pw.println("mBackgroundNormal: " + mBackgroundNormal);
                if (mBackgroundNormal != null) {
                    DumpUtilsKt.withIncreasedIndent(pw, () -> {
                        mBackgroundNormal.dump(pw, args);
                dumpBackgroundView(pw, args);
            });
        }
    }

    protected void dumpBackgroundView(IndentingPrintWriter pw, String[] args) {
        pw.println("Background View: " + mBackgroundNormal);
        if (DUMP_VERBOSE && mBackgroundNormal != null) {
            DumpUtilsKt.withIncreasedIndent(pw, () -> {
                mBackgroundNormal.dump(pw, args);
            });
        }
    }
+2 −0
Original line number Diff line number Diff line
@@ -3593,6 +3593,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        // Skip super call; dump viewState ourselves
        pw.println("Notification: " + mEntry.getKey());
        DumpUtilsKt.withIncreasedIndent(pw, () -> {
            pw.println(this);
            pw.print("visibility: " + getVisibility());
            pw.print(", alpha: " + getAlpha());
            pw.print(", translation: " + getTranslation());
@@ -3612,6 +3613,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
                pw.println("no viewState!!!");
            }
            pw.println(getRoundableState().debugString());
            dumpBackgroundView(pw, args);

            int transientViewCount = mChildrenContainer == null
                    ? 0 : mChildrenContainer.getTransientViewCount();
+3 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import com.android.systemui.statusbar.notification.Roundable;
import com.android.systemui.statusbar.notification.RoundableState;
import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.util.Compile;
import com.android.systemui.util.DumpUtilsKt;

import java.io.PrintWriter;
@@ -52,7 +53,8 @@ import java.util.List;
public abstract class ExpandableView extends FrameLayout implements Dumpable, Roundable {
    private static final String TAG = "ExpandableView";
    /** whether the dump() for this class should include verbose details */
    protected static final boolean DUMP_VERBOSE = false;
    protected static final boolean DUMP_VERBOSE =
            Compile.IS_DEBUG && Log.isLoggable(TAG, Log.VERBOSE);

    private RoundableState mRoundableState = null;
    protected OnHeightChangedListener mOnHeightChangedListener;
+14 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.statusbar.notification.row;

import static com.android.systemui.util.ColorUtilKt.hexColorString;

import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Canvas;
@@ -27,6 +29,9 @@ import android.graphics.drawable.RippleDrawable;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.internal.util.ArrayUtils;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
@@ -44,6 +49,7 @@ public class NotificationBackgroundView extends View implements Dumpable {
    private int mClipTopAmount;
    private int mClipBottomAmount;
    private int mTintColor;
    @Nullable private Integer mRippleColor;
    private final float[] mCornerRadii = new float[8];
    private boolean mBottomIsRounded;
    private boolean mBottomAmountClips = true;
@@ -127,6 +133,7 @@ public class NotificationBackgroundView extends View implements Dumpable {
            unscheduleDrawable(mBackground);
        }
        mBackground = background;
        mRippleColor = null;
        mBackground.mutate();
        if (mBackground != null) {
            mBackground.setCallback(this);
@@ -215,6 +222,9 @@ public class NotificationBackgroundView extends View implements Dumpable {
        if (mBackground instanceof RippleDrawable) {
            RippleDrawable ripple = (RippleDrawable) mBackground;
            ripple.setColor(ColorStateList.valueOf(color));
            mRippleColor = color;
        } else {
            mRippleColor = null;
        }
    }

@@ -290,7 +300,7 @@ public class NotificationBackgroundView extends View implements Dumpable {
    }

    @Override
    public void dump(PrintWriter pw, String[] args) {
    public void dump(PrintWriter pw, @NonNull String[] args) {
        pw.println("mDontModifyCorners: " + mDontModifyCorners);
        pw.println("mClipTopAmount: " + mClipTopAmount);
        pw.println("mClipBottomAmount: " + mClipBottomAmount);
@@ -299,5 +309,8 @@ public class NotificationBackgroundView extends View implements Dumpable {
        pw.println("mBottomAmountClips: " + mBottomAmountClips);
        pw.println("mActualWidth: " + mActualWidth);
        pw.println("mActualHeight: " + mActualHeight);
        pw.println("mTintColor: " + hexColorString(mTintColor));
        pw.println("mRippleColor: " + hexColorString(mRippleColor));
        pw.println("mBackground: " + mBackground);
    }
}
+11 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.util
import android.content.res.TypedArray
import android.graphics.Color
import android.view.ContextThemeWrapper
import androidx.annotation.ColorInt

/** Returns an ARGB color version of [color] at the given [alpha]. */
fun getColorWithAlpha(color: Int, alpha: Float): Int =
@@ -35,8 +36,11 @@ fun getColorWithAlpha(color: Int, alpha: Float): Int =
 * otherwise, returns the color from the private attribute {@param privAttrId}.
 */
fun getPrivateAttrColorIfUnset(
    ctw: ContextThemeWrapper, attrArray: TypedArray,
    attrIndex: Int, defColor: Int, privAttrId: Int
    ctw: ContextThemeWrapper,
    attrArray: TypedArray,
    attrIndex: Int,
    defColor: Int,
    privAttrId: Int
): Int {
    // If the index is specified, use that value
    var a = attrArray
@@ -51,3 +55,8 @@ fun getPrivateAttrColorIfUnset(
    a.recycle()
    return color
}

/** Returns the color as a HTML hex color (or null) */
fun hexColorString(@ColorInt color: Int?): String = color
    ?.let { String.format("#%08x", it) }
    ?: "null"