diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml index 23f34251b812c..4ca59f5082add 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded.xml @@ -37,12 +37,6 @@ android:layout_height="match_parent" android:layout_width="match_parent" /> - - @@ -109,5 +103,11 @@ layout="@layout/keyguard_bottom_area" android:visibility="gone" /> + + diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java index 2ce403764c7de..d6380199e8449 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java @@ -89,7 +89,8 @@ public class KeyguardClockPositionAlgorithm { private int mNotificationStackHeight; /** - * Minimum top margin to avoid overlap with status bar. + * Minimum top margin to avoid overlap with status bar, lock icon, or multi-user switcher + * avatar. */ private int mMinTopMargin; @@ -186,15 +187,15 @@ public class KeyguardClockPositionAlgorithm { /** * Sets up algorithm values. */ - public void setup(int statusBarMinHeight, int maxShadeBottom, int notificationStackHeight, - float panelExpansion, int parentHeight, int keyguardStatusHeight, - int userSwitchHeight, int clockPreferredY, int userSwitchPreferredY, - boolean hasCustomClock, boolean hasVisibleNotifs, float dark, float emptyDragAmount, - boolean bypassEnabled, int unlockedStackScrollerPadding, boolean showLockIcon, - float qsExpansion, int cutoutTopInset) { - mMinTopMargin = statusBarMinHeight + (showLockIcon - ? mContainerTopPaddingWithLockIcon : mContainerTopPaddingWithoutLockIcon) - + userSwitchHeight; + public void setup(int keyguardStatusBarHeaderHeight, int maxShadeBottom, + int notificationStackHeight, float panelExpansion, int parentHeight, + int keyguardStatusHeight, int userSwitchHeight, int clockPreferredY, + int userSwitchPreferredY, boolean hasCustomClock, boolean hasVisibleNotifs, float dark, + float emptyDragAmount, boolean bypassEnabled, int unlockedStackScrollerPadding, + boolean showLockIcon, float qsExpansion, int cutoutTopInset) { + mMinTopMargin = keyguardStatusBarHeaderHeight + Math.max(showLockIcon + ? mContainerTopPaddingWithLockIcon : mContainerTopPaddingWithoutLockIcon, + userSwitchHeight); mMaxShadeBottom = maxShadeBottom; mNotificationStackHeight = notificationStackHeight; mPanelExpansion = panelExpansion; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index 6940050f754b5..093f57adb21a8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -287,21 +287,6 @@ public class NotificationPanelViewController extends PanelViewController { } }; - final KeyguardUserSwitcherController.KeyguardUserSwitcherListener - mKeyguardUserSwitcherListener = - new KeyguardUserSwitcherController.KeyguardUserSwitcherListener() { - @Override - public void onKeyguardUserSwitcherChanged(boolean open) { - if (mKeyguardUserSwitcherController == null) { - updateUserSwitcherVisibility(false); - } else if (!mKeyguardUserSwitcherController.isSimpleUserSwitcher()) { - updateUserSwitcherVisibility(open - && mKeyguardStateController.isShowing() - && !mKeyguardStateController.isKeyguardFadingAway()); - } - } - }; - private final LayoutInflater mLayoutInflater; private final PowerManager mPowerManager; private final AccessibilityManager mAccessibilityManager; @@ -329,7 +314,6 @@ public class NotificationPanelViewController extends PanelViewController { private KeyguardAffordanceHelper mAffordanceHelper; private KeyguardQsUserSwitchController mKeyguardQsUserSwitchController; - private boolean mKeyguardUserSwitcherIsShowing; private KeyguardUserSwitcherController mKeyguardUserSwitcherController; private KeyguardStatusBarView mKeyguardStatusBar; private ViewGroup mBigClockContainer; @@ -374,6 +358,7 @@ public class NotificationPanelViewController extends PanelViewController { private ValueAnimator mQsExpansionAnimator; private FlingAnimationUtils mFlingAnimationUtils; private int mStatusBarMinHeight; + private int mStatusBarHeaderHeightKeyguard; private int mNotificationsHeaderCollideDistance; private float mEmptyDragAmount; private float mDownX; @@ -772,6 +757,8 @@ public class NotificationPanelViewController extends PanelViewController { .setMaxLengthSeconds(0.4f).build(); mStatusBarMinHeight = mResources.getDimensionPixelSize( com.android.internal.R.dimen.status_bar_height); + mStatusBarHeaderHeightKeyguard = mResources.getDimensionPixelSize( + R.dimen.status_bar_header_height_keyguard); mQsPeekHeight = mResources.getDimensionPixelSize(R.dimen.qs_peek_height); mNotificationsHeaderCollideDistance = mResources.getDimensionPixelSize( R.dimen.header_notifications_collide_distance); @@ -808,7 +795,6 @@ public class NotificationPanelViewController extends PanelViewController { // Try to close the switcher so that callbacks are triggered if necessary. // Otherwise, NPV can get into a state where some of the views are still hidden mKeyguardUserSwitcherController.closeSwitcherIfOpenAndNotSimple(false); - mKeyguardUserSwitcherController.removeCallback(); } mKeyguardQsUserSwitchController = null; @@ -828,7 +814,6 @@ public class NotificationPanelViewController extends PanelViewController { mKeyguardUserSwitcherComponentFactory.build(keyguardUserSwitcherView); mKeyguardUserSwitcherController = userSwitcherComponent.getKeyguardUserSwitcherController(); - mKeyguardUserSwitcherController.setCallback(mKeyguardUserSwitcherListener); mKeyguardUserSwitcherController.init(); mKeyguardStatusBar.setKeyguardUserSwitcherEnabled(true); } else { @@ -1069,7 +1054,7 @@ public class NotificationPanelViewController extends PanelViewController { int totalHeight = mView.getHeight(); int bottomPadding = Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding); int clockPreferredY = mKeyguardStatusViewController.getClockPreferredY(totalHeight); - int userSwitcherPreferredY = mStatusBarMinHeight; + int userSwitcherPreferredY = mStatusBarHeaderHeightKeyguard; boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled(); final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController .getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMedia(); @@ -1078,7 +1063,8 @@ public class NotificationPanelViewController extends PanelViewController { ? mKeyguardQsUserSwitchController.getUserIconHeight() : (mKeyguardUserSwitcherController != null ? mKeyguardUserSwitcherController.getUserIconHeight() : 0); - mClockPositionAlgorithm.setup(mStatusBarMinHeight, totalHeight - bottomPadding, + mClockPositionAlgorithm.setup(mStatusBarHeaderHeightKeyguard, + totalHeight - bottomPadding, mNotificationStackScrollLayoutController.getIntrinsicContentHeight(), getExpandedFraction(), totalHeight, @@ -3523,34 +3509,6 @@ public class NotificationPanelViewController extends PanelViewController { return false; } - private void updateUserSwitcherVisibility(boolean open) { - // Do not update if previously called with the same state. - if (mKeyguardUserSwitcherIsShowing == open) { - return; - } - mKeyguardUserSwitcherIsShowing = open; - - if (open) { - animateKeyguardStatusBarOut(); - mKeyguardStatusViewController.setKeyguardStatusViewVisibility( - mBarState, - true /* keyguardFadingAway */, - true /* goingToFullShade */, - mBarState); - setKeyguardBottomAreaVisibility(mBarState, true); - mNotificationContainerParent.setVisibility(View.GONE); - } else { - animateKeyguardStatusBarIn(StackStateAnimator.ANIMATION_DURATION_STANDARD); - mKeyguardStatusViewController.setKeyguardStatusViewVisibility( - StatusBarState.KEYGUARD, - false, - false, - StatusBarState.SHADE_LOCKED); - setKeyguardBottomAreaVisibility(mBarState, false); - mNotificationContainerParent.setVisibility(View.VISIBLE); - } - } - private void updateDisabledUdfpsController() { final boolean udfpsEnrolled = mAuthController.getUdfpsRegion() != null && mAuthController.isUdfpsEnrolled( diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherController.java index b76e451cb6813..8845a05cf6f52 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherController.java @@ -19,9 +19,13 @@ package com.android.systemui.statusbar.policy; import static com.android.systemui.statusbar.policy.UserSwitcherController.USER_SWITCH_DISABLED_ALPHA; import static com.android.systemui.statusbar.policy.UserSwitcherController.USER_SWITCH_ENABLED_ALPHA; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ObjectAnimator; import android.content.Context; import android.content.res.Resources; import android.database.DataSetObserver; +import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.os.UserHandle; @@ -50,7 +54,6 @@ import com.android.systemui.statusbar.notification.stack.StackStateAnimator; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.util.ViewController; -import java.lang.ref.WeakReference; import java.util.ArrayList; import javax.inject.Inject; @@ -73,9 +76,10 @@ public class KeyguardUserSwitcherController extends ViewController mKeyguardUserSwitcherCallback; protected final SysuiStatusBarStateController mStatusBarStateController; private final KeyguardVisibilityHelper mKeyguardVisibilityHelper; + private ObjectAnimator mBgAnimator; + private final KeyguardUserSwitcherScrim mBackground; // Child views of KeyguardUserSwitcherView private KeyguardUserSwitcherListView mListView; @@ -171,6 +175,7 @@ public class KeyguardUserSwitcherController extends ViewController(callback); - } - - /** - * If user switcher state changes, notifies all {@link KeyguardUserSwitcherListener}. - * Switcher state is updatd before animations finish. + * NOTE: switcher state is updated before animations finish. * * @param animate true to animate transition. The user switcher state (i.e. * {@link #isUserSwitcherOpen()}) is updated before animation is finished. */ private void setUserSwitcherOpened(boolean open, boolean animate) { - boolean wasOpen = mUserSwitcherOpen; if (DEBUG) { - Log.d(TAG, String.format("setUserSwitcherOpened: %b -> %b (animate=%b)", wasOpen, - open, animate)); + Log.d(TAG, + String.format("setUserSwitcherOpened: %b -> %b (animate=%b)", + mUserSwitcherOpen, open, animate)); } mUserSwitcherOpen = open; - if (mUserSwitcherOpen != wasOpen) { - notifyUserSwitcherStateChanged(); - } updateVisibilities(animate); } private void updateVisibilities(boolean animate) { if (DEBUG) Log.d(TAG, String.format("updateVisibilities: animate=%b", animate)); mEndGuestButton.animate().cancel(); + if (mBgAnimator != null) { + mBgAnimator.cancel(); + } + + if (mUserSwitcherOpen) { + mBgAnimator = ObjectAnimator.ofInt(mBackground, "alpha", 0, 255); + mBgAnimator.setDuration(400); + mBgAnimator.setInterpolator(Interpolators.ALPHA_IN); + mBgAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mBgAnimator = null; + } + }); + mBgAnimator.start(); + } else { + mBgAnimator = ObjectAnimator.ofInt(mBackground, "alpha", 255, 0); + mBgAnimator.setDuration(400); + mBgAnimator.setInterpolator(Interpolators.ALPHA_OUT); + mBgAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mBgAnimator = null; + } + }); + mBgAnimator.start(); + } + if (mUserSwitcherOpen && mCurrentUserIsGuest) { // Show the "End guest session" button mEndGuestButton.setVisibility(View.VISIBLE); @@ -459,34 +480,6 @@ public class KeyguardUserSwitcherController extends ViewController