summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Selim Cinek <cinek@google.com> 2018-10-15 17:37:21 -0700
committer Selim Cinek <cinek@google.com> 2018-10-16 15:11:24 -0700
commit3088766a3815137629d65ae986a4f64d50f98ee8 (patch)
treee4f5228c8c71f2b51371a0c0397e3ca54e7c44f9
parent8736e952916c4473d462a04f3011f2fcab9eae62 (diff)
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
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java33
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java28
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ViewState.java43
4 files changed, 111 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
index bce613a33859..d66d093d810e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
@@ -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.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java
index 46019e3b48ea..38d657b967a0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java
@@ -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.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 33ac390de29f..bac42ffceb92 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -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)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ViewState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ViewState.java
index 1f3244f2177d..a15fd7083017 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ViewState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ViewState.java
@@ -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);
+ }
}