summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yining Liu <liuyining@google.com> 2023-05-30 23:03:47 +0000
committer Yining Liu <liuyining@google.com> 2023-06-01 20:09:03 +0000
commit5d695bff831b8f64d320d0385c65182127a01c5c (patch)
tree9436802241f52b2aecd2be04a81cffc76d9cc257
parent9cdcda8d45f8349faf48fee8bb47c09e2ac6082a (diff)
Add traces to the main thread inflation of NotificationHeaderView and HybridNotificationView
Add traces to the main thread inflation of NotificationHeaderView and HybridNotificationView to track the performance of inflation. Bug: 285039325 Test: Perfetto Change-Id: I1399c5ece6acea1f6997650254d61dd3f0b2b256
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridGroupManager.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java2
4 files changed, 24 insertions, 0 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 bfb6fb0fcdc7..9f397fe9ac0c 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
@@ -556,6 +556,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
}
public void onNotificationUpdated() {
+ if (mIsSummaryWithChildren) {
+ Trace.beginSection("ExpNotRow#onNotifUpdated (summary)");
+ } else {
+ Trace.beginSection("ExpNotRow#onNotifUpdated (leaf)");
+ }
for (NotificationContentView l : mLayouts) {
l.onNotificationUpdated(mEntry);
}
@@ -591,6 +596,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
mUpdateSelfBackgroundOnUpdate = false;
updateBackgroundColorsOfSelf();
}
+ Trace.endSection();
}
private void updateBackgroundColorsOfSelf() {
@@ -2588,6 +2594,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
mIsSummaryWithChildren = mChildrenContainer != null
&& mChildrenContainer.getNotificationChildCount() > 0;
if (mIsSummaryWithChildren) {
+ Trace.beginSection("ExpNotRow#onChildCountChanged (summary)");
NotificationViewWrapper wrapper = mChildrenContainer.getNotificationViewWrapper();
if (wrapper == null || wrapper.getNotificationHeader() == null) {
mChildrenContainer.recreateNotificationHeader(mExpandClickListener,
@@ -2599,6 +2606,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
updateChildrenAppearance();
updateChildrenVisibility();
applyChildrenRoundness();
+ if (mIsSummaryWithChildren) {
+ Trace.endSection();
+ }
}
protected void expandNotification() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridGroupManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridGroupManager.java
index 77fd05186090..3e10f2ad52e5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridGroupManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridGroupManager.java
@@ -22,6 +22,7 @@ import android.annotation.Nullable;
import android.app.Notification;
import android.content.Context;
import android.content.res.Resources;
+import android.os.Trace;
import android.service.notification.StatusBarNotification;
import android.util.TypedValue;
import android.view.LayoutInflater;
@@ -57,6 +58,7 @@ public class HybridGroupManager {
}
private HybridNotificationView inflateHybridView(View contentView, ViewGroup parent) {
+ Trace.beginSection("HybridGroupManager#inflateHybridView");
LayoutInflater inflater = LayoutInflater.from(mContext);
int layout = contentView instanceof ConversationLayout
? R.layout.hybrid_conversation_notification
@@ -64,6 +66,7 @@ public class HybridGroupManager {
HybridNotificationView hybrid = (HybridNotificationView)
inflater.inflate(layout, parent, false);
parent.addView(hybrid);
+ Trace.endSection();
return hybrid;
}
@@ -90,12 +93,18 @@ public class HybridGroupManager {
public HybridNotificationView bindFromNotification(HybridNotificationView reusableView,
View contentView, StatusBarNotification notification,
ViewGroup parent) {
+ boolean isNewView = false;
if (reusableView == null) {
+ Trace.beginSection("HybridGroupManager#bindFromNotification");
reusableView = inflateHybridView(contentView, parent);
+ isNewView = true;
}
CharSequence titleText = resolveTitle(notification.getNotification());
CharSequence contentText = resolveText(notification.getNotification());
reusableView.bind(titleText, contentText, contentView);
+ if (isNewView) {
+ Trace.endSection();
+ }
return reusableView;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
index 451d837b63a0..124df8c3b815 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
@@ -26,6 +26,7 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.RemoteException;
+import android.os.Trace;
import android.service.notification.StatusBarNotification;
import android.util.ArrayMap;
import android.util.AttributeSet;
@@ -1193,6 +1194,7 @@ public class NotificationContentView extends FrameLayout implements Notification
private void updateSingleLineView() {
if (mIsChildInGroup) {
+ Trace.beginSection("NotifContentView#updateSingleLineView");
boolean isNewView = mSingleLineView == null;
mSingleLineView = mHybridGroupManager.bindFromNotification(
mSingleLineView, mContractedChild, mNotificationEntry.getSbn(), this);
@@ -1200,6 +1202,7 @@ public class NotificationContentView extends FrameLayout implements Notification
updateViewVisibility(mVisibleType, VISIBLE_TYPE_SINGLELINE,
mSingleLineView, mSingleLineView);
}
+ Trace.endSection();
} else if (mSingleLineView != null) {
removeView(mSingleLineView);
mSingleLineView = null;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
index d18757d3453f..f8e374de11e2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
@@ -379,6 +379,7 @@ public class NotificationChildrenContainer extends ViewGroup
}
public void recreateNotificationHeader(OnClickListener listener, boolean isConversation) {
+ Trace.beginSection("NotifChildCont#recreateHeader");
mHeaderClickListener = listener;
mIsConversation = isConversation;
StatusBarNotification notification = mContainingNotification.getEntry().getSbn();
@@ -406,6 +407,7 @@ public class NotificationChildrenContainer extends ViewGroup
recreateLowPriorityHeader(builder, isConversation);
updateHeaderVisibility(false /* animate */);
updateChildrenAppearance();
+ Trace.endSection();
}
/**