diff --git a/packages/SystemUI/res/values-sw600dp-land/config.xml b/packages/SystemUI/res/values-sw600dp-land/config.xml
index 6dff2e3ef6c28..a6321fe148947 100644
--- a/packages/SystemUI/res/values-sw600dp-land/config.xml
+++ b/packages/SystemUI/res/values-sw600dp-land/config.xml
@@ -19,4 +19,7 @@
2
+
+
+ true
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 44eeba1146a4e..bb04c3b356289 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -565,4 +565,7 @@
false
+
+
+ false
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
index a30f193c50a37..3b4759464891e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -95,6 +95,7 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
import com.android.systemui.qs.QSDetailDisplayer;
import com.android.systemui.statusbar.CommandQueue;
+import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.GestureRecorder;
import com.android.systemui.statusbar.KeyguardAffordanceView;
import com.android.systemui.statusbar.KeyguardIndicationController;
@@ -292,6 +293,7 @@ public class NotificationPanelViewController extends PanelViewController {
private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
private final KeyguardStatusViewComponent.Factory mKeyguardStatusViewComponentFactory;
private final QSDetailDisplayer mQSDetailDisplayer;
+ private final FeatureFlags mFeatureFlags;
private final ScrimController mScrimController;
// Maximum # notifications to show on Keyguard; extras will be collapsed in an overflow card.
// If there are exactly 1 + mMaxKeyguardNotifications, then still shows all notifications
@@ -554,7 +556,9 @@ public class NotificationPanelViewController extends PanelViewController {
QSDetailDisplayer qsDetailDisplayer,
ScrimController scrimController,
MediaDataManager mediaDataManager,
- AmbientState ambientState) {
+ AmbientState ambientState,
+ FeatureFlags featureFlags
+ ) {
super(view, falsingManager, dozeLog, keyguardStateController,
(SysuiStatusBarStateController) statusBarStateController, vibratorHelper,
latencyTracker, flingAnimationUtilsBuilder.get(), statusBarTouchableRegionManager,
@@ -571,6 +575,7 @@ public class NotificationPanelViewController extends PanelViewController {
mNotificationIconAreaController = notificationIconAreaController;
mKeyguardStatusViewComponentFactory = keyguardStatusViewComponentFactory;
mQSDetailDisplayer = qsDetailDisplayer;
+ mFeatureFlags = featureFlags;
mView.setWillNotDraw(!DEBUG);
mLayoutInflater = layoutInflater;
mFalsingManager = falsingManager;
@@ -768,6 +773,26 @@ public class NotificationPanelViewController extends PanelViewController {
lp.width = panelWidth;
mNotificationStackScrollLayoutController.setLayoutParams(lp);
}
+
+ if (shouldUseSplitNotificationShade()) {
+ // In order to change the constraints at runtime, all children of the Constraint Layout
+ // must have ids.
+ ensureAllViewsHaveIds(mNotificationContainerParent);
+ }
+ }
+
+ private boolean shouldUseSplitNotificationShade() {
+ return mFeatureFlags.isTwoColumnNotificationShadeEnabled()
+ && mResources.getBoolean(R.bool.config_use_split_notification_shade);
+ }
+
+ private static void ensureAllViewsHaveIds(ViewGroup parentView) {
+ for (int i = 0; i < parentView.getChildCount(); i++) {
+ View childView = parentView.getChildAt(i);
+ if (childView.getId() == View.NO_ID) {
+ childView.setId(View.generateViewId());
+ }
+ }
}
private void reInflateViews() {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
index 8d4470bb1cb6e..fa78ca6626e15 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
@@ -68,6 +68,7 @@ import com.android.systemui.media.MediaDataManager;
import com.android.systemui.media.MediaHierarchyManager;
import com.android.systemui.qs.QSDetailDisplayer;
import com.android.systemui.statusbar.CommandQueue;
+import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.KeyguardAffordanceView;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationShelfController;
@@ -204,6 +205,10 @@ public class NotificationPanelViewTest extends SysuiTestCase {
@Mock
private MediaDataManager mMediaDataManager;
@Mock
+ private FeatureFlags mFeatureFlags;
+ @Mock
+ private NotificationsQuickSettingsContainer mNotificationContainerParent;
+ @Mock
private AmbientState mAmbientState;
private NotificationPanelViewController mNotificationPanelViewController;
private View.AccessibilityDelegate mAccessibiltyDelegate;
@@ -219,6 +224,8 @@ public class NotificationPanelViewTest extends SysuiTestCase {
when(mResources.getDisplayMetrics()).thenReturn(mDisplayMetrics);
mDisplayMetrics.density = 100;
when(mResources.getBoolean(R.bool.config_enableNotificationShadeDrag)).thenReturn(true);
+ when(mResources.getDimensionPixelSize(R.dimen.qs_panel_width)).thenReturn(400);
+ when(mResources.getDimensionPixelSize(R.dimen.notification_panel_width)).thenReturn(400);
when(mView.getContext()).thenReturn(getContext());
when(mView.findViewById(R.id.keyguard_header)).thenReturn(mKeyguardStatusBar);
when(mView.findViewById(R.id.keyguard_clock_container)).thenReturn(mKeyguardClockSwitch);
@@ -237,6 +244,8 @@ public class NotificationPanelViewTest extends SysuiTestCase {
when(mView.findViewById(R.id.keyguard_status_view))
.thenReturn(mock(KeyguardStatusView.class));
when(mView.findViewById(R.id.keyguard_header)).thenReturn(mKeyguardStatusBar);
+ when(mView.findViewById(R.id.notification_container_parent))
+ .thenReturn(mNotificationContainerParent);
FlingAnimationUtils.Builder flingAnimationUtilsBuilder = new FlingAnimationUtils.Builder(
mDisplayMetrics);
@@ -264,6 +273,11 @@ public class NotificationPanelViewTest extends SysuiTestCase {
.thenReturn(mKeyguardClockSwitchController);
when(mKeyguardStatusViewComponent.getKeyguardStatusViewController())
.thenReturn(mKeyguardStatusViewController);
+ when(mQsFrame.getLayoutParams()).thenReturn(
+ new ViewGroup.LayoutParams(600, 400));
+ when(mNotificationStackScrollLayoutController.getLayoutParams()).thenReturn(
+ new ViewGroup.LayoutParams(600, 400));
+
mNotificationPanelViewController = new NotificationPanelViewController(mView,
mResources,
mLayoutInflater,
@@ -285,7 +299,8 @@ public class NotificationPanelViewTest extends SysuiTestCase {
new QSDetailDisplayer(),
mScrimController,
mMediaDataManager,
- mAmbientState);
+ mAmbientState,
+ mFeatureFlags);
mNotificationPanelViewController.initDependencies(
mStatusBar,
mNotificationShelfController);
@@ -400,6 +415,25 @@ public class NotificationPanelViewTest extends SysuiTestCase {
verify(mStatusBarKeyguardViewManager).showBouncer(true);
}
+ @Test
+ public void testAllChildrenOfNotificationContainer_haveIds() {
+ when(mNotificationContainerParent.getChildCount()).thenReturn(2);
+ when(mResources.getBoolean(R.bool.config_use_split_notification_shade)).thenReturn(true);
+ when(mFeatureFlags.isTwoColumnNotificationShadeEnabled()).thenReturn(true);
+
+ View view1 = new View(mContext);
+ view1.setId(1);
+ when(mNotificationContainerParent.getChildAt(0)).thenReturn(view1);
+
+ View view2 = mock(View.class);
+ when(mNotificationContainerParent.getChildAt(1)).thenReturn(view2);
+
+ mNotificationPanelViewController.updateResources();
+
+ assertThat(mNotificationContainerParent.getChildAt(0).getId()).isEqualTo(1);
+ assertThat(mNotificationContainerParent.getChildAt(1).getId()).isNotEqualTo(View.NO_ID);
+ }
+
private void onTouchEvent(MotionEvent ev) {
mTouchHandler.onTouch(mView, ev);
}