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

Commit 4f4df1d7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix IME window can't show on Simulated display" into qt-dev

parents 274a7b29 51bc29ec
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -7432,8 +7432,7 @@ public class WindowManagerService extends IWindowManager.Stub
        @Override
        public boolean shouldShowIme(int displayId) {
            synchronized (mGlobalLock) {
                final DisplayContent displayContent = mRoot.getDisplayContent(displayId);
                return mDisplayWindowSettings.shouldShowImeLocked(displayContent);
                return WindowManagerService.this.shouldShowIme(displayId);
            }
        }
    }
+18 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import android.view.Surface;
import androidx.test.filters.SmallTest;

import com.android.dx.mockito.inline.extended.ExtendedMockito;
import com.android.server.LocalServices;
import com.android.server.policy.WindowManagerPolicy;

import org.junit.After;
@@ -588,6 +589,23 @@ public class DisplayWindowSettingsTests extends WindowTestsBase {
                getStoredDisplayAttributeValue("shouldShowIme"));
    }

    @Test
    public void testShouldShowImeWithinForceDesktopMode() {
        try {
            // Presume display enabled force desktop mode from developer options.
            final DisplayContent dc = createMockSimulatedDisplay();
            mWm.setForceDesktopModeOnExternalDisplays(true);
            final WindowManagerInternal wmInternal = LocalServices.getService(
                    WindowManagerInternal.class);
            // Make sure WindowManagerInter#shouldShowIme as true is due to
            // mForceDesktopModeOnExternalDisplays as true.
            assertFalse(mWm.mDisplayWindowSettings.shouldShowImeLocked(dc));
            assertTrue(wmInternal.shouldShowIme(dc.getDisplayId()));
        } finally {
            mWm.setForceDesktopModeOnExternalDisplays(false);
        }
    }

    /**
     * Prepares display settings and stores in {@link #mStorage}. Uses provided display identifier
     * and stores windowingMode=WINDOWING_MODE_PINNED.
+10 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.wm;
import static android.app.AppOpsManager.OP_NONE;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.os.Process.SYSTEM_UID;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.DisplayAdjustments.DEFAULT_DISPLAY_ADJUSTMENTS;
import static android.view.View.VISIBLE;
@@ -445,4 +446,13 @@ class WindowTestsBase {
            return new WindowTestUtils.TestWindowState(mWm, mMockSession, mIWindow, attrs, token);
        }
    }

    /** Creates a {@link DisplayContent} as parts of simulate display info for test. */
    DisplayContent createMockSimulatedDisplay() {
        DisplayInfo displayInfo = new DisplayInfo();
        displayInfo.copyFrom(mDisplayInfo);
        displayInfo.type = Display.TYPE_VIRTUAL;
        displayInfo.ownerUid = SYSTEM_UID;
        return createNewDisplay(displayInfo);
    }
}