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

Skip to content
Commit c0add4e1 authored by Jorge Gil's avatar Jorge Gil
Browse files

[39/N] Desks: Restore persisted desks on reboot

Adds support for restoring persisted desks on shell init. Restoring is
done as follows:
1) DisplayController init must run before
   DesktopRepositoryInitializerImpl to have a list of available
   displays ready (already runs first because of dagger dependencies)
2) On init, DesktopRepositoryInitializerImpl selects desks to persist
   based on available displays from (1) and desk id validity for
   single-desk edge cases
3) For each desk, DesktopRepositoryInitializerImpl creates a new desk
   instance (root task), inserts the desktop data with the new deskId
   and deletes the data under the old deskId
4) DesktopRepositoryInitializerImpl maintains an "isInitialized"
   StateFlow<Boolean> and pings it when finished
5) DesktopDisplayEventHandler collects this StateFlow, and when |true|,
   checks whether an empty desk needs to be created. This prevents
   creating the empty/default desk when persisted desks will be
   restored.

It also starts non-running tasks when activating a desk similar to how
bringDesktopAppsToFront() did it for single-desk setups.

Flag: com.android.window.flags.enable_multiple_desktops_backend
Bug: 393961770
Bug: 391484873
Fix: 393978864
Test: create a couple of desks and add tasks to them, reboot - verify
desks still exist in the repository (with new deskIds)

Change-Id: Idf38fef305088043ea4dbb0a8095181248b6116d
parent 8703cf93
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment