diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml
index 8ebbc520197dd..4a732008137a4 100644
--- a/packages/SystemUI/res/values/ids.xml
+++ b/packages/SystemUI/res/values/ids.xml
@@ -18,4 +18,5 @@
+
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
index 6aa7dcded78b4..674d9a3e0aac4 100644
--- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
@@ -39,7 +39,8 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
View getChildAtRawPosition(float x, float y);
View getChildAtPosition(float x, float y);
boolean canChildBeExpanded(View v);
- boolean setUserExpandedChild(View v, boolean userxpanded);
+ boolean setUserExpandedChild(View v, boolean userExpanded);
+ boolean setUserLockedChild(View v, boolean userLocked);
}
private static final String TAG = "ExpandHelper";
@@ -433,7 +434,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
final int y = (int) ev.getY();
View underPointer = findView(x, y);
if (isFinished && underPointer != null && underPointer != mCurrView) {
- setGlow(0f);
+ finishScale(false);
initScale(underPointer);
mInitialTouchY = ev.getY();
mHasPopped = false;
@@ -458,6 +459,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
private boolean initScale(View v) {
if (v != null) {
if (DEBUG) Slog.d(TAG, "scale begins on view: " + v);
+ mCallback.setUserLockedChild(v, true);
setView(v);
setGlow(GLOW_BASE);
mScaler.setView(v);
@@ -479,21 +481,26 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
}
private void finishScale(boolean force) {
+ float currentHeight = mScaler.getHeight();
+ float targetHeight = mSmallSize;
float h = mScaler.getHeight();
final boolean wasClosed = (mOldHeight == mSmallSize);
if (wasClosed) {
- h = (force || h > mSmallSize) ? mNaturalHeight : mSmallSize;
+ targetHeight = (force || currentHeight > mSmallSize) ? mNaturalHeight : mSmallSize;
} else {
- h = (force || h < mNaturalHeight) ? mSmallSize : mNaturalHeight;
+ targetHeight = (force || currentHeight < mNaturalHeight) ? mSmallSize : mNaturalHeight;
}
if (mScaleAnimation.isRunning()) {
mScaleAnimation.cancel();
}
- mScaleAnimation.setFloatValues(h);
- mScaleAnimation.setupStartValues();
- mScaleAnimation.start();
setGlow(0f);
mCallback.setUserExpandedChild(mCurrView, h == mNaturalHeight);
+ if (targetHeight != currentHeight) {
+ mScaleAnimation.setFloatValues(targetHeight);
+ mScaleAnimation.setupStartValues();
+ mScaleAnimation.start();
+ }
+ mCallback.setUserLockedChild(mCurrView, false);
if (DEBUG) Slog.d(TAG, "scale was finished on view: " + mCurrView);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index b392648b68649..ea5089d0f6668 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -780,16 +780,20 @@ public abstract class BaseStatusBar extends SystemUI implements
int N = mNotificationData.size();
for (int i = 0; i < N; i++) {
NotificationData.Entry entry = mNotificationData.get(i);
- if (i == (N-1)) {
- if (DEBUG) Slog.d(TAG, "expanding top notification at " + i);
- expandView(entry, true);
- } else {
- if (!entry.userExpanded()) {
- if (DEBUG) Slog.d(TAG, "collapsing notification at " + i);
- expandView(entry, false);
+ if (!entry.userLocked()) {
+ if (i == (N-1)) {
+ if (DEBUG) Slog.d(TAG, "expanding top notification at " + i);
+ expandView(entry, true);
} else {
- if (DEBUG) Slog.d(TAG, "ignoring user-modified notification at " + i);
+ if (!entry.userExpanded()) {
+ if (DEBUG) Slog.d(TAG, "collapsing notification at " + i);
+ expandView(entry, false);
+ } else {
+ if (DEBUG) Slog.d(TAG, "ignoring user-modified notification at " + i);
+ }
}
+ } else {
+ if (DEBUG) Slog.d(TAG, "ignoring notification being held by user at " + i);
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index dfd8cf8a46890..c82f25008f2d5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -71,6 +71,18 @@ public class NotificationData {
public boolean setUserExpanded(boolean userExpanded) {
return NotificationData.setUserExpanded(row, userExpanded);
}
+ /**
+ * Return whether the entry is being touched by the user.
+ */
+ public boolean userLocked() {
+ return NotificationData.getUserLocked(row);
+ }
+ /**
+ * Set the flag indicating that this is being touched by the user.
+ */
+ public boolean setUserLocked(boolean userLocked) {
+ return NotificationData.setUserLocked(row, userLocked);
+ }
}
private final ArrayList mEntries = new ArrayList();
private final Comparator mEntryCmp = new Comparator() {
@@ -197,4 +209,18 @@ public class NotificationData {
public static boolean setUserExpanded(View row, boolean userExpanded) {
return writeBooleanTag(row, R.id.user_expanded_tag, userExpanded);
}
+
+ /**
+ * Return whether the entry is being touched by the user.
+ */
+ public static boolean getUserLocked(View row) {
+ return readBooleanTag(row, R.id.user_lock_tag);
+ }
+
+ /**
+ * Set whether the entry is being touched by the user.
+ */
+ public static boolean setUserLocked(View row, boolean userLocked) {
+ return writeBooleanTag(row, R.id.user_lock_tag, userLocked);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
index 61e5ab63d6e80..9fee49ba87194 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
@@ -161,6 +161,10 @@ public class NotificationRowLayout
return NotificationData.setUserExpanded(v, userExpanded);
}
+ public boolean setUserLockedChild(View v, boolean userLocked) {
+ return NotificationData.setUserLocked(v, userLocked);
+ }
+
public void onChildDismissed(View v) {
final View veto = v.findViewById(R.id.veto);
if (veto != null && veto.getVisibility() != View.GONE && mRemoveViews) {