Merge "Fix issue where notifications are visible during screen off if bypass is enabled." into sc-dev
This commit is contained in:
@@ -98,8 +98,6 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var animatingScreenOff = false
|
|
||||||
|
|
||||||
private var collapsedEnoughToHide: Boolean = false
|
private var collapsedEnoughToHide: Boolean = false
|
||||||
|
|
||||||
var pulsing: Boolean = false
|
var pulsing: Boolean = false
|
||||||
@@ -236,11 +234,11 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onDozeAmountChanged(linear: Float, eased: Float) {
|
override fun onDozeAmountChanged(linear: Float, eased: Float) {
|
||||||
if (overrideDozeAmountIfBypass()) {
|
if (overrideDozeAmountIfAnimatingScreenOff(linear)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overrideDozeAmountIfAnimatingScreenOff(linear)) {
|
if (overrideDozeAmountIfBypass()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +265,7 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
|
|
||||||
override fun onStateChanged(newState: Int) {
|
override fun onStateChanged(newState: Int) {
|
||||||
if (unlockedScreenOffAnimationController.shouldPlayScreenOffAnimation()) {
|
if (unlockedScreenOffAnimationController.shouldPlayScreenOffAnimation()) {
|
||||||
if (animatingScreenOff &&
|
if (unlockedScreenOffAnimationController.isScreenOffAnimationPlaying() &&
|
||||||
state == StatusBarState.KEYGUARD &&
|
state == StatusBarState.KEYGUARD &&
|
||||||
newState == StatusBarState.SHADE) {
|
newState == StatusBarState.SHADE) {
|
||||||
// If we're animating the screen off and going from KEYGUARD back to SHADE, the
|
// If we're animating the screen off and going from KEYGUARD back to SHADE, the
|
||||||
@@ -275,12 +273,16 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
// dozing) so that the notifications are no longer hidden.
|
// dozing) so that the notifications are no longer hidden.
|
||||||
setDozeAmount(0f, 0f)
|
setDozeAmount(0f, 0f)
|
||||||
}
|
}
|
||||||
|
|
||||||
animatingScreenOff =
|
|
||||||
state == StatusBarState.SHADE && newState == StatusBarState.KEYGUARD
|
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideDozeAmountIfBypass()
|
if (overrideDozeAmountIfAnimatingScreenOff(mLinearDozeAmount)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (overrideDozeAmountIfBypass()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (bypassController.bypassEnabled &&
|
if (bypassController.bypassEnabled &&
|
||||||
newState == StatusBarState.KEYGUARD && state == StatusBarState.SHADE_LOCKED &&
|
newState == StatusBarState.KEYGUARD && state == StatusBarState.SHADE_LOCKED &&
|
||||||
(!statusBarStateController.isDozing || shouldAnimateVisibility())) {
|
(!statusBarStateController.isDozing || shouldAnimateVisibility())) {
|
||||||
@@ -330,12 +332,7 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
* animation. If true, the original doze amount should be ignored.
|
* animation. If true, the original doze amount should be ignored.
|
||||||
*/
|
*/
|
||||||
private fun overrideDozeAmountIfAnimatingScreenOff(linearDozeAmount: Float): Boolean {
|
private fun overrideDozeAmountIfAnimatingScreenOff(linearDozeAmount: Float): Boolean {
|
||||||
if (animatingScreenOff) {
|
if (unlockedScreenOffAnimationController.isScreenOffAnimationPlaying()) {
|
||||||
if (linearDozeAmount == 1f) {
|
|
||||||
animatingScreenOff = false
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
setDozeAmount(1f, 1f)
|
setDozeAmount(1f, 1f)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -395,11 +392,6 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
override fun onDozingChanged(isDozing: Boolean) {
|
override fun onDozingChanged(isDozing: Boolean) {
|
||||||
if (isDozing) {
|
if (isDozing) {
|
||||||
setNotificationsVisible(visible = false, animate = false, increaseSpeed = false)
|
setNotificationsVisible(visible = false, animate = false, increaseSpeed = false)
|
||||||
} else {
|
|
||||||
// We only unset the flag once we fully went asleep. If the user interrupts the
|
|
||||||
// animation in the middle, we have to abort the animation as well to make sure
|
|
||||||
// the notifications are visible again.
|
|
||||||
animatingScreenOff = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ import com.android.systemui.statusbar.phone.HeadsUpAppearanceController;
|
|||||||
import com.android.systemui.statusbar.phone.HeadsUpTouchHelper;
|
import com.android.systemui.statusbar.phone.HeadsUpTouchHelper;
|
||||||
import com.android.systemui.statusbar.phone.ShadeController;
|
import com.android.systemui.statusbar.phone.ShadeController;
|
||||||
import com.android.systemui.statusbar.phone.StatusBar;
|
import com.android.systemui.statusbar.phone.StatusBar;
|
||||||
|
import com.android.systemui.statusbar.phone.UnlockedScreenOffAnimationController;
|
||||||
import com.android.systemui.statusbar.policy.HeadsUpUtil;
|
import com.android.systemui.statusbar.policy.HeadsUpUtil;
|
||||||
import com.android.systemui.statusbar.policy.ScrollAdapter;
|
import com.android.systemui.statusbar.policy.ScrollAdapter;
|
||||||
import com.android.systemui.util.Assert;
|
import com.android.systemui.util.Assert;
|
||||||
@@ -456,6 +457,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
private long mNumHeadsUp;
|
private long mNumHeadsUp;
|
||||||
private NotificationStackScrollLayoutController.TouchHandler mTouchHandler;
|
private NotificationStackScrollLayoutController.TouchHandler mTouchHandler;
|
||||||
private final FeatureFlags mFeatureFlags;
|
private final FeatureFlags mFeatureFlags;
|
||||||
|
private final UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
|
||||||
private boolean mShouldUseSplitNotificationShade;
|
private boolean mShouldUseSplitNotificationShade;
|
||||||
|
|
||||||
private final ExpandableView.OnHeightChangedListener mOnChildHeightChangedListener =
|
private final ExpandableView.OnHeightChangedListener mOnChildHeightChangedListener =
|
||||||
@@ -497,11 +499,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
GroupMembershipManager groupMembershipManager,
|
GroupMembershipManager groupMembershipManager,
|
||||||
GroupExpansionManager groupExpansionManager,
|
GroupExpansionManager groupExpansionManager,
|
||||||
AmbientState ambientState,
|
AmbientState ambientState,
|
||||||
FeatureFlags featureFlags) {
|
FeatureFlags featureFlags,
|
||||||
|
UnlockedScreenOffAnimationController unlockedScreenOffAnimationController) {
|
||||||
super(context, attrs, 0, 0);
|
super(context, attrs, 0, 0);
|
||||||
Resources res = getResources();
|
Resources res = getResources();
|
||||||
mSectionsManager = notificationSectionsManager;
|
mSectionsManager = notificationSectionsManager;
|
||||||
mFeatureFlags = featureFlags;
|
mFeatureFlags = featureFlags;
|
||||||
|
mUnlockedScreenOffAnimationController = unlockedScreenOffAnimationController;
|
||||||
mShouldUseSplitNotificationShade = shouldUseSplitNotificationShade(mFeatureFlags, res);
|
mShouldUseSplitNotificationShade = shouldUseSplitNotificationShade(mFeatureFlags, res);
|
||||||
mSectionsManager.initialize(this, LayoutInflater.from(context));
|
mSectionsManager.initialize(this, LayoutInflater.from(context));
|
||||||
mSections = mSectionsManager.createSectionsForBuckets();
|
mSections = mSectionsManager.createSectionsForBuckets();
|
||||||
@@ -606,6 +610,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
RemoteInputController remoteInputController = mRemoteInputManager.getController();
|
RemoteInputController remoteInputController = mRemoteInputManager.getController();
|
||||||
boolean showFooterView = (showDismissView || mController.hasActiveNotifications())
|
boolean showFooterView = (showDismissView || mController.hasActiveNotifications())
|
||||||
&& mStatusBarState != StatusBarState.KEYGUARD
|
&& mStatusBarState != StatusBarState.KEYGUARD
|
||||||
|
&& !mUnlockedScreenOffAnimationController.isScreenOffAnimationPlaying()
|
||||||
&& (remoteInputController == null || !remoteInputController.isRemoteInputActive());
|
&& (remoteInputController == null || !remoteInputController.isRemoteInputActive());
|
||||||
boolean showHistory = Settings.Secure.getIntForUser(mContext.getContentResolver(),
|
boolean showHistory = Settings.Secure.getIntForUser(mContext.getContentResolver(),
|
||||||
Settings.Secure.NOTIFICATION_HISTORY_ENABLED, 0, UserHandle.USER_CURRENT) == 1;
|
Settings.Secure.NOTIFICATION_HISTORY_ENABLED, 0, UserHandle.USER_CURRENT) == 1;
|
||||||
@@ -4617,7 +4622,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
|
|
||||||
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected void setStatusBarState(int statusBarState) {
|
public void setStatusBarState(int statusBarState) {
|
||||||
mStatusBarState = statusBarState;
|
mStatusBarState = statusBarState;
|
||||||
mAmbientState.setStatusBarState(statusBarState);
|
mAmbientState.setStatusBarState(statusBarState);
|
||||||
updateSpeedBumpIndex();
|
updateSpeedBumpIndex();
|
||||||
|
|||||||
@@ -4283,7 +4283,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
/**
|
/**
|
||||||
* Reconfigures the shade to show the AOD UI (clock, smartspace, etc). This is called by the
|
* Reconfigures the shade to show the AOD UI (clock, smartspace, etc). This is called by the
|
||||||
* screen off animation controller in order to animate in AOD without "actually" fully switching
|
* screen off animation controller in order to animate in AOD without "actually" fully switching
|
||||||
* to the KEYGUARD state.
|
* to the KEYGUARD state, which is a heavy transition that causes jank as 10+ files react to the
|
||||||
|
* change.
|
||||||
*/
|
*/
|
||||||
public void showAodUi() {
|
public void showAodUi() {
|
||||||
setDozing(true /* dozing */, false /* animate */, null);
|
setDozing(true /* dozing */, false /* animate */, null);
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ import com.android.systemui.statusbar.notification.row.FooterView;
|
|||||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.KeyguardBypassEnabledProvider;
|
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.KeyguardBypassEnabledProvider;
|
||||||
import com.android.systemui.statusbar.phone.ShadeController;
|
import com.android.systemui.statusbar.phone.ShadeController;
|
||||||
import com.android.systemui.statusbar.phone.StatusBar;
|
import com.android.systemui.statusbar.phone.StatusBar;
|
||||||
|
import com.android.systemui.statusbar.phone.UnlockedScreenOffAnimationController;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -105,6 +106,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
@Mock private NotificationSwipeHelper mNotificationSwipeHelper;
|
@Mock private NotificationSwipeHelper mNotificationSwipeHelper;
|
||||||
@Mock private NotificationStackScrollLayoutController mStackScrollLayoutController;
|
@Mock private NotificationStackScrollLayoutController mStackScrollLayoutController;
|
||||||
@Mock private FeatureFlags mFeatureFlags;
|
@Mock private FeatureFlags mFeatureFlags;
|
||||||
|
@Mock private UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@UiThreadTest
|
@UiThreadTest
|
||||||
@@ -143,7 +145,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
mGroupMembershipManger,
|
mGroupMembershipManger,
|
||||||
mGroupExpansionManager,
|
mGroupExpansionManager,
|
||||||
mAmbientState,
|
mAmbientState,
|
||||||
mFeatureFlags);
|
mFeatureFlags,
|
||||||
|
mUnlockedScreenOffAnimationController);
|
||||||
mStackScrollerInternal.initView(getContext(), mKeyguardBypassEnabledProvider,
|
mStackScrollerInternal.initView(getContext(), mKeyguardBypassEnabledProvider,
|
||||||
mNotificationSwipeHelper);
|
mNotificationSwipeHelper);
|
||||||
mStackScroller = spy(mStackScrollerInternal);
|
mStackScroller = spy(mStackScrollerInternal);
|
||||||
|
|||||||
Reference in New Issue
Block a user