Merge "Fix Notification redaction when power cycling a non-dozing device while occluded." into tm-qpr-dev am: 64f07c0057
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19377521 Change-Id: I1e55731d3fb4a3a0fbe2cb33c12816450fc5da38 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -642,6 +642,8 @@ public class NotificationLockscreenUserManagerImpl implements
|
|||||||
// - device keyguard is shown in secure mode;
|
// - device keyguard is shown in secure mode;
|
||||||
// - profile is locked with a work challenge.
|
// - profile is locked with a work challenge.
|
||||||
SparseArray<UserInfo> currentProfiles = getCurrentProfiles();
|
SparseArray<UserInfo> currentProfiles = getCurrentProfiles();
|
||||||
|
SparseBooleanArray oldPublicModes = mLockscreenPublicMode.clone();
|
||||||
|
SparseBooleanArray oldWorkChallenges = mUsersWithSeparateWorkChallenge.clone();
|
||||||
mUsersWithSeparateWorkChallenge.clear();
|
mUsersWithSeparateWorkChallenge.clear();
|
||||||
for (int i = currentProfiles.size() - 1; i >= 0; i--) {
|
for (int i = currentProfiles.size() - 1; i >= 0; i--) {
|
||||||
final int userId = currentProfiles.valueAt(i).id;
|
final int userId = currentProfiles.valueAt(i).id;
|
||||||
@@ -660,7 +662,10 @@ public class NotificationLockscreenUserManagerImpl implements
|
|||||||
}
|
}
|
||||||
getEntryManager().updateNotifications("NotificationLockscreenUserManager.updatePublicMode");
|
getEntryManager().updateNotifications("NotificationLockscreenUserManager.updatePublicMode");
|
||||||
// TODO(b/234738798): Migrate KeyguardNotificationVisibilityProvider to use this listener
|
// TODO(b/234738798): Migrate KeyguardNotificationVisibilityProvider to use this listener
|
||||||
// notifyNotificationStateChanged();
|
if (!mLockscreenPublicMode.equals(oldPublicModes)
|
||||||
|
|| !mUsersWithSeparateWorkChallenge.equals(oldWorkChallenges)) {
|
||||||
|
notifyNotificationStateChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -324,6 +324,13 @@ public class NotificationStackScrollLayoutController {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recalculate sensitiveness without animation; called when waking up while keyguard occluded.
|
||||||
|
*/
|
||||||
|
public void updateSensitivenessForOccludedWakeup() {
|
||||||
|
mView.updateSensitiveness(false, mLockscreenUserManager.isAnyProfilePublicMode());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the overexpansion of the panel to be applied to the view.
|
* Set the overexpansion of the panel to be applied to the view.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3661,6 +3661,18 @@ public class CentralSurfacesImpl extends CoreStartable implements
|
|||||||
public void onFinishedWakingUp() {
|
public void onFinishedWakingUp() {
|
||||||
mWakeUpCoordinator.setFullyAwake(true);
|
mWakeUpCoordinator.setFullyAwake(true);
|
||||||
mWakeUpCoordinator.setWakingUp(false);
|
mWakeUpCoordinator.setWakingUp(false);
|
||||||
|
if (mKeyguardStateController.isOccluded()
|
||||||
|
&& !mDozeParameters.canControlUnlockedScreenOff()) {
|
||||||
|
// When the keyguard is occluded we don't use the KEYGUARD state which would
|
||||||
|
// normally cause these redaction updates. If AOD is on, the KEYGUARD state is used
|
||||||
|
// to show the doze, AND UnlockedScreenOffAnimationController.onFinishedWakingUp()
|
||||||
|
// would force a KEYGUARD state that would take care of recalculating redaction.
|
||||||
|
// So if AOD is off or unsupported we need to trigger these updates at screen on
|
||||||
|
// when the keyguard is occluded.
|
||||||
|
mLockscreenUserManager.updatePublicMode();
|
||||||
|
mNotificationPanelViewController.getNotificationStackScrollLayoutController()
|
||||||
|
.updateSensitivenessForOccludedWakeup();
|
||||||
|
}
|
||||||
if (mLaunchCameraWhenFinishedWaking) {
|
if (mLaunchCameraWhenFinishedWaking) {
|
||||||
mNotificationPanelViewController.launchCamera(mLastCameraLaunchSource);
|
mNotificationPanelViewController.launchCamera(mLastCameraLaunchSource);
|
||||||
mLaunchCameraWhenFinishedWaking = false;
|
mLaunchCameraWhenFinishedWaking = false;
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ import static junit.framework.Assert.assertFalse;
|
|||||||
import static junit.framework.Assert.assertTrue;
|
import static junit.framework.Assert.assertTrue;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
|
import static org.mockito.Mockito.clearInvocations;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.never;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
@@ -59,6 +61,7 @@ import com.android.systemui.broadcast.BroadcastDispatcher;
|
|||||||
import com.android.systemui.dump.DumpManager;
|
import com.android.systemui.dump.DumpManager;
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
import com.android.systemui.statusbar.NotificationLockscreenUserManager.KeyguardNotificationSuppressor;
|
import com.android.systemui.statusbar.NotificationLockscreenUserManager.KeyguardNotificationSuppressor;
|
||||||
|
import com.android.systemui.statusbar.NotificationLockscreenUserManager.NotificationStateChangedListener;
|
||||||
import com.android.systemui.statusbar.notification.NotificationEntryManager;
|
import com.android.systemui.statusbar.notification.NotificationEntryManager;
|
||||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
||||||
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder;
|
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder;
|
||||||
@@ -324,6 +327,38 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase {
|
|||||||
assertTrue(mLockscreenUserManager.isLockscreenPublicMode(mCurrentUser.id));
|
assertTrue(mLockscreenUserManager.isLockscreenPublicMode(mCurrentUser.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateIsPublicMode() {
|
||||||
|
when(mKeyguardStateController.isMethodSecure()).thenReturn(true);
|
||||||
|
|
||||||
|
NotificationStateChangedListener listener = mock(NotificationStateChangedListener.class);
|
||||||
|
mLockscreenUserManager.addNotificationStateChangedListener(listener);
|
||||||
|
mLockscreenUserManager.mCurrentProfiles.append(0, mock(UserInfo.class));
|
||||||
|
|
||||||
|
// first call explicitly sets user 0 to not public; notifies
|
||||||
|
mLockscreenUserManager.updatePublicMode();
|
||||||
|
assertFalse(mLockscreenUserManager.isLockscreenPublicMode(0));
|
||||||
|
verify(listener).onNotificationStateChanged();
|
||||||
|
clearInvocations(listener);
|
||||||
|
|
||||||
|
// calling again has no changes; does not notify
|
||||||
|
mLockscreenUserManager.updatePublicMode();
|
||||||
|
assertFalse(mLockscreenUserManager.isLockscreenPublicMode(0));
|
||||||
|
verify(listener, never()).onNotificationStateChanged();
|
||||||
|
|
||||||
|
// Calling again with keyguard now showing makes user 0 public; notifies
|
||||||
|
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||||
|
mLockscreenUserManager.updatePublicMode();
|
||||||
|
assertTrue(mLockscreenUserManager.isLockscreenPublicMode(0));
|
||||||
|
verify(listener).onNotificationStateChanged();
|
||||||
|
clearInvocations(listener);
|
||||||
|
|
||||||
|
// calling again has no changes; does not notify
|
||||||
|
mLockscreenUserManager.updatePublicMode();
|
||||||
|
assertTrue(mLockscreenUserManager.isLockscreenPublicMode(0));
|
||||||
|
verify(listener, never()).onNotificationStateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShowSilentNotifications_settingSaysShow() {
|
public void testShowSilentNotifications_settingSaysShow() {
|
||||||
mSettings.putInt(Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 1);
|
mSettings.putInt(Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user