diff options
| author | 2023-07-18 18:38:14 +0000 | |
|---|---|---|
| committer | 2023-07-18 18:38:14 +0000 | |
| commit | 7df848bb82ae351391462371806b9a1d4c3f8a33 (patch) | |
| tree | 5bd8fcc380774bff466ecccdb5ab3e2991ba1545 | |
| parent | 3103498b1ed0e964c54f5c78af5241d880e0e6b2 (diff) | |
| parent | 59d53af9d4d5477472e4ab8f2c8044f0f3f0a1fb (diff) | |
Merge "[CS] 3/N: Move KeyguardViewMediator to WallpaperRepository." into udc-qpr-dev am: b7b011f55e am: 59d53af9d4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23983990
Change-Id: I37885bcddaaa6a6ad398a4c2ea93b76b8b7bd057
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
4 files changed, 29 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 9a32e94180c7..ddd4a2bf4453 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -163,9 +163,11 @@ import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.UserSwitcherController; 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.SystemSettings; import com.android.systemui.util.time.SystemClock; +import com.android.systemui.wallpapers.data.repository.WallpaperRepository; import com.android.wm.shell.keyguard.KeyguardTransitions; 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 REBOOT_MAINLINE_UPDATE = "reboot,mainline_update"; private final DreamOverlayStateController mDreamOverlayStateController; + private final JavaAdapter mJavaAdapter; + private final WallpaperRepository mWallpaperRepository; /** The stream type that the lock sounds are tied to. */ private int mUiSoundsStreamType; @@ -1323,6 +1327,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, KeyguardTransitions keyguardTransitions, InteractionJankMonitor interactionJankMonitor, DreamOverlayStateController dreamOverlayStateController, + JavaAdapter javaAdapter, + WallpaperRepository wallpaperRepository, Lazy<ShadeController> shadeControllerLazy, Lazy<NotificationShadeWindowController> notificationShadeWindowControllerLazy, Lazy<ActivityLaunchAnimator> activityLaunchAnimator, @@ -1384,6 +1390,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mScreenOffAnimationController = screenOffAnimationController; mInteractionJankMonitor = interactionJankMonitor; mDreamOverlayStateController = dreamOverlayStateController; + mJavaAdapter = javaAdapter; + mWallpaperRepository = wallpaperRepository; mActivityLaunchAnimator = activityLaunchAnimator; mScrimControllerLazy = scrimControllerLazy; @@ -1487,6 +1495,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, com.android.internal.R.anim.lock_screen_behind_enter); mWorkLockController = new WorkLockActivityController(mContext, mUserTracker); + + mJavaAdapter.alwaysCollectFlow( + mWallpaperRepository.getWallpaperSupportsAmbientMode(), + this::setWallpaperSupportsAmbientMode); } // TODO(b/273443374) remove, temporary util to get a feature flag @@ -3464,7 +3476,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 * with the light reveal scrim. */ - public void setWallpaperSupportsAmbientMode(boolean supportsAmbientMode) { + private void setWallpaperSupportsAmbientMode(boolean supportsAmbientMode) { mWallpaperSupportsAmbientMode = supportsAmbientMode; } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java b/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java index 1487408f1a0c..a5ac7c7500e1 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java @@ -67,9 +67,11 @@ import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.UserSwitcherController; 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.SystemSettings; import com.android.systemui.util.time.SystemClock; +import com.android.systemui.wallpapers.data.repository.WallpaperRepository; import com.android.wm.shell.keyguard.KeyguardTransitions; import dagger.Lazy; @@ -131,6 +133,8 @@ public class KeyguardModule { KeyguardTransitions keyguardTransitions, InteractionJankMonitor interactionJankMonitor, DreamOverlayStateController dreamOverlayStateController, + JavaAdapter javaAdapter, + WallpaperRepository wallpaperRepository, Lazy<ShadeController> shadeController, Lazy<NotificationShadeWindowController> notificationShadeWindowController, Lazy<ActivityLaunchAnimator> activityLaunchAnimator, @@ -172,6 +176,8 @@ public class KeyguardModule { keyguardTransitions, interactionJankMonitor, dreamOverlayStateController, + javaAdapter, + wallpaperRepository, shadeController, notificationShadeWindowController, activityLaunchAnimator, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index 5fb729cb26f1..ce1ec16d3140 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -3572,7 +3572,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { && (info != null && info.supportsAmbientMode()); mNotificationShadeWindowController.setWallpaperSupportsAmbientMode(supportsAmbientMode); - mKeyguardViewMediator.setWallpaperSupportsAmbientMode(supportsAmbientMode); } }; diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java index ddcbe7993697..00f67a32ff8e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java @@ -78,6 +78,7 @@ import com.android.keyguard.KeyguardDisplayManager; import com.android.keyguard.KeyguardSecurityView; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; +import com.android.keyguard.TestScopeProvider; import com.android.keyguard.mediator.ScreenOnCoordinator; import com.android.systemui.DejankUtils; import com.android.systemui.SysuiTestCase; @@ -115,9 +116,11 @@ import com.android.systemui.statusbar.policy.UserSwitcherController; import com.android.systemui.util.DeviceConfigProxy; import com.android.systemui.util.DeviceConfigProxyFake; 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.SystemSettings; import com.android.systemui.util.time.FakeSystemClock; +import com.android.systemui.wallpapers.data.repository.FakeWallpaperRepository; import com.android.wm.shell.keyguard.KeyguardTransitions; import org.junit.After; @@ -132,6 +135,7 @@ import org.mockito.MockitoAnnotations; import kotlinx.coroutines.CoroutineDispatcher; import kotlinx.coroutines.flow.Flow; +import kotlinx.coroutines.test.TestScope; @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper @@ -139,6 +143,9 @@ import kotlinx.coroutines.flow.Flow; public class KeyguardViewMediatorTest extends SysuiTestCase { private KeyguardViewMediator mViewMediator; + private final TestScope mTestScope = TestScopeProvider.getTestScope(); + private final JavaAdapter mJavaAdapter = new JavaAdapter(mTestScope.getBackgroundScope()); + private @Mock UserTracker mUserTracker; private @Mock DevicePolicyManager mDevicePolicyManager; private @Mock LockPatternUtils mLockPatternUtils; @@ -191,6 +198,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { private @Mock SecureSettings mSecureSettings; private @Mock AlarmManager mAlarmManager; private FakeSystemClock mSystemClock; + private final FakeWallpaperRepository mWallpaperRepository = new FakeWallpaperRepository(); /** Most recent value passed to {@link KeyguardStateController#notifyKeyguardGoingAway}. */ private boolean mKeyguardGoingAway = false; @@ -928,6 +936,8 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { mKeyguardTransitions, mInteractionJankMonitor, mDreamOverlayStateController, + mJavaAdapter, + mWallpaperRepository, () -> mShadeController, () -> mNotificationShadeWindowController, () -> mActivityLaunchAnimator, |