Merge "Revert^3 "Remove dozeui binder call"" into main
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/BottomAreaSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/BottomAreaSection.kt
index 467dbca..97d5b41 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/BottomAreaSection.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/BottomAreaSection.kt
@@ -32,7 +32,6 @@
import com.android.compose.animation.scene.ElementKey
import com.android.compose.animation.scene.SceneScope
import com.android.systemui.animation.view.LaunchableImageView
-import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.ui.binder.KeyguardIndicationAreaBinder
import com.android.systemui.keyguard.ui.binder.KeyguardQuickAffordanceViewBinder
import com.android.systemui.keyguard.ui.view.KeyguardIndicationArea
@@ -44,7 +43,6 @@
import com.android.systemui.statusbar.KeyguardIndicationController
import com.android.systemui.statusbar.VibratorHelper
import javax.inject.Inject
-import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.DisposableHandle
import kotlinx.coroutines.flow.Flow
@@ -56,7 +54,6 @@
private val vibratorHelper: VibratorHelper,
private val indicationController: KeyguardIndicationController,
private val indicationAreaViewModel: KeyguardIndicationAreaViewModel,
- @Main private val mainImmediateDispatcher: CoroutineDispatcher,
) {
/**
* Renders a single lockscreen shortcut.
@@ -164,7 +161,6 @@
transitionAlpha,
falsingManager,
vibratorHelper,
- mainImmediateDispatcher,
) {
indicationController.showTransientIndication(it)
}
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/LockSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/LockSection.kt
index 48684a0..9f02201 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/LockSection.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/LockSection.kt
@@ -34,7 +34,6 @@
import com.android.keyguard.LockIconViewController
import com.android.systemui.biometrics.AuthController
import com.android.systemui.dagger.qualifiers.Application
-import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.deviceentry.shared.DeviceEntryUdfpsRefactor
import com.android.systemui.flags.FeatureFlagsClassic
import com.android.systemui.flags.Flags
@@ -51,14 +50,12 @@
import com.android.systemui.statusbar.VibratorHelper
import dagger.Lazy
import javax.inject.Inject
-import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
class LockSection
@Inject
constructor(
@Application private val applicationScope: CoroutineScope,
- @Main private val mainImmediateDispatcher: CoroutineDispatcher,
private val windowManager: WindowManager,
private val authController: AuthController,
private val featureFlags: FeatureFlagsClassic,
@@ -96,7 +93,6 @@
deviceEntryBackgroundViewModel.get(),
falsingManager.get(),
vibratorHelper.get(),
- mainImmediateDispatcher,
)
}
} else {
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt
index 1dd5d07..f78fbd1 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt
@@ -215,16 +215,14 @@
)
repository.setStatusBarState(StatusBarState.KEYGUARD)
- // User begins to swipe up
- shadeRepository.setLegacyShadeExpansion(0.99f)
+ shadeRepository.setLegacyShadeExpansion(1f)
// When not dismissable, no alpha value (null) should emit
repository.setKeyguardDismissible(false)
assertThat(dismissAlpha).isNull()
repository.setKeyguardDismissible(true)
- shadeRepository.setLegacyShadeExpansion(0.98f)
- assertThat(dismissAlpha).isGreaterThan(0.5f)
+ assertThat(dismissAlpha).isGreaterThan(0.95f)
}
@Test
diff --git a/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt b/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt
index 70182c1..3b8a268 100644
--- a/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt
+++ b/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt
@@ -31,7 +31,6 @@
import androidx.annotation.VisibleForTesting
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
-import com.android.app.tracing.coroutines.launch
import com.android.systemui.broadcast.BroadcastDispatcher
import com.android.systemui.customization.R
import com.android.systemui.dagger.qualifiers.Background
@@ -66,7 +65,6 @@
import java.util.TimeZone
import java.util.concurrent.Executor
import javax.inject.Inject
-import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DisposableHandle
import kotlinx.coroutines.Job
@@ -74,6 +72,7 @@
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.merge
+import kotlinx.coroutines.launch
/**
* Controller for a Clock provided by the registry and used on the keyguard. Instantiated by
@@ -91,7 +90,6 @@
@DisplaySpecific private val resources: Resources,
private val context: Context,
@Main private val mainExecutor: DelayableExecutor,
- @Main private val mainImmediateDispatcher: CoroutineDispatcher,
@Background private val bgExecutor: Executor,
private val clockBuffers: ClockMessageBuffers,
private val featureFlags: FeatureFlagsClassic,
@@ -426,7 +424,7 @@
keyguardUpdateMonitor.registerCallback(keyguardUpdateMonitorCallback)
zenModeController.addCallback(zenModeCallback)
disposableHandle =
- parent.repeatWhenAttached(mainImmediateDispatcher) {
+ parent.repeatWhenAttached {
repeatOnLifecycle(Lifecycle.State.CREATED) {
listenForDozing(this)
if (MigrateClocksToBlueprint.isEnabled) {
@@ -531,14 +529,12 @@
@VisibleForTesting
internal fun listenForDozeAmount(scope: CoroutineScope): Job {
- return scope.launch("$TAG#listenForDozeAmount") {
- keyguardInteractor.dozeAmount.collect { handleDoze(it) }
- }
+ return scope.launch { keyguardInteractor.dozeAmount.collect { handleDoze(it) } }
}
@VisibleForTesting
internal fun listenForDozeAmountTransition(scope: CoroutineScope): Job {
- return scope.launch("$TAG#listenForDozeAmountTransition") {
+ return scope.launch {
merge(
keyguardTransitionInteractor.aodToLockscreenTransition.map { step ->
step.copy(value = 1f - step.value)
@@ -556,7 +552,7 @@
*/
@VisibleForTesting
internal fun listenForAnyStateToAodTransition(scope: CoroutineScope): Job {
- return scope.launch("$TAG#listenForAnyStateToAodTransition") {
+ return scope.launch {
keyguardTransitionInteractor
.transitionStepsToState(AOD)
.filter { it.transitionState == TransitionState.STARTED }
@@ -567,7 +563,7 @@
@VisibleForTesting
internal fun listenForDozing(scope: CoroutineScope): Job {
- return scope.launch("$TAG#listenForDozing") {
+ return scope.launch {
combine(
keyguardInteractor.dozeAmount,
keyguardInteractor.isDozing,
@@ -632,7 +628,7 @@
}
companion object {
- private const val TAG = "ClockEventController"
- private const val DOZE_TICKRATE_THRESHOLD = 0.99f
+ private val TAG = ClockEventController::class.simpleName!!
+ private val DOZE_TICKRATE_THRESHOLD = 0.99f
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java b/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java
index 9a9e698..424bd0a 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java
@@ -209,15 +209,6 @@
}
/**
- * Logs cancelation requests for time ticks
- * @param isPending is an unschedule request pending?
- * @param isTimeTickScheduled is a time tick request scheduled
- */
- public void tracePendingUnscheduleTimeTick(boolean isPending, boolean isTimeTickScheduled) {
- mLogger.logPendingUnscheduleTimeTick(isPending, isTimeTickScheduled);
- }
-
- /**
* Appends keyguard visibility change event to the logs
* @param showing whether the keyguard is now showing
*/
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeLogger.kt b/packages/SystemUI/src/com/android/systemui/doze/DozeLogger.kt
index 9d6693e..75b8e51 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeLogger.kt
@@ -162,15 +162,6 @@
})
}
- fun logPendingUnscheduleTimeTick(isPending: Boolean, isTimeTickScheduled: Boolean) {
- buffer.log(TAG, INFO, {
- bool1 = isPending
- bool2 = isTimeTickScheduled
- }, {
- "Pending unschedule time tick, isPending=$bool1, isTimeTickScheduled:$bool2"
- })
- }
-
fun logDozeStateChanged(state: DozeMachine.State) {
buffer.log(TAG, INFO, {
str1 = state.name
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeUi.java b/packages/SystemUI/src/com/android/systemui/doze/DozeUi.java
index 1a855d7..34a80e8 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeUi.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeUi.java
@@ -26,12 +26,11 @@
import android.text.format.Formatter;
import android.util.Log;
-import com.android.systemui.dagger.qualifiers.Background;
+import com.android.systemui.DejankUtils;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.doze.dagger.DozeScope;
import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.util.AlarmTimeout;
-import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.wakelock.WakeLock;
import java.util.Calendar;
@@ -53,19 +52,14 @@
private final boolean mCanAnimateTransition;
private final DozeParameters mDozeParameters;
private final DozeLog mDozeLog;
- private final DelayableExecutor mBgExecutor;
- private Runnable mCancelRunnable = null;
private long mLastTimeTickElapsed = 0;
// If time tick is scheduled and there's not a pending runnable to cancel:
- private volatile boolean mTimeTickScheduled;
+ private boolean mTimeTickScheduled;
private final Runnable mCancelTimeTickerRunnable = new Runnable() {
@Override
public void run() {
- mDozeLog.tracePendingUnscheduleTimeTick(false, mTimeTickScheduled);
- if (!mTimeTickScheduled) {
- mTimeTicker.cancel();
- }
+ mTimeTicker.cancel();
}
};
@@ -73,13 +67,11 @@
public DozeUi(Context context, AlarmManager alarmManager,
WakeLock wakeLock, DozeHost host, @Main Handler handler,
DozeParameters params,
- @Background DelayableExecutor bgExecutor,
DozeLog dozeLog) {
mContext = context;
mWakeLock = wakeLock;
mHost = host;
mHandler = handler;
- mBgExecutor = bgExecutor;
mCanAnimateTransition = !params.getDisplayNeedsBlanking();
mDozeParameters = params;
mTimeTicker = new AlarmTimeout(alarmManager, this::onTimeTick, "doze_time_tick", handler);
@@ -174,6 +166,7 @@
return;
}
mTimeTickScheduled = true;
+ DejankUtils.removeCallbacks(mCancelTimeTickerRunnable);
long time = System.currentTimeMillis();
long delta = roundToNextMinute(time) - System.currentTimeMillis();
@@ -189,8 +182,7 @@
return;
}
mTimeTickScheduled = false;
- mDozeLog.tracePendingUnscheduleTimeTick(true, mTimeTickScheduled);
- mBgExecutor.execute(mCancelTimeTickerRunnable);
+ DejankUtils.postAfterTraversal(mCancelTimeTickerRunnable);
}
private void verifyLastTimeTick() {
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt
index e6e6ff6..c32c226 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt
@@ -41,7 +41,6 @@
import com.android.systemui.CoreStartable
import com.android.systemui.common.ui.ConfigurationState
import com.android.systemui.dagger.SysUISingleton
-import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryHapticsInteractor
import com.android.systemui.deviceentry.shared.DeviceEntryUdfpsRefactor
import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor
@@ -73,7 +72,6 @@
import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator
import dagger.Lazy
import javax.inject.Inject
-import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.DisposableHandle
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -110,7 +108,6 @@
private val keyguardBlueprintViewBinder: KeyguardBlueprintViewBinder,
private val clockInteractor: KeyguardClockInteractor,
private val keyguardViewMediator: KeyguardViewMediator,
- @Main private val mainImmediateDispatcher: CoroutineDispatcher,
) : CoreStartable {
private var rootViewHandle: DisposableHandle? = null
@@ -214,7 +211,6 @@
vibratorHelper,
falsingManager,
keyguardViewMediator,
- mainImmediateDispatcher,
)
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
index 2182fe3..e384bfb 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
@@ -49,7 +49,6 @@
import com.android.systemui.shade.data.repository.ShadeRepository
import com.android.systemui.statusbar.CommandQueue
import com.android.systemui.statusbar.notification.stack.domain.interactor.SharedNotificationContainerInteractor
-import com.android.systemui.util.kotlin.Utils.Companion.sample as sampleCombine
import com.android.systemui.util.kotlin.sample
import javax.inject.Inject
import javax.inject.Provider
@@ -280,16 +279,12 @@
* signal should be sent directly to transitions.
*/
val dismissAlpha: Flow<Float?> =
- shadeRepository.legacyShadeExpansion
- .filter { it < 1f }
- .sampleCombine(
+ combine(
+ shadeRepository.legacyShadeExpansion,
statusBarState,
keyguardTransitionInteractor.currentKeyguardState,
isKeyguardDismissible,
- )
- .map {
- (legacyShadeExpansion, statusBarState, currentKeyguardState, isKeyguardDismissible)
- ->
+ ) { legacyShadeExpansion, statusBarState, currentKeyguardState, isKeyguardDismissible ->
if (
statusBarState == StatusBarState.KEYGUARD &&
isKeyguardDismissible &&
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/DeviceEntryIconViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/DeviceEntryIconViewBinder.kt
index e423fe0..f46a207 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/DeviceEntryIconViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/DeviceEntryIconViewBinder.kt
@@ -25,7 +25,6 @@
import androidx.core.view.isInvisible
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
-import com.android.app.tracing.coroutines.launch
import com.android.systemui.common.ui.view.LongPressHandlingView
import com.android.systemui.deviceentry.shared.DeviceEntryUdfpsRefactor
import com.android.systemui.keyguard.ui.view.DeviceEntryIconView
@@ -35,15 +34,13 @@
import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.statusbar.VibratorHelper
-import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.launch
@ExperimentalCoroutinesApi
object DeviceEntryIconViewBinder {
- private const val TAG = "DeviceEntryIconViewBinder"
-
/**
* Updates UI for:
* - device entry containing view (parent view for the below views)
@@ -61,7 +58,6 @@
bgViewModel: DeviceEntryBackgroundViewModel,
falsingManager: FalsingManager,
vibratorHelper: VibratorHelper,
- mainImmediateDispatcher: CoroutineDispatcher,
) {
DeviceEntryUdfpsRefactor.isUnexpectedlyInLegacyMode()
val longPressHandlingView = view.longPressHandlingView
@@ -77,33 +73,31 @@
view,
HapticFeedbackConstants.CONFIRM,
)
- applicationScope.launch("$TAG#viewModel.onLongPress") {
- viewModel.onLongPress()
- }
+ applicationScope.launch { viewModel.onLongPress() }
}
}
- view.repeatWhenAttached(mainImmediateDispatcher) {
+ view.repeatWhenAttached {
// Repeat on CREATED so that the view will always observe the entire
// GONE => AOD transition (even though the view may not be visible until the middle
// of the transition.
repeatOnLifecycle(Lifecycle.State.CREATED) {
- launch("$TAG#viewModel.isVisible") {
+ launch {
viewModel.isVisible.collect { isVisible ->
longPressHandlingView.isInvisible = !isVisible
}
}
- launch("$TAG#viewModel.isLongPressEnabled") {
+ launch {
viewModel.isLongPressEnabled.collect { isEnabled ->
longPressHandlingView.setLongPressHandlingEnabled(isEnabled)
}
}
- launch("$TAG#viewModel.accessibilityDelegateHint") {
+ launch {
viewModel.accessibilityDelegateHint.collect { hint ->
view.accessibilityHintType = hint
}
}
- launch("$TAG#viewModel.useBackgroundProtection") {
+ launch {
viewModel.useBackgroundProtection.collect { useBackgroundProtection ->
if (useBackgroundProtection) {
bgView.visibility = View.VISIBLE
@@ -112,7 +106,7 @@
}
}
}
- launch("$TAG#viewModel.burnInOffsets") {
+ launch {
viewModel.burnInOffsets.collect { burnInOffsets ->
view.translationX = burnInOffsets.x.toFloat()
view.translationY = burnInOffsets.y.toFloat()
@@ -120,17 +114,15 @@
}
}
- launch("$TAG#viewModel.deviceEntryViewAlpha") {
- viewModel.deviceEntryViewAlpha.collect { alpha -> view.alpha = alpha }
- }
+ launch { viewModel.deviceEntryViewAlpha.collect { alpha -> view.alpha = alpha } }
}
}
- fgIconView.repeatWhenAttached(mainImmediateDispatcher) {
+ fgIconView.repeatWhenAttached {
repeatOnLifecycle(Lifecycle.State.STARTED) {
// Start with an empty state
fgIconView.setImageState(StateSet.NOTHING, /* merge */ false)
- launch("$TAG#fgViewModel.viewModel") {
+ launch {
fgViewModel.viewModel.collect { viewModel ->
fgIconView.setImageState(
view.getIconState(viewModel.type, viewModel.useAodVariant),
@@ -150,10 +142,8 @@
bgView.repeatWhenAttached {
repeatOnLifecycle(Lifecycle.State.CREATED) {
- launch("$TAG#bgViewModel.alpha") {
- bgViewModel.alpha.collect { alpha -> bgView.alpha = alpha }
- }
- launch("$TAG#bgViewModel.color") {
+ launch { bgViewModel.alpha.collect { alpha -> bgView.alpha = alpha } }
+ launch {
bgViewModel.color.collect { color ->
bgView.imageTintList = ColorStateList.valueOf(color)
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinder.kt
index 1b06a69..6255f0d 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinder.kt
@@ -26,7 +26,6 @@
import androidx.constraintlayout.widget.ConstraintSet
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
-import com.android.app.tracing.coroutines.launch
import com.android.keyguard.KeyguardClockSwitch.LARGE
import com.android.keyguard.KeyguardClockSwitch.SMALL
import com.android.systemui.keyguard.MigrateClocksToBlueprint
@@ -38,10 +37,10 @@
import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.plugins.clocks.ClockController
import com.android.systemui.shared.clocks.DEFAULT_CLOCK_ID
-import kotlinx.coroutines.DisposableHandle
+import kotlinx.coroutines.launch
object KeyguardClockViewBinder {
- private const val TAG = "KeyguardClockViewBinder"
+ private val TAG = KeyguardClockViewBinder::class.simpleName!!
// When changing to new clock, we need to remove old clock views from burnInLayer
private var lastClock: ClockController? = null
@JvmStatic
@@ -51,12 +50,15 @@
viewModel: KeyguardClockViewModel,
keyguardClockInteractor: KeyguardClockInteractor,
blueprintInteractor: KeyguardBlueprintInteractor,
- ): DisposableHandle {
- keyguardClockInteractor.clockEventController.registerListeners(keyguardRootView)
-
- return keyguardRootView.repeatWhenAttached {
+ ) {
+ keyguardRootView.repeatWhenAttached {
repeatOnLifecycle(Lifecycle.State.CREATED) {
- launch("$TAG#viewModel.currentClock") {
+ keyguardClockInteractor.clockEventController.registerListeners(keyguardRootView)
+ }
+ }
+ keyguardRootView.repeatWhenAttached {
+ repeatOnLifecycle(Lifecycle.State.CREATED) {
+ launch {
if (!MigrateClocksToBlueprint.isEnabled) return@launch
viewModel.currentClock.collect { currentClock ->
cleanupClockViews(currentClock, keyguardRootView, viewModel.burnInLayer)
@@ -65,14 +67,14 @@
applyConstraints(clockSection, keyguardRootView, true)
}
}
- launch("$TAG#viewModel.clockSize") {
+ launch {
if (!MigrateClocksToBlueprint.isEnabled) return@launch
viewModel.clockSize.collect {
updateBurnInLayer(keyguardRootView, viewModel)
blueprintInteractor.refreshBlueprint(Type.ClockSize)
}
}
- launch("$TAG#viewModel.clockShouldBeCentered") {
+ launch {
if (!MigrateClocksToBlueprint.isEnabled) return@launch
viewModel.clockShouldBeCentered.collect { clockShouldBeCentered ->
viewModel.currentClock.value?.let {
@@ -89,7 +91,7 @@
}
}
}
- launch("$TAG#viewModel.isAodIconsVisible") {
+ launch {
if (!MigrateClocksToBlueprint.isEnabled) return@launch
viewModel.isAodIconsVisible.collect { isAodIconsVisible ->
viewModel.currentClock.value?.let {
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt
index 6c21e6c..abd79ab 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt
@@ -30,7 +30,6 @@
import androidx.core.view.updateLayoutParams
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
-import com.android.app.tracing.coroutines.launch
import com.android.settingslib.Utils
import com.android.systemui.animation.Expandable
import com.android.systemui.animation.view.LaunchableImageView
@@ -42,11 +41,11 @@
import com.android.systemui.res.R
import com.android.systemui.statusbar.VibratorHelper
import com.android.systemui.util.doOnEnd
-import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.map
+import kotlinx.coroutines.launch
/** This is only for a SINGLE Quick affordance */
object KeyguardQuickAffordanceViewBinder {
@@ -54,7 +53,6 @@
private const val EXIT_DOZE_BUTTON_REVEAL_ANIMATION_DURATION_MS = 250L
private const val SCALE_SELECTED_BUTTON = 1.23f
private const val DIM_ALPHA = 0.3f
- private const val TAG = "KeyguardQuickAffordanceViewBinder"
/**
* Defines interface for an object that acts as the binding between the view and its view-model.
@@ -76,15 +74,14 @@
alpha: Flow<Float>,
falsingManager: FalsingManager?,
vibratorHelper: VibratorHelper?,
- mainImmediateDispatcher: CoroutineDispatcher,
messageDisplayer: (Int) -> Unit,
): Binding {
val button = view as ImageView
val configurationBasedDimensions = MutableStateFlow(loadFromResources(view))
val disposableHandle =
- view.repeatWhenAttached(mainImmediateDispatcher) {
+ view.repeatWhenAttached {
repeatOnLifecycle(Lifecycle.State.STARTED) {
- launch("$TAG#viewModel.collect") {
+ launch {
viewModel.collect { buttonModel ->
updateButton(
view = button,
@@ -96,7 +93,7 @@
}
}
- launch("$TAG#updateButtonAlpha") {
+ launch {
updateButtonAlpha(
view = button,
viewModel = viewModel,
@@ -104,7 +101,7 @@
)
}
- launch("$TAG#configurationBasedDimensions") {
+ launch {
configurationBasedDimensions.collect { dimensions ->
button.updateLayoutParams<ViewGroup.LayoutParams> {
width = dimensions.buttonSizePx.width
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt
index 44fd582..5ee35e4f 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt
@@ -33,7 +33,6 @@
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
import com.android.app.animation.Interpolators
-import com.android.app.tracing.coroutines.launch
import com.android.internal.jank.InteractionJankMonitor
import com.android.internal.jank.InteractionJankMonitor.CUJ_SCREEN_OFF_SHOW_AOD
import com.android.systemui.Flags.newAodTransition
@@ -73,7 +72,6 @@
import com.android.systemui.util.ui.stopAnimating
import com.android.systemui.util.ui.value
import kotlin.math.min
-import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.DisposableHandle
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.coroutineScope
@@ -81,6 +79,7 @@
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.update
+import kotlinx.coroutines.launch
/** Bind occludingAppDeviceEntryMessageViewModel to run whenever the keyguard view is attached. */
@OptIn(ExperimentalCoroutinesApi::class)
@@ -101,7 +100,6 @@
vibratorHelper: VibratorHelper?,
falsingManager: FalsingManager?,
keyguardViewMediator: KeyguardViewMediator?,
- mainImmediateDispatcher: CoroutineDispatcher,
): DisposableHandle {
val disposables = DisposableHandles()
val childViews = mutableMapOf<Int, View>()
@@ -125,9 +123,9 @@
)
disposables +=
- view.repeatWhenAttached(mainImmediateDispatcher) {
+ view.repeatWhenAttached {
repeatOnLifecycle(Lifecycle.State.CREATED) {
- launch("$TAG#occludingAppDeviceEntryMessageViewModel.message") {
+ launch {
occludingAppDeviceEntryMessageViewModel.message.collect { biometricMessage
->
if (biometricMessage?.message != null) {
@@ -146,7 +144,7 @@
if (
KeyguardBottomAreaRefactor.isEnabled || DeviceEntryUdfpsRefactor.isEnabled
) {
- launch("$TAG#viewModel.alpha") {
+ launch {
viewModel.alpha(viewState).collect { alpha ->
view.alpha = alpha
if (KeyguardBottomAreaRefactor.isEnabled) {
@@ -158,21 +156,21 @@
}
if (MigrateClocksToBlueprint.isEnabled) {
- launch("$TAG#viewModel.burnInLayerVisibility") {
+ launch {
viewModel.burnInLayerVisibility.collect { visibility ->
childViews[burnInLayerId]?.visibility = visibility
childViews[aodNotificationIconContainerId]?.visibility = visibility
}
}
- launch("$TAG#viewModel.burnInLayerAlpha") {
+ launch {
viewModel.burnInLayerAlpha.collect { alpha ->
childViews[statusViewId]?.alpha = alpha
childViews[aodNotificationIconContainerId]?.alpha = alpha
}
}
- launch("$TAG#viewModel.topClippingBounds") {
+ launch {
val clipBounds = Rect()
viewModel.topClippingBounds.collect { clipTop ->
if (clipTop == null) {
@@ -189,13 +187,13 @@
}
}
- launch("$TAG#viewModel.lockscreenStateAlpha") {
+ launch {
viewModel.lockscreenStateAlpha(viewState).collect { alpha ->
childViews[statusViewId]?.alpha = alpha
}
}
- launch("$TAG#viewModel.translationY") {
+ launch {
// When translation happens in burnInLayer, it won't be weather clock
// large clock isn't added to burnInLayer due to its scale transition
// so we also need to add translation to it here
@@ -207,7 +205,7 @@
}
}
- launch("$TAG#viewModel.translationX") {
+ launch {
viewModel.translationX.collect { state ->
val px = state.value ?: return@collect
when {
@@ -234,7 +232,7 @@
}
}
- launch("$TAG#viewModel.scale") {
+ launch {
viewModel.scale.collect { scaleViewModel ->
if (scaleViewModel.scaleClockOnly) {
// For clocks except weather clock, we have scale transition
@@ -265,7 +263,7 @@
}
if (NotificationIconContainerRefactor.isEnabled) {
- launch("$TAG#viewModel.isNotifIconContainerVisible") {
+ launch {
val iconsAppearTranslationPx =
configuration
.getDimensionPixelSize(R.dimen.shelf_appear_translation)
@@ -282,7 +280,7 @@
}
interactionJankMonitor?.let { jankMonitor ->
- launch("$TAG#viewModel.goneToAodTransition") {
+ launch {
viewModel.goneToAodTransition.collect {
when (it.transitionState) {
TransitionState.STARTED -> {
@@ -308,7 +306,7 @@
}
}
- launch("$TAG#shadeInteractor.isAnyFullyExpanded") {
+ launch {
shadeInteractor.isAnyFullyExpanded.collect { isFullyAnyExpanded ->
view.visibility =
if (isFullyAnyExpanded) {
@@ -319,12 +317,10 @@
}
}
- launch("$TAG#burnInParams.collect") {
- burnInParams.collect { viewModel.updateBurnInParams(it) }
- }
+ launch { burnInParams.collect { viewModel.updateBurnInParams(it) } }
if (deviceEntryHapticsInteractor != null && vibratorHelper != null) {
- launch("$TAG#deviceEntryHapticsInteractor.playSuccessHaptic") {
+ launch {
deviceEntryHapticsInteractor.playSuccessHaptic.collect {
vibratorHelper.performHapticFeedback(
view,
@@ -334,7 +330,7 @@
}
}
- launch("$TAG#deviceEntryHapticsInteractor.playErrorHaptic") {
+ launch {
deviceEntryHapticsInteractor.playErrorHaptic.collect {
vibratorHelper.performHapticFeedback(
view,
@@ -589,5 +585,4 @@
private const val ID = "occluding_app_device_entry_unlock_msg"
private const val AOD_ICONS_APPEAR_DURATION: Long = 200
- private const val TAG = "KeyguardRootViewBinder"
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt
index 40ea445..7c6edb0 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt
@@ -390,7 +390,6 @@
null, // device entry haptics not required for preview mode
null, // falsing manager not required for preview mode
null, // keyguard view mediator is not required for preview mode
- mainDispatcher,
)
}
rootView.addView(
@@ -457,7 +456,6 @@
alpha = flowOf(1f),
falsingManager = falsingManager,
vibratorHelper = vibratorHelper,
- mainImmediateDispatcher = mainDispatcher,
) { message ->
indicationController.showTransientIndication(message)
}
@@ -472,7 +470,6 @@
alpha = flowOf(1f),
falsingManager = falsingManager,
vibratorHelper = vibratorHelper,
- mainImmediateDispatcher = mainDispatcher,
) { message ->
indicationController.showTransientIndication(message)
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AlignShortcutsToUdfpsSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AlignShortcutsToUdfpsSection.kt
index 5404729..2e96638 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AlignShortcutsToUdfpsSection.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AlignShortcutsToUdfpsSection.kt
@@ -36,7 +36,6 @@
import com.android.systemui.statusbar.KeyguardIndicationController
import com.android.systemui.statusbar.VibratorHelper
import javax.inject.Inject
-import kotlinx.coroutines.CoroutineDispatcher
class AlignShortcutsToUdfpsSection
@Inject
@@ -48,7 +47,6 @@
private val falsingManager: FalsingManager,
private val indicationController: KeyguardIndicationController,
private val vibratorHelper: VibratorHelper,
- @Main private val mainImmediateDispatcher: CoroutineDispatcher,
) : BaseShortcutSection() {
override fun addViews(constraintLayout: ConstraintLayout) {
if (KeyguardBottomAreaRefactor.isEnabled) {
@@ -66,7 +64,6 @@
keyguardQuickAffordancesCombinedViewModel.transitionAlpha,
falsingManager,
vibratorHelper,
- mainImmediateDispatcher,
) {
indicationController.showTransientIndication(it)
}
@@ -77,7 +74,6 @@
keyguardQuickAffordancesCombinedViewModel.transitionAlpha,
falsingManager,
vibratorHelper,
- mainImmediateDispatcher,
) {
indicationController.showTransientIndication(it)
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/ClockSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/ClockSection.kt
index e0bf815..78a1fcf 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/ClockSection.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/ClockSection.kt
@@ -45,7 +45,6 @@
import com.android.systemui.shared.R as sharedR
import dagger.Lazy
import javax.inject.Inject
-import kotlinx.coroutines.DisposableHandle
internal fun ConstraintSet.setVisibility(
views: Iterable<View>,
@@ -66,23 +65,19 @@
val smartspaceViewModel: KeyguardSmartspaceViewModel,
val blueprintInteractor: Lazy<KeyguardBlueprintInteractor>,
) : KeyguardSection() {
- private var handle: DisposableHandle? = null
-
override fun addViews(constraintLayout: ConstraintLayout) {}
override fun bindData(constraintLayout: ConstraintLayout) {
if (!MigrateClocksToBlueprint.isEnabled) {
return
}
- handle?.dispose()
- handle =
- KeyguardClockViewBinder.bind(
- this,
- constraintLayout,
- keyguardClockViewModel,
- clockInteractor,
- blueprintInteractor.get()
- )
+ KeyguardClockViewBinder.bind(
+ this,
+ constraintLayout,
+ keyguardClockViewModel,
+ clockInteractor,
+ blueprintInteractor.get()
+ )
}
override fun applyConstraints(constraintSet: ConstraintSet) {
@@ -94,13 +89,7 @@
}
}
- override fun removeViews(constraintLayout: ConstraintLayout) {
- if (!MigrateClocksToBlueprint.isEnabled) {
- return
- }
- handle?.dispose()
- handle = null
- }
+ override fun removeViews(constraintLayout: ConstraintLayout) {}
private fun buildConstraints(
clock: ClockController,
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt
index 865e989..29041d1 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt
@@ -30,7 +30,6 @@
import com.android.keyguard.LockIconViewController
import com.android.systemui.biometrics.AuthController
import com.android.systemui.dagger.qualifiers.Application
-import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.deviceentry.shared.DeviceEntryUdfpsRefactor
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
@@ -48,7 +47,6 @@
import com.android.systemui.statusbar.VibratorHelper
import dagger.Lazy
import javax.inject.Inject
-import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -69,7 +67,6 @@
private val deviceEntryBackgroundViewModel: Lazy<DeviceEntryBackgroundViewModel>,
private val falsingManager: Lazy<FalsingManager>,
private val vibratorHelper: Lazy<VibratorHelper>,
- @Main private val mainImmediateDispatcher: CoroutineDispatcher,
) : KeyguardSection() {
private val deviceEntryIconViewId = R.id.device_entry_icon_view
@@ -107,7 +104,6 @@
deviceEntryBackgroundViewModel.get(),
falsingManager.get(),
vibratorHelper.get(),
- mainImmediateDispatcher,
)
}
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt
index 27ca5cd..45b8257 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt
@@ -35,7 +35,6 @@
import com.android.systemui.statusbar.KeyguardIndicationController
import com.android.systemui.statusbar.VibratorHelper
import javax.inject.Inject
-import kotlinx.coroutines.CoroutineDispatcher
class DefaultShortcutsSection
@Inject
@@ -47,7 +46,6 @@
private val falsingManager: FalsingManager,
private val indicationController: KeyguardIndicationController,
private val vibratorHelper: VibratorHelper,
- @Main private val mainImmediateDispatcher: CoroutineDispatcher,
) : BaseShortcutSection() {
override fun addViews(constraintLayout: ConstraintLayout) {
if (KeyguardBottomAreaRefactor.isEnabled) {
@@ -65,7 +63,6 @@
keyguardQuickAffordancesCombinedViewModel.transitionAlpha,
falsingManager,
vibratorHelper,
- mainImmediateDispatcher,
) {
indicationController.showTransientIndication(it)
}
@@ -76,7 +73,6 @@
keyguardQuickAffordancesCombinedViewModel.transitionAlpha,
falsingManager,
vibratorHelper,
- mainImmediateDispatcher,
) {
indicationController.showTransientIndication(it)
}
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt
index ca55dd8..f32d5b8 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt
@@ -142,7 +142,6 @@
context.resources,
context,
mainExecutor,
- IMMEDIATE,
bgExecutor,
clockBuffers,
withDeps.featureFlags,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeUiTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeUiTest.java
index e7caf00..7311f4a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeUiTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeUiTest.java
@@ -41,8 +41,6 @@
import com.android.systemui.DejankUtils;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.statusbar.phone.DozeParameters;
-import com.android.systemui.util.concurrency.FakeExecutor;
-import com.android.systemui.util.time.FakeSystemClock;
import com.android.systemui.util.wakelock.WakeLockFake;
import org.junit.After;
@@ -71,7 +69,6 @@
private Handler mHandler;
private HandlerThread mHandlerThread;
private DozeUi mDozeUi;
- private FakeExecutor mFakeExecutor;
@Before
public void setUp() throws Exception {
@@ -83,9 +80,9 @@
mHandlerThread.start();
mWakeLock = new WakeLockFake();
mHandler = mHandlerThread.getThreadHandler();
- mFakeExecutor = new FakeExecutor(new FakeSystemClock());
+
mDozeUi = new DozeUi(mContext, mAlarmManager, mWakeLock, mHost, mHandler,
- mDozeParameters, mFakeExecutor, mDozeLog);
+ mDozeParameters, mDozeLog);
mDozeUi.setDozeMachine(mMachine);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt
index b5f668c..4f2b690 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt
@@ -38,7 +38,6 @@
import com.android.systemui.statusbar.VibratorHelper
import com.android.systemui.util.mockito.whenever
import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.test.TestScope
@@ -86,7 +85,6 @@
{ mock(DeviceEntryBackgroundViewModel::class.java) },
{ falsingManager },
{ mock(VibratorHelper::class.java) },
- mock(CoroutineDispatcher::class.java),
)
}