Loading src/com/android/settings/notification/LockScreenNotificationShowSeenController.java +24 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.settings.notification; import static android.provider.Settings.Secure.LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS; import android.content.ContentResolver; import android.content.Context; import android.database.ContentObserver; Loading @@ -42,7 +44,8 @@ import com.android.settings.core.TogglePreferenceController; public class LockScreenNotificationShowSeenController extends TogglePreferenceController implements LifecycleEventObserver { private static final int UNSET = 0; // 0 is the default value for phones, we treat 0 as off as usage private static final int UNSET_OFF = 0; static final int ON = 1; static final int OFF = 2; @Nullable private Preference mPreference; Loading Loading @@ -96,14 +99,24 @@ public class LockScreenNotificationShowSeenController extends TogglePreferenceCo @Override public int getAvailabilityStatus() { if (!Flags.notificationMinimalism()) { return CONDITIONALLY_UNAVAILABLE; } if (Flags.notificationMinimalism()) { if (!lockScreenShowNotification()) { return CONDITIONALLY_UNAVAILABLE; } // We want to show the switch when the lock screen notification minimalism flag is on. return AVAILABLE; } int setting = Settings.Secure.getInt(mContext.getContentResolver(), LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, UNSET_OFF); if (setting == UNSET_OFF) { // hide the setting if the minimalism flag is off, and the device is phone // UNSET_OFF is the default value for phones return CONDITIONALLY_UNAVAILABLE; } else { return AVAILABLE; } } /** * @return Whether showing notifications on the lockscreen is enabled. Loading @@ -118,9 +131,14 @@ public class LockScreenNotificationShowSeenController extends TogglePreferenceCo return lockScreenShowSeenNotifications(); } /** * @return whether to show seen notifications on lockscreen */ private boolean lockScreenShowSeenNotifications() { // UNSET_OFF is the default value for phone, which is equivalent to off in effect // (show seen notification) return Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, UNSET) == OFF; Settings.Secure.LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, UNSET_OFF) != ON; } @Override Loading src/com/android/settings/notification/ShowOnlyUnseenNotificationsOnLockscreenPreferenceController.java +6 −4 Original line number Diff line number Diff line Loading @@ -31,7 +31,9 @@ import com.android.settings.core.TogglePreferenceController; public class ShowOnlyUnseenNotificationsOnLockscreenPreferenceController extends TogglePreferenceController { private static final int UNSET = 0; // This is the default value for phones, before notification minimalism, this setting is // unavailable to phones, we use this value to hide the toggle on phones. private static final int UNSET_UNAVAILABLE = 0; @VisibleForTesting static final int ON = 1; @VisibleForTesting Loading @@ -46,7 +48,7 @@ public class ShowOnlyUnseenNotificationsOnLockscreenPreferenceController @Override public boolean isChecked() { return Settings.Secure.getInt(mContext.getContentResolver(), LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, UNSET) == ON; LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, UNSET_UNAVAILABLE) == ON; } @Override Loading @@ -69,8 +71,8 @@ public class ShowOnlyUnseenNotificationsOnLockscreenPreferenceController return AVAILABLE; } int setting = Settings.Secure.getInt(mContext.getContentResolver(), LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, UNSET); if (setting == UNSET) { LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, UNSET_UNAVAILABLE); if (setting == UNSET_UNAVAILABLE) { return CONDITIONALLY_UNAVAILABLE; } else { return AVAILABLE; Loading Loading
src/com/android/settings/notification/LockScreenNotificationShowSeenController.java +24 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.settings.notification; import static android.provider.Settings.Secure.LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS; import android.content.ContentResolver; import android.content.Context; import android.database.ContentObserver; Loading @@ -42,7 +44,8 @@ import com.android.settings.core.TogglePreferenceController; public class LockScreenNotificationShowSeenController extends TogglePreferenceController implements LifecycleEventObserver { private static final int UNSET = 0; // 0 is the default value for phones, we treat 0 as off as usage private static final int UNSET_OFF = 0; static final int ON = 1; static final int OFF = 2; @Nullable private Preference mPreference; Loading Loading @@ -96,14 +99,24 @@ public class LockScreenNotificationShowSeenController extends TogglePreferenceCo @Override public int getAvailabilityStatus() { if (!Flags.notificationMinimalism()) { return CONDITIONALLY_UNAVAILABLE; } if (Flags.notificationMinimalism()) { if (!lockScreenShowNotification()) { return CONDITIONALLY_UNAVAILABLE; } // We want to show the switch when the lock screen notification minimalism flag is on. return AVAILABLE; } int setting = Settings.Secure.getInt(mContext.getContentResolver(), LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, UNSET_OFF); if (setting == UNSET_OFF) { // hide the setting if the minimalism flag is off, and the device is phone // UNSET_OFF is the default value for phones return CONDITIONALLY_UNAVAILABLE; } else { return AVAILABLE; } } /** * @return Whether showing notifications on the lockscreen is enabled. Loading @@ -118,9 +131,14 @@ public class LockScreenNotificationShowSeenController extends TogglePreferenceCo return lockScreenShowSeenNotifications(); } /** * @return whether to show seen notifications on lockscreen */ private boolean lockScreenShowSeenNotifications() { // UNSET_OFF is the default value for phone, which is equivalent to off in effect // (show seen notification) return Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, UNSET) == OFF; Settings.Secure.LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, UNSET_OFF) != ON; } @Override Loading
src/com/android/settings/notification/ShowOnlyUnseenNotificationsOnLockscreenPreferenceController.java +6 −4 Original line number Diff line number Diff line Loading @@ -31,7 +31,9 @@ import com.android.settings.core.TogglePreferenceController; public class ShowOnlyUnseenNotificationsOnLockscreenPreferenceController extends TogglePreferenceController { private static final int UNSET = 0; // This is the default value for phones, before notification minimalism, this setting is // unavailable to phones, we use this value to hide the toggle on phones. private static final int UNSET_UNAVAILABLE = 0; @VisibleForTesting static final int ON = 1; @VisibleForTesting Loading @@ -46,7 +48,7 @@ public class ShowOnlyUnseenNotificationsOnLockscreenPreferenceController @Override public boolean isChecked() { return Settings.Secure.getInt(mContext.getContentResolver(), LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, UNSET) == ON; LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, UNSET_UNAVAILABLE) == ON; } @Override Loading @@ -69,8 +71,8 @@ public class ShowOnlyUnseenNotificationsOnLockscreenPreferenceController return AVAILABLE; } int setting = Settings.Secure.getInt(mContext.getContentResolver(), LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, UNSET); if (setting == UNSET) { LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, UNSET_UNAVAILABLE); if (setting == UNSET_UNAVAILABLE) { return CONDITIONALLY_UNAVAILABLE; } else { return AVAILABLE; Loading