Loading core/java/com/android/internal/config/sysui/SystemUiDeviceConfigFlags.java +7 −0 Original line number Diff line number Diff line Loading @@ -239,6 +239,13 @@ public final class SystemUiDeviceConfigFlags { public static final String ASSIST_TRANSCRIPTION_MIN_DURATION = "assist_transcription_min_duration"; /** * (boolean) Whether or not to enable an extra section in the notification shade which * filters for "people" related messages. */ public static final String NOTIFICATIONS_USE_PEOPLE_FILTERING = "notifications_use_people_filtering"; // Flags related to brightline falsing /** Loading packages/CarSystemUI/src/com/android/systemui/car/CarNotificationEntryManager.java +3 −3 Original line number Diff line number Diff line Loading @@ -15,11 +15,11 @@ */ package com.android.systemui.car; import android.content.Context; import android.service.notification.NotificationListenerService; import android.service.notification.StatusBarNotification; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotificationData; import javax.inject.Inject; import javax.inject.Singleton; Loading @@ -34,8 +34,8 @@ import javax.inject.Singleton; public class CarNotificationEntryManager extends NotificationEntryManager { @Inject public CarNotificationEntryManager(Context context) { super(context); public CarNotificationEntryManager(NotificationData notificationData) { super(notificationData); } @Override Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +2 −3 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.service.notification.NotificationListenerService.REASON_ER import android.annotation.Nullable; import android.app.Notification; import android.content.Context; import android.service.notification.NotificationListenerService; import android.service.notification.NotificationListenerService.Ranking; import android.service.notification.StatusBarNotification; Loading Loading @@ -124,8 +123,8 @@ public class NotificationEntryManager implements } @Inject public NotificationEntryManager(Context context) { mNotificationData = new NotificationData(context); public NotificationEntryManager(NotificationData notificationData) { mNotificationData = notificationData; } /** Adds a {@link NotificationEntryListener}. */ Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationSectionsFeatureManager.kt 0 → 100644 +73 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.notification import android.content.Context import android.provider.DeviceConfig import com.android.internal.annotations.VisibleForTesting import com.android.internal.config.sysui.SystemUiDeviceConfigFlags.NOTIFICATIONS_USE_PEOPLE_FILTERING import com.android.systemui.statusbar.notification.stack.NotificationSectionsManager.BUCKET_ALERTING import com.android.systemui.statusbar.notification.stack.NotificationSectionsManager.BUCKET_PEOPLE import com.android.systemui.statusbar.notification.stack.NotificationSectionsManager.BUCKET_SILENT import com.android.systemui.util.DeviceConfigProxy import javax.inject.Inject private var sUsePeopleFiltering: Boolean? = null /** * Feature controller for the NOTIFICATIONS_USE_PEOPLE_FILTERING config. */ class NotificationSectionsFeatureManager @Inject constructor( val proxy: DeviceConfigProxy, val context: Context ) { fun isFilteringEnabled(): Boolean { return usePeopleFiltering(proxy) } fun getNotificationBuckets(): IntArray { return when { isFilteringEnabled() -> intArrayOf(BUCKET_PEOPLE, BUCKET_ALERTING, BUCKET_SILENT) NotificationUtils.useNewInterruptionModel(context) -> intArrayOf(BUCKET_ALERTING, BUCKET_SILENT) else -> intArrayOf(BUCKET_ALERTING) } } fun getNumberOfBuckets(): Int { return getNotificationBuckets().size } @VisibleForTesting fun clearCache() { sUsePeopleFiltering = null } } private fun usePeopleFiltering(proxy: DeviceConfigProxy): Boolean { if (sUsePeopleFiltering == null) { sUsePeopleFiltering = proxy.getBoolean( DeviceConfig.NAMESPACE_SYSTEMUI, NOTIFICATIONS_USE_PEOPLE_FILTERING, false) } return sUsePeopleFiltering!! } packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java +0 −14 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ public class NotificationUtils { private static final int[] sLocationOffset = new int[2]; @Nullable private static Boolean sUseNewInterruptionModel = null; @Nullable private static Boolean sUsePeopleFiltering = null; public static boolean isGrayscale(ImageView v, ContrastColorUtil colorUtil) { Object isGrayscale = v.getTag(R.id.icon_is_grayscale); Loading Loading @@ -88,17 +87,4 @@ public class NotificationUtils { } return sUseNewInterruptionModel; } /** * Caches and returns the value of the people filtering setting. Cannot change except through * process restarts. */ public static boolean usePeopleFiltering(Context context) { if (sUsePeopleFiltering == null) { sUsePeopleFiltering = context.getResources().getBoolean( R.bool.config_usePeopleFiltering); } return sUsePeopleFiltering; } } Loading
core/java/com/android/internal/config/sysui/SystemUiDeviceConfigFlags.java +7 −0 Original line number Diff line number Diff line Loading @@ -239,6 +239,13 @@ public final class SystemUiDeviceConfigFlags { public static final String ASSIST_TRANSCRIPTION_MIN_DURATION = "assist_transcription_min_duration"; /** * (boolean) Whether or not to enable an extra section in the notification shade which * filters for "people" related messages. */ public static final String NOTIFICATIONS_USE_PEOPLE_FILTERING = "notifications_use_people_filtering"; // Flags related to brightline falsing /** Loading
packages/CarSystemUI/src/com/android/systemui/car/CarNotificationEntryManager.java +3 −3 Original line number Diff line number Diff line Loading @@ -15,11 +15,11 @@ */ package com.android.systemui.car; import android.content.Context; import android.service.notification.NotificationListenerService; import android.service.notification.StatusBarNotification; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotificationData; import javax.inject.Inject; import javax.inject.Singleton; Loading @@ -34,8 +34,8 @@ import javax.inject.Singleton; public class CarNotificationEntryManager extends NotificationEntryManager { @Inject public CarNotificationEntryManager(Context context) { super(context); public CarNotificationEntryManager(NotificationData notificationData) { super(notificationData); } @Override Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +2 −3 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.service.notification.NotificationListenerService.REASON_ER import android.annotation.Nullable; import android.app.Notification; import android.content.Context; import android.service.notification.NotificationListenerService; import android.service.notification.NotificationListenerService.Ranking; import android.service.notification.StatusBarNotification; Loading Loading @@ -124,8 +123,8 @@ public class NotificationEntryManager implements } @Inject public NotificationEntryManager(Context context) { mNotificationData = new NotificationData(context); public NotificationEntryManager(NotificationData notificationData) { mNotificationData = notificationData; } /** Adds a {@link NotificationEntryListener}. */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationSectionsFeatureManager.kt 0 → 100644 +73 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.notification import android.content.Context import android.provider.DeviceConfig import com.android.internal.annotations.VisibleForTesting import com.android.internal.config.sysui.SystemUiDeviceConfigFlags.NOTIFICATIONS_USE_PEOPLE_FILTERING import com.android.systemui.statusbar.notification.stack.NotificationSectionsManager.BUCKET_ALERTING import com.android.systemui.statusbar.notification.stack.NotificationSectionsManager.BUCKET_PEOPLE import com.android.systemui.statusbar.notification.stack.NotificationSectionsManager.BUCKET_SILENT import com.android.systemui.util.DeviceConfigProxy import javax.inject.Inject private var sUsePeopleFiltering: Boolean? = null /** * Feature controller for the NOTIFICATIONS_USE_PEOPLE_FILTERING config. */ class NotificationSectionsFeatureManager @Inject constructor( val proxy: DeviceConfigProxy, val context: Context ) { fun isFilteringEnabled(): Boolean { return usePeopleFiltering(proxy) } fun getNotificationBuckets(): IntArray { return when { isFilteringEnabled() -> intArrayOf(BUCKET_PEOPLE, BUCKET_ALERTING, BUCKET_SILENT) NotificationUtils.useNewInterruptionModel(context) -> intArrayOf(BUCKET_ALERTING, BUCKET_SILENT) else -> intArrayOf(BUCKET_ALERTING) } } fun getNumberOfBuckets(): Int { return getNotificationBuckets().size } @VisibleForTesting fun clearCache() { sUsePeopleFiltering = null } } private fun usePeopleFiltering(proxy: DeviceConfigProxy): Boolean { if (sUsePeopleFiltering == null) { sUsePeopleFiltering = proxy.getBoolean( DeviceConfig.NAMESPACE_SYSTEMUI, NOTIFICATIONS_USE_PEOPLE_FILTERING, false) } return sUsePeopleFiltering!! }
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java +0 −14 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ public class NotificationUtils { private static final int[] sLocationOffset = new int[2]; @Nullable private static Boolean sUseNewInterruptionModel = null; @Nullable private static Boolean sUsePeopleFiltering = null; public static boolean isGrayscale(ImageView v, ContrastColorUtil colorUtil) { Object isGrayscale = v.getTag(R.id.icon_is_grayscale); Loading Loading @@ -88,17 +87,4 @@ public class NotificationUtils { } return sUseNewInterruptionModel; } /** * Caches and returns the value of the people filtering setting. Cannot change except through * process restarts. */ public static boolean usePeopleFiltering(Context context) { if (sUsePeopleFiltering == null) { sUsePeopleFiltering = context.getResources().getBoolean( R.bool.config_usePeopleFiltering); } return sUsePeopleFiltering; } }