Merge "Wakeup the screen for full screen intents" into sc-v2-dev am: 35185d54b4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16307918 Change-Id: I7545c9f6c2afc89204f819a6da2eb8ad81816d72
This commit is contained in:
@@ -1987,7 +1987,7 @@ public class StatusBar extends SystemUI implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void maybeEscalateHeadsUp() {
|
private void maybeEscalateHeadsUp() {
|
||||||
mHeadsUpManager.getAllEntries().forEach(entry -> {
|
mHeadsUpManager.getAllEntries().forEach(entry -> {
|
||||||
final StatusBarNotification sbn = entry.getSbn();
|
final StatusBarNotification sbn = entry.getSbn();
|
||||||
final Notification notification = sbn.getNotification();
|
final Notification notification = sbn.getNotification();
|
||||||
@@ -1998,6 +1998,7 @@ public class StatusBar extends SystemUI implements
|
|||||||
try {
|
try {
|
||||||
EventLog.writeEvent(EventLogTags.SYSUI_HEADS_UP_ESCALATION,
|
EventLog.writeEvent(EventLogTags.SYSUI_HEADS_UP_ESCALATION,
|
||||||
sbn.getKey());
|
sbn.getKey());
|
||||||
|
wakeUpForFullScreenIntent();
|
||||||
notification.fullScreenIntent.send();
|
notification.fullScreenIntent.send();
|
||||||
entry.notifyFullScreenIntentLaunched();
|
entry.notifyFullScreenIntentLaunched();
|
||||||
} catch (PendingIntent.CanceledException e) {
|
} catch (PendingIntent.CanceledException e) {
|
||||||
@@ -2007,6 +2008,17 @@ public class StatusBar extends SystemUI implements
|
|||||||
mHeadsUpManager.releaseAllImmediately();
|
mHeadsUpManager.releaseAllImmediately();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wakeUpForFullScreenIntent() {
|
||||||
|
if (isGoingToSleep() || mDozing) {
|
||||||
|
mPowerManager.wakeUp(
|
||||||
|
SystemClock.uptimeMillis(),
|
||||||
|
PowerManager.WAKE_REASON_APPLICATION,
|
||||||
|
"com.android.systemui:full_screen_intent");
|
||||||
|
mWakeUpComingFromTouch = false;
|
||||||
|
mWakeUpTouchLocation = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void makeExpandedVisible(boolean force) {
|
void makeExpandedVisible(boolean force) {
|
||||||
if (SPEW) Log.d(TAG, "Make expanded visible: expanded visible=" + mExpandedVisible);
|
if (SPEW) Log.d(TAG, "Make expanded visible: expanded visible=" + mExpandedVisible);
|
||||||
if (!force && (mExpandedVisible || !mCommandQueue.panelsEnabled())) {
|
if (!force && (mExpandedVisible || !mCommandQueue.panelsEnabled())) {
|
||||||
@@ -3536,7 +3548,7 @@ public class StatusBar extends SystemUI implements
|
|||||||
DejankUtils.startDetectingBlockingIpcs(tag);
|
DejankUtils.startDetectingBlockingIpcs(tag);
|
||||||
updateRevealEffect(false /* wakingUp */);
|
updateRevealEffect(false /* wakingUp */);
|
||||||
updateNotificationPanelTouchState();
|
updateNotificationPanelTouchState();
|
||||||
notifyHeadsUpGoingToSleep();
|
maybeEscalateHeadsUp();
|
||||||
dismissVolumeDialog();
|
dismissVolumeDialog();
|
||||||
mWakeUpCoordinator.setFullyAwake(false);
|
mWakeUpCoordinator.setFullyAwake(false);
|
||||||
mBypassHeadsUpNotifier.setFullyAwake(false);
|
mBypassHeadsUpNotifier.setFullyAwake(false);
|
||||||
@@ -4081,10 +4093,6 @@ public class StatusBar extends SystemUI implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void notifyHeadsUpGoingToSleep() {
|
|
||||||
maybeEscalateHeadsUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Whether the security bouncer from Keyguard is showing.
|
* @return Whether the security bouncer from Keyguard is showing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ import android.text.TextUtils;
|
|||||||
import android.util.EventLog;
|
import android.util.EventLog;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import com.android.internal.jank.InteractionJankMonitor;
|
import com.android.internal.jank.InteractionJankMonitor;
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
import com.android.internal.statusbar.NotificationVisibility;
|
import com.android.internal.statusbar.NotificationVisibility;
|
||||||
@@ -593,7 +595,8 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleFullScreenIntent(NotificationEntry entry) {
|
@VisibleForTesting
|
||||||
|
void handleFullScreenIntent(NotificationEntry entry) {
|
||||||
if (mNotificationInterruptStateProvider.shouldLaunchFullScreenIntentWhenAdded(entry)) {
|
if (mNotificationInterruptStateProvider.shouldLaunchFullScreenIntentWhenAdded(entry)) {
|
||||||
if (shouldSuppressFullScreenIntent(entry)) {
|
if (shouldSuppressFullScreenIntent(entry)) {
|
||||||
mLogger.logFullScreenIntentSuppressedByDnD(entry.getKey());
|
mLogger.logFullScreenIntentSuppressedByDnD(entry.getKey());
|
||||||
@@ -617,6 +620,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
|
|||||||
try {
|
try {
|
||||||
EventLog.writeEvent(EventLogTags.SYSUI_FULLSCREEN_NOTIFICATION,
|
EventLog.writeEvent(EventLogTags.SYSUI_FULLSCREEN_NOTIFICATION,
|
||||||
entry.getKey());
|
entry.getKey());
|
||||||
|
mStatusBar.wakeUpForFullScreenIntent();
|
||||||
fullscreenIntent.send();
|
fullscreenIntent.send();
|
||||||
entry.notifyFullScreenIntentLaunched();
|
entry.notifyFullScreenIntentLaunched();
|
||||||
mMetricsLogger.count("note_fullscreen", 1);
|
mMetricsLogger.count("note_fullscreen", 1);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import static org.mockito.Mockito.when;
|
|||||||
|
|
||||||
import android.app.KeyguardManager;
|
import android.app.KeyguardManager;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
|
import android.app.NotificationManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -62,7 +63,6 @@ import com.android.systemui.statusbar.NotificationLockscreenUserManager;
|
|||||||
import com.android.systemui.statusbar.NotificationPresenter;
|
import com.android.systemui.statusbar.NotificationPresenter;
|
||||||
import com.android.systemui.statusbar.NotificationRemoteInputManager;
|
import com.android.systemui.statusbar.NotificationRemoteInputManager;
|
||||||
import com.android.systemui.statusbar.StatusBarState;
|
import com.android.systemui.statusbar.StatusBarState;
|
||||||
import com.android.systemui.statusbar.notification.NotificationActivityStarter;
|
|
||||||
import com.android.systemui.statusbar.notification.NotificationEntryManager;
|
import com.android.systemui.statusbar.notification.NotificationEntryManager;
|
||||||
import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorControllerProvider;
|
import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorControllerProvider;
|
||||||
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
|
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
|
||||||
@@ -114,6 +114,8 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
|
|||||||
@Mock
|
@Mock
|
||||||
private KeyguardStateController mKeyguardStateController;
|
private KeyguardStateController mKeyguardStateController;
|
||||||
@Mock
|
@Mock
|
||||||
|
private NotificationInterruptStateProvider mNotificationInterruptStateProvider;
|
||||||
|
@Mock
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
@Mock
|
@Mock
|
||||||
private BubblesManager mBubblesManager;
|
private BubblesManager mBubblesManager;
|
||||||
@@ -133,7 +135,7 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
|
|||||||
@Mock
|
@Mock
|
||||||
private OnUserInteractionCallback mOnUserInteractionCallback;
|
private OnUserInteractionCallback mOnUserInteractionCallback;
|
||||||
@Mock
|
@Mock
|
||||||
private NotificationActivityStarter mNotificationActivityStarter;
|
private StatusBarNotificationActivityStarter mNotificationActivityStarter;
|
||||||
@Mock
|
@Mock
|
||||||
private ActivityLaunchAnimator mActivityLaunchAnimator;
|
private ActivityLaunchAnimator mActivityLaunchAnimator;
|
||||||
private FakeExecutor mUiBgExecutor = new FakeExecutor(new FakeSystemClock());
|
private FakeExecutor mUiBgExecutor = new FakeExecutor(new FakeSystemClock());
|
||||||
@@ -209,7 +211,7 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
|
|||||||
mock(NotificationLockscreenUserManager.class),
|
mock(NotificationLockscreenUserManager.class),
|
||||||
mShadeController,
|
mShadeController,
|
||||||
mKeyguardStateController,
|
mKeyguardStateController,
|
||||||
mock(NotificationInterruptStateProvider.class),
|
mNotificationInterruptStateProvider,
|
||||||
mock(LockPatternUtils.class),
|
mock(LockPatternUtils.class),
|
||||||
mock(StatusBarRemoteInputCallback.class),
|
mock(StatusBarRemoteInputCallback.class),
|
||||||
mActivityIntentHelper,
|
mActivityIntentHelper,
|
||||||
@@ -365,4 +367,27 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
|
|||||||
// Notification should not be cancelled.
|
// Notification should not be cancelled.
|
||||||
verify(mEntryManager, never()).performRemoveNotification(eq(sbn), any(), anyInt());
|
verify(mEntryManager, never()).performRemoveNotification(eq(sbn), any(), anyInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOnFullScreenIntentWhenDozing_wakeUpDevice() {
|
||||||
|
// GIVEN entry that can has a full screen intent that can show
|
||||||
|
Notification.Builder nb = new Notification.Builder(mContext, "a")
|
||||||
|
.setContentTitle("foo")
|
||||||
|
.setSmallIcon(android.R.drawable.sym_def_app_icon)
|
||||||
|
.setFullScreenIntent(mock(PendingIntent.class), true);
|
||||||
|
StatusBarNotification sbn = new StatusBarNotification("pkg", "pkg", 0,
|
||||||
|
"tag" + System.currentTimeMillis(), 0, 0,
|
||||||
|
nb.build(), new UserHandle(0), null, 0);
|
||||||
|
NotificationEntry entry = mock(NotificationEntry.class);
|
||||||
|
when(entry.getImportance()).thenReturn(NotificationManager.IMPORTANCE_HIGH);
|
||||||
|
when(entry.getSbn()).thenReturn(sbn);
|
||||||
|
when(mNotificationInterruptStateProvider.shouldLaunchFullScreenIntentWhenAdded(eq(entry)))
|
||||||
|
.thenReturn(true);
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
mNotificationActivityStarter.handleFullScreenIntent(entry);
|
||||||
|
|
||||||
|
// THEN display should try wake up for the full screen intent
|
||||||
|
verify(mStatusBar).wakeUpForFullScreenIntent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user