summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Julia Reynolds <juliacr@google.com> 2016-02-17 20:19:01 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-02-17 20:19:02 +0000
commitaef37e426b56d2047d2ec172a1123d8e35145a0c (patch)
tree2b37af59a48c41915027a85f2f14a08d814a2eae
parentc86f234c51ebcb78164d850177eb2143112f9f65 (diff)
parent83fa1073f577333e7f25ca8bc5ce1c13d4c6d9e5 (diff)
Merge "Increase the importance of noisy notifications." into nyc-dev
-rw-r--r--services/core/java/com/android/server/notification/NotificationRecord.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationRecord.java b/services/core/java/com/android/server/notification/NotificationRecord.java
index 484b0e95b359..12c70a3fa83d 100644
--- a/services/core/java/com/android/server/notification/NotificationRecord.java
+++ b/services/core/java/com/android/server/notification/NotificationRecord.java
@@ -23,11 +23,13 @@ import static android.service.notification.NotificationListenerService.Ranking.I
import android.app.Notification;
import android.content.Context;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.Icon;
import android.media.AudioAttributes;
+import android.os.Build;
import android.os.UserHandle;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
@@ -146,6 +148,22 @@ public final class NotificationRecord {
importance = IMPORTANCE_DEFAULT;
}
+ try {
+ final ApplicationInfo applicationInfo = mContext.getPackageManager().getApplicationInfo(
+ sbn.getPackageName(), 0);
+ if (applicationInfo.targetSdkVersion < Build.VERSION_CODES.N) {
+ if (isNoisy) {
+ if (importance >= IMPORTANCE_HIGH) {
+ importance = IMPORTANCE_MAX;
+ } else {
+ importance = IMPORTANCE_HIGH;
+ }
+ }
+ }
+ } catch (NameNotFoundException e) {
+ // oh well.
+ }
+
if (n.fullScreenIntent != null) {
importance = IMPORTANCE_MAX;
}