Merge changes If981a380,I48a8f882,I4b248b2f,Id9e6ce2a,Ib5239325, ... into nyc-dev
am: 4f0e1e1d09
* commit '4f0e1e1d090089f5b0337d53fe77a90a1c796398':
Fixed a bug where custom notifications were invisible
Fixed a transformation error when fading in views
Fixed animation jank in notification groups
Fixed a bug where the single line view would be invisible
Fixed a bug where huns could be invisible
Fixed a crash with notification children
This commit is contained in:
@@ -527,6 +527,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
mGuts.setVisibility(oldGuts.getVisibility());
|
||||
addView(mGuts, index);
|
||||
}
|
||||
mPrivateLayout.reInflateViews();
|
||||
mPublicLayout.reInflateViews();
|
||||
}
|
||||
|
||||
public interface ExpansionLogger {
|
||||
|
||||
@@ -248,14 +248,16 @@ public class NotificationContentView extends FrameLayout {
|
||||
public void reset(boolean resetActualHeight) {
|
||||
if (mContractedChild != null) {
|
||||
mContractedChild.animate().cancel();
|
||||
removeView(mContractedChild);
|
||||
}
|
||||
if (mExpandedChild != null) {
|
||||
mExpandedChild.animate().cancel();
|
||||
removeView(mExpandedChild);
|
||||
}
|
||||
if (mHeadsUpChild != null) {
|
||||
mHeadsUpChild.animate().cancel();
|
||||
removeView(mHeadsUpChild);
|
||||
}
|
||||
removeAllViews();
|
||||
mContractedChild = null;
|
||||
mExpandedChild = null;
|
||||
mHeadsUpChild = null;
|
||||
@@ -494,7 +496,8 @@ public class NotificationContentView extends FrameLayout {
|
||||
return VISIBLE_TYPE_EXPANDED;
|
||||
}
|
||||
} else {
|
||||
if (viewHeight <= mContractedChild.getHeight() || noExpandedChild) {
|
||||
if (noExpandedChild || (viewHeight <= mContractedChild.getHeight()
|
||||
&& (!mIsChildInGroup || !mContainingNotification.isExpanded()))) {
|
||||
return VISIBLE_TYPE_CONTRACTED;
|
||||
} else {
|
||||
return VISIBLE_TYPE_EXPANDED;
|
||||
@@ -569,6 +572,9 @@ public class NotificationContentView extends FrameLayout {
|
||||
if (mIsChildInGroup) {
|
||||
mSingleLineView = mHybridViewManager.bindFromNotification(
|
||||
mSingleLineView, mStatusBarNotification.getNotification());
|
||||
} else if (mSingleLineView != null) {
|
||||
removeView(mSingleLineView);
|
||||
mSingleLineView = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -685,4 +691,12 @@ public class NotificationContentView extends FrameLayout {
|
||||
public void requestSelectLayout(boolean needsAnimation) {
|
||||
selectLayout(needsAnimation, false);
|
||||
}
|
||||
|
||||
public void reInflateViews() {
|
||||
if (mIsChildInGroup && mSingleLineView != null) {
|
||||
removeView(mSingleLineView);
|
||||
mSingleLineView = null;
|
||||
updateSingleLineView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,4 +45,10 @@ public class NotificationCustomViewWrapper extends NotificationViewWrapper {
|
||||
mInvertHelper.update(dark);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
super.setVisible(visible);
|
||||
mView.setAlpha(visible ? 1.0f : 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,6 +105,7 @@ public abstract class NotificationViewWrapper implements TransformableView {
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
mView.animate().cancel();
|
||||
mView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,14 +293,19 @@ public class TransformState {
|
||||
mTransformedView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
|
||||
mTransformedView.setAlpha(visible ? 1.0f : 0.0f);
|
||||
if (visible) {
|
||||
mTransformedView.setTranslationX(0);
|
||||
mTransformedView.setTranslationY(0);
|
||||
mTransformedView.setScaleX(1.0f);
|
||||
mTransformedView.setScaleY(1.0f);
|
||||
resetTransformedView();
|
||||
}
|
||||
}
|
||||
|
||||
public void prepareFadeIn() {
|
||||
resetTransformedView();
|
||||
}
|
||||
|
||||
private void resetTransformedView() {
|
||||
mTransformedView.setTranslationX(0);
|
||||
mTransformedView.setTranslationY(0);
|
||||
mTransformedView.setScaleX(1.0f);
|
||||
mTransformedView.setScaleY(1.0f);
|
||||
}
|
||||
|
||||
public static TransformState obtain() {
|
||||
|
||||
@@ -1511,8 +1511,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
|
||||
private void updateNotificationShadeForChildren() {
|
||||
// First let's remove all children which don't belong in the parents
|
||||
ArrayList<ExpandableNotificationRow> toRemove = new ArrayList<>();
|
||||
boolean orderChanged = false;
|
||||
for (int i = 0; i < mStackScroller.getChildCount(); i++) {
|
||||
View view = mStackScroller.getChildAt(i);
|
||||
if (!(view instanceof ExpandableNotificationRow)) {
|
||||
@@ -1524,7 +1524,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
List<ExpandableNotificationRow> children = parent.getNotificationChildren();
|
||||
List<ExpandableNotificationRow> orderedChildren = mTmpChildOrderMap.get(parent);
|
||||
|
||||
// lets first remove all undesired children
|
||||
if (children != null) {
|
||||
toRemove.clear();
|
||||
for (ExpandableNotificationRow childRow : children) {
|
||||
@@ -1537,8 +1536,21 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
mStackScroller.notifyGroupChildRemoved(remove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Let's now add all notification children which are missing
|
||||
boolean orderChanged = false;
|
||||
for (int i = 0; i < mStackScroller.getChildCount(); i++) {
|
||||
View view = mStackScroller.getChildAt(i);
|
||||
if (!(view instanceof ExpandableNotificationRow)) {
|
||||
// We don't care about non-notification views.
|
||||
continue;
|
||||
}
|
||||
|
||||
ExpandableNotificationRow parent = (ExpandableNotificationRow) view;
|
||||
List<ExpandableNotificationRow> children = parent.getNotificationChildren();
|
||||
List<ExpandableNotificationRow> orderedChildren = mTmpChildOrderMap.get(parent);
|
||||
|
||||
// We now add all the children which are not in there already
|
||||
for (int childIndex = 0; orderedChildren != null && childIndex < orderedChildren.size();
|
||||
childIndex++) {
|
||||
ExpandableNotificationRow childView = orderedChildren.get(childIndex);
|
||||
@@ -2249,7 +2261,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
|
||||
@Override
|
||||
public void maybeEscalateHeadsUp() {
|
||||
TreeSet<HeadsUpManager.HeadsUpEntry> entries = mHeadsUpManager.getSortedEntries();
|
||||
Collection<HeadsUpManager.HeadsUpEntry> entries = mHeadsUpManager.getAllEntries();
|
||||
for (HeadsUpManager.HeadsUpEntry entry : entries) {
|
||||
final StatusBarNotification sbn = entry.entry.notification;
|
||||
final Notification notification = sbn.getNotification();
|
||||
|
||||
@@ -39,10 +39,10 @@ import com.android.systemui.statusbar.phone.PhoneStatusBar;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Stack;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
* A manager which handles heads up notifications which is a special mode where
|
||||
@@ -90,7 +90,6 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
|
||||
private int mSnoozeLengthMs;
|
||||
private ContentObserver mSettingsObserver;
|
||||
private HashMap<String, HeadsUpEntry> mHeadsUpEntries = new HashMap<>();
|
||||
private TreeSet<HeadsUpEntry> mSortedEntries = new TreeSet<>();
|
||||
private HashSet<String> mSwipedOutKeys = new HashSet<>();
|
||||
private int mUser;
|
||||
private Clock mClock;
|
||||
@@ -230,7 +229,6 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
|
||||
|
||||
private void removeHeadsUpEntry(NotificationData.Entry entry) {
|
||||
HeadsUpEntry remove = mHeadsUpEntries.remove(entry.key);
|
||||
mSortedEntries.remove(remove);
|
||||
entry.row.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
|
||||
entry.row.setHeadsUp(false);
|
||||
setEntryPinned(remove, false /* isPinned */);
|
||||
@@ -345,12 +343,21 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
|
||||
return mHeadsUpEntries.get(key).entry;
|
||||
}
|
||||
|
||||
public TreeSet<HeadsUpEntry> getSortedEntries() {
|
||||
return mSortedEntries;
|
||||
public Collection<HeadsUpEntry> getAllEntries() {
|
||||
return mHeadsUpEntries.values();
|
||||
}
|
||||
|
||||
public HeadsUpEntry getTopEntry() {
|
||||
return mSortedEntries.isEmpty() ? null : mSortedEntries.first();
|
||||
if (mHeadsUpEntries.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
HeadsUpEntry topEntry = null;
|
||||
for (HeadsUpEntry entry: mHeadsUpEntries.values()) {
|
||||
if (topEntry == null || entry.compareTo(topEntry) == -1) {
|
||||
topEntry = entry;
|
||||
}
|
||||
}
|
||||
return topEntry;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -374,26 +381,18 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
|
||||
return;
|
||||
}
|
||||
if (mHasPinnedNotification) {
|
||||
int minX = 0;
|
||||
int maxX = 0;
|
||||
int maxY = 0;
|
||||
for (HeadsUpEntry entry : mSortedEntries) {
|
||||
ExpandableNotificationRow row = entry.entry.row;
|
||||
if (row.isPinned()) {
|
||||
if (row.isChildInGroup()) {
|
||||
final ExpandableNotificationRow groupSummary
|
||||
= mGroupManager.getGroupSummary(row.getStatusBarNotification());
|
||||
if (groupSummary != null) {
|
||||
row = groupSummary;
|
||||
}
|
||||
}
|
||||
row.getLocationOnScreen(mTmpTwoArray);
|
||||
minX = mTmpTwoArray[0];
|
||||
maxX = mTmpTwoArray[0] + row.getWidth();
|
||||
maxY = row.getIntrinsicHeight();
|
||||
break;
|
||||
ExpandableNotificationRow topEntry = getTopEntry().entry.row;
|
||||
if (topEntry.isChildInGroup()) {
|
||||
final ExpandableNotificationRow groupSummary
|
||||
= mGroupManager.getGroupSummary(topEntry.getStatusBarNotification());
|
||||
if (groupSummary != null) {
|
||||
topEntry = groupSummary;
|
||||
}
|
||||
}
|
||||
topEntry.getLocationOnScreen(mTmpTwoArray);
|
||||
int minX = mTmpTwoArray[0];
|
||||
int maxX = mTmpTwoArray[0] + topEntry.getWidth();
|
||||
int maxY = topEntry.getIntrinsicHeight();
|
||||
|
||||
info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
|
||||
info.touchableRegion.set(minX, 0, maxX, maxY);
|
||||
@@ -413,7 +412,7 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
|
||||
pw.print(" mSnoozeLengthMs="); pw.println(mSnoozeLengthMs);
|
||||
pw.print(" now="); pw.println(SystemClock.elapsedRealtime());
|
||||
pw.print(" mUser="); pw.println(mUser);
|
||||
for (HeadsUpEntry entry: mSortedEntries) {
|
||||
for (HeadsUpEntry entry: mHeadsUpEntries.values()) {
|
||||
pw.print(" HeadsUpEntry="); pw.println(entry.entry);
|
||||
}
|
||||
int N = mSnoozedPackages.size();
|
||||
@@ -633,7 +632,6 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
|
||||
}
|
||||
|
||||
public void updateEntry(boolean updatePostTime) {
|
||||
mSortedEntries.remove(HeadsUpEntry.this);
|
||||
long currentTime = mClock.currentTimeMillis();
|
||||
earliestRemovaltime = currentTime + mMinimumDisplayTime;
|
||||
if (updatePostTime) {
|
||||
@@ -648,7 +646,6 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
|
||||
long removeDelay = Math.max(finishTime - currentTime, mMinimumDisplayTime);
|
||||
mHandler.postDelayed(mRemoveHeadsUpRunnable, removeDelay);
|
||||
}
|
||||
mSortedEntries.add(HeadsUpEntry.this);
|
||||
}
|
||||
|
||||
private boolean isSticky() {
|
||||
@@ -658,6 +655,13 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
|
||||
|
||||
@Override
|
||||
public int compareTo(HeadsUpEntry o) {
|
||||
boolean isPinned = entry.row.isPinned();
|
||||
boolean otherPinned = o.entry.row.isPinned();
|
||||
if (isPinned && !otherPinned) {
|
||||
return -1;
|
||||
} else if (!isPinned && otherPinned) {
|
||||
return 1;
|
||||
}
|
||||
boolean selfFullscreen = hasFullScreenIntent(entry);
|
||||
boolean otherFullscreen = hasFullScreenIntent(o.entry);
|
||||
if (selfFullscreen && !otherFullscreen) {
|
||||
|
||||
Reference in New Issue
Block a user