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

Commit 6f39c91c authored by Lingyu Feng's avatar Lingyu Feng Committed by Android (Google) Code Review
Browse files

Merge "Send onDisplay{Add|Remove}SystemDecorations via IDisplayWindowListener...

Merge "Send onDisplay{Add|Remove}SystemDecorations via IDisplayWindowListener instead of CommandQueue" into main
parents b83c5a99 24ea59b0
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -69,4 +69,14 @@ oneway interface IDisplayWindowListener {
     * Called when the eligibility of the desktop mode for a display have changed.
     */
    void onDesktopModeEligibleChanged(int displayId);

    /**
     * Called when the system decorations should be added onto the display.
     */
    void onDisplayAddSystemDecorations(int displayId);

    /**
     * Called when the system decorations should be removed from the display.
     */
    void onDisplayRemoveSystemDecorations(int displayId);
}
+6 −0
Original line number Diff line number Diff line
@@ -453,6 +453,12 @@ public class DisplayController {
                DisplayController.this.onDesktopModeEligibleChanged(displayId);
            });
        }

        @Override
        public void onDisplayAddSystemDecorations(int displayId) { }

        @Override
        public void onDisplayRemoveSystemDecorations(int displayId) { }
    }

    /**
+6 −0
Original line number Diff line number Diff line
@@ -568,6 +568,12 @@ public class CameraServiceProxy extends SystemService

        @Override
        public void onDesktopModeEligibleChanged(int displayId) { }

        @Override
        public void onDisplayAddSystemDecorations(int displayId) { }

        @Override
        public void onDisplayRemoveSystemDecorations(int displayId) { }
    }


+18 −5
Original line number Diff line number Diff line
@@ -1934,7 +1934,11 @@ public class DisplayPolicy {
            final int displayId = getDisplayId();
            final boolean isSystemDecorationsSupported =
                    mDisplayContent.isSystemDecorationsSupported();
            final boolean isHomeSupported = mDisplayContent.isHomeSupported();
            if (DesktopExperienceFlags.ENABLE_SYS_DECORS_CALLBACKS_VIA_WM.isTrue()
                    && isSystemDecorationsSupported) {
                mService.mDisplayNotificationController
                        .dispatchDisplayAddSystemDecorations(displayId);
            }
            final boolean eligibleForDesktopMode =
                    isSystemDecorationsSupported && (mDisplayContent.isDefaultDisplay
                            || mDisplayContent.allowContentModeSwitch());
@@ -1942,8 +1946,11 @@ public class DisplayPolicy {
                mService.mDisplayNotificationController.dispatchDesktopModeEligibleChanged(
                        displayId);
            }

            final boolean isHomeSupported = mDisplayContent.isHomeSupported();
            mHandler.post(() -> {
                if (isSystemDecorationsSupported) {
                if (!DesktopExperienceFlags.ENABLE_SYS_DECORS_CALLBACKS_VIA_WM.isTrue()
                        && isSystemDecorationsSupported) {
                    StatusBarManagerInternal statusBar = getStatusBarManagerInternal();
                    if (statusBar != null) {
                        statusBar.onDisplayAddSystemDecorations(displayId);
@@ -1975,13 +1982,19 @@ public class DisplayPolicy {

    void notifyDisplayRemoveSystemDecorations() {
        final int displayId = getDisplayId();
        if (DesktopExperienceFlags.ENABLE_SYS_DECORS_CALLBACKS_VIA_WM.isTrue()) {
            mService.mDisplayNotificationController
                    .dispatchDisplayRemoveSystemDecorations(displayId);
        }
        mService.mDisplayNotificationController.dispatchDesktopModeEligibleChanged(displayId);
        mHandler.post(
                () -> {
                    if (!DesktopExperienceFlags.ENABLE_SYS_DECORS_CALLBACKS_VIA_WM.isTrue()) {
                        StatusBarManagerInternal statusBar = getStatusBarManagerInternal();
                        if (statusBar != null) {
                            statusBar.onDisplayRemoveSystemDecorations(displayId);
                        }
                    }
                    final WallpaperManagerInternal wpMgr =
                            LocalServices.getService(WallpaperManagerInternal.class);
                    if (wpMgr != null) {
+22 −0
Original line number Diff line number Diff line
@@ -144,4 +144,26 @@ class DisplayWindowListenerController {
        }
        mDisplayListeners.finishBroadcast();
    }

    void dispatchDisplayAddSystemDecorations(int displayId) {
        int count = mDisplayListeners.beginBroadcast();
        for (int i = 0; i < count; ++i) {
            try {
                mDisplayListeners.getBroadcastItem(i).onDisplayAddSystemDecorations(displayId);
            } catch (RemoteException e) {
            }
        }
        mDisplayListeners.finishBroadcast();
    }

    void dispatchDisplayRemoveSystemDecorations(int displayId) {
        int count = mDisplayListeners.beginBroadcast();
        for (int i = 0; i < count; ++i) {
            try {
                mDisplayListeners.getBroadcastItem(i).onDisplayRemoveSystemDecorations(displayId);
            } catch (RemoteException e) {
            }
        }
        mDisplayListeners.finishBroadcast();
    }
}
Loading