Hiding replied notification icons from AOD
Previously we would only hide them from the statusbar, but not from AOD. Test: add notification, reply, observe no icon on AOD Change-Id: I10a2aeb1a94aa101f055fbdc2b611477fbe1ac1b Fixes: 78486801
This commit is contained in:
@@ -47,6 +47,8 @@ public class NotificationIconAreaController implements DarkReceiver {
|
||||
private final Rect mTintArea = new Rect();
|
||||
private NotificationStackScrollLayout mNotificationScrollLayout;
|
||||
private Context mContext;
|
||||
private boolean mFullyDark;
|
||||
private boolean mHasShelfIconsWhenFullyDark;
|
||||
|
||||
public NotificationIconAreaController(Context context, StatusBar statusBar) {
|
||||
mStatusBar = statusBar;
|
||||
@@ -173,13 +175,40 @@ public class NotificationIconAreaController implements DarkReceiver {
|
||||
public void updateNotificationIcons() {
|
||||
|
||||
updateStatusBarIcons();
|
||||
updateIconsForLayout(entry -> entry.expandedIcon, mShelfIcons,
|
||||
NotificationShelf.SHOW_AMBIENT_ICONS, false /* hideDismissed */,
|
||||
false /* hideRepliedMessages */);
|
||||
updateShelfIcons();
|
||||
updateHasShelfIconsWhenFullyDark();
|
||||
|
||||
applyNotificationIconsTint();
|
||||
}
|
||||
|
||||
private void updateHasShelfIconsWhenFullyDark() {
|
||||
boolean hasIconsWhenFullyDark = false;
|
||||
for (int i = 0; i < mNotificationScrollLayout.getChildCount(); i++) {
|
||||
View view = mNotificationScrollLayout.getChildAt(i);
|
||||
if (view instanceof ExpandableNotificationRow) {
|
||||
NotificationData.Entry ent = ((ExpandableNotificationRow) view).getEntry();
|
||||
if (shouldShowNotificationIcon(ent,
|
||||
NotificationShelf.SHOW_AMBIENT_ICONS /* showAmbient */,
|
||||
false /* hideDismissed */,
|
||||
true /* hideReplied */)) {
|
||||
hasIconsWhenFullyDark = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
mHasShelfIconsWhenFullyDark = hasIconsWhenFullyDark;
|
||||
}
|
||||
|
||||
public boolean hasShelfIconsWhenFullyDark() {
|
||||
return mHasShelfIconsWhenFullyDark;
|
||||
}
|
||||
|
||||
private void updateShelfIcons() {
|
||||
updateIconsForLayout(entry -> entry.expandedIcon, mShelfIcons,
|
||||
NotificationShelf.SHOW_AMBIENT_ICONS, false /* hideDismissed */,
|
||||
mFullyDark /* hideRepliedMessages */);
|
||||
}
|
||||
|
||||
public void updateStatusBarIcons() {
|
||||
updateIconsForLayout(entry -> entry.icon, mNotificationIcons,
|
||||
false /* showAmbient */, true /* hideDismissed */, true /* hideRepliedMessages */);
|
||||
@@ -320,6 +349,11 @@ public class NotificationIconAreaController implements DarkReceiver {
|
||||
v.setDecorColor(mIconTint);
|
||||
}
|
||||
|
||||
public void setFullyDark(boolean fullyDark) {
|
||||
mFullyDark = fullyDark;
|
||||
updateShelfIcons();
|
||||
}
|
||||
|
||||
public void setDark(boolean dark) {
|
||||
mNotificationIcons.setDark(dark, false, 0);
|
||||
mShelfIcons.setDark(dark, false, 0);
|
||||
|
||||
@@ -823,6 +823,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
.createNotificationIconAreaController(context, this);
|
||||
inflateShelf();
|
||||
mNotificationIconAreaController.setupShelf(mNotificationShelf);
|
||||
mStackScroller.setIconAreaController(mNotificationIconAreaController);
|
||||
Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mNotificationIconAreaController);
|
||||
FragmentHostManager.get(mStatusBarWindow)
|
||||
.addTagListener(CollapsedStatusBarFragment.TAG, (tag, fragment) -> {
|
||||
|
||||
@@ -101,6 +101,7 @@ import com.android.systemui.statusbar.phone.DozeParameters;
|
||||
import com.android.systemui.statusbar.phone.HeadsUpAppearanceController;
|
||||
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
|
||||
import com.android.systemui.statusbar.phone.NotificationGroupManager;
|
||||
import com.android.systemui.statusbar.phone.NotificationIconAreaController;
|
||||
import com.android.systemui.statusbar.phone.ScrimController;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
import com.android.systemui.statusbar.policy.HeadsUpUtil;
|
||||
@@ -416,6 +417,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
private ArrayList<BiConsumer<Float, Float>> mExpandedHeightListeners = new ArrayList<>();
|
||||
private int mHeadsUpInset;
|
||||
private HeadsUpAppearanceController mHeadsUpAppearanceController;
|
||||
private NotificationIconAreaController mIconAreaController;
|
||||
|
||||
public NotificationStackScrollLayout(Context context) {
|
||||
this(context, null);
|
||||
@@ -532,10 +534,16 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
final int lockScreenRight = getWidth() - mSidePaddings;
|
||||
final int lockScreenTop = mCurrentBounds.top;
|
||||
final int lockScreenBottom = mCurrentBounds.bottom;
|
||||
final int darkLeft = getWidth() / 2 - mSeparatorWidth / 2;
|
||||
final int darkRight = darkLeft + mSeparatorWidth;
|
||||
final int darkTop = (int) (mRegularTopPadding + mSeparatorThickness / 2f);
|
||||
final int darkBottom = darkTop + mSeparatorThickness;
|
||||
int separatorWidth = 0;
|
||||
int separatorThickness = 0;
|
||||
if (mIconAreaController.hasShelfIconsWhenFullyDark()) {
|
||||
separatorThickness = mSeparatorThickness;
|
||||
separatorWidth = mSeparatorWidth;
|
||||
}
|
||||
final int darkLeft = getWidth() / 2 - separatorWidth / 2;
|
||||
final int darkRight = darkLeft + separatorWidth;
|
||||
final int darkTop = (int) (mRegularTopPadding + separatorThickness / 2f);
|
||||
final int darkBottom = darkTop + separatorThickness;
|
||||
|
||||
if (mAmbientState.hasPulsingNotifications()) {
|
||||
// No divider, we have a notification icon instead
|
||||
@@ -4011,12 +4019,16 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
mDarkAmount = darkAmount;
|
||||
boolean wasFullyDark = mAmbientState.isFullyDark();
|
||||
mAmbientState.setDarkAmount(darkAmount);
|
||||
if (mAmbientState.isFullyDark() != wasFullyDark) {
|
||||
boolean nowFullyDark = mAmbientState.isFullyDark();
|
||||
if (nowFullyDark != wasFullyDark) {
|
||||
updateContentHeight();
|
||||
DozeParameters dozeParameters = DozeParameters.getInstance(mContext);
|
||||
if (mAmbientState.isFullyDark() && dozeParameters.shouldControlScreenOff()) {
|
||||
if (nowFullyDark && dozeParameters.shouldControlScreenOff()) {
|
||||
mShelf.fadeInTranslating();
|
||||
}
|
||||
if (mIconAreaController != null) {
|
||||
mIconAreaController.setFullyDark(nowFullyDark);
|
||||
}
|
||||
}
|
||||
updateAlgorithmHeightAndPadding();
|
||||
updateBackgroundDimming();
|
||||
@@ -4618,6 +4630,10 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
mHeadsUpAppearanceController = headsUpAppearanceController;
|
||||
}
|
||||
|
||||
public void setIconAreaController(NotificationIconAreaController controller) {
|
||||
mIconAreaController = controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* A listener that is notified when the empty space below the notifications is clicked on
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user