Drop input for toast and child surfaces am: 55c1473bf2
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16502616 Change-Id: I5834fdb9e3559023a96cde91067bb1e988a01034
This commit is contained in:
@@ -147,6 +147,7 @@ import android.graphics.Insets;
|
|||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.Region;
|
import android.graphics.Region;
|
||||||
|
import android.gui.DropInputMode;
|
||||||
import android.hardware.input.InputManager;
|
import android.hardware.input.InputManager;
|
||||||
import android.hardware.power.V1_0.PowerHint;
|
import android.hardware.power.V1_0.PowerHint;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -967,6 +968,20 @@ public class DisplayPolicy {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add additional policy if needed to ensure the window or its children should not receive any
|
||||||
|
* input.
|
||||||
|
*/
|
||||||
|
public void setDropInputModePolicy(WindowState win, LayoutParams attrs) {
|
||||||
|
if (attrs.type == TYPE_TOAST
|
||||||
|
&& (attrs.privateFlags & PRIVATE_FLAG_TRUSTED_OVERLAY) == 0) {
|
||||||
|
// Toasts should not receive input. These windows should not have any children, so
|
||||||
|
// force this hierarchy of windows to drop all input.
|
||||||
|
mService.mTransactionFactory.get()
|
||||||
|
.setDropInputMode(win.getSurfaceControl(), DropInputMode.ALL).apply();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if the calling activity initiate toast and is visible with
|
* @return {@code true} if the calling activity initiate toast and is visible with
|
||||||
* {@link WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED} flag.
|
* {@link WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED} flag.
|
||||||
|
|||||||
@@ -1656,6 +1656,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
|
|
||||||
win.mToken.addWindow(win);
|
win.mToken.addWindow(win);
|
||||||
displayPolicy.addWindowLw(win, attrs);
|
displayPolicy.addWindowLw(win, attrs);
|
||||||
|
displayPolicy.setDropInputModePolicy(win, win.mAttrs);
|
||||||
if (type == TYPE_INPUT_METHOD) {
|
if (type == TYPE_INPUT_METHOD) {
|
||||||
displayContent.setInputMethodWindowLocked(win);
|
displayContent.setInputMethodWindowLocked(win);
|
||||||
imMayMove = false;
|
imMayMove = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user