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

Commit 7aa54bb1 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Do not assume DisplayNotificationController is thread-safe" into main

parents 10b80a64 6e008806
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -1904,6 +1904,10 @@ public class DisplayPolicy {
            final boolean eligibleForDesktopMode =
                    isSystemDecorationsSupported && (mDisplayContent.isDefaultDisplay
                            || mDisplayContent.allowContentModeSwitch());
            if (eligibleForDesktopMode) {
                mService.mDisplayNotificationController.dispatchDesktopModeEligibleChanged(
                        displayId);
            }
            mHandler.post(() -> {
                if (isSystemDecorationsSupported) {
                    StatusBarManagerInternal statusBar = getStatusBarManagerInternal();
@@ -1918,10 +1922,6 @@ public class DisplayPolicy {
                        wpMgr.onDisplayAddSystemDecorations(displayId);
                    }
                }
                if (eligibleForDesktopMode) {
                    mService.mDisplayNotificationController.dispatchDesktopModeEligibleChanged(
                            displayId);
                }
            });
        } else {
            mHandler.post(() -> {
@@ -1940,9 +1940,10 @@ public class DisplayPolicy {
    }

    void notifyDisplayRemoveSystemDecorations() {
        final int displayId = getDisplayId();
        mService.mDisplayNotificationController.dispatchDesktopModeEligibleChanged(displayId);
        mHandler.post(
                () -> {
                    final int displayId = getDisplayId();
                    StatusBarManagerInternal statusBar = getStatusBarManagerInternal();
                    if (statusBar != null) {
                        statusBar.onDisplayRemoveSystemDecorations(displayId);
@@ -1952,8 +1953,6 @@ public class DisplayPolicy {
                    if (wpMgr != null) {
                        wpMgr.onDisplayRemoveSystemDecorations(displayId);
                    }
                    mService.mDisplayNotificationController.dispatchDesktopModeEligibleChanged(
                            displayId);
                    final NotificationManagerInternal notificationManager =
                            LocalServices.getService(NotificationManagerInternal.class);
                    if (notificationManager != null) {
+0 −4
Original line number Diff line number Diff line
@@ -77,8 +77,6 @@ import android.view.WindowManager;

import androidx.test.filters.MediumTest;

import com.android.server.UiThread;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -234,14 +232,12 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase {
        doReturn(true).when(newDisp1).allowContentModeSwitch();
        doReturn(true).when(newDisp1).isSystemDecorationsSupported();
        mAtm.mWindowManager.setShouldShowSystemDecors(newDisp1.mDisplayId, true);
        waitHandlerIdle(UiThread.getHandler());
        assertEquals(1, desktopModeEligibleChanged.size());
        assertEquals(newDisp1.mDisplayId, (int) desktopModeEligibleChanged.get(0));
        desktopModeEligibleChanged.clear();
        // Check removing decoration
        doReturn(false).when(newDisp1).isSystemDecorationsSupported();
        mAtm.mWindowManager.setShouldShowSystemDecors(newDisp1.mDisplayId, false);
        waitHandlerIdle(UiThread.getHandler());
        assertEquals(1, desktopModeEligibleChanged.size());
        assertEquals(newDisp1.mDisplayId, (int) desktopModeEligibleChanged.get(0));
        desktopModeEligibleChanged.clear();