diff options
author | 2025-02-11 14:32:25 +0100 | |
---|---|---|
committer | 2025-02-12 11:47:38 +0100 | |
commit | 787314ed22d859e510163327dd6c58b215c2f7f9 (patch) | |
tree | 43bbf1e8b974683a4f6d7a154f55e69200bf926f /packages/SettingsLib/src | |
parent | 81c1aef9a73bdbc6d246c70ec200c6a808d1763c (diff) |
Inline MODES_API flag
Mostly mechanical changes, except:
* Fixed bug in updateZenRulesOnLocaleChange() - was checking wrong field for FIELD_NAME flag.
* Renamed areChannelsBypassingDnd to hasPriorityChannels, except when it's the "real" areChannelsBypassingDnd, i.e. hasPriorityChannels && allowPriorityChannels.
* Deleted or inlined a handful of methods.
Bug: 310620812
Test: Preexisting + ZenModeHelperTest
Flag: EXEMPT Inlining flag
Change-Id: Icdb8f7abe80b87e468372cfbfe6e51a0dadba3a2
Diffstat (limited to 'packages/SettingsLib/src')
2 files changed, 14 insertions, 28 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/notification/data/repository/ZenModeRepository.kt b/packages/SettingsLib/src/com/android/settingslib/notification/data/repository/ZenModeRepository.kt index f446bb8e32d1..c4e724554c04 100644 --- a/packages/SettingsLib/src/com/android/settingslib/notification/data/repository/ZenModeRepository.kt +++ b/packages/SettingsLib/src/com/android/settingslib/notification/data/repository/ZenModeRepository.kt @@ -93,10 +93,9 @@ class ZenModeRepositoryImpl( IntentFilter().apply { addAction(NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED) addAction(NotificationManager.ACTION_NOTIFICATION_POLICY_CHANGED) - if (android.app.Flags.modesApi()) - addAction( - NotificationManager.ACTION_CONSOLIDATED_NOTIFICATION_POLICY_CHANGED - ) + addAction( + NotificationManager.ACTION_CONSOLIDATED_NOTIFICATION_POLICY_CHANGED + ) }, /* broadcastPermission = */ null, /* scheduler = */ backgroundHandler, @@ -109,16 +108,13 @@ class ZenModeRepositoryImpl( } override val consolidatedNotificationPolicy: StateFlow<NotificationManager.Policy?> by lazy { - if (android.app.Flags.modesApi()) - flowFromBroadcast(NotificationManager.ACTION_CONSOLIDATED_NOTIFICATION_POLICY_CHANGED) { - // If available, get the value from extras to avoid a potential binder call. - it?.extras?.getParcelable(EXTRA_NOTIFICATION_POLICY) - ?: notificationManager.consolidatedNotificationPolicy - } - else - flowFromBroadcast(NotificationManager.ACTION_NOTIFICATION_POLICY_CHANGED) { - notificationManager.consolidatedNotificationPolicy - } + flowFromBroadcast(NotificationManager.ACTION_CONSOLIDATED_NOTIFICATION_POLICY_CHANGED) { + // If available, get the value from extras to avoid a potential binder call. + it?.extras?.getParcelable( + EXTRA_NOTIFICATION_POLICY, + NotificationManager.Policy::class.java + ) ?: notificationManager.consolidatedNotificationPolicy + } } override val globalZenMode: StateFlow<Int?> by lazy { diff --git a/packages/SettingsLib/src/com/android/settingslib/notification/modes/EnableDndDialogFactory.java b/packages/SettingsLib/src/com/android/settingslib/notification/modes/EnableDndDialogFactory.java index f0e7fb851d5f..52d62b6226b8 100644 --- a/packages/SettingsLib/src/com/android/settingslib/notification/modes/EnableDndDialogFactory.java +++ b/packages/SettingsLib/src/com/android/settingslib/notification/modes/EnableDndDialogFactory.java @@ -19,7 +19,6 @@ package com.android.settingslib.notification.modes; import android.app.ActivityManager; import android.app.AlarmManager; import android.app.AlertDialog; -import android.app.Flags; import android.app.NotificationManager; import android.content.Context; import android.content.DialogInterface; @@ -42,8 +41,6 @@ import android.widget.RadioGroup; import android.widget.ScrollView; import android.widget.TextView; -import androidx.annotation.Nullable; - import com.android.internal.annotations.VisibleForTesting; import com.android.internal.policy.PhoneWindow; import com.android.settingslib.R; @@ -80,7 +77,6 @@ public class EnableDndDialogFactory { private static final int SECONDS_MS = 1000; private static final int MINUTES_MS = 60 * SECONDS_MS; - @Nullable private final EnableDndDialogMetricsLogger mMetricsLogger; @VisibleForTesting @@ -152,16 +148,10 @@ public class EnableDndDialogFactory { Slog.d(TAG, "Invalid manual condition: " + tag.condition); } // always triggers priority-only dnd with chosen condition - if (Flags.modesApi()) { - mNotificationManager.setZenMode( - Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS, - getRealConditionId(tag.condition), TAG, - /* fromUser= */ true); - } else { - mNotificationManager.setZenMode( - Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS, - getRealConditionId(tag.condition), TAG); - } + mNotificationManager.setZenMode( + Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS, + getRealConditionId(tag.condition), TAG, + /* fromUser= */ true); } }); |