From 40e8e4c95c600f1d7e4967b00315509061cbe59c Mon Sep 17 00:00:00 2001 From: Danesh M Date: Tue, 12 Apr 2016 15:24:16 -0700 Subject: Lockscreen : Bunch-o-fixes - Prevent edge gesture from conflicting with lockscreen shortcuts - Fix lockscreen shortcuts crash where animations were being run on detached view - Fix statusbar flicker when swiping keyguard in from the left - Fade scrim away when swiping lockscreen in and out - Fix back button not working when showing bouncer in external keyguard. - Ensure we collapse bottom area after up/cancel when in external keyguard - Fix issue where clock/notifications can get off-center when swiping to left. - Fix bottom flicker when swiping lockscreen to left - Only lock directional swiping when swipe helper acknowledges it. This allows for all the standard swipe behavior to function. - Ensure lockscreen shortcuts are not actionable when in SHADE - Only dismiss bottom area after lockscreen shortcuts animations have finished animating - Prevent swipe when album art showing CYNGNOS-2585 CYNGNOS-2488 CYNGNOS-2517 CYNGNOS-2390 CYNGNOS-2632 CYNGNOS-2634 Change-Id: I2fe767ed7e07b621075c755aae98121c8517b997 --- .../systemui/keyguard/KeyguardViewMediator.java | 9 ++ .../systemui/statusbar/phone/KeyguardBouncer.java | 8 +- .../statusbar/phone/NotificationPanelView.java | 113 +++++++++++++-------- .../systemui/statusbar/phone/PhoneStatusBar.java | 15 ++- .../systemui/statusbar/phone/ScrimController.java | 4 +- .../systemui/statusbar/phone/ViewLinker.java | 76 ++++++++++++++ .../statusbar/policy/LiveLockScreenController.java | 12 +++ .../stack/NotificationStackScrollLayout.java | 22 +++- .../android/server/policy/PhoneWindowManager.java | 9 +- 9 files changed, 219 insertions(+), 49 deletions(-) create mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/phone/ViewLinker.java diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 4a899f7..2c4c269 100755 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -53,6 +53,7 @@ import android.util.EventLog; import android.util.Log; import android.util.Slog; import android.view.IWindowManager; +import android.view.View; import android.view.ViewGroup; import android.view.WindowManagerGlobal; import android.view.WindowManagerPolicy; @@ -1294,9 +1295,17 @@ public class KeyguardViewMediator extends SystemUI { } public void showKeyguard() { + // This is to prevent left edge from interfering + // with affordances. + if (mStatusBar.isAffordanceSwipeInProgress()) { + return; + } mHandler.post(new Runnable() { @Override public void run() { + // Hide status bar window to avoid flicker, + // slideNotificationPanelIn will make it visible later. + mStatusBar.getStatusBarWindow().setVisibility(View.INVISIBLE); // Get the keyguard into the correct state by calling mStatusBar.showKeyguard() mStatusBar.showKeyguard(); // Now have the notification panel slid back into view 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(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 { + + 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; + } +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LiveLockScreenController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LiveLockScreenController.java index 5c6bc4c..68fd4c1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LiveLockScreenController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LiveLockScreenController.java @@ -10,6 +10,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.util.EventLog; +import android.view.View; import com.android.systemui.EventLogTags; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.phone.NotificationPanelView; @@ -79,6 +80,10 @@ public class LiveLockScreenController { onKeyguardDismissed(); } + if (statusBarState == StatusBarState.KEYGUARD) { + mBar.getScrimController().forceHideScrims(false); + } + mStatusBarState = statusBarState; if (statusBarState == StatusBarState.KEYGUARD || statusBarState == StatusBarState.SHADE_LOCKED) { @@ -241,12 +246,19 @@ public class LiveLockScreenController { EventLog.writeEvent(EventLogTags.SYSUI_LLS_NOTIFICATION_PANEL_SHOWN, hasFocus ? 0 : 1); } + // Hide statusbar and scrim if live lockscreen + // currently has focus + mBar.setStatusBarViewVisibility(!hasFocus); + mBar.getScrimController().forceHideScrims(hasFocus); mLlsHasFocus = hasFocus; } public void onKeyguardDismissed() { if (mLiveLockScreenView != null) mLiveLockScreenView.onKeyguardDismissed(); EventLog.writeEvent(EventLogTags.SYSUI_LLS_KEYGUARD_DISMISSED, mLlsHasFocus ? 1 : 0); + // Ensure we reset visibility when keyguard is dismissed + mBar.setStatusBarViewVisibility(true); + mBar.getScrimController().forceHideScrims(false); } private Runnable mAddNewLiveLockScreenRunnable = new Runnable() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 2f04b42..b6e131a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -50,6 +50,7 @@ import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.phone.NotificationGroupManager; import com.android.systemui.statusbar.phone.PhoneStatusBar; import com.android.systemui.statusbar.phone.ScrimController; +import com.android.systemui.statusbar.phone.ViewLinker; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.ScrollAdapter; @@ -63,7 +64,8 @@ import java.util.HashSet; */ public class NotificationStackScrollLayout extends ViewGroup implements SwipeHelper.Callback, ExpandHelper.Callback, ScrollAdapter, - ExpandableView.OnHeightChangedListener, NotificationGroupManager.OnGroupChangeListener { + ExpandableView.OnHeightChangedListener, NotificationGroupManager.OnGroupChangeListener, + ViewLinker.ViewLinkerParent { private static final String TAG = "NotificationStackScrollLayout"; private static final boolean DEBUG = false; @@ -234,6 +236,7 @@ public class NotificationStackScrollLayout extends ViewGroup private boolean mForceNoOverlappingRendering; private NotificationOverflowContainer mOverflowContainer; private final ArrayList> mTmpList = new ArrayList<>(); + private ViewLinker.ViewLinkerCallback mLinkerCallback; public NotificationStackScrollLayout(Context context) { this(context, null); @@ -2879,6 +2882,23 @@ public class NotificationStackScrollLayout extends ViewGroup return !mForceNoOverlappingRendering && super.hasOverlappingRendering(); } + @Override + public void registerLinker(ViewLinker.ViewLinkerCallback callback) { + mLinkerCallback = callback; + } + + @Override + public void setAlpha(float alpha) { + super.setAlpha(alpha); + mLinkerCallback.onAlphaChanged(alpha); + } + + @Override + public void setTranslationX(float translationX) { + super.setTranslationX(translationX); + mLinkerCallback.onTranslationXChanged(translationX); + } + /** * A listener that is notified when some child locations might have changed. */ diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index cb150dc..943bea9 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -1764,10 +1764,15 @@ public class PhoneWindowManager implements WindowManagerPolicy { mNavigationBarLeftInLandscape) { requestTransientBars(mNavigationBar); } - if (mShowKeyguardOnLeftSwipe && isKeyguardShowingOrOccluded()) { + boolean focusedWindowIsExternalKeyguard = false; + if (mFocusedWindow != null) { + focusedWindowIsExternalKeyguard = (mFocusedWindow.getAttrs().type + & WindowManager.LayoutParams.TYPE_KEYGUARD_PANEL) != 0; + } + if (mShowKeyguardOnLeftSwipe && isKeyguardShowingOrOccluded() + && focusedWindowIsExternalKeyguard) { // Show keyguard mKeyguardDelegate.showKeyguard(); - mShowKeyguardOnLeftSwipe = false; } } @Override -- cgit v1.1