diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/phone')
5 files changed, 170 insertions, 46 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index 6f0f720..6b6ce5b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -88,7 +88,13 @@ public class KeyguardBouncer { if (mRoot.getVisibility() == View.VISIBLE || mShowingSoon) { return; } - mPhoneStatusBar.mKeyguardBottomArea.setVisibility(View.GONE); + mPhoneStatusBar.getScrimController().forceHideScrims(false); + // Don't hide bottom area if we are in the middle of a affordance + // launch transition, since once the animation is finished, NPV + // will take care of setting it invisible. + if (!mPhoneStatusBar.mNotificationPanel.isLaunchTransitionRunning()) { + mPhoneStatusBar.mKeyguardBottomArea.setVisibility(View.GONE); + } // Try to dismiss the Keyguard. If no security pattern is set, this will dismiss the whole // Keyguard. If we need to authenticate, show the bouncer. if (!mKeyguardView.dismiss()) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 729f965..d7c1acc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -263,6 +263,7 @@ public class NotificationPanelView extends PanelView implements private final int mScreenHeight; private LiveLockScreenController mLiveLockscreenController; private final GestureDetector mGestureDetector; + private ViewLinker mViewLinker; private enum SwipeLockedDirection { UNKNOWN, @@ -274,12 +275,12 @@ public class NotificationPanelView extends PanelView implements SwipeHelper.SimpleCallback mSwipeCallback = new SwipeHelper.SimpleCallback() { @Override public View getChildAtPosition(MotionEvent ev) { - return mNotificationStackScroller; + return mViewLinker.getParent(); } @Override public View getChildContentView(View v) { - return mNotificationStackScroller; + return mViewLinker.getParent(); } @Override @@ -311,11 +312,10 @@ public class NotificationPanelView extends PanelView implements mLiveLockscreenController.getLiveLockScreenView() .onLockscreenSlideOffsetChanged(swipeProgress); - // Ensures the status view and notifications are kept in sync when - // being swiped away - mKeyguardStatusView.setTranslationX(mNotificationStackScroller.getTranslationX()); - mKeyguardStatusView.setAlpha(mNotificationStackScroller.getAlpha()); - mKeyguardStatusBar.setAlpha(mNotificationStackScroller.getAlpha()); + // Fade out scrim background + float alpha = ScrimController.SCRIM_BEHIND_ALPHA_KEYGUARD - (1f - swipeProgress); + alpha = Math.max(0, alpha); + mStatusBar.getScrimController().setScrimBehindColor(alpha); return false; } @@ -348,7 +348,7 @@ public class NotificationPanelView extends PanelView implements final int gradientEnd = res.getColor(R.color.live_lockscreen_gradient_end); mGestureDetector = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() { - public float mDown; + private float mDown; @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { @@ -359,12 +359,14 @@ public class NotificationPanelView extends PanelView implements mCanDismissKeyguard = true; mShowingExternalKeyguard = false; mStatusBar.showBouncer(); + mStatusBar.unfocusKeyguardExternalView(); return true; } @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { float delta = mDown - e2.getRawY(); + delta = Math.max(0, delta); float screenHeightHalf = (float) mScreenHeight / 2f; int color = (Integer) ArgbEvaluator.getInstance() .evaluate(delta / screenHeightHalf, gradientStart, gradientEnd); @@ -430,6 +432,11 @@ public class NotificationPanelView extends PanelView implements mDozeAnimationInterpolator = AnimationUtils.loadInterpolator(getContext(), android.R.interpolator.linear_out_slow_in); + mViewLinker = new ViewLinker<NotificationStackScrollLayout>(mNotificationStackScroller, + new ViewLinker.LinkInfo(mKeyguardStatusBar, ViewLinker.LINK_ALPHA), + new ViewLinker.LinkInfo(mKeyguardStatusView, ViewLinker.LINK_ALPHA + | ViewLinker.LINK_TRANSLATION)); + mKeyguardBottomArea = (KeyguardBottomAreaView) View.inflate(getContext(), R.layout.keyguard_bottom_area, null); /** Keyguard bottom area lives in a separate window, and as such, @@ -438,15 +445,16 @@ public class NotificationPanelView extends PanelView implements mKeyguardBottomArea.setOnInterceptTouchListener(new KeyguardBottomAreaView.OnInterceptTouchEventListener() { @Override public boolean onInterceptTouchEvent(MotionEvent e) { - boolean intercept = mAfforanceHelper.onInterceptTouchEvent(e); - if (!intercept) { - if (mShowingExternalKeyguard) { - // Handles swipe up to fade/dismiss when showing - // live lock screen + boolean intercept = false; + if (mShowingExternalKeyguard) { + // Handles swipe up to fade/dismiss when showing + // live lock screen + intercept = mAfforanceHelper.onInterceptTouchEvent(e); + if (!intercept) { intercept = mGestureDetector.onTouchEvent(e); - } else { - intercept = NotificationPanelView.this.onInterceptTouchEvent(e); } + } else { + intercept = NotificationPanelView.this.onInterceptTouchEvent(e); } return intercept; } @@ -455,19 +463,24 @@ public class NotificationPanelView extends PanelView implements @Override public boolean onTouch(View v, MotionEvent e) { int action = e.getAction(); - // Ensure we collapse and clear fade - if (action == MotionEvent.ACTION_UP || - action == MotionEvent.ACTION_CANCEL) { + + boolean isCancelOrUp = action == MotionEvent.ACTION_UP || + action == MotionEvent.ACTION_CANCEL; + if (isCancelOrUp) { mKeyguardBottomArea.setBackground(null); } - boolean intercept = mAfforanceHelper.onTouchEvent(e); - if (!intercept) { - if (mShowingExternalKeyguard) { + boolean intercept = false; + if (mShowingExternalKeyguard) { + intercept = mAfforanceHelper.onTouchEvent(e); + if (isCancelOrUp) { + mKeyguardBottomArea.expand(false); + } + if (!intercept) { intercept = mGestureDetector.onTouchEvent(e); - } else { - intercept = NotificationPanelView.this.onTouchEvent(e); } + } else { + intercept = NotificationPanelView.this.onTouchEvent(e); } return intercept; } @@ -491,6 +504,10 @@ public class NotificationPanelView extends PanelView implements }); } + public boolean isAffordanceSwipeInProgress() { + return mAfforanceHelper.isSwipingInProgress(); + } + @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); @@ -807,7 +824,7 @@ public class NotificationPanelView extends PanelView implements return true; } - if (isKeyguardInteractiveAndShowing()) { + if (isKeyguardInteractiveAndShowing() || mStatusBar.isKeyguardShowingMedia()) { return super.onInterceptTouchEvent(event); } @@ -987,7 +1004,7 @@ public class NotificationPanelView extends PanelView implements } if ((!mIsExpanding || mHintAnimationRunning) && !mQsExpanded - && mStatusBar.getBarState() != StatusBarState.SHADE) { + && (mStatusBar.getBarState() != StatusBarState.SHADE || mShowingExternalKeyguard)) { mAfforanceHelper.onTouchEvent(event); } if (mOnlyAffordanceInThisMotion) { @@ -1002,26 +1019,29 @@ public class NotificationPanelView extends PanelView implements updateVerticalPanelPosition(event.getX()); } - if (isKeyguardInteractiveAndShowing()) { + if (isKeyguardInteractiveAndShowing() || mStatusBar.isKeyguardShowingMedia()) { super.onTouchEvent(event); return true; } - if (!mSwipeHelper.isDragging() && super.onTouchEvent(event)) { - mLockedDirection = SwipeLockedDirection.VERTICAL; - return true; - } - if ((!mIsExpanding || mHintAnimationRunning) && !mQsExpanded && mLockedDirection != SwipeLockedDirection.VERTICAL && mStatusBar.getBarState() != StatusBarState.SHADE) { - if (mSwipeHelper.onTouchEvent(event)) { + mSwipeHelper.onTouchEvent(event); + if (mSwipeHelper.isDragging()) { mLockedDirection = SwipeLockedDirection.HORIZONTAL; + } + if (mLockedDirection == SwipeLockedDirection.HORIZONTAL) { + requestDisallowInterceptTouchEvent(true); return true; } } - return false; + + if (super.onTouchEvent(event)) { + mLockedDirection = SwipeLockedDirection.VERTICAL; + } + return true; } private boolean isKeyguardInteractiveAndShowing() { @@ -2028,9 +2048,6 @@ public class NotificationPanelView extends PanelView implements alpha = getNotificationsTopY() / (mKeyguardStatusBar.getHeight() + mNotificationsHeaderCollideDistance); - } else if (mStatusBar.getBarState() == StatusBarState.SHADE && - mLiveLockscreenController.isShowingLiveLockScreenView()) { - alpha = 1; } else { // In SHADE_LOCKED, the top card is already really close to the header. Hide it as @@ -2043,6 +2060,9 @@ public class NotificationPanelView extends PanelView implements } private void updateHeaderKeyguardAlpha() { + if (mSwipeHelper.isDragging()) { + return; + } float alphaQsExpansion = 1 - Math.min(1, getQsExpansionFraction() * 2); mKeyguardStatusBar.setAlpha(Math.min(getKeyguardContentsAlpha(), alphaQsExpansion) * mKeyguardStatusBarAnimateAlpha); @@ -2057,6 +2077,9 @@ public class NotificationPanelView extends PanelView implements private void updateKeyguardBottomAreaAlpha() { float alpha = Math.min(getKeyguardContentsAlpha(), 1 - getQsExpansionFraction()); + if (mShowingExternalKeyguard) { + alpha = 1f; + } mKeyguardBottomArea.setAlpha(alpha); mKeyguardBottomArea.setImportantForAccessibility(alpha == 0f ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS @@ -2280,6 +2303,7 @@ public class NotificationPanelView extends PanelView implements mLaunchAnimationEndRunnable.run(); mLaunchAnimationEndRunnable = null; } + mKeyguardBottomArea.setVisibility(View.GONE); } @Override @@ -2836,16 +2860,20 @@ public class NotificationPanelView extends PanelView implements @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { + View statusBarView = mStatusBar.getStatusBarWindow(); + if (valueAnimator.getAnimatedFraction() > 0 && + statusBarView.getVisibility() != View.VISIBLE) { + statusBarView.setVisibility(View.VISIBLE); + } float translationX = (Float) valueAnimator.getAnimatedValue(); float alpha = valueAnimator.getAnimatedFraction(); - mNotificationStackScroller.setTranslationX(translationX); - mNotificationStackScroller.setAlpha(alpha); - - mKeyguardStatusView.setTranslationX(translationX); - mKeyguardStatusView.setAlpha(alpha); + mViewLinker.getParent().setTranslationX(translationX); + mViewLinker.getParent().setAlpha(alpha); - mKeyguardStatusBar.setAlpha(alpha); + float alpha1 = ScrimController.SCRIM_BEHIND_ALPHA_KEYGUARD * alpha; + alpha1 = Math.max(0, alpha1); + mStatusBar.getScrimController().setScrimBehindColor(alpha1); mLiveLockscreenController.getLiveLockScreenView() .onLockscreenSlideOffsetChanged(alpha); } @@ -2866,6 +2894,7 @@ public class NotificationPanelView extends PanelView implements mKeyguardStatusView.setTranslationX(mNotificationStackScroller.getTranslationX()); mKeyguardStatusBar.setAlpha(0f); + mStatusBar.getScrimController().setScrimBehindColor(0f); ValueAnimator animator = ValueAnimator.ofFloat( mNotificationStackScroller.getTranslationX(), 0f); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 9a73aff..3e78be6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -326,7 +326,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, StatusBarWindowView mStatusBarWindow; FrameLayout mStatusBarWindowContent; - PhoneStatusBarView mStatusBarView; + private PhoneStatusBarView mStatusBarView; private int mStatusBarWindowState = WINDOW_STATE_SHOWING; private StatusBarWindowManager mStatusBarWindowManager; private UnlockMethodCache mUnlockMethodCache; @@ -494,6 +494,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } } + public void setStatusBarViewVisibility(boolean visible) { + mStatusBarView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); + } + class DevForceNavbarObserver extends UserContentObserver { DevForceNavbarObserver(Handler handler) { super(handler); @@ -789,6 +793,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, private RankingMap mLatestRankingMap; private boolean mNoAnimationOnNextBarModeChange; + public ScrimController getScrimController() { + return mScrimController; + } + @Override public void start() { mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)) @@ -4338,6 +4346,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mDraggedDownRow = null; } mAssistManager.onLockscreenShown(); + mKeyguardBottomArea.requestFocus(); if (mLiveLockScreenController.isShowingLiveLockScreenView()) { mLiveLockScreenController.getLiveLockScreenView().onKeyguardShowing( mStatusBarKeyguardViewManager.isScreenTurnedOn()); @@ -5531,4 +5540,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } } } + + public boolean isAffordanceSwipeInProgress() { + return mNotificationPanel.isAffordanceSwipeInProgress(); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index b9e9292..975cb77 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -45,9 +45,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, public static final long ANIMATION_DURATION = 220; public static final Interpolator KEYGUARD_FADE_OUT_INTERPOLATOR = new PathInterpolator(0f, 0, 0.7f, 1f); + public static final float SCRIM_BEHIND_ALPHA_KEYGUARD = 0.45f; private static final float SCRIM_BEHIND_ALPHA = 0.62f; - private static final float SCRIM_BEHIND_ALPHA_KEYGUARD = 0.45f; private static final float SCRIM_BEHIND_ALPHA_UNLOCKING = 0.2f; private static final float SCRIM_IN_FRONT_ALPHA = 0.75f; private static final int TAG_KEY_ANIM = R.id.scrim; @@ -255,7 +255,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, } } - private void setScrimBehindColor(float alpha) { + public void setScrimBehindColor(float alpha) { setScrimColor(mScrimBehind, alpha); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ViewLinker.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ViewLinker.java new file mode 100644 index 0000000..48457c6 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ViewLinker.java @@ -0,0 +1,76 @@ +package com.android.systemui.statusbar.phone; + +import android.view.View; + +/* + Allows mirroring of view states such as alpha, translation...etc + */ +public class ViewLinker<T extends View & ViewLinker.ViewLinkerParent> { + + public static final int LINK_ALPHA = 0x1; + public static final int LINK_TRANSLATION = 0x2; + + private final LinkInfo[] mLinkedViews; + private final T mParent; + + public interface ViewLinkerCallback { + void onAlphaChanged(float alpha); + void onTranslationXChanged(float translationX); + } + + public interface ViewLinkerParent { + void registerLinker(ViewLinkerCallback callback); + } + + public static class LinkInfo { + private View mView; + private int mFlags; + public LinkInfo(View v, int linkFlags) { + mView = v; + mFlags = linkFlags; + } + private boolean supportsFlag(int flag) { + return (mFlags & flag) != 0; + } + } + + private ViewLinkerCallback mCallback = new ViewLinkerCallback() { + @Override + public void onAlphaChanged(float alpha) { + for (LinkInfo v : mLinkedViews) { + if (v.supportsFlag(LINK_ALPHA)) { + v.mView.setAlpha(alpha); + } + } + } + + @Override + public void onTranslationXChanged(float translationX) { + for (LinkInfo v : mLinkedViews) { + if (v.supportsFlag(LINK_TRANSLATION)) { + v.mView.setTranslationX(translationX); + } + } + } + }; + + public ViewLinker(T parent, LinkInfo... viewsToLink) { + mLinkedViews = viewsToLink; + mParent = parent; + ensureParentNotInLink(); + parent.registerLinker(mCallback); + } + + private void ensureParentNotInLink() { + for (LinkInfo v : mLinkedViews) { + if (v.mView == mParent) { + throw new IllegalStateException("Parent cannot be" + + "one of the linked views"); + } + } + } + + public View getParent() { + return mParent; + } +} |