Merge "[CS] 3/N: Move KeyguardViewMediator to WallpaperRepository." into udc-qpr-dev am: b7b011f55e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23983990

Change-Id: I90c602004db4464a368aef4492d75866a6bd54b6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Caitlin Shkuratov
2023-07-18 17:56:22 +00:00
committed by Automerger Merge Worker
4 changed files with 29 additions and 2 deletions

View File

@@ -163,9 +163,11 @@ import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.UserSwitcherController; import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.util.DeviceConfigProxy; import com.android.systemui.util.DeviceConfigProxy;
import com.android.systemui.util.kotlin.JavaAdapter;
import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.util.settings.SecureSettings;
import com.android.systemui.util.settings.SystemSettings; import com.android.systemui.util.settings.SystemSettings;
import com.android.systemui.util.time.SystemClock; import com.android.systemui.util.time.SystemClock;
import com.android.systemui.wallpapers.data.repository.WallpaperRepository;
import com.android.wm.shell.keyguard.KeyguardTransitions; import com.android.wm.shell.keyguard.KeyguardTransitions;
import dagger.Lazy; import dagger.Lazy;
@@ -290,6 +292,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
public static final String SYS_BOOT_REASON_PROP = "sys.boot.reason.last"; public static final String SYS_BOOT_REASON_PROP = "sys.boot.reason.last";
public static final String REBOOT_MAINLINE_UPDATE = "reboot,mainline_update"; public static final String REBOOT_MAINLINE_UPDATE = "reboot,mainline_update";
private final DreamOverlayStateController mDreamOverlayStateController; private final DreamOverlayStateController mDreamOverlayStateController;
private final JavaAdapter mJavaAdapter;
private final WallpaperRepository mWallpaperRepository;
/** The stream type that the lock sounds are tied to. */ /** The stream type that the lock sounds are tied to. */
private int mUiSoundsStreamType; private int mUiSoundsStreamType;
@@ -1322,6 +1326,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
KeyguardTransitions keyguardTransitions, KeyguardTransitions keyguardTransitions,
InteractionJankMonitor interactionJankMonitor, InteractionJankMonitor interactionJankMonitor,
DreamOverlayStateController dreamOverlayStateController, DreamOverlayStateController dreamOverlayStateController,
JavaAdapter javaAdapter,
WallpaperRepository wallpaperRepository,
Lazy<ShadeController> shadeControllerLazy, Lazy<ShadeController> shadeControllerLazy,
Lazy<NotificationShadeWindowController> notificationShadeWindowControllerLazy, Lazy<NotificationShadeWindowController> notificationShadeWindowControllerLazy,
Lazy<ActivityLaunchAnimator> activityLaunchAnimator, Lazy<ActivityLaunchAnimator> activityLaunchAnimator,
@@ -1382,6 +1388,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
mScreenOffAnimationController = screenOffAnimationController; mScreenOffAnimationController = screenOffAnimationController;
mInteractionJankMonitor = interactionJankMonitor; mInteractionJankMonitor = interactionJankMonitor;
mDreamOverlayStateController = dreamOverlayStateController; mDreamOverlayStateController = dreamOverlayStateController;
mJavaAdapter = javaAdapter;
mWallpaperRepository = wallpaperRepository;
mActivityLaunchAnimator = activityLaunchAnimator; mActivityLaunchAnimator = activityLaunchAnimator;
mScrimControllerLazy = scrimControllerLazy; mScrimControllerLazy = scrimControllerLazy;
@@ -1484,6 +1492,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
com.android.internal.R.anim.lock_screen_behind_enter); com.android.internal.R.anim.lock_screen_behind_enter);
mWorkLockController = new WorkLockActivityController(mContext, mUserTracker); mWorkLockController = new WorkLockActivityController(mContext, mUserTracker);
mJavaAdapter.alwaysCollectFlow(
mWallpaperRepository.getWallpaperSupportsAmbientMode(),
this::setWallpaperSupportsAmbientMode);
} }
// TODO(b/273443374) remove, temporary util to get a feature flag // TODO(b/273443374) remove, temporary util to get a feature flag
@@ -3458,7 +3470,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
* In case it does support it, we have to fade in the incoming app, otherwise we'll reveal it * In case it does support it, we have to fade in the incoming app, otherwise we'll reveal it
* with the light reveal scrim. * with the light reveal scrim.
*/ */
public void setWallpaperSupportsAmbientMode(boolean supportsAmbientMode) { private void setWallpaperSupportsAmbientMode(boolean supportsAmbientMode) {
mWallpaperSupportsAmbientMode = supportsAmbientMode; mWallpaperSupportsAmbientMode = supportsAmbientMode;
} }

View File

