Loading packages/SettingsLib/src/com/android/settingslib/notification/data/repository/ZenModeRepository.kt +12 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter import android.os.Handler import com.android.settingslib.flags.Flags import kotlin.coroutines.CoroutineContext import kotlinx.coroutines.CoroutineScope Loading Loading @@ -50,6 +51,9 @@ class ZenModeRepositoryImpl( private val notificationManager: NotificationManager, val scope: CoroutineScope, val backgroundCoroutineContext: CoroutineContext, // This is nullable just to simplify testing, since SettingsLib doesn't have a good way // to create a fake handler. val backgroundHandler: Handler?, ) : ZenModeRepository { private val notificationBroadcasts = Loading @@ -69,7 +73,14 @@ class ZenModeRepositoryImpl( if (Flags.volumePanelBroadcastFix() && android.app.Flags.modesApi()) addAction( NotificationManager.ACTION_CONSOLIDATED_NOTIFICATION_POLICY_CHANGED) }) }, /* broadcastPermission = */ null, /* scheduler = */ if (Flags.volumePanelBroadcastFix()) { backgroundHandler } else { null }, ) awaitClose { context.unregisterReceiver(receiver) } } Loading packages/SettingsLib/tests/robotests/src/com/android/settingslib/notification/data/repository/ZenModeRepositoryTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ class ZenModeRepositoryTest { notificationManager, testScope.backgroundScope, testScope.testScheduler, backgroundHandler = null, ) } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java +5 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification.dagger; import android.app.NotificationManager; import android.content.Context; import android.os.Handler; import android.service.notification.NotificationListenerService; import com.android.internal.jank.InteractionJankMonitor; Loading Loading @@ -283,9 +284,11 @@ public interface NotificationsModule { Context context, NotificationManager notificationManager, @Application CoroutineScope coroutineScope, @Background CoroutineContext coroutineContext) { @Background CoroutineContext coroutineContext, @Background Handler handler ) { return new ZenModeRepositoryImpl(context, notificationManager, coroutineScope, coroutineContext); coroutineScope, coroutineContext, handler); } @Provides Loading Loading
packages/SettingsLib/src/com/android/settingslib/notification/data/repository/ZenModeRepository.kt +12 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter import android.os.Handler import com.android.settingslib.flags.Flags import kotlin.coroutines.CoroutineContext import kotlinx.coroutines.CoroutineScope Loading Loading @@ -50,6 +51,9 @@ class ZenModeRepositoryImpl( private val notificationManager: NotificationManager, val scope: CoroutineScope, val backgroundCoroutineContext: CoroutineContext, // This is nullable just to simplify testing, since SettingsLib doesn't have a good way // to create a fake handler. val backgroundHandler: Handler?, ) : ZenModeRepository { private val notificationBroadcasts = Loading @@ -69,7 +73,14 @@ class ZenModeRepositoryImpl( if (Flags.volumePanelBroadcastFix() && android.app.Flags.modesApi()) addAction( NotificationManager.ACTION_CONSOLIDATED_NOTIFICATION_POLICY_CHANGED) }) }, /* broadcastPermission = */ null, /* scheduler = */ if (Flags.volumePanelBroadcastFix()) { backgroundHandler } else { null }, ) awaitClose { context.unregisterReceiver(receiver) } } Loading
packages/SettingsLib/tests/robotests/src/com/android/settingslib/notification/data/repository/ZenModeRepositoryTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ class ZenModeRepositoryTest { notificationManager, testScope.backgroundScope, testScope.testScheduler, backgroundHandler = null, ) } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java +5 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification.dagger; import android.app.NotificationManager; import android.content.Context; import android.os.Handler; import android.service.notification.NotificationListenerService; import com.android.internal.jank.InteractionJankMonitor; Loading Loading @@ -283,9 +284,11 @@ public interface NotificationsModule { Context context, NotificationManager notificationManager, @Application CoroutineScope coroutineScope, @Background CoroutineContext coroutineContext) { @Background CoroutineContext coroutineContext, @Background Handler handler ) { return new ZenModeRepositoryImpl(context, notificationManager, coroutineScope, coroutineContext); coroutineScope, coroutineContext, handler); } @Provides Loading