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

Commit 189579e4 authored by Orhan Uysal's avatar Orhan Uysal
Browse files

Add peristence flag to dev options.

Bug: 369062310
Test: m
Flag: EXEMPT no-op
Change-Id: Ifad7c06a828d6736c844b647dd2fd6569b5f198f
parent 25e8d87e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -74,7 +74,8 @@ public enum DesktopModeFlags {
    ENABLE_DESKTOP_APP_LAUNCH_ALTTAB_TRANSITIONS(
            Flags::enableDesktopAppLaunchAlttabTransitions, false),
    ENABLE_DESKTOP_APP_LAUNCH_TRANSITIONS(
            Flags::enableDesktopAppLaunchTransitions, false);
            Flags::enableDesktopAppLaunchTransitions, false),
    ENABLE_DESKTOP_WINDOWING_PERSISTENCE(Flags::enableDesktopWindowingPersistence, false);

    private static final String TAG = "DesktopModeFlagsUtil";
    // Function called to obtain aconfig flag value.
+5 −5
Original line number Diff line number Diff line
@@ -23,12 +23,12 @@ import android.util.ArrayMap
import android.util.ArraySet
import android.util.SparseArray
import android.view.Display.INVALID_DISPLAY
import android.window.DesktopModeFlags
import android.window.WindowContainerToken
import androidx.core.util.forEach
import androidx.core.util.keyIterator
import androidx.core.util.valueIterator
import com.android.internal.protolog.ProtoLog
import com.android.window.flags.Flags
import com.android.wm.shell.desktopmode.persistence.DesktopPersistentRepository
import com.android.wm.shell.desktopmode.persistence.DesktopRepositoryInitializer
import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE
@@ -294,7 +294,7 @@ class DesktopRepository (
                taskId, isVisible, displayId)
            logD("VisibleTaskCount has changed from %d to %d", prevCount, newCount)
            notifyVisibleTaskListeners(displayId, newCount)
            if (Flags.enableDesktopWindowingPersistence()) {
            if (DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_PERSISTENCE.isTrue()) {
                updatePersistentRepository(displayId)
            }
        }
@@ -344,7 +344,7 @@ class DesktopRepository (
        desktopTaskDataByDisplayId.getOrCreate(displayId).freeformTasksInZOrder.add(0, taskId)
        // Unminimize the task if it is minimized.
        unminimizeTask(displayId, taskId)
        if (Flags.enableDesktopWindowingPersistence()) {
        if (DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_PERSISTENCE.isTrue()) {
            updatePersistentRepository(displayId)
        }
    }
@@ -362,7 +362,7 @@ class DesktopRepository (
            desktopTaskDataByDisplayId.getOrCreate(displayId).minimizedTasks.add(taskId)
        }
        updateTask(displayId, taskId, isVisible = false)
        if (Flags.enableDesktopWindowingPersistence()) {
        if (DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_PERSISTENCE.isTrue()) {
            updatePersistentRepository(displayId)
        }
    }
@@ -410,7 +410,7 @@ class DesktopRepository (
        unminimizeTask(displayId, taskId)
        removeActiveTask(taskId)
        removeVisibleTask(taskId)
        if (Flags.enableDesktopWindowingPersistence()) {
        if (DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_PERSISTENCE.isTrue()) {
            updatePersistentRepository(displayId)
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -1161,7 +1161,7 @@ class DesktopTasksController(
                if (runningTaskInfo != null) {
                    // Task is already running, reorder it to the front
                    wct.reorder(runningTaskInfo.token, /* onTop= */ true)
                } else if (Flags.enableDesktopWindowingPersistence()) {
                } else if (DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_PERSISTENCE.isTrue()) {
                    // Task is not running, start it
                    wct.startTask(
                        taskId,
+2 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package com.android.wm.shell.desktopmode.persistence

import android.content.Context
import com.android.window.flags.Flags
import android.window.DesktopModeFlags
import com.android.wm.shell.desktopmode.DesktopRepository
import com.android.wm.shell.shared.annotations.ShellMainThread
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus
@@ -36,7 +36,7 @@ class DesktopRepositoryInitializerImpl(
    @ShellMainThread private val mainCoroutineScope: CoroutineScope,
) : DesktopRepositoryInitializer {
    override fun initialize(repository: DesktopRepository) {
        if (!Flags.enableDesktopWindowingPersistence()) return
        if (!DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_PERSISTENCE.isTrue()) return
        //  TODO: b/365962554 - Handle the case that user moves to desktop before it's initialized
        mainCoroutineScope.launch {
            val desktop = persistentRepository.readDesktop() ?: return@launch
+1 −2
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

import com.android.internal.protolog.ProtoLog;
import com.android.window.flags.Flags;
import com.android.wm.shell.common.ExternalInterfaceBinder;
import com.android.wm.shell.common.RemoteCallable;
import com.android.wm.shell.common.ShellExecutor;
@@ -426,7 +425,7 @@ public class RecentTasksController implements TaskStackListenerCallback,
                // If task has their app bounds set to null which happens after reboot, set the
                // app bounds to persisted lastFullscreenBounds. Also set the position in parent
                // to the top left of the bounds.
                if (Flags.enableDesktopWindowingPersistence()
                if (DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_PERSISTENCE.isTrue()
                        && taskInfo.configuration.windowConfiguration.getAppBounds() == null) {
                    taskInfo.configuration.windowConfiguration.setAppBounds(
                            taskInfo.lastNonFullscreenBounds);