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

Commit 41d3004c authored by Sergey Pinkevich's avatar Sergey Pinkevich Committed by Android (Google) Code Review
Browse files

Merge "Dump DesktopRepository for each user" into main

parents b4ccfabf fccafcea
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -2583,8 +2583,7 @@ class DesktopTasksController(
        val innerPrefix = "$prefix  "
        pw.println("${prefix}DesktopTasksController")
        DesktopModeStatus.dump(pw, innerPrefix, context)
        pw.println("${prefix}userId=$userId")
        taskRepository.dump(pw, innerPrefix)
        userRepositories.dump(pw, innerPrefix)
    }

    /** The interface for calls from outside the shell, within the host process. */
+10 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context
import android.content.pm.UserInfo
import android.os.UserManager
import android.util.SparseArray
import androidx.core.util.forEach
import com.android.internal.protolog.ProtoLog
import com.android.window.flags.Flags
import com.android.wm.shell.desktopmode.persistence.DesktopPersistentRepository
@@ -31,6 +32,7 @@ import com.android.wm.shell.shared.desktopmode.DesktopModeStatus
import com.android.wm.shell.sysui.ShellController
import com.android.wm.shell.sysui.ShellInit
import com.android.wm.shell.sysui.UserChangeListener
import java.io.PrintWriter
import kotlinx.coroutines.CoroutineScope

/** Manages per-user DesktopRepository instances. */
@@ -87,6 +89,14 @@ class DesktopUserRepositories(
        return desktopRepoByUserId.getOrCreate(profileId)
    }

    /** Dumps [DesktopRepository] for each user. */
    fun dump(pw: PrintWriter, prefix: String) {
        desktopRepoByUserId.forEach { key, value ->
            pw.println("${prefix}userId=$key")
            value.dump(pw, prefix)
        }
    }

    override fun onUserChanged(newUserId: Int, userContext: Context) {
        logD("onUserChanged previousUserId=%d, newUserId=%d", userId, newUserId)
        userId = newUserId