@@ -66,9 +66,11 @@ import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.UserSwitcherController; import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.util.DeviceConfigProxy; import com.android.systemui.util.DeviceConfigProxy;
import com.android.systemui.util.kotlin.JavaAdapter;
import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.util.settings.SecureSettings;
import com.android.systemui.util.settings.SystemSettings; import com.android.systemui.util.settings.SystemSettings;
import com.android.systemui.util.time.SystemClock; import com.android.systemui.util.time.SystemClock;
import com.android.systemui.wallpapers.data.repository.WallpaperRepository;
import com.android.wm.shell.keyguard.KeyguardTransitions; import com.android.wm.shell.keyguard.KeyguardTransitions;
import dagger.Lazy; import dagger.Lazy;
@@ -130,6 +132,8 @@ public class KeyguardModule {
KeyguardTransitions keyguardTransitions, KeyguardTransitions keyguardTransitions,
InteractionJankMonitor interactionJankMonitor, InteractionJankMonitor interactionJankMonitor,
DreamOverlayStateController dreamOverlayStateController, DreamOverlayStateController dreamOverlayStateController,
JavaAdapter javaAdapter,
WallpaperRepository wallpaperRepository,
Lazy<ShadeController> shadeController, Lazy<ShadeController> shadeController,
Lazy<NotificationShadeWindowController> notificationShadeWindowController, Lazy<NotificationShadeWindowController> notificationShadeWindowController,
Lazy<ActivityLaunchAnimator> activityLaunchAnimator, Lazy<ActivityLaunchAnimator> activityLaunchAnimator,
@@ -170,6 +174,8 @@ public class KeyguardModule {
keyguardTransitions, keyguardTransitions,
interactionJankMonitor, interactionJankMonitor,
dreamOverlayStateController, dreamOverlayStateController,
javaAdapter,
wallpaperRepository,
shadeController, shadeController,
notificationShadeWindowController, notificationShadeWindowController,
activityLaunchAnimator, activityLaunchAnimator,

View File

@@ -3572,7 +3572,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
&& (info != null && info.supportsAmbientMode()); && (info != null && info.supportsAmbientMode());
mNotificationShadeWindowController.setWallpaperSupportsAmbientMode(supportsAmbientMode); mNotificationShadeWindowController.setWallpaperSupportsAmbientMode(supportsAmbientMode);
mKeyguardViewMediator.setWallpaperSupportsAmbientMode(supportsAmbientMode);
} }
}; };

View File

@@ -71,6 +71,7 @@ import com.android.keyguard.KeyguardDisplayManager;
import com.android.keyguard.KeyguardSecurityView; import com.android.keyguard.KeyguardSecurityView;
import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.TestScopeProvider;
import com.android.keyguard.mediator.ScreenOnCoordinator; import com.android.keyguard.mediator.ScreenOnCoordinator;
import com.android.systemui.DejankUtils; import com.android.systemui.DejankUtils;
import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase;
@@ -108,9 +109,11 @@ import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.util.DeviceConfigProxy; import com.android.systemui.util.DeviceConfigProxy;
import com.android.systemui.util.DeviceConfigProxyFake; import com.android.systemui.util.DeviceConfigProxyFake;
import com.android.systemui.util.concurrency.FakeExecutor; import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.kotlin.JavaAdapter;
import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.util.settings.SecureSettings;
import com.android.systemui.util.settings.SystemSettings; import com.android.systemui.util.settings.SystemSettings;
import com.android.systemui.util.time.FakeSystemClock; import com.android.systemui.util.time.FakeSystemClock;
import com.android.systemui.wallpapers.data.repository.FakeWallpaperRepository;
import com.android.wm.shell.keyguard.KeyguardTransitions; import com.android.wm.shell.keyguard.KeyguardTransitions;
import org.junit.After; import org.junit.After;
@@ -124,6 +127,7 @@ import org.mockito.MockitoAnnotations;
import kotlinx.coroutines.CoroutineDispatcher; import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.flow.Flow; import kotlinx.coroutines.flow.Flow;
import kotlinx.coroutines.test.TestScope;
@RunWith(AndroidTestingRunner.class) @RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper @TestableLooper.RunWithLooper
@@ -131,6 +135,9 @@ import kotlinx.coroutines.flow.Flow;
public class KeyguardViewMediatorTest extends SysuiTestCase { public class KeyguardViewMediatorTest extends SysuiTestCase {
private KeyguardViewMediator mViewMediator; private KeyguardViewMediator mViewMediator;
private final TestScope mTestScope = TestScopeProvider.getTestScope();
private final JavaAdapter mJavaAdapter = new JavaAdapter(mTestScope.getBackgroundScope());
private @Mock UserTracker mUserTracker; private @Mock UserTracker mUserTracker;
private @Mock DevicePolicyManager mDevicePolicyManager; private @Mock DevicePolicyManager mDevicePolicyManager;
private @Mock LockPatternUtils mLockPatternUtils; private @Mock LockPatternUtils mLockPatternUtils;
@@ -182,6 +189,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
private @Mock SecureSettings mSecureSettings; private @Mock SecureSettings mSecureSettings;
private @Mock AlarmManager mAlarmManager; private @Mock AlarmManager mAlarmManager;
private FakeSystemClock mSystemClock; private FakeSystemClock mSystemClock;
private final FakeWallpaperRepository mWallpaperRepository = new FakeWallpaperRepository();
private @Mock CoroutineDispatcher mDispatcher; private @Mock CoroutineDispatcher mDispatcher;
private @Mock DreamingToLockscreenTransitionViewModel mDreamingToLockscreenTransitionViewModel; private @Mock DreamingToLockscreenTransitionViewModel mDreamingToLockscreenTransitionViewModel;
@@ -817,6 +825,8 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
mKeyguardTransitions, mKeyguardTransitions,
mInteractionJankMonitor, mInteractionJankMonitor,
mDreamOverlayStateController, mDreamOverlayStateController,
mJavaAdapter,
mWallpaperRepository,
() -> mShadeController, () -> mShadeController,
() -> mNotificationShadeWindowController, () -> mNotificationShadeWindowController,
() -> mActivityLaunchAnimator, () -> mActivityLaunchAnimator,