Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +26 −5 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import com.android.systemui.statusbar.notification.NotificationInterruptionState import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag; import com.android.systemui.statusbar.phone.StatusBarWindowController; import com.android.systemui.statusbar.policy.ConfigurationController; import java.lang.annotation.Retention; Loading @@ -74,7 +75,8 @@ import javax.inject.Singleton; * The controller manages addition, removal, and visible state of bubbles on screen. */ @Singleton public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListener { public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListener, ConfigurationController.ConfigurationListener { private static final String TAG = "BubbleController"; Loading @@ -84,6 +86,7 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe @IntDef({DISMISS_USER_GESTURE, DISMISS_AGED, DISMISS_TASK_FINISHED, DISMISS_BLOCKED, DISMISS_NOTIF_CANCEL, DISMISS_ACCESSIBILITY_ACTION}) @interface DismissReason {} static final int DISMISS_USER_GESTURE = 1; static final int DISMISS_AGED = 2; static final int DISMISS_TASK_FINISHED = 3; Loading Loading @@ -151,6 +154,7 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe public interface BubbleExpandListener { /** * Called when the expansion state of the bubble stack changes. * * @param isExpanding whether it's expanding or collapsing * @param key the notification key associated with bubble being expanded */ Loading Loading @@ -179,13 +183,16 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe @Inject public BubbleController(Context context, StatusBarWindowController statusBarWindowController, BubbleData data) { this(context, statusBarWindowController, data, null /* synchronizer */); BubbleData data, ConfigurationController configurationController) { this(context, statusBarWindowController, data, null /* synchronizer */, configurationController); } public BubbleController(Context context, StatusBarWindowController statusBarWindowController, BubbleData data, @Nullable BubbleStackView.SurfaceSynchronizer synchronizer) { BubbleData data, @Nullable BubbleStackView.SurfaceSynchronizer synchronizer, ConfigurationController configurationController) { mContext = context; configurationController.addCallback(this /* configurationListener */); mNotificationEntryManager = Dependency.get(NotificationEntryManager.class); mNotificationEntryManager.addNotificationEntryListener(mEntryListener); Loading Loading @@ -215,6 +222,20 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe mSurfaceSynchronizer = synchronizer; } @Override public void onUiModeChanged() { if (mStackView != null) { mStackView.onConfigChanged(); } } @Override public void onOverlayChanged() { if (mStackView != null) { mStackView.onConfigChanged(); } } /** * Set a listener to be notified when some states of the bubbles change. */ Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +7 −0 Original line number Diff line number Diff line Loading @@ -354,6 +354,13 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList } } /** * Update bubble expanded view header when user toggles dark mode. */ void updateHeaderColor() { mHeaderView.setBackgroundColor(mContext.getColor(R.attr.colorAccent)); } private void updateHeaderView() { mSettingsIcon.setContentDescription(getResources().getString( R.string.bubbles_settings_button_description, mAppName)); Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +7 −0 Original line number Diff line number Diff line Loading @@ -238,6 +238,13 @@ public class BubbleStackView extends FrameLayout { mBubbleContainer.bringToFront(); } /** * Handle config changes. */ public void onConfigChanged() { mExpandedBubble.expandedView.updateHeaderColor(); } @Override public void getBoundsOnScreen(Rect outRect, boolean clipToParent) { getBoundsOnScreen(outRect); Loading packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java +9 −3 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.StatusBarWindowController; import com.android.systemui.statusbar.policy.ConfigurationController; import org.junit.Before; import org.junit.Test; Loading @@ -66,6 +67,9 @@ public class BubbleControllerTest extends SysuiTestCase { private IActivityManager mActivityManager; @Mock private DozeParameters mDozeParameters; @Mock private ConfigurationController mConfigurationController; private FrameLayout mStatusBarView; @Captor private ArgumentCaptor<NotificationEntryListener> mEntryListenerCaptor; Loading Loading @@ -97,6 +101,7 @@ public class BubbleControllerTest extends SysuiTestCase { mStatusBarView = new FrameLayout(mContext); mDependency.injectTestDependency(NotificationEntryManager.class, mNotificationEntryManager); // Bubbles get added to status bar window view mStatusBarWindowController = new StatusBarWindowController(mContext, mWindowManager, mActivityManager, mDozeParameters); Loading @@ -115,7 +120,7 @@ public class BubbleControllerTest extends SysuiTestCase { mBubbleData = new BubbleData(); mBubbleController = new TestableBubbleController(mContext, mStatusBarWindowController, mBubbleData); mBubbleData, mConfigurationController); mBubbleController.setBubbleStateChangeListener(mBubbleStateChangeListener); mBubbleController.setExpandListener(mBubbleExpandListener); Loading Loading @@ -331,8 +336,9 @@ public class BubbleControllerTest extends SysuiTestCase { static class TestableBubbleController extends BubbleController { // Let's assume surfaces can be synchronized immediately. TestableBubbleController(Context context, StatusBarWindowController statusBarWindowController, BubbleData data) { super(context, statusBarWindowController, data, Runnable::run); StatusBarWindowController statusBarWindowController, BubbleData data, ConfigurationController configurationController) { super(context, statusBarWindowController, data, Runnable::run, configurationController); } @Override Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +26 −5 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import com.android.systemui.statusbar.notification.NotificationInterruptionState import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag; import com.android.systemui.statusbar.phone.StatusBarWindowController; import com.android.systemui.statusbar.policy.ConfigurationController; import java.lang.annotation.Retention; Loading @@ -74,7 +75,8 @@ import javax.inject.Singleton; * The controller manages addition, removal, and visible state of bubbles on screen. */ @Singleton public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListener { public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListener, ConfigurationController.ConfigurationListener { private static final String TAG = "BubbleController"; Loading @@ -84,6 +86,7 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe @IntDef({DISMISS_USER_GESTURE, DISMISS_AGED, DISMISS_TASK_FINISHED, DISMISS_BLOCKED, DISMISS_NOTIF_CANCEL, DISMISS_ACCESSIBILITY_ACTION}) @interface DismissReason {} static final int DISMISS_USER_GESTURE = 1; static final int DISMISS_AGED = 2; static final int DISMISS_TASK_FINISHED = 3; Loading Loading @@ -151,6 +154,7 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe public interface BubbleExpandListener { /** * Called when the expansion state of the bubble stack changes. * * @param isExpanding whether it's expanding or collapsing * @param key the notification key associated with bubble being expanded */ Loading Loading @@ -179,13 +183,16 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe @Inject public BubbleController(Context context, StatusBarWindowController statusBarWindowController, BubbleData data) { this(context, statusBarWindowController, data, null /* synchronizer */); BubbleData data, ConfigurationController configurationController) { this(context, statusBarWindowController, data, null /* synchronizer */, configurationController); } public BubbleController(Context context, StatusBarWindowController statusBarWindowController, BubbleData data, @Nullable BubbleStackView.SurfaceSynchronizer synchronizer) { BubbleData data, @Nullable BubbleStackView.SurfaceSynchronizer synchronizer, ConfigurationController configurationController) { mContext = context; configurationController.addCallback(this /* configurationListener */); mNotificationEntryManager = Dependency.get(NotificationEntryManager.class); mNotificationEntryManager.addNotificationEntryListener(mEntryListener); Loading Loading @@ -215,6 +222,20 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe mSurfaceSynchronizer = synchronizer; } @Override public void onUiModeChanged() { if (mStackView != null) { mStackView.onConfigChanged(); } } @Override public void onOverlayChanged() { if (mStackView != null) { mStackView.onConfigChanged(); } } /** * Set a listener to be notified when some states of the bubbles change. */ Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +7 −0 Original line number Diff line number Diff line Loading @@ -354,6 +354,13 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList } } /** * Update bubble expanded view header when user toggles dark mode. */ void updateHeaderColor() { mHeaderView.setBackgroundColor(mContext.getColor(R.attr.colorAccent)); } private void updateHeaderView() { mSettingsIcon.setContentDescription(getResources().getString( R.string.bubbles_settings_button_description, mAppName)); Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +7 −0 Original line number Diff line number Diff line Loading @@ -238,6 +238,13 @@ public class BubbleStackView extends FrameLayout { mBubbleContainer.bringToFront(); } /** * Handle config changes. */ public void onConfigChanged() { mExpandedBubble.expandedView.updateHeaderColor(); } @Override public void getBoundsOnScreen(Rect outRect, boolean clipToParent) { getBoundsOnScreen(outRect); Loading
packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java +9 −3 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.StatusBarWindowController; import com.android.systemui.statusbar.policy.ConfigurationController; import org.junit.Before; import org.junit.Test; Loading @@ -66,6 +67,9 @@ public class BubbleControllerTest extends SysuiTestCase { private IActivityManager mActivityManager; @Mock private DozeParameters mDozeParameters; @Mock private ConfigurationController mConfigurationController; private FrameLayout mStatusBarView; @Captor private ArgumentCaptor<NotificationEntryListener> mEntryListenerCaptor; Loading Loading @@ -97,6 +101,7 @@ public class BubbleControllerTest extends SysuiTestCase { mStatusBarView = new FrameLayout(mContext); mDependency.injectTestDependency(NotificationEntryManager.class, mNotificationEntryManager); // Bubbles get added to status bar window view mStatusBarWindowController = new StatusBarWindowController(mContext, mWindowManager, mActivityManager, mDozeParameters); Loading @@ -115,7 +120,7 @@ public class BubbleControllerTest extends SysuiTestCase { mBubbleData = new BubbleData(); mBubbleController = new TestableBubbleController(mContext, mStatusBarWindowController, mBubbleData); mBubbleData, mConfigurationController); mBubbleController.setBubbleStateChangeListener(mBubbleStateChangeListener); mBubbleController.setExpandListener(mBubbleExpandListener); Loading Loading @@ -331,8 +336,9 @@ public class BubbleControllerTest extends SysuiTestCase { static class TestableBubbleController extends BubbleController { // Let's assume surfaces can be synchronized immediately. TestableBubbleController(Context context, StatusBarWindowController statusBarWindowController, BubbleData data) { super(context, statusBarWindowController, data, Runnable::run); StatusBarWindowController statusBarWindowController, BubbleData data, ConfigurationController configurationController) { super(context, statusBarWindowController, data, Runnable::run, configurationController); } @Override Loading