* commit '7795faace682aee863d836da91364b2ea5632c8f': Fix jank when clicking on HUN
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.util.NotificationColorUtil;
|
||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||||
|
import com.android.systemui.DejankUtils;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.RecentsComponent;
|
import com.android.systemui.RecentsComponent;
|
||||||
import com.android.systemui.SwipeHelper;
|
import com.android.systemui.SwipeHelper;
|
||||||
@@ -1506,6 +1507,15 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
final PendingIntent intent = sbn.getNotification().contentIntent;
|
final PendingIntent intent = sbn.getNotification().contentIntent;
|
||||||
final String notificationKey = sbn.getKey();
|
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) {
|
if (NOTIFICATION_CLICK_DEBUG) {
|
||||||
Log.d(TAG, "Clicked on content of " + notificationKey);
|
Log.d(TAG, "Clicked on content of " + notificationKey);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,6 +110,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private boolean mJustClicked;
|
||||||
|
|
||||||
public NotificationContentView getPrivateLayout() {
|
public NotificationContentView getPrivateLayout() {
|
||||||
return mPrivateLayout;
|
return mPrivateLayout;
|
||||||
}
|
}
|
||||||
@@ -301,6 +303,21 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
|||||||
return mHeadsUpHeight;
|
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 interface ExpansionLogger {
|
||||||
public void logNotificationExpansion(String key, boolean userAction, boolean expanded);
|
public void logNotificationExpansion(String key, boolean userAction, boolean expanded);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ public class AnimationFilter {
|
|||||||
boolean hasDelays;
|
boolean hasDelays;
|
||||||
boolean hasGoToFullShadeEvent;
|
boolean hasGoToFullShadeEvent;
|
||||||
boolean hasDarkEvent;
|
boolean hasDarkEvent;
|
||||||
|
boolean hasHeadsUpDisappearClickEvent;
|
||||||
int darkAnimationOriginIndex;
|
int darkAnimationOriginIndex;
|
||||||
|
|
||||||
public AnimationFilter animateAlpha() {
|
public AnimationFilter animateAlpha() {
|
||||||
@@ -106,6 +107,10 @@ public class AnimationFilter {
|
|||||||
hasDarkEvent = true;
|
hasDarkEvent = true;
|
||||||
darkAnimationOriginIndex = ev.darkAnimationOriginIndex;
|
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;
|
hasDelays = false;
|
||||||
hasGoToFullShadeEvent = false;
|
hasGoToFullShadeEvent = false;
|
||||||
hasDarkEvent = false;
|
hasDarkEvent = false;
|
||||||
|
hasHeadsUpDisappearClickEvent = false;
|
||||||
darkAnimationOriginIndex =
|
darkAnimationOriginIndex =
|
||||||
NotificationStackScrollLayout.AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE;
|
NotificationStackScrollLayout.AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1915,7 +1915,9 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
boolean onBottom = false;
|
boolean onBottom = false;
|
||||||
boolean pinnedAndClosed = row.isPinned() && !mIsExpanded;
|
boolean pinnedAndClosed = row.isPinned() && !mIsExpanded;
|
||||||
if (!mIsExpanded && !isHeadsUp) {
|
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 {
|
} else {
|
||||||
StackViewState viewState = mCurrentStackScrollState.getViewStateForView(row);
|
StackViewState viewState = mCurrentStackScrollState.getViewStateForView(row);
|
||||||
if (viewState == null) {
|
if (viewState == null) {
|
||||||
@@ -3016,6 +3018,15 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
.animateY()
|
.animateY()
|
||||||
.animateZ(),
|
.animateZ(),
|
||||||
|
|
||||||
|
// ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK
|
||||||
|
new AnimationFilter()
|
||||||
|
.animateAlpha()
|
||||||
|
.animateHeight()
|
||||||
|
.animateTopInset()
|
||||||
|
.animateY()
|
||||||
|
.animateZ()
|
||||||
|
.hasDelays(),
|
||||||
|
|
||||||
// ANIMATION_TYPE_HEADS_UP_OTHER
|
// ANIMATION_TYPE_HEADS_UP_OTHER
|
||||||
new AnimationFilter()
|
new AnimationFilter()
|
||||||
.animateAlpha()
|
.animateAlpha()
|
||||||
@@ -3087,6 +3098,9 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
// ANIMATION_TYPE_HEADS_UP_DISAPPEAR
|
// ANIMATION_TYPE_HEADS_UP_DISAPPEAR
|
||||||
StackStateAnimator.ANIMATION_DURATION_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
|
// ANIMATION_TYPE_HEADS_UP_OTHER
|
||||||
StackStateAnimator.ANIMATION_DURATION_STANDARD,
|
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_GROUP_EXPANSION_CHANGED = 13;
|
||||||
static final int ANIMATION_TYPE_HEADS_UP_APPEAR = 14;
|
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_DISAPPEAR = 15;
|
||||||
static final int ANIMATION_TYPE_HEADS_UP_OTHER = 16;
|
static final int ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK = 16;
|
||||||
static final int ANIMATION_TYPE_EVERYTHING = 17;
|
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_ABOVE = -1;
|
||||||
static final int DARK_ANIMATION_ORIGIN_INDEX_BELOW = -2;
|
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 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 = 2;
|
||||||
public static final int DELAY_EFFECT_MAX_INDEX_DIFFERENCE_CHILDREN = 3;
|
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_Y = R.id.translation_y_animator_tag;
|
||||||
private static final int TAG_ANIMATOR_TRANSLATION_Z = R.id.translation_z_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) {
|
if (mAnimationFilter.hasGoToFullShadeEvent) {
|
||||||
return calculateDelayGoToFullShade(viewState);
|
return calculateDelayGoToFullShade(viewState);
|
||||||
}
|
}
|
||||||
|
if (mAnimationFilter.hasHeadsUpDisappearClickEvent) {
|
||||||
|
return ANIMATION_DELAY_HEADS_UP;
|
||||||
|
}
|
||||||
long minDelay = 0;
|
long minDelay = 0;
|
||||||
for (NotificationStackScrollLayout.AnimationEvent event : mNewEvents) {
|
for (NotificationStackScrollLayout.AnimationEvent event : mNewEvents) {
|
||||||
long delayPerElement = ANIMATION_DELAY_PER_ELEMENT_INTERRUPTING;
|
long delayPerElement = ANIMATION_DELAY_PER_ELEMENT_INTERRUPTING;
|
||||||
@@ -890,7 +894,9 @@ public class StackStateAnimator {
|
|||||||
mHeadsUpAppearChildren.add(changingView);
|
mHeadsUpAppearChildren.add(changingView);
|
||||||
finalState.applyState(changingView, mTmpState);
|
finalState.applyState(changingView, mTmpState);
|
||||||
} else if (event.animationType == NotificationStackScrollLayout
|
} 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);
|
mHeadsUpDisappearChildren.add(changingView);
|
||||||
if (mHostLayout.indexOfChild(changingView) == -1) {
|
if (mHostLayout.indexOfChild(changingView) == -1) {
|
||||||
// This notification was actually removed, so we need to add it to the overlay
|
// 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
|
// We temporarily enable Y animations, the real filter will be combined
|
||||||
// afterwards anyway
|
// afterwards anyway
|
||||||
mAnimationFilter.animateY = true;
|
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);
|
ANIMATION_DURATION_HEADS_UP_DISAPPEAR);
|
||||||
mChildrenToClearFromOverlay.add(changingView);
|
mChildrenToClearFromOverlay.add(changingView);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user