Revert suppression of recalculation to fix jump after aod->ls animation am: c003cb8785
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18581099 Change-Id: I090b83db4630087c3c4e9be88b278182317c4141 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -37,6 +37,7 @@ import kotlin.properties.Delegates.notNull
|
|||||||
|
|
||||||
private const val TAG = "NotifStackSizeCalc"
|
private const val TAG = "NotifStackSizeCalc"
|
||||||
private val DEBUG = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.DEBUG)
|
private val DEBUG = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.DEBUG)
|
||||||
|
private val SPEW = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.VERBOSE)
|
||||||
|
|
||||||
/** Calculates number of notifications to display and the height of the notification stack. */
|
/** Calculates number of notifications to display and the height of the notification stack. */
|
||||||
@SysUISingleton
|
@SysUISingleton
|
||||||
@@ -87,9 +88,10 @@ constructor(
|
|||||||
// Could be < 0 if the space available is less than the shelf size. Returns 0 in this case.
|
// Could be < 0 if the space available is less than the shelf size. Returns 0 in this case.
|
||||||
maxNotifications = max(0, maxNotifications)
|
maxNotifications = max(0, maxNotifications)
|
||||||
log {
|
log {
|
||||||
|
val sequence = if (SPEW) " stackHeightSequence=${stackHeightSequence.toList()}" else ""
|
||||||
"computeMaxKeyguardNotifications(" +
|
"computeMaxKeyguardNotifications(" +
|
||||||
"availableSpace=$totalAvailableSpace" +
|
"availableSpace=$totalAvailableSpace" +
|
||||||
" shelfHeight=$shelfIntrinsicHeight) -> $maxNotifications"
|
" shelfHeight=$shelfIntrinsicHeight) -> $maxNotifications$sequence"
|
||||||
}
|
}
|
||||||
return maxNotifications
|
return maxNotifications
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcherView;
|
|||||||
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
|
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
|
||||||
import com.android.systemui.statusbar.window.StatusBarWindowStateController;
|
import com.android.systemui.statusbar.window.StatusBarWindowStateController;
|
||||||
import com.android.systemui.unfold.SysUIUnfoldComponent;
|
import com.android.systemui.unfold.SysUIUnfoldComponent;
|
||||||
|
import com.android.systemui.util.Compile;
|
||||||
import com.android.systemui.util.LargeScreenUtils;
|
import com.android.systemui.util.LargeScreenUtils;
|
||||||
import com.android.systemui.util.ListenerSet;
|
import com.android.systemui.util.ListenerSet;
|
||||||
import com.android.systemui.util.Utils;
|
import com.android.systemui.util.Utils;
|
||||||
@@ -216,7 +217,8 @@ import javax.inject.Provider;
|
|||||||
@CentralSurfacesComponent.CentralSurfacesScope
|
@CentralSurfacesComponent.CentralSurfacesScope
|
||||||
public class NotificationPanelViewController extends PanelViewController {
|
public class NotificationPanelViewController extends PanelViewController {
|
||||||
|
|
||||||
private static final boolean DEBUG_LOGCAT = Log.isLoggable(TAG, Log.DEBUG);
|
private static final boolean DEBUG_LOGCAT = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.DEBUG);
|
||||||
|
private static final boolean SPEW_LOGCAT = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.VERBOSE);
|
||||||
private static final boolean DEBUG_DRAWABLE = false;
|
private static final boolean DEBUG_DRAWABLE = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1294,6 +1296,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
private void updateMaxDisplayedNotifications(boolean recompute) {
|
private void updateMaxDisplayedNotifications(boolean recompute) {
|
||||||
if (recompute) {
|
if (recompute) {
|
||||||
mMaxAllowedKeyguardNotifications = Math.max(computeMaxKeyguardNotifications(), 1);
|
mMaxAllowedKeyguardNotifications = Math.max(computeMaxKeyguardNotifications(), 1);
|
||||||
|
} else {
|
||||||
|
if (SPEW_LOGCAT) Log.d(TAG, "Skipping computeMaxKeyguardNotifications() by request");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mKeyguardShowing && !mKeyguardBypassController.getBypassEnabled()) {
|
if (mKeyguardShowing && !mKeyguardBypassController.getBypassEnabled()) {
|
||||||
@@ -1546,6 +1550,19 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
mNotificationStackScrollLayoutController.getHeight()
|
mNotificationStackScrollLayoutController.getHeight()
|
||||||
- staticTopPadding
|
- staticTopPadding
|
||||||
- bottomPadding;
|
- bottomPadding;
|
||||||
|
|
||||||
|
if (SPEW_LOGCAT) {
|
||||||
|
Log.d(TAG, "getSpaceForLockscreenNotifications()"
|
||||||
|
+ " availableSpace=" + availableSpace
|
||||||
|
+ " NSSL.height=" + mNotificationStackScrollLayoutController.getHeight()
|
||||||
|
+ " NSSL.top=" + mNotificationStackScrollLayoutController.getTop()
|
||||||
|
+ " staticTopPadding=" + staticTopPadding
|
||||||
|
+ " bottomPadding=" + bottomPadding
|
||||||
|
+ " lockIconPadding=" + lockIconPadding
|
||||||
|
+ " mIndicationBottomPadding=" + mIndicationBottomPadding
|
||||||
|
+ " mAmbientIndicationBottomPadding=" + mAmbientIndicationBottomPadding
|
||||||
|
);
|
||||||
|
}
|
||||||
return availableSpace;
|
return availableSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1554,7 +1571,12 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
int computeMaxKeyguardNotifications() {
|
int computeMaxKeyguardNotifications() {
|
||||||
if (mAmbientState.getFractionToShade() > 0 || mAmbientState.getDozeAmount() > 0) {
|
if (mAmbientState.getFractionToShade() > 0) {
|
||||||
|
if (SPEW_LOGCAT) {
|
||||||
|
Log.v(TAG, "Internally skipping computeMaxKeyguardNotifications()"
|
||||||
|
+ " fractionToShade=" + mAmbientState.getFractionToShade()
|
||||||
|
);
|
||||||
|
}
|
||||||
return mMaxAllowedKeyguardNotifications;
|
return mMaxAllowedKeyguardNotifications;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -577,20 +577,9 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
|||||||
.isEqualTo(-1);
|
.isEqualTo(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void computeMaxKeyguardNotifications_dozeAmountNotZero_returnsExistingMax() {
|
|
||||||
when(mAmbientState.getDozeAmount()).thenReturn(0.5f);
|
|
||||||
mNotificationPanelViewController.setMaxDisplayedNotifications(-1);
|
|
||||||
|
|
||||||
// computeMaxKeyguardNotifications sets maxAllowed to 0 at minimum if it updates the value
|
|
||||||
assertThat(mNotificationPanelViewController.computeMaxKeyguardNotifications())
|
|
||||||
.isEqualTo(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void computeMaxKeyguardNotifications_noTransition_updatesMax() {
|
public void computeMaxKeyguardNotifications_noTransition_updatesMax() {
|
||||||
when(mAmbientState.getFractionToShade()).thenReturn(0f);
|
when(mAmbientState.getFractionToShade()).thenReturn(0f);
|
||||||
when(mAmbientState.getDozeAmount()).thenReturn(0f);
|
|
||||||
mNotificationPanelViewController.setMaxDisplayedNotifications(-1);
|
mNotificationPanelViewController.setMaxDisplayedNotifications(-1);
|
||||||
|
|
||||||
// computeMaxKeyguardNotifications sets maxAllowed to 0 at minimum if it updates the value
|
// computeMaxKeyguardNotifications sets maxAllowed to 0 at minimum if it updates the value
|
||||||
|
|||||||
Reference in New Issue
Block a user