Merge "Revert "Moving smartspace to the right on the lockscreen for split shade"" into sc-v2-dev am: f8503766e7

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

Change-Id: I5d11db1b52d1b7d0c67a56314949232043452606
This commit is contained in:
Android Build Prod User
2021-08-25 11:44:15 +00:00
committed by Automerger Merge Worker
10 changed files with 164 additions and 203 deletions

View File

@@ -68,16 +68,6 @@
lockScreenWeight="400" lockScreenWeight="400"
/> />
</FrameLayout> </FrameLayout>
<FrameLayout
android:id="@+id/keyguard_smartspace_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/below_clock_padding_start"
android:paddingEnd="@dimen/below_clock_padding_end"
android:layout_alignParentStart="true"
android:layout_below="@id/lockscreen_clock_view"
/>
<!-- either keyguard_status_area or keyguard_smartspace_container is visible -->
<include layout="@layout/keyguard_status_area" <include layout="@layout/keyguard_status_area"
android:id="@+id/keyguard_status_area" android:id="@+id/keyguard_status_area"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -86,18 +86,6 @@
layout="@layout/keyguard_status_view" layout="@layout/keyguard_status_view"
android:visibility="gone"/> android:visibility="gone"/>
<FrameLayout
android:id="@+id/split_shade_smartspace_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingStart="@dimen/notification_side_paddings"
android:paddingEnd="@dimen/notification_side_paddings"
systemui:layout_constraintStart_toStartOf="@id/qs_edge_guideline"
systemui:layout_constraintEnd_toEndOf="parent"
systemui:layout_constraintTop_toTopOf="parent"
android:visibility="gone">
</FrameLayout>
<include layout="@layout/dock_info_overlay"/> <include layout="@layout/dock_info_overlay"/>
<FrameLayout <FrameLayout

View File

