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

Commit ca97932f authored by Riddle Hsu's avatar Riddle Hsu Committed by Automerger Merge Worker
Browse files

Merge "Toggle dim according to progress of recents animation" into udc-dev am:...

Merge "Toggle dim according to progress of recents animation" into udc-dev am: f51e5001 am: 20622b97 am: 3d3cf5a6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23693824



Change-Id: Ic163dce23ad85c5d9c1bfc2a80531633a247af4c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 14ed6ebd 3d3cf5a6
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -178,6 +178,10 @@ class Dimmer {
        mSurfaceAnimatorStarter = surfaceAnimatorStarter;
        mSurfaceAnimatorStarter = surfaceAnimatorStarter;
    }
    }


    WindowContainer<?> getHost() {
        return mHost;
    }

    private SurfaceControl makeDimLayer() {
    private SurfaceControl makeDimLayer() {
        return mHost.makeChildSurface(null)
        return mHost.makeChildSurface(null)
                .setParent(mHost.getSurfaceControl())
                .setParent(mHost.getSurfaceControl())
+2 −1
Original line number Original line Diff line number Diff line
@@ -790,7 +790,8 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {


            // If SystemUI is dragging for recents, we want to reset the dim state so any dim layer
            // If SystemUI is dragging for recents, we want to reset the dim state so any dim layer
            // on the display level fades out.
            // on the display level fades out.
            if (forAllTasks(task -> !task.canAffectSystemUiFlags())) {
            if (!mTransitionController.isShellTransitionsEnabled()
                    && forAllTasks(task -> !task.canAffectSystemUiFlags())) {
                mDimmer.resetDimStates();
                mDimmer.resetDimStates();
            }
            }


+32 −0
Original line number Original line Diff line number Diff line
@@ -397,6 +397,28 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        return false;
        return false;
    }
    }


    boolean canApplyDim(@NonNull Task task) {
        if (mTransientLaunches == null) return true;
        final Dimmer dimmer = task.getDimmer();
        final WindowContainer<?> dimmerHost = dimmer != null ? dimmer.getHost() : null;
        if (dimmerHost == null) return false;
        if (isInTransientHide(dimmerHost)) {
            // The layer of dimmer is inside transient-hide task, then allow to dim.
            return true;
        }
        // The dimmer host of a translucent task can be a display, then it is not in transient-hide.
        for (int i = mTransientLaunches.size() - 1; i >= 0; --i) {
            // The transient task is usually the task of recents/home activity.
            final Task transientTask = mTransientLaunches.keyAt(i).getTask();
            if (transientTask != null && transientTask.canAffectSystemUiFlags()) {
                // It usually means that the recents animation has moved the transient-hide task
                // an noticeable distance, then the display level dimmer should not show.
                return false;
            }
        }
        return true;
    }

    boolean hasTransientLaunch() {
    boolean hasTransientLaunch() {
        return mTransientLaunches != null && !mTransientLaunches.isEmpty();
        return mTransientLaunches != null && !mTransientLaunches.isEmpty();
    }
    }
@@ -1224,6 +1246,16 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
                    mController.mAtm.mRootWindowContainer.getDisplayContent(mRecentsDisplayId);
                    mController.mAtm.mRootWindowContainer.getDisplayContent(mRecentsDisplayId);
            dc.getInputMonitor().setActiveRecents(null /* activity */, null /* layer */);
            dc.getInputMonitor().setActiveRecents(null /* activity */, null /* layer */);
        }
        }
        if (mTransientLaunches != null) {
            for (int i = mTransientLaunches.size() - 1; i >= 0; --i) {
                // Reset the ability of controlling SystemUi which might be changed by
                // setTransientLaunch or setRecentsAppBehindSystemBars.
                final Task task = mTransientLaunches.keyAt(i).getTask();
                if (task != null) {
                    task.setCanAffectSystemUiFlags(true);
                }
            }
        }


        for (int i = 0; i < mTargetDisplays.size(); ++i) {
        for (int i = 0; i < mTargetDisplays.size(); ++i) {
            final DisplayContent dc = mTargetDisplays.get(i);
            final DisplayContent dc = mTargetDisplays.get(i);
+13 −0
Original line number Original line Diff line number Diff line
@@ -477,6 +477,19 @@ class TransitionController {
        return false;
        return false;
    }
    }


    boolean canApplyDim(@Nullable Task task) {
        if (task == null) {
            // Always allow non-activity window.
            return true;
        }
        for (int i = mPlayingTransitions.size() - 1; i >= 0; --i) {
            if (!mPlayingTransitions.get(i).canApplyDim(task)) {
                return false;
            }
        }
        return true;
    }

    /**
    /**
     * During transient-launch, the "behind" app should retain focus during the transition unless
     * During transient-launch, the "behind" app should retain focus during the transition unless
     * something takes focus from it explicitly (eg. by calling ATMS.setFocusedTask or by another
     * something takes focus from it explicitly (eg. by calling ATMS.setFocusedTask or by another
+2 −1
Original line number Original line Diff line number Diff line
@@ -5124,12 +5124,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP


    private void applyDims() {
    private void applyDims() {
        if (((mAttrs.flags & FLAG_DIM_BEHIND) != 0 || shouldDrawBlurBehind())
        if (((mAttrs.flags & FLAG_DIM_BEHIND) != 0 || shouldDrawBlurBehind())
                   && isVisibleNow() && !mHidden) {
                   && isVisibleNow() && !mHidden && mTransitionController.canApplyDim(getTask())) {
            // Only show the Dimmer when the following is satisfied:
            // Only show the Dimmer when the following is satisfied:
            // 1. The window has the flag FLAG_DIM_BEHIND or blur behind is requested
            // 1. The window has the flag FLAG_DIM_BEHIND or blur behind is requested
            // 2. The WindowToken is not hidden so dims aren't shown when the window is exiting.
            // 2. The WindowToken is not hidden so dims aren't shown when the window is exiting.
            // 3. The WS is considered visible according to the isVisible() method
            // 3. The WS is considered visible according to the isVisible() method
            // 4. The WS is not hidden.
            // 4. The WS is not hidden.
            // 5. The window is not in a transition or is in a transition that allows to dim.
            mIsDimming = true;
            mIsDimming = true;
            final float dimAmount = (mAttrs.flags & FLAG_DIM_BEHIND) != 0 ? mAttrs.dimAmount : 0;
            final float dimAmount = (mAttrs.flags & FLAG_DIM_BEHIND) != 0 ? mAttrs.dimAmount : 0;
            final int blurRadius = shouldDrawBlurBehind() ? mAttrs.getBlurBehindRadius() : 0;
            final int blurRadius = shouldDrawBlurBehind() ? mAttrs.getBlurBehindRadius() : 0;
Loading