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

Commit 4be18e7d authored by Lingyu Feng's avatar Lingyu Feng
Browse files

Refactor onDisplayReady to onDisplayAddSystemDecorations

Renames onDisplayReady() to onDisplayAddSystemDecorations() to maintain
consistency with onDisplayRemoveSystemDecorations().

Previously, onDisplayReady() was sent regardless of the return value of
isSystemDecorationsSupported(). In this CL,
onDisplayAddSystemDeocrations() is only sent when
isSystemDecorationsSupported() returns true.

Bug: 390591772
Flag: com.android.server.display.feature.flags.enable_display_content_mode_management
Test: atest CommandQueueTest WallpaperManagerServiceTests
Test: adb shell settings put secure mirror_built_in_display {1|0}
Change-Id: I5d4289ac303a79948c9ac51da04e8b486f4e2cf6
parent 5b8c5b64
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -217,9 +217,9 @@ oneway interface IStatusBar
    void setUdfpsRefreshRateCallback(in IUdfpsRefreshRateRequestCallback callback);

    /**
     * Notifies System UI that the display is ready to show system decorations.
     * Notifies System UI that the system decorations should be added on the display.
     */
    void onDisplayReady(int displayId);
    void onDisplayAddSystemDecorations(int displayId);

    /**
     * Notifies System UI that the system decorations should be removed from the display.
+6 −6
Original line number Diff line number Diff line
@@ -460,17 +460,17 @@ public class CommandQueueTest extends SysuiTestCase {
    }

    @Test
    public void testOnDisplayReady() {
        mCommandQueue.onDisplayReady(DEFAULT_DISPLAY);
    public void testonDisplayAddSystemDecorations() {
        mCommandQueue.onDisplayAddSystemDecorations(DEFAULT_DISPLAY);
        waitForIdleSync();
        verify(mCallbacks).onDisplayReady(eq(DEFAULT_DISPLAY));
        verify(mCallbacks).onDisplayAddSystemDecorations(eq(DEFAULT_DISPLAY));
    }

    @Test
    public void testOnDisplayReadyForSecondaryDisplay() {
        mCommandQueue.onDisplayReady(SECONDARY_DISPLAY);
    public void testonDisplayAddSystemDecorationsForSecondaryDisplay() {
        mCommandQueue.onDisplayAddSystemDecorations(SECONDARY_DISPLAY);
        waitForIdleSync();
        verify(mCallbacks).onDisplayReady(eq(SECONDARY_DISPLAY));
        verify(mCallbacks).onDisplayAddSystemDecorations(eq(SECONDARY_DISPLAY));
    }

    @Test
+2 −2
Original line number Diff line number Diff line
@@ -146,9 +146,9 @@ oneway interface ILauncherProxy {
    void onUnbind(IRemoteCallback reply) = 35;

    /**
     * Sent when {@link TaskbarDelegate#onDisplayReady} is called.
     * Sent when {@link TaskbarDelegate#onDisplayAddSystemDecorations} is called.
     */
    void onDisplayReady(int displayId) = 36;
    void onDisplayAddSystemDecorations(int displayId) = 36;

    /**
     * Sent when {@link TaskbarDelegate#onDisplayRemoved} is called.
+4 −1
Original line number Diff line number Diff line
@@ -284,7 +284,10 @@ public class NavigationBarControllerImpl implements
        }

        @Override
        public void onDisplayReady(int displayId) {
        public void onDisplayAddSystemDecorations(int displayId) {
            if (enableDisplayContentModeManagement()) {
                mHasNavBar.put(displayId, true);
            }
            Display display = mDisplayManager.getDisplay(displayId);
            mIsLargeScreen = isLargeScreen(mContext);
            createNavigationBar(display, null /* savedState */, null /* result */);
+4 −4
Original line number Diff line number Diff line
@@ -238,16 +238,16 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
    }

    @Override
    public void onDisplayReady(int displayId) {
        CommandQueue.Callbacks.super.onDisplayReady(displayId);
    public void onDisplayAddSystemDecorations(int displayId) {
        CommandQueue.Callbacks.super.onDisplayAddSystemDecorations(displayId);
        if (mLauncherProxyService.getProxy() == null) {
            return;
        }

        try {
            mLauncherProxyService.getProxy().onDisplayReady(displayId);
            mLauncherProxyService.getProxy().onDisplayAddSystemDecorations(displayId);
        } catch (RemoteException e) {
            Log.e(TAG, "onDisplayReady() failed", e);
            Log.e(TAG, "onDisplayAddSystemDecorations() failed", e);
        }
    }

Loading