Merge "Convert NSSL debug props to FeatureFlags"

This commit is contained in:
Jeff DeCew
2021-12-31 02:50:58 +00:00
committed by Android (Google) Code Review
2 changed files with 31 additions and 25 deletions

View File

@@ -49,6 +49,12 @@ public class Flags {
public static final ResourceBooleanFlag NOTIFICATION_SHADE_DRAG =
new ResourceBooleanFlag(104, R.bool.config_enableNotificationShadeDrag);
public static final BooleanFlag NSSL_DEBUG_LINES =
new BooleanFlag(105, false);
public static final BooleanFlag NSSL_DEBUG_REMOVE_ANIMATION =
new BooleanFlag(106, false);
/***************************************/
// 200 - keyguard/lockscreen
public static final BooleanFlag KEYGUARD_LAYOUT =

View File

@@ -43,7 +43,6 @@ import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.AttributeSet;
@@ -80,6 +79,8 @@ import com.android.systemui.Dumpable;
import com.android.systemui.ExpandHelper;
import com.android.systemui.R;
import com.android.systemui.animation.Interpolators;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.EmptyShadeView;
@@ -132,14 +133,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
public static final float BACKGROUND_ALPHA_DIMMED = 0.7f;
private static final String TAG = "StackScroller";
// Usage:
// adb shell setprop persist.debug.nssl true && adb reboot
private static final boolean DEBUG = SystemProperties.getBoolean("persist.debug.nssl",
false /* default */);
// TODO(b/187291379) disable again before release
private static final boolean DEBUG_REMOVE_ANIMATION = SystemProperties.getBoolean(
"persist.debug.nssl.dismiss", false /* default */);
// Delay in milli-seconds before shade closes for clear all.
private final int DELAY_BEFORE_SHADE_CLOSE = 200;
private boolean mShadeNeedsToClose = false;
@@ -192,7 +185,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
private float mInitialTouchX;
private float mInitialTouchY;
private final boolean mDebugLines;
private Paint mDebugPaint;
/** Used to track the Y positions that were already used to draw debug text labels. */
private Set<Integer> mDebugTextUsedYPositions;
private final boolean mDebugRemoveAnimation;
private int mContentHeight;
private int mIntrinsicContentHeight;
private int mCollapsedSize;
@@ -569,6 +567,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
public NotificationStackScrollLayout(Context context, AttributeSet attrs) {
super(context, attrs, 0, 0);
Resources res = getResources();
FeatureFlags featureFlags = Dependency.get(FeatureFlags.class);
mDebugLines = featureFlags.isEnabled(Flags.NSSL_DEBUG_LINES);
mDebugRemoveAnimation = featureFlags.isEnabled(Flags.NSSL_DEBUG_REMOVE_ANIMATION);
mSectionsManager = Dependency.get(NotificationSectionsManager.class);
mScreenOffAnimationController =
Dependency.get(ScreenOffAnimationController.class);
@@ -591,10 +592,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
res.getBoolean(R.bool.config_drawNotificationBackground);
setOutlineProvider(mOutlineProvider);
boolean willDraw = mShouldDrawNotificationBackground || DEBUG;
boolean willDraw = mShouldDrawNotificationBackground || mDebugLines;
setWillNotDraw(!willDraw);
mBackgroundPaint.setAntiAlias(true);
if (DEBUG) {
if (mDebugLines) {
mDebugPaint = new Paint();
mDebugPaint.setColor(0xffff0000);
mDebugPaint.setStrokeWidth(2);
@@ -729,18 +730,17 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
drawHeadsUpBackground(canvas);
}
if (DEBUG) {
if (mDebugLines) {
onDrawDebug(canvas);
}
}
/** Used to track the Y positions that were already used to draw debug text labels. */
private static final Set<Integer> DEBUG_TEXT_USED_Y_POSITIONS =
DEBUG ? new HashSet<>() : Collections.emptySet();
private void onDrawDebug(Canvas canvas) {
DEBUG_TEXT_USED_Y_POSITIONS.clear();
if (mDebugTextUsedYPositions == null) {
mDebugTextUsedYPositions = new HashSet<>();
} else {
mDebugTextUsedYPositions.clear();
}
int y = mTopPadding;
drawDebugInfo(canvas, y, Color.RED, /* label= */ "mTopPadding");
@@ -776,10 +776,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
private int computeDebugYTextPosition(int lineY) {
int textY = lineY;
while (DEBUG_TEXT_USED_Y_POSITIONS.contains(textY)) {
while (mDebugTextUsedYPositions.contains(textY)) {
textY = (int) (textY + mDebugPaint.getTextSize());
}
DEBUG_TEXT_USED_Y_POSITIONS.add(textY);
mDebugTextUsedYPositions.add(textY);
return textY;
}
@@ -2702,14 +2702,14 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
boolean generateRemoveAnimation(ExpandableView child) {
String key = "";
if (DEBUG_REMOVE_ANIMATION) {
if (mDebugRemoveAnimation) {
if (child instanceof ExpandableNotificationRow) {
key = ((ExpandableNotificationRow) child).getEntry().getKey();
}
Log.d(TAG, "generateRemoveAnimation " + key);
}
if (removeRemovedChildFromHeadsUpChangeAnimations(child)) {
if (DEBUG_REMOVE_ANIMATION) {
if (mDebugRemoveAnimation) {
Log.d(TAG, "removedBecauseOfHeadsUp " + key);
}
mAddedHeadsUpChildren.remove(child);
@@ -2720,7 +2720,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
mClearTransientViewsWhenFinished.add(child);
return true;
}
if (DEBUG_REMOVE_ANIMATION) {
if (mDebugRemoveAnimation) {
Log.d(TAG, "generateRemove " + key
+ "\nmIsExpanded " + mIsExpanded
+ "\nmAnimationsEnabled " + mAnimationsEnabled
@@ -2728,7 +2728,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
if (mIsExpanded && mAnimationsEnabled && !isChildInInvisibleGroup(child)) {
if (!mChildrenToAddAnimated.contains(child)) {
if (DEBUG_REMOVE_ANIMATION) {
if (mDebugRemoveAnimation) {
Log.d(TAG, "needsAnimation = true " + key);
}
// Generate Animations
@@ -3227,7 +3227,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
ignoreChildren);
mAnimationEvents.add(event);
mSwipedOutViews.remove(child);
if (DEBUG_REMOVE_ANIMATION) {
if (mDebugRemoveAnimation) {
String key = "";
if (child instanceof ExpandableNotificationRow) {
key = ((ExpandableNotificationRow) child).getEntry().getKey();