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

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

Merge "Add burn-in for shade migration" into main

parents 97ee1bfd 4c6b998e
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
@@ -552,6 +552,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