summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java23
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java8
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java4
5 files changed, 37 insertions, 18 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java
index 8ab17432524d..6386365c2966 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java
@@ -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 = "";
@@ -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);
@@ -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
@@ -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()
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 970efd5cbfe2..f6c1b1c50fee 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -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() {
@@ -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();
@@ -533,7 +535,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
mGroupMembershipManager = groupMembershipManager;
mGroupExpansionManager = groupExpansionManager;
mStatusbarStateController = statusbarStateController;
- mFeatureFlags = featureFlags;
}
void initializeForegroundServiceSection(ForegroundServiceDungeonView fgsSectionView) {
@@ -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 {
@@ -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);
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 cd712044a60e..4ef6668acfb9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -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;
@@ -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;
@@ -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();
}
}
@@ -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;
@@ -1915,7 +1919,7 @@ public class NotificationPanelViewController extends PanelViewController {
mBarState != KEYGUARD
&& (!mQsExpanded
|| mQsExpansionFromOverscroll
- || Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources)));
+ || mShouldUseSplitNotificationShade));
if (mKeyguardUserSwitcherController != null && mQsExpanded
&& !mStackScrollerOverscrolling) {
@@ -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
@@ -2203,8 +2207,7 @@ public class NotificationPanelViewController extends PanelViewController {
return true;
}
- return !Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources)
- && (isInSettings() || mIsPanelCollapseOnQQS);
+ return !mShouldUseSplitNotificationShade && (isInSettings() || mIsPanelCollapseOnQQS);
}
@Override
@@ -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);
}
}
@@ -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;
}
@@ -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();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java
index fb817eac3e10..a2113b94740b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java
@@ -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();
}
}
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 ec5114e181e8..91f3611d548d 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
@@ -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();
@@ -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) {