diff --git a/packages/SystemUI/res-keyguard/color/notification_background_dimmed_color.xml b/packages/SystemUI/res-keyguard/color/notification_background_dimmed_color.xml deleted file mode 100644 index 3345e6e42500f..0000000000000 --- a/packages/SystemUI/res-keyguard/color/notification_background_dimmed_color.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - \ No newline at end of file diff --git a/packages/SystemUI/res/drawable/notification_material_bg_dim.xml b/packages/SystemUI/res/drawable/notification_material_bg_dim.xml deleted file mode 100644 index 1127d3c247fd2..0000000000000 --- a/packages/SystemUI/res/drawable/notification_material_bg_dim.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - diff --git a/packages/SystemUI/res/layout/status_bar_notification_shelf.xml b/packages/SystemUI/res/layout/status_bar_notification_shelf.xml index 781c015b2bdcd..87a1bbb2aa5c5 100644 --- a/packages/SystemUI/res/layout/status_bar_notification_shelf.xml +++ b/packages/SystemUI/res/layout/status_bar_notification_shelf.xml @@ -27,10 +27,6 @@ android:id="@+id/backgroundNormal" android:layout_width="match_parent" android:layout_height="match_parent" /> - { - float animatedFraction = animation.getAnimatedFraction(); - if (reverse) { - animatedFraction = 1.0f - animatedFraction; - } - setNormalBackgroundVisibilityAmount(animatedFraction); - }) - .setDuration(ACTIVATE_ANIMATION_LENGTH); - } - /** * Cancels the hotspot and makes the notification inactive. */ public void makeInactive(boolean animate) { if (mActivated) { mActivated = false; - if (mDimmed) { - if (animate) { - startActivateAnimation(true /* reverse */); - } else { - updateBackground(); - } - } } if (mOnActivatedListener != null) { mOnActivatedListener.onActivationReset(this); } } - public void setDimmed(boolean dimmed, boolean fade) { - mNeedsDimming = dimmed; - if (mOnDimmedListener != null) { - mOnDimmedListener.onSetDimmed(dimmed); - } - dimmed &= isDimmable(); - if (mDimmed != dimmed) { - mDimmed = dimmed; - resetBackgroundAlpha(); - if (fade) { - fadeDimmedBackground(); - } else { - updateBackground(); - } - } - } - - public boolean isDimmable() { - return true; - } - - public boolean isDimmed() { - return mDimmed; - } - private void updateOutlineAlpha() { float alpha = NotificationStackScrollLayout.BACKGROUND_ALPHA_DIMMED; alpha = (alpha + (1.0f - alpha) * mNormalBackgroundVisibilityAmount); @@ -448,7 +327,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView public void setDistanceToTopRoundness(float distanceToTopRoundness) { super.setDistanceToTopRoundness(distanceToTopRoundness); mBackgroundNormal.setDistanceToTopRoundness(distanceToTopRoundness); - mBackgroundDimmed.setDistanceToTopRoundness(distanceToTopRoundness); } /** Sets whether this view is the last notification in a section. */ @@ -457,7 +335,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView if (lastInSection != mLastInSection) { super.setLastInSection(lastInSection); mBackgroundNormal.setLastInSection(lastInSection); - mBackgroundDimmed.setLastInSection(lastInSection); } } @@ -467,7 +344,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView if (firstInSection != mFirstInSection) { super.setFirstInSection(firstInSection); mBackgroundNormal.setFirstInSection(firstInSection); - mBackgroundDimmed.setFirstInSection(firstInSection); } } @@ -486,13 +362,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView mOverrideAmount = overrideAmount; int newColor = calculateBgColor(); setBackgroundTintColor(newColor); - if (!isDimmable() && mNeedsDimming) { - mBackgroundNormal.setDrawableAlpha((int) NotificationUtils.interpolate(255, - mDimmedAlpha, - overrideAmount)); - } else { - mBackgroundNormal.setDrawableAlpha(255); - } } protected void updateBackgroundTint() { @@ -504,7 +373,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView mBackgroundColorAnimator.cancel(); } int rippleColor = getRippleColor(); - mBackgroundDimmed.setRippleColor(rippleColor); mBackgroundNormal.setRippleColor(rippleColor); int color = calculateBgColor(); if (!animated) { @@ -537,110 +405,12 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView // We don't need to tint a normal notification color = 0; } - mBackgroundDimmed.setTint(color); mBackgroundNormal.setTint(color); } } - /** - * Fades the background when the dimmed state changes. - */ - private void fadeDimmedBackground() { - mBackgroundDimmed.animate().cancel(); - mBackgroundNormal.animate().cancel(); - if (mActivated) { - updateBackground(); - return; - } - if (!shouldHideBackground()) { - if (mDimmed) { - mBackgroundDimmed.setVisibility(View.VISIBLE); - } else { - mBackgroundNormal.setVisibility(View.VISIBLE); - } - } - float startAlpha = mDimmed ? 1f : 0; - float endAlpha = mDimmed ? 0 : 1f; - int duration = BACKGROUND_ANIMATION_LENGTH_MS; - // Check whether there is already a background animation running. - if (mBackgroundAnimator != null) { - startAlpha = (Float) mBackgroundAnimator.getAnimatedValue(); - duration = (int) mBackgroundAnimator.getCurrentPlayTime(); - mBackgroundAnimator.removeAllListeners(); - mBackgroundAnimator.cancel(); - if (duration <= 0) { - updateBackground(); - return; - } - } - mBackgroundNormal.setAlpha(startAlpha); - mBackgroundAnimator = - ObjectAnimator.ofFloat(mBackgroundNormal, View.ALPHA, startAlpha, endAlpha); - mBackgroundAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN); - mBackgroundAnimator.setDuration(duration); - mBackgroundAnimator.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - updateBackground(); - mBackgroundAnimator = null; - mDimmedBackgroundFadeInAmount = -1; - } - }); - mBackgroundAnimator.addUpdateListener(mBackgroundVisibilityUpdater); - mBackgroundAnimator.start(); - } - - protected void updateBackgroundAlpha(float transformationAmount) { - float bgAlpha = isChildInGroup() && mDimmed ? transformationAmount : 1f; - if (mDimmedBackgroundFadeInAmount != -1) { - bgAlpha *= mDimmedBackgroundFadeInAmount; - } - mBackgroundDimmed.setAlpha(bgAlpha); - } - - protected void resetBackgroundAlpha() { - updateBackgroundAlpha(0f /* transformationAmount */); - } - - protected void updateBackground() { - cancelFadeAnimations(); - if (shouldHideBackground()) { - mBackgroundDimmed.setVisibility(INVISIBLE); - mBackgroundNormal.setVisibility(mActivated ? VISIBLE : INVISIBLE); - } else if (mDimmed) { - // When groups are animating to the expanded state from the lockscreen, show the - // normal background instead of the dimmed background. - final boolean dontShowDimmed = isGroupExpansionChanging() && isChildInGroup(); - mBackgroundDimmed.setVisibility(dontShowDimmed ? View.INVISIBLE : View.VISIBLE); - mBackgroundNormal.setVisibility((mActivated || dontShowDimmed) - ? View.VISIBLE - : View.INVISIBLE); - } else { - mBackgroundDimmed.setVisibility(View.INVISIBLE); - mBackgroundNormal.setVisibility(View.VISIBLE); - mBackgroundNormal.setAlpha(1f); - // make in inactive to avoid it sticking around active - makeInactive(false /* animate */); - } - setNormalBackgroundVisibilityAmount( - mBackgroundNormal.getVisibility() == View.VISIBLE ? 1.0f : 0.0f); - } - protected void updateBackgroundClipping() { mBackgroundNormal.setBottomAmountClips(!isChildInGroup()); - mBackgroundDimmed.setBottomAmountClips(!isChildInGroup()); - } - - protected boolean shouldHideBackground() { - return false; - } - - private void cancelFadeAnimations() { - if (mBackgroundAnimator != null) { - mBackgroundAnimator.cancel(); - } - mBackgroundDimmed.animate().cancel(); - mBackgroundNormal.animate().cancel(); } @Override @@ -654,21 +424,18 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView super.setActualHeight(actualHeight, notifyListeners); setPivotY(actualHeight / 2); mBackgroundNormal.setActualHeight(actualHeight); - mBackgroundDimmed.setActualHeight(actualHeight); } @Override public void setClipTopAmount(int clipTopAmount) { super.setClipTopAmount(clipTopAmount); mBackgroundNormal.setClipTopAmount(clipTopAmount); - mBackgroundDimmed.setClipTopAmount(clipTopAmount); } @Override public void setClipBottomAmount(int clipBottomAmount) { super.setClipBottomAmount(clipBottomAmount); mBackgroundNormal.setClipBottomAmount(clipBottomAmount); - mBackgroundDimmed.setClipBottomAmount(clipBottomAmount); } @Override @@ -891,13 +658,11 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView } private void applyBackgroundRoundness(float topRadius, float bottomRadius) { - mBackgroundDimmed.setRadius(topRadius, bottomRadius); mBackgroundNormal.setRadius(topRadius, bottomRadius); } @Override protected void setBackgroundTop(int backgroundTop) { - mBackgroundDimmed.setBackgroundTop(backgroundTop); mBackgroundNormal.setBackgroundTop(backgroundTop); } @@ -1033,10 +798,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView mTouchHandler = touchHandler; } - void setOnDimmedListener(OnDimmedListener onDimmedListener) { - mOnDimmedListener = onDimmedListener; - } - public void setAccessibilityManager(AccessibilityManager accessibilityManager) { mAccessibilityManager = accessibilityManager; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewController.java index edd97afce2cae..0a63e19acc1ac 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewController.java @@ -85,7 +85,6 @@ public class ActivatableNotificationViewController mExpandableOutlineViewController.init(); mView.setOnTouchListener(mTouchHandler); mView.setTouchHandler(mTouchHandler); - mView.setOnDimmedListener(dimmed -> mNeedsDimming = dimmed); mView.setAccessibilityManager(mAccessibilityManager); } @@ -116,14 +115,8 @@ public class ActivatableNotificationViewController if (mAccessibilityManager.isTouchExplorationEnabled()) { return false; } - if (mNeedsDimming && mView.isInteractive()) { - if (mNeedsDimming && !mView.isDimmed()) { - // We're actually dimmed, but our content isn't dimmable, - // let's ensure we have a ripple - return false; - } - result = mNotificationTapHelper.onTouchEvent(ev, mView.getActualHeight()); - } else if (ev.getAction() == MotionEvent.ACTION_UP) { + + if (ev.getAction() == MotionEvent.ACTION_UP) { // If this is a false tap, capture the even so it doesn't result in a click. return mFalsingManager.isFalseTap(FalsingManager.LOW_PENALTY); } @@ -132,17 +125,6 @@ public class ActivatableNotificationViewController @Override public boolean onInterceptTouchEvent(MotionEvent ev) { - if (mNeedsDimming && ev.getActionMasked() == MotionEvent.ACTION_DOWN - && mView.disallowSingleClick(ev) - && !mAccessibilityManager.isTouchExplorationEnabled()) { - if (!mView.isActive()) { - return true; - } else if (mFalsingManager.isFalseDoubleTap()) { - mBlockNextTouch = true; - mView.makeInactive(true /* animate */); - return true; - } - } return false; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index 500838fac5f98..4e943746f8aaf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -630,17 +630,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mSecureStateProvider = secureStateProvider; } - @Override - public boolean isDimmable() { - if (!getShowingLayout().isDimmable()) { - return false; - } - if (showingPulsing()) { - return false; - } - return super.isDimmable(); - } - private void updateLimits() { for (NotificationContentView l : mLayouts) { updateLimitsForView(l); @@ -853,7 +842,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mNotificationParent = isChildInGroup ? parent : null; mPrivateLayout.setIsChildInGroup(isChildInGroup); - resetBackgroundAlpha(); updateBackgroundForGroupState(); updateClickAndFocus(); if (mNotificationParent != null) { @@ -894,11 +882,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView return false; } - @Override - protected boolean shouldHideBackground() { - return super.shouldHideBackground() || mShowNoBackground; - } - @Override public boolean isSummaryWithChildren() { return mIsSummaryWithChildren; @@ -2873,7 +2856,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mShowNoBackground = false; } updateOutline(); - updateBackground(); } public int getPositionOfChild(ExpandableNotificationRow childRow) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java index a0b0b3dc57bd6..b8447e7dd7263 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java @@ -693,7 +693,6 @@ public class NotificationContentView extends FrameLayout { endColor = NotificationUtils.interpolateColors(startColor, endColor, transformationAmount); } - mContainingNotification.updateBackgroundAlpha(transformationAmount); mContainingNotification.setContentBackground(endColor, false, this); } @@ -868,7 +867,6 @@ public class NotificationContentView extends FrameLayout { public void updateBackgroundColor(boolean animate) { int customBackgroundColor = getBackgroundColor(mVisibleType); - mContainingNotification.resetBackgroundAlpha(); mContainingNotification.setContentBackground(customBackgroundColor, animate, this); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java index 41835082d7068..94e273b1965a3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.notification.row; -import static org.mockito.ArgumentMatchers.anyFloat; -import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; @@ -57,7 +55,6 @@ public class NotificationContentViewTest extends SysuiTestCase { mView = new NotificationContentView(mContext, null); ExpandableNotificationRow row = new ExpandableNotificationRow(mContext, null); ExpandableNotificationRow mockRow = spy(row); - doNothing().when(mockRow).updateBackgroundAlpha(anyFloat()); doReturn(10).when(mockRow).getIntrinsicHeight(); mView.setContainingNotification(mockRow);