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

Commit 91b3a1bd authored by Yunfan Chen's avatar Yunfan Chen
Browse files

Hook up TaskDescription into set bar color calls (6/N)

This patch will update the task description when the app calls
setStatusBarColor or setNavigationBarColor. The status bar is updated
but the information is not reflected in the task description without
this patch.

Bug: 132756841
Bug: 113253712
Test: Test with the test app in b/132756841. The task description is
      updated as expected.
Test: go/wm-smoke
Change-Id: I4ba1e5e7dd0f096cba40221450a8861e3d578e3c
parent 3ad8b97d
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -3927,6 +3927,26 @@ public class Activity extends ContextThemeWrapper
        ActivityTaskManager.getService().toggleFreeformWindowingMode(mToken);
    }

    /**
     * Update the forced status bar color.
     * @hide
     */
    @Override
    public void updateStatusBarColor(int color) {
        mTaskDescription.setStatusBarColor(color);
        setTaskDescription(mTaskDescription);
    }

    /**
     * Update the forced navigation bar color.
     * @hide
     */
    @Override
    public void updateNavigationBarColor(int color) {
        mTaskDescription.setNavigationBarColor(color);
        setTaskDescription(mTaskDescription);
    }

    /**
     * Puts the activity in picture-in-picture mode if the activity supports.
     * @see android.R.attr#supportsPictureInPicture
+10 −0
Original line number Diff line number Diff line
@@ -636,6 +636,16 @@ public abstract class Window {

        /** Returns whether the window belongs to the task root. */
        boolean isTaskRoot();

        /**
         * Update the status bar color to a forced one.
         */
        void updateStatusBarColor(int color);

        /**
         * Update the navigation bar color to a forced one.
         */
        void updateNavigationBarColor(int color);
    }

    /**
+8 −0
Original line number Diff line number Diff line
@@ -3829,6 +3829,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
        if (mDecor != null) {
            mDecor.updateColorViews(null, false /* animate */);
        }
        final WindowControllerCallback callback = getWindowControllerCallback();
        if (callback != null) {
            getWindowControllerCallback().updateStatusBarColor(color);
        }
    }

    @Override
@@ -3843,6 +3847,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
        if (mDecor != null) {
            mDecor.updateColorViews(null, false /* animate */);
        }
        final WindowControllerCallback callback = getWindowControllerCallback();
        if (callback != null) {
            getWindowControllerCallback().updateNavigationBarColor(color);
        }
    }

    @Override