Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae3dbf5b authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge changes I51287df6,If25d3a0e into main

* changes:
  Remove dozeui binder call
  Add coroutine names for tracing
parents 0732d71d 61b2f3f6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import androidx.core.content.res.ResourcesCompat
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
@@ -43,6 +44,7 @@ import com.android.systemui.res.R
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

@@ -54,6 +56,7 @@ constructor(
    private val vibratorHelper: VibratorHelper,
    private val indicationController: KeyguardIndicationController,
    private val indicationAreaViewModel: KeyguardIndicationAreaViewModel,
    @Main private val mainImmediateDispatcher: CoroutineDispatcher,
) {
    /**
     * Renders a single lockscreen shortcut.
@@ -161,6 +164,7 @@ constructor(
                        transitionAlpha,
                        falsingManager,
                        vibratorHelper,
                        mainImmediateDispatcher,
                    ) {
                        indicationController.showTransientIndication(it)
                    }
+4 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import com.android.keyguard.LockIconView
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
@@ -50,12 +51,14 @@ import com.android.systemui.shade.NotificationPanelView
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,
@@ -93,6 +96,7 @@ constructor(
                                deviceEntryBackgroundViewModel.get(),
                                falsingManager.get(),
                                vibratorHelper.get(),
                                mainImmediateDispatcher,
                            )
                        }
                    } else {
+4 −2
Original line number Diff line number Diff line
@@ -214,14 +214,16 @@ class KeyguardInteractorTest : SysuiTestCase() {
            )

            repository.setStatusBarState(StatusBarState.KEYGUARD)
            shadeRepository.setLegacyShadeExpansion(1f)
            // User begins to swipe up
            shadeRepository.setLegacyShadeExpansion(0.99f)

            // When not dismissable, no alpha value (null) should emit
            repository.setKeyguardDismissible(false)
            assertThat(dismissAlpha).isNull()

            repository.setKeyguardDismissible(true)
            assertThat(dismissAlpha).isGreaterThan(0.95f)
            shadeRepository.setLegacyShadeExpansion(0.98f)
            assertThat(dismissAlpha).isGreaterThan(0.5f)
        }

    @Test
+12 −8
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.view.ViewTreeObserver.OnGlobalLayoutListener
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
@@ -65,6 +66,7 @@ import java.util.Locale
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
@@ -72,7 +74,6 @@ import kotlinx.coroutines.flow.combine
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
@@ -90,6 +91,7 @@ constructor(
    @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,
@@ -424,7 +426,7 @@ constructor(
        keyguardUpdateMonitor.registerCallback(keyguardUpdateMonitorCallback)
        zenModeController.addCallback(zenModeCallback)
        disposableHandle =
            parent.repeatWhenAttached {
            parent.repeatWhenAttached(mainImmediateDispatcher) {
                repeatOnLifecycle(Lifecycle.State.CREATED) {
                    listenForDozing(this)
                    if (MigrateClocksToBlueprint.isEnabled) {
@@ -529,12 +531,14 @@ constructor(

    @VisibleForTesting
    internal fun listenForDozeAmount(scope: CoroutineScope): Job {
        return scope.launch { keyguardInteractor.dozeAmount.collect { handleDoze(it) } }
        return scope.launch("$TAG#listenForDozeAmount") {
            keyguardInteractor.dozeAmount.collect { handleDoze(it) }
        }
    }

    @VisibleForTesting
    internal fun listenForDozeAmountTransition(scope: CoroutineScope): Job {
        return scope.launch {
        return scope.launch("$TAG#listenForDozeAmountTransition") {
            merge(
                    keyguardTransitionInteractor.aodToLockscreenTransition.map { step ->
                        step.copy(value = 1f - step.value)
@@ -550,7 +554,7 @@ constructor(
     */
    @VisibleForTesting
    internal fun listenForAnyStateToAodTransition(scope: CoroutineScope): Job {
        return scope.launch {
        return scope.launch("$TAG#listenForAnyStateToAodTransition") {
            keyguardTransitionInteractor
                .transitionStepsToState(AOD)
                .filter { it.transitionState == TransitionState.STARTED }
@@ -561,7 +565,7 @@ constructor(

    @VisibleForTesting
    internal fun listenForDozing(scope: CoroutineScope): Job {
        return scope.launch {
        return scope.launch("$TAG#listenForDozing") {
            combine(
                    keyguardInteractor.dozeAmount,
                    keyguardInteractor.isDozing,
@@ -626,7 +630,7 @@ constructor(
    }

    companion object {
        private val TAG = ClockEventController::class.simpleName!!
        private val DOZE_TICKRATE_THRESHOLD = 0.99f
        private const val TAG = "ClockEventController"
        private const val DOZE_TICKRATE_THRESHOLD = 0.99f
    }
}
+6 −3
Original line number Diff line number Diff line
@@ -250,7 +250,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
            mLargeClockFrame = mView.findViewById(R.id.lockscreen_clock_view_large);
        }


        if (!mOnlyClock) {
            mDumpManager.unregisterDumpable(getClass().getSimpleName()); // unregister previous
            mDumpManager.registerDumpable(getClass().getSimpleName(), this);
@@ -282,7 +281,9 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
    protected void onViewAttached() {
        mClockRegistry.registerClockChangeListener(mClockChangedListener);
        setClock(mClockRegistry.createCurrentClock());
        if (!MigrateClocksToBlueprint.isEnabled()) {
            mClockEventController.registerListeners(mView);
        }
        mKeyguardSmallClockTopMargin =
                mView.getResources().getDimensionPixelSize(R.dimen.keyguard_clock_top_margin);
        mKeyguardLargeClockTopMargin =
@@ -365,7 +366,9 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
    @Override
    protected void onViewDetached() {
        mClockRegistry.unregisterClockChangeListener(mClockChangedListener);
        if (!MigrateClocksToBlueprint.isEnabled()) {
            mClockEventController.unregisterListeners();
        }
        setClock(null);

        mBgExecutor.execute(() -> {
Loading