summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2021-11-23 17:33:13 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-11-23 17:33:13 +0000
commit35185d54b4352ac30d587ee42b360d9c46136d10 (patch)
treed29ab347fa6e013aa2ffb338b5b648d398530c03
parentf322436d6ab31342d311c65b7bfd5557e5b249fc (diff)
parente1a74223bb8868739b1e52b85c7d971156862eba (diff)
Merge "Wakeup the screen for full screen intents" into sc-v2-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java20
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java6
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java31
3 files changed, 47 insertions, 10 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 7b6cdbecc640..0f55f289ff27 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -1987,7 +1987,7 @@ public class StatusBar extends SystemUI implements
}
}
- public void maybeEscalateHeadsUp() {
+ private void maybeEscalateHeadsUp() {
mHeadsUpManager.getAllEntries().forEach(entry -> {
final StatusBarNotification sbn = entry.getSbn();
final Notification notification = sbn.getNotification();
@@ -1998,6 +1998,7 @@ public class StatusBar extends SystemUI implements
try {
EventLog.writeEvent(EventLogTags.SYSUI_HEADS_UP_ESCALATION,
sbn.getKey());
+ wakeUpForFullScreenIntent();
notification.fullScreenIntent.send();
entry.notifyFullScreenIntentLaunched();
} catch (PendingIntent.CanceledException e) {
@@ -2007,6 +2008,17 @@ public class StatusBar extends SystemUI implements
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) {
if (SPEW) Log.d(TAG, "Make expanded visible: expanded visible=" + mExpandedVisible);
if (!force && (mExpandedVisible || !mCommandQueue.panelsEnabled())) {
@@ -3536,7 +3548,7 @@ public class StatusBar extends SystemUI implements
DejankUtils.startDetectingBlockingIpcs(tag);
updateRevealEffect(false /* wakingUp */);
updateNotificationPanelTouchState();
- notifyHeadsUpGoingToSleep();
+ maybeEscalateHeadsUp();
dismissVolumeDialog();
mWakeUpCoordinator.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.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
index dba3b2418790..ce3811113912 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
@@ -41,6 +41,8 @@ import android.text.TextUtils;
import android.util.EventLog;
import android.view.View;
+import androidx.annotation.VisibleForTesting;
+
import com.android.internal.jank.InteractionJankMonitor;
import com.android.internal.logging.MetricsLogger;
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 (shouldSuppressFullScreenIntent(entry)) {
mLogger.logFullScreenIntentSuppressedByDnD(entry.getKey());
@@ -617,6 +620,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
try {
EventLog.writeEvent(EventLogTags.SYSUI_FULLSCREEN_NOTIFICATION,
entry.getKey());
+ mStatusBar.wakeUpForFullScreenIntent();
fullscreenIntent.send();
entry.notifyFullScreenIntentLaunched();
mMetricsLogger.count("note_fullscreen", 1);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
index 72a3d664a6ce..cec5877e324a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
@@ -34,6 +34,7 @@ import static org.mockito.Mockito.when;
import android.app.KeyguardManager;
import android.app.Notification;
+import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
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.NotificationRemoteInputManager;
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.NotificationLaunchAnimatorControllerProvider;
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
@@ -114,6 +114,8 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
@Mock
private KeyguardStateController mKeyguardStateController;
@Mock
+ private NotificationInterruptStateProvider mNotificationInterruptStateProvider;
+ @Mock
private Handler mHandler;
@Mock
private BubblesManager mBubblesManager;
@@ -133,7 +135,7 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
@Mock
private OnUserInteractionCallback mOnUserInteractionCallback;
@Mock
- private NotificationActivityStarter mNotificationActivityStarter;
+ private StatusBarNotificationActivityStarter mNotificationActivityStarter;
@Mock
private ActivityLaunchAnimator mActivityLaunchAnimator;
private FakeExecutor mUiBgExecutor = new FakeExecutor(new FakeSystemClock());
@@ -209,7 +211,7 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
mock(NotificationLockscreenUserManager.class),
mShadeController,
mKeyguardStateController,
- mock(NotificationInterruptStateProvider.class),
+ mNotificationInterruptStateProvider,
mock(LockPatternUtils.class),
mock(StatusBarRemoteInputCallback.class),
mActivityIntentHelper,
@@ -365,4 +367,27 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
// Notification should not be cancelled.
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();
+ }
}