Merge "Hiding replied notification icons from AOD" into pi-dev
This commit is contained in:
@@ -47,6 +47,8 @@ public class NotificationIconAreaController implements DarkReceiver {
|
|||||||
private final Rect mTintArea = new Rect();
|
private final Rect mTintArea = new Rect();
|
||||||
private NotificationStackScrollLayout mNotificationScrollLayout;
|
private NotificationStackScrollLayout mNotificationScrollLayout;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
private boolean mFullyDark;
|
||||||
|
private boolean mHasShelfIconsWhenFullyDark;
|
||||||
|
|
||||||
public NotificationIconAreaController(Context context, StatusBar statusBar) {
|
public NotificationIconAreaController(Context context, StatusBar statusBar) {
|
||||||
mStatusBar = statusBar;
|
mStatusBar = statusBar;
|
||||||
@@ -173,13 +175,40 @@ public class NotificationIconAreaController implements DarkReceiver {
|
|||||||
public void updateNotificationIcons() {
|
public void updateNotificationIcons() {
|
||||||
|
|
||||||
updateStatusBarIcons();
|
updateStatusBarIcons();
|
||||||
updateIconsForLayout(entry -> entry.expandedIcon, mShelfIcons,
|
updateShelfIcons();
|
||||||
NotificationShelf.SHOW_AMBIENT_ICONS, false /* hideDismissed */,
|
updateHasShelfIconsWhenFullyDark();
|
||||||
false /* hideRepliedMessages */);
|
|
||||||
|
|
||||||
applyNotificationIconsTint();
|
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() {
|
public void updateStatusBarIcons() {
|
||||||
updateIconsForLayout(entry -> entry.icon, mNotificationIcons,
|
updateIconsForLayout(entry -> entry.icon, mNotificationIcons,
|
||||||
false /* showAmbient */, true /* hideDismissed */, true /* hideRepliedMessages */);
|
false /* showAmbient */, true /* hideDismissed */, true /* hideRepliedMessages */);
|
||||||
@@ -320,6 +349,11 @@ public class NotificationIconAreaController implements DarkReceiver {
|
|||||||
v.setDecorColor(mIconTint);
|
v.setDecorColor(mIconTint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFullyDark(boolean fullyDark) {
|
||||||
|
mFullyDark = fullyDark;
|
||||||
|
updateShelfIcons();
|
||||||
|
}
|
||||||
|
|
||||||
public void setDark(boolean dark) {
|
public void setDark(boolean dark) {
|
||||||
mNotificationIcons.setDark(dark, false, 0);
|
mNotificationIcons.setDark(dark, false, 0);
|
||||||
mShelfIcons.setDark(dark, false, 0);
|
mShelfIcons.setDark(dark, false, 0);
|
||||||
|
|||||||
@@ -829,6 +829,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
.createNotificationIconAreaController(context, this);
|
.createNotificationIconAreaController(context, this);
|
||||||
inflateShelf();
|
inflateShelf();
|
||||||
mNotificationIconAreaController.setupShelf(mNotificationShelf);
|
mNotificationIconAreaController.setupShelf(mNotificationShelf);
|
||||||
|
mStackScroller.setIconAreaController(mNotificationIconAreaController);
|
||||||
Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mNotificationIconAreaController);
|
Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mNotificationIconAreaController);
|
||||||
FragmentHostManager.get(mStatusBarWindow)
|
FragmentHostManager.get(mStatusBarWindow)
|
||||||
.addTagListener(CollapsedStatusBarFragment.TAG, (tag, fragment) -> {
|
.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.HeadsUpAppearanceController;
|
||||||
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
|
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
|
||||||
import com.android.systemui.statusbar.phone.NotificationGroupManager;
|
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.ScrimController;
|
||||||
import com.android.systemui.statusbar.phone.StatusBar;
|
import com.android.systemui.statusbar.phone.StatusBar;
|
||||||
import com.android.systemui.statusbar.policy.HeadsUpUtil;
|
import com.android.systemui.statusbar.policy.HeadsUpUtil;
|
||||||
@@ -420,6 +421,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
private ArrayList<BiConsumer<Float, Float>> mExpandedHeightListeners = new ArrayList<>();
|
private ArrayList<BiConsumer<Float, Float>> mExpandedHeightListeners = new ArrayList<>();
|
||||||
private int mHeadsUpInset;
|
private int mHeadsUpInset;
|
||||||
private HeadsUpAppearanceController mHeadsUpAppearanceController;
|
private HeadsUpAppearanceController mHeadsUpAppearanceController;
|
||||||
|
private NotificationIconAreaController mIconAreaController;
|
||||||
|
|
||||||
public NotificationStackScrollLayout(Context context) {
|
public NotificationStackScrollLayout(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -536,10 +538,16 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
final int lockScreenRight = getWidth() - mSidePaddings;
|
final int lockScreenRight = getWidth() - mSidePaddings;
|
||||||
final int lockScreenTop = mCurrentBounds.top;
|
final int lockScreenTop = mCurrentBounds.top;
|
||||||
final int lockScreenBottom = mCurrentBounds.bottom;
|
final int lockScreenBottom = mCurrentBounds.bottom;
|
||||||
final int darkLeft = getWidth() / 2 - mSeparatorWidth / 2;
|
int separatorWidth = 0;
|
||||||
final int darkRight = darkLeft + mSeparatorWidth;
|
int separatorThickness = 0;
|
||||||
final int darkTop = (int) (mRegularTopPadding + mSeparatorThickness / 2f);
|
if (mIconAreaController.hasShelfIconsWhenFullyDark()) {
|
||||||
final int darkBottom = darkTop + mSeparatorThickness;
|
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()) {
|
if (mAmbientState.hasPulsingNotifications()) {
|
||||||
// No divider, we have a notification icon instead
|
// No divider, we have a notification icon instead
|
||||||
@@ -4015,12 +4023,16 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
mDarkAmount = darkAmount;
|
mDarkAmount = darkAmount;
|
||||||
boolean wasFullyDark = mAmbientState.isFullyDark();
|
boolean wasFullyDark = mAmbientState.isFullyDark();
|
||||||
mAmbientState.setDarkAmount(darkAmount);
|
mAmbientState.setDarkAmount(darkAmount);
|
||||||
if (mAmbientState.isFullyDark() != wasFullyDark) {
|
boolean nowFullyDark = mAmbientState.isFullyDark();
|
||||||
|
if (nowFullyDark != wasFullyDark) {
|
||||||
updateContentHeight();
|
updateContentHeight();
|
||||||
DozeParameters dozeParameters = DozeParameters.getInstance(mContext);
|
DozeParameters dozeParameters = DozeParameters.getInstance(mContext);
|
||||||
if (mAmbientState.isFullyDark() && dozeParameters.shouldControlScreenOff()) {
|
if (nowFullyDark && dozeParameters.shouldControlScreenOff()) {
|
||||||
mShelf.fadeInTranslating();
|
mShelf.fadeInTranslating();
|
||||||
}
|
}
|
||||||
|
if (mIconAreaController != null) {
|
||||||
|
mIconAreaController.setFullyDark(nowFullyDark);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
updateAlgorithmHeightAndPadding();
|
updateAlgorithmHeightAndPadding();
|
||||||
updateBackgroundDimming();
|
updateBackgroundDimming();
|
||||||
@@ -4638,6 +4650,10 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
mHeadsUpAppearanceController = headsUpAppearanceController;
|
mHeadsUpAppearanceController = headsUpAppearanceController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIconAreaController(NotificationIconAreaController controller) {
|
||||||
|
mIconAreaController = controller;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A listener that is notified when the empty space below the notifications is clicked on
|
* A listener that is notified when the empty space below the notifications is clicked on
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user