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

Commit c3df9e9d authored by Chris Poultney's avatar Chris Poultney Committed by Android (Google) Code Review
Browse files

Merge "Add crucial comments for wallpaper binding" into main

parents 2b56b57d 24c6cc0d
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -3316,6 +3316,21 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
        return false;
    }

    /*
     * Attempt to bind the wallpaper given by `componentName`, returning true on success otherwise
     * false.
     *
     * When called, `wallpaper` is in a deliberately inconsistent state. Most fields have been
     * updated to describe the desired wallpaper, but the ComponentName is not updated until
     * binding is successful. This is required for maybeDetachWallpapers() to work correctly.
     *
     * The late update of the component field should cause multi-threading headaches with
     * WallpaperConnection#onServiceConnected, but doesn't because onServiceConnected required
     * `mLock` and `bindWallpaperComponentLocked` is always called with that lock, which prevents a
     * race condition.
     *
     * This is a major motivation for making WallpaperData immutable per b/267170056.
     */
    boolean bindWallpaperComponentLocked(ComponentName componentName, boolean force,
            boolean fromUser, WallpaperData wallpaper, IRemoteCallback reply) {
        if (DEBUG_LIVE) {