summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/viewbinder/FooterViewBinder.kt35
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/viewmodel/FooterViewModel.kt7
3 files changed, 53 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java
index e5ce25d5144e..bf3032248984 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java
@@ -309,7 +309,20 @@ public class FooterView extends StackScrollerDecorView {
}
}
- /** Set onClickListener for the manage/history button. */
+ /** Set onClickListener for the notification settings button. */
+ public void setSettingsButtonClickListener(OnClickListener listener) {
+ mSettingsButton.setOnClickListener(listener);
+ }
+
+ /** Set onClickListener for the notification history button. */
+ public void setHistoryButtonClickListener(OnClickListener listener) {
+ mHistoryButton.setOnClickListener(listener);
+ }
+
+ /**
+ * Set onClickListener for the manage/history button. This is replaced by two separate buttons
+ * in the redesign.
+ */
public void setManageButtonClickListener(OnClickListener listener) {
mManageOrHistoryButton.setOnClickListener(listener);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/viewbinder/FooterViewBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/viewbinder/FooterViewBinder.kt
index ddd9cdd5e306..34894a2757df 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/viewbinder/FooterViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/viewbinder/FooterViewBinder.kt
@@ -18,9 +18,12 @@ package com.android.systemui.statusbar.notification.footer.ui.viewbinder
import android.view.View
import androidx.lifecycle.lifecycleScope
+import com.android.app.tracing.coroutines.launchTraced as launch
+import com.android.internal.jank.InteractionJankMonitor
import com.android.systemui.Flags
import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.statusbar.notification.NotificationActivityStarter
+import com.android.systemui.statusbar.notification.NotificationActivityStarter.SettingsIntent
import com.android.systemui.statusbar.notification.emptyshade.shared.ModesEmptyShadeFix
import com.android.systemui.statusbar.notification.footer.ui.view.FooterView
import com.android.systemui.statusbar.notification.footer.ui.viewmodel.FooterViewModel
@@ -29,7 +32,6 @@ import com.android.systemui.util.ui.stopAnimating
import com.android.systemui.util.ui.value
import kotlinx.coroutines.DisposableHandle
import kotlinx.coroutines.coroutineScope
-import com.android.app.tracing.coroutines.launchTraced as launch
/** Binds a [FooterView] to its [view model][FooterViewModel]. */
object FooterViewBinder {
@@ -74,6 +76,9 @@ object FooterViewBinder {
notificationActivityStarter,
)
}
+ } else {
+ bindSettingsButtonListener(footer, notificationActivityStarter)
+ bindHistoryButtonListener(footer, notificationActivityStarter)
}
launch { bindMessage(footer, viewModel) }
}
@@ -117,6 +122,34 @@ object FooterViewBinder {
}
}
+ private fun bindSettingsButtonListener(
+ footer: FooterView,
+ notificationActivityStarter: NotificationActivityStarter,
+ ) {
+ val settingsIntent =
+ SettingsIntent.forNotificationSettings(
+ cujType = InteractionJankMonitor.CUJ_SHADE_APP_LAUNCH_FROM_HISTORY_BUTTON
+ )
+ val onClickListener = { view: View ->
+ notificationActivityStarter.startSettingsIntent(view, settingsIntent)
+ }
+ footer.setSettingsButtonClickListener(onClickListener)
+ }
+
+ private fun bindHistoryButtonListener(
+ footer: FooterView,
+ notificationActivityStarter: NotificationActivityStarter,
+ ) {
+ val settingsIntent =
+ SettingsIntent.forNotificationHistory(
+ cujType = InteractionJankMonitor.CUJ_SHADE_APP_LAUNCH_FROM_HISTORY_BUTTON
+ )
+ val onClickListener = { view: View ->
+ notificationActivityStarter.startSettingsIntent(view, settingsIntent)
+ }
+ footer.setHistoryButtonClickListener(onClickListener)
+ }
+
private suspend fun bindManageOrHistoryButton(
footer: FooterView,
viewModel: FooterViewModel,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/viewmodel/FooterViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/viewmodel/FooterViewModel.kt
index a3f4cd225130..d8021fae98fb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/viewmodel/FooterViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/viewmodel/FooterViewModel.kt
@@ -98,7 +98,6 @@ class FooterViewModel(
val manageButtonShouldLaunchHistory =
notificationSettingsInteractor.isNotificationHistoryEnabled
- // TODO(b/366003631): When inlining the flag, consider adding this to FooterButtonViewModel.
val manageOrHistoryButtonClick: Flow<SettingsIntent> by lazy {
if (ModesEmptyShadeFix.isUnexpectedlyInLegacyMode()) {
flowOf(SettingsIntent(Intent(Settings.ACTION_NOTIFICATION_SETTINGS)))
@@ -124,7 +123,11 @@ class FooterViewModel(
else R.string.manage_notifications_text
}
- /** The button for managing notification settings or opening notification history. */
+ /**
+ * The button for managing notification settings or opening notification history. This is
+ * replaced by two separate buttons in the redesign. These are currently static, and therefore
+ * not modeled here, but if that changes we can also add them as FooterButtonViewModels.
+ */
val manageOrHistoryButton: FooterButtonViewModel =
FooterButtonViewModel(
labelId = manageOrHistoryButtonText,