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

Commit 4c6b998e authored by Matt Pietal's avatar Matt Pietal
Browse files

Add burn-in for shade migration

This migrates burn-in logic away from KeyguardClockPositionAlgorithm
to flows. Does so by using a constraintlayout Layer, in order to group
elements for scaling and translation.

Weather clocks scales, but smartspace is misplaced and will follow up
work is required on the large version.

Aod notif icon translation has been disabled, as it interferes with other
translation. It is no longer needed in latest motion specs.

Fixes: 296372316
Test: atest KeyguardRootViewModelTest BurnInInteractorTest
Change-Id: Iebc5ca66d441e363d61c3cc536e3a5ae4d0d962e
parent 2cca910b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -221,6 +221,7 @@
    <item type="id" name="split_shade_guideline" />
    <item type="id" name="lock_icon" />
    <item type="id" name="lock_icon_bg" />
    <item type="id" name="burn_in_layer" />

    <!-- Privacy dialog -->
    <item type="id" name="privacy_dialog_close_app_button" />
+4 −0
Original line number Diff line number Diff line
@@ -549,6 +549,10 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
        constraintSet.applyTo(layout);
    }

    public ClockController getClockController() {
        return mKeyguardClockSwitchController.getClock();
    }

    @Override
    public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
        mView.dump(pw, args);
+4 −0
Original line number Diff line number Diff line
@@ -28,4 +28,8 @@ class BurnInHelperWrapper @Inject constructor() {
    fun burnInProgressOffset(): Float {
        return getBurnInProgressOffset()
    }

    fun burnInScale(): Float {
        return getBurnInScale()
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -137,7 +137,8 @@ constructor(
                occludingAppDeviceEntryMessageViewModel,
                chipbarCoordinator,
                keyguardStateController,
                shadeInteractor
                shadeInteractor,
                { keyguardStatusViewController!!.getClockController() },
            )
    }

+18 −1
Original line number Diff line number Diff line
@@ -19,17 +19,22 @@ package com.android.systemui.keyguard.domain.interactor

import android.content.Context
import androidx.annotation.DimenRes
import com.android.systemui.res.R
import com.android.systemui.common.ui.data.repository.ConfigurationRepository
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.doze.util.BurnInHelperWrapper
import com.android.systemui.keyguard.shared.model.BurnInModel
import com.android.systemui.res.R
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.mapLatest
import kotlinx.coroutines.flow.stateIn

@@ -54,6 +59,18 @@ constructor(
            .mapLatest { burnInHelperWrapper.burnInProgressOffset() }
            .stateIn(scope, SharingStarted.Lazily, burnInHelperWrapper.burnInProgressOffset())

    val keyguardBurnIn: Flow<BurnInModel> =
        combine(
                burnInOffset(R.dimen.burn_in_prevention_offset_x, isXAxis = true),
                burnInOffset(R.dimen.burn_in_prevention_offset_y, isXAxis = false).map {
                    it * 2 -
                        context.resources.getDimensionPixelSize(R.dimen.burn_in_prevention_offset_y)
                }
            ) { translationX, translationY ->
                BurnInModel(translationX, translationY, burnInHelperWrapper.burnInScale())
            }
            .distinctUntilChanged()

    /**
     * Use for max burn-in offsets that are NOT specified in pixels. This flow will recalculate the
     * max burn-in offset on any configuration changes. If the max burn-in offset is specified in
Loading