From 6d00203188a5dbdf1f927b2da613f0da77aeda32 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Wed, 13 Feb 2019 13:45:17 -0800 Subject: [PATCH] Only populate activity view when we're showing it Follow up comments from ag/6274141 Test: manual - expand and collapse some activity view based bubbles atest BubbleTestController Bug: 123543995 Change-Id: I9024f074bdf91e9d2955bdb1007fb55c48e35c21 --- .../android/systemui/bubbles/BubbleExpandedView.java | 12 ++++++++++-- .../android/systemui/bubbles/BubbleStackView.java | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java index 3389c46f66b7f..492eadd240ed6 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java @@ -107,8 +107,10 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList private ActivityView.StateCallback mStateCallback = new ActivityView.StateCallback() { @Override public void onActivityViewReady(ActivityView view) { - mActivityViewReady = true; - mActivityView.startActivity(mBubbleIntent); + if (!mActivityViewReady) { + mActivityViewReady = true; + mActivityView.startActivity(mBubbleIntent); + } } @Override @@ -262,6 +264,12 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList updateHeaderView(); updatePermissionView(); updateExpandedView(); + } + + /** + * Lets activity view know it should be shown / populated. + */ + public void populateActivityView() { mActivityView.setCallback(mStateCallback); } diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java index 8bc83d4c852bb..6c1b93bd099f7 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -707,6 +707,7 @@ public class BubbleStackView extends FrameLayout implements BubbleTouchHandler.F mExpandedViewContainer.removeAllViews(); if (mExpandedBubble != null && mIsExpanded) { mExpandedViewContainer.addView(mExpandedBubble.expandedView); + mExpandedBubble.expandedView.populateActivityView(); mExpandedViewContainer.setVisibility(mIsExpanded ? VISIBLE : GONE); } }