Merge changes from topic "sys_win_trust_sys_display" into qt-dev
am: 405804397d
Change-Id: I13e658be8b3c72ab6f6ec3c2ac1a91895cfdf66e
This commit is contained in:
@@ -3206,6 +3206,7 @@ package android.view {
|
||||
method public default void setShouldShowIme(int, boolean);
|
||||
method public default void setShouldShowSystemDecors(int, boolean);
|
||||
method public default void setShouldShowWithInsecureKeyguard(int, boolean);
|
||||
method public default boolean shouldShowIme(int);
|
||||
method public default boolean shouldShowSystemDecors(int);
|
||||
}
|
||||
|
||||
|
||||
@@ -508,14 +508,25 @@ public interface WindowManager extends ViewManager {
|
||||
*
|
||||
* @param displayId Display ID.
|
||||
* @param shouldShow Indicates that the display should show IME.
|
||||
* @see KeyguardManager#isDeviceSecure()
|
||||
* @see KeyguardManager#isDeviceLocked()
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
default void setShouldShowIme(int displayId, boolean shouldShow) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that the display should show IME.
|
||||
*
|
||||
* @param displayId The id of the display.
|
||||
* @return {@code true} if the display should show IME when an input field becomes
|
||||
* focused on it.
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
default boolean shouldShowIme(int displayId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable {
|
||||
/**
|
||||
* X position for this window. With the default gravity it is ignored.
|
||||
|
||||
@@ -192,4 +192,13 @@ public final class WindowManagerImpl implements WindowManager {
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldShowIme(int displayId) {
|
||||
try {
|
||||
return WindowManagerGlobal.getWindowManagerService().shouldShowIme(displayId);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1409,7 +1409,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
mIWindowManager = IWindowManager.Stub.asInterface(
|
||||
ServiceManager.getService(Context.WINDOW_SERVICE));
|
||||
mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class);
|
||||
mImeDisplayValidator = mWindowManagerInternal::shouldShowSystemDecorOnDisplay;
|
||||
mImeDisplayValidator = displayId -> mWindowManagerInternal.shouldShowIme(displayId);
|
||||
mCaller = new HandlerCaller(context, null, new HandlerCaller.Callback() {
|
||||
@Override
|
||||
public void executeMessage(Message msg) {
|
||||
@@ -2139,7 +2139,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
if (displayId == DEFAULT_DISPLAY || displayId == INVALID_DISPLAY) {
|
||||
return FALLBACK_DISPLAY_ID;
|
||||
}
|
||||
// Show IME window on fallback display when the display is not allowed.
|
||||
|
||||
// Show IME window on fallback display when the display doesn't support system decorations
|
||||
// or the display is virtual and isn't owned by system for security concern.
|
||||
return checker.displayCanShowIme(displayId) ? displayId : FALLBACK_DISPLAY_ID;
|
||||
}
|
||||
|
||||
|
||||
@@ -484,4 +484,12 @@ public abstract class WindowManagerInternal {
|
||||
* Checks if this display is configured and allowed to show system decorations.
|
||||
*/
|
||||
public abstract boolean shouldShowSystemDecorOnDisplay(int displayId);
|
||||
|
||||
/**
|
||||
* Indicates that the display should show IME.
|
||||
*
|
||||
* @param displayId The id of the display.
|
||||
* @return {@code true} if the display should show IME when an input field become focused on it.
|
||||
*/
|
||||
public abstract boolean shouldShowIme(int displayId);
|
||||
}
|
||||
|
||||
@@ -6921,7 +6921,12 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
+ displayId);
|
||||
return false;
|
||||
}
|
||||
return mDisplayWindowSettings.shouldShowImeLocked(displayContent);
|
||||
final Display display = displayContent.getDisplay();
|
||||
if (isUntrustedVirtualDisplay(display)) {
|
||||
return false;
|
||||
}
|
||||
return mDisplayWindowSettings.shouldShowImeLocked(displayContent)
|
||||
|| mForceDesktopModeOnExternalDisplays;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7365,6 +7370,14 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
return WindowManagerService.this.shouldShowSystemDecors(displayId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldShowIme(int displayId) {
|
||||
synchronized (mGlobalLock) {
|
||||
final DisplayContent displayContent = mRoot.getDisplayContent(displayId);
|
||||
return mDisplayWindowSettings.shouldShowImeLocked(displayContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void registerAppFreezeListener(AppFreezeListener listener) {
|
||||
|
||||
Reference in New Issue
Block a user