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

Commit fccafcea authored by Sergey Pinkevich's avatar Sergey Pinkevich
Browse files

Dump DesktopRepository for each user

The command to make a dump is: adb shell dumpsys activity service SystemUIService WMShell

Bug: 383073562
Test: manually run dump command and checked output
Flag: EXEMPT not needed because of simple technical change not affeecting user behavior

Change-Id: I5851afddf85426547bd2c5807dbdb293c3ea6def
parent da61b0b8
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -2577,8 +2577,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