Merge changes I87c5ad3f,I09b32c8f

* changes:
  Fix 2 input issues.
  Clear calling id in dontOverrideDisplayInfo.
This commit is contained in:
Andrii Kulian
2018-08-02 01:17:42 +00:00
committed by Android (Google) Code Review
3 changed files with 35 additions and 24 deletions

View File

@@ -801,7 +801,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
// {@link DisplayContent} ready for use.
mDisplayReady = true;
mInputMonitor = new InputMonitor(service, mDisplayId);
// TODO(b/112081256): Use independent InputMonitor.
mInputMonitor = isDefaultDisplay ? new InputMonitor(service, mDisplayId)
: mService.getDefaultDisplayContentLocked().mInputMonitor;
}
boolean isReady() {

View File

@@ -399,7 +399,8 @@ final class InputMonitor {
this.inDrag = inDrag;
wallpaperController = mService.mRoot.mWallpaperController;
mService.mRoot.getDisplayContent(mDisplayId).forAllWindows(this,
// TODO(b/112081256): Use independent InputMonitor for each display.
mService.mRoot/*.getDisplayContent(mDisplayId)*/.forAllWindows(this,
true /* traverseTopToBottom */);
if (mAddWallpaperInputConsumerHandle) {
// No visible wallpaper found, add the wallpaper input consumer at the end.

View File

@@ -6082,23 +6082,26 @@ public class WindowManagerService extends IWindowManager.Stub
@Override
public void createInputConsumer(IBinder token, String name, InputChannel inputChannel) {
synchronized (mWindowMap) {
mRoot.forAllDisplays(dc -> {
dc.getInputMonitor().createInputConsumer(token, name, inputChannel,
// TODO(b/112049699): Fix this for multiple displays. There is only one inputChannel
// here to accept the return value.
DisplayContent display = mRoot.getDisplayContent(Display.DEFAULT_DISPLAY);
if (display != null) {
display.getInputMonitor().createInputConsumer(token, name, inputChannel,
Binder.getCallingPid(), Binder.getCallingUserHandle());
});
}
}
}
@Override
public boolean destroyInputConsumer(String name) {
synchronized (mWindowMap) {
AtomicBoolean retValue = new AtomicBoolean(true);
mRoot.forAllDisplays(dc -> {
if (!dc.getInputMonitor().destroyInputConsumer(name)) {
retValue.set(false);
}
});
return retValue.get();
// TODO(b/112049699): Fix this for multiple displays. For consistency with
// createInputConsumer above.
DisplayContent display = mRoot.getDisplayContent(Display.DEFAULT_DISPLAY);
if (display != null) {
return display.getInputMonitor().destroyInputConsumer(name);
}
return false;
}
}
@@ -7090,19 +7093,24 @@ public class WindowManagerService extends IWindowManager.Stub
@Override
public void dontOverrideDisplayInfo(int displayId) {
synchronized (mWindowMap) {
final DisplayContent dc = getDisplayContentOrCreate(displayId);
if (dc == null) {
throw new IllegalArgumentException(
"Trying to register a non existent display.");
final long token = Binder.clearCallingIdentity();
try {
synchronized (mWindowMap) {
final DisplayContent dc = getDisplayContentOrCreate(displayId);
if (dc == null) {
throw new IllegalArgumentException(
"Trying to register a non existent display.");
}
// We usually set the override info in DisplayManager so that we get consistent
// values when displays are changing. However, we don't do this for displays that
// serve as containers for ActivityViews because we don't want letter-/pillar-boxing
// during resize.
dc.mShouldOverrideDisplayConfiguration = false;
mDisplayManagerInternal.setDisplayInfoOverrideFromWindowManager(displayId,
null /* info */);
}
// We usually set the override info in DisplayManager so that we get consistent
// values when displays are changing. However, we don't do this for displays that
// serve as containers for ActivityViews because we don't want letter-/pillar-boxing
// during resize.
dc.mShouldOverrideDisplayConfiguration = false;
mDisplayManagerInternal.setDisplayInfoOverrideFromWindowManager(displayId,
null /* info */);
} finally {
Binder.restoreCallingIdentity(token);
}
}