Merge "Update notification FSI logic for when device is considered dreaming" into tm-qpr-dev am: 5ac43d6f1c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22075464 Change-Id: Ice971601bb77f6190246b6f5c100452255719226 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -49,6 +49,13 @@ public interface StatusBarStateController {
|
|||||||
*/
|
*/
|
||||||
boolean isPulsing();
|
boolean isPulsing();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is device dreaming. This method is more inclusive than
|
||||||
|
* {@link android.service.dreams.IDreamManager.isDreaming}, as it will return true during the
|
||||||
|
* dream's wake-up phase.
|
||||||
|
*/
|
||||||
|
boolean isDreaming();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a state listener
|
* Adds a state listener
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController.StateList
|
|||||||
import com.android.systemui.shade.ShadeExpansionStateManager;
|
import com.android.systemui.shade.ShadeExpansionStateManager;
|
||||||
import com.android.systemui.statusbar.notification.stack.StackStateAnimator;
|
import com.android.systemui.statusbar.notification.stack.StackStateAnimator;
|
||||||
import com.android.systemui.statusbar.policy.CallbackController;
|
import com.android.systemui.statusbar.policy.CallbackController;
|
||||||
|
import com.android.systemui.util.Compile;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -300,7 +301,7 @@ public class StatusBarStateControllerImpl implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setIsDreaming(boolean isDreaming) {
|
public boolean setIsDreaming(boolean isDreaming) {
|
||||||
if (Log.isLoggable(TAG, Log.DEBUG)) {
|
if (Log.isLoggable(TAG, Log.DEBUG) || Compile.IS_DEBUG) {
|
||||||
Log.d(TAG, "setIsDreaming:" + isDreaming);
|
Log.d(TAG, "setIsDreaming:" + isDreaming);
|
||||||
}
|
}
|
||||||
if (mIsDreaming == isDreaming) {
|
if (mIsDreaming == isDreaming) {
|
||||||
@@ -321,6 +322,11 @@ public class StatusBarStateControllerImpl implements
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDreaming() {
|
||||||
|
return mIsDreaming;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAndInstrumentDozeAmount(View view, float dozeAmount, boolean animated) {
|
public void setAndInstrumentDozeAmount(View view, float dozeAmount, boolean animated) {
|
||||||
if (mDarkAnimator != null && mDarkAnimator.isRunning()) {
|
if (mDarkAnimator != null && mDarkAnimator.isRunning()) {
|
||||||
@@ -581,6 +587,7 @@ public class StatusBarStateControllerImpl implements
|
|||||||
pw.println(" mLeaveOpenOnKeyguardHide=" + mLeaveOpenOnKeyguardHide);
|
pw.println(" mLeaveOpenOnKeyguardHide=" + mLeaveOpenOnKeyguardHide);
|
||||||
pw.println(" mKeyguardRequested=" + mKeyguardRequested);
|
pw.println(" mKeyguardRequested=" + mKeyguardRequested);
|
||||||
pw.println(" mIsDozing=" + mIsDozing);
|
pw.println(" mIsDozing=" + mIsDozing);
|
||||||
|
pw.println(" mIsDreaming=" + mIsDreaming);
|
||||||
pw.println(" mListeners{" + mListeners.size() + "}=");
|
pw.println(" mListeners{" + mListeners.size() + "}=");
|
||||||
for (RankedListener rl : mListeners) {
|
for (RankedListener rl : mListeners) {
|
||||||
pw.println(" " + rl.mListener);
|
pw.println(" " + rl.mListener);
|
||||||
|
|||||||
@@ -28,11 +28,8 @@ import android.database.ContentObserver;
|
|||||||
import android.hardware.display.AmbientDisplayConfiguration;
|
import android.hardware.display.AmbientDisplayConfiguration;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.RemoteException;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.service.dreams.IDreamManager;
|
|
||||||
import android.service.notification.StatusBarNotification;
|
import android.service.notification.StatusBarNotification;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.logging.UiEvent;
|
import com.android.internal.logging.UiEvent;
|
||||||
@@ -67,7 +64,6 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
|
|||||||
private final KeyguardStateController mKeyguardStateController;
|
private final KeyguardStateController mKeyguardStateController;
|
||||||
private final ContentResolver mContentResolver;
|
private final ContentResolver mContentResolver;
|
||||||
private final PowerManager mPowerManager;
|
private final PowerManager mPowerManager;
|
||||||
private final IDreamManager mDreamManager;
|
|
||||||
private final AmbientDisplayConfiguration mAmbientDisplayConfiguration;
|
private final AmbientDisplayConfiguration mAmbientDisplayConfiguration;
|
||||||
private final BatteryController mBatteryController;
|
private final BatteryController mBatteryController;
|
||||||
private final HeadsUpManager mHeadsUpManager;
|
private final HeadsUpManager mHeadsUpManager;
|
||||||
@@ -109,7 +105,6 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
|
|||||||
public NotificationInterruptStateProviderImpl(
|
public NotificationInterruptStateProviderImpl(
|
||||||
ContentResolver contentResolver,
|
ContentResolver contentResolver,
|
||||||
PowerManager powerManager,
|
PowerManager powerManager,
|
||||||
IDreamManager dreamManager,
|
|
||||||
AmbientDisplayConfiguration ambientDisplayConfiguration,
|
AmbientDisplayConfiguration ambientDisplayConfiguration,
|
||||||
BatteryController batteryController,
|
BatteryController batteryController,
|
||||||
StatusBarStateController statusBarStateController,
|
StatusBarStateController statusBarStateController,
|
||||||
@@ -123,7 +118,6 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
|
|||||||
UserTracker userTracker) {
|
UserTracker userTracker) {
|
||||||
mContentResolver = contentResolver;
|
mContentResolver = contentResolver;
|
||||||
mPowerManager = powerManager;
|
mPowerManager = powerManager;
|
||||||
mDreamManager = dreamManager;
|
|
||||||
mBatteryController = batteryController;
|
mBatteryController = batteryController;
|
||||||
mAmbientDisplayConfiguration = ambientDisplayConfiguration;
|
mAmbientDisplayConfiguration = ambientDisplayConfiguration;
|
||||||
mStatusBarStateController = statusBarStateController;
|
mStatusBarStateController = statusBarStateController;
|
||||||
@@ -283,7 +277,9 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the device is currently dreaming, then launch the FullScreenIntent
|
// If the device is currently dreaming, then launch the FullScreenIntent
|
||||||
if (isDreaming()) {
|
// We avoid using IDreamManager#isDreaming here as that method will return false during
|
||||||
|
// the dream's wake-up phase.
|
||||||
|
if (mStatusBarStateController.isDreaming()) {
|
||||||
return getDecisionGivenSuppression(FullScreenIntentDecision.FSI_DEVICE_IS_DREAMING,
|
return getDecisionGivenSuppression(FullScreenIntentDecision.FSI_DEVICE_IS_DREAMING,
|
||||||
suppressedByDND);
|
suppressedByDND);
|
||||||
}
|
}
|
||||||
@@ -383,16 +379,6 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
|
|||||||
mLogger.logFullscreen(entry, "Expected not to HUN");
|
mLogger.logFullscreen(entry, "Expected not to HUN");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDreaming() {
|
|
||||||
try {
|
|
||||||
return mDreamManager.isDreaming();
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
Log.e(TAG, "Failed to query dream manager.", e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean shouldHeadsUpWhenAwake(NotificationEntry entry, boolean log) {
|
private boolean shouldHeadsUpWhenAwake(NotificationEntry entry, boolean log) {
|
||||||
StatusBarNotification sbn = entry.getSbn();
|
StatusBarNotification sbn = entry.getSbn();
|
||||||
|
|
||||||
@@ -442,7 +428,7 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean inUse = mPowerManager.isScreenOn() && !isDreaming();
|
boolean inUse = mPowerManager.isScreenOn() && !mStatusBarStateController.isDreaming();
|
||||||
|
|
||||||
if (!inUse) {
|
if (!inUse) {
|
||||||
if (log) mLogger.logNoHeadsUpNotInUse(entry);
|
if (log) mLogger.logNoHeadsUpNotInUse(entry);
|
||||||
|
|||||||
@@ -167,4 +167,13 @@ class StatusBarStateControllerImplTest : SysuiTestCase() {
|
|||||||
controller.setIsDreaming(false)
|
controller.setIsDreaming(false)
|
||||||
verify(listener).onDreamingChanged(false)
|
verify(listener).onDreamingChanged(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testSetDreamState_getterReturnsCurrentState() {
|
||||||
|
controller.setIsDreaming(true)
|
||||||
|
assertTrue(controller.isDreaming())
|
||||||
|
|
||||||
|
controller.setIsDreaming(false)
|
||||||
|
assertFalse(controller.isDreaming())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ import android.hardware.display.AmbientDisplayConfiguration;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.service.dreams.IDreamManager;
|
|
||||||
import android.testing.AndroidTestingRunner;
|
import android.testing.AndroidTestingRunner;
|
||||||
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
@@ -87,8 +86,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
@Mock
|
@Mock
|
||||||
PowerManager mPowerManager;
|
PowerManager mPowerManager;
|
||||||
@Mock
|
@Mock
|
||||||
IDreamManager mDreamManager;
|
|
||||||
@Mock
|
|
||||||
AmbientDisplayConfiguration mAmbientDisplayConfiguration;
|
AmbientDisplayConfiguration mAmbientDisplayConfiguration;
|
||||||
@Mock
|
@Mock
|
||||||
StatusBarStateController mStatusBarStateController;
|
StatusBarStateController mStatusBarStateController;
|
||||||
@@ -126,7 +123,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
new NotificationInterruptStateProviderImpl(
|
new NotificationInterruptStateProviderImpl(
|
||||||
mContext.getContentResolver(),
|
mContext.getContentResolver(),
|
||||||
mPowerManager,
|
mPowerManager,
|
||||||
mDreamManager,
|
|
||||||
mAmbientDisplayConfiguration,
|
mAmbientDisplayConfiguration,
|
||||||
mBatteryController,
|
mBatteryController,
|
||||||
mStatusBarStateController,
|
mStatusBarStateController,
|
||||||
@@ -150,7 +146,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
when(mHeadsUpManager.isSnoozed(any())).thenReturn(false);
|
when(mHeadsUpManager.isSnoozed(any())).thenReturn(false);
|
||||||
|
|
||||||
when(mStatusBarStateController.isDozing()).thenReturn(false);
|
when(mStatusBarStateController.isDozing()).thenReturn(false);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,7 +348,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// Also not in use if screen is on but we're showing screen saver / "dreaming"
|
// Also not in use if screen is on but we're showing screen saver / "dreaming"
|
||||||
when(mPowerManager.isDeviceIdleMode()).thenReturn(true);
|
when(mPowerManager.isDeviceIdleMode()).thenReturn(true);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(true);
|
when(mStatusBarStateController.isDreaming()).thenReturn(true);
|
||||||
assertThat(mNotifInterruptionStateProvider.shouldHeadsUp(entry)).isFalse();
|
assertThat(mNotifInterruptionStateProvider.shouldHeadsUp(entry)).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,7 +528,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
public void testShouldNotFullScreen_notPendingIntent() throws RemoteException {
|
public void testShouldNotFullScreen_notPendingIntent() throws RemoteException {
|
||||||
NotificationEntry entry = createNotification(IMPORTANCE_HIGH);
|
NotificationEntry entry = createNotification(IMPORTANCE_HIGH);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(true);
|
when(mPowerManager.isInteractive()).thenReturn(true);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
||||||
|
|
||||||
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
||||||
@@ -551,7 +547,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
.setSuppressedVisualEffects(SUPPRESSED_EFFECT_FULL_SCREEN_INTENT)
|
.setSuppressedVisualEffects(SUPPRESSED_EFFECT_FULL_SCREEN_INTENT)
|
||||||
.build();
|
.build();
|
||||||
when(mPowerManager.isInteractive()).thenReturn(false);
|
when(mPowerManager.isInteractive()).thenReturn(false);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
||||||
|
|
||||||
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
||||||
@@ -570,7 +566,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
.setSuppressedVisualEffects(SUPPRESSED_EFFECT_FULL_SCREEN_INTENT)
|
.setSuppressedVisualEffects(SUPPRESSED_EFFECT_FULL_SCREEN_INTENT)
|
||||||
.build();
|
.build();
|
||||||
when(mPowerManager.isInteractive()).thenReturn(false);
|
when(mPowerManager.isInteractive()).thenReturn(false);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
||||||
|
|
||||||
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
||||||
@@ -592,7 +588,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
public void testShouldNotFullScreen_notHighImportance() throws RemoteException {
|
public void testShouldNotFullScreen_notHighImportance() throws RemoteException {
|
||||||
NotificationEntry entry = createFsiNotification(IMPORTANCE_DEFAULT, /* silenced */ false);
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_DEFAULT, /* silenced */ false);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(true);
|
when(mPowerManager.isInteractive()).thenReturn(true);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
||||||
|
|
||||||
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
||||||
@@ -614,7 +610,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
public void testShouldNotFullScreen_isGroupAlertSilenced() throws RemoteException {
|
public void testShouldNotFullScreen_isGroupAlertSilenced() throws RemoteException {
|
||||||
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ true);
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ true);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(false);
|
when(mPowerManager.isInteractive()).thenReturn(false);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(true);
|
when(mStatusBarStateController.isDreaming()).thenReturn(true);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(KEYGUARD);
|
when(mStatusBarStateController.getState()).thenReturn(KEYGUARD);
|
||||||
|
|
||||||
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
||||||
@@ -643,7 +639,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
public void testShouldFullScreen_notInteractive() throws RemoteException {
|
public void testShouldFullScreen_notInteractive() throws RemoteException {
|
||||||
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(false);
|
when(mPowerManager.isInteractive()).thenReturn(false);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
||||||
|
|
||||||
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
||||||
@@ -665,7 +661,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
public void testShouldFullScreen_isDreaming() throws RemoteException {
|
public void testShouldFullScreen_isDreaming() throws RemoteException {
|
||||||
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(true);
|
when(mPowerManager.isInteractive()).thenReturn(true);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(true);
|
when(mStatusBarStateController.isDreaming()).thenReturn(true);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
||||||
|
|
||||||
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
||||||
@@ -687,7 +683,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
public void testShouldFullScreen_onKeyguard() throws RemoteException {
|
public void testShouldFullScreen_onKeyguard() throws RemoteException {
|
||||||
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(true);
|
when(mPowerManager.isInteractive()).thenReturn(true);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(KEYGUARD);
|
when(mStatusBarStateController.getState()).thenReturn(KEYGUARD);
|
||||||
|
|
||||||
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
||||||
@@ -710,7 +706,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(true);
|
when(mPowerManager.isInteractive()).thenReturn(true);
|
||||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
||||||
|
|
||||||
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry))
|
||||||
@@ -727,7 +723,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(true);
|
when(mPowerManager.isInteractive()).thenReturn(true);
|
||||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
||||||
when(mHeadsUpManager.isSnoozed("a")).thenReturn(true);
|
when(mHeadsUpManager.isSnoozed("a")).thenReturn(true);
|
||||||
|
|
||||||
@@ -746,7 +742,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(true);
|
when(mPowerManager.isInteractive()).thenReturn(true);
|
||||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
||||||
when(mHeadsUpManager.isSnoozed("a")).thenReturn(true);
|
when(mHeadsUpManager.isSnoozed("a")).thenReturn(true);
|
||||||
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||||
@@ -767,7 +763,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(true);
|
when(mPowerManager.isInteractive()).thenReturn(true);
|
||||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
||||||
when(mHeadsUpManager.isSnoozed("a")).thenReturn(true);
|
when(mHeadsUpManager.isSnoozed("a")).thenReturn(true);
|
||||||
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||||
@@ -792,7 +788,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(true);
|
when(mPowerManager.isInteractive()).thenReturn(true);
|
||||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE_LOCKED);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE_LOCKED);
|
||||||
when(mHeadsUpManager.isSnoozed("a")).thenReturn(true);
|
when(mHeadsUpManager.isSnoozed("a")).thenReturn(true);
|
||||||
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||||
@@ -813,7 +809,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(true);
|
when(mPowerManager.isInteractive()).thenReturn(true);
|
||||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE_LOCKED);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE_LOCKED);
|
||||||
when(mHeadsUpManager.isSnoozed("a")).thenReturn(true);
|
when(mHeadsUpManager.isSnoozed("a")).thenReturn(true);
|
||||||
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||||
@@ -838,7 +834,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(true);
|
when(mPowerManager.isInteractive()).thenReturn(true);
|
||||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
||||||
when(mHeadsUpManager.isSnoozed("a")).thenReturn(true);
|
when(mHeadsUpManager.isSnoozed("a")).thenReturn(true);
|
||||||
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
||||||
@@ -859,7 +855,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(true);
|
when(mPowerManager.isInteractive()).thenReturn(true);
|
||||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
||||||
when(mHeadsUpManager.isSnoozed("a")).thenReturn(true);
|
when(mHeadsUpManager.isSnoozed("a")).thenReturn(true);
|
||||||
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
||||||
|
|||||||
@@ -337,7 +337,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
|||||||
mNotificationInterruptStateProvider =
|
mNotificationInterruptStateProvider =
|
||||||
new TestableNotificationInterruptStateProviderImpl(mContext.getContentResolver(),
|
new TestableNotificationInterruptStateProviderImpl(mContext.getContentResolver(),
|
||||||
mPowerManager,
|
mPowerManager,
|
||||||
mDreamManager,
|
|
||||||
mAmbientDisplayConfiguration,
|
mAmbientDisplayConfiguration,
|
||||||
mStatusBarStateController,
|
mStatusBarStateController,
|
||||||
mKeyguardStateController,
|
mKeyguardStateController,
|
||||||
@@ -719,7 +718,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
|||||||
public void testShouldHeadsUp_nonSuppressedGroupSummary() throws Exception {
|
public void testShouldHeadsUp_nonSuppressedGroupSummary() throws Exception {
|
||||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||||
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
|
|
||||||
Notification n = new Notification.Builder(getContext(), "a")
|
Notification n = new Notification.Builder(getContext(), "a")
|
||||||
.setGroup("a")
|
.setGroup("a")
|
||||||
@@ -742,7 +741,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
|||||||
public void testShouldHeadsUp_suppressedGroupSummary() throws Exception {
|
public void testShouldHeadsUp_suppressedGroupSummary() throws Exception {
|
||||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||||
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
|
|
||||||
Notification n = new Notification.Builder(getContext(), "a")
|
Notification n = new Notification.Builder(getContext(), "a")
|
||||||
.setGroup("a")
|
.setGroup("a")
|
||||||
@@ -765,7 +764,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
|||||||
public void testShouldHeadsUp_suppressedHeadsUp() throws Exception {
|
public void testShouldHeadsUp_suppressedHeadsUp() throws Exception {
|
||||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||||
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
|
|
||||||
Notification n = new Notification.Builder(getContext(), "a").build();
|
Notification n = new Notification.Builder(getContext(), "a").build();
|
||||||
|
|
||||||
@@ -786,7 +785,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
|||||||
public void testShouldHeadsUp_noSuppressedHeadsUp() throws Exception {
|
public void testShouldHeadsUp_noSuppressedHeadsUp() throws Exception {
|
||||||
when(mPowerManager.isScreenOn()).thenReturn(true);
|
when(mPowerManager.isScreenOn()).thenReturn(true);
|
||||||
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mStatusBarStateController.isDreaming()).thenReturn(false);
|
||||||
|
|
||||||
Notification n = new Notification.Builder(getContext(), "a").build();
|
Notification n = new Notification.Builder(getContext(), "a").build();
|
||||||
|
|
||||||
@@ -1345,7 +1344,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
|||||||
TestableNotificationInterruptStateProviderImpl(
|
TestableNotificationInterruptStateProviderImpl(
|
||||||
ContentResolver contentResolver,
|
ContentResolver contentResolver,
|
||||||
PowerManager powerManager,
|
PowerManager powerManager,
|
||||||
IDreamManager dreamManager,
|
|
||||||
AmbientDisplayConfiguration ambientDisplayConfiguration,
|
AmbientDisplayConfiguration ambientDisplayConfiguration,
|
||||||
StatusBarStateController controller,
|
StatusBarStateController controller,
|
||||||
KeyguardStateController keyguardStateController,
|
KeyguardStateController keyguardStateController,
|
||||||
@@ -1360,7 +1358,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
|||||||
super(
|
super(
|
||||||
contentResolver,
|
contentResolver,
|
||||||
powerManager,
|
powerManager,
|
||||||
dreamManager,
|
|
||||||
ambientDisplayConfiguration,
|
ambientDisplayConfiguration,
|
||||||
batteryController,
|
batteryController,
|
||||||
controller,
|
controller,
|
||||||
|
|||||||
@@ -355,7 +355,6 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
TestableNotificationInterruptStateProviderImpl interruptionStateProvider =
|
TestableNotificationInterruptStateProviderImpl interruptionStateProvider =
|
||||||
new TestableNotificationInterruptStateProviderImpl(mContext.getContentResolver(),
|
new TestableNotificationInterruptStateProviderImpl(mContext.getContentResolver(),
|
||||||
mock(PowerManager.class),
|
mock(PowerManager.class),
|
||||||
mock(IDreamManager.class),
|
|
||||||
mock(AmbientDisplayConfiguration.class),
|
mock(AmbientDisplayConfiguration.class),
|
||||||
mock(StatusBarStateController.class),
|
mock(StatusBarStateController.class),
|
||||||
mock(KeyguardStateController.class),
|
mock(KeyguardStateController.class),
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import android.content.ContentResolver;
|
|||||||
import android.hardware.display.AmbientDisplayConfiguration;
|
import android.hardware.display.AmbientDisplayConfiguration;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.service.dreams.IDreamManager;
|
|
||||||
|
|
||||||
import com.android.internal.logging.UiEventLogger;
|
import com.android.internal.logging.UiEventLogger;
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
@@ -39,7 +38,6 @@ public class TestableNotificationInterruptStateProviderImpl
|
|||||||
TestableNotificationInterruptStateProviderImpl(
|
TestableNotificationInterruptStateProviderImpl(
|
||||||
ContentResolver contentResolver,
|
ContentResolver contentResolver,
|
||||||
PowerManager powerManager,
|
PowerManager powerManager,
|
||||||
IDreamManager dreamManager,
|
|
||||||
AmbientDisplayConfiguration ambientDisplayConfiguration,
|
AmbientDisplayConfiguration ambientDisplayConfiguration,
|
||||||
StatusBarStateController statusBarStateController,
|
StatusBarStateController statusBarStateController,
|
||||||
KeyguardStateController keyguardStateController,
|
KeyguardStateController keyguardStateController,
|
||||||
@@ -53,7 +51,6 @@ public class TestableNotificationInterruptStateProviderImpl
|
|||||||
UserTracker userTracker) {
|
UserTracker userTracker) {
|
||||||
super(contentResolver,
|
super(contentResolver,
|
||||||
powerManager,
|
powerManager,
|
||||||
dreamManager,
|
|
||||||
ambientDisplayConfiguration,
|
ambientDisplayConfiguration,
|
||||||
batteryController,
|
batteryController,
|
||||||
statusBarStateController,
|
statusBarStateController,
|
||||||
|
|||||||
Reference in New Issue
Block a user