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

Commit 9aeb352d authored by Todd Lee's avatar Todd Lee
Browse files

Decouple wallpaper tokens in transitions for wear

Bug: b/355596979
Test: presubmits
Flag: com.android.window.flags.ensure_wallpaper_in_wear_transitions
Change-Id: I64de405ac8f98bd94cd80dfa4c4314b9ef804f94
parent e3e4506e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -227,6 +227,16 @@ flag {
  }
}

flag {
  name: "ensure_wallpaper_in_wear_transitions"
  namespace: "windowing_frontend"
  description: "Ensure that wallpaper window tokens are always present/available for collection in transitions on Wear"
  bug: "355596979"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "custom_animations_behind_translucent"
  namespace: "windowing_frontend"
+4 −3
Original line number Diff line number Diff line
@@ -1804,7 +1804,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
                // If on a rotation leash, the wallpaper token surface needs to be shown explicitly
                // because shell only gets the leash and the wallpaper token surface is not allowed
                // to be changed by non-transition logic until the transition is finished.
                if (Flags.ensureWallpaperInTransitions() && wp.isVisibleRequested()
                if (wp.mWmService.mFlags.mEnsureWallpaperInTransitions && wp.isVisibleRequested()
                        && wp.getFixedRotationLeash() != null) {
                    transaction.show(wp.mSurfaceControl);
                }
@@ -2216,7 +2216,8 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            if (wallpaper != null) {
                if (!wallpaper.isVisible() && wallpaper.isVisibleRequested()) {
                    wallpaper.commitVisibility(showWallpaper);
                } else if (Flags.ensureWallpaperInTransitions() && wallpaper.isVisible()
                } else if (wallpaper.mWmService.mFlags.mEnsureWallpaperInTransitions
                        && wallpaper.isVisible()
                        && !showWallpaper && !wallpaper.getDisplayContent().isKeyguardLocked()
                        && !wallpaperIsOwnTarget(wallpaper)) {
                    wallpaper.setVisibleRequested(false);
@@ -2934,7 +2935,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
                    // Use parent rotation because shell doesn't know the surface is rotated.
                    endRotation = parent.getWindowConfiguration().getRotation();
                }
            } else if (isWallpaper(target) && Flags.ensureWallpaperInTransitions()
            } else if (isWallpaper(target) && target.mWmService.mFlags.mEnsureWallpaperInTransitions
                    && target.getRelativeDisplayRotation() != 0
                    && !target.mTransitionController.useShellTransitionsRotation()) {
                // If the wallpaper is "fixed-rotated", shell is unaware of this, so use the
+2 −3
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.protolog.ProtoLog;
import com.android.internal.util.ToBooleanFunction;
import com.android.server.wallpaper.WallpaperCropper.WallpaperCropUtils;
import com.android.window.flags.Flags;

import java.io.PrintWriter;
import java.util.ArrayList;
@@ -759,7 +758,7 @@ class WallpaperController {

    void collectTopWallpapers(Transition transition) {
        if (mFindResults.hasTopShowWhenLockedWallpaper()) {
            if (Flags.ensureWallpaperInTransitions()) {
            if (mService.mFlags.mEnsureWallpaperInTransitions) {
                transition.collect(mFindResults.mTopWallpaper.mTopShowWhenLockedWallpaper.mToken);
            } else {
                transition.collect(mFindResults.mTopWallpaper.mTopShowWhenLockedWallpaper);
@@ -767,7 +766,7 @@ class WallpaperController {

        }
        if (mFindResults.hasTopHideWhenLockedWallpaper()) {
            if (Flags.ensureWallpaperInTransitions()) {
            if (mService.mFlags.mEnsureWallpaperInTransitions) {
                transition.collect(mFindResults.mTopWallpaper.mTopHideWhenLockedWallpaper.mToken);
            } else {
                transition.collect(mFindResults.mTopWallpaper.mTopHideWhenLockedWallpaper);
+1 −2
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import android.os.RemoteException;
import android.util.SparseArray;

import com.android.internal.protolog.ProtoLog;
import com.android.window.flags.Flags;

import java.util.function.Consumer;

@@ -85,7 +84,7 @@ class WallpaperWindowToken extends WindowToken {
    public void prepareSurfaces() {
        super.prepareSurfaces();

        if (Flags.ensureWallpaperInTransitions()) {
        if (mWmService.mFlags.mEnsureWallpaperInTransitions) {
            // Similar to Task.prepareSurfaces, outside of transitions we need to apply visibility
            // changes directly. In transitions the transition player will take care of applying the
            // visibility change.
+24 −0
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.server.wm;

import android.app.AppGlobals;
import android.content.pm.PackageManager;

import com.android.window.flags.Flags;

/**
@@ -53,5 +56,26 @@ class WindowManagerFlags {
    final boolean mRespectNonTopVisibleFixedOrientation =
            Flags.respectNonTopVisibleFixedOrientation();

    final boolean mEnsureWallpaperInTransitions;

    /* End Available Flags */

    WindowManagerFlags() {
        boolean isWatch;
        try {
            isWatch = AppGlobals.getPackageManager().hasSystemFeature(
                        PackageManager.FEATURE_WATCH, 0 /* version */);
        } catch (Throwable e) {
            isWatch = false;
        }
        /*
         * Wallpaper enablement is separated on Wear vs Phone as the latter appears to still exhibit
         * regressions when enabled (for example b/353870983). These don't exist on Wear likely
         * due to differences in SysUI/transition implementations. Wear enablement is required for
         * 25Q2 while phone doesn't have as pressing a constraint and will wait to resolve any
         * outstanding issues prior to roll-out.
         */
        mEnsureWallpaperInTransitions = (isWatch && Flags.ensureWallpaperInWearTransitions())
                || Flags.ensureWallpaperInTransitions();
    }
}
Loading