Merge "Fix jank when clicking on HUN" into mnc-dr-dev
This commit is contained in:
@@ -90,6 +90,7 @@ import com.android.internal.statusbar.StatusBarIconList;
|
||||
import com.android.internal.util.NotificationColorUtil;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||
import com.android.systemui.DejankUtils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.RecentsComponent;
|
||||
import com.android.systemui.SwipeHelper;
|
||||
@@ -1506,6 +1507,15 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
final PendingIntent intent = sbn.getNotification().contentIntent;
|
||||
final String notificationKey = sbn.getKey();
|
||||
|
||||
// Mark notification for one frame.
|
||||
row.setJustClicked(true);
|
||||
DejankUtils.postAfterTraversal(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
row.setJustClicked(false);
|
||||
}
|
||||
});
|
||||
|
||||
if (NOTIFICATION_CLICK_DEBUG) {
|
||||
Log.d(TAG, "Clicked on content of " + notificationKey);
|
||||
}
|
||||
|
||||
@@ -110,6 +110,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
}
|
||||
};
|
||||
|
||||
private boolean mJustClicked;
|
||||
|
||||
public NotificationContentView getPrivateLayout() {
|
||||
return mPrivateLayout;
|
||||
}
|
||||
@@ -301,6 +303,21 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
return mHeadsUpHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark whether this notification was just clicked, i.e. the user has just clicked this
|
||||
* notification in this frame.
|
||||
*/
|
||||
public void setJustClicked(boolean justClicked) {
|
||||
mJustClicked = justClicked;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if this notification has been clicked in this frame, false otherwise
|
||||
*/
|
||||
public boolean wasJustClicked() {
|
||||
return mJustClicked;
|
||||
}
|
||||
|
||||
public interface ExpansionLogger {
|
||||
public void logNotificationExpansion(String key, boolean userAction, boolean expanded);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public class AnimationFilter {
|
||||
boolean hasDelays;
|
||||
boolean hasGoToFullShadeEvent;
|
||||
boolean hasDarkEvent;
|
||||
boolean hasHeadsUpDisappearClickEvent;
|
||||
int darkAnimationOriginIndex;
|
||||
|
||||
public AnimationFilter animateAlpha() {
|
||||
@@ -106,6 +107,10 @@ public class AnimationFilter {
|
||||
hasDarkEvent = true;
|
||||
darkAnimationOriginIndex = ev.darkAnimationOriginIndex;
|
||||
}
|
||||
if (ev.animationType == NotificationStackScrollLayout.AnimationEvent
|
||||
.ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK) {
|
||||
hasHeadsUpDisappearClickEvent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,6 +140,7 @@ public class AnimationFilter {
|
||||
hasDelays = false;
|
||||
hasGoToFullShadeEvent = false;
|
||||
hasDarkEvent = false;
|
||||
hasHeadsUpDisappearClickEvent = false;
|
||||
darkAnimationOriginIndex =
|
||||
NotificationStackScrollLayout.AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE;
|
||||
}
|
||||
|
||||
@@ -1915,7 +1915,9 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
boolean onBottom = false;
|
||||
boolean pinnedAndClosed = row.isPinned() && !mIsExpanded;
|
||||
if (!mIsExpanded && !isHeadsUp) {
|
||||
type = AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR;
|
||||
type = row.wasJustClicked()
|
||||
? AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK
|
||||
: AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR;
|
||||
} else {
|
||||
StackViewState viewState = mCurrentStackScrollState.getViewStateForView(row);
|
||||
if (viewState == null) {
|
||||
@@ -3016,6 +3018,15 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
.animateY()
|
||||
.animateZ(),
|
||||
|
||||
// ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK
|
||||
new AnimationFilter()
|
||||
.animateAlpha()
|
||||
.animateHeight()
|
||||
.animateTopInset()
|
||||
.animateY()
|
||||
.animateZ()
|
||||
.hasDelays(),
|
||||
|
||||
// ANIMATION_TYPE_HEADS_UP_OTHER
|
||||
new AnimationFilter()
|
||||
.animateAlpha()
|
||||
@@ -3087,6 +3098,9 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
// ANIMATION_TYPE_HEADS_UP_DISAPPEAR
|
||||
StackStateAnimator.ANIMATION_DURATION_HEADS_UP_DISAPPEAR,
|
||||
|
||||
// ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK
|
||||
StackStateAnimator.ANIMATION_DURATION_HEADS_UP_DISAPPEAR,
|
||||
|
||||
// ANIMATION_TYPE_HEADS_UP_OTHER
|
||||
StackStateAnimator.ANIMATION_DURATION_STANDARD,
|
||||
|
||||
@@ -3110,8 +3124,9 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
static final int ANIMATION_TYPE_GROUP_EXPANSION_CHANGED = 13;
|
||||
static final int ANIMATION_TYPE_HEADS_UP_APPEAR = 14;
|
||||
static final int ANIMATION_TYPE_HEADS_UP_DISAPPEAR = 15;
|
||||
static final int ANIMATION_TYPE_HEADS_UP_OTHER = 16;
|
||||
static final int ANIMATION_TYPE_EVERYTHING = 17;
|
||||
static final int ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK = 16;
|
||||
static final int ANIMATION_TYPE_HEADS_UP_OTHER = 17;
|
||||
static final int ANIMATION_TYPE_EVERYTHING = 18;
|
||||
|
||||
static final int DARK_ANIMATION_ORIGIN_INDEX_ABOVE = -1;
|
||||
static final int DARK_ANIMATION_ORIGIN_INDEX_BELOW = -2;
|
||||
|
||||
@@ -54,6 +54,7 @@ public class StackStateAnimator {
|
||||
public static final int ANIMATION_DELAY_PER_ELEMENT_DARK = 24;
|
||||
public static final int DELAY_EFFECT_MAX_INDEX_DIFFERENCE = 2;
|
||||
public static final int DELAY_EFFECT_MAX_INDEX_DIFFERENCE_CHILDREN = 3;
|
||||
public static final int ANIMATION_DELAY_HEADS_UP = 120;
|
||||
|
||||
private static final int TAG_ANIMATOR_TRANSLATION_Y = R.id.translation_y_animator_tag;
|
||||
private static final int TAG_ANIMATOR_TRANSLATION_Z = R.id.translation_z_animator_tag;
|
||||
@@ -320,6 +321,9 @@ public class StackStateAnimator {
|
||||
if (mAnimationFilter.hasGoToFullShadeEvent) {
|
||||
return calculateDelayGoToFullShade(viewState);
|
||||
}
|
||||
if (mAnimationFilter.hasHeadsUpDisappearClickEvent) {
|
||||
return ANIMATION_DELAY_HEADS_UP;
|
||||
}
|
||||
long minDelay = 0;
|
||||
for (NotificationStackScrollLayout.AnimationEvent event : mNewEvents) {
|
||||
long delayPerElement = ANIMATION_DELAY_PER_ELEMENT_INTERRUPTING;
|
||||
@@ -890,7 +894,9 @@ public class StackStateAnimator {
|
||||
mHeadsUpAppearChildren.add(changingView);
|
||||
finalState.applyState(changingView, mTmpState);
|
||||
} else if (event.animationType == NotificationStackScrollLayout
|
||||
.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR) {
|
||||
.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR ||
|
||||
event.animationType == NotificationStackScrollLayout
|
||||
.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK) {
|
||||
mHeadsUpDisappearChildren.add(changingView);
|
||||
if (mHostLayout.indexOfChild(changingView) == -1) {
|
||||
// This notification was actually removed, so we need to add it to the overlay
|
||||
@@ -900,7 +906,11 @@ public class StackStateAnimator {
|
||||
// We temporarily enable Y animations, the real filter will be combined
|
||||
// afterwards anyway
|
||||
mAnimationFilter.animateY = true;
|
||||
startViewAnimations(changingView, mTmpState, 0,
|
||||
startViewAnimations(changingView, mTmpState,
|
||||
event.animationType == NotificationStackScrollLayout
|
||||
.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK
|
||||
? ANIMATION_DELAY_HEADS_UP
|
||||
: 0,
|
||||
ANIMATION_DURATION_HEADS_UP_DISAPPEAR);
|
||||
mChildrenToClearFromOverlay.add(changingView);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user