Limit when a ranking reconsidering can alert
Otherwise notifications that were silenced by DND that still exist when DND is turned off can re-alert. Test: StatusBarTest, "with zen". No alerts should happen within ~10 seconds of starting the test Change-Id: I9e58118c0a40e0d4f1bafb0913e569b560879ba2 Fixes: 62355996
This commit is contained in:
@@ -4194,16 +4194,19 @@ public class NotificationManagerService extends SystemService {
|
||||
}
|
||||
int indexBefore = findNotificationRecordIndexLocked(record);
|
||||
boolean interceptBefore = record.isIntercepted();
|
||||
float contactAffinityBefore = record.getContactAffinity();
|
||||
int visibilityBefore = record.getPackageVisibilityOverride();
|
||||
recon.applyChangesLocked(record);
|
||||
applyZenModeLocked(record);
|
||||
mRankingHelper.sort(mNotificationList);
|
||||
int indexAfter = findNotificationRecordIndexLocked(record);
|
||||
boolean interceptAfter = record.isIntercepted();
|
||||
float contactAffinityAfter = record.getContactAffinity();
|
||||
int visibilityAfter = record.getPackageVisibilityOverride();
|
||||
changed = indexBefore != indexAfter || interceptBefore != interceptAfter
|
||||
|| visibilityBefore != visibilityAfter;
|
||||
if (interceptBefore && !interceptAfter) {
|
||||
if (interceptBefore && !interceptAfter
|
||||
&& Float.compare(contactAffinityBefore, contactAffinityAfter) != 0) {
|
||||
buzzBeepBlinkLocked(record);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
|
||||
<uses-permission android:name="android.permission.MANAGE_NOTIFICATIONS" />
|
||||
|
||||
<application>
|
||||
<activity android:name="StatusBarTest" android:label="_StatusBar">
|
||||
|
||||
@@ -129,6 +129,24 @@ public class NotificationTestList extends TestActivity
|
||||
mNM.notify(7001, n);
|
||||
}
|
||||
},
|
||||
new Test("with zen") {
|
||||
public void run()
|
||||
{
|
||||
mNM.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_ALARMS);
|
||||
Notification n = new Notification.Builder(NotificationTestList.this,
|
||||
"default")
|
||||
.setSmallIcon(R.drawable.icon2)
|
||||
.setContentTitle("Default priority")
|
||||
.build();
|
||||
mNM.notify("default", 7004, n);
|
||||
try {
|
||||
Thread.sleep(8000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mNM.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_ALL);
|
||||
}
|
||||
},
|
||||
new Test("repeated") {
|
||||
public void run()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user