Loading packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java +6 −1 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr private final DumpManager mDumpManager; private final FeatureFlags mFeatureFlags; protected final ArrayList<TileRecord> mRecords = new ArrayList<>(); private boolean mShouldUseSplitNotificationShade; private int mLastOrientation; private String mCachedSpecs = ""; Loading @@ -81,6 +82,8 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr new QSPanel.OnConfigurationChangedListener() { @Override public void onConfigurationChange(Configuration newConfig) { mShouldUseSplitNotificationShade = Utils.shouldUseSplitNotificationShade(mFeatureFlags, getResources()); if (newConfig.orientation != mLastOrientation) { mLastOrientation = newConfig.orientation; switchTileLayout(false); Loading Loading @@ -119,6 +122,8 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr mDumpManager = dumpManager; mFeatureFlags = featureFlags; mQSLabelFlag = featureFlags.isQSLabelsEnabled(); mShouldUseSplitNotificationShade = Utils.shouldUseSplitNotificationShade(mFeatureFlags, getResources()); } @Override Loading Loading @@ -345,7 +350,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr } boolean shouldUseHorizontalLayout() { if (Utils.shouldUseSplitNotificationShade(mFeatureFlags, getResources())) { if (mShouldUseSplitNotificationShade) { return false; } return mUsingMediaPlayer && mMediaHost.getVisible() Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +8 −5 Original line number Diff line number Diff line Loading @@ -456,6 +456,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private long mNumHeadsUp; private NotificationStackScrollLayoutController.TouchHandler mTouchHandler; private final FeatureFlags mFeatureFlags; private boolean mShouldUseSplitNotificationShade; private final ExpandableView.OnHeightChangedListener mOnChildHeightChangedListener = new ExpandableView.OnHeightChangedListener() { Loading Loading @@ -500,7 +501,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable super(context, attrs, 0, 0); Resources res = getResources(); mSectionsManager = notificationSectionsManager; mFeatureFlags = featureFlags; mShouldUseSplitNotificationShade = shouldUseSplitNotificationShade(mFeatureFlags, res); mSectionsManager.initialize(this, LayoutInflater.from(context)); mSections = mSectionsManager.createSectionsForBuckets(); Loading Loading @@ -533,7 +535,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mGroupMembershipManager = groupMembershipManager; mGroupExpansionManager = groupExpansionManager; mStatusbarStateController = statusbarStateController; mFeatureFlags = featureFlags; } void initializeForegroundServiceSection(ForegroundServiceDungeonView fgsSectionView) { Loading Loading @@ -1164,7 +1165,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable if (stackStartPosition <= stackEndPosition) { stackHeight = stackEndPosition; } else { if (shouldUseSplitNotificationShade(mFeatureFlags, getResources())) { if (mShouldUseSplitNotificationShade) { // This prevents notifications from being collapsed when QS is expanded. stackHeight = (int) height; } else { Loading Loading @@ -1552,8 +1553,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mStatusBarHeight = getResources().getDimensionPixelOffset(R.dimen.status_bar_height); float densityScale = getResources().getDisplayMetrics().density; Resources res = getResources(); mShouldUseSplitNotificationShade = shouldUseSplitNotificationShade(mFeatureFlags, res); mStatusBarHeight = res.getDimensionPixelOffset(R.dimen.status_bar_height); float densityScale = res.getDisplayMetrics().density; mSwipeHelper.setDensityScale(densityScale); float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop(); mSwipeHelper.setPagingTouchSlop(pagingTouchSlop); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +13 −10 Original line number Diff line number Diff line Loading @@ -305,6 +305,7 @@ public class NotificationPanelViewController extends PanelViewController { // 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 private final int mMaxKeyguardNotifications; private boolean mShouldUseSplitNotificationShade; // Current max allowed keyguard notifications determined by measuring the panel private int mMaxAllowedKeyguardNotifications; Loading Loading @@ -598,6 +599,8 @@ public class NotificationPanelViewController extends PanelViewController { mKeyguardUserSwitcherEnabled && mResources.getBoolean( R.bool.config_keyguard_user_switch_opens_qs_details); keyguardUpdateMonitor.setKeyguardQsUserSwitchEnabled(mKeyguardQsUserSwitchEnabled); mShouldUseSplitNotificationShade = Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources); mView.setWillNotDraw(!DEBUG); mLayoutInflater = layoutInflater; mFalsingManager = falsingManager; Loading Loading @@ -736,7 +739,7 @@ public class NotificationPanelViewController extends PanelViewController { mView.setAccessibilityDelegate(mAccessibilityDelegate); // dynamically apply the split shade value overrides. if (Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources)) { if (mShouldUseSplitNotificationShade) { updateResources(); } } Loading Loading @@ -835,12 +838,13 @@ public class NotificationPanelViewController extends PanelViewController { public void updateResources() { int qsWidth = mResources.getDimensionPixelSize(R.dimen.qs_panel_width); int panelWidth = mResources.getDimensionPixelSize(R.dimen.notification_panel_width); mShouldUseSplitNotificationShade = Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources); // To change the constraints at runtime, all children of the ConstraintLayout must have ids ensureAllViewsHaveIds(mNotificationContainerParent); ConstraintSet constraintSet = new ConstraintSet(); constraintSet.clone(mNotificationContainerParent); if (Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources)) { if (mShouldUseSplitNotificationShade) { // width = 0 to take up all available space within constraints qsWidth = 0; panelWidth = 0; Loading Loading @@ -1915,7 +1919,7 @@ public class NotificationPanelViewController extends PanelViewController { mBarState != KEYGUARD && (!mQsExpanded || mQsExpansionFromOverscroll || Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources))); || mShouldUseSplitNotificationShade)); if (mKeyguardUserSwitcherController != null && mQsExpanded && !mStackScrollerOverscrolling) { Loading Loading @@ -1987,7 +1991,7 @@ public class NotificationPanelViewController extends PanelViewController { private float calculateQsTopPadding() { // in split shade mode we want notifications to be directly below status bar if (Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources) && !mKeyguardShowing) { if (mShouldUseSplitNotificationShade && !mKeyguardShowing) { return 0f; } if (mKeyguardShowing && (mQsExpandImmediate Loading Loading @@ -2203,8 +2207,7 @@ public class NotificationPanelViewController extends PanelViewController { return true; } return !Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources) && (isInSettings() || mIsPanelCollapseOnQQS); return !mShouldUseSplitNotificationShade && (isInSettings() || mIsPanelCollapseOnQQS); } @Override Loading Loading @@ -2631,7 +2634,7 @@ public class NotificationPanelViewController extends PanelViewController { super.onTrackingStarted(); if (mQsFullyExpanded) { mQsExpandImmediate = true; if (!Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources)) { if (!mShouldUseSplitNotificationShade) { mNotificationStackScrollLayoutController.setShouldShowShelfOnly(true); } } Loading Loading @@ -2882,7 +2885,7 @@ public class NotificationPanelViewController extends PanelViewController { */ protected void updateHorizontalPanelPosition(float x) { if (mNotificationStackScrollLayoutController.getWidth() * 1.75f > mView.getWidth() || Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources)) { || mShouldUseSplitNotificationShade) { resetHorizontalPanelPosition(); return; } Loading Loading @@ -3573,7 +3576,7 @@ public class NotificationPanelViewController extends PanelViewController { @Override public void onOverscrollTopChanged(float amount, boolean isRubberbanded) { // When in split shade, overscroll shouldn't carry through to QS if (Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources)) { if (mShouldUseSplitNotificationShade) { return; } cancelQsAnimation(); Loading packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -242,10 +242,18 @@ public class QSPanelControllerBaseTest extends SysuiTestCase { when(mMediaHost.getVisible()).thenReturn(true); when(mFeatureFlags.isTwoColumnNotificationShadeEnabled()).thenReturn(false); mController = new TestableQSPanelControllerBase(mQSPanel, mQSTileHost, mQSCustomizerController, mMediaHost, mMetricsLogger, mUiEventLogger, mQSLogger, mDumpManager, mFeatureFlags); assertThat(mController.shouldUseHorizontalLayout()).isTrue(); when(mFeatureFlags.isTwoColumnNotificationShadeEnabled()).thenReturn(true); when(mResources.getBoolean(R.bool.config_use_split_notification_shade)).thenReturn(true); mController = new TestableQSPanelControllerBase(mQSPanel, mQSTileHost, mQSCustomizerController, mMediaHost, mMetricsLogger, mUiEventLogger, mQSLogger, mDumpManager, mFeatureFlags); assertThat(mController.shouldUseHorizontalLayout()).isFalse(); } } packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -536,8 +536,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { @Test public void testCanCollapsePanelOnTouch_falseInDualPaneShade() { mStatusBarStateController.setState(SHADE); when(mResources.getBoolean(R.bool.config_use_split_notification_shade)).thenReturn(true); when(mFeatureFlags.isTwoColumnNotificationShadeEnabled()).thenReturn(true); enableSplitShade(); mNotificationPanelViewController.setQsExpanded(true); assertThat(mNotificationPanelViewController.canCollapsePanelOnTouch()).isFalse(); Loading @@ -562,6 +561,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { private void enableSplitShade() { when(mResources.getBoolean(R.bool.config_use_split_notification_shade)).thenReturn(true); when(mFeatureFlags.isTwoColumnNotificationShadeEnabled()).thenReturn(true); mNotificationPanelViewController.updateResources(); } private void onTouchEvent(MotionEvent ev) { Loading Loading
packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java +6 −1 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr private final DumpManager mDumpManager; private final FeatureFlags mFeatureFlags; protected final ArrayList<TileRecord> mRecords = new ArrayList<>(); private boolean mShouldUseSplitNotificationShade; private int mLastOrientation; private String mCachedSpecs = ""; Loading @@ -81,6 +82,8 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr new QSPanel.OnConfigurationChangedListener() { @Override public void onConfigurationChange(Configuration newConfig) { mShouldUseSplitNotificationShade = Utils.shouldUseSplitNotificationShade(mFeatureFlags, getResources()); if (newConfig.orientation != mLastOrientation) { mLastOrientation = newConfig.orientation; switchTileLayout(false); Loading Loading @@ -119,6 +122,8 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr mDumpManager = dumpManager; mFeatureFlags = featureFlags; mQSLabelFlag = featureFlags.isQSLabelsEnabled(); mShouldUseSplitNotificationShade = Utils.shouldUseSplitNotificationShade(mFeatureFlags, getResources()); } @Override Loading Loading @@ -345,7 +350,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr } boolean shouldUseHorizontalLayout() { if (Utils.shouldUseSplitNotificationShade(mFeatureFlags, getResources())) { if (mShouldUseSplitNotificationShade) { return false; } return mUsingMediaPlayer && mMediaHost.getVisible() Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +8 −5 Original line number Diff line number Diff line Loading @@ -456,6 +456,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private long mNumHeadsUp; private NotificationStackScrollLayoutController.TouchHandler mTouchHandler; private final FeatureFlags mFeatureFlags; private boolean mShouldUseSplitNotificationShade; private final ExpandableView.OnHeightChangedListener mOnChildHeightChangedListener = new ExpandableView.OnHeightChangedListener() { Loading Loading @@ -500,7 +501,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable super(context, attrs, 0, 0); Resources res = getResources(); mSectionsManager = notificationSectionsManager; mFeatureFlags = featureFlags; mShouldUseSplitNotificationShade = shouldUseSplitNotificationShade(mFeatureFlags, res); mSectionsManager.initialize(this, LayoutInflater.from(context)); mSections = mSectionsManager.createSectionsForBuckets(); Loading Loading @@ -533,7 +535,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mGroupMembershipManager = groupMembershipManager; mGroupExpansionManager = groupExpansionManager; mStatusbarStateController = statusbarStateController; mFeatureFlags = featureFlags; } void initializeForegroundServiceSection(ForegroundServiceDungeonView fgsSectionView) { Loading Loading @@ -1164,7 +1165,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable if (stackStartPosition <= stackEndPosition) { stackHeight = stackEndPosition; } else { if (shouldUseSplitNotificationShade(mFeatureFlags, getResources())) { if (mShouldUseSplitNotificationShade) { // This prevents notifications from being collapsed when QS is expanded. stackHeight = (int) height; } else { Loading Loading @@ -1552,8 +1553,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mStatusBarHeight = getResources().getDimensionPixelOffset(R.dimen.status_bar_height); float densityScale = getResources().getDisplayMetrics().density; Resources res = getResources(); mShouldUseSplitNotificationShade = shouldUseSplitNotificationShade(mFeatureFlags, res); mStatusBarHeight = res.getDimensionPixelOffset(R.dimen.status_bar_height); float densityScale = res.getDisplayMetrics().density; mSwipeHelper.setDensityScale(densityScale); float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop(); mSwipeHelper.setPagingTouchSlop(pagingTouchSlop); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +13 −10 Original line number Diff line number Diff line Loading @@ -305,6 +305,7 @@ public class NotificationPanelViewController extends PanelViewController { // 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 private final int mMaxKeyguardNotifications; private boolean mShouldUseSplitNotificationShade; // Current max allowed keyguard notifications determined by measuring the panel private int mMaxAllowedKeyguardNotifications; Loading Loading @@ -598,6 +599,8 @@ public class NotificationPanelViewController extends PanelViewController { mKeyguardUserSwitcherEnabled && mResources.getBoolean( R.bool.config_keyguard_user_switch_opens_qs_details); keyguardUpdateMonitor.setKeyguardQsUserSwitchEnabled(mKeyguardQsUserSwitchEnabled); mShouldUseSplitNotificationShade = Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources); mView.setWillNotDraw(!DEBUG); mLayoutInflater = layoutInflater; mFalsingManager = falsingManager; Loading Loading @@ -736,7 +739,7 @@ public class NotificationPanelViewController extends PanelViewController { mView.setAccessibilityDelegate(mAccessibilityDelegate); // dynamically apply the split shade value overrides. if (Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources)) { if (mShouldUseSplitNotificationShade) { updateResources(); } } Loading Loading @@ -835,12 +838,13 @@ public class NotificationPanelViewController extends PanelViewController { public void updateResources() { int qsWidth = mResources.getDimensionPixelSize(R.dimen.qs_panel_width); int panelWidth = mResources.getDimensionPixelSize(R.dimen.notification_panel_width); mShouldUseSplitNotificationShade = Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources); // To change the constraints at runtime, all children of the ConstraintLayout must have ids ensureAllViewsHaveIds(mNotificationContainerParent); ConstraintSet constraintSet = new ConstraintSet(); constraintSet.clone(mNotificationContainerParent); if (Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources)) { if (mShouldUseSplitNotificationShade) { // width = 0 to take up all available space within constraints qsWidth = 0; panelWidth = 0; Loading Loading @@ -1915,7 +1919,7 @@ public class NotificationPanelViewController extends PanelViewController { mBarState != KEYGUARD && (!mQsExpanded || mQsExpansionFromOverscroll || Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources))); || mShouldUseSplitNotificationShade)); if (mKeyguardUserSwitcherController != null && mQsExpanded && !mStackScrollerOverscrolling) { Loading Loading @@ -1987,7 +1991,7 @@ public class NotificationPanelViewController extends PanelViewController { private float calculateQsTopPadding() { // in split shade mode we want notifications to be directly below status bar if (Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources) && !mKeyguardShowing) { if (mShouldUseSplitNotificationShade && !mKeyguardShowing) { return 0f; } if (mKeyguardShowing && (mQsExpandImmediate Loading Loading @@ -2203,8 +2207,7 @@ public class NotificationPanelViewController extends PanelViewController { return true; } return !Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources) && (isInSettings() || mIsPanelCollapseOnQQS); return !mShouldUseSplitNotificationShade && (isInSettings() || mIsPanelCollapseOnQQS); } @Override Loading Loading @@ -2631,7 +2634,7 @@ public class NotificationPanelViewController extends PanelViewController { super.onTrackingStarted(); if (mQsFullyExpanded) { mQsExpandImmediate = true; if (!Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources)) { if (!mShouldUseSplitNotificationShade) { mNotificationStackScrollLayoutController.setShouldShowShelfOnly(true); } } Loading Loading @@ -2882,7 +2885,7 @@ public class NotificationPanelViewController extends PanelViewController { */ protected void updateHorizontalPanelPosition(float x) { if (mNotificationStackScrollLayoutController.getWidth() * 1.75f > mView.getWidth() || Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources)) { || mShouldUseSplitNotificationShade) { resetHorizontalPanelPosition(); return; } Loading Loading @@ -3573,7 +3576,7 @@ public class NotificationPanelViewController extends PanelViewController { @Override public void onOverscrollTopChanged(float amount, boolean isRubberbanded) { // When in split shade, overscroll shouldn't carry through to QS if (Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources)) { if (mShouldUseSplitNotificationShade) { return; } cancelQsAnimation(); Loading
packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -242,10 +242,18 @@ public class QSPanelControllerBaseTest extends SysuiTestCase { when(mMediaHost.getVisible()).thenReturn(true); when(mFeatureFlags.isTwoColumnNotificationShadeEnabled()).thenReturn(false); mController = new TestableQSPanelControllerBase(mQSPanel, mQSTileHost, mQSCustomizerController, mMediaHost, mMetricsLogger, mUiEventLogger, mQSLogger, mDumpManager, mFeatureFlags); assertThat(mController.shouldUseHorizontalLayout()).isTrue(); when(mFeatureFlags.isTwoColumnNotificationShadeEnabled()).thenReturn(true); when(mResources.getBoolean(R.bool.config_use_split_notification_shade)).thenReturn(true); mController = new TestableQSPanelControllerBase(mQSPanel, mQSTileHost, mQSCustomizerController, mMediaHost, mMetricsLogger, mUiEventLogger, mQSLogger, mDumpManager, mFeatureFlags); assertThat(mController.shouldUseHorizontalLayout()).isFalse(); } }
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -536,8 +536,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { @Test public void testCanCollapsePanelOnTouch_falseInDualPaneShade() { mStatusBarStateController.setState(SHADE); when(mResources.getBoolean(R.bool.config_use_split_notification_shade)).thenReturn(true); when(mFeatureFlags.isTwoColumnNotificationShadeEnabled()).thenReturn(true); enableSplitShade(); mNotificationPanelViewController.setQsExpanded(true); assertThat(mNotificationPanelViewController.canCollapsePanelOnTouch()).isFalse(); Loading @@ -562,6 +561,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { private void enableSplitShade() { when(mResources.getBoolean(R.bool.config_use_split_notification_shade)).thenReturn(true); when(mFeatureFlags.isTwoColumnNotificationShadeEnabled()).thenReturn(true); mNotificationPanelViewController.updateResources(); } private void onTouchEvent(MotionEvent ev) { Loading