DO NOT MERGE: WM: Only allow system to use NO_INPUT_CHANNEL.
NO_INPUT_CHANNEL is a hidden WM flag that allows creation of a window without an input channel. Unfortunately in releases prior to Android R this would allow creation of a Window which will not be known to the InputDispatcher at all. This means that the logic generating FLAG_OBSCURED will work and a window will be able to overlay another window without the overlayed window being notified. In Android R and later this isn't a problem as the InputDispatcher is informed of all windows, input channel or not. For past Android releases, this patch disables NO_INPUT_CHANNEL for use outside of the WM. Bug: 152064592 Test: Existing tests pass Change-Id: I7e1f45cba139eab92e7df88d1e052baba0ae2cc6
This commit is contained in:
@@ -110,6 +110,13 @@ public final class InputChannel implements Parcelable {
|
|||||||
return name != null ? name : "uninitialized";
|
return name != null ? name : "uninitialized";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public boolean isValid() {
|
||||||
|
return mPtr != 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disposes the input channel.
|
* Disposes the input channel.
|
||||||
* Explicitly releases the reference this object is holding on the input channel.
|
* Explicitly releases the reference this object is holding on the input channel.
|
||||||
|
|||||||
@@ -851,10 +851,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
// manager, to make sure we do the relayout before receiving
|
// manager, to make sure we do the relayout before receiving
|
||||||
// any other events from the system.
|
// any other events from the system.
|
||||||
requestLayout();
|
requestLayout();
|
||||||
if ((mWindowAttributes.inputFeatures
|
mInputChannel = new InputChannel();
|
||||||
& WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL) == 0) {
|
|
||||||
mInputChannel = new InputChannel();
|
|
||||||
}
|
|
||||||
mForceDecorViewVisibility = (mWindowAttributes.privateFlags
|
mForceDecorViewVisibility = (mWindowAttributes.privateFlags
|
||||||
& PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY) != 0;
|
& PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY) != 0;
|
||||||
try {
|
try {
|
||||||
@@ -947,7 +944,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
mInputQueueCallback =
|
mInputQueueCallback =
|
||||||
((RootViewSurfaceTaker)view).willYouTakeTheInputQueue();
|
((RootViewSurfaceTaker)view).willYouTakeTheInputQueue();
|
||||||
}
|
}
|
||||||
if (mInputChannel != null) {
|
if (mInputChannel.isValid()) {
|
||||||
if (mInputQueueCallback != null) {
|
if (mInputQueueCallback != null) {
|
||||||
mInputQueue = new InputQueue();
|
mInputQueue = new InputQueue();
|
||||||
mInputQueueCallback.onInputQueueCreated(mInputQueue);
|
mInputQueueCallback.onInputQueueCreated(mInputQueue);
|
||||||
|
|||||||
@@ -1441,8 +1441,13 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean openInputChannels = (outInputChannel != null
|
boolean openInputChannels = (outInputChannel != null
|
||||||
&& (attrs.inputFeatures & INPUT_FEATURE_NO_INPUT_CHANNEL) == 0);
|
&& (attrs.inputFeatures & INPUT_FEATURE_NO_INPUT_CHANNEL) == 0);
|
||||||
|
if (callingUid != SYSTEM_UID) {
|
||||||
|
Slog.e(TAG_WM,
|
||||||
|
"App trying to use insecure INPUT_FEATURE_NO_INPUT_CHANNEL flag. Ignoring");
|
||||||
|
openInputChannels = true;
|
||||||
|
}
|
||||||
if (openInputChannels) {
|
if (openInputChannels) {
|
||||||
win.openInputChannel(outInputChannel);
|
win.openInputChannel(outInputChannel);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user