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

Commit 5a9d75f6 authored by Lucas Silva's avatar Lucas Silva
Browse files

Fix issue with edit mode being dismissed immediately

When the device is dreaming and the user enters edit mode, it may take
some time for the dream to exit. During this time, the
EditWidgetsActivity enters a stopped state since the dream is still on
top. This can cause the activity to dismiss itself immediately.

This change addresses this by:
1. Setting android:turnScreenOn to true for EditWidgetsActivity to
   ensure it terminates the dream sooner when it starts.
2. Waiting for the dream to finish before considering the activity
   visible.

Fixes: 368208874
Test: manually by setting device lock to "swipe" and entering edit mode
while dreaming
Flag: EXEMPT bugfix

Change-Id: I2a903ddc754fe9db5b4b690fbf04d0bd15b7af71
parent 33942c1e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1013,6 +1013,7 @@
            android:autoRemoveFromRecents="true"
            android:launchMode="singleTop"
            android:showForAllUsers="true"
            android:turnScreenOn="true"
            android:exported="false">
        </activity>

+6 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.ui.Modifier
import androidx.lifecycle.lifecycleScope
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.compose.theme.PlatformTheme
import com.android.internal.logging.UiEventLogger
import com.android.systemui.Flags.communalEditWidgetsActivityFinishFix
@@ -44,6 +45,7 @@ import com.android.systemui.communal.ui.compose.CommunalHub
import com.android.systemui.communal.ui.view.layout.sections.CommunalAppWidgetSection
import com.android.systemui.communal.ui.viewmodel.CommunalEditModeViewModel
import com.android.systemui.communal.util.WidgetPickerIntentUtils.getWidgetExtraFromIntent
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.core.Logger
@@ -52,13 +54,13 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.settings.UserTracker
import javax.inject.Inject
import kotlinx.coroutines.flow.first
import com.android.app.tracing.coroutines.launchTraced as launch

/** An Activity for editing the widgets that appear in hub mode. */
class EditWidgetsActivity
@Inject
constructor(
    private val communalViewModel: CommunalEditModeViewModel,
    private val keyguardInteractor: KeyguardInteractor,
    private var windowManagerService: IWindowManager? = null,
    private val uiEventLogger: UiEventLogger,
    private val widgetConfiguratorFactory: WidgetConfigurationController.Factory,
@@ -223,6 +225,9 @@ constructor(
                    communalViewModel.currentScene.first { it == CommunalScenes.Blank }
                }

                // Wait for dream to exit, if we were previously dreaming.
                keyguardInteractor.isDreaming.first { !it }

                communalViewModel.setEditModeState(EditModeState.SHOWING)

                // Inform the ActivityController that we are now fully visible.