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

Commit 2c167c08 authored by Jernej Virag's avatar Jernej Virag Committed by Android (Google) Code Review
Browse files

Merge "Move animation scale observer registration Binder to bg thread" into main

parents c7529cb8 f873c219
Loading
Loading
Loading
Loading
+7 −5
Original line number Original line Diff line number Diff line
@@ -216,7 +216,7 @@ constructor(
    private var carouselLocale: Locale? = null
    private var carouselLocale: Locale? = null


    private val animationScaleObserver: ContentObserver =
    private val animationScaleObserver: ContentObserver =
        object : ContentObserver(null) {
        object : ContentObserver(executor, 0) {
            override fun onChange(selfChange: Boolean) {
            override fun onChange(selfChange: Boolean) {
                if (!mediaFlags.isSceneContainerEnabled()) {
                if (!mediaFlags.isSceneContainerEnabled()) {
                    MediaPlayerData.players().forEach { it.updateAnimatorDurationScale() }
                    MediaPlayerData.players().forEach { it.updateAnimatorDurationScale() }
@@ -396,11 +396,13 @@ constructor(
        }
        }


        // Notifies all active players about animation scale changes.
        // Notifies all active players about animation scale changes.
        bgExecutor.execute {
            globalSettings.registerContentObserverSync(
            globalSettings.registerContentObserverSync(
                    Settings.Global.getUriFor(Settings.Global.ANIMATOR_DURATION_SCALE),
                    Settings.Global.getUriFor(Settings.Global.ANIMATOR_DURATION_SCALE),
                    animationScaleObserver
                    animationScaleObserver
            )
            )
        }
        }
    }


    private fun setUpListeners() {
    private fun setUpListeners() {
        val visualStabilityCallback = OnReorderingAllowedListener {
        val visualStabilityCallback = OnReorderingAllowedListener {
+5 −4
Original line number Original line Diff line number Diff line
@@ -193,6 +193,7 @@ class MediaCarouselControllerTest : SysuiTestCase() {
        whenever(panel.mediaViewController).thenReturn(mediaViewController)
        whenever(panel.mediaViewController).thenReturn(mediaViewController)
        whenever(mediaFlags.isPersistentSsCardEnabled()).thenReturn(false)
        whenever(mediaFlags.isPersistentSsCardEnabled()).thenReturn(false)
        MediaPlayerData.clear()
        MediaPlayerData.clear()
        FakeExecutor.exhaustExecutors(bgExecutor)
        verify(globalSettings)
        verify(globalSettings)
                .registerContentObserverSync(
                .registerContentObserverSync(
                        eq(Settings.Global.getUriFor(Settings.Global.ANIMATOR_DURATION_SCALE)),
                        eq(Settings.Global.getUriFor(Settings.Global.ANIMATOR_DURATION_SCALE)),