Merge "remove special case code for groups." into nyc-dev
This commit is contained in:
@@ -2543,18 +2543,13 @@ public class NotificationManagerService extends SystemService {
|
|||||||
// Handle grouped notifications and bail out early if we
|
// Handle grouped notifications and bail out early if we
|
||||||
// can to avoid extracting signals.
|
// can to avoid extracting signals.
|
||||||
handleGroupedNotificationLocked(r, old, callingUid, callingPid);
|
handleGroupedNotificationLocked(r, old, callingUid, callingPid);
|
||||||
boolean ignoreNotification =
|
|
||||||
removeUnusedGroupedNotificationLocked(r, old, callingUid, callingPid);
|
|
||||||
if (DBG) Slog.d(TAG, "ignoreNotification is " + ignoreNotification);
|
|
||||||
|
|
||||||
// This conditional is a dirty hack to limit the logging done on
|
// This conditional is a dirty hack to limit the logging done on
|
||||||
// behalf of the download manager without affecting other apps.
|
// behalf of the download manager without affecting other apps.
|
||||||
if (!pkg.equals("com.android.providers.downloads")
|
if (!pkg.equals("com.android.providers.downloads")
|
||||||
|| Log.isLoggable("DownloadManager", Log.VERBOSE)) {
|
|| Log.isLoggable("DownloadManager", Log.VERBOSE)) {
|
||||||
int enqueueStatus = EVENTLOG_ENQUEUE_STATUS_NEW;
|
int enqueueStatus = EVENTLOG_ENQUEUE_STATUS_NEW;
|
||||||
if (ignoreNotification) {
|
if (old != null) {
|
||||||
enqueueStatus = EVENTLOG_ENQUEUE_STATUS_IGNORED;
|
|
||||||
} else if (old != null) {
|
|
||||||
enqueueStatus = EVENTLOG_ENQUEUE_STATUS_UPDATE;
|
enqueueStatus = EVENTLOG_ENQUEUE_STATUS_UPDATE;
|
||||||
}
|
}
|
||||||
EventLogTags.writeNotificationEnqueue(callingUid, callingPid,
|
EventLogTags.writeNotificationEnqueue(callingUid, callingPid,
|
||||||
@@ -2562,10 +2557,6 @@ public class NotificationManagerService extends SystemService {
|
|||||||
enqueueStatus);
|
enqueueStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ignoreNotification) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mRankingHelper.extractSignals(r);
|
mRankingHelper.extractSignals(r);
|
||||||
|
|
||||||
final boolean isPackageSuspended = isPackageSuspendedForUser(pkg, callingUid);
|
final boolean isPackageSuspended = isPackageSuspendedForUser(pkg, callingUid);
|
||||||
@@ -2681,58 +2672,6 @@ public class NotificationManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Performs group notification optimizations if SysUI is the only active
|
|
||||||
* notification listener and returns whether the given notification should
|
|
||||||
* be ignored.
|
|
||||||
*
|
|
||||||
* <p>Returns true if the given notification is a child of a group with a
|
|
||||||
* summary, which means that SysUI will never show it, and hence the new
|
|
||||||
* notification can be safely ignored. Also cancels any previous instance
|
|
||||||
* of the ignored notification.</p>
|
|
||||||
*
|
|
||||||
* <p>For summaries, cancels all children of that group, as SysUI will
|
|
||||||
* never show them anymore.</p>
|
|
||||||
*
|
|
||||||
* @return true if the given notification can be ignored as an optimization
|
|
||||||
*/
|
|
||||||
private boolean removeUnusedGroupedNotificationLocked(NotificationRecord r,
|
|
||||||
NotificationRecord old, int callingUid, int callingPid) {
|
|
||||||
if (!ENABLE_CHILD_NOTIFICATIONS) {
|
|
||||||
// No optimizations are possible if listeners want groups.
|
|
||||||
if (mListeners.notificationGroupsDesired()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
StatusBarNotification sbn = r.sbn;
|
|
||||||
String group = sbn.getGroupKey();
|
|
||||||
boolean isSummary = sbn.getNotification().isGroupSummary();
|
|
||||||
boolean isChild = !isSummary && sbn.isGroup();
|
|
||||||
|
|
||||||
NotificationRecord summary = mSummaryByGroupKey.get(group);
|
|
||||||
if (isChild && summary != null) {
|
|
||||||
// Child with an active summary -> ignore
|
|
||||||
if (DBG) {
|
|
||||||
Slog.d(TAG, "Ignoring group child " + sbn.getKey() + " due to existing summary "
|
|
||||||
+ summary.getKey());
|
|
||||||
}
|
|
||||||
// Make sure we don't leave an old version of the notification around.
|
|
||||||
if (old != null) {
|
|
||||||
if (DBG) {
|
|
||||||
Slog.d(TAG, "Canceling old version of ignored group child " + sbn.getKey());
|
|
||||||
}
|
|
||||||
cancelNotificationLocked(old, false, REASON_GROUP_OPTIMIZATION);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else if (isSummary) {
|
|
||||||
// Summary -> cancel children
|
|
||||||
cancelGroupChildrenLocked(r, callingUid, callingPid, null,
|
|
||||||
REASON_GROUP_OPTIMIZATION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void buzzBeepBlinkLocked(NotificationRecord record) {
|
void buzzBeepBlinkLocked(NotificationRecord record) {
|
||||||
boolean buzz = false;
|
boolean buzz = false;
|
||||||
@@ -3869,7 +3808,6 @@ public class NotificationManagerService extends SystemService {
|
|||||||
public class NotificationListeners extends ManagedServices {
|
public class NotificationListeners extends ManagedServices {
|
||||||
|
|
||||||
private final ArraySet<ManagedServiceInfo> mLightTrimListeners = new ArraySet<>();
|
private final ArraySet<ManagedServiceInfo> mLightTrimListeners = new ArraySet<>();
|
||||||
private boolean mNotificationGroupsDesired;
|
|
||||||
|
|
||||||
public NotificationListeners() {
|
public NotificationListeners() {
|
||||||
super(getContext(), mHandler, mNotificationList, mUserProfiles);
|
super(getContext(), mHandler, mNotificationList, mUserProfiles);
|
||||||
@@ -3902,7 +3840,6 @@ public class NotificationManagerService extends SystemService {
|
|||||||
final INotificationListener listener = (INotificationListener) info.service;
|
final INotificationListener listener = (INotificationListener) info.service;
|
||||||
final NotificationRankingUpdate update;
|
final NotificationRankingUpdate update;
|
||||||
synchronized (mNotificationList) {
|
synchronized (mNotificationList) {
|
||||||
updateNotificationGroupsDesiredLocked();
|
|
||||||
update = makeRankingUpdateLocked(info);
|
update = makeRankingUpdateLocked(info);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -3919,7 +3856,6 @@ public class NotificationManagerService extends SystemService {
|
|||||||
updateEffectsSuppressorLocked();
|
updateEffectsSuppressorLocked();
|
||||||
}
|
}
|
||||||
mLightTrimListeners.remove(removed);
|
mLightTrimListeners.remove(removed);
|
||||||
updateNotificationGroupsDesiredLocked();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnNotificationPostedTrimLocked(ManagedServiceInfo info, int trim) {
|
public void setOnNotificationPostedTrimLocked(ManagedServiceInfo info, int trim) {
|
||||||
@@ -4112,31 +4048,6 @@ public class NotificationManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether any of the currently registered listeners wants to receive notification
|
|
||||||
* groups.
|
|
||||||
*
|
|
||||||
* <p>Currently we assume groups are desired by non-SystemUI listeners.</p>
|
|
||||||
*/
|
|
||||||
public boolean notificationGroupsDesired() {
|
|
||||||
return mNotificationGroupsDesired;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateNotificationGroupsDesiredLocked() {
|
|
||||||
mNotificationGroupsDesired = true;
|
|
||||||
// No listeners, no groups.
|
|
||||||
if (mServices.isEmpty()) {
|
|
||||||
mNotificationGroupsDesired = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// One listener: Check whether it's SysUI.
|
|
||||||
if (mServices.size() == 1 &&
|
|
||||||
mServices.get(0).component.getPackageName().equals("com.android.systemui")) {
|
|
||||||
mNotificationGroupsDesired = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class DumpFilter {
|
public static final class DumpFilter {
|
||||||
|
|||||||
Reference in New Issue
Block a user