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

Commit e439dec1 authored by Tarandeep Singh's avatar Tarandeep Singh
Browse files

Propagate light nav bar info

When SystemUI (notification UI) is pulled down, the windows behind are
dimmed, including navigation bar. At this point of time, navigationbar
color could be controlled by IME and system overrides it.
With this fix, we check if IME is already controlling navbar color.

Change-Id: I9f25860a5b7858f1d17d2921816910a938c656bb
Fix: 122439339
Test: Manually verified using steps in bug.
parent 7f39f77d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -50,9 +50,11 @@ oneway interface IStatusBar
     * @param mask which flags to change
     * @param fullscreenBounds the current bounds of the fullscreen stack, in screen coordinates
     * @param dockedBounds the current bounds of the docked stack, in screen coordinates
     * @param navbarColorManagedByIme {@code true} if navigation bar color is managed by IME.
     */
    void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis, int dockedStackVis,
            int mask, in Rect fullscreenBounds, in Rect dockedBounds);
            int mask, in Rect fullscreenBounds, in Rect dockedBounds,
            boolean navbarColorManagedByIme);

    void topAppWindowChanged(int displayId, boolean menuVisible);
    void setImeWindowStatus(int displayId, in IBinder token, int vis, int backDisposition,
+6 −2
Original line number Diff line number Diff line
@@ -39,12 +39,13 @@ public final class RegisterStatusBarResult implements Parcelable {
    public final IBinder mImeToken;
    public final Rect mFullscreenStackBounds;
    public final Rect mDockedStackBounds;
    public final boolean mNavbarColorManagedByIme;

    public RegisterStatusBarResult(ArrayMap<String, StatusBarIcon> icons, int disabledFlags1,
            int systemUiVisibility, boolean menuVisible, int imeWindowVis, int imeBackDisposition,
            boolean showImeSwitcher, int disabledFlags2, int fullscreenStackSysUiVisibility,
            int dockedStackSysUiVisibility, IBinder imeToken, Rect fullscreenStackBounds,
            Rect dockedStackBounds) {
            Rect dockedStackBounds, boolean navbarColorManagedByIme) {
        mIcons = new ArrayMap<>(icons);
        mDisabledFlags1 = disabledFlags1;
        mSystemUiVisibility = systemUiVisibility;
@@ -58,6 +59,7 @@ public final class RegisterStatusBarResult implements Parcelable {
        mImeToken = imeToken;
        mFullscreenStackBounds = fullscreenStackBounds;
        mDockedStackBounds = dockedStackBounds;
        mNavbarColorManagedByIme = navbarColorManagedByIme;
    }

    @Override
@@ -80,6 +82,7 @@ public final class RegisterStatusBarResult implements Parcelable {
        dest.writeStrongBinder(mImeToken);
        dest.writeTypedObject(mFullscreenStackBounds, flags);
        dest.writeTypedObject(mDockedStackBounds, flags);
        dest.writeBoolean(mNavbarColorManagedByIme);
    }

    /**
@@ -103,11 +106,12 @@ public final class RegisterStatusBarResult implements Parcelable {
                    final IBinder imeToken = source.readStrongBinder();
                    final Rect fullscreenStackBounds = source.readTypedObject(Rect.CREATOR);
                    final Rect dockedStackBounds = source.readTypedObject(Rect.CREATOR);
                    final boolean navbarColorManagedByIme = source.readBoolean();
                    return new RegisterStatusBarResult(icons, disabledFlags1, systemUiVisibility,
                            menuVisible, imeWindowVis, imeBackDisposition, showImeSwitcher,
                            disabledFlags2, fullscreenStackSysUiVisibility,
                            dockedStackSysUiVisibility, imeToken, fullscreenStackBounds,
                            dockedStackBounds);
                            dockedStackBounds, navbarColorManagedByIme);
                }

                @Override
+3 −1
Original line number Diff line number Diff line
@@ -57,7 +57,8 @@ public class RegisterStatusBarResultTest {
                0x80 /* dockedStackSysUiVisibility */,
                new Binder() /* imeToken */,
                new Rect(0x100, 0x200, 0x400, 0x800) /* fullscreenStackBounds */,
                new Rect(0x1000, 0x2000, 0x4000, 0x8000) /* dockedStackBounds */);
                new Rect(0x1000, 0x2000, 0x4000, 0x8000) /* dockedStackBounds */,
                true /* navbarColorManagedByIme */);

        final RegisterStatusBarResult copy = clone(original);

@@ -80,6 +81,7 @@ public class RegisterStatusBarResultTest {
        assertThat(copy.mImeToken).isSameAs(original.mImeToken);
        assertThat(copy.mFullscreenStackBounds).isEqualTo(original.mFullscreenStackBounds);
        assertThat(copy.mDockedStackBounds).isEqualTo(original.mDockedStackBounds);
        assertThat(copy.mNavbarColorManagedByIme).isEqualTo(original.mNavbarColorManagedByIme);
    }

    private RegisterStatusBarResult clone(RegisterStatusBarResult original) {
+8 −3
Original line number Diff line number Diff line
@@ -175,9 +175,11 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController<
         * @param fullscreenStackBounds The current bounds of the fullscreen stack, in screen
         *                              coordinates.
         * @param dockedStackBounds The current bounds of the docked stack, in screen coordinates.
         * @param navbarColorManagedByIme {@code true} if navigation bar color is managed by IME.
         */
        default void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
                int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
                int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds,
                boolean navbarColorManagedByIme) {
        }

        /**
@@ -459,7 +461,8 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController<

    @Override
    public void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
            int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
            int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds,
            boolean navbarColorManagedByIme) {
        synchronized (mLock) {
            // Don't coalesce these, since it might have one time flags set such as
            // STATUS_BAR_UNHIDE which might get lost.
@@ -469,6 +472,7 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController<
            args.argi3 = fullscreenStackVis;
            args.argi4 = dockedStackVis;
            args.argi5 = mask;
            args.argi6 = navbarColorManagedByIme ? 1 : 0;
            args.arg1 = fullscreenStackBounds;
            args.arg2 = dockedStackBounds;
            mHandler.obtainMessage(MSG_SET_SYSTEMUI_VISIBILITY, args).sendToTarget();
@@ -879,7 +883,8 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController<
                    args = (SomeArgs) msg.obj;
                    for (int i = 0; i < mCallbacks.size(); i++) {
                        mCallbacks.get(i).setSystemUiVisibility(args.argi1, args.argi2, args.argi3,
                                args.argi4, args.argi5, (Rect) args.arg1, (Rect) args.arg2);
                                args.argi4, args.argi5, (Rect) args.arg1, (Rect) args.arg2,
                                args.argi6 == 1);
                    }
                    args.recycle();
                    break;
+3 −2
Original line number Diff line number Diff line
@@ -95,7 +95,8 @@ public class AutoHideController implements CommandQueue.Callbacks {

    @Override
    public void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
            int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
            int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds,
            boolean navbarColorManagedByIme) {
        if (displayId != mDisplayId) {
            return;
        }
@@ -119,7 +120,7 @@ public class AutoHideController implements CommandQueue.Callbacks {
            if (mSystemUiVisibility != newVal) {
                mCommandQueue.setSystemUiVisibility(mDisplayId, mSystemUiVisibility,
                        fullscreenStackVis, dockedStackVis, mask, fullscreenStackBounds,
                        dockedStackBounds);
                        dockedStackBounds, navbarColorManagedByIme);
            }

            notifySystemUiVisibilityChanged(mSystemUiVisibility);
Loading