Merge "Allow user-prioritized packages through in priority mode." into lmp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
fdfd4f8f83
@@ -211,7 +211,7 @@ public final class NotificationRecord {
|
||||
}
|
||||
|
||||
public void setPackagePriority(int packagePriority) {
|
||||
mPackagePriority = packagePriority;
|
||||
mPackagePriority = packagePriority;
|
||||
}
|
||||
|
||||
public int getPackagePriority() {
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.android.server.notification;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.content.Context;
|
||||
import android.util.Slog;
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ public class ZenLog {
|
||||
private static final int TYPE_UNSUBSCRIBE = 8;
|
||||
private static final int TYPE_CONFIG = 9;
|
||||
private static final int TYPE_FOLLOW_RINGER_MODE = 10;
|
||||
private static final int TYPE_NOT_INTERCEPTED = 11;
|
||||
|
||||
private static int sNext;
|
||||
private static int sSize;
|
||||
@@ -67,6 +68,11 @@ public class ZenLog {
|
||||
append(TYPE_INTERCEPTED, record.getKey() + "," + reason);
|
||||
}
|
||||
|
||||
public static void traceNotIntercepted(NotificationRecord record, String reason) {
|
||||
if (record != null && record.isUpdate) return; // already logged
|
||||
append(TYPE_NOT_INTERCEPTED, record.getKey() + "," + reason);
|
||||
}
|
||||
|
||||
public static void traceAllowDisable(String pkg, boolean allowDisable, String reason) {
|
||||
if (SYSTEM_PACKAGES.contains(pkg)) return;
|
||||
append(TYPE_ALLOW_DISABLE, allowDisable + "," + pkg + "," + reason);
|
||||
@@ -122,6 +128,7 @@ public class ZenLog {
|
||||
case TYPE_UNSUBSCRIBE: return "unsubscribe";
|
||||
case TYPE_CONFIG: return "config";
|
||||
case TYPE_FOLLOW_RINGER_MODE: return "follow_ringer_mode";
|
||||
case TYPE_NOT_INTERCEPTED: return "not_intercepted";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +137,13 @@ public class ZenModeHelper {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// allow user-prioritized packages through in priority mode
|
||||
if (mZenMode == Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS) {
|
||||
if (record.getPackagePriority() == Notification.PRIORITY_MAX) {
|
||||
ZenLog.traceNotIntercepted(record, "priorityApp");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// audience has veto power over all following rules
|
||||
if (!audienceMatches(record)) {
|
||||
ZenLog.traceIntercepted(record, "!audienceMatches");
|
||||
|
||||
Reference in New Issue
Block a user