Merge changes from topic "jr-viseffects" into pi-dev
am: 0b4626aa23
Change-Id: I7448e6dd66c5bff50afd996b68030a53a6738842
This commit is contained in:
@@ -16,6 +16,13 @@
|
||||
|
||||
package com.android.systemui.statusbar;
|
||||
|
||||
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT;
|
||||
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
|
||||
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS;
|
||||
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST;
|
||||
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK;
|
||||
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_STATUS_BAR;
|
||||
|
||||
import android.app.AppGlobals;
|
||||
import android.app.AppOpsManager;
|
||||
import android.app.Notification;
|
||||
@@ -445,20 +452,47 @@ public class NotificationData {
|
||||
return Ranking.VISIBILITY_NO_OVERRIDE;
|
||||
}
|
||||
|
||||
public boolean shouldSuppressScreenOff(String key) {
|
||||
public boolean shouldSuppressFullScreenIntent(String key) {
|
||||
if (mRankingMap != null) {
|
||||
getRanking(key, mTmpRanking);
|
||||
return (mTmpRanking.getSuppressedVisualEffects()
|
||||
& NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_OFF) != 0;
|
||||
& SUPPRESSED_EFFECT_FULL_SCREEN_INTENT) != 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldSuppressScreenOn(String key) {
|
||||
public boolean shouldSuppressPeek(String key) {
|
||||
if (mRankingMap != null) {
|
||||
getRanking(key, mTmpRanking);
|
||||
return (mTmpRanking.getSuppressedVisualEffects()
|
||||
& NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_ON) != 0;
|
||||
& SUPPRESSED_EFFECT_PEEK) != 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldSuppressStatusBar(String key) {
|
||||
if (mRankingMap != null) {
|
||||
getRanking(key, mTmpRanking);
|
||||
return (mTmpRanking.getSuppressedVisualEffects()
|
||||
& SUPPRESSED_EFFECT_STATUS_BAR) != 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldSuppressAmbient(String key) {
|
||||
if (mRankingMap != null) {
|
||||
getRanking(key, mTmpRanking);
|
||||
return (mTmpRanking.getSuppressedVisualEffects()
|
||||
& SUPPRESSED_EFFECT_AMBIENT) != 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldSuppressNotificationList(String key) {
|
||||
if (mRankingMap != null) {
|
||||
getRanking(key, mTmpRanking);
|
||||
return (mTmpRanking.getSuppressedVisualEffects()
|
||||
& SUPPRESSED_EFFECT_NOTIFICATION_LIST) != 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -576,6 +610,14 @@ public class NotificationData {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mEnvironment.isDozing() && shouldSuppressAmbient(sbn.getKey())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mEnvironment.isDozing() && shouldSuppressNotificationList(sbn.getKey())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!StatusBar.ENABLE_CHILD_NOTIFICATIONS
|
||||
&& mGroupManager.isChildInGroupWithSummary(sbn)) {
|
||||
return true;
|
||||
@@ -670,5 +712,9 @@ public class NotificationData {
|
||||
public boolean isNotificationForCurrentProfiles(StatusBarNotification sbn);
|
||||
public String getCurrentMediaNotificationKey();
|
||||
public NotificationGroupManager getGroupManager();
|
||||
/**
|
||||
* @return true iff the device is dozing
|
||||
*/
|
||||
boolean isDozing();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,11 +304,7 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater.
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mPowerManager.isInteractive()) {
|
||||
return mNotificationData.shouldSuppressScreenOn(key);
|
||||
} else {
|
||||
return mNotificationData.shouldSuppressScreenOff(key);
|
||||
}
|
||||
return mNotificationData.shouldSuppressFullScreenIntent(key);
|
||||
}
|
||||
|
||||
private void inflateViews(NotificationData.Entry entry, ViewGroup parent) {
|
||||
@@ -849,12 +845,13 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mPresenter.isDozing() && mNotificationData.shouldSuppressScreenOn(sbn.getKey())) {
|
||||
if (!mPresenter.isDozing() && mNotificationData.shouldSuppressPeek(sbn.getKey())) {
|
||||
if (DEBUG) Log.d(TAG, "No peeking: suppressed by DND: " + sbn.getKey());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mPresenter.isDozing() && mNotificationData.shouldSuppressScreenOff(sbn.getKey())) {
|
||||
// Peeking triggers an ambient display pulse, so disable peek is ambient is active
|
||||
if (mPresenter.isDozing() && mNotificationData.shouldSuppressAmbient(sbn.getKey())) {
|
||||
if (DEBUG) Log.d(TAG, "No peeking: suppressed by DND: " + sbn.getKey());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -100,11 +100,6 @@ public interface NotificationPresenter extends NotificationData.Environment,
|
||||
*/
|
||||
void updateNotificationViews();
|
||||
|
||||
/**
|
||||
* @return true iff the device is dozing
|
||||
*/
|
||||
boolean isDozing();
|
||||
|
||||
/**
|
||||
* Returns the maximum number of notifications to show while locked.
|
||||
*
|
||||
|
||||
@@ -141,7 +141,7 @@ public class NotificationIconAreaController implements DarkReceiver {
|
||||
}
|
||||
|
||||
// showAmbient == show in shade but not shelf
|
||||
if (!showAmbient && notificationData.shouldSuppressScreenOn(entry.key)) {
|
||||
if (!showAmbient && notificationData.shouldSuppressStatusBar(entry.key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4603,6 +4603,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
if (mAmbientIndicationContainer instanceof DozeReceiver) {
|
||||
((DozeReceiver) mAmbientIndicationContainer).setDozing(mDozing);
|
||||
}
|
||||
mEntryManager.updateNotifications();
|
||||
updateDozingState();
|
||||
updateReportRejectedTouchVisibility();
|
||||
Trace.endSection();
|
||||
|
||||
@@ -346,7 +346,7 @@ public class StatusBarTest extends SysuiTestCase {
|
||||
public void testShouldPeek_nonSuppressedGroupSummary() {
|
||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
||||
when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(false);
|
||||
when(mNotificationData.shouldSuppressStatusBar(any())).thenReturn(false);
|
||||
when(mNotificationData.shouldFilterOut(any())).thenReturn(false);
|
||||
when(mSystemServicesProxy.isDreaming()).thenReturn(false);
|
||||
when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH);
|
||||
@@ -367,7 +367,7 @@ public class StatusBarTest extends SysuiTestCase {
|
||||
public void testShouldPeek_suppressedGroupSummary() {
|
||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
||||
when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(false);
|
||||
when(mNotificationData.shouldSuppressStatusBar(any())).thenReturn(false);
|
||||
when(mNotificationData.shouldFilterOut(any())).thenReturn(false);
|
||||
when(mSystemServicesProxy.isDreaming()).thenReturn(false);
|
||||
when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH);
|
||||
@@ -385,16 +385,32 @@ public class StatusBarTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShouldPeek_suppressedScreenOn_dozing() {
|
||||
public void testShouldPeek_suppressedPeek() {
|
||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
||||
when(mNotificationData.shouldFilterOut(any())).thenReturn(false);
|
||||
when(mSystemServicesProxy.isDreaming()).thenReturn(false);
|
||||
when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH);
|
||||
|
||||
mStatusBar.mDozing = true;
|
||||
when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(true);
|
||||
when(mNotificationData.shouldSuppressScreenOff(any())).thenReturn(false);
|
||||
when(mNotificationData.shouldSuppressPeek(any())).thenReturn(true);
|
||||
|
||||
Notification n = new Notification.Builder(getContext(), "a").build();
|
||||
StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n,
|
||||
UserHandle.of(0), null, 0);
|
||||
NotificationData.Entry entry = new NotificationData.Entry(sbn);
|
||||
|
||||
assertFalse(mEntryManager.shouldPeek(entry, sbn));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShouldPeek_noSuppressedPeek() {
|
||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
||||
when(mNotificationData.shouldFilterOut(any())).thenReturn(false);
|
||||
when(mSystemServicesProxy.isDreaming()).thenReturn(false);
|
||||
when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH);
|
||||
|
||||
when(mNotificationData.shouldSuppressPeek(any())).thenReturn(false);
|
||||
|
||||
Notification n = new Notification.Builder(getContext(), "a").build();
|
||||
StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n,
|
||||
@@ -404,63 +420,6 @@ public class StatusBarTest extends SysuiTestCase {
|
||||
assertTrue(mEntryManager.shouldPeek(entry, sbn));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShouldPeek_suppressedScreenOn_noDoze() {
|
||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
||||
when(mNotificationData.shouldFilterOut(any())).thenReturn(false);
|
||||
when(mSystemServicesProxy.isDreaming()).thenReturn(false);
|
||||
when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH);
|
||||
|
||||
mStatusBar.mDozing = false;
|
||||
when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(true);
|
||||
when(mNotificationData.shouldSuppressScreenOff(any())).thenReturn(false);
|
||||
|
||||
Notification n = new Notification.Builder(getContext(), "a").build();
|
||||
StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n,
|
||||
UserHandle.of(0), null, 0);
|
||||
NotificationData.Entry entry = new NotificationData.Entry(sbn);
|
||||
assertFalse(mEntryManager.shouldPeek(entry, sbn));
|
||||
}
|
||||
@Test
|
||||
public void testShouldPeek_suppressedScreenOff_dozing() {
|
||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
||||
when(mNotificationData.shouldFilterOut(any())).thenReturn(false);
|
||||
when(mSystemServicesProxy.isDreaming()).thenReturn(false);
|
||||
when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH);
|
||||
|
||||
mStatusBar.mDozing = true;
|
||||
when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(false);
|
||||
when(mNotificationData.shouldSuppressScreenOff(any())).thenReturn(true);
|
||||
|
||||
Notification n = new Notification.Builder(getContext(), "a").build();
|
||||
StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n,
|
||||
UserHandle.of(0), null, 0);
|
||||
NotificationData.Entry entry = new NotificationData.Entry(sbn);
|
||||
assertFalse(mEntryManager.shouldPeek(entry, sbn));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShouldPeek_suppressedScreenOff_noDoze() {
|
||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
||||
when(mNotificationData.shouldFilterOut(any())).thenReturn(false);
|
||||
when(mSystemServicesProxy.isDreaming()).thenReturn(false);
|
||||
when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH);
|
||||
|
||||
mStatusBar.mDozing = false;
|
||||
when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(false);
|
||||
when(mNotificationData.shouldSuppressScreenOff(any())).thenReturn(true);
|
||||
|
||||
Notification n = new Notification.Builder(getContext(), "a").build();
|
||||
StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n,
|
||||
UserHandle.of(0), null, 0);
|
||||
NotificationData.Entry entry = new NotificationData.Entry(sbn);
|
||||
assertTrue(mEntryManager.shouldPeek(entry, sbn));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testLogHidden() {
|
||||
try {
|
||||
@@ -574,6 +533,7 @@ public class StatusBarTest extends SysuiTestCase {
|
||||
public void testFingerprintNotification_UpdatesScrims() {
|
||||
mStatusBar.mStatusBarWindowManager = mock(StatusBarWindowManager.class);
|
||||
mStatusBar.mDozeScrimController = mock(DozeScrimController.class);
|
||||
mStatusBar.mNotificationIconAreaController = mock(NotificationIconAreaController.class);
|
||||
mStatusBar.notifyFpAuthModeChanged();
|
||||
verify(mScrimController).transitionTo(any(), any());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user