Fix IME window can't show on Simulated display
CL Icfd66689dad4b782c50b56a515194dd138d3b280 introduced
WindowManagerInternal#shouldShowIme for IMMS to check if the display can
show IME window, which just calling DisplayWindowSettings#shouldShowIme.
That will missed Simulated display use case & we should use WMS#shouldShowIme
since we have already implemented force desktop mode check for simulated
display with combined DisplayWindowSettings#shouldShowIme in above CL.
Correct the API usage to fix the issue.
Fix: 131921175
Fix: 129443632
Test: atest MultiDisplaySystemDecorationTests
Test: atest DisplayWindowSettingsTests#testShouldShowImeWithinForceDesktopMode
Test: manual as below steps:
1. adb shell settings put global force_desktop_mode_on_external_displays 1
2. adb shell settings put global overlay_display_devices 1080x1920/320
3. adb reboot, make sure simulated display overlaid on device.
4. By using a Bluetooth mouse or a USB mouse, launch any Activity on
simulated display that has an input field.
5. Click that input field to see if IME window can shown simulated display.
Change-Id: I5b592f7152dffb12826c6cbd8ab466fcf1392fb7
This commit is contained in:
@@ -7426,8 +7426,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user