Merge changes from topic "split-shade-cherry-pick-v2" into sc-v2-dev am: 52bbb0feb1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16407020

Change-Id: I0c8495d98c65d7bf7ab5876630a07c4014cf56c9
This commit is contained in:
TreeHugger Robot
2021-12-06 22:56:58 +00:00
committed by Automerger Merge Worker
6 changed files with 42 additions and 22 deletions

View File

@@ -109,6 +109,16 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
mPageToRestore = savedInstanceState.getInt(CURRENT_PAGE, -1); mPageToRestore = savedInstanceState.getInt(CURRENT_PAGE, -1);
} }
@Override
public int getTilesHeight() {
// Use the first page as that is the maximum height we need to show.
TileLayout tileLayout = mPages.get(0);
if (tileLayout == null) {
return 0;
}
return tileLayout.getTilesHeight();
}
@Override @Override
protected void onConfigurationChanged(Configuration newConfig) { protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);

View File

@@ -378,23 +378,24 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
} }
private void updateQsState() { private void updateQsState() {
final boolean expandVisually = mQsExpanded || mStackScrollerOverscrolling final boolean expanded = mQsExpanded || mInSplitShade;
final boolean expandVisually = expanded || mStackScrollerOverscrolling
|| mHeaderAnimating; || mHeaderAnimating;
mQSPanelController.setExpanded(mQsExpanded); mQSPanelController.setExpanded(expanded);
mQSDetail.setExpanded(mQsExpanded); mQSDetail.setExpanded(expanded);
boolean keyguardShowing = isKeyguardState(); boolean keyguardShowing = isKeyguardState();
mHeader.setVisibility((mQsExpanded || !keyguardShowing || mHeaderAnimating mHeader.setVisibility((expanded || !keyguardShowing || mHeaderAnimating
|| mShowCollapsedOnKeyguard) || mShowCollapsedOnKeyguard)
? View.VISIBLE ? View.VISIBLE
: View.INVISIBLE); : View.INVISIBLE);
mHeader.setExpanded((keyguardShowing && !mHeaderAnimating && !mShowCollapsedOnKeyguard) mHeader.setExpanded((keyguardShowing && !mHeaderAnimating && !mShowCollapsedOnKeyguard)
|| (mQsExpanded && !mStackScrollerOverscrolling), mQuickQSPanelController); || (expanded && !mStackScrollerOverscrolling), mQuickQSPanelController);
mFooter.setVisibility(!mQsDisabled && (mQsExpanded || !keyguardShowing || mHeaderAnimating mFooter.setVisibility(!mQsDisabled && (expanded || !keyguardShowing || mHeaderAnimating
|| mShowCollapsedOnKeyguard) || mShowCollapsedOnKeyguard)
? View.VISIBLE ? View.VISIBLE
: View.INVISIBLE); : View.INVISIBLE);
mFooter.setExpanded((keyguardShowing && !mHeaderAnimating && !mShowCollapsedOnKeyguard) mFooter.setExpanded((keyguardShowing && !mHeaderAnimating && !mShowCollapsedOnKeyguard)
|| (mQsExpanded && !mStackScrollerOverscrolling)); || (expanded && !mStackScrollerOverscrolling));
mQSPanelController.setVisibility( mQSPanelController.setVisibility(
!mQsDisabled && expandVisually ? View.VISIBLE : View.INVISIBLE); !mQsDisabled && expandVisually ? View.VISIBLE : View.INVISIBLE);
} }
@@ -406,7 +407,8 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
} }
private void updateShowCollapsedOnKeyguard() { private void updateShowCollapsedOnKeyguard() {
boolean showCollapsed = mBypassController.getBypassEnabled() || mTransitioningToFullShade; boolean showCollapsed = mBypassController.getBypassEnabled()
|| (mTransitioningToFullShade && !mInSplitShade);
if (showCollapsed != mShowCollapsedOnKeyguard) { if (showCollapsed != mShowCollapsedOnKeyguard) {
mShowCollapsedOnKeyguard = showCollapsed; mShowCollapsedOnKeyguard = showCollapsed;
updateQsState(); updateQsState();
@@ -486,6 +488,8 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
public void setInSplitShade(boolean inSplitShade) { public void setInSplitShade(boolean inSplitShade) {
mInSplitShade = inSplitShade; mInSplitShade = inSplitShade;
mQSAnimator.setTranslateWhileExpanding(inSplitShade); mQSAnimator.setTranslateWhileExpanding(inSplitShade);
updateShowCollapsedOnKeyguard();
updateQsState();
} }
@Override @Override
@@ -504,7 +508,8 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
public void setQsExpansion(float expansion, float panelExpansionFraction, public void setQsExpansion(float expansion, float panelExpansionFraction,
float proposedTranslation, float squishinessFraction) { float proposedTranslation, float squishinessFraction) {
float headerTranslation = mTransitioningToFullShade ? 0 : proposedTranslation; float headerTranslation = mTransitioningToFullShade ? 0 : proposedTranslation;
float progress = mTransitioningToFullShade ? mFullShadeProgress : panelExpansionFraction; float progress = mTransitioningToFullShade || mState == StatusBarState.KEYGUARD
? mFullShadeProgress : panelExpansionFraction;
setAlphaAnimationProgress(mInSplitShade ? progress : 1); setAlphaAnimationProgress(mInSplitShade ? progress : 1);
mContainer.setExpansion(expansion); mContainer.setExpansion(expansion);
final float translationScaleY = (mInSplitShade final float translationScaleY = (mInSplitShade

View File

@@ -258,13 +258,8 @@ public class QSPanel extends LinearLayout implements Tunable {
} }
private void updateViewPositions() { private void updateViewPositions() {
if (!(mTileLayout instanceof TileLayout)) {
return;
}
TileLayout layout = (TileLayout) mTileLayout;
// Adjust view positions based on tile squishing // Adjust view positions based on tile squishing
int tileHeightOffset = layout.getTilesHeight() - layout.getHeight(); int tileHeightOffset = mTileLayout.getTilesHeight() - mTileLayout.getHeight();
boolean move = false; boolean move = false;
for (int i = 0; i < getChildCount(); i++) { for (int i = 0; i < getChildCount(); i++) {
@@ -787,6 +782,12 @@ public class QSPanel extends LinearLayout implements Tunable {
/** */ /** */
void setListening(boolean listening, UiEventLogger uiEventLogger); void setListening(boolean listening, UiEventLogger uiEventLogger);
/** */
int getHeight();
/** */
int getTilesHeight();
/** /**
* Sets a size modifier for the tile. Where 0 means collapsed, and 1 expanded. * Sets a size modifier for the tile. Where 0 means collapsed, and 1 expanded.
*/ */

View File

@@ -275,6 +275,7 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
return Math.max(mColumns * mRows, 1); return Math.max(mColumns * mRows, 1);
} }
@Override
public int getTilesHeight() { public int getTilesHeight() {
return mLastTileBottom + getPaddingBottom(); return mLastTileBottom + getPaddingBottom();
} }

View File

@@ -174,7 +174,7 @@ class LockscreenShadeTransitionController @Inject constructor(
internal fun canDragDown(): Boolean { internal fun canDragDown(): Boolean {
return (statusBarStateController.state == StatusBarState.KEYGUARD || return (statusBarStateController.state == StatusBarState.KEYGUARD ||
nsslController.isInLockedDownShade()) && nsslController.isInLockedDownShade()) &&
qS.isFullyCollapsed (qS.isFullyCollapsed || useSplitShade)
} }
/** /**
@@ -285,7 +285,7 @@ class LockscreenShadeTransitionController @Inject constructor(
internal val isDragDownAnywhereEnabled: Boolean internal val isDragDownAnywhereEnabled: Boolean
get() = (statusBarStateController.getState() == StatusBarState.KEYGUARD && get() = (statusBarStateController.getState() == StatusBarState.KEYGUARD &&
!keyguardBypassController.bypassEnabled && !keyguardBypassController.bypassEnabled &&
qS.isFullyCollapsed) (qS.isFullyCollapsed || useSplitShade))
/** /**
* The amount in pixels that the user has dragged down. * The amount in pixels that the user has dragged down.

View File

@@ -2246,11 +2246,14 @@ public class NotificationPanelViewController extends PanelViewController {
private void updateQsExpansion() { private void updateQsExpansion() {
if (mQs == null) return; if (mQs == null) return;
float qsExpansionFraction = computeQsExpansionFraction(); final float squishiness =
float squishiness = mNotificationStackScrollLayoutController mQsExpandImmediate || mQsExpanded ? 1f : mNotificationStackScrollLayoutController
.getNotificationSquishinessFraction(); .getNotificationSquishinessFraction();
mQs.setQsExpansion(qsExpansionFraction, getExpandedFraction(), getHeaderTranslation(), final float qsExpansionFraction = computeQsExpansionFraction();
mQsExpandImmediate || mQsExpanded ? 1f : squishiness); final float adjustedExpansionFraction = mShouldUseSplitNotificationShade
? 1f : computeQsExpansionFraction();
mQs.setQsExpansion(adjustedExpansionFraction, getExpandedFraction(), getHeaderTranslation(),
squishiness);
mSplitShadeHeaderController.setQsExpandedFraction(qsExpansionFraction); mSplitShadeHeaderController.setQsExpandedFraction(qsExpansionFraction);
mMediaHierarchyManager.setQsExpansion(qsExpansionFraction); mMediaHierarchyManager.setQsExpansion(qsExpansionFraction);
int qsPanelBottomY = calculateQsBottomPosition(qsExpansionFraction); int qsPanelBottomY = calculateQsBottomPosition(qsExpansionFraction);