diff options
| author | 2025-01-15 02:32:40 -0800 | |
|---|---|---|
| committer | 2025-01-15 02:32:40 -0800 | |
| commit | d2d5c500b8e385e73836ba1900f8b85f7cf4e89e (patch) | |
| tree | 26c0fa3720678a4ef396cd213be901648ac68c86 | |
| parent | 9eac7e0faac7e6acf618a50762c0088649442076 (diff) | |
| parent | ecdcc734116948a518f0567903017cf1925d9578 (diff) | |
Merge "Remove obsolete increased heights" into main
15 files changed, 77 insertions, 363 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 3c37b449c3a8..93d751cb9402 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -6627,7 +6627,20 @@ public class Notification implements Parcelable */ @Deprecated public RemoteViews createContentView() { - return createContentView(false /* increasedheight */ ); + if (useExistingRemoteView(mN.contentView)) { + return fullyCustomViewRequiresDecoration(false /* fromStyle */) + ? minimallyDecoratedContentView(mN.contentView) : mN.contentView; + } else if (mStyle != null) { + final RemoteViews styleView = mStyle.makeContentView(); + if (styleView != null) { + return fullyCustomViewRequiresDecoration(true /* fromStyle */) + ? minimallyDecoratedContentView(styleView) : styleView; + } + } + StandardTemplateParams p = mParams.reset() + .viewType(StandardTemplateParams.VIEW_TYPE_NORMAL) + .fillTextsFrom(this); + return applyStandardTemplate(getCollapsedBaseLayoutResource(), p, null /* result */); } // This code is executed on behalf of other apps' notifications, sometimes even by 3p apps, @@ -6688,33 +6701,6 @@ public class Notification implements Parcelable return standard; } - /** - * Construct a RemoteViews for the smaller content view. - * - * @param increasedHeight true if this layout be created with an increased height. Some - * styles may support showing more then just that basic 1U size - * and the system may decide to render important notifications - * slightly bigger even when collapsed. - * - * @hide - */ - public RemoteViews createContentView(boolean increasedHeight) { - if (useExistingRemoteView(mN.contentView)) { - return fullyCustomViewRequiresDecoration(false /* fromStyle */) - ? minimallyDecoratedContentView(mN.contentView) : mN.contentView; - } else if (mStyle != null) { - final RemoteViews styleView = mStyle.makeContentView(increasedHeight); - if (styleView != null) { - return fullyCustomViewRequiresDecoration(true /* fromStyle */) - ? minimallyDecoratedContentView(styleView) : styleView; - } - } - StandardTemplateParams p = mParams.reset() - .viewType(StandardTemplateParams.VIEW_TYPE_NORMAL) - .fillTextsFrom(this); - return applyStandardTemplate(getCollapsedBaseLayoutResource(), p, null /* result */); - } - private boolean useExistingRemoteView(RemoteViews customContent) { if (customContent == null) { return false; @@ -6850,48 +6836,13 @@ public class Notification implements Parcelable } /** - * Construct a RemoteViews for the final heads-up notification layout. - * - * @param increasedHeight true if this layout be created with an increased height. Some - * styles may support showing more then just that basic 1U size - * and the system may decide to render important notifications - * slightly bigger even when collapsed. - * - * @hide - */ - public RemoteViews createHeadsUpContentView(boolean increasedHeight) { - if (useExistingRemoteView(mN.headsUpContentView)) { - return fullyCustomViewRequiresDecoration(false /* fromStyle */) - ? minimallyDecoratedHeadsUpContentView(mN.headsUpContentView) - : mN.headsUpContentView; - } else if (mStyle != null) { - final RemoteViews styleView = mStyle.makeHeadsUpContentView(increasedHeight); - if (styleView != null) { - return fullyCustomViewRequiresDecoration(true /* fromStyle */) - ? minimallyDecoratedHeadsUpContentView(styleView) : styleView; - } - } else if (mActions.size() == 0) { - return null; - } - - // We only want at most a single remote input history to be shown here, otherwise - // the content would become squished. - StandardTemplateParams p = mParams.reset() - .viewType(StandardTemplateParams.VIEW_TYPE_HEADS_UP) - .fillTextsFrom(this) - .setMaxRemoteInputHistory(1); - return applyStandardTemplateWithActions(getHeadsUpBaseLayoutResource(), p, - null /* result */); - } - - /** * Construct a RemoteViews for the final compact heads-up notification layout. * @hide */ public RemoteViews createCompactHeadsUpContentView() { // Don't show compact heads up for FSI notifications. if (mN.fullScreenIntent != null) { - return createHeadsUpContentView(/* increasedHeight= */ false); + return createHeadsUpContentView(); } if (mStyle != null) { @@ -6929,7 +6880,28 @@ public class Notification implements Parcelable */ @Deprecated public RemoteViews createHeadsUpContentView() { - return createHeadsUpContentView(false /* useIncreasedHeight */); + if (useExistingRemoteView(mN.headsUpContentView)) { + return fullyCustomViewRequiresDecoration(false /* fromStyle */) + ? minimallyDecoratedHeadsUpContentView(mN.headsUpContentView) + : mN.headsUpContentView; + } else if (mStyle != null) { + final RemoteViews styleView = mStyle.makeHeadsUpContentView(); + if (styleView != null) { + return fullyCustomViewRequiresDecoration(true /* fromStyle */) + ? minimallyDecoratedHeadsUpContentView(styleView) : styleView; + } + } else if (mActions.size() == 0) { + return null; + } + + // We only want at most a single remote input history to be shown here, otherwise + // the content would become squished. + StandardTemplateParams p = mParams.reset() + .viewType(StandardTemplateParams.VIEW_TYPE_HEADS_UP) + .fillTextsFrom(this) + .setMaxRemoteInputHistory(1); + return applyStandardTemplateWithActions(getHeadsUpBaseLayoutResource(), p, + null /* result */); } /** @@ -8236,10 +8208,9 @@ public class Notification implements Parcelable * Construct a Style-specific RemoteViews for the collapsed notification layout. * The default implementation has nothing additional to add. * - * @param increasedHeight true if this layout be created with an increased height. * @hide */ - public RemoteViews makeContentView(boolean increasedHeight) { + public RemoteViews makeContentView() { return null; } @@ -8254,10 +8225,9 @@ public class Notification implements Parcelable /** * Construct a Style-specific RemoteViews for the final HUN layout. * - * @param increasedHeight true if this layout be created with an increased height. * @hide */ - public RemoteViews makeHeadsUpContentView(boolean increasedHeight) { + public RemoteViews makeHeadsUpContentView() { return null; } @@ -8543,9 +8513,9 @@ public class Notification implements Parcelable * @hide */ @Override - public RemoteViews makeContentView(boolean increasedHeight) { + public RemoteViews makeContentView() { if (mPictureIcon == null || !mShowBigPictureWhenCollapsed) { - return super.makeContentView(increasedHeight); + return super.makeContentView(); } StandardTemplateParams p = mBuilder.mParams.reset() @@ -8559,9 +8529,9 @@ public class Notification implements Parcelable * @hide */ @Override - public RemoteViews makeHeadsUpContentView(boolean increasedHeight) { + public RemoteViews makeHeadsUpContentView() { if (mPictureIcon == null || !mShowBigPictureWhenCollapsed) { - return super.makeHeadsUpContentView(increasedHeight); + return super.makeHeadsUpContentView(); } StandardTemplateParams p = mBuilder.mParams.reset() @@ -8792,35 +8762,6 @@ public class Notification implements Parcelable } /** - * @param increasedHeight true if this layout be created with an increased height. - * - * @hide - */ - @Override - public RemoteViews makeContentView(boolean increasedHeight) { - if (increasedHeight) { - ArrayList<Action> originalActions = mBuilder.mActions; - mBuilder.mActions = new ArrayList<>(); - RemoteViews remoteViews = makeExpandedContentView(); - mBuilder.mActions = originalActions; - return remoteViews; - } - return super.makeContentView(increasedHeight); - } - - /** - * @hide - */ - @Override - public RemoteViews makeHeadsUpContentView(boolean increasedHeight) { - if (increasedHeight && mBuilder.mActions.size() > 0) { - // TODO(b/163626038): pass VIEW_TYPE_HEADS_UP? - return makeExpandedContentView(); - } - return super.makeHeadsUpContentView(increasedHeight); - } - - /** * @hide */ public RemoteViews makeExpandedContentView() { @@ -9404,7 +9345,7 @@ public class Notification implements Parcelable * @hide */ @Override - public RemoteViews makeContentView(boolean increasedHeight) { + public RemoteViews makeContentView() { // All messaging templates contain the actions ArrayList<Action> originalActions = mBuilder.mActions; try { @@ -9649,7 +9590,7 @@ public class Notification implements Parcelable * @hide */ @Override - public RemoteViews makeHeadsUpContentView(boolean increasedHeight) { + public RemoteViews makeHeadsUpContentView() { return makeMessagingView(StandardTemplateParams.VIEW_TYPE_HEADS_UP); } @@ -10484,7 +10425,7 @@ public class Notification implements Parcelable * @hide */ @Override - public RemoteViews makeContentView(boolean increasedHeight) { + public RemoteViews makeContentView() { return makeMediaContentView(null /* customContent */); } @@ -10500,7 +10441,7 @@ public class Notification implements Parcelable * @hide */ @Override - public RemoteViews makeHeadsUpContentView(boolean increasedHeight) { + public RemoteViews makeHeadsUpContentView() { return makeMediaContentView(null /* customContent */); } @@ -10913,7 +10854,7 @@ public class Notification implements Parcelable * @hide */ @Override - public RemoteViews makeContentView(boolean increasedHeight) { + public RemoteViews makeContentView() { return makeCallLayout(StandardTemplateParams.VIEW_TYPE_NORMAL); } @@ -10921,7 +10862,7 @@ public class Notification implements Parcelable * @hide */ @Override - public RemoteViews makeHeadsUpContentView(boolean increasedHeight) { + public RemoteViews makeHeadsUpContentView() { return makeCallLayout(StandardTemplateParams.VIEW_TYPE_HEADS_UP); } @@ -10932,7 +10873,7 @@ public class Notification implements Parcelable @Override public RemoteViews makeCompactHeadsUpContentView() { // Use existing heads up for call style. - return makeHeadsUpContentView(false); + return makeHeadsUpContentView(); } /** @@ -11701,7 +11642,7 @@ public class Notification implements Parcelable * @hide */ @Override - public RemoteViews makeContentView(boolean increasedHeight) { + public RemoteViews makeContentView() { final StandardTemplateParams p = mBuilder.mParams.reset() .viewType(StandardTemplateParams.VIEW_TYPE_NORMAL) .hideProgress(true) @@ -11713,7 +11654,7 @@ public class Notification implements Parcelable * @hide */ @Override - public RemoteViews makeHeadsUpContentView(boolean increasedHeight) { + public RemoteViews makeHeadsUpContentView() { final StandardTemplateParams p = mBuilder.mParams.reset() .viewType(StandardTemplateParams.VIEW_TYPE_HEADS_UP) .hideProgress(true) @@ -12192,7 +12133,7 @@ public class Notification implements Parcelable * @hide */ @Override - public RemoteViews makeContentView(boolean increasedHeight) { + public RemoteViews makeContentView() { return makeStandardTemplateWithCustomContent(mBuilder.mN.contentView); } @@ -12208,7 +12149,7 @@ public class Notification implements Parcelable * @hide */ @Override - public RemoteViews makeHeadsUpContentView(boolean increasedHeight) { + public RemoteViews makeHeadsUpContentView() { return makeDecoratedHeadsUpContentView(); } @@ -12328,7 +12269,7 @@ public class Notification implements Parcelable * @hide */ @Override - public RemoteViews makeContentView(boolean increasedHeight) { + public RemoteViews makeContentView() { return makeMediaContentView(mBuilder.mN.contentView); } @@ -12347,7 +12288,7 @@ public class Notification implements Parcelable * @hide */ @Override - public RemoteViews makeHeadsUpContentView(boolean increasedHeight) { + public RemoteViews makeHeadsUpContentView() { RemoteViews customContent = mBuilder.mN.headsUpContentView != null ? mBuilder.mN.headsUpContentView : mBuilder.mN.contentView; diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinderTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinderTest.java index f7673da6dfb0..4c87e47b8911 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinderTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinderTest.java @@ -26,12 +26,10 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; - import androidx.core.os.CancellationSignal; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; -import com.android.internal.util.NotificationMessagingUtil; import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; @@ -51,7 +49,6 @@ import java.util.concurrent.atomic.AtomicReference; @SmallTest public class HeadsUpViewBinderTest extends SysuiTestCase { private HeadsUpViewBinder mViewBinder; - @Mock private NotificationMessagingUtil mNotificationMessagingUtil; @Mock private RowContentBindStage mBindStage; private final HeadsUpViewBinderLogger mLogger = spy( new HeadsUpViewBinderLogger(logcatLogBuffer())); @@ -61,7 +58,7 @@ public class HeadsUpViewBinderTest extends SysuiTestCase { @Before public void setup() { MockitoAnnotations.initMocks(this); - mViewBinder = new HeadsUpViewBinder(mNotificationMessagingUtil, mBindStage, mLogger); + mViewBinder = new HeadsUpViewBinder(mBindStage, mLogger); when(mEntry.getKey()).thenReturn("key"); when(mEntry.getRow()).thenReturn(mRow); when(mBindStage.getStageParams(eq(mEntry))).thenReturn(new RowContentBindParams()); diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java index a49a66fe26b2..da31cd967a36 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java @@ -163,42 +163,6 @@ public class NotificationContentInflaterTest extends SysuiTestCase { } @Test - public void testIncreasedHeadsUpBeingUsed() { - BindParams params = new BindParams(false, false, /* usesIncreasedHeadsUpHeight */ true, - REDACTION_TYPE_NONE); - Notification.Builder builder = spy(mBuilder); - mNotificationInflater.inflateNotificationViews( - mRow.getEntry(), - mRow, - params, - true /* inflateSynchronously */, - FLAG_CONTENT_VIEW_ALL, - builder, - mContext, - mContext, - mSmartReplyStateInflater); - verify(builder).createHeadsUpContentView(true); - } - - @Test - public void testIncreasedHeightBeingUsed() { - BindParams params = new BindParams(false, /* usesIncreasedHeight */ true, false, - REDACTION_TYPE_NONE); - Notification.Builder builder = spy(mBuilder); - mNotificationInflater.inflateNotificationViews( - mRow.getEntry(), - mRow, - params, - true /* inflateSynchronously */, - FLAG_CONTENT_VIEW_ALL, - builder, - mContext, - mContext, - mSmartReplyStateInflater); - verify(builder).createContentView(true); - } - - @Test public void testInflationCallsUpdated() throws Exception { inflateAndWait(mNotificationInflater, FLAG_CONTENT_VIEW_ALL, mRow); verify(mRow).onNotificationUpdated(); @@ -238,7 +202,7 @@ public class NotificationContentInflaterTest extends SysuiTestCase { mRow.getEntry(), mRow, FLAG_CONTENT_VIEW_ALL, - new BindParams(false, false, false, REDACTION_TYPE_NONE), + new BindParams(false, REDACTION_TYPE_NONE), false /* forceInflate */, null /* callback */); Assert.assertNull(mRow.getEntry().getRunningTask()); @@ -576,7 +540,7 @@ public class NotificationContentInflaterTest extends SysuiTestCase { row.getEntry(), row, contentToInflate, - new BindParams(false, false, false, redactionType), + new BindParams(false, redactionType), false /* forceInflate */, callback /* callback */); assertTrue(countDownLatch.await(500, TimeUnit.MILLISECONDS)); diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImplTest.kt index f25ba2c93c65..680b1bee72b2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImplTest.kt @@ -144,43 +144,6 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() { } @Test - fun testIncreasedHeadsUpBeingUsed() { - val params = - BindParams(false, false, /* usesIncreasedHeadsUpHeight */ true, REDACTION_TYPE_NONE) - val builder = spy(builder) - notificationInflater.inflateNotificationViews( - row.entry, - row, - params, - true, /* inflateSynchronously */ - FLAG_CONTENT_VIEW_ALL, - builder, - mContext, - smartReplyStateInflater, - mock(), - ) - verify(builder).createHeadsUpContentView(true) - } - - @Test - fun testIncreasedHeightBeingUsed() { - val params = BindParams(false, /* usesIncreasedHeight */ true, false, REDACTION_TYPE_NONE) - val builder = spy(builder) - notificationInflater.inflateNotificationViews( - row.entry, - row, - params, - true, /* inflateSynchronously */ - FLAG_CONTENT_VIEW_ALL, - builder, - mContext, - smartReplyStateInflater, - mock(), - ) - verify(builder).createContentView(true) - } - - @Test fun testInflationCallsUpdated() { inflateAndWait(notificationInflater, FLAG_CONTENT_VIEW_ALL, row) verify(row).onNotificationUpdated() @@ -226,7 +189,7 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() { row.entry, row, FLAG_CONTENT_VIEW_ALL, - BindParams(false, false, false, REDACTION_TYPE_NONE), + BindParams(false, REDACTION_TYPE_NONE), false, /* forceInflate */ null, /* callback */ ) @@ -703,7 +666,7 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() { row.entry, row, contentToInflate, - BindParams(false, false, false, redactionType), + BindParams(false, redactionType), false, /* forceInflate */ callback, /* callback */ ) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/RowContentBindStageTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/RowContentBindStageTest.java index 841cb4a3669b..98e275a473fa 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/RowContentBindStageTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/RowContentBindStageTest.java @@ -214,54 +214,6 @@ public class RowContentBindStageTest extends SysuiTestCase { } @Test - public void testSetUseIncreasedHeight() { - // GIVEN a view with all content bound. - RowContentBindParams params = mRowContentBindStage.getStageParams(mEntry); - params.requireContentViews(FLAG_CONTENT_VIEW_ALL); - params.clearDirtyContentViews(); - - // WHEN use increased height is set and stage executed. - params.setUseIncreasedCollapsedHeight(true); - mRowContentBindStage.executeStage(mEntry, mRow, (en) -> { }); - - // THEN binder is called with group view and contracted is bound. - ArgumentCaptor<BindParams> bindParamsCaptor = ArgumentCaptor.forClass(BindParams.class); - verify(mBinder).bindContent( - eq(mEntry), - any(), - eq(FLAG_CONTENT_VIEW_CONTRACTED), - bindParamsCaptor.capture(), - anyBoolean(), - any()); - BindParams usedParams = bindParamsCaptor.getValue(); - assertTrue(usedParams.usesIncreasedHeight); - } - - @Test - public void testSetUseIncreasedHeadsUpHeight() { - // GIVEN a view with all content bound. - RowContentBindParams params = mRowContentBindStage.getStageParams(mEntry); - params.requireContentViews(FLAG_CONTENT_VIEW_ALL); - params.clearDirtyContentViews(); - - // WHEN use increased heads up height is set and stage executed. - params.setUseIncreasedHeadsUpHeight(true); - mRowContentBindStage.executeStage(mEntry, mRow, (en) -> { }); - - // THEN binder is called with use group view and heads up is bound. - ArgumentCaptor<BindParams> bindParamsCaptor = ArgumentCaptor.forClass(BindParams.class); - verify(mBinder).bindContent( - eq(mEntry), - any(), - eq(FLAG_CONTENT_VIEW_HEADS_UP), - bindParamsCaptor.capture(), - anyBoolean(), - any()); - BindParams usedParams = bindParamsCaptor.getValue(); - assertTrue(usedParams.usesIncreasedHeadsUpHeight); - } - - @Test public void testSetNeedsReinflation() { // GIVEN a view with all content bound. RowContentBindParams params = mRowContentBindStage.getStageParams(mEntry); diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 2ffa3d19e161..cf975d43293d 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -254,9 +254,6 @@ <!-- Reference width used when validating notification layouts --> <dimen name="notification_validation_reference_width">320dp</dimen> - <!-- Increased height of a small notification in the status bar --> - <dimen name="notification_min_height_increased">146dp</dimen> - <!-- Height of a small notification in the status bar which was used before android N --> <dimen name="notification_min_height_legacy">64dp</dimen> @@ -281,9 +278,6 @@ <!-- Height of a heads up notification in the status bar --> <dimen name="notification_max_heads_up_height">136dp</dimen> - <!-- Height of a heads up notification in the status bar --> - <dimen name="notification_max_heads_up_height_increased">188dp</dimen> - <!-- Side padding on the side of notifications --> <dimen name="notification_side_paddings">16dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinderImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinderImpl.java index d83acf34ca99..9ed1632c8bc6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinderImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinderImpl.java @@ -248,8 +248,6 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { @NonNull NotifInflater.Params inflaterParams, ExpandableNotificationRow row, @Nullable NotificationRowContentBinder.InflationCallback inflationCallback) { - final boolean useIncreasedCollapsedHeight = - mMessagingUtil.isImportantMessaging(entry.getSbn(), entry.getImportance()); final boolean isMinimized = inflaterParams.isMinimized(); // Set show snooze action @@ -258,7 +256,6 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { RowContentBindParams params = mRowContentBindStage.getStageParams(entry); params.requireContentViews(FLAG_CONTENT_VIEW_CONTRACTED); params.requireContentViews(FLAG_CONTENT_VIEW_EXPANDED); - params.setUseIncreasedCollapsedHeight(useIncreasedCollapsedHeight); params.setUseMinimized(isMinimized); int redactionType = inflaterParams.getRedactionType(); @@ -303,7 +300,6 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { mLogger.logRequestingRebind(entry, inflaterParams); mRowContentBindStage.requestRebind(entry, en -> { mLogger.logRebindComplete(entry); - row.setUsesIncreasedCollapsedHeight(useIncreasedCollapsedHeight); row.setIsMinimized(isMinimized); if (inflationCallback != null) { inflationCallback.onAsyncInflationFinished(en); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt index 0a9899e88d24..c3266fc57c2e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt @@ -93,7 +93,6 @@ constructor( clickerBuilder.build(bubblesOptional, notificationActivityStarter) ) notificationRowBinder.setUpWithPresenter(presenter, listContainer) - headsUpViewBinder.setPresenter(presenter) notifBindPipelineInitializer.initialize() animatedImageNotificationManager.bind() diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinder.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinder.java index 32ec02319241..9988f729a11a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinder.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/HeadsUpViewBinder.java @@ -23,9 +23,7 @@ import android.util.ArrayMap; import androidx.annotation.Nullable; import androidx.core.os.CancellationSignal; -import com.android.internal.util.NotificationMessagingUtil; import com.android.systemui.dagger.SysUISingleton; -import com.android.systemui.statusbar.NotificationPresenter; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.coordinator.HeadsUpCoordinator; import com.android.systemui.statusbar.notification.row.RowContentBindParams; @@ -45,30 +43,18 @@ import javax.inject.Inject; @SysUISingleton public class HeadsUpViewBinder { private final RowContentBindStage mStage; - private final NotificationMessagingUtil mNotificationMessagingUtil; private final Map<NotificationEntry, CancellationSignal> mOngoingBindCallbacks = new ArrayMap<>(); private final HeadsUpViewBinderLogger mLogger; - private NotificationPresenter mNotificationPresenter; @Inject - HeadsUpViewBinder( - NotificationMessagingUtil notificationMessagingUtil, - RowContentBindStage bindStage, HeadsUpViewBinderLogger logger) { - mNotificationMessagingUtil = notificationMessagingUtil; + HeadsUpViewBinder(RowContentBindStage bindStage, HeadsUpViewBinderLogger logger) { mStage = bindStage; mLogger = logger; } /** - * Set notification presenter to determine parameters for heads up view inflation. - */ - public void setPresenter(NotificationPresenter presenter) { - mNotificationPresenter = presenter; - } - - /** * Bind heads up view to the notification row. * @param callback callback after heads up view is bound */ @@ -77,15 +63,9 @@ public class HeadsUpViewBinder { boolean isPinnedByUser, @Nullable HeadsUpBindCallback callback) { RowContentBindParams params = mStage.getStageParams(entry); - final boolean isImportantMessage = mNotificationMessagingUtil.isImportantMessaging( - entry.getSbn(), entry.getImportance()); - final boolean useIncreasedHeadsUp = isImportantMessage - && !mNotificationPresenter.isPresenterFullyCollapsed(); - params.setUseIncreasedHeadsUpHeight(useIncreasedHeadsUp); params.requireContentViews(FLAG_CONTENT_VIEW_HEADS_UP); CancellationSignal signal = mStage.requestRebind(entry, en -> { mLogger.entryBoundSuccessfully(entry); - en.getRow().setUsesIncreasedHeadsUpHeight(params.useIncreasedHeadsUpHeight()); // requestRebind promises that if we called cancel before this callback would be // invoked, then we will not enter this callback, and because we always cancel before // adding to this map, we know this will remove the correct signal. 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 95604c113a15..598ff09ba3b0 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 @@ -191,12 +191,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView private int mMaxHeadsUpHeightBeforeP; private int mMaxHeadsUpHeightBeforeS; private int mMaxHeadsUpHeight; - private int mMaxHeadsUpHeightIncreased; private int mMaxSmallHeightBeforeN; private int mMaxSmallHeightBeforeP; private int mMaxSmallHeightBeforeS; private int mMaxSmallHeight; - private int mMaxSmallHeightLarge; private int mMaxExpandedHeight; private int mNotificationLaunchHeight; private boolean mMustStayOnScreen; @@ -414,8 +412,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView private OnUserInteractionCallback mOnUserInteractionCallback; private NotificationGutsManager mNotificationGutsManager; private boolean mIsMinimized; - private boolean mUseIncreasedCollapsedHeight; - private boolean mUseIncreasedHeadsUpHeight; private float mTranslationWhenRemoved; private boolean mWasChildInGroupWhenRemoved; private final NotificationInlineImageResolver mImageResolver; @@ -828,8 +824,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } } else if (isCallLayout) { smallHeight = mMaxExpandedHeight; - } else if (mUseIncreasedCollapsedHeight && layout == mPrivateLayout) { - smallHeight = mMaxSmallHeightLarge; } else { smallHeight = mMaxSmallHeight; } @@ -845,8 +839,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } else { headsUpHeight = mMaxHeadsUpHeightBeforeS; } - } else if (mUseIncreasedHeadsUpHeight && layout == mPrivateLayout) { - headsUpHeight = mMaxHeadsUpHeightIncreased; } else { headsUpHeight = mMaxHeadsUpHeight; } @@ -1848,14 +1840,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView return mIsMinimized; } - public void setUsesIncreasedCollapsedHeight(boolean use) { - mUseIncreasedCollapsedHeight = use; - } - - public void setUsesIncreasedHeadsUpHeight(boolean use) { - mUseIncreasedHeadsUpHeight = use; - } - /** * Interface for logging {{@link ExpandableNotificationRow} events.} */ @@ -2086,8 +2070,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mMaxSmallHeight = NotificationUtils.getFontScaledHeight(mContext, R.dimen.notification_min_height); } - mMaxSmallHeightLarge = NotificationUtils.getFontScaledHeight(mContext, - R.dimen.notification_min_height_increased); mMaxExpandedHeight = NotificationUtils.getFontScaledHeight(mContext, R.dimen.notification_max_height); mMaxHeadsUpHeightBeforeN = NotificationUtils.getFontScaledHeight(mContext, @@ -2098,8 +2080,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView R.dimen.notification_max_heads_up_height_before_s); mMaxHeadsUpHeight = NotificationUtils.getFontScaledHeight(mContext, R.dimen.notification_max_heads_up_height); - mMaxHeadsUpHeightIncreased = NotificationUtils.getFontScaledHeight(mContext, - R.dimen.notification_max_heads_up_height_increased); Resources res = getResources(); mEnableNonGroupedNotificationExpand = diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java index 7b3a4710b69c..57fe24f40acb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java @@ -436,8 +436,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder if ((reInflateFlags & FLAG_CONTENT_VIEW_CONTRACTED) != 0) { logger.logAsyncTaskProgress(entryForLogging, "creating contracted remote view"); - result.newContentView = createContentView(builder, bindParams.isMinimized, - bindParams.usesIncreasedHeight); + result.newContentView = createContentView(builder, bindParams.isMinimized); } if ((reInflateFlags & FLAG_CONTENT_VIEW_EXPANDED) != 0) { @@ -451,8 +450,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder if (isHeadsUpCompact) { result.newHeadsUpView = builder.createCompactHeadsUpContentView(); } else { - result.newHeadsUpView = builder.createHeadsUpContentView( - bindParams.usesIncreasedHeadsUpHeight); + result.newHeadsUpView = builder.createHeadsUpContentView(); } } @@ -462,7 +460,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder && bindParams.redactionType == REDACTION_TYPE_SENSITIVE_CONTENT) { result.newPublicView = createSensitiveContentMessageNotification( row.getEntry().getSbn().getNotification(), builder.getStyle(), - systemUiContext, packageContext).createContentView(true); + systemUiContext, packageContext).createContentView(); } else { result.newPublicView = builder.makePublicContentView(bindParams.isMinimized); } @@ -1135,11 +1133,11 @@ public class NotificationContentInflater implements NotificationRowContentBinder } private static RemoteViews createContentView(Notification.Builder builder, - boolean isMinimized, boolean useLarge) { + boolean isMinimized) { if (isMinimized) { return builder.makeLowPriorityContentView(false /* useRegularSubtext */); } - return builder.createContentView(useLarge); + return builder.createContentView(); } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinder.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinder.java index 1cef8791e0ea..0be1d5d9d79d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinder.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinder.java @@ -143,11 +143,8 @@ public interface NotificationRowContentBinder { */ class BindParams { - public BindParams(boolean minimized, boolean increasedHeight, - boolean increasedHeadsUpHeight, int redaction) { + public BindParams(boolean minimized, int redaction) { isMinimized = minimized; - usesIncreasedHeight = increasedHeight; - usesIncreasedHeadsUpHeight = increasedHeadsUpHeight; redactionType = redaction; } @@ -157,16 +154,6 @@ public interface NotificationRowContentBinder { public final boolean isMinimized; /** - * Use increased height when binding contracted view. - */ - public final boolean usesIncreasedHeight; - - /** - * Use increased height when binding heads up views. - */ - public final boolean usesIncreasedHeadsUpHeight; - - /** * Controls the type of public view to show, if a public view is requested */ public final @RedactionType int redactionType; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImpl.kt index c619b17f1ad8..49e38def98a6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImpl.kt @@ -822,11 +822,7 @@ constructor( entryForLogging, "creating contracted remote view", ) - createContentView( - builder, - bindParams.isMinimized, - bindParams.usesIncreasedHeight, - ) + createContentView(builder, bindParams.isMinimized) } else null val expanded = if (reInflateFlags and FLAG_CONTENT_VIEW_EXPANDED != 0) { @@ -846,7 +842,7 @@ constructor( if (isHeadsUpCompact) { builder.createCompactHeadsUpContentView() } else { - builder.createHeadsUpContentView(bindParams.usesIncreasedHeadsUpHeight) + @Suppress("DEPRECATION") builder.createHeadsUpContentView() } } else null val public = @@ -862,7 +858,7 @@ constructor( systemUiContext, packageContext, ) - .createContentView(bindParams.usesIncreasedHeight) + .createContentView() } else { builder.makePublicContentView(bindParams.isMinimized) } @@ -1654,11 +1650,12 @@ constructor( private fun createContentView( builder: Notification.Builder, isMinimized: Boolean, - useLarge: Boolean, ): RemoteViews { return if (isMinimized) { builder.makeLowPriorityContentView(false /* useRegularSubtext */) - } else builder.createContentView(useLarge) + } else { + @Suppress("DEPRECATION") builder.createContentView() + } } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RowContentBindParams.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RowContentBindParams.java index bc44cb0e1074..adbff10a629b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RowContentBindParams.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RowContentBindParams.java @@ -20,7 +20,6 @@ import static com.android.systemui.statusbar.NotificationLockscreenUserManager.R import static com.android.systemui.statusbar.NotificationLockscreenUserManager.RedactionType; import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_CONTRACTED; import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_EXPANDED; -import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_HEADS_UP; import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationFlag; @@ -29,8 +28,6 @@ import com.android.systemui.statusbar.notification.row.NotificationRowContentBin */ public final class RowContentBindParams { private boolean mUseMinimized; - private boolean mUseIncreasedHeight; - private boolean mUseIncreasedHeadsUpHeight; private boolean mViewsNeedReinflation; private @InflationFlag int mContentViews = DEFAULT_INFLATION_FLAGS; private @RedactionType int mRedactionType = REDACTION_TYPE_NONE; @@ -75,34 +72,6 @@ public final class RowContentBindParams { } /** - * Set whether content should use an increased height version of its contracted view. - */ - public void setUseIncreasedCollapsedHeight(boolean useIncreasedHeight) { - if (mUseIncreasedHeight != useIncreasedHeight) { - mDirtyContentViews |= FLAG_CONTENT_VIEW_CONTRACTED; - } - mUseIncreasedHeight = useIncreasedHeight; - } - - public boolean useIncreasedHeight() { - return mUseIncreasedHeight; - } - - /** - * Set whether content should use an increased height version of its heads up view. - */ - public void setUseIncreasedHeadsUpHeight(boolean useIncreasedHeadsUpHeight) { - if (mUseIncreasedHeadsUpHeight != useIncreasedHeadsUpHeight) { - mDirtyContentViews |= FLAG_CONTENT_VIEW_HEADS_UP; - } - mUseIncreasedHeadsUpHeight = useIncreasedHeadsUpHeight; - } - - public boolean useIncreasedHeadsUpHeight() { - return mUseIncreasedHeadsUpHeight; - } - - /** * Require the specified content views to be bound after the rebind request. * * @see InflationFlag @@ -169,10 +138,8 @@ public final class RowContentBindParams { @Override public String toString() { return String.format("RowContentBindParams[mContentViews=%x mDirtyContentViews=%x " - + "mUseMinimized=%b mUseIncreasedHeight=%b " - + "mUseIncreasedHeadsUpHeight=%b mViewsNeedReinflation=%b]", - mContentViews, mDirtyContentViews, mUseMinimized, mUseIncreasedHeight, - mUseIncreasedHeadsUpHeight, mViewsNeedReinflation); + + "mUseMinimized=%b mViewsNeedReinflation=%b]", + mContentViews, mDirtyContentViews, mUseMinimized, mViewsNeedReinflation); } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RowContentBindStage.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RowContentBindStage.java index 53f74161e7fc..6883ec575d7e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RowContentBindStage.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RowContentBindStage.java @@ -72,8 +72,7 @@ public class RowContentBindStage extends BindStage<RowContentBindParams> { // Bind/unbind with parameters mBinder.unbindContent(entry, row, contentToUnbind); - BindParams bindParams = new BindParams(params.useMinimized(), params.useIncreasedHeight(), - params.useIncreasedHeadsUpHeight(), params.getRedactionType()); + BindParams bindParams = new BindParams(params.useMinimized(), params.getRedactionType()); boolean forceInflate = params.needsReinflation(); InflationCallback inflationCallback = new InflationCallback() { |