Merge "Ensure stackHeight accounts for pulseHeight and dozeAmount where we used to use innerHeight." into sc-dev
This commit is contained in:
@@ -70,6 +70,7 @@ import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
|
|||||||
import com.android.systemui.statusbar.notification.row.OnUserInteractionCallback;
|
import com.android.systemui.statusbar.notification.row.OnUserInteractionCallback;
|
||||||
import com.android.systemui.statusbar.notification.stack.NotificationSectionsManager;
|
import com.android.systemui.statusbar.notification.stack.NotificationSectionsManager;
|
||||||
import com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm;
|
import com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm;
|
||||||
|
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
||||||
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.policy.HeadsUpManager;
|
import com.android.systemui.statusbar.policy.HeadsUpManager;
|
||||||
@@ -93,6 +94,10 @@ public interface NotificationsModule {
|
|||||||
StackScrollAlgorithm.SectionProvider bindSectionProvider(
|
StackScrollAlgorithm.SectionProvider bindSectionProvider(
|
||||||
NotificationSectionsManager impl);
|
NotificationSectionsManager impl);
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
StackScrollAlgorithm.BypassController bindBypassController(
|
||||||
|
KeyguardBypassController impl);
|
||||||
|
|
||||||
/** Provides an instance of {@link NotificationEntryManager} */
|
/** Provides an instance of {@link NotificationEntryManager} */
|
||||||
@SysUISingleton
|
@SysUISingleton
|
||||||
@Provides
|
@Provides
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
|||||||
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
|
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
|
||||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||||
import com.android.systemui.statusbar.notification.row.ExpandableView;
|
import com.android.systemui.statusbar.notification.row.ExpandableView;
|
||||||
|
import com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm.BypassController;
|
||||||
import com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm.SectionProvider;
|
import com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm.SectionProvider;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -43,6 +44,7 @@ public class AmbientState {
|
|||||||
private static final boolean NOTIFICATIONS_HAVE_SHADOWS = false;
|
private static final boolean NOTIFICATIONS_HAVE_SHADOWS = false;
|
||||||
|
|
||||||
private final SectionProvider mSectionProvider;
|
private final SectionProvider mSectionProvider;
|
||||||
|
private final BypassController mBypassController;
|
||||||
private int mScrollY;
|
private int mScrollY;
|
||||||
private boolean mDimmed;
|
private boolean mDimmed;
|
||||||
private ActivatableNotificationView mActivatedChild;
|
private ActivatableNotificationView mActivatedChild;
|
||||||
@@ -152,14 +154,25 @@ public class AmbientState {
|
|||||||
return mStackHeight;
|
return mStackHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Height of notifications panel, with the animation from pulseHeight accounted for.
|
||||||
|
*/
|
||||||
|
// TODO(b/192348384): move this logic to getStackHeight, and remove this and getInnerHeight
|
||||||
|
public float getPulseStackHeight() {
|
||||||
|
float pulseHeight = Math.min(mPulseHeight, mStackHeight);
|
||||||
|
return MathUtils.lerp(mStackHeight, pulseHeight, mDozeAmount);
|
||||||
|
}
|
||||||
|
|
||||||
/** Tracks the state from AlertingNotificationManager#hasNotifications() */
|
/** Tracks the state from AlertingNotificationManager#hasNotifications() */
|
||||||
private boolean mHasAlertEntries;
|
private boolean mHasAlertEntries;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AmbientState(
|
public AmbientState(
|
||||||
Context context,
|
Context context,
|
||||||
@NonNull SectionProvider sectionProvider) {
|
@NonNull SectionProvider sectionProvider,
|
||||||
|
@NonNull BypassController bypassController) {
|
||||||
mSectionProvider = sectionProvider;
|
mSectionProvider = sectionProvider;
|
||||||
|
mBypassController = bypassController;
|
||||||
reload(context);
|
reload(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,6 +310,13 @@ public class AmbientState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is bypass currently enabled?
|
||||||
|
*/
|
||||||
|
public boolean isBypassEnabled() {
|
||||||
|
return mBypassController.isBypassEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
public float getOverScrollAmount(boolean top) {
|
public float getOverScrollAmount(boolean top) {
|
||||||
return top ? mOverScrollTopAmount : mOverScrollBottomAmount;
|
return top ? mOverScrollTopAmount : mOverScrollBottomAmount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -421,10 +421,20 @@ public class StackScrollAlgorithm {
|
|||||||
// When pulsing (incoming notification on AOD), innerHeight is 0; clamp all
|
// When pulsing (incoming notification on AOD), innerHeight is 0; clamp all
|
||||||
// to shelf start, thereby hiding all notifications (except the first one, which
|
// to shelf start, thereby hiding all notifications (except the first one, which
|
||||||
// we later unhide in updatePulsingState)
|
// we later unhide in updatePulsingState)
|
||||||
final int stackBottom =
|
// TODO(b/192348384): merge InnerHeight with StackHeight
|
||||||
!ambientState.isShadeExpanded() || ambientState.isDozing()
|
final int stackBottom;
|
||||||
? ambientState.getInnerHeight()
|
if (ambientState.isBypassEnabled()) {
|
||||||
: (int) ambientState.getStackHeight();
|
// We want to use the stackHeight when pulse expanding, since the animation
|
||||||
|
// isn't currently optimized if the pulseHeight is continuously changing
|
||||||
|
// Let's improve this when we're merging the heights above
|
||||||
|
stackBottom = ambientState.isPulseExpanding()
|
||||||
|
? (int) ambientState.getStackHeight()
|
||||||
|
: ambientState.getInnerHeight();
|
||||||
|
} else {
|
||||||
|
stackBottom = !ambientState.isShadeExpanded() || ambientState.isDozing()
|
||||||
|
? ambientState.getInnerHeight()
|
||||||
|
: (int) ambientState.getPulseStackHeight();
|
||||||
|
}
|
||||||
final int shelfStart =
|
final int shelfStart =
|
||||||
stackBottom - ambientState.getShelf().getIntrinsicHeight();
|
stackBottom - ambientState.getShelf().getIntrinsicHeight();
|
||||||
viewState.yTranslation = Math.min(viewState.yTranslation, shelfStart);
|
viewState.yTranslation = Math.min(viewState.yTranslation, shelfStart);
|
||||||
@@ -742,4 +752,14 @@ public class StackScrollAlgorithm {
|
|||||||
*/
|
*/
|
||||||
boolean beginsSection(@NonNull View view, @Nullable View previous);
|
boolean beginsSection(@NonNull View view, @Nullable View previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for telling the StackScrollAlgorithm information about the bypass state
|
||||||
|
*/
|
||||||
|
public interface BypassController {
|
||||||
|
/**
|
||||||
|
* True if bypass is enabled. Note that this is always false if face auth is not enabled.
|
||||||
|
*/
|
||||||
|
boolean isBypassEnabled();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import com.android.systemui.dump.DumpManager
|
|||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController
|
import com.android.systemui.plugins.statusbar.StatusBarStateController
|
||||||
import com.android.systemui.statusbar.NotificationLockscreenUserManager
|
import com.android.systemui.statusbar.NotificationLockscreenUserManager
|
||||||
import com.android.systemui.statusbar.StatusBarState
|
import com.android.systemui.statusbar.StatusBarState
|
||||||
|
import com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController
|
import com.android.systemui.statusbar.policy.KeyguardStateController
|
||||||
import com.android.systemui.tuner.TunerService
|
import com.android.systemui.tuner.TunerService
|
||||||
import java.io.FileDescriptor
|
import java.io.FileDescriptor
|
||||||
@@ -35,7 +36,7 @@ import java.io.PrintWriter
|
|||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@SysUISingleton
|
@SysUISingleton
|
||||||
open class KeyguardBypassController : Dumpable {
|
open class KeyguardBypassController : Dumpable, StackScrollAlgorithm.BypassController {
|
||||||
|
|
||||||
private val mKeyguardStateController: KeyguardStateController
|
private val mKeyguardStateController: KeyguardStateController
|
||||||
private val statusBarStateController: StatusBarStateController
|
private val statusBarStateController: StatusBarStateController
|
||||||
@@ -67,6 +68,9 @@ open class KeyguardBypassController : Dumpable {
|
|||||||
lateinit var unlockController: BiometricUnlockController
|
lateinit var unlockController: BiometricUnlockController
|
||||||
var isPulseExpanding = false
|
var isPulseExpanding = false
|
||||||
|
|
||||||
|
/** delegates to [bypassEnabled] but conforms to [StackScrollAlgorithm.BypassController] */
|
||||||
|
override fun isBypassEnabled() = bypassEnabled
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If face unlock dismisses the lock screen or keeps user on keyguard for the current user.
|
* If face unlock dismisses the lock screen or keeps user on keyguard for the current user.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ import com.android.systemui.statusbar.notification.collection.legacy.Notificatio
|
|||||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||||
import com.android.systemui.statusbar.notification.row.FooterView;
|
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.KeyguardBypassController;
|
||||||
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.phone.UnlockedScreenOffAnimationController;
|
||||||
@@ -101,6 +102,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
@Mock private RemoteInputController mRemoteInputController;
|
@Mock private RemoteInputController mRemoteInputController;
|
||||||
@Mock private NotificationRoundnessManager mNotificationRoundnessManager;
|
@Mock private NotificationRoundnessManager mNotificationRoundnessManager;
|
||||||
@Mock private KeyguardBypassEnabledProvider mKeyguardBypassEnabledProvider;
|
@Mock private KeyguardBypassEnabledProvider mKeyguardBypassEnabledProvider;
|
||||||
|
@Mock private KeyguardBypassController mBypassController;
|
||||||
@Mock private NotificationSectionsManager mNotificationSectionsManager;
|
@Mock private NotificationSectionsManager mNotificationSectionsManager;
|
||||||
@Mock private NotificationSection mNotificationSection;
|
@Mock private NotificationSection mNotificationSection;
|
||||||
@Mock private SysuiStatusBarStateController mStatusBarStateController;
|
@Mock private SysuiStatusBarStateController mStatusBarStateController;
|
||||||
@@ -132,7 +134,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
when(mRemoteInputManager.getController()).thenReturn(mRemoteInputController);
|
when(mRemoteInputManager.getController()).thenReturn(mRemoteInputController);
|
||||||
|
|
||||||
// Interact with real instance of AmbientState.
|
// Interact with real instance of AmbientState.
|
||||||
mAmbientState = new AmbientState(mContext, mNotificationSectionsManager);
|
mAmbientState = new AmbientState(mContext, mNotificationSectionsManager, mBypassController);
|
||||||
|
|
||||||
// The actual class under test. You may need to work with this class directly when
|
// The actual class under test. You may need to work with this class directly when
|
||||||
// testing anonymous class members of mStackScroller, like mMenuEventListener,
|
// testing anonymous class members of mStackScroller, like mMenuEventListener,
|
||||||
|
|||||||
Reference in New Issue
Block a user