@@ -17,13 +17,13 @@
package com.android.keyguard; package com.android.keyguard;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import static com.android.keyguard.KeyguardClockSwitch.LARGE; import static com.android.keyguard.KeyguardClockSwitch.LARGE;
import android.app.WallpaperManager; import android.app.WallpaperManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
@@ -93,7 +93,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
private final ClockManager.ClockChangedListener mClockChangedListener = this::setClockPlugin; private final ClockManager.ClockChangedListener mClockChangedListener = this::setClockPlugin;
private ViewGroup mSmartspaceContainer; // If set, will replace keyguard_status_area
private View mSmartspaceView;
private final KeyguardUnlockAnimationController mKeyguardUnlockAnimationController; private final KeyguardUnlockAnimationController mKeyguardUnlockAnimationController;
private SmartspaceTransitionController mSmartspaceTransitionController; private SmartspaceTransitionController mSmartspaceTransitionController;
@@ -147,8 +148,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
mClockFrame = mView.findViewById(R.id.lockscreen_clock_view); mClockFrame = mView.findViewById(R.id.lockscreen_clock_view);
mLargeClockFrame = mView.findViewById(R.id.lockscreen_clock_view_large); mLargeClockFrame = mView.findViewById(R.id.lockscreen_clock_view_large);
mSmartspaceContainer = mView.findViewById(R.id.keyguard_smartspace_container);
mSmartspaceController.setKeyguardStatusContainer(mSmartspaceContainer);
mClockViewController = mClockViewController =
new AnimatableClockController( new AnimatableClockController(
@@ -190,25 +189,35 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
} }
updateAodIcons(); updateAodIcons();
if (mSmartspaceController.isSmartspaceEnabled()) { if (mSmartspaceController.isEnabled()) {
// "Enabled" doesn't mean smartspace is displayed here - inside mSmartspaceContainer - mSmartspaceView = mSmartspaceController.buildAndConnectView(mView);
// it might be a part of another view when in split shade. But it means that it CAN be
// displayed here, so we want to hide keyguard_status_area and set views relations
// accordingly.
View ksa = mView.findViewById(R.id.keyguard_status_area); View ksa = mView.findViewById(R.id.keyguard_status_area);
// we show either keyguard_status_area or smartspace, so when smartspace can be visible, int ksaIndex = mView.indexOfChild(ksa);
// keyguard_status_area should be hidden
ksa.setVisibility(View.GONE); ksa.setVisibility(View.GONE);
// Place smartspace view below normal clock...
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
MATCH_PARENT, WRAP_CONTENT);
lp.addRule(RelativeLayout.BELOW, R.id.lockscreen_clock_view);
mView.addView(mSmartspaceView, ksaIndex, lp);
int startPadding = getContext().getResources()
.getDimensionPixelSize(R.dimen.below_clock_padding_start);
int endPadding = getContext().getResources()
.getDimensionPixelSize(R.dimen.below_clock_padding_end);
mSmartspaceView.setPaddingRelative(startPadding, 0, endPadding, 0);
updateClockLayout(); updateClockLayout();
View nic = mView.findViewById(R.id.left_aligned_notification_icon_container); View nic = mView.findViewById(
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) nic.getLayoutParams(); R.id.left_aligned_notification_icon_container);
lp.addRule(RelativeLayout.BELOW, mSmartspaceContainer.getId()); lp = (RelativeLayout.LayoutParams) nic.getLayoutParams();
lp.addRule(RelativeLayout.BELOW, mSmartspaceView.getId());
nic.setLayoutParams(lp); nic.setLayoutParams(lp);
mView.setSmartspaceView(mSmartspaceContainer);
mSmartspaceTransitionController.setLockscreenSmartspace(mSmartspaceContainer); mView.setSmartspaceView(mSmartspaceView);
mSmartspaceTransitionController.setLockscreenSmartspace(mSmartspaceView);
} }
} }
@@ -231,7 +240,10 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
// instance of this class. In order to fix this, we need to modify the plugin so that // instance of this class. In order to fix this, we need to modify the plugin so that
// (a) we get a new view each time and (b) we can properly clean up an old view by making // (a) we get a new view each time and (b) we can properly clean up an old view by making
// it unregister itself as a plugin listener. // it unregister itself as a plugin listener.
mSmartspaceContainer.removeAllViews(); if (mSmartspaceView != null) {
mView.removeView(mSmartspaceView);
mSmartspaceView = null;
}
} }
/** /**
@@ -244,7 +256,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
} }
private void updateClockLayout() { private void updateClockLayout() {
if (mSmartspaceController.isSmartspaceEnabled()) { if (mSmartspaceController.isEnabled()) {
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(MATCH_PARENT, RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(MATCH_PARENT,
MATCH_PARENT); MATCH_PARENT);
lp.topMargin = getContext().getResources().getDimensionPixelSize( lp.topMargin = getContext().getResources().getDimensionPixelSize(
@@ -309,8 +321,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
PropertyAnimator.setProperty(mLargeClockFrame, AnimatableProperty.SCALE_Y, PropertyAnimator.setProperty(mLargeClockFrame, AnimatableProperty.SCALE_Y,
scale, props, animate); scale, props, animate);
if (mSmartspaceContainer != null) { if (mSmartspaceView != null) {
PropertyAnimator.setProperty(mSmartspaceContainer, AnimatableProperty.TRANSLATION_X, PropertyAnimator.setProperty(mSmartspaceView, AnimatableProperty.TRANSLATION_X,
x, props, animate); x, props, animate);
// If we're unlocking with the SmartSpace shared element transition, let the controller // If we're unlocking with the SmartSpace shared element transition, let the controller
@@ -328,8 +340,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
public void setChildrenAlphaExcludingSmartspace(float alpha) { public void setChildrenAlphaExcludingSmartspace(float alpha) {
final Set<View> excludedViews = new HashSet<>(); final Set<View> excludedViews = new HashSet<>();
if (mSmartspaceContainer != null) { if (mSmartspaceView != null) {
excludedViews.add(mSmartspaceContainer); excludedViews.add(mSmartspaceView);
} }
setChildrenAlphaExcluding(alpha, excludedViews); setChildrenAlphaExcluding(alpha, excludedViews);

View File

@@ -31,8 +31,6 @@ import android.os.Handler
import android.os.UserHandle import android.os.UserHandle
import android.provider.Settings import android.provider.Settings
import android.view.View import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.ViewGroup import android.view.ViewGroup
import com.android.settingslib.Utils import com.android.settingslib.Utils
import com.android.systemui.R import com.android.systemui.R
@@ -46,21 +44,14 @@ import com.android.systemui.plugins.FalsingManager
import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.settings.UserTracker import com.android.systemui.settings.UserTracker
import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.FeatureFlags
import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.statusbar.notification.AnimatableProperty
import com.android.systemui.statusbar.notification.PropertyAnimator
import com.android.systemui.statusbar.notification.stack.AnimationProperties
import com.android.systemui.statusbar.notification.stack.StackStateAnimator
import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.util.concurrency.Execution import com.android.systemui.util.concurrency.Execution
import com.android.systemui.util.settings.SecureSettings import com.android.systemui.util.settings.SecureSettings
import java.lang.RuntimeException
import java.util.Optional import java.util.Optional
import java.util.concurrent.Executor import java.util.concurrent.Executor
import javax.inject.Inject import javax.inject.Inject
private val ANIMATION_PROPERTIES = AnimationProperties()
.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD.toLong())
/** /**
* Controller for managing the smartspace view on the lockscreen * Controller for managing the smartspace view on the lockscreen
*/ */
@@ -81,15 +72,10 @@ class LockscreenSmartspaceController @Inject constructor(
@Main private val handler: Handler, @Main private val handler: Handler,
optionalPlugin: Optional<BcSmartspaceDataPlugin> optionalPlugin: Optional<BcSmartspaceDataPlugin>
) { ) {
var splitShadeContainer: ViewGroup? = null
private var singlePaneContainer: ViewGroup? = null
private var session: SmartspaceSession? = null private var session: SmartspaceSession? = null
private val plugin: BcSmartspaceDataPlugin? = optionalPlugin.orElse(null) private val plugin: BcSmartspaceDataPlugin? = optionalPlugin.orElse(null)
private lateinit var smartspaceView: SmartspaceView private lateinit var smartspaceView: SmartspaceView
// smartspace casted to View
lateinit var view: View lateinit var view: View
private set private set
@@ -97,60 +83,12 @@ class LockscreenSmartspaceController @Inject constructor(
private var showSensitiveContentForManagedUser = false private var showSensitiveContentForManagedUser = false
private var managedUserHandle: UserHandle? = null private var managedUserHandle: UserHandle? = null
private var isAod = false fun isEnabled(): Boolean {
private var isSplitShade = false
fun isSmartspaceEnabled(): Boolean {
execution.assertIsMainThread() execution.assertIsMainThread()
return featureFlags.isSmartspaceEnabled && plugin != null return featureFlags.isSmartspaceEnabled && plugin != null
} }
fun setKeyguardStatusContainer(container: ViewGroup) {
singlePaneContainer = container
// reattach smartspace if necessary as this might be a new container
updateSmartSpaceContainer()
}
fun onSplitShadeChanged(splitShade: Boolean) {
isSplitShade = splitShade
updateSmartSpaceContainer()
}
private fun updateSmartSpaceContainer() {
if (!isSmartspaceEnabled()) return
// in AOD we always want to show smartspace on the left i.e. in singlePaneContainer
if (isSplitShade && !isAod) {
switchContainerVisibility(
newParent = splitShadeContainer,
oldParent = singlePaneContainer)
} else {
switchContainerVisibility(
newParent = singlePaneContainer,
oldParent = splitShadeContainer)
}
requestSmartspaceUpdate()
}
private fun switchContainerVisibility(newParent: ViewGroup?, oldParent: ViewGroup?) {
// it might be the case that smartspace was already attached and we just needed to update
// visibility, e.g. going from lockscreen -> unlocked -> lockscreen
if (newParent?.childCount == 0) {
oldParent?.removeAllViews()
newParent.addView(buildAndConnectView(newParent))
}
oldParent?.visibility = GONE
newParent?.visibility = VISIBLE
}
fun setSplitShadeSmartspaceAlpha(alpha: Float) {
// the other container's alpha is modified as a part of keyguard status view, so we don't
// have to do that here
if (splitShadeContainer?.visibility == VISIBLE) {
splitShadeContainer?.alpha = alpha
}
}
/** /**
* Constructs the smartspace view and connects it to the smartspace service. Subsequent calls * Constructs the smartspace view and connects it to the smartspace service. Subsequent calls
* are idempotent until [disconnect] is called. * are idempotent until [disconnect] is called.
@@ -158,7 +96,7 @@ class LockscreenSmartspaceController @Inject constructor(
fun buildAndConnectView(parent: ViewGroup): View { fun buildAndConnectView(parent: ViewGroup): View {
execution.assertIsMainThread() execution.assertIsMainThread()
if (!isSmartspaceEnabled()) { if (!isEnabled()) {
throw RuntimeException("Cannot build view when not enabled") throw RuntimeException("Cannot build view when not enabled")
} }
@@ -244,6 +182,7 @@ class LockscreenSmartspaceController @Inject constructor(
userTracker.removeCallback(userTrackerCallback) userTracker.removeCallback(userTrackerCallback)
contentResolver.unregisterContentObserver(settingsObserver) contentResolver.unregisterContentObserver(settingsObserver)
configurationController.removeCallback(configChangeListener) configurationController.removeCallback(configChangeListener)
statusBarStateController.removeCallback(statusBarStateListener)
session = null session = null
plugin?.onTargetsAvailable(emptyList()) plugin?.onTargetsAvailable(emptyList())
@@ -259,13 +198,6 @@ class LockscreenSmartspaceController @Inject constructor(
plugin?.unregisterListener(listener) plugin?.unregisterListener(listener)
} }
fun shiftSplitShadeSmartspace(y: Int, animate: Boolean) {
if (splitShadeContainer?.visibility == VISIBLE) {
PropertyAnimator.setProperty(splitShadeContainer, AnimatableProperty.Y, y.toFloat(),
ANIMATION_PROPERTIES, animate)
}
}
private val sessionListener = SmartspaceSession.OnTargetsAvailableListener { targets -> private val sessionListener = SmartspaceSession.OnTargetsAvailableListener { targets ->
execution.assertIsMainThread() execution.assertIsMainThread()
val filteredTargets = targets.filter(::filterSmartspaceTarget) val filteredTargets = targets.filter(::filterSmartspaceTarget)
@@ -301,23 +233,6 @@ class LockscreenSmartspaceController @Inject constructor(
execution.assertIsMainThread() execution.assertIsMainThread()
smartspaceView.setDozeAmount(eased) smartspaceView.setDozeAmount(eased)
} }
override fun onDozingChanged(isDozing: Boolean) {
isAod = isDozing
updateSmartSpaceContainer()
}
override fun onStateChanged(newState: Int) {
if (newState == StatusBarState.KEYGUARD) {
if (isSmartspaceEnabled()) {
updateSmartSpaceContainer()
}
} else {
splitShadeContainer?.visibility = GONE
singlePaneContainer?.visibility = GONE
disconnect()
}
}
} }
private fun filterSmartspaceTarget(t: SmartspaceTarget): Boolean { private fun filterSmartspaceTarget(t: SmartspaceTarget): Boolean {

View File

@@ -32,11 +32,23 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcherListView;
* Utility class to calculate the clock position and top padding of notifications on Keyguard. * Utility class to calculate the clock position and top padding of notifications on Keyguard.
*/ */
public class KeyguardClockPositionAlgorithm { public class KeyguardClockPositionAlgorithm {
/**
* How much the clock height influences the shade position.
* 0 means nothing, 1 means move the shade up by the height of the clock
* 0.5f means move the shade up by half of the size of the clock.
*/
private static float CLOCK_HEIGHT_WEIGHT = 0.7f;
/** /**
* Margin between the bottom of the status view and the notification shade. * Margin between the bottom of the status view and the notification shade.
*/ */
private int mStatusViewBottomMargin; private int mStatusViewBottomMargin;
/**
* Height of the parent view - display size in px.
*/
private int mHeight;
/** /**
* Height of {@link KeyguardStatusView}. * Height of {@link KeyguardStatusView}.
*/ */
@@ -55,6 +67,21 @@ public class KeyguardClockPositionAlgorithm {
*/ */
private int mUserSwitchPreferredY; private int mUserSwitchPreferredY;
/**
* Whether or not there is a custom clock face on keyguard.
*/
private boolean mHasCustomClock;
/**
* Whether or not the NSSL contains any visible notifications.
*/
private boolean mHasVisibleNotifs;
/**
* Height of notification stack: Sum of height of each notification.
*/
private int mNotificationStackHeight;
/** /**
* Minimum top margin to avoid overlap with status bar, lock icon, or multi-user switcher * Minimum top margin to avoid overlap with status bar, lock icon, or multi-user switcher
* avatar. * avatar.
@@ -121,7 +148,6 @@ public class KeyguardClockPositionAlgorithm {
private int mUnlockedStackScrollerPadding; private int mUnlockedStackScrollerPadding;
private boolean mIsSplitShade; private boolean mIsSplitShade;
private int mSplitShadeSmartspaceHeight;
/** /**
* Refreshes the dimension values. * Refreshes the dimension values.
@@ -144,25 +170,28 @@ public class KeyguardClockPositionAlgorithm {
* Sets up algorithm values. * Sets up algorithm values.
*/ */
public void setup(int keyguardStatusBarHeaderHeight, int maxShadeBottom, public void setup(int keyguardStatusBarHeaderHeight, int maxShadeBottom,
float panelExpansion, int notificationStackHeight, float panelExpansion, int parentHeight,
int keyguardStatusHeight, int userSwitchHeight, int userSwitchPreferredY, float dark, int keyguardStatusHeight, int userSwitchHeight, int userSwitchPreferredY,
boolean hasCustomClock, boolean hasVisibleNotifs, float dark,
float overStrechAmount, boolean bypassEnabled, int unlockedStackScrollerPadding, float overStrechAmount, boolean bypassEnabled, int unlockedStackScrollerPadding,
float qsExpansion, int cutoutTopInset, int splitShadeSmartspaceHeight, float qsExpansion, int cutoutTopInset, boolean isSplitShade) {
boolean isSplitShade) {
mMinTopMargin = keyguardStatusBarHeaderHeight + Math.max(mContainerTopPadding, mMinTopMargin = keyguardStatusBarHeaderHeight + Math.max(mContainerTopPadding,
userSwitchHeight); userSwitchHeight);
mMaxShadeBottom = maxShadeBottom; mMaxShadeBottom = maxShadeBottom;
mNotificationStackHeight = notificationStackHeight;
mPanelExpansion = panelExpansion; mPanelExpansion = panelExpansion;
mHeight = parentHeight;
mKeyguardStatusHeight = keyguardStatusHeight + mStatusViewBottomMargin; mKeyguardStatusHeight = keyguardStatusHeight + mStatusViewBottomMargin;
mUserSwitchHeight = userSwitchHeight; mUserSwitchHeight = userSwitchHeight;
mUserSwitchPreferredY = userSwitchPreferredY; mUserSwitchPreferredY = userSwitchPreferredY;
mHasCustomClock = hasCustomClock;
mHasVisibleNotifs = hasVisibleNotifs;
mDarkAmount = dark; mDarkAmount = dark;
mOverStretchAmount = overStrechAmount; mOverStretchAmount = overStrechAmount;
mBypassEnabled = bypassEnabled; mBypassEnabled = bypassEnabled;
mUnlockedStackScrollerPadding = unlockedStackScrollerPadding; mUnlockedStackScrollerPadding = unlockedStackScrollerPadding;
mQsExpansion = qsExpansion; mQsExpansion = qsExpansion;
mCutoutTopInset = cutoutTopInset; mCutoutTopInset = cutoutTopInset;
mSplitShadeSmartspaceHeight = splitShadeSmartspaceHeight;
mIsSplitShade = isSplitShade; mIsSplitShade = isSplitShade;
} }
@@ -184,7 +213,7 @@ public class KeyguardClockPositionAlgorithm {
if (mBypassEnabled) { if (mBypassEnabled) {
return (int) (mUnlockedStackScrollerPadding + mOverStretchAmount); return (int) (mUnlockedStackScrollerPadding + mOverStretchAmount);
} else if (mIsSplitShade) { } else if (mIsSplitShade) {
return clockYPosition + mSplitShadeSmartspaceHeight; return clockYPosition;
} else { } else {
return clockYPosition + mKeyguardStatusHeight; return clockYPosition + mKeyguardStatusHeight;
} }

View File

@@ -138,7 +138,6 @@ import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.VibratorHelper; import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.events.PrivacyDotViewController; import com.android.systemui.statusbar.events.PrivacyDotViewController;
import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController;
import com.android.systemui.statusbar.notification.AnimatableProperty; import com.android.systemui.statusbar.notification.AnimatableProperty;
import com.android.systemui.statusbar.notification.ConversationNotificationManager; import com.android.systemui.statusbar.notification.ConversationNotificationManager;
import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.DynamicPrivacyController;
@@ -230,7 +229,6 @@ public class NotificationPanelViewController extends PanelViewController {
private final HeightListener mHeightListener = new HeightListener(); private final HeightListener mHeightListener = new HeightListener();
private final ConfigurationListener mConfigurationListener = new ConfigurationListener(); private final ConfigurationListener mConfigurationListener = new ConfigurationListener();
private final SettingsChangeObserver mSettingsChangeObserver; private final SettingsChangeObserver mSettingsChangeObserver;
private final LockscreenSmartspaceController mLockscreenSmartspaceController;
@VisibleForTesting final StatusBarStateListener mStatusBarStateListener = @VisibleForTesting final StatusBarStateListener mStatusBarStateListener =
new StatusBarStateListener(); new StatusBarStateListener();
@@ -357,8 +355,6 @@ public class NotificationPanelViewController extends PanelViewController {
private KeyguardStatusViewController mKeyguardStatusViewController; private KeyguardStatusViewController mKeyguardStatusViewController;
private LockIconViewController mLockIconViewController; private LockIconViewController mLockIconViewController;
private NotificationsQuickSettingsContainer mNotificationContainerParent; private NotificationsQuickSettingsContainer mNotificationContainerParent;
private FrameLayout mSplitShadeSmartspaceContainer;
private boolean mAnimateNextPositionUpdate; private boolean mAnimateNextPositionUpdate;
private float mQuickQsOffsetHeight; private float mQuickQsOffsetHeight;
private UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController; private UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
@@ -736,7 +732,6 @@ public class NotificationPanelViewController extends PanelViewController {
@Main Executor uiExecutor, @Main Executor uiExecutor,
SecureSettings secureSettings, SecureSettings secureSettings,
SplitShadeHeaderController splitShadeHeaderController, SplitShadeHeaderController splitShadeHeaderController,
LockscreenSmartspaceController lockscreenSmartspaceController,
UnlockedScreenOffAnimationController unlockedScreenOffAnimationController, UnlockedScreenOffAnimationController unlockedScreenOffAnimationController,
LockscreenGestureLogger lockscreenGestureLogger, LockscreenGestureLogger lockscreenGestureLogger,
NotificationRemoteInputManager remoteInputManager, NotificationRemoteInputManager remoteInputManager,
@@ -777,7 +772,6 @@ public class NotificationPanelViewController extends PanelViewController {
mQSDetailDisplayer = qsDetailDisplayer; mQSDetailDisplayer = qsDetailDisplayer;
mFragmentService = fragmentService; mFragmentService = fragmentService;
mSettingsChangeObserver = new SettingsChangeObserver(handler); mSettingsChangeObserver = new SettingsChangeObserver(handler);
mLockscreenSmartspaceController = lockscreenSmartspaceController;
mShouldUseSplitNotificationShade = mShouldUseSplitNotificationShade =
Utils.shouldUseSplitNotificationShade(mResources); Utils.shouldUseSplitNotificationShade(mResources);
mView.setWillNotDraw(!DEBUG); mView.setWillNotDraw(!DEBUG);
@@ -872,9 +866,6 @@ public class NotificationPanelViewController extends PanelViewController {
loadDimens(); loadDimens();
mKeyguardStatusBar = mView.findViewById(R.id.keyguard_header); mKeyguardStatusBar = mView.findViewById(R.id.keyguard_header);
mBigClockContainer = mView.findViewById(R.id.big_clock_container); mBigClockContainer = mView.findViewById(R.id.big_clock_container);
mSplitShadeSmartspaceContainer = mView.findViewById(R.id.split_shade_smartspace_container);
mLockscreenSmartspaceController.setSplitShadeContainer(mSplitShadeSmartspaceContainer);
mLockscreenSmartspaceController.onSplitShadeChanged(mShouldUseSplitNotificationShade);
UserAvatarView userAvatarView = null; UserAvatarView userAvatarView = null;
KeyguardUserSwitcherView keyguardUserSwitcherView = null; KeyguardUserSwitcherView keyguardUserSwitcherView = null;
@@ -1080,7 +1071,7 @@ public class NotificationPanelViewController extends PanelViewController {
mNotificationContainerParent.setSplitShadeEnabled(mShouldUseSplitNotificationShade); mNotificationContainerParent.setSplitShadeEnabled(mShouldUseSplitNotificationShade);
updateKeyguardStatusViewAlignment(/* animate= */false); updateKeyguardStatusViewAlignment(/* animate= */false);
mLockscreenSmartspaceController.onSplitShadeChanged(mShouldUseSplitNotificationShade);
mKeyguardMediaController.refreshMediaPosition(); mKeyguardMediaController.refreshMediaPosition();
} }
@@ -1346,15 +1337,16 @@ public class NotificationPanelViewController extends PanelViewController {
? 1.0f : mInterpolatedDarkAmount; ? 1.0f : mInterpolatedDarkAmount;
mClockPositionAlgorithm.setup(mStatusBarHeaderHeightKeyguard, mClockPositionAlgorithm.setup(mStatusBarHeaderHeightKeyguard,
totalHeight - bottomPadding, totalHeight - bottomPadding,
mNotificationStackScrollLayoutController.getIntrinsicContentHeight(),
expandedFraction, expandedFraction,
totalHeight,
mKeyguardStatusViewController.getLockscreenHeight(), mKeyguardStatusViewController.getLockscreenHeight(),
userIconHeight, userIconHeight,
userSwitcherPreferredY, userSwitcherPreferredY, hasCustomClock(),
darkamount, mOverStretchAmount, hasVisibleNotifications, darkamount, mOverStretchAmount,
bypassEnabled, getUnlockedStackScrollerPadding(), bypassEnabled, getUnlockedStackScrollerPadding(),
computeQsExpansionFraction(), computeQsExpansionFraction(),
mDisplayTopInset, mDisplayTopInset,
mSplitShadeSmartspaceContainer.getHeight(),
mShouldUseSplitNotificationShade); mShouldUseSplitNotificationShade);
mClockPositionAlgorithm.run(mClockPositionResult); mClockPositionAlgorithm.run(mClockPositionResult);
boolean animate = mNotificationStackScrollLayoutController.isAddOrRemoveAnimationPending(); boolean animate = mNotificationStackScrollLayoutController.isAddOrRemoveAnimationPending();
@@ -1374,9 +1366,6 @@ public class NotificationPanelViewController extends PanelViewController {
mClockPositionResult.userSwitchY, mClockPositionResult.userSwitchY,
animateClock); animateClock);
} }
// no need to translate in X axis - horizontal position is determined by constraints
mLockscreenSmartspaceController
.shiftSplitShadeSmartspace(mClockPositionResult.clockY, animateClock);
updateNotificationTranslucency(); updateNotificationTranslucency();
updateClock(); updateClock();
} }
@@ -1544,7 +1533,6 @@ public class NotificationPanelViewController extends PanelViewController {
if (mKeyguardUserSwitcherController != null) { if (mKeyguardUserSwitcherController != null) {
mKeyguardUserSwitcherController.setAlpha(alpha); mKeyguardUserSwitcherController.setAlpha(alpha);
} }
mLockscreenSmartspaceController.setSplitShadeSmartspaceAlpha(alpha);
} }
public void animateToFullShade(long delay) { public void animateToFullShade(long delay) {
@@ -3726,7 +3714,6 @@ public class NotificationPanelViewController extends PanelViewController {
public void dozeTimeTick() { public void dozeTimeTick() {
mKeyguardBottomArea.dozeTimeTick(); mKeyguardBottomArea.dozeTimeTick();
mKeyguardStatusViewController.dozeTimeTick(); mKeyguardStatusViewController.dozeTimeTick();
mLockscreenSmartspaceController.requestSmartspaceUpdate();
if (mInterpolatedDarkAmount > 0) { if (mInterpolatedDarkAmount > 0) {
positionClockAndNotifications(); positionClockAndNotifications();
} }

View File

@@ -19,6 +19,7 @@ package com.android.keyguard;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never; import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
@@ -28,7 +29,6 @@ import static org.mockito.Mockito.when;
import android.content.res.Resources; import android.content.res.Resources;
import android.testing.AndroidTestingRunner; import android.testing.AndroidTestingRunner;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
@@ -104,8 +104,6 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
private AnimatableClockView mLargeClockView; private AnimatableClockView mLargeClockView;
@Mock @Mock
private FrameLayout mLargeClockFrame; private FrameLayout mLargeClockFrame;
@Mock
private ViewGroup mSmartspaceContainer;
private final View mFakeSmartspaceView = new View(mContext); private final View mFakeSmartspaceView = new View(mContext);
@@ -125,8 +123,6 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
when(mView.findViewById(R.id.animatable_clock_view)).thenReturn(mClockView); when(mView.findViewById(R.id.animatable_clock_view)).thenReturn(mClockView);
when(mView.findViewById(R.id.animatable_clock_view_large)).thenReturn(mLargeClockView); when(mView.findViewById(R.id.animatable_clock_view_large)).thenReturn(mLargeClockView);
when(mView.findViewById(R.id.lockscreen_clock_view_large)).thenReturn(mLargeClockFrame); when(mView.findViewById(R.id.lockscreen_clock_view_large)).thenReturn(mLargeClockFrame);
when(mView.findViewById(R.id.keyguard_smartspace_container))
.thenReturn(mSmartspaceContainer);
when(mClockView.getContext()).thenReturn(getContext()); when(mClockView.getContext()).thenReturn(getContext());
when(mLargeClockView.getContext()).thenReturn(getContext()); when(mLargeClockView.getContext()).thenReturn(getContext());
@@ -214,7 +210,7 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
@Test @Test
public void testSmartspaceEnabledRemovesKeyguardStatusArea() { public void testSmartspaceEnabledRemovesKeyguardStatusArea() {
when(mSmartspaceController.isSmartspaceEnabled()).thenReturn(true); when(mSmartspaceController.isEnabled()).thenReturn(true);
when(mSmartspaceController.buildAndConnectView(any())).thenReturn(mFakeSmartspaceView); when(mSmartspaceController.buildAndConnectView(any())).thenReturn(mFakeSmartspaceView);
mController.init(); mController.init();
@@ -223,7 +219,7 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
@Test @Test
public void testSmartspaceDisabledShowsKeyguardStatusArea() { public void testSmartspaceDisabledShowsKeyguardStatusArea() {
when(mSmartspaceController.isSmartspaceEnabled()).thenReturn(false); when(mSmartspaceController.isEnabled()).thenReturn(false);
mController.init(); mController.init();
assertEquals(View.VISIBLE, mStatusArea.getVisibility()); assertEquals(View.VISIBLE, mStatusArea.getVisibility());
@@ -231,16 +227,17 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
@Test @Test
public void testDetachRemovesSmartspaceView() { public void testDetachRemovesSmartspaceView() {
when(mSmartspaceController.isSmartspaceEnabled()).thenReturn(true); when(mSmartspaceController.isEnabled()).thenReturn(true);
when(mSmartspaceController.buildAndConnectView(any())).thenReturn(mFakeSmartspaceView); when(mSmartspaceController.buildAndConnectView(any())).thenReturn(mFakeSmartspaceView);
mController.init(); mController.init();
verify(mView).addView(eq(mFakeSmartspaceView), anyInt(), any());
ArgumentCaptor<View.OnAttachStateChangeListener> listenerArgumentCaptor = ArgumentCaptor<View.OnAttachStateChangeListener> listenerArgumentCaptor =
ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class); ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class);
verify(mView).addOnAttachStateChangeListener(listenerArgumentCaptor.capture()); verify(mView).addOnAttachStateChangeListener(listenerArgumentCaptor.capture());
listenerArgumentCaptor.getValue().onViewDetachedFromWindow(mView); listenerArgumentCaptor.getValue().onViewDetachedFromWindow(mView);
verify(mSmartspaceContainer).removeAllViews(); verify(mView).removeView(mFakeSmartspaceView);
} }
@Test @Test

View File

@@ -389,6 +389,7 @@ class LockscreenSmartspaceControllerTest : SysuiTestCase() {
verify(userTracker).removeCallback(userListener) verify(userTracker).removeCallback(userListener)
verify(contentResolver).unregisterContentObserver(settingsObserver) verify(contentResolver).unregisterContentObserver(settingsObserver)
verify(configurationController).removeCallback(configChangeListener) verify(configurationController).removeCallback(configChangeListener)
verify(statusBarStateController).removeCallback(statusBarStateListener)
} }
@Test @Test

View File

@@ -38,27 +38,35 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
private static final float ZERO_DRAG = 0.f; private static final float ZERO_DRAG = 0.f;
private static final float OPAQUE = 1.f; private static final float OPAQUE = 1.f;
private static final float TRANSPARENT = 0.f; private static final float TRANSPARENT = 0.f;
private static final boolean HAS_CUSTOM_CLOCK = false;
private static final boolean HAS_VISIBLE_NOTIFS = false;
private KeyguardClockPositionAlgorithm mClockPositionAlgorithm; private KeyguardClockPositionAlgorithm mClockPositionAlgorithm;
private KeyguardClockPositionAlgorithm.Result mClockPosition; private KeyguardClockPositionAlgorithm.Result mClockPosition;
private int mNotificationStackHeight;
private float mPanelExpansion; private float mPanelExpansion;
private int mKeyguardStatusHeight; private int mKeyguardStatusHeight;
private float mDark; private float mDark;
private boolean mHasCustomClock;
private boolean mHasVisibleNotifs;
private float mQsExpansion; private float mQsExpansion;
private int mCutoutTopInsetPx = 0; private int mCutoutTopInset = 0; // in pixels
private int mSplitShadeSmartspaceHeightPx = 0;
private boolean mIsSplitShade = false; private boolean mIsSplitShade = false;
@Before @Before
public void setUp() { public void setUp() {
mClockPositionAlgorithm = new KeyguardClockPositionAlgorithm(); mClockPositionAlgorithm = new KeyguardClockPositionAlgorithm();
mClockPosition = new KeyguardClockPositionAlgorithm.Result(); mClockPosition = new KeyguardClockPositionAlgorithm.Result();
mHasCustomClock = HAS_CUSTOM_CLOCK;
mHasVisibleNotifs = HAS_VISIBLE_NOTIFS;
} }
@Test @Test
public void clockPositionTopOfScreenOnAOD() { public void clockPositionTopOfScreenOnAOD() {
// GIVEN on AOD and clock has 0 height // GIVEN on AOD and both stack scroll and clock have 0 height
givenAOD(); givenAOD();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT; mKeyguardStatusHeight = EMPTY_HEIGHT;
// WHEN the clock position algorithm is run // WHEN the clock position algorithm is run
positionClock(); positionClock();
@@ -71,10 +79,11 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
@Test @Test
public void clockPositionBelowCutout() { public void clockPositionBelowCutout() {
// GIVEN on AOD and clock has 0 height // GIVEN on AOD and both stack scroll and clock have 0 height
givenAOD(); givenAOD();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT; mKeyguardStatusHeight = EMPTY_HEIGHT;
mCutoutTopInsetPx = 300; mCutoutTopInset = 300;
// WHEN the clock position algorithm is run // WHEN the clock position algorithm is run
positionClock(); positionClock();
// THEN the clock Y position is below the cutout // THEN the clock Y position is below the cutout
@@ -88,6 +97,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
public void clockPositionAdjustsForKeyguardStatusOnAOD() { public void clockPositionAdjustsForKeyguardStatusOnAOD() {
// GIVEN on AOD with a clock of height 100 // GIVEN on AOD with a clock of height 100
givenAOD(); givenAOD();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = 100; mKeyguardStatusHeight = 100;
// WHEN the clock position algorithm is run // WHEN the clock position algorithm is run
positionClock(); positionClock();
@@ -102,6 +112,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
public void clockPositionLargeClockOnAOD() { public void clockPositionLargeClockOnAOD() {
// GIVEN on AOD with a full screen clock // GIVEN on AOD with a full screen clock
givenAOD(); givenAOD();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = SCREEN_HEIGHT; mKeyguardStatusHeight = SCREEN_HEIGHT;
// WHEN the clock position algorithm is run // WHEN the clock position algorithm is run
positionClock(); positionClock();
@@ -114,8 +125,9 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
@Test @Test
public void clockPositionTopOfScreenOnLockScreen() { public void clockPositionTopOfScreenOnLockScreen() {
// GIVEN on lock screen with clock of 0 height // GIVEN on lock screen with stack scroll and clock of 0 height
givenLockScreen(); givenLockScreen();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT; mKeyguardStatusHeight = EMPTY_HEIGHT;
// WHEN the clock position algorithm is run // WHEN the clock position algorithm is run
positionClock(); positionClock();
@@ -125,10 +137,25 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
assertThat(mClockPosition.clockX).isEqualTo(0); assertThat(mClockPosition.clockX).isEqualTo(0);
} }
@Test
public void clockPositionWithStackScrollExpandOnLockScreen() {
// GIVEN on lock screen with stack scroll of height 500
givenLockScreen();
mNotificationStackHeight = 500;
mKeyguardStatusHeight = EMPTY_HEIGHT;
// WHEN the clock position algorithm is run
positionClock();
// THEN the clock Y position stays to the top
assertThat(mClockPosition.clockY).isEqualTo(0);
// AND the clock is positioned on the left.
assertThat(mClockPosition.clockX).isEqualTo(0);
}
@Test @Test
public void clockPositionWithPartialDragOnLockScreen() { public void clockPositionWithPartialDragOnLockScreen() {
// GIVEN dragging up on lock screen // GIVEN dragging up on lock screen
givenLockScreen(); givenLockScreen();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT; mKeyguardStatusHeight = EMPTY_HEIGHT;
mPanelExpansion = 0.5f; mPanelExpansion = 0.5f;
// WHEN the clock position algorithm is run // WHEN the clock position algorithm is run
@@ -144,6 +171,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
public void clockPositionWithFullDragOnLockScreen() { public void clockPositionWithFullDragOnLockScreen() {
// GIVEN the lock screen is dragged up // GIVEN the lock screen is dragged up
givenLockScreen(); givenLockScreen();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT; mKeyguardStatusHeight = EMPTY_HEIGHT;
mPanelExpansion = 0.f; mPanelExpansion = 0.f;
// WHEN the clock position algorithm is run // WHEN the clock position algorithm is run
@@ -156,6 +184,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
public void largeClockOnLockScreenIsTransparent() { public void largeClockOnLockScreenIsTransparent() {
// GIVEN on lock screen with a full screen clock // GIVEN on lock screen with a full screen clock
givenLockScreen(); givenLockScreen();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = SCREEN_HEIGHT; mKeyguardStatusHeight = SCREEN_HEIGHT;
// WHEN the clock position algorithm is run // WHEN the clock position algorithm is run
positionClock(); positionClock();
@@ -165,8 +194,9 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
@Test @Test
public void notifPositionTopOfScreenOnAOD() { public void notifPositionTopOfScreenOnAOD() {
// GIVEN on AOD and clock has 0 height // GIVEN on AOD and both stack scroll and clock have 0 height
givenAOD(); givenAOD();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT; mKeyguardStatusHeight = EMPTY_HEIGHT;
// WHEN the position algorithm is run // WHEN the position algorithm is run
positionClock(); positionClock();
@@ -178,6 +208,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
public void notifPositionIndependentOfKeyguardStatusHeightOnAOD() { public void notifPositionIndependentOfKeyguardStatusHeightOnAOD() {
// GIVEN on AOD and clock has a nonzero height // GIVEN on AOD and clock has a nonzero height
givenAOD(); givenAOD();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = 100; mKeyguardStatusHeight = 100;
// WHEN the position algorithm is run // WHEN the position algorithm is run
positionClock(); positionClock();
@@ -189,6 +220,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
public void notifPositionWithLargeClockOnAOD() { public void notifPositionWithLargeClockOnAOD() {
// GIVEN on AOD and clock has a nonzero height // GIVEN on AOD and clock has a nonzero height
givenAOD(); givenAOD();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = SCREEN_HEIGHT; mKeyguardStatusHeight = SCREEN_HEIGHT;
// WHEN the position algorithm is run // WHEN the position algorithm is run
positionClock(); positionClock();
@@ -198,8 +230,9 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
@Test @Test
public void notifPositionMiddleOfScreenOnLockScreen() { public void notifPositionMiddleOfScreenOnLockScreen() {
// GIVEN on lock screen and clock has 0 height // GIVEN on lock screen and both stack scroll and clock have 0 height
givenLockScreen(); givenLockScreen();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT; mKeyguardStatusHeight = EMPTY_HEIGHT;
// WHEN the position algorithm is run // WHEN the position algorithm is run
positionClock(); positionClock();
@@ -207,43 +240,59 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0); assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
} }
@Test
public void notifPositionAdjustsForStackHeightOnLockScreen() {
// GIVEN on lock screen and stack scroller has a nonzero height
givenLockScreen();
mNotificationStackHeight = 500;
mKeyguardStatusHeight = EMPTY_HEIGHT;
// WHEN the position algorithm is run
positionClock();
// THEN the notif padding adjusts for keyguard status height
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
}
@Test @Test
public void notifPositionAdjustsForClockHeightOnLockScreen() { public void notifPositionAdjustsForClockHeightOnLockScreen() {
// GIVEN on lock screen and stack scroller has a nonzero height // GIVEN on lock screen and stack scroller has a nonzero height
givenLockScreen(); givenLockScreen();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = 200; mKeyguardStatusHeight = 200;
// WHEN the position algorithm is run // WHEN the position algorithm is run
positionClock(); positionClock();
// THEN the notif padding adjusts for both clock and notif stack.
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(200);
}
@Test
public void notifPositionAdjustsForStackHeightAndClockHeightOnLockScreen() {
// GIVEN on lock screen and stack scroller has a nonzero height
givenLockScreen();
mNotificationStackHeight = 500;
mKeyguardStatusHeight = 200;
// WHEN the position algorithm is run
positionClock();
// THEN the notifs are placed below the statusview
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(200); assertThat(mClockPosition.stackScrollerPadding).isEqualTo(200);
} }
@Test @Test
public void notifPositionAlignedWithClockInSplitShadeMode() { public void notifPositionAlignedWithClockInSplitShadeMode() {
// GIVEN on lock screen and split shade mode
givenLockScreen(); givenLockScreen();
mIsSplitShade = true; mIsSplitShade = true;
mKeyguardStatusHeight = 200; mHasCustomClock = true;
// WHEN the position algorithm is run // WHEN the position algorithm is run
positionClock(); positionClock();
// THEN the notif padding DOESN'T adjust for keyguard status height. // THEN the notif padding DOESN'T adjust for keyguard status height.
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0); assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
} }
@Test
public void notifPositionAdjustedBySmartspaceHeightInSplitShadeMode() {
givenLockScreen();
mSplitShadeSmartspaceHeightPx = 200;
mIsSplitShade = true;
// WHEN the position algorithm is run
positionClock();
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(200);
}
@Test @Test
public void notifPositionWithLargeClockOnLockScreen() { public void notifPositionWithLargeClockOnLockScreen() {
// GIVEN on lock screen and clock has a nonzero height // GIVEN on lock screen and clock has a nonzero height
givenLockScreen(); givenLockScreen();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = SCREEN_HEIGHT; mKeyguardStatusHeight = SCREEN_HEIGHT;
// WHEN the position algorithm is run // WHEN the position algorithm is run
positionClock(); positionClock();
@@ -255,6 +304,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
public void notifPositionWithFullDragOnLockScreen() { public void notifPositionWithFullDragOnLockScreen() {
// GIVEN the lock screen is dragged up // GIVEN the lock screen is dragged up
givenLockScreen(); givenLockScreen();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT; mKeyguardStatusHeight = EMPTY_HEIGHT;
mPanelExpansion = 0.f; mPanelExpansion = 0.f;
// WHEN the clock position algorithm is run // WHEN the clock position algorithm is run
@@ -267,18 +317,19 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
public void notifPositionWithLargeClockFullDragOnLockScreen() { public void notifPositionWithLargeClockFullDragOnLockScreen() {
// GIVEN the lock screen is dragged up and a full screen clock // GIVEN the lock screen is dragged up and a full screen clock
givenLockScreen(); givenLockScreen();
mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = SCREEN_HEIGHT; mKeyguardStatusHeight = SCREEN_HEIGHT;
mPanelExpansion = 0.f; mPanelExpansion = 0.f;
// WHEN the clock position algorithm is run // WHEN the clock position algorithm is run
positionClock(); positionClock();
// THEN the notif padding is zero.
assertThat(mClockPosition.stackScrollerPadding).isEqualTo( assertThat(mClockPosition.stackScrollerPadding).isEqualTo(
(int) (mKeyguardStatusHeight * .667f)); (int) (mKeyguardStatusHeight * .667f));
} }
@Test @Test
public void clockHiddenWhenQsIsExpanded() { public void clockHiddenWhenQsIsExpanded() {
// GIVEN on the lock screen with visible notifications // GIVEN on the lock screen with a custom clock and visible notifications
givenLockScreen(); givenLockScreen();
mQsExpansion = 1; mQsExpansion = 1;
// WHEN the clock position algorithm is run // WHEN the clock position algorithm is run
@@ -298,12 +349,12 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
} }
private void positionClock() { private void positionClock() {
mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mNotificationStackHeight,
mPanelExpansion, mKeyguardStatusHeight, mPanelExpansion, SCREEN_HEIGHT, mKeyguardStatusHeight,
0 /* userSwitchHeight */, 0 /* userSwitchPreferredY */, 0 /* userSwitchHeight */, 0 /* userSwitchPreferredY */,
mDark, ZERO_DRAG, false /* bypassEnabled */, mHasCustomClock, mHasVisibleNotifs, mDark, ZERO_DRAG, false /* bypassEnabled */,
0 /* unlockedStackScrollerPadding */, mQsExpansion, 0 /* unlockedStackScrollerPadding */, mQsExpansion,
mCutoutTopInsetPx, mSplitShadeSmartspaceHeightPx, mIsSplitShade); mCutoutTopInset, mIsSplitShade);
mClockPositionAlgorithm.run(mClockPosition); mClockPositionAlgorithm.run(mClockPosition);
} }
} }

View File

@@ -63,7 +63,6 @@ import android.view.ViewPropertyAnimator;
import android.view.ViewStub; import android.view.ViewStub;
import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet; import androidx.constraintlayout.widget.ConstraintSet;
@@ -113,7 +112,6 @@ import com.android.systemui.statusbar.StatusBarStateControllerImpl;
import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.VibratorHelper; import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.events.PrivacyDotViewController; import com.android.systemui.statusbar.events.PrivacyDotViewController;
import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController;
import com.android.systemui.statusbar.notification.ConversationNotificationManager; import com.android.systemui.statusbar.notification.ConversationNotificationManager;
import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationEntryManager;
@@ -303,10 +301,6 @@ public class NotificationPanelViewTest extends SysuiTestCase {
@Mock @Mock
private ControlsComponent mControlsComponent; private ControlsComponent mControlsComponent;
@Mock @Mock
private LockscreenSmartspaceController mLockscreenSmartspaceController;
@Mock
private FrameLayout mSplitShadeSmartspaceContainer;
@Mock
private LockscreenGestureLogger mLockscreenGestureLogger; private LockscreenGestureLogger mLockscreenGestureLogger;
private SysuiStatusBarStateController mStatusBarStateController; private SysuiStatusBarStateController mStatusBarStateController;
@@ -357,8 +351,6 @@ public class NotificationPanelViewTest extends SysuiTestCase {
when(mView.findViewById(R.id.qs_frame)).thenReturn(mQsFrame); when(mView.findViewById(R.id.qs_frame)).thenReturn(mQsFrame);
when(mView.findViewById(R.id.keyguard_status_view)) when(mView.findViewById(R.id.keyguard_status_view))
.thenReturn(mock(KeyguardStatusView.class)); .thenReturn(mock(KeyguardStatusView.class));
when(mView.findViewById(R.id.split_shade_smartspace_container))
.thenReturn(mSplitShadeSmartspaceContainer);
mNotificationContainerParent = new NotificationsQuickSettingsContainer(getContext(), null); mNotificationContainerParent = new NotificationsQuickSettingsContainer(getContext(), null);
mNotificationContainerParent.addView(newViewWithId(R.id.qs_frame)); mNotificationContainerParent.addView(newViewWithId(R.id.qs_frame));
mNotificationContainerParent.addView(newViewWithId(R.id.notification_stack_scroller)); mNotificationContainerParent.addView(newViewWithId(R.id.notification_stack_scroller));
@@ -452,7 +444,6 @@ public class NotificationPanelViewTest extends SysuiTestCase {
new FakeExecutor(new FakeSystemClock()), new FakeExecutor(new FakeSystemClock()),
mSecureSettings, mSecureSettings,
mSplitShadeHeaderController, mSplitShadeHeaderController,
mLockscreenSmartspaceController,
mUnlockedScreenOffAnimationController, mUnlockedScreenOffAnimationController,
mLockscreenGestureLogger, mLockscreenGestureLogger,
mNotificationRemoteInputManager, mNotificationRemoteInputManager,