summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/ExpandHelper.java36
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java13
5 files changed, 47 insertions, 22 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
index 7a5e32227db1..d98bb23d88da 100644
--- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
@@ -326,7 +326,8 @@ public class ExpandHelper implements Gefingerpoken {
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (DEBUG) Log.d(TAG, "up/cancel");
- finishExpanding(false, getCurrentVelocity());
+ finishExpanding(ev.getActionMasked() == MotionEvent.ACTION_CANCEL,
+ getCurrentVelocity());
clearView();
break;
}
@@ -390,7 +391,8 @@ public class ExpandHelper implements Gefingerpoken {
@Override
public boolean onTouchEvent(MotionEvent ev) {
- if (!isEnabled()) {
+ if (!isEnabled() && !mExpanding) {
+ // In case we're expanding we still want to finish the current motion.
return false;
}
trackVelocity(ev);
@@ -485,7 +487,8 @@ public class ExpandHelper implements Gefingerpoken {
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (DEBUG) Log.d(TAG, "up/cancel");
- finishExpanding(false, getCurrentVelocity());
+ finishExpanding(!isEnabled() || ev.getActionMasked() == MotionEvent.ACTION_CANCEL,
+ getCurrentVelocity());
clearView();
break;
}
@@ -526,28 +529,37 @@ public class ExpandHelper implements Gefingerpoken {
return true;
}
- private void finishExpanding(boolean force, float velocity) {
+ /**
+ * Finish the current expand motion
+ * @param forceAbort whether the expansion should be forcefully aborted and returned to the old
+ * state
+ * @param velocity the velocity this was expanded/ collapsed with
+ */
+ private void finishExpanding(boolean forceAbort, float velocity) {
if (!mExpanding) return;
if (DEBUG) Log.d(TAG, "scale in finishing on view: " + mResizedView);
float currentHeight = mScaler.getHeight();
- float h = mScaler.getHeight();
final boolean wasClosed = (mOldHeight == mSmallSize);
boolean nowExpanded;
- int naturalHeight = mScaler.getNaturalHeight();
- if (wasClosed) {
- nowExpanded = (force || currentHeight > mOldHeight && velocity >= 0);
+ if (!forceAbort) {
+ if (wasClosed) {
+ nowExpanded = currentHeight > mOldHeight && velocity >= 0;
+ } else {
+ nowExpanded = currentHeight >= mOldHeight || velocity > 0;
+ }
+ nowExpanded |= mNaturalHeight == mSmallSize;
} else {
- nowExpanded = !force && (currentHeight >= mOldHeight || velocity > 0);
+ nowExpanded = !wasClosed;
}
- nowExpanded |= mNaturalHeight == mSmallSize;
if (mScaleAnimation.isRunning()) {
mScaleAnimation.cancel();
}
mCallback.expansionStateChanged(false);
+ int naturalHeight = mScaler.getNaturalHeight();
float targetHeight = nowExpanded ? naturalHeight : mSmallSize;
- if (targetHeight != currentHeight) {
+ if (targetHeight != currentHeight && mEnabled) {
mScaleAnimation.setFloatValues(targetHeight);
mScaleAnimation.setupStartValues();
final View scaledView = mResizedView;
@@ -597,7 +609,7 @@ public class ExpandHelper implements Gefingerpoken {
* Use this to abort any pending expansions in progress.
*/
public void cancel() {
- finishExpanding(true, 0f /* velocity */);
+ finishExpanding(true /* forceAbort */, 0f /* velocity */);
clearView();
// reset the gesture detector
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java
index 2dabf5d32016..19132da9b3bd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java
@@ -228,6 +228,10 @@ public class DragDownHelper implements Gefingerpoken {
return mCallback.getChildAtRawPosition(x, y);
}
+ public boolean isDraggingDown() {
+ return mDraggingDown;
+ }
+
public interface DragDownCallback {
/**
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 ea4e10297eda..ca7cf1845c1f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -4692,7 +4692,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
/* Only ever called as a consequence of a lockscreen expansion gesture. */
@Override
public boolean onDraggedDown(View startingChild, int dragLengthY) {
- if (hasActiveNotifications()) {
+ if (hasActiveNotifications() && (!isDozing() || isPulsing())) {
EventLogTags.writeSysuiLockscreenGesture(
EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_SWIPE_DOWN_FULL_SHADE,
(int) (dragLengthY / mDisplayMetrics.density),
@@ -4706,8 +4706,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
return true;
} else {
-
- // No notifications - abort gesture.
+ // abort gesture.
return false;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index 487f0e73959c..1b73a3f53997 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -285,13 +285,10 @@ public class StatusBarWindowView extends FrameLayout {
@Override
public boolean onTouchEvent(MotionEvent ev) {
- if (mService.isDozing() && !mService.isPulsing()) {
- // Discard all touch events in always-on.
- return true;
- }
-
- boolean handled = false;
- if (mService.getBarState() == StatusBarState.KEYGUARD) {
+ boolean handled = mService.isDozing() && !mService.isPulsing();
+ if (mService.getBarState() == StatusBarState.KEYGUARD
+ && (!handled || mDragDownHelper.isDraggingDown())) {
+ // we still want to finish our drag down gesture when locking the screen
handled = mDragDownHelper.onTouchEvent(ev);
}
if (!handled) {
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 ec44f19e8bfc..1e9c838ecc26 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -1064,6 +1064,19 @@ public class NotificationStackScrollLayout extends ViewGroup
public void setUserExpandedChild(View v, boolean userExpanded) {
if (v instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) v;
+ if (userExpanded && onKeyguard()) {
+ // Due to a race when locking the screen while touching, a notification may be
+ // expanded even after we went back to keyguard. An example of this happens if
+ // you click in the empty space while expanding a group.
+
+ // We also need to un-user lock it here, since otherwise the content height
+ // calculated might be wrong. We also can't invert the two calls since
+ // un-userlocking it will trigger a layout switch in the content view.
+ row.setUserLocked(false);
+ updateContentHeight();
+ notifyHeightChangeListener(row);
+ return;
+ }
row.setUserExpanded(userExpanded, true /* allowChildrenExpansion */);
row.onExpandedByGesture(userExpanded);
}