Loading packages/SystemUI/src/com/android/systemui/media/MediaHost.kt +0 −18 Original line number Diff line number Diff line Loading @@ -199,14 +199,6 @@ class MediaHost constructor( } } override var squishFraction: Float = 1.0f set(value) { if (!value.equals(field)) { field = value changedListener?.invoke() } } override var showsOnlyActiveMedia: Boolean = false set(value) { if (!value.equals(field)) { Loading Loading @@ -257,7 +249,6 @@ class MediaHost constructor( override fun copy(): MediaHostState { val mediaHostState = MediaHostStateHolder() mediaHostState.expansion = expansion mediaHostState.squishFraction = squishFraction mediaHostState.showsOnlyActiveMedia = showsOnlyActiveMedia mediaHostState.measurementInput = measurementInput?.copy() mediaHostState.visible = visible Loading @@ -276,9 +267,6 @@ class MediaHost constructor( if (expansion != other.expansion) { return false } if (squishFraction != other.squishFraction) { return false } if (showsOnlyActiveMedia != other.showsOnlyActiveMedia) { return false } Loading @@ -297,7 +285,6 @@ class MediaHost constructor( override fun hashCode(): Int { var result = measurementInput?.hashCode() ?: 0 result = 31 * result + expansion.hashCode() result = 31 * result + squishFraction.hashCode() result = 31 * result + falsingProtectionNeeded.hashCode() result = 31 * result + showsOnlyActiveMedia.hashCode() result = 31 * result + if (visible) 1 else 2 Loading Loading @@ -337,11 +324,6 @@ interface MediaHostState { */ var expansion: Float /** * Fraction of the height animation. */ var squishFraction: Float /** * Is this host only showing active media or is it showing all of them including resumption? */ Loading packages/SystemUI/src/com/android/systemui/media/MediaViewController.kt +29 −56 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.systemui.media import android.content.Context import android.content.res.Configuration import androidx.annotation.VisibleForTesting import androidx.constraintlayout.widget.ConstraintSet import com.android.systemui.R import com.android.systemui.statusbar.policy.ConfigurationController Loading Loading @@ -276,62 +275,38 @@ class MediaViewController @Inject constructor( } } /** * Apply squishFraction to a copy of viewState such that the cached version is untouched. */ @VisibleForTesting internal fun squishViewState( viewState: TransitionViewState, squishFraction: Float ): TransitionViewState { val squishedViewState = viewState.copy() squishedViewState.height = (squishedViewState.height * squishFraction).toInt() val albumArtViewState = squishedViewState.widgetStates.get(R.id.album_art) if (albumArtViewState != null) { albumArtViewState.height = squishedViewState.height } return squishedViewState } /** * Obtain a new viewState for a given media state. This usually returns a cached state, but if * it's not available, it will recreate one by measuring, which may be expensive. */ @VisibleForTesting public fun obtainViewState(state: MediaHostState?): TransitionViewState? { private fun obtainViewState(state: MediaHostState?): TransitionViewState? { if (state == null || state.measurementInput == null) { return null } // Only a subset of the state is relevant to get a valid viewState. Let's get the cachekey var cacheKey = getKey(state, isGutsVisible, tmpKey) val viewState = viewStates[cacheKey] if (viewState != null) { // we already have cached this measurement, let's continue if (state.squishFraction < 1f) { return squishViewState(viewState, state.squishFraction) } return viewState } // Copy the key since this might call recursively into it and we're using tmpKey cacheKey = cacheKey.copy() val result: TransitionViewState? if (transitionLayout == null) { return null } // Not cached. Let's create a new measurement if (transitionLayout != null) { // Let's create a new measurement if (state.expansion == 0.0f || state.expansion == 1.0f) { result = transitionLayout!!.calculateViewState( state.measurementInput!!, constraintSetForExpansion(state.expansion), TransitionViewState()) setGutsViewState(result) // We don't want to cache interpolated or null states as this could quickly fill up // our cache. We only cache the start and the end states since the interpolation // is cheap setGutsViewState(result) viewStates[cacheKey] = result logger.logMediaSize("measured new viewState", result.width, result.height) } else { // This is an interpolated state val startState = state.copy().also { it.expansion = 0.0f } Loading @@ -340,16 +315,14 @@ class MediaViewController @Inject constructor( // from the start and end state and interpolate them val startViewState = obtainViewState(startState) as TransitionViewState val endState = state.copy().also { it.expansion = 1.0f } val endViewState = obtainViewState(endState) as TransitionViewState result = layoutController.getInterpolatedState( startViewState, endViewState, state.expansion) logger.logMediaSize("interpolated viewState", result.width, result.height) } if (state.squishFraction < 1f) { return squishViewState(result, state.squishFraction) } else { result = null } return result } Loading packages/SystemUI/src/com/android/systemui/qs/QSFragment.java +0 −1 Original line number Diff line number Diff line Loading @@ -624,7 +624,6 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca if (mQSAnimator != null) { mQSAnimator.setPosition(expansion); } mQqsMediaHost.setSquishFraction(mSquishinessFraction); updateMediaPositions(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +5 −0 Original line number Diff line number Diff line Loading @@ -1371,7 +1371,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable */ @ShadeViewRefactor(RefactorComponent.COORDINATOR) public void setExpandedHeight(float height) { final float shadeBottom = getHeight() - getEmptyBottomMargin(); final boolean skipHeightUpdate = shouldSkipHeightUpdate(); if (!skipHeightUpdate) { final float expansionFraction = MathUtils.saturate(height / shadeBottom); mAmbientState.setExpansionFraction(expansionFraction); } updateStackPosition(); if (!skipHeightUpdate) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +3 −1 Original line number Diff line number Diff line Loading @@ -3058,7 +3058,9 @@ public class NotificationPanelViewController extends PanelViewController { } private int calculatePanelHeightShade() { final int maxHeight = mNotificationStackScrollLayoutController.getHeight(); int emptyBottomMargin = mNotificationStackScrollLayoutController.getEmptyBottomMargin(); int maxHeight = mNotificationStackScrollLayoutController.getHeight() - emptyBottomMargin; if (mBarState == KEYGUARD) { int minKeyguardPanelBottom = mClockPositionAlgorithm.getLockscreenStatusViewHeight() + mNotificationStackScrollLayoutController.getIntrinsicContentHeight(); Loading Loading
packages/SystemUI/src/com/android/systemui/media/MediaHost.kt +0 −18 Original line number Diff line number Diff line Loading @@ -199,14 +199,6 @@ class MediaHost constructor( } } override var squishFraction: Float = 1.0f set(value) { if (!value.equals(field)) { field = value changedListener?.invoke() } } override var showsOnlyActiveMedia: Boolean = false set(value) { if (!value.equals(field)) { Loading Loading @@ -257,7 +249,6 @@ class MediaHost constructor( override fun copy(): MediaHostState { val mediaHostState = MediaHostStateHolder() mediaHostState.expansion = expansion mediaHostState.squishFraction = squishFraction mediaHostState.showsOnlyActiveMedia = showsOnlyActiveMedia mediaHostState.measurementInput = measurementInput?.copy() mediaHostState.visible = visible Loading @@ -276,9 +267,6 @@ class MediaHost constructor( if (expansion != other.expansion) { return false } if (squishFraction != other.squishFraction) { return false } if (showsOnlyActiveMedia != other.showsOnlyActiveMedia) { return false } Loading @@ -297,7 +285,6 @@ class MediaHost constructor( override fun hashCode(): Int { var result = measurementInput?.hashCode() ?: 0 result = 31 * result + expansion.hashCode() result = 31 * result + squishFraction.hashCode() result = 31 * result + falsingProtectionNeeded.hashCode() result = 31 * result + showsOnlyActiveMedia.hashCode() result = 31 * result + if (visible) 1 else 2 Loading Loading @@ -337,11 +324,6 @@ interface MediaHostState { */ var expansion: Float /** * Fraction of the height animation. */ var squishFraction: Float /** * Is this host only showing active media or is it showing all of them including resumption? */ Loading
packages/SystemUI/src/com/android/systemui/media/MediaViewController.kt +29 −56 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.systemui.media import android.content.Context import android.content.res.Configuration import androidx.annotation.VisibleForTesting import androidx.constraintlayout.widget.ConstraintSet import com.android.systemui.R import com.android.systemui.statusbar.policy.ConfigurationController Loading Loading @@ -276,62 +275,38 @@ class MediaViewController @Inject constructor( } } /** * Apply squishFraction to a copy of viewState such that the cached version is untouched. */ @VisibleForTesting internal fun squishViewState( viewState: TransitionViewState, squishFraction: Float ): TransitionViewState { val squishedViewState = viewState.copy() squishedViewState.height = (squishedViewState.height * squishFraction).toInt() val albumArtViewState = squishedViewState.widgetStates.get(R.id.album_art) if (albumArtViewState != null) { albumArtViewState.height = squishedViewState.height } return squishedViewState } /** * Obtain a new viewState for a given media state. This usually returns a cached state, but if * it's not available, it will recreate one by measuring, which may be expensive. */ @VisibleForTesting public fun obtainViewState(state: MediaHostState?): TransitionViewState? { private fun obtainViewState(state: MediaHostState?): TransitionViewState? { if (state == null || state.measurementInput == null) { return null } // Only a subset of the state is relevant to get a valid viewState. Let's get the cachekey var cacheKey = getKey(state, isGutsVisible, tmpKey) val viewState = viewStates[cacheKey] if (viewState != null) { // we already have cached this measurement, let's continue if (state.squishFraction < 1f) { return squishViewState(viewState, state.squishFraction) } return viewState } // Copy the key since this might call recursively into it and we're using tmpKey cacheKey = cacheKey.copy() val result: TransitionViewState? if (transitionLayout == null) { return null } // Not cached. Let's create a new measurement if (transitionLayout != null) { // Let's create a new measurement if (state.expansion == 0.0f || state.expansion == 1.0f) { result = transitionLayout!!.calculateViewState( state.measurementInput!!, constraintSetForExpansion(state.expansion), TransitionViewState()) setGutsViewState(result) // We don't want to cache interpolated or null states as this could quickly fill up // our cache. We only cache the start and the end states since the interpolation // is cheap setGutsViewState(result) viewStates[cacheKey] = result logger.logMediaSize("measured new viewState", result.width, result.height) } else { // This is an interpolated state val startState = state.copy().also { it.expansion = 0.0f } Loading @@ -340,16 +315,14 @@ class MediaViewController @Inject constructor( // from the start and end state and interpolate them val startViewState = obtainViewState(startState) as TransitionViewState val endState = state.copy().also { it.expansion = 1.0f } val endViewState = obtainViewState(endState) as TransitionViewState result = layoutController.getInterpolatedState( startViewState, endViewState, state.expansion) logger.logMediaSize("interpolated viewState", result.width, result.height) } if (state.squishFraction < 1f) { return squishViewState(result, state.squishFraction) } else { result = null } return result } Loading
packages/SystemUI/src/com/android/systemui/qs/QSFragment.java +0 −1 Original line number Diff line number Diff line Loading @@ -624,7 +624,6 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca if (mQSAnimator != null) { mQSAnimator.setPosition(expansion); } mQqsMediaHost.setSquishFraction(mSquishinessFraction); updateMediaPositions(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +5 −0 Original line number Diff line number Diff line Loading @@ -1371,7 +1371,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable */ @ShadeViewRefactor(RefactorComponent.COORDINATOR) public void setExpandedHeight(float height) { final float shadeBottom = getHeight() - getEmptyBottomMargin(); final boolean skipHeightUpdate = shouldSkipHeightUpdate(); if (!skipHeightUpdate) { final float expansionFraction = MathUtils.saturate(height / shadeBottom); mAmbientState.setExpansionFraction(expansionFraction); } updateStackPosition(); if (!skipHeightUpdate) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +3 −1 Original line number Diff line number Diff line Loading @@ -3058,7 +3058,9 @@ public class NotificationPanelViewController extends PanelViewController { } private int calculatePanelHeightShade() { final int maxHeight = mNotificationStackScrollLayoutController.getHeight(); int emptyBottomMargin = mNotificationStackScrollLayoutController.getEmptyBottomMargin(); int maxHeight = mNotificationStackScrollLayoutController.getHeight() - emptyBottomMargin; if (mBarState == KEYGUARD) { int minKeyguardPanelBottom = mClockPositionAlgorithm.getLockscreenStatusViewHeight() + mNotificationStackScrollLayoutController.getIntrinsicContentHeight(); Loading