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

Commit 10ea6f00 authored by Jiaming Liu's avatar Jiaming Liu
Browse files

Move canAffectSystemUiFlags to TaskFragment

This allows configuring a TaskFragment to not affest system UI (e.g.
status bar colors).

Bug: 339262182
Test: Manual
Flag: EXEMPT refactor
Change-Id: Iddd09920f129f45f543e1d362bd9c007c2e167dd
parent 973dfac3
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -5455,7 +5455,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }

    boolean canAffectSystemUiFlags() {
        return task != null && task.canAffectSystemUiFlags() && isVisible()
        final TaskFragment taskFragment = getTaskFragment();
        return taskFragment != null && taskFragment.canAffectSystemUiFlags()
                && isVisible()
                && !mWaitForEnteringPinnedMode && !inPinnedWindowingMode();
    }

+0 −18
Original line number Diff line number Diff line
@@ -468,9 +468,6 @@ class Task extends TaskFragment {
    // NOTE: This value needs to be persisted with each task
    private TaskDescription mTaskDescription;

    /** @see #setCanAffectSystemUiFlags */
    private boolean mCanAffectSystemUiFlags = true;

    private static Exception sTmpException;

    private boolean mForceShowForAllUsers;
@@ -3288,21 +3285,6 @@ class Task extends TaskFragment {
        return isRootTask() && callback.test(this) ? this : null;
    }

    /**
     * @param canAffectSystemUiFlags If false, all windows in this task can not affect SystemUI
     *                               flags. See {@link WindowState#canAffectSystemUiFlags()}.
     */
    void setCanAffectSystemUiFlags(boolean canAffectSystemUiFlags) {
        mCanAffectSystemUiFlags = canAffectSystemUiFlags;
    }

    /**
     * @see #setCanAffectSystemUiFlags
     */
    boolean canAffectSystemUiFlags() {
        return mCanAffectSystemUiFlags;
    }

    void dontAnimateDimExit() {
        mDimmer.dontAnimateExit();
    }
+24 −0
Original line number Diff line number Diff line
@@ -409,6 +409,9 @@ class TaskFragment extends WindowContainer<WindowContainer> {

    private boolean mForceTranslucent = false;

    /** @see #setCanAffectSystemUiFlags */
    private boolean mCanAffectSystemUiFlags = true;

    final Point mLastSurfaceSize = new Point();

    private final Rect mTmpBounds = new Rect();
@@ -966,6 +969,27 @@ class TaskFragment extends WindowContainer<WindowContainer> {
        return !forAllActivities(r -> !isAllowedToEmbedActivityInTrustedMode(r));
    }

    /**
     * @param canAffectSystemUiFlags If false, all windows in this taskfragment can not affect
     *                               SystemUI flags. See
     *                               {@link WindowState#canAffectSystemUiFlags()}.
     */
    void setCanAffectSystemUiFlags(boolean canAffectSystemUiFlags) {
        mCanAffectSystemUiFlags = canAffectSystemUiFlags;
    }

    /**
     * @see #setCanAffectSystemUiFlags
     */
    boolean canAffectSystemUiFlags() {
        if (!mCanAffectSystemUiFlags) {
            return false;
        }
        final TaskFragment parentTaskFragment =
                getParent() != null ? getParent().asTaskFragment() : null;
        return parentTaskFragment == null || parentTaskFragment.canAffectSystemUiFlags();
    }

    /**
     * Returns the TaskFragment that is being organized, which could be this or the ascendant
     * TaskFragment.