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

Commit 82e5eb33 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Dimming on an embedded TaskFragment vs. parent Task"

parents 88f11a9f 9b588133
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -478,7 +478,6 @@ class Task extends TaskFragment {
    // to layout without loading all the task snapshots
    final PersistedTaskSnapshotData mLastTaskSnapshotData;

    private Dimmer mDimmer = new Dimmer(this);
    private final Rect mTmpDimBoundsRect = new Rect();

    /** @see #setCanAffectSystemUiFlags */
+30 −0
Original line number Diff line number Diff line
@@ -161,6 +161,8 @@ class TaskFragment extends WindowContainer<WindowContainer> {
     */
    int mMinHeight;

    Dimmer mDimmer = new Dimmer(this);

    /** This task fragment will be removed when the cleanup of its children are done. */
    private boolean mIsRemovalRequested;

@@ -2348,6 +2350,34 @@ class TaskFragment extends WindowContainer<WindowContainer> {
        sendTaskFragmentVanished();
    }

    @Override
    Dimmer getDimmer() {
        // If the window is in an embedded TaskFragment, we want to dim at the TaskFragment.
        if (asTask() == null) {
            return mDimmer;
        }

        return super.getDimmer();
    }

    @Override
    void prepareSurfaces() {
        if (asTask() != null) {
            super.prepareSurfaces();
            return;
        }

        mDimmer.resetDimStates();
        super.prepareSurfaces();

        // Bounds need to be relative, as the dim layer is a child.
        final Rect dimBounds = getBounds();
        dimBounds.offsetTo(0 /* newLeft */, 0 /* newTop */);
        if (mDimmer.updateDims(getPendingTransaction(), dimBounds)) {
            scheduleAnimation();
        }
    }

    @Override
    boolean canBeAnimationTarget() {
        return true;