Merge "Revert "Add wallpaper input consumer to WindowManagerService"" into nyc-dev
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 5bcf102..7af4a1f 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -400,14 +400,4 @@
* @hide
*/
void registerShortcutKey(in long shortcutCode, IShortcutService keySubscriber);
-
- /**
- * Create the input consumer for wallpaper events.
- */
- void createWallpaperInputConsumer(out InputChannel inputChannel);
-
- /**
- * Remove the input consumer for wallpaper events.
- */
- void removeWallpaperInputConsumer();
}
diff --git a/services/core/java/com/android/server/wm/InputConsumerImpl.java b/services/core/java/com/android/server/wm/InputConsumerImpl.java
index 24783bc..0581a16 100644
--- a/services/core/java/com/android/server/wm/InputConsumerImpl.java
+++ b/services/core/java/com/android/server/wm/InputConsumerImpl.java
@@ -16,33 +16,38 @@
package com.android.server.wm;
+import android.os.Looper;
import android.os.Process;
import android.view.Display;
import android.view.InputChannel;
+import android.view.InputEventReceiver;
import android.view.WindowManager;
+import android.view.WindowManagerPolicy;
+
import com.android.server.input.InputApplicationHandle;
import com.android.server.input.InputWindowHandle;
-class InputConsumerImpl {
+public final class InputConsumerImpl implements WindowManagerPolicy.InputConsumer {
final WindowManagerService mService;
final InputChannel mServerChannel, mClientChannel;
final InputApplicationHandle mApplicationHandle;
final InputWindowHandle mWindowHandle;
+ final InputEventReceiver mInputEventReceiver;
+ final int mWindowLayer;
- InputConsumerImpl(WindowManagerService service, String name, InputChannel inputChannel) {
+ public InputConsumerImpl(WindowManagerService service, Looper looper,
+ InputEventReceiver.Factory inputEventReceiverFactory) {
+ String name = "input consumer";
mService = service;
InputChannel[] channels = InputChannel.openInputChannelPair(name);
mServerChannel = channels[0];
- if (inputChannel != null) {
- channels[1].transferTo(inputChannel);
- channels[1].dispose();
- mClientChannel = inputChannel;
- } else {
- mClientChannel = channels[1];
- }
+ mClientChannel = channels[1];
mService.mInputManager.registerInputChannel(mServerChannel, null);
+ mInputEventReceiver = inputEventReceiverFactory.createInputEventReceiver(
+ mClientChannel, looper);
+
mApplicationHandle = new InputApplicationHandle(null);
mApplicationHandle.name = name;
mApplicationHandle.dispatchingTimeoutNanos =
@@ -52,7 +57,8 @@
mWindowHandle.name = name;
mWindowHandle.inputChannel = mServerChannel;
mWindowHandle.layoutParamsType = WindowManager.LayoutParams.TYPE_INPUT_CONSUMER;
- mWindowHandle.layer = getLayerLw(mWindowHandle.layoutParamsType);
+ mWindowLayer = getLayerLw(mWindowHandle.layoutParamsType);
+ mWindowHandle.layer = mWindowLayer;
mWindowHandle.layoutParamsFlags = 0;
mWindowHandle.dispatchingTimeoutNanos =
WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
@@ -75,15 +81,21 @@
mWindowHandle.frameBottom = dh;
}
+ @Override
+ public void dismiss() {
+ synchronized (mService.mWindowMap) {
+ if (mService.removeInputConsumer()) {
+ mInputEventReceiver.dispose();
+ mService.mInputManager.unregisterInputChannel(mServerChannel);
+ mClientChannel.dispose();
+ mServerChannel.dispose();
+ }
+ }
+ }
+
private int getLayerLw(int windowType) {
return mService.mPolicy.windowTypeToLayerLw(windowType)
* WindowManagerService.TYPE_LAYER_MULTIPLIER
+ WindowManagerService.TYPE_LAYER_OFFSET;
}
-
- void disposeChannelsLw() {
- mService.mInputManager.unregisterInputChannel(mServerChannel);
- mClientChannel.dispose();
- mServerChannel.dispose();
- }
}
diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java
index eea0e73..b702180 100644
--- a/services/core/java/com/android/server/wm/InputMonitor.java
+++ b/services/core/java/com/android/server/wm/InputMonitor.java
@@ -282,8 +282,6 @@
boolean addInputConsumerHandle = mService.mInputConsumer != null;
- boolean addWallpaperInputConsumerHandle = mService.mWallpaperInputConsumer != null;
-
// Add all windows on the default display.
final int numDisplays = mService.mDisplayContents.size();
final WallpaperController wallpaperController = mService.mWallpaperControllerLocked;
@@ -304,14 +302,6 @@
addInputConsumerHandle = false;
}
- if (addWallpaperInputConsumerHandle) {
- if (child.mAttrs.type == WindowManager.LayoutParams.TYPE_WALLPAPER) {
- // Add the wallpaper input consumer above the first wallpaper window.
- addInputWindowHandleLw(mService.mWallpaperInputConsumer.mWindowHandle);
- addWallpaperInputConsumerHandle = false;
- }
- }
-
final int flags = child.mAttrs.flags;
final int privateFlags = child.mAttrs.privateFlags;
final int type = child.mAttrs.type;
@@ -339,11 +329,6 @@
}
}
- if (addWallpaperInputConsumerHandle) {
- // No wallpaper found, add the wallpaper input consumer at the end.
- addInputWindowHandleLw(mService.mWallpaperInputConsumer.mWindowHandle);
- }
-
// Send windows to native code.
mService.mInputManager.setInputWindows(mInputWindowHandles);
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index dcb4a63..97c4c42 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -407,11 +407,6 @@
InputConsumerImpl mInputConsumer;
/**
- * The input consumer added to the window manager before all wallpaper windows.
- */
- InputConsumerImpl mWallpaperInputConsumer;
-
- /**
* Windows that are being resized. Used so we can tell the client about
* the resize after closing the transaction in which we resized the
* underlying surface.
@@ -9629,37 +9624,13 @@
}
}
- private static final class HideNavInputConsumer extends InputConsumerImpl
- implements WindowManagerPolicy.InputConsumer {
- private final InputEventReceiver mInputEventReceiver;
-
- HideNavInputConsumer(WindowManagerService service, Looper looper,
- InputEventReceiver.Factory inputEventReceiverFactory) {
- super(service, "input consumer", null);
- mInputEventReceiver = inputEventReceiverFactory.createInputEventReceiver(
- mClientChannel, looper);
- }
-
- @Override
- public void dismiss() {
- if (mService.removeInputConsumer()) {
- synchronized (mService.mWindowMap) {
- mInputEventReceiver.dispose();
- disposeChannelsLw();
- }
- }
- }
- }
-
@Override
- public WindowManagerPolicy.InputConsumer addInputConsumer(Looper looper,
+ public InputConsumerImpl addInputConsumer(Looper looper,
InputEventReceiver.Factory inputEventReceiverFactory) {
synchronized (mWindowMap) {
- HideNavInputConsumer inputConsumerImpl = new HideNavInputConsumer(
- this, looper, inputEventReceiverFactory);
- mInputConsumer = inputConsumerImpl;
+ mInputConsumer = new InputConsumerImpl(this, looper, inputEventReceiverFactory);
mInputMonitor.updateInputWindowsLw(true);
- return inputConsumerImpl;
+ return mInputConsumer;
}
}
@@ -9674,24 +9645,6 @@
}
}
- public void createWallpaperInputConsumer(InputChannel inputChannel) {
- synchronized (mWindowMap) {
- mWallpaperInputConsumer = new InputConsumerImpl(this, "wallpaper input", inputChannel);
- mWallpaperInputConsumer.mWindowHandle.hasWallpaper = true;
- mInputMonitor.updateInputWindowsLw(true);
- }
- }
-
- public void removeWallpaperInputConsumer() {
- synchronized (mWindowMap) {
- if (mWallpaperInputConsumer != null) {
- mWallpaperInputConsumer.disposeChannelsLw();
- mWallpaperInputConsumer = null;
- mInputMonitor.updateInputWindowsLw(true);
- }
- }
- }
-
@Override
public boolean hasNavigationBar() {
return mPolicy.hasNavigationBar();
diff --git a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
index eda2f39..3e5ddbc 100644
--- a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
+++ b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
@@ -860,10 +860,6 @@
mService.mInputConsumer.layout(dw, dh);
}
- if (mService.mWallpaperInputConsumer != null) {
- mService.mWallpaperInputConsumer.layout(dw, dh);
- }
-
final int N = windows.size();
int i;