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

Commit 7fbe96ab authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

[Floaty] Remove obsolete TopLevelWindowEffectsThread

Bug: 411435519
Flag: com.android.systemui.shared.enable_lpp_assist_invocation_effect
Test: TopLevelWindowEffectsTest
Test: Manual, verified that effect works as expected
Change-Id: Iaf0617e3c9040e8ae2a546bbf0adbd7771ecac5c
parent 2be72ae9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ class TopLevelWindowEffectsTest : SysuiTestCase() {
    private val Kosmos.underTest by
        Kosmos.Fixture {
            TopLevelWindowEffects(
                topLevelWindowEffectsScope = testScope.backgroundScope,
                applicationScope = testScope.backgroundScope,
                squeezeEffectInteractor =
                    SqueezeEffectInteractor(
                        squeezeEffectRepository = fakeSqueezeEffectRepository,
+3 −3
Original line number Diff line number Diff line
@@ -24,9 +24,9 @@ import androidx.core.animation.ValueAnimator
import com.android.app.animation.InterpolatorsAndroidX
import com.android.systemui.CoreStartable
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.keyevent.domain.interactor.KeyEventInteractor
import com.android.systemui.topwindoweffects.domain.interactor.SqueezeEffectInteractor
import com.android.systemui.topwindoweffects.qualifiers.TopLevelWindowEffectsThread
import com.android.systemui.topwindoweffects.ui.viewmodel.SqueezeEffectConfig
import com.android.systemui.topwindoweffects.ui.viewmodel.SqueezeEffectHapticPlayer
import com.android.wm.shell.appzoomout.AppZoomOut
@@ -42,7 +42,7 @@ import kotlinx.coroutines.launch
class TopLevelWindowEffects
@Inject
constructor(
    @TopLevelWindowEffectsThread private val topLevelWindowEffectsScope: CoroutineScope,
    @Application private val applicationScope: CoroutineScope,
    private val squeezeEffectInteractor: SqueezeEffectInteractor,
    private val keyEventInteractor: KeyEventInteractor,
    // TODO(b/409930584): make AppZoomOut non-optional
@@ -68,7 +68,7 @@ constructor(
    }

    override fun start() {
        topLevelWindowEffectsScope.launch {
        applicationScope.launch {
            squeezeEffectInteractor.isSqueezeEffectEnabled.collectLatest { enabled ->
                if (enabled) {
                    squeezeEffectInteractor.isPowerButtonDownAsSingleKeyGesture.collectLatest { down
+0 −36
Original line number Diff line number Diff line
@@ -16,22 +16,13 @@

package com.android.systemui.topwindoweffects.dagger

import android.os.Handler
import android.os.Looper
import com.android.systemui.CoreStartable
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.shared.Flags.enableLppAssistInvocationEffect
import com.android.systemui.topwindoweffects.TopLevelWindowEffects
import com.android.systemui.topwindoweffects.qualifiers.TopLevelWindowEffectsThread
import dagger.Module
import dagger.Provides
import dagger.multibindings.ClassKey
import dagger.multibindings.IntoMap
import java.util.concurrent.Executor
import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.asCoroutineDispatcher

@Module
object TopLevelWindowEffectsModule {
@@ -48,31 +39,4 @@ object TopLevelWindowEffectsModule {
            }
        }
    }

    @Provides
    @SysUISingleton
    @TopLevelWindowEffectsThread
    fun provideTopLevelWindowEffectsHandler(@TopLevelWindowEffectsThread looper: Looper): Handler =
        Handler(looper)

    @Provides
    @SysUISingleton
    @TopLevelWindowEffectsThread
    fun provideTopLevelWindowEffectsScope(
        @TopLevelWindowEffectsThread dispatcher: CoroutineDispatcher
    ): CoroutineScope = CoroutineScope(dispatcher)

    @Provides
    @SysUISingleton
    @TopLevelWindowEffectsThread
    fun provideTopLevelWindowEffectsDispatcher(
        @TopLevelWindowEffectsThread executor: Executor
    ): CoroutineDispatcher = executor.asCoroutineDispatcher()

    @Provides
    @SysUISingleton
    @TopLevelWindowEffectsThread
    fun provideTopLevelWindowEffectsContext(
        @TopLevelWindowEffectsThread dispatcher: CoroutineDispatcher
    ): CoroutineContext = dispatcher
}
+0 −24
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.topwindoweffects.qualifiers

import javax.inject.Qualifier

@Qualifier
@MustBeDocumented
@Retention(AnnotationRetention.RUNTIME)
annotation class TopLevelWindowEffectsThread
+3 −3
Original line number Diff line number Diff line
@@ -17,8 +17,8 @@
package com.android.systemui.topwindoweffects.ui.viewmodel

import android.os.VibrationEffect
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.statusbar.VibratorHelper
import com.android.systemui.topwindoweffects.qualifiers.TopLevelWindowEffectsThread
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
import kotlinx.coroutines.CoroutineScope
@@ -30,7 +30,7 @@ class SqueezeEffectHapticPlayer
@AssistedInject
constructor(
    private val vibratorHelper: VibratorHelper,
    @TopLevelWindowEffectsThread private val topLevelWindowEffectsScope: CoroutineScope,
    @Background private val bgScope: CoroutineScope,
) {

    private val primitiveDurations =
@@ -51,7 +51,7 @@ constructor(
    fun start() {
        cancel()
        vibrationJob =
            topLevelWindowEffectsScope.launch {
            bgScope.launch {
                delay(invocationHaptics.initialDelay.toLong())
                vibratorHelper.vibrate(
                    invocationHaptics.vibration,
Loading