From 202699b2326dfe40df62af822d7bb65a3898fa4f Mon Sep 17 00:00:00 2001 From: shaozhongqi Date: Tue, 3 Dec 2019 17:43:20 +0800 Subject: [PATCH] NotificationService causes watchdog issues and improves performance NotificationComparator will visit settings.db every time it compares , and indirectly calling IntArrayMemory is very time consuming, so the solution is optimized Test: manual - atest NotificationManagerServiceTest and check the logs... Bug:145560121 Change-Id: Ic66c87d65790b408846cb7ed7ab131c58482fe16 Signed-off-by: shaozhongqi --- .../server/notification/NotificationComparator.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/services/core/java/com/android/server/notification/NotificationComparator.java b/services/core/java/com/android/server/notification/NotificationComparator.java index 9b9f4de7a18f1..f295ed37939c9 100644 --- a/services/core/java/com/android/server/notification/NotificationComparator.java +++ b/services/core/java/com/android/server/notification/NotificationComparator.java @@ -23,7 +23,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.provider.Settings; import android.telecom.TelecomManager; import com.android.internal.util.NotificationMessagingUtil; @@ -55,14 +54,9 @@ public class NotificationComparator final boolean isLeftHighImportance = leftImportance >= IMPORTANCE_DEFAULT; final boolean isRightHighImportance = rightImportance >= IMPORTANCE_DEFAULT; - // With new interruption model, prefer importance bucket above all other criteria - // (to ensure buckets are contiguous) - if (Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.NOTIFICATION_NEW_INTERRUPTION_MODEL, 1) == 1) { - if (isLeftHighImportance != isRightHighImportance) { - // by importance bucket, high importance higher than low importance - return -1 * Boolean.compare(isLeftHighImportance, isRightHighImportance); - } + if (isLeftHighImportance != isRightHighImportance) { + // by importance bucket, high importance higher than low importance + return -1 * Boolean.compare(isLeftHighImportance, isRightHighImportance); } // first all colorized notifications