summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk1
-rw-r--r--core/java/android/hardware/input/IInputManager.aidl21
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java2
-rw-r--r--services/java/com/android/server/SystemServer.java1
-rw-r--r--services/java/com/android/server/accessibility/AccessibilityInputFilter.java2
-rw-r--r--services/java/com/android/server/accessibility/TouchExplorer.java2
-rw-r--r--services/java/com/android/server/input/InputApplicationHandle.java (renamed from services/java/com/android/server/wm/InputApplicationHandle.java)7
-rw-r--r--services/java/com/android/server/input/InputFilter.java (renamed from services/java/com/android/server/wm/InputFilter.java)12
-rw-r--r--services/java/com/android/server/input/InputManagerService.java (renamed from services/java/com/android/server/wm/InputManager.java)509
-rw-r--r--services/java/com/android/server/input/InputWindowHandle.java (renamed from services/java/com/android/server/wm/InputWindowHandle.java)7
-rw-r--r--services/java/com/android/server/wm/AppWindowToken.java1
-rw-r--r--services/java/com/android/server/wm/DragState.java2
-rw-r--r--services/java/com/android/server/wm/FakeWindowImpl.java3
-rw-r--r--services/java/com/android/server/wm/InputMonitor.java17
-rw-r--r--services/java/com/android/server/wm/WindowManagerService.java45
-rw-r--r--services/java/com/android/server/wm/WindowState.java2
-rw-r--r--services/jni/Android.mk6
-rw-r--r--services/jni/com_android_server_input_InputApplicationHandle.cpp (renamed from services/jni/com_android_server_InputApplicationHandle.cpp)6
-rw-r--r--services/jni/com_android_server_input_InputApplicationHandle.h (renamed from services/jni/com_android_server_InputApplicationHandle.h)0
-rw-r--r--services/jni/com_android_server_input_InputManagerService.cpp (renamed from services/jni/com_android_server_InputManager.cpp)500
-rw-r--r--services/jni/com_android_server_input_InputWindowHandle.cpp (renamed from services/jni/com_android_server_InputWindowHandle.cpp)10
-rw-r--r--services/jni/com_android_server_input_InputWindowHandle.h (renamed from services/jni/com_android_server_InputWindowHandle.h)0
22 files changed, 580 insertions, 576 deletions
diff --git a/Android.mk b/Android.mk
index 5879bb5..7b21b48 100644
--- a/Android.mk
+++ b/Android.mk
@@ -110,6 +110,7 @@ LOCAL_SRC_FILES += \
core/java/android/content/pm/IPackageStatsObserver.aidl \
core/java/android/database/IContentObserver.aidl \
core/java/android/hardware/ISerialManager.aidl \
+ core/java/android/hardware/input/IInputManager.aidl \
core/java/android/hardware/usb/IUsbManager.aidl \
core/java/android/net/IConnectivityManager.aidl \
core/java/android/net/INetworkManagementEventObserver.aidl \
diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl
new file mode 100644
index 0000000..85061bb
--- /dev/null
+++ b/core/java/android/hardware/input/IInputManager.aidl
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.input;
+
+/** @hide */
+interface IInputManager {
+}
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index 377ea66..bb0a6fe 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -85,7 +85,7 @@ import android.view.WindowManagerPolicy;
* This class is created by the initialization routine of the {@link WindowManagerPolicy},
* and runs on its thread. The keyguard UI is created from that thread in the
* constructor of this class. The apis may be called from other threads, including the
- * {@link com.android.server.wm.InputManager}'s and {@link android.view.WindowManager}'s.
+ * {@link com.android.server.input.InputManagerService}'s and {@link android.view.WindowManager}'s.
* Therefore, methods on this class are synchronized, and any action that is pointed
* directly to the keyguard UI is posted to a {@link Handler} to ensure it is taken on the UI
* thread of the keyguard.
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 423dad6..bdb34ca 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -219,6 +219,7 @@ class ServerThread extends Thread {
factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL,
!firstBoot);
ServiceManager.addService(Context.WINDOW_SERVICE, wm);
+ ServiceManager.addService(Context.INPUT_SERVICE, wm.getInputManagerService());
ActivityManagerService.self().setWindowManager(wm);
diff --git a/services/java/com/android/server/accessibility/AccessibilityInputFilter.java b/services/java/com/android/server/accessibility/AccessibilityInputFilter.java
index 769cb6a..31aa21e 100644
--- a/services/java/com/android/server/accessibility/AccessibilityInputFilter.java
+++ b/services/java/com/android/server/accessibility/AccessibilityInputFilter.java
@@ -16,7 +16,7 @@
package com.android.server.accessibility;
-import com.android.server.wm.InputFilter;
+import com.android.server.input.InputFilter;
import android.content.Context;
import android.util.Slog;
diff --git a/services/java/com/android/server/accessibility/TouchExplorer.java b/services/java/com/android/server/accessibility/TouchExplorer.java
index 41cf9a6..d07aa7a 100644
--- a/services/java/com/android/server/accessibility/TouchExplorer.java
+++ b/services/java/com/android/server/accessibility/TouchExplorer.java
@@ -29,7 +29,7 @@ import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import com.android.server.accessibility.AccessibilityInputFilter.Explorer;
-import com.android.server.wm.InputFilter;
+import com.android.server.input.InputFilter;
import java.util.Arrays;
diff --git a/services/java/com/android/server/wm/InputApplicationHandle.java b/services/java/com/android/server/input/InputApplicationHandle.java
index 1812f11..42c1052 100644
--- a/services/java/com/android/server/wm/InputApplicationHandle.java
+++ b/services/java/com/android/server/input/InputApplicationHandle.java
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-package com.android.server.wm;
-
+package com.android.server.input;
/**
* Functions as a handle for an application that can receive input.
@@ -30,7 +29,7 @@ public final class InputApplicationHandle {
private int ptr;
// The window manager's application window token.
- public final AppWindowToken appWindowToken;
+ public final Object appWindowToken;
// Application name.
public String name;
@@ -40,7 +39,7 @@ public final class InputApplicationHandle {
private native void nativeDispose();
- public InputApplicationHandle(AppWindowToken appWindowToken) {
+ public InputApplicationHandle(Object appWindowToken) {
this.appWindowToken = appWindowToken;
}
diff --git a/services/java/com/android/server/wm/InputFilter.java b/services/java/com/android/server/input/InputFilter.java
index 8f0001a..2ce0a02 100644
--- a/services/java/com/android/server/wm/InputFilter.java
+++ b/services/java/com/android/server/input/InputFilter.java
@@ -14,7 +14,9 @@
* limitations under the License.
*/
-package com.android.server.wm;
+package com.android.server.input;
+
+import com.android.server.wm.WindowManagerService;
import android.os.Handler;
import android.os.Looper;
@@ -33,7 +35,7 @@ import android.view.WindowManagerPolicy;
* system's behavior changes as follows:
* <ul>
* <li>Input events are first delivered to the {@link WindowManagerPolicy}
- * interception methods before queueing as usual. This critical step takes care of managing
+ * interception methods before queuing as usual. This critical step takes care of managing
* the power state of the device and handling wake keys.</li>
* <li>Input events are then asynchronously delivered to the input filter's
* {@link #onInputEvent(InputEvent)} method instead of being enqueued for dispatch to
@@ -79,7 +81,7 @@ import android.view.WindowManagerPolicy;
* {@link WindowManagerPolicy#FLAG_PASS_TO_USER} policy flag. The input filter may
* sometimes receive events that do not have this flag set. It should take note of
* the fact that the policy intends to drop the event, clean up its state, and
- * then send appropriate cancelation events to the dispatcher if needed.
+ * then send appropriate cancellation events to the dispatcher if needed.
* </p><p>
* For example, suppose the input filter is processing a gesture and one of the touch events
* it receives does not have the {@link WindowManagerPolicy#FLAG_PASS_TO_USER} flag set.
@@ -89,8 +91,8 @@ import android.view.WindowManagerPolicy;
* Corollary: Events that set sent to the dispatcher should usually include the
* {@link WindowManagerPolicy#FLAG_PASS_TO_USER} flag. Otherwise, they will be dropped!
* </p><p>
- * It may be prudent to disable automatic key repeating for synthetically generated
- * keys by setting the {@link WindowManagerPolicy#FLAG_DISABLE_KEY_REPEAT} policy flag.
+ * It may be prudent to disable automatic key repeating for synthetic key events
+ * by setting the {@link WindowManagerPolicy#FLAG_DISABLE_KEY_REPEAT} policy flag.
* </p>
*/
public abstract class InputFilter {
diff --git a/services/java/com/android/server/wm/InputManager.java b/services/java/com/android/server/input/InputManagerService.java
index 56c3519..6a566ae 100644
--- a/services/java/com/android/server/wm/InputManager.java
+++ b/services/java/com/android/server/input/InputManagerService.java
@@ -14,10 +14,12 @@
* limitations under the License.
*/
-package com.android.server.wm;
+package com.android.server.input;
import com.android.internal.util.XmlUtils;
import com.android.server.Watchdog;
+import com.android.server.input.InputFilter.Host;
+import com.android.server.wm.WindowManagerService;
import org.xmlpull.v1.XmlPullParser;
@@ -25,7 +27,10 @@ import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.database.ContentObserver;
+import android.hardware.input.IInputManager;
+import android.os.Binder;
import android.os.Environment;
+import android.os.Handler;
import android.os.Looper;
import android.os.MessageQueue;
import android.os.SystemProperties;
@@ -44,6 +49,7 @@ import android.view.WindowManager;
import android.view.WindowManagerPolicy;
import java.io.File;
+import java.io.FileDescriptor;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
@@ -53,61 +59,66 @@ import java.util.ArrayList;
/*
* Wraps the C++ InputManager and provides its callbacks.
*/
-public class InputManager implements Watchdog.Monitor {
+public class InputManagerService extends IInputManager.Stub implements Watchdog.Monitor {
static final String TAG = "InputManager";
-
- private static final boolean DEBUG = false;
+ static final boolean DEBUG = false;
+
+ private static final String EXCLUDED_DEVICES_PATH = "etc/excluded-input-devices.xml";
+
+ // Pointer to native input manager service object.
+ private final int mPtr;
- private final Callbacks mCallbacks;
private final Context mContext;
- private final WindowManagerService mWindowManagerService;
-
- private static native void nativeInit(Context context,
- Callbacks callbacks, MessageQueue messageQueue);
- private static native void nativeStart();
- private static native void nativeSetDisplaySize(int displayId, int width, int height,
- int externalWidth, int externalHeight);
- private static native void nativeSetDisplayOrientation(int displayId, int rotation);
+ private final Callbacks mCallbacks;
+ private final Handler mHandler;
+
+ private static native int nativeInit(InputManagerService service,
+ Context context, MessageQueue messageQueue);
+ private static native void nativeStart(int ptr);
+ private static native void nativeSetDisplaySize(int ptr, int displayId,
+ int width, int height, int externalWidth, int externalHeight);
+ private static native void nativeSetDisplayOrientation(int ptr, int displayId, int rotation);
- private static native int nativeGetScanCodeState(int deviceId, int sourceMask,
- int scanCode);
- private static native int nativeGetKeyCodeState(int deviceId, int sourceMask,
- int keyCode);
- private static native int nativeGetSwitchState(int deviceId, int sourceMask,
- int sw);
- private static native boolean nativeHasKeys(int deviceId, int sourceMask,
- int[] keyCodes, boolean[] keyExists);
- private static native void nativeRegisterInputChannel(InputChannel inputChannel,
+ private static native int nativeGetScanCodeState(int ptr,
+ int deviceId, int sourceMask, int scanCode);
+ private static native int nativeGetKeyCodeState(int ptr,
+ int deviceId, int sourceMask, int keyCode);
+ private static native int nativeGetSwitchState(int ptr,
+ int deviceId, int sourceMask, int sw);
+ private static native boolean nativeHasKeys(int ptr,
+ int deviceId, int sourceMask, int[] keyCodes, boolean[] keyExists);
+ private static native void nativeRegisterInputChannel(int ptr, InputChannel inputChannel,
InputWindowHandle inputWindowHandle, boolean monitor);
- private static native void nativeUnregisterInputChannel(InputChannel inputChannel);
- private static native void nativeSetInputFilterEnabled(boolean enable);
- private static native int nativeInjectInputEvent(InputEvent event,
+ private static native void nativeUnregisterInputChannel(int ptr, InputChannel inputChannel);
+ private static native void nativeSetInputFilterEnabled(int ptr, boolean enable);
+ private static native int nativeInjectInputEvent(int ptr, InputEvent event,
int injectorPid, int injectorUid, int syncMode, int timeoutMillis,
int policyFlags);
- private static native void nativeSetInputWindows(InputWindowHandle[] windowHandles);
- private static native void nativeSetInputDispatchMode(boolean enabled, boolean frozen);
- private static native void nativeSetSystemUiVisibility(int visibility);
- private static native void nativeSetFocusedApplication(InputApplicationHandle application);
- private static native InputDevice nativeGetInputDevice(int deviceId);
- private static native void nativeGetInputConfiguration(Configuration configuration);
- private static native int[] nativeGetInputDeviceIds();
- private static native boolean nativeTransferTouchFocus(InputChannel fromChannel,
- InputChannel toChannel);
- private static native void nativeSetPointerSpeed(int speed);
- private static native void nativeSetShowTouches(boolean enabled);
- private static native String nativeDump();
- private static native void nativeMonitor();
+ private static native void nativeSetInputWindows(int ptr, InputWindowHandle[] windowHandles);
+ private static native void nativeSetInputDispatchMode(int ptr, boolean enabled, boolean frozen);
+ private static native void nativeSetSystemUiVisibility(int ptr, int visibility);
+ private static native void nativeSetFocusedApplication(int ptr,
+ InputApplicationHandle application);
+ private static native InputDevice nativeGetInputDevice(int ptr, int deviceId);
+ private static native void nativeGetInputConfiguration(int ptr, Configuration configuration);
+ private static native int[] nativeGetInputDeviceIds(int ptr);
+ private static native boolean nativeTransferTouchFocus(int ptr,
+ InputChannel fromChannel, InputChannel toChannel);
+ private static native void nativeSetPointerSpeed(int ptr, int speed);
+ private static native void nativeSetShowTouches(int ptr, boolean enabled);
+ private static native String nativeDump(int ptr);
+ private static native void nativeMonitor(int ptr);
// Input event injection constants defined in InputDispatcher.h.
- static final int INPUT_EVENT_INJECTION_SUCCEEDED = 0;
- static final int INPUT_EVENT_INJECTION_PERMISSION_DENIED = 1;
- static final int INPUT_EVENT_INJECTION_FAILED = 2;
- static final int INPUT_EVENT_INJECTION_TIMED_OUT = 3;
-
+ public static final int INPUT_EVENT_INJECTION_SUCCEEDED = 0;
+ public static final int INPUT_EVENT_INJECTION_PERMISSION_DENIED = 1;
+ public static final int INPUT_EVENT_INJECTION_FAILED = 2;
+ public static final int INPUT_EVENT_INJECTION_TIMED_OUT = 3;
+
// Input event injection synchronization modes defined in InputDispatcher.h
- static final int INPUT_EVENT_INJECTION_SYNC_NONE = 0;
- static final int INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_RESULT = 1;
- static final int INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISH = 2;
+ public static final int INPUT_EVENT_INJECTION_SYNC_NONE = 0;
+ public static final int INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_RESULT = 1;
+ public static final int INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISH = 2;
// Key states (may be returned by queries about the current state of a
// particular key code, scan code or switch).
@@ -129,23 +140,21 @@ public class InputManager implements Watchdog.Monitor {
InputFilter mInputFilter;
InputFilterHost mInputFilterHost;
- public InputManager(Context context, WindowManagerService windowManagerService) {
+ public InputManagerService(Context context, Callbacks callbacks) {
this.mContext = context;
- this.mWindowManagerService = windowManagerService;
- this.mCallbacks = new Callbacks();
-
- Looper looper = windowManagerService.mH.getLooper();
+ this.mCallbacks = callbacks;
+ this.mHandler = new Handler();
Slog.i(TAG, "Initializing input manager");
- nativeInit(mContext, mCallbacks, looper.getQueue());
-
- // Add ourself to the Watchdog monitors.
- Watchdog.getInstance().addMonitor(this);
+ mPtr = nativeInit(this, mContext, mHandler.getLooper().getQueue());
}
public void start() {
Slog.i(TAG, "Starting input manager");
- nativeStart();
+ nativeStart(mPtr);
+
+ // Add ourself to the Watchdog monitors.
+ Watchdog.getInstance().addMonitor(this);
registerPointerSpeedSettingObserver();
registerShowTouchesSettingObserver();
@@ -164,7 +173,7 @@ public class InputManager implements Watchdog.Monitor {
Slog.d(TAG, "Setting display #" + displayId + " size to " + width + "x" + height
+ " external size " + externalWidth + "x" + externalHeight);
}
- nativeSetDisplaySize(displayId, width, height, externalWidth, externalHeight);
+ nativeSetDisplaySize(mPtr, displayId, width, height, externalWidth, externalHeight);
}
public void setDisplayOrientation(int displayId, int rotation) {
@@ -175,7 +184,7 @@ public class InputManager implements Watchdog.Monitor {
if (DEBUG) {
Slog.d(TAG, "Setting display #" + displayId + " orientation to " + rotation);
}
- nativeSetDisplayOrientation(displayId, rotation);
+ nativeSetDisplayOrientation(mPtr, displayId, rotation);
}
public void getInputConfiguration(Configuration config) {
@@ -183,7 +192,7 @@ public class InputManager implements Watchdog.Monitor {
throw new IllegalArgumentException("config must not be null.");
}
- nativeGetInputConfiguration(config);
+ nativeGetInputConfiguration(mPtr, config);
}
/**
@@ -196,7 +205,7 @@ public class InputManager implements Watchdog.Monitor {
* @return The key state.
*/
public int getKeyCodeState(int deviceId, int sourceMask, int keyCode) {
- return nativeGetKeyCodeState(deviceId, sourceMask, keyCode);
+ return nativeGetKeyCodeState(mPtr, deviceId, sourceMask, keyCode);
}
/**
@@ -209,7 +218,7 @@ public class InputManager implements Watchdog.Monitor {
* @return The key state.
*/
public int getScanCodeState(int deviceId, int sourceMask, int scanCode) {
- return nativeGetScanCodeState(deviceId, sourceMask, scanCode);
+ return nativeGetScanCodeState(mPtr, deviceId, sourceMask, scanCode);
}
/**
@@ -222,7 +231,7 @@ public class InputManager implements Watchdog.Monitor {
* @return The switch state.
*/
public int getSwitchState(int deviceId, int sourceMask, int switchCode) {
- return nativeGetSwitchState(deviceId, sourceMask, switchCode);
+ return nativeGetSwitchState(mPtr, deviceId, sourceMask, switchCode);
}
/**
@@ -246,7 +255,7 @@ public class InputManager implements Watchdog.Monitor {
+ "least as large as keyCodes.");
}
- return nativeHasKeys(deviceId, sourceMask, keyCodes, keyExists);
+ return nativeHasKeys(mPtr, deviceId, sourceMask, keyCodes, keyExists);
}
/**
@@ -260,7 +269,7 @@ public class InputManager implements Watchdog.Monitor {
}
InputChannel[] inputChannels = InputChannel.openInputChannelPair(inputChannelName);
- nativeRegisterInputChannel(inputChannels[0], null, true);
+ nativeRegisterInputChannel(mPtr, inputChannels[0], null, true);
inputChannels[0].dispose(); // don't need to retain the Java object reference
return inputChannels[1];
}
@@ -277,7 +286,7 @@ public class InputManager implements Watchdog.Monitor {
throw new IllegalArgumentException("inputChannel must not be null.");
}
- nativeRegisterInputChannel(inputChannel, inputWindowHandle, false);
+ nativeRegisterInputChannel(mPtr, inputChannel, inputWindowHandle, false);
}
/**
@@ -289,7 +298,7 @@ public class InputManager implements Watchdog.Monitor {
throw new IllegalArgumentException("inputChannel must not be null.");
}
- nativeUnregisterInputChannel(inputChannel);
+ nativeUnregisterInputChannel(mPtr, inputChannel);
}
/**
@@ -323,7 +332,7 @@ public class InputManager implements Watchdog.Monitor {
filter.install(mInputFilterHost);
}
- nativeSetInputFilterEnabled(filter != null);
+ nativeSetInputFilterEnabled(mPtr, filter != null);
}
}
@@ -362,8 +371,8 @@ public class InputManager implements Watchdog.Monitor {
throw new IllegalArgumentException("timeoutMillis must be positive");
}
- return nativeInjectInputEvent(event, injectorPid, injectorUid, syncMode, timeoutMillis,
- WindowManagerPolicy.FLAG_DISABLE_KEY_REPEAT);
+ return nativeInjectInputEvent(mPtr, event, injectorPid, injectorUid, syncMode,
+ timeoutMillis, WindowManagerPolicy.FLAG_DISABLE_KEY_REPEAT);
}
/**
@@ -372,7 +381,7 @@ public class InputManager implements Watchdog.Monitor {
* @return The input device or null if not found.
*/
public InputDevice getInputDevice(int deviceId) {
- return nativeGetInputDevice(deviceId);
+ return nativeGetInputDevice(mPtr, deviceId);
}
/**
@@ -380,23 +389,23 @@ public class InputManager implements Watchdog.Monitor {
* @return The input device ids.
*/
public int[] getInputDeviceIds() {
- return nativeGetInputDeviceIds();
+ return nativeGetInputDeviceIds(mPtr);
}
public void setInputWindows(InputWindowHandle[] windowHandles) {
- nativeSetInputWindows(windowHandles);
+ nativeSetInputWindows(mPtr, windowHandles);
}
public void setFocusedApplication(InputApplicationHandle application) {
- nativeSetFocusedApplication(application);
+ nativeSetFocusedApplication(mPtr, application);
}
public void setInputDispatchMode(boolean enabled, boolean frozen) {
- nativeSetInputDispatchMode(enabled, frozen);
+ nativeSetInputDispatchMode(mPtr, enabled, frozen);
}
public void setSystemUiVisibility(int visibility) {
- nativeSetSystemUiVisibility(visibility);
+ nativeSetSystemUiVisibility(mPtr, visibility);
}
/**
@@ -419,7 +428,7 @@ public class InputManager implements Watchdog.Monitor {
if (toChannel == null) {
throw new IllegalArgumentException("toChannel must not be null.");
}
- return nativeTransferTouchFocus(fromChannel, toChannel);
+ return nativeTransferTouchFocus(mPtr, fromChannel, toChannel);
}
/**
@@ -429,7 +438,7 @@ public class InputManager implements Watchdog.Monitor {
*/
public void setPointerSpeed(int speed) {
speed = Math.min(Math.max(speed, -7), 7);
- nativeSetPointerSpeed(speed);
+ nativeSetPointerSpeed(mPtr, speed);
}
public void updatePointerSpeedFromSettings() {
@@ -440,7 +449,7 @@ public class InputManager implements Watchdog.Monitor {
private void registerPointerSpeedSettingObserver() {
mContext.getContentResolver().registerContentObserver(
Settings.System.getUriFor(Settings.System.POINTER_SPEED), true,
- new ContentObserver(mWindowManagerService.mH) {
+ new ContentObserver(mHandler) {
@Override
public void onChange(boolean selfChange) {
updatePointerSpeedFromSettings();
@@ -460,13 +469,13 @@ public class InputManager implements Watchdog.Monitor {
public void updateShowTouchesFromSettings() {
int setting = getShowTouchesSetting(0);
- nativeSetShowTouches(setting != 0);
+ nativeSetShowTouches(mPtr, setting != 0);
}
private void registerShowTouchesSettingObserver() {
mContext.getContentResolver().registerContentObserver(
Settings.System.getUriFor(Settings.System.SHOW_TOUCHES), true,
- new ContentObserver(mWindowManagerService.mH) {
+ new ContentObserver(mHandler) {
@Override
public void onChange(boolean selfChange) {
updateShowTouchesFromSettings();
@@ -484,200 +493,220 @@ public class InputManager implements Watchdog.Monitor {
return result;
}
- public void dump(PrintWriter pw) {
- String dumpStr = nativeDump();
+ @Override
+ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ if (mContext.checkCallingOrSelfPermission("android.permission.DUMP")
+ != PackageManager.PERMISSION_GRANTED) {
+ pw.println("Permission Denial: can't dump InputManager from from pid="
+ + Binder.getCallingPid()
+ + ", uid=" + Binder.getCallingUid());
+ return;
+ }
+
+ pw.println("INPUT MANAGER (dumpsys input)\n");
+ String dumpStr = nativeDump(mPtr);
if (dumpStr != null) {
pw.println(dumpStr);
}
}
- // Called by the heartbeat to ensure locks are not held indefnitely (for deadlock detection).
+ // Called by the heartbeat to ensure locks are not held indefinitely (for deadlock detection).
public void monitor() {
synchronized (mInputFilterLock) { }
- nativeMonitor();
+ nativeMonitor(mPtr);
}
- private final class InputFilterHost implements InputFilter.Host {
- private boolean mDisconnected;
+ // Native callback.
+ private void notifyConfigurationChanged(long whenNanos) {
+ mCallbacks.notifyConfigurationChanged();
+ }
- public void disconnectLocked() {
- mDisconnected = true;
- }
+ // Native callback.
+ private void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) {
+ mCallbacks.notifyLidSwitchChanged(whenNanos, lidOpen);
+ }
- public void sendInputEvent(InputEvent event, int policyFlags) {
- if (event == null) {
- throw new IllegalArgumentException("event must not be null");
- }
+ // Native callback.
+ private void notifyInputChannelBroken(InputWindowHandle inputWindowHandle) {
+ mCallbacks.notifyInputChannelBroken(inputWindowHandle);
+ }
- synchronized (mInputFilterLock) {
- if (!mDisconnected) {
- nativeInjectInputEvent(event, 0, 0, INPUT_EVENT_INJECTION_SYNC_NONE, 0,
- policyFlags | WindowManagerPolicy.FLAG_FILTERED);
- }
+ // Native callback.
+ private long notifyANR(InputApplicationHandle inputApplicationHandle,
+ InputWindowHandle inputWindowHandle) {
+ return mCallbacks.notifyANR(inputApplicationHandle, inputWindowHandle);
+ }
+
+ // Native callback.
+ final boolean filterInputEvent(InputEvent event, int policyFlags) {
+ synchronized (mInputFilterLock) {
+ if (mInputFilter != null) {
+ mInputFilter.filterInputEvent(event, policyFlags);
+ return false;
}
}
+ event.recycle();
+ return true;
}
- /*
- * Callbacks from native.
- */
- private final class Callbacks {
- static final String TAG = "InputManager-Callbacks";
-
- private static final boolean DEBUG_VIRTUAL_KEYS = false;
- private static final String EXCLUDED_DEVICES_PATH = "etc/excluded-input-devices.xml";
- private static final String CALIBRATION_DIR_PATH = "usr/idc/";
-
- @SuppressWarnings("unused")
- public void notifyConfigurationChanged(long whenNanos) {
- mWindowManagerService.mInputMonitor.notifyConfigurationChanged();
- }
-
- @SuppressWarnings("unused")
- public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) {
- mWindowManagerService.mInputMonitor.notifyLidSwitchChanged(whenNanos, lidOpen);
- }
-
- @SuppressWarnings("unused")
- public void notifyInputChannelBroken(InputWindowHandle inputWindowHandle) {
- mWindowManagerService.mInputMonitor.notifyInputChannelBroken(inputWindowHandle);
- }
-
- @SuppressWarnings("unused")
- public long notifyANR(InputApplicationHandle inputApplicationHandle,
- InputWindowHandle inputWindowHandle) {
- return mWindowManagerService.mInputMonitor.notifyANR(
- inputApplicationHandle, inputWindowHandle);
- }
+ // Native callback.
+ private int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags, boolean isScreenOn) {
+ return mCallbacks.interceptKeyBeforeQueueing(
+ event, policyFlags, isScreenOn);
+ }
- @SuppressWarnings("unused")
- final boolean filterInputEvent(InputEvent event, int policyFlags) {
- synchronized (mInputFilterLock) {
- if (mInputFilter != null) {
- mInputFilter.filterInputEvent(event, policyFlags);
- return false;
- }
- }
- event.recycle();
- return true;
- }
+ // Native callback.
+ private int interceptMotionBeforeQueueingWhenScreenOff(int policyFlags) {
+ return mCallbacks.interceptMotionBeforeQueueingWhenScreenOff(policyFlags);
+ }
- @SuppressWarnings("unused")
- public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags, boolean isScreenOn) {
- return mWindowManagerService.mInputMonitor.interceptKeyBeforeQueueing(
- event, policyFlags, isScreenOn);
- }
+ // Native callback.
+ private long interceptKeyBeforeDispatching(InputWindowHandle focus,
+ KeyEvent event, int policyFlags) {
+ return mCallbacks.interceptKeyBeforeDispatching(focus, event, policyFlags);
+ }
- @SuppressWarnings("unused")
- public int interceptMotionBeforeQueueingWhenScreenOff(int policyFlags) {
- return mWindowManagerService.mInputMonitor.interceptMotionBeforeQueueingWhenScreenOff(
- policyFlags);
- }
+ // Native callback.
+ private KeyEvent dispatchUnhandledKey(InputWindowHandle focus,
+ KeyEvent event, int policyFlags) {
+ return mCallbacks.dispatchUnhandledKey(focus, event, policyFlags);
+ }
- @SuppressWarnings("unused")
- public long interceptKeyBeforeDispatching(InputWindowHandle focus,
- KeyEvent event, int policyFlags) {
- return mWindowManagerService.mInputMonitor.interceptKeyBeforeDispatching(
- focus, event, policyFlags);
- }
-
- @SuppressWarnings("unused")
- public KeyEvent dispatchUnhandledKey(InputWindowHandle focus,
- KeyEvent event, int policyFlags) {
- return mWindowManagerService.mInputMonitor.dispatchUnhandledKey(
- focus, event, policyFlags);
- }
-
- @SuppressWarnings("unused")
- public boolean checkInjectEventsPermission(int injectorPid, int injectorUid) {
- return mContext.checkPermission(
- android.Manifest.permission.INJECT_EVENTS, injectorPid, injectorUid)
- == PackageManager.PERMISSION_GRANTED;
- }
+ // Native callback.
+ private boolean checkInjectEventsPermission(int injectorPid, int injectorUid) {
+ return mContext.checkPermission(android.Manifest.permission.INJECT_EVENTS,
+ injectorPid, injectorUid) == PackageManager.PERMISSION_GRANTED;
+ }
- @SuppressWarnings("unused")
- public int getVirtualKeyQuietTimeMillis() {
- return mContext.getResources().getInteger(
- com.android.internal.R.integer.config_virtualKeyQuietTimeMillis);
- }
+ // Native callback.
+ private int getVirtualKeyQuietTimeMillis() {
+ return mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_virtualKeyQuietTimeMillis);
+ }
- @SuppressWarnings("unused")
- public String[] getExcludedDeviceNames() {
- ArrayList<String> names = new ArrayList<String>();
-
- // Read partner-provided list of excluded input devices
- XmlPullParser parser = null;
- // Environment.getRootDirectory() is a fancy way of saying ANDROID_ROOT or "/system".
- File confFile = new File(Environment.getRootDirectory(), EXCLUDED_DEVICES_PATH);
- FileReader confreader = null;
- try {
- confreader = new FileReader(confFile);
- parser = Xml.newPullParser();
- parser.setInput(confreader);
- XmlUtils.beginDocument(parser, "devices");
-
- while (true) {
- XmlUtils.nextElement(parser);
- if (!"device".equals(parser.getName())) {
- break;
- }
- String name = parser.getAttributeValue(null, "name");
- if (name != null) {
- names.add(name);
- }
+ // Native callback.
+ private String[] getExcludedDeviceNames() {
+ ArrayList<String> names = new ArrayList<String>();
+
+ // Read partner-provided list of excluded input devices
+ XmlPullParser parser = null;
+ // Environment.getRootDirectory() is a fancy way of saying ANDROID_ROOT or "/system".
+ File confFile = new File(Environment.getRootDirectory(), EXCLUDED_DEVICES_PATH);
+ FileReader confreader = null;
+ try {
+ confreader = new FileReader(confFile);
+ parser = Xml.newPullParser();
+ parser.setInput(confreader);
+ XmlUtils.beginDocument(parser, "devices");
+
+ while (true) {
+ XmlUtils.nextElement(parser);
+ if (!"device".equals(parser.getName())) {
+ break;
+ }
+ String name = parser.getAttributeValue(null, "name");
+ if (name != null) {
+ names.add(name);
}
- } catch (FileNotFoundException e) {
- // It's ok if the file does not exist.
- } catch (Exception e) {
- Slog.e(TAG, "Exception while parsing '" + confFile.getAbsolutePath() + "'", e);
- } finally {
- try { if (confreader != null) confreader.close(); } catch (IOException e) { }
}
-
- return names.toArray(new String[names.size()]);
+ } catch (FileNotFoundException e) {
+ // It's ok if the file does not exist.
+ } catch (Exception e) {
+ Slog.e(TAG, "Exception while parsing '" + confFile.getAbsolutePath() + "'", e);
+ } finally {
+ try { if (confreader != null) confreader.close(); } catch (IOException e) { }
}
- @SuppressWarnings("unused")
- public int getKeyRepeatTimeout() {
- return ViewConfiguration.getKeyRepeatTimeout();
- }
+ return names.toArray(new String[names.size()]);
+ }
- @SuppressWarnings("unused")
- public int getKeyRepeatDelay() {
- return ViewConfiguration.getKeyRepeatDelay();
- }
+ // Native callback.
+ private int getKeyRepeatTimeout() {
+ return ViewConfiguration.getKeyRepeatTimeout();
+ }
- @SuppressWarnings("unused")
- public int getHoverTapTimeout() {
- return ViewConfiguration.getHoverTapTimeout();
- }
+ // Native callback.
+ private int getKeyRepeatDelay() {
+ return ViewConfiguration.getKeyRepeatDelay();
+ }
- @SuppressWarnings("unused")
- public int getHoverTapSlop() {
- return ViewConfiguration.getHoverTapSlop();
- }
+ // Native callback.
+ private int getHoverTapTimeout() {
+ return ViewConfiguration.getHoverTapTimeout();
+ }
- @SuppressWarnings("unused")
- public int getDoubleTapTimeout() {
- return ViewConfiguration.getDoubleTapTimeout();
- }
+ // Native callback.
+ private int getHoverTapSlop() {
+ return ViewConfiguration.getHoverTapSlop();
+ }
- @SuppressWarnings("unused")
- public int getLongPressTimeout() {
- return ViewConfiguration.getLongPressTimeout();
- }
+ // Native callback.
+ private int getDoubleTapTimeout() {
+ return ViewConfiguration.getDoubleTapTimeout();
+ }
- @SuppressWarnings("unused")
- public int getPointerLayer() {
- return mWindowManagerService.mPolicy.windowTypeToLayerLw(
- WindowManager.LayoutParams.TYPE_POINTER)
- * WindowManagerService.TYPE_LAYER_MULTIPLIER
- + WindowManagerService.TYPE_LAYER_OFFSET;
+ // Native callback.
+ private int getLongPressTimeout() {
+ return ViewConfiguration.getLongPressTimeout();
+ }
+
+ // Native callback.
+ private int getPointerLayer() {
+ return mCallbacks.getPointerLayer();
+ }
+
+ // Native callback.
+ private PointerIcon getPointerIcon() {
+ return PointerIcon.getDefaultIcon(mContext);
+ }
+
+ /**
+ * Callback interface implemented by the Window Manager.
+ */
+ public interface Callbacks {
+ public void notifyConfigurationChanged();
+
+ public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen);
+
+ public void notifyInputChannelBroken(InputWindowHandle inputWindowHandle);
+
+ public long notifyANR(InputApplicationHandle inputApplicationHandle,
+ InputWindowHandle inputWindowHandle);
+
+ public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags, boolean isScreenOn);
+
+ public int interceptMotionBeforeQueueingWhenScreenOff(int policyFlags);
+
+ public long interceptKeyBeforeDispatching(InputWindowHandle focus,
+ KeyEvent event, int policyFlags);
+
+ public KeyEvent dispatchUnhandledKey(InputWindowHandle focus,
+ KeyEvent event, int policyFlags);
+
+ public int getPointerLayer();
+ }
+
+ /**
+ * Hosting interface for input filters to call back into the input manager.
+ */
+ private final class InputFilterHost implements InputFilter.Host {
+ private boolean mDisconnected;
+
+ public void disconnectLocked() {
+ mDisconnected = true;
}
- @SuppressWarnings("unused")
- public PointerIcon getPointerIcon() {
- return PointerIcon.getDefaultIcon(mContext);
+ public void sendInputEvent(InputEvent event, int policyFlags) {
+ if (event == null) {
+ throw new IllegalArgumentException("event must not be null");
+ }
+
+ synchronized (mInputFilterLock) {
+ if (!mDisconnected) {
+ nativeInjectInputEvent(mPtr, event, 0, 0, INPUT_EVENT_INJECTION_SYNC_NONE, 0,
+ policyFlags | WindowManagerPolicy.FLAG_FILTERED);
+ }
+ }
}
}
}
diff --git a/services/java/com/android/server/wm/InputWindowHandle.java b/services/java/com/android/server/input/InputWindowHandle.java
index 264877c..03d66af 100644
--- a/services/java/com/android/server/wm/InputWindowHandle.java
+++ b/services/java/com/android/server/input/InputWindowHandle.java
@@ -14,11 +14,10 @@
* limitations under the License.
*/
-package com.android.server.wm;
+package com.android.server.input;
import android.graphics.Region;
import android.view.InputChannel;
-import android.view.WindowManagerPolicy;
/**
* Functions as a handle for a window that can receive input.
@@ -35,7 +34,7 @@ public final class InputWindowHandle {
public final InputApplicationHandle inputApplicationHandle;
// The window manager's window state.
- public final WindowManagerPolicy.WindowState windowState;
+ public final Object windowState;
// The input channel associated with the window.
public InputChannel inputChannel;
@@ -91,7 +90,7 @@ public final class InputWindowHandle {
private native void nativeDispose();
public InputWindowHandle(InputApplicationHandle inputApplicationHandle,
- WindowManagerPolicy.WindowState windowState) {
+ Object windowState) {
this.inputApplicationHandle = inputApplicationHandle;
this.windowState = windowState;
}
diff --git a/services/java/com/android/server/wm/AppWindowToken.java b/services/java/com/android/server/wm/AppWindowToken.java
index 3069b74..55d571d 100644
--- a/services/java/com/android/server/wm/AppWindowToken.java
+++ b/services/java/com/android/server/wm/AppWindowToken.java
@@ -18,6 +18,7 @@ package com.android.server.wm;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
+import com.android.server.input.InputApplicationHandle;
import com.android.server.wm.WindowManagerService.H;
import android.content.pm.ActivityInfo;
diff --git a/services/java/com/android/server/wm/DragState.java b/services/java/com/android/server/wm/DragState.java
index a19035a..b2cf3e0 100644
--- a/services/java/com/android/server/wm/DragState.java
+++ b/services/java/com/android/server/wm/DragState.java
@@ -16,6 +16,8 @@
package com.android.server.wm;
+import com.android.server.input.InputApplicationHandle;
+import com.android.server.input.InputWindowHandle;
import com.android.server.wm.WindowManagerService.DragInputEventReceiver;
import com.android.server.wm.WindowManagerService.H;
diff --git a/services/java/com/android/server/wm/FakeWindowImpl.java b/services/java/com/android/server/wm/FakeWindowImpl.java
index 121ce18..2527f46 100644
--- a/services/java/com/android/server/wm/FakeWindowImpl.java
+++ b/services/java/com/android/server/wm/FakeWindowImpl.java
@@ -16,6 +16,9 @@
package com.android.server.wm;
+import com.android.server.input.InputApplicationHandle;
+import com.android.server.input.InputWindowHandle;
+
import android.os.Looper;
import android.os.Process;
import android.util.Slog;
diff --git a/services/java/com/android/server/wm/InputMonitor.java b/services/java/com/android/server/wm/InputMonitor.java
index fb74d27..c28cfa2 100644
--- a/services/java/com/android/server/wm/InputMonitor.java
+++ b/services/java/com/android/server/wm/InputMonitor.java
@@ -16,6 +16,10 @@
package com.android.server.wm;
+import com.android.server.input.InputManagerService;
+import com.android.server.input.InputApplicationHandle;
+import com.android.server.input.InputWindowHandle;
+
import android.graphics.Rect;
import android.os.RemoteException;
import android.util.Log;
@@ -27,7 +31,7 @@ import android.view.WindowManager;
import java.util.ArrayList;
import java.util.Arrays;
-final class InputMonitor {
+final class InputMonitor implements InputManagerService.Callbacks {
private final WindowManagerService mService;
// Current window with input focus for keys and other non-touch events. May be null.
@@ -93,7 +97,7 @@ final class InputMonitor {
}
if (appWindowToken == null && inputApplicationHandle != null) {
- appWindowToken = inputApplicationHandle.appWindowToken;
+ appWindowToken = (AppWindowToken)inputApplicationHandle.appWindowToken;
if (appWindowToken != null) {
Slog.i(WindowManagerService.TAG,
"Input event dispatching timed out sending to application "
@@ -301,7 +305,14 @@ final class InputMonitor {
WindowState windowState = focus != null ? (WindowState) focus.windowState : null;
return mService.mPolicy.dispatchUnhandledKey(windowState, event, policyFlags);
}
-
+
+ /* Callback to get pointer layer. */
+ public int getPointerLayer() {
+ return mService.mPolicy.windowTypeToLayerLw(WindowManager.LayoutParams.TYPE_POINTER)
+ * WindowManagerService.TYPE_LAYER_MULTIPLIER
+ + WindowManagerService.TYPE_LAYER_OFFSET;
+ }
+
/* Called when the current input focus changes.
* Layer assignment is assumed to be complete by the time this is called.
*/
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index afbc348..da56ef7 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -44,6 +44,8 @@ import com.android.server.EventLogTags;
import com.android.server.PowerManagerService;
import com.android.server.Watchdog;
import com.android.server.am.BatteryStatsService;
+import com.android.server.input.InputFilter;
+import com.android.server.input.InputManagerService;
import android.Manifest;
import android.app.ActivityManagerNative;
@@ -577,7 +579,7 @@ public class WindowManagerService extends IWindowManager.Stub
float mTransitionAnimationScale = 1.0f;
float mAnimatorDurationScale = 1.0f;
- final InputManager mInputManager;
+ final InputManagerService mInputManager;
// Who is holding the screen on.
Session mHoldingScreenOn;
@@ -843,7 +845,7 @@ public class WindowManagerService extends IWindowManager.Stub
"KEEP_SCREEN_ON_FLAG");
mHoldingScreenWakeLock.setReferenceCounted(false);
- mInputManager = new InputManager(context, this);
+ mInputManager = new InputManagerService(context, mInputMonitor);
mAnimator = new WindowAnimator(this, context, mPolicy);
PolicyThread thr = new PolicyThread(mPolicy, this, context, pm);
@@ -864,6 +866,10 @@ public class WindowManagerService extends IWindowManager.Stub
Watchdog.getInstance().addMonitor(this);
}
+ public InputManagerService getInputManagerService() {
+ return mInputManager;
+ }
+
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
throws RemoteException {
@@ -6416,8 +6422,8 @@ public class WindowManagerService extends IWindowManager.Stub
final long ident = Binder.clearCallingIdentity();
final int result = mInputManager.injectInputEvent(newEvent, pid, uid,
- sync ? InputManager.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISH
- : InputManager.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_RESULT,
+ sync ? InputManagerService.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISH
+ : InputManagerService.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_RESULT,
INJECTION_TIMEOUT_MILLIS);
Binder.restoreCallingIdentity(ident);
@@ -6446,8 +6452,8 @@ public class WindowManagerService extends IWindowManager.Stub
}
final int result = mInputManager.injectInputEvent(newEvent, pid, uid,
- sync ? InputManager.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISH
- : InputManager.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_RESULT,
+ sync ? InputManagerService.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISH
+ : InputManagerService.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_RESULT,
INJECTION_TIMEOUT_MILLIS);
Binder.restoreCallingIdentity(ident);
@@ -6476,8 +6482,8 @@ public class WindowManagerService extends IWindowManager.Stub
}
final int result = mInputManager.injectInputEvent(newEvent, pid, uid,
- sync ? InputManager.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISH
- : InputManager.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_RESULT,
+ sync ? InputManagerService.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISH
+ : InputManagerService.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_RESULT,
INJECTION_TIMEOUT_MILLIS);
Binder.restoreCallingIdentity(ident);
@@ -6498,7 +6504,7 @@ public class WindowManagerService extends IWindowManager.Stub
final long ident = Binder.clearCallingIdentity();
final int result = mInputManager.injectInputEvent(ev, pid, uid,
- InputManager.INPUT_EVENT_INJECTION_SYNC_NONE,
+ InputManagerService.INPUT_EVENT_INJECTION_SYNC_NONE,
INJECTION_TIMEOUT_MILLIS);
Binder.restoreCallingIdentity(ident);
@@ -6507,16 +6513,16 @@ public class WindowManagerService extends IWindowManager.Stub
private boolean reportInjectionResult(int result, int pid) {
switch (result) {
- case InputManager.INPUT_EVENT_INJECTION_PERMISSION_DENIED:
+ case InputManagerService.INPUT_EVENT_INJECTION_PERMISSION_DENIED:
Slog.w(TAG, "Input event injection from pid " + pid + " permission denied.");
throw new SecurityException(
"Injecting to another application requires INJECT_EVENTS permission");
- case InputManager.INPUT_EVENT_INJECTION_SUCCEEDED:
+ case InputManagerService.INPUT_EVENT_INJECTION_SUCCEEDED:
return true;
- case InputManager.INPUT_EVENT_INJECTION_TIMED_OUT:
+ case InputManagerService.INPUT_EVENT_INJECTION_TIMED_OUT:
Slog.w(TAG, "Input event injection from pid " + pid + " timed out.");
return false;
- case InputManager.INPUT_EVENT_INJECTION_FAILED:
+ case InputManagerService.INPUT_EVENT_INJECTION_FAILED:
default:
Slog.w(TAG, "Input event injection from pid " + pid + " failed.");
return false;
@@ -9192,11 +9198,6 @@ public class WindowManagerService extends IWindowManager.Stub
mPolicy.lockNow();
}
- void dumpInput(FileDescriptor fd, PrintWriter pw, boolean dumpAll) {
- pw.println("WINDOW MANAGER INPUT (dumpsys window input)");
- mInputManager.dump(pw);
- }
-
void dumpPolicyLocked(FileDescriptor fd, PrintWriter pw, String[] args, boolean dumpAll) {
pw.println("WINDOW MANAGER POLICY STATE (dumpsys window policy)");
mPolicy.dump(" ", fd, pw, args);
@@ -9592,7 +9593,6 @@ public class WindowManagerService extends IWindowManager.Stub
pw.println("Window manager dump options:");
pw.println(" [-a] [-h] [cmd] ...");
pw.println(" cmd may be one of:");
- pw.println(" i[input]: input subsystem state");
pw.println(" p[policy]: policy state");
pw.println(" s[essions]: active sessions");
pw.println(" t[okens]: token list");
@@ -9613,10 +9613,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (opti < args.length) {
String cmd = args[opti];
opti++;
- if ("input".equals(cmd) || "i".equals(cmd)) {
- dumpInput(fd, pw, true);
- return;
- } else if ("policy".equals(cmd) || "p".equals(cmd)) {
+ if ("policy".equals(cmd) || "p".equals(cmd)) {
synchronized(mWindowMap) {
dumpPolicyLocked(fd, pw, args, true);
}
@@ -9651,8 +9648,6 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
- dumpInput(fd, pw, dumpAll);
-
synchronized(mWindowMap) {
if (dumpAll) {
pw.println("-------------------------------------------------------------------------------");
diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java
index b74aa61..d65b947 100644
--- a/services/java/com/android/server/wm/WindowState.java
+++ b/services/java/com/android/server/wm/WindowState.java
@@ -23,6 +23,8 @@ import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
+import com.android.server.input.InputWindowHandle;
+
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Matrix;
diff --git a/services/jni/Android.mk b/services/jni/Android.mk
index c02dd36..ac4fd15 100644
--- a/services/jni/Android.mk
+++ b/services/jni/Android.mk
@@ -4,9 +4,9 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
com_android_server_AlarmManagerService.cpp \
com_android_server_BatteryService.cpp \
- com_android_server_InputApplicationHandle.cpp \
- com_android_server_InputManager.cpp \
- com_android_server_InputWindowHandle.cpp \
+ com_android_server_input_InputApplicationHandle.cpp \
+ com_android_server_input_InputManagerService.cpp \
+ com_android_server_input_InputWindowHandle.cpp \
com_android_server_LightsService.cpp \
com_android_server_PowerManagerService.cpp \
com_android_server_SerialService.cpp \
diff --git a/services/jni/com_android_server_InputApplicationHandle.cpp b/services/jni/com_android_server_input_InputApplicationHandle.cpp
index c76ab53..0109430 100644
--- a/services/jni/com_android_server_InputApplicationHandle.cpp
+++ b/services/jni/com_android_server_input_InputApplicationHandle.cpp
@@ -21,7 +21,7 @@
#include <android_runtime/AndroidRuntime.h>
#include <utils/threads.h>
-#include "com_android_server_InputApplicationHandle.h"
+#include "com_android_server_input_InputApplicationHandle.h"
namespace android {
@@ -135,12 +135,12 @@ static JNINativeMethod gInputApplicationHandleMethods[] = {
LOG_FATAL_IF(! var, "Unable to find field " fieldName);
int register_android_server_InputApplicationHandle(JNIEnv* env) {
- int res = jniRegisterNativeMethods(env, "com/android/server/wm/InputApplicationHandle",
+ int res = jniRegisterNativeMethods(env, "com/android/server/input/InputApplicationHandle",
gInputApplicationHandleMethods, NELEM(gInputApplicationHandleMethods));
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
jclass clazz;
- FIND_CLASS(clazz, "com/android/server/wm/InputApplicationHandle");
+ FIND_CLASS(clazz, "com/android/server/input/InputApplicationHandle");
GET_FIELD_ID(gInputApplicationHandleClassInfo.ptr, clazz,
"ptr", "I");
diff --git a/services/jni/com_android_server_InputApplicationHandle.h b/services/jni/com_android_server_input_InputApplicationHandle.h
index 89d48c6..89d48c6 100644
--- a/services/jni/com_android_server_InputApplicationHandle.h
+++ b/services/jni/com_android_server_input_InputApplicationHandle.h
diff --git a/services/jni/com_android_server_InputManager.cpp b/services/jni/com_android_server_input_InputManagerService.cpp
index 5c3e002..22795bf 100644
--- a/services/jni/com_android_server_InputManager.cpp
+++ b/services/jni/com_android_server_input_InputManagerService.cpp
@@ -46,8 +46,8 @@
#include <android/graphics/GraphicsJNI.h>
#include "com_android_server_PowerManagerService.h"
-#include "com_android_server_InputApplicationHandle.h"
-#include "com_android_server_InputWindowHandle.h"
+#include "com_android_server_input_InputApplicationHandle.h"
+#include "com_android_server_input_InputWindowHandle.h"
namespace android {
@@ -77,7 +77,7 @@ static struct {
jmethodID getLongPressTimeout;
jmethodID getPointerLayer;
jmethodID getPointerIcon;
-} gCallbacksClassInfo;
+} gServiceClassInfo;
static struct {
jclass clazz;
@@ -166,7 +166,7 @@ protected:
virtual ~NativeInputManager();
public:
- NativeInputManager(jobject contextObj, jobject callbacksObj, const sp<Looper>& looper);
+ NativeInputManager(jobject contextObj, jobject serviceObj, const sp<Looper>& looper);
inline sp<InputManager> getInputManager() const { return mInputManager; }
@@ -222,7 +222,7 @@ private:
sp<InputManager> mInputManager;
jobject mContextObj;
- jobject mCallbacksObj;
+ jobject mServiceObj;
sp<Looper> mLooper;
Mutex mLock;
@@ -269,12 +269,12 @@ private:
NativeInputManager::NativeInputManager(jobject contextObj,
- jobject callbacksObj, const sp<Looper>& looper) :
+ jobject serviceObj, const sp<Looper>& looper) :
mLooper(looper) {
JNIEnv* env = jniEnv();
mContextObj = env->NewGlobalRef(contextObj);
- mCallbacksObj = env->NewGlobalRef(callbacksObj);
+ mServiceObj = env->NewGlobalRef(serviceObj);
{
AutoMutex _l(mLock);
@@ -298,7 +298,7 @@ NativeInputManager::~NativeInputManager() {
JNIEnv* env = jniEnv();
env->DeleteGlobalRef(mContextObj);
- env->DeleteGlobalRef(mCallbacksObj);
+ env->DeleteGlobalRef(mServiceObj);
}
void NativeInputManager::dump(String8& dump) {
@@ -387,15 +387,15 @@ status_t NativeInputManager::unregisterInputChannel(JNIEnv* env,
void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outConfig) {
JNIEnv* env = jniEnv();
- jint virtualKeyQuietTime = env->CallIntMethod(mCallbacksObj,
- gCallbacksClassInfo.getVirtualKeyQuietTimeMillis);
+ jint virtualKeyQuietTime = env->CallIntMethod(mServiceObj,
+ gServiceClassInfo.getVirtualKeyQuietTimeMillis);
if (!checkAndClearExceptionFromCallback(env, "getVirtualKeyQuietTimeMillis")) {
outConfig->virtualKeyQuietTime = milliseconds_to_nanoseconds(virtualKeyQuietTime);
}
outConfig->excludedDeviceNames.clear();
- jobjectArray excludedDeviceNames = jobjectArray(env->CallObjectMethod(mCallbacksObj,
- gCallbacksClassInfo.getExcludedDeviceNames));
+ jobjectArray excludedDeviceNames = jobjectArray(env->CallObjectMethod(mServiceObj,
+ gServiceClassInfo.getExcludedDeviceNames));
if (!checkAndClearExceptionFromCallback(env, "getExcludedDeviceNames") && excludedDeviceNames) {
jsize length = env->GetArrayLength(excludedDeviceNames);
for (jsize i = 0; i < length; i++) {
@@ -408,14 +408,14 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon
env->DeleteLocalRef(excludedDeviceNames);
}
- jint hoverTapTimeout = env->CallIntMethod(mCallbacksObj,
- gCallbacksClassInfo.getHoverTapTimeout);
+ jint hoverTapTimeout = env->CallIntMethod(mServiceObj,
+ gServiceClassInfo.getHoverTapTimeout);
if (!checkAndClearExceptionFromCallback(env, "getHoverTapTimeout")) {
- jint doubleTapTimeout = env->CallIntMethod(mCallbacksObj,
- gCallbacksClassInfo.getDoubleTapTimeout);
+ jint doubleTapTimeout = env->CallIntMethod(mServiceObj,
+ gServiceClassInfo.getDoubleTapTimeout);
if (!checkAndClearExceptionFromCallback(env, "getDoubleTapTimeout")) {
- jint longPressTimeout = env->CallIntMethod(mCallbacksObj,
- gCallbacksClassInfo.getLongPressTimeout);
+ jint longPressTimeout = env->CallIntMethod(mServiceObj,
+ gServiceClassInfo.getLongPressTimeout);
if (!checkAndClearExceptionFromCallback(env, "getLongPressTimeout")) {
outConfig->pointerGestureTapInterval = milliseconds_to_nanoseconds(hoverTapTimeout);
@@ -430,8 +430,8 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon
}
}
- jint hoverTapSlop = env->CallIntMethod(mCallbacksObj,
- gCallbacksClassInfo.getHoverTapSlop);
+ jint hoverTapSlop = env->CallIntMethod(mServiceObj,
+ gServiceClassInfo.getHoverTapSlop);
if (!checkAndClearExceptionFromCallback(env, "getHoverTapSlop")) {
outConfig->pointerGestureTapSlop = hoverTapSlop;
}
@@ -467,8 +467,8 @@ sp<PointerControllerInterface> NativeInputManager::obtainPointerController(int32
controller->setDisplayOrientation(mLocked.displayOrientation);
JNIEnv* env = jniEnv();
- jobject pointerIconObj = env->CallObjectMethod(mCallbacksObj,
- gCallbacksClassInfo.getPointerIcon);
+ jobject pointerIconObj = env->CallObjectMethod(mServiceObj,
+ gServiceClassInfo.getPointerIcon);
if (!checkAndClearExceptionFromCallback(env, "getPointerIcon")) {
PointerIcon pointerIcon;
status_t status = android_view_PointerIcon_load(env, pointerIconObj,
@@ -490,7 +490,7 @@ sp<PointerControllerInterface> NativeInputManager::obtainPointerController(int32
void NativeInputManager::ensureSpriteControllerLocked() {
if (mLocked.spriteController == NULL) {
JNIEnv* env = jniEnv();
- jint layer = env->CallIntMethod(mCallbacksObj, gCallbacksClassInfo.getPointerLayer);
+ jint layer = env->CallIntMethod(mServiceObj, gServiceClassInfo.getPointerLayer);
if (checkAndClearExceptionFromCallback(env, "getPointerLayer")) {
layer = -1;
}
@@ -509,7 +509,7 @@ void NativeInputManager::notifySwitch(nsecs_t when, int32_t switchCode,
switch (switchCode) {
case SW_LID:
- env->CallVoidMethod(mCallbacksObj, gCallbacksClassInfo.notifyLidSwitchChanged,
+ env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyLidSwitchChanged,
when, switchValue == 0);
checkAndClearExceptionFromCallback(env, "notifyLidSwitchChanged");
break;
@@ -523,7 +523,7 @@ void NativeInputManager::notifyConfigurationChanged(nsecs_t when) {
JNIEnv* env = jniEnv();
- env->CallVoidMethod(mCallbacksObj, gCallbacksClassInfo.notifyConfigurationChanged, when);
+ env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyConfigurationChanged, when);
checkAndClearExceptionFromCallback(env, "notifyConfigurationChanged");
}
@@ -540,8 +540,8 @@ nsecs_t NativeInputManager::notifyANR(const sp<InputApplicationHandle>& inputApp
jobject inputWindowHandleObj =
getInputWindowHandleObjLocalRef(env, inputWindowHandle);
- jlong newTimeout = env->CallLongMethod(mCallbacksObj,
- gCallbacksClassInfo.notifyANR, inputApplicationHandleObj, inputWindowHandleObj);
+ jlong newTimeout = env->CallLongMethod(mServiceObj,
+ gServiceClassInfo.notifyANR, inputApplicationHandleObj, inputWindowHandleObj);
if (checkAndClearExceptionFromCallback(env, "notifyANR")) {
newTimeout = 0; // abort dispatch
} else {
@@ -563,7 +563,7 @@ void NativeInputManager::notifyInputChannelBroken(const sp<InputWindowHandle>& i
jobject inputWindowHandleObj =
getInputWindowHandleObjLocalRef(env, inputWindowHandle);
if (inputWindowHandleObj) {
- env->CallVoidMethod(mCallbacksObj, gCallbacksClassInfo.notifyInputChannelBroken,
+ env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyInputChannelBroken,
inputWindowHandleObj);
checkAndClearExceptionFromCallback(env, "notifyInputChannelBroken");
@@ -574,14 +574,14 @@ void NativeInputManager::notifyInputChannelBroken(const sp<InputWindowHandle>& i
void NativeInputManager::getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) {
JNIEnv* env = jniEnv();
- jint keyRepeatTimeout = env->CallIntMethod(mCallbacksObj,
- gCallbacksClassInfo.getKeyRepeatTimeout);
+ jint keyRepeatTimeout = env->CallIntMethod(mServiceObj,
+ gServiceClassInfo.getKeyRepeatTimeout);
if (!checkAndClearExceptionFromCallback(env, "getKeyRepeatTimeout")) {
outConfig->keyRepeatTimeout = milliseconds_to_nanoseconds(keyRepeatTimeout);
}
- jint keyRepeatDelay = env->CallIntMethod(mCallbacksObj,
- gCallbacksClassInfo.getKeyRepeatDelay);
+ jint keyRepeatDelay = env->CallIntMethod(mServiceObj,
+ gServiceClassInfo.getKeyRepeatDelay);
if (!checkAndClearExceptionFromCallback(env, "getKeyRepeatDelay")) {
outConfig->keyRepeatDelay = milliseconds_to_nanoseconds(keyRepeatDelay);
}
@@ -734,7 +734,7 @@ bool NativeInputManager::filterInputEvent(const InputEvent* inputEvent, uint32_t
}
// The callee is responsible for recycling the event.
- jboolean pass = env->CallBooleanMethod(mCallbacksObj, gCallbacksClassInfo.filterInputEvent,
+ jboolean pass = env->CallBooleanMethod(mServiceObj, gServiceClassInfo.filterInputEvent,
inputEventObj, policyFlags);
if (checkAndClearExceptionFromCallback(env, "filterInputEvent")) {
pass = true;
@@ -758,8 +758,8 @@ void NativeInputManager::interceptKeyBeforeQueueing(const KeyEvent* keyEvent,
jobject keyEventObj = android_view_KeyEvent_fromNative(env, keyEvent);
jint wmActions;
if (keyEventObj) {
- wmActions = env->CallIntMethod(mCallbacksObj,
- gCallbacksClassInfo.interceptKeyBeforeQueueing,
+ wmActions = env->CallIntMethod(mServiceObj,
+ gServiceClassInfo.interceptKeyBeforeQueueing,
keyEventObj, policyFlags, isScreenOn);
if (checkAndClearExceptionFromCallback(env, "interceptKeyBeforeQueueing")) {
wmActions = 0;
@@ -802,8 +802,8 @@ void NativeInputManager::interceptMotionBeforeQueueing(nsecs_t when, uint32_t& p
}
} else {
JNIEnv* env = jniEnv();
- jint wmActions = env->CallIntMethod(mCallbacksObj,
- gCallbacksClassInfo.interceptMotionBeforeQueueingWhenScreenOff,
+ jint wmActions = env->CallIntMethod(mServiceObj,
+ gServiceClassInfo.interceptMotionBeforeQueueingWhenScreenOff,
policyFlags);
if (checkAndClearExceptionFromCallback(env,
"interceptMotionBeforeQueueingWhenScreenOff")) {
@@ -858,8 +858,8 @@ nsecs_t NativeInputManager::interceptKeyBeforeDispatching(
jobject inputWindowHandleObj = getInputWindowHandleObjLocalRef(env, inputWindowHandle);
jobject keyEventObj = android_view_KeyEvent_fromNative(env, keyEvent);
if (keyEventObj) {
- jlong delayMillis = env->CallLongMethod(mCallbacksObj,
- gCallbacksClassInfo.interceptKeyBeforeDispatching,
+ jlong delayMillis = env->CallLongMethod(mServiceObj,
+ gServiceClassInfo.interceptKeyBeforeDispatching,
inputWindowHandleObj, keyEventObj, policyFlags);
bool error = checkAndClearExceptionFromCallback(env, "interceptKeyBeforeDispatching");
android_view_KeyEvent_recycle(env, keyEventObj);
@@ -891,8 +891,8 @@ bool NativeInputManager::dispatchUnhandledKey(const sp<InputWindowHandle>& input
jobject inputWindowHandleObj = getInputWindowHandleObjLocalRef(env, inputWindowHandle);
jobject keyEventObj = android_view_KeyEvent_fromNative(env, keyEvent);
if (keyEventObj) {
- jobject fallbackKeyEventObj = env->CallObjectMethod(mCallbacksObj,
- gCallbacksClassInfo.dispatchUnhandledKey,
+ jobject fallbackKeyEventObj = env->CallObjectMethod(mServiceObj,
+ gServiceClassInfo.dispatchUnhandledKey,
inputWindowHandleObj, keyEventObj, policyFlags);
if (checkAndClearExceptionFromCallback(env, "dispatchUnhandledKey")) {
fallbackKeyEventObj = NULL;
@@ -925,8 +925,8 @@ void NativeInputManager::pokeUserActivity(nsecs_t eventTime, int32_t eventType)
bool NativeInputManager::checkInjectEventsPermissionNonReentrant(
int32_t injectorPid, int32_t injectorUid) {
JNIEnv* env = jniEnv();
- jboolean result = env->CallBooleanMethod(mCallbacksObj,
- gCallbacksClassInfo.checkInjectEventsPermission, injectorPid, injectorUid);
+ jboolean result = env->CallBooleanMethod(mServiceObj,
+ gServiceClassInfo.checkInjectEventsPermission, injectorPid, injectorUid);
if (checkAndClearExceptionFromCallback(env, "checkInjectEventsPermission")) {
result = false;
}
@@ -947,103 +947,75 @@ void NativeInputManager::loadPointerResources(PointerResources* outResources) {
// ----------------------------------------------------------------------------
-static sp<NativeInputManager> gNativeInputManager;
-
-static bool checkInputManagerUnitialized(JNIEnv* env) {
- if (gNativeInputManager == NULL) {
- ALOGE("Input manager not initialized.");
- jniThrowRuntimeException(env, "Input manager not initialized.");
- return true;
- }
- return false;
-}
-
-static void android_server_InputManager_nativeInit(JNIEnv* env, jclass clazz,
- jobject contextObj, jobject callbacksObj, jobject messageQueueObj) {
- if (gNativeInputManager == NULL) {
- sp<Looper> looper = android_os_MessageQueue_getLooper(env, messageQueueObj);
- gNativeInputManager = new NativeInputManager(contextObj, callbacksObj, looper);
- } else {
- ALOGE("Input manager already initialized.");
- jniThrowRuntimeException(env, "Input manager already initialized.");
- }
+static jint nativeInit(JNIEnv* env, jclass clazz,
+ jobject serviceObj, jobject contextObj, jobject messageQueueObj) {
+ sp<Looper> looper = android_os_MessageQueue_getLooper(env, messageQueueObj);
+ NativeInputManager* im = new NativeInputManager(contextObj, serviceObj, looper);
+ im->incStrong(serviceObj);
+ return reinterpret_cast<jint>(im);
}
-static void android_server_InputManager_nativeStart(JNIEnv* env, jclass clazz) {
- if (checkInputManagerUnitialized(env)) {
- return;
- }
+static void nativeStart(JNIEnv* env, jclass clazz, jint ptr) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- status_t result = gNativeInputManager->getInputManager()->start();
+ status_t result = im->getInputManager()->start();
if (result) {
jniThrowRuntimeException(env, "Input manager could not be started.");
}
}
-static void android_server_InputManager_nativeSetDisplaySize(JNIEnv* env, jclass clazz,
+static void nativeSetDisplaySize(JNIEnv* env, jclass clazz, jint ptr,
jint displayId, jint width, jint height, jint externalWidth, jint externalHeight) {
- if (checkInputManagerUnitialized(env)) {
- return;
- }
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
// XXX we could get this from the SurfaceFlinger directly instead of requiring it
// to be passed in like this, not sure which is better but leaving it like this
// keeps the window manager in direct control of when display transitions propagate down
// to the input dispatcher
- gNativeInputManager->setDisplaySize(displayId, width, height, externalWidth, externalHeight);
+ im->setDisplaySize(displayId, width, height, externalWidth, externalHeight);
}
-static void android_server_InputManager_nativeSetDisplayOrientation(JNIEnv* env, jclass clazz,
- jint displayId, jint orientation) {
- if (checkInputManagerUnitialized(env)) {
- return;
- }
+static void nativeSetDisplayOrientation(JNIEnv* env, jclass clazz,
+ jint ptr, jint displayId, jint orientation) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- gNativeInputManager->setDisplayOrientation(displayId, orientation);
+ im->setDisplayOrientation(displayId, orientation);
}
-static jint android_server_InputManager_nativeGetScanCodeState(JNIEnv* env, jclass clazz,
- jint deviceId, jint sourceMask, jint scanCode) {
- if (checkInputManagerUnitialized(env)) {
- return AKEY_STATE_UNKNOWN;
- }
+static jint nativeGetScanCodeState(JNIEnv* env, jclass clazz,
+ jint ptr, jint deviceId, jint sourceMask, jint scanCode) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- return gNativeInputManager->getInputManager()->getReader()->getScanCodeState(
+ return im->getInputManager()->getReader()->getScanCodeState(
deviceId, uint32_t(sourceMask), scanCode);
}
-static jint android_server_InputManager_nativeGetKeyCodeState(JNIEnv* env, jclass clazz,
- jint deviceId, jint sourceMask, jint keyCode) {
- if (checkInputManagerUnitialized(env)) {
- return AKEY_STATE_UNKNOWN;
- }
+static jint nativeGetKeyCodeState(JNIEnv* env, jclass clazz,
+ jint ptr, jint deviceId, jint sourceMask, jint keyCode) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- return gNativeInputManager->getInputManager()->getReader()->getKeyCodeState(
+ return im->getInputManager()->getReader()->getKeyCodeState(
deviceId, uint32_t(sourceMask), keyCode);
}
-static jint android_server_InputManager_nativeGetSwitchState(JNIEnv* env, jclass clazz,
- jint deviceId, jint sourceMask, jint sw) {
- if (checkInputManagerUnitialized(env)) {
- return AKEY_STATE_UNKNOWN;
- }
+static jint nativeGetSwitchState(JNIEnv* env, jclass clazz,
+ jint ptr, jint deviceId, jint sourceMask, jint sw) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- return gNativeInputManager->getInputManager()->getReader()->getSwitchState(
+ return im->getInputManager()->getReader()->getSwitchState(
deviceId, uint32_t(sourceMask), sw);
}
-static jboolean android_server_InputManager_nativeHasKeys(JNIEnv* env, jclass clazz,
- jint deviceId, jint sourceMask, jintArray keyCodes, jbooleanArray outFlags) {
- if (checkInputManagerUnitialized(env)) {
- return JNI_FALSE;
- }
+static jboolean nativeHasKeys(JNIEnv* env, jclass clazz,
+ jint ptr, jint deviceId, jint sourceMask, jintArray keyCodes, jbooleanArray outFlags) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
int32_t* codes = env->GetIntArrayElements(keyCodes, NULL);
uint8_t* flags = env->GetBooleanArrayElements(outFlags, NULL);
jsize numCodes = env->GetArrayLength(keyCodes);
jboolean result;
if (numCodes == env->GetArrayLength(keyCodes)) {
- result = gNativeInputManager->getInputManager()->getReader()->hasKeys(
+ result = im->getInputManager()->getReader()->hasKeys(
deviceId, uint32_t(sourceMask), numCodes, codes, flags);
} else {
result = JNI_FALSE;
@@ -1059,21 +1031,18 @@ static void throwInputChannelNotInitialized(JNIEnv* env) {
"inputChannel is not initialized");
}
-static void android_server_InputManager_handleInputChannelDisposed(JNIEnv* env,
+static void handleInputChannelDisposed(JNIEnv* env,
jobject inputChannelObj, const sp<InputChannel>& inputChannel, void* data) {
+ NativeInputManager* im = static_cast<NativeInputManager*>(data);
+
ALOGW("Input channel object '%s' was disposed without first being unregistered with "
"the input manager!", inputChannel->getName().string());
-
- if (gNativeInputManager != NULL) {
- gNativeInputManager->unregisterInputChannel(env, inputChannel);
- }
+ im->unregisterInputChannel(env, inputChannel);
}
-static void android_server_InputManager_nativeRegisterInputChannel(JNIEnv* env, jclass clazz,
- jobject inputChannelObj, jobject inputWindowHandleObj, jboolean monitor) {
- if (checkInputManagerUnitialized(env)) {
- return;
- }
+static void nativeRegisterInputChannel(JNIEnv* env, jclass clazz,
+ jint ptr, jobject inputChannelObj, jobject inputWindowHandleObj, jboolean monitor) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
sp<InputChannel> inputChannel = android_view_InputChannel_getInputChannel(env,
inputChannelObj);
@@ -1085,7 +1054,7 @@ static void android_server_InputManager_nativeRegisterInputChannel(JNIEnv* env,
sp<InputWindowHandle> inputWindowHandle =
android_server_InputWindowHandle_getHandle(env, inputWindowHandleObj);
- status_t status = gNativeInputManager->registerInputChannel(
+ status_t status = im->registerInputChannel(
env, inputChannel, inputWindowHandle, monitor);
if (status) {
String8 message;
@@ -1096,15 +1065,13 @@ static void android_server_InputManager_nativeRegisterInputChannel(JNIEnv* env,
if (! monitor) {
android_view_InputChannel_setDisposeCallback(env, inputChannelObj,
- android_server_InputManager_handleInputChannelDisposed, NULL);
+ handleInputChannelDisposed, im);
}
}
-static void android_server_InputManager_nativeUnregisterInputChannel(JNIEnv* env, jclass clazz,
- jobject inputChannelObj) {
- if (checkInputManagerUnitialized(env)) {
- return;
- }
+static void nativeUnregisterInputChannel(JNIEnv* env, jclass clazz,
+ jint ptr, jobject inputChannelObj) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
sp<InputChannel> inputChannel = android_view_InputChannel_getInputChannel(env,
inputChannelObj);
@@ -1115,7 +1082,7 @@ static void android_server_InputManager_nativeUnregisterInputChannel(JNIEnv* env
android_view_InputChannel_setDisposeCallback(env, inputChannelObj, NULL, NULL);
- status_t status = gNativeInputManager->unregisterInputChannel(env, inputChannel);
+ status_t status = im->unregisterInputChannel(env, inputChannel);
if (status && status != BAD_VALUE) { // ignore already unregistered channel
String8 message;
message.appendFormat("Failed to unregister input channel. status=%d", status);
@@ -1123,21 +1090,17 @@ static void android_server_InputManager_nativeUnregisterInputChannel(JNIEnv* env
}
}
-static void android_server_InputManager_nativeSetInputFilterEnabled(JNIEnv* env, jclass clazz,
- jboolean enabled) {
- if (checkInputManagerUnitialized(env)) {
- return;
- }
+static void nativeSetInputFilterEnabled(JNIEnv* env, jclass clazz,
+ jint ptr, jboolean enabled) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- gNativeInputManager->getInputManager()->getDispatcher()->setInputFilterEnabled(enabled);
+ im->getInputManager()->getDispatcher()->setInputFilterEnabled(enabled);
}
-static jint android_server_InputManager_nativeInjectInputEvent(JNIEnv* env, jclass clazz,
- jobject inputEventObj, jint injectorPid, jint injectorUid,
+static jint nativeInjectInputEvent(JNIEnv* env, jclass clazz,
+ jint ptr, jobject inputEventObj, jint injectorPid, jint injectorUid,
jint syncMode, jint timeoutMillis, jint policyFlags) {
- if (checkInputManagerUnitialized(env)) {
- return INPUT_EVENT_INJECTION_FAILED;
- }
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
if (env->IsInstanceOf(inputEventObj, gKeyEventClassInfo.clazz)) {
KeyEvent keyEvent;
@@ -1147,7 +1110,7 @@ static jint android_server_InputManager_nativeInjectInputEvent(JNIEnv* env, jcla
return INPUT_EVENT_INJECTION_FAILED;
}
- return gNativeInputManager->getInputManager()->getDispatcher()->injectInputEvent(
+ return im->getInputManager()->getDispatcher()->injectInputEvent(
& keyEvent, injectorPid, injectorUid, syncMode, timeoutMillis,
uint32_t(policyFlags));
} else if (env->IsInstanceOf(inputEventObj, gMotionEventClassInfo.clazz)) {
@@ -1157,7 +1120,7 @@ static jint android_server_InputManager_nativeInjectInputEvent(JNIEnv* env, jcla
return INPUT_EVENT_INJECTION_FAILED;
}
- return gNativeInputManager->getInputManager()->getDispatcher()->injectInputEvent(
+ return im->getInputManager()->getDispatcher()->injectInputEvent(
motionEvent, injectorPid, injectorUid, syncMode, timeoutMillis,
uint32_t(policyFlags));
} else {
@@ -1166,50 +1129,40 @@ static jint android_server_InputManager_nativeInjectInputEvent(JNIEnv* env, jcla
}
}
-static void android_server_InputManager_nativeSetInputWindows(JNIEnv* env, jclass clazz,
- jobjectArray windowHandleObjArray) {
- if (checkInputManagerUnitialized(env)) {
- return;
- }
+static void nativeSetInputWindows(JNIEnv* env, jclass clazz,
+ jint ptr, jobjectArray windowHandleObjArray) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- gNativeInputManager->setInputWindows(env, windowHandleObjArray);
+ im->setInputWindows(env, windowHandleObjArray);
}
-static void android_server_InputManager_nativeSetFocusedApplication(JNIEnv* env, jclass clazz,
- jobject applicationHandleObj) {
- if (checkInputManagerUnitialized(env)) {
- return;
- }
+static void nativeSetFocusedApplication(JNIEnv* env, jclass clazz,
+ jint ptr, jobject applicationHandleObj) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- gNativeInputManager->setFocusedApplication(env, applicationHandleObj);
+ im->setFocusedApplication(env, applicationHandleObj);
}
-static void android_server_InputManager_nativeSetInputDispatchMode(JNIEnv* env,
- jclass clazz, jboolean enabled, jboolean frozen) {
- if (checkInputManagerUnitialized(env)) {
- return;
- }
+static void nativeSetInputDispatchMode(JNIEnv* env,
+ jclass clazz, jint ptr, jboolean enabled, jboolean frozen) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- gNativeInputManager->setInputDispatchMode(enabled, frozen);
+ im->setInputDispatchMode(enabled, frozen);
}
-static void android_server_InputManager_nativeSetSystemUiVisibility(JNIEnv* env,
- jclass clazz, jint visibility) {
- if (checkInputManagerUnitialized(env)) {
- return;
- }
+static void nativeSetSystemUiVisibility(JNIEnv* env,
+ jclass clazz, jint ptr, jint visibility) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- gNativeInputManager->setSystemUiVisibility(visibility);
+ im->setSystemUiVisibility(visibility);
}
-static jobject android_server_InputManager_nativeGetInputDevice(JNIEnv* env,
- jclass clazz, jint deviceId) {
- if (checkInputManagerUnitialized(env)) {
- return NULL;
- }
+static jobject nativeGetInputDevice(JNIEnv* env,
+ jclass clazz, jint ptr, jint deviceId) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
InputDeviceInfo deviceInfo;
- status_t status = gNativeInputManager->getInputManager()->getReader()->getInputDeviceInfo(
+ status_t status = im->getInputManager()->getReader()->getInputDeviceInfo(
deviceId, & deviceInfo);
if (status) {
return NULL;
@@ -1249,14 +1202,12 @@ static jobject android_server_InputManager_nativeGetInputDevice(JNIEnv* env,
return deviceObj;
}
-static jintArray android_server_InputManager_nativeGetInputDeviceIds(JNIEnv* env,
- jclass clazz) {
- if (checkInputManagerUnitialized(env)) {
- return NULL;
- }
+static jintArray nativeGetInputDeviceIds(JNIEnv* env,
+ jclass clazz, jint ptr) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
Vector<int> deviceIds;
- gNativeInputManager->getInputManager()->getReader()->getInputDeviceIds(deviceIds);
+ im->getInputManager()->getReader()->getInputDeviceIds(deviceIds);
jintArray deviceIdsObj = env->NewIntArray(deviceIds.size());
if (! deviceIdsObj) {
@@ -1267,25 +1218,21 @@ static jintArray android_server_InputManager_nativeGetInputDeviceIds(JNIEnv* env
return deviceIdsObj;
}
-static void android_server_InputManager_nativeGetInputConfiguration(JNIEnv* env,
- jclass clazz, jobject configObj) {
- if (checkInputManagerUnitialized(env)) {
- return;
- }
+static void nativeGetInputConfiguration(JNIEnv* env,
+ jclass clazz, jint ptr, jobject configObj) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
InputConfiguration config;
- gNativeInputManager->getInputManager()->getReader()->getInputConfiguration(& config);
+ im->getInputManager()->getReader()->getInputConfiguration(& config);
env->SetIntField(configObj, gConfigurationClassInfo.touchscreen, config.touchScreen);
env->SetIntField(configObj, gConfigurationClassInfo.keyboard, config.keyboard);
env->SetIntField(configObj, gConfigurationClassInfo.navigation, config.navigation);
}
-static jboolean android_server_InputManager_nativeTransferTouchFocus(JNIEnv* env,
- jclass clazz, jobject fromChannelObj, jobject toChannelObj) {
- if (checkInputManagerUnitialized(env)) {
- return false;
- }
+static jboolean nativeTransferTouchFocus(JNIEnv* env,
+ jclass clazz, jint ptr, jobject fromChannelObj, jobject toChannelObj) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
sp<InputChannel> fromChannel =
android_view_InputChannel_getInputChannel(env, fromChannelObj);
@@ -1296,101 +1243,93 @@ static jboolean android_server_InputManager_nativeTransferTouchFocus(JNIEnv* env
return false;
}
- return gNativeInputManager->getInputManager()->getDispatcher()->
+ return im->getInputManager()->getDispatcher()->
transferTouchFocus(fromChannel, toChannel);
}
-static void android_server_InputManager_nativeSetPointerSpeed(JNIEnv* env,
- jclass clazz, jint speed) {
- if (checkInputManagerUnitialized(env)) {
- return;
- }
+static void nativeSetPointerSpeed(JNIEnv* env,
+ jclass clazz, jint ptr, jint speed) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- gNativeInputManager->setPointerSpeed(speed);
+ im->setPointerSpeed(speed);
}
-static void android_server_InputManager_nativeSetShowTouches(JNIEnv* env,
- jclass clazz, jboolean enabled) {
- if (checkInputManagerUnitialized(env)) {
- return;
- }
+static void nativeSetShowTouches(JNIEnv* env,
+ jclass clazz, jint ptr, jboolean enabled) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- gNativeInputManager->setShowTouches(enabled);
+ im->setShowTouches(enabled);
}
-static jstring android_server_InputManager_nativeDump(JNIEnv* env, jclass clazz) {
- if (checkInputManagerUnitialized(env)) {
- return NULL;
- }
+static jstring nativeDump(JNIEnv* env, jclass clazz, jint ptr) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
String8 dump;
- gNativeInputManager->dump(dump);
+ im->dump(dump);
return env->NewStringUTF(dump.string());
}
-static void android_server_InputManager_nativeMonitor(JNIEnv* env, jclass clazz) {
- if (checkInputManagerUnitialized(env)) {
- return;
- }
+static void nativeMonitor(JNIEnv* env, jclass clazz, jint ptr) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- gNativeInputManager->getInputManager()->getReader()->monitor();
- gNativeInputManager->getInputManager()->getDispatcher()->monitor();
+ im->getInputManager()->getReader()->monitor();
+ im->getInputManager()->getDispatcher()->monitor();
}
// ----------------------------------------------------------------------------
static JNINativeMethod gInputManagerMethods[] = {
/* name, signature, funcPtr */
- { "nativeInit", "(Landroid/content/Context;"
- "Lcom/android/server/wm/InputManager$Callbacks;Landroid/os/MessageQueue;)V",
- (void*) android_server_InputManager_nativeInit },
- { "nativeStart", "()V",
- (void*) android_server_InputManager_nativeStart },
- { "nativeSetDisplaySize", "(IIIII)V",
- (void*) android_server_InputManager_nativeSetDisplaySize },
- { "nativeSetDisplayOrientation", "(II)V",
- (void*) android_server_InputManager_nativeSetDisplayOrientation },
- { "nativeGetScanCodeState", "(III)I",
- (void*) android_server_InputManager_nativeGetScanCodeState },
- { "nativeGetKeyCodeState", "(III)I",
- (void*) android_server_InputManager_nativeGetKeyCodeState },
- { "nativeGetSwitchState", "(III)I",
- (void*) android_server_InputManager_nativeGetSwitchState },
- { "nativeHasKeys", "(II[I[Z)Z",
- (void*) android_server_InputManager_nativeHasKeys },
+ { "nativeInit",
+ "(Lcom/android/server/input/InputManagerService;Landroid/content/Context;Landroid/os/MessageQueue;)I",
+ (void*) nativeInit },
+ { "nativeStart", "(I)V",
+ (void*) nativeStart },
+ { "nativeSetDisplaySize", "(IIIIII)V",
+ (void*) nativeSetDisplaySize },
+ { "nativeSetDisplayOrientation", "(III)V",
+ (void*) nativeSetDisplayOrientation },
+ { "nativeGetScanCodeState", "(IIII)I",
+ (void*) nativeGetScanCodeState },
+ { "nativeGetKeyCodeState", "(IIII)I",
+ (void*) nativeGetKeyCodeState },
+ { "nativeGetSwitchState", "(IIII)I",
+ (void*) nativeGetSwitchState },
+ { "nativeHasKeys", "(III[I[Z)Z",
+ (void*) nativeHasKeys },
{ "nativeRegisterInputChannel",
- "(Landroid/view/InputChannel;Lcom/android/server/wm/InputWindowHandle;Z)V",
- (void*) android_server_InputManager_nativeRegisterInputChannel },
- { "nativeUnregisterInputChannel", "(Landroid/view/InputChannel;)V",
- (void*) android_server_InputManager_nativeUnregisterInputChannel },
- { "nativeSetInputFilterEnabled", "(Z)V",
- (void*) android_server_InputManager_nativeSetInputFilterEnabled },
- { "nativeInjectInputEvent", "(Landroid/view/InputEvent;IIIII)I",
- (void*) android_server_InputManager_nativeInjectInputEvent },
- { "nativeSetInputWindows", "([Lcom/android/server/wm/InputWindowHandle;)V",
- (void*) android_server_InputManager_nativeSetInputWindows },
- { "nativeSetFocusedApplication", "(Lcom/android/server/wm/InputApplicationHandle;)V",
- (void*) android_server_InputManager_nativeSetFocusedApplication },
- { "nativeSetInputDispatchMode", "(ZZ)V",
- (void*) android_server_InputManager_nativeSetInputDispatchMode },
- { "nativeSetSystemUiVisibility", "(I)V",
- (void*) android_server_InputManager_nativeSetSystemUiVisibility },
- { "nativeGetInputDevice", "(I)Landroid/view/InputDevice;",
- (void*) android_server_InputManager_nativeGetInputDevice },
- { "nativeGetInputDeviceIds", "()[I",
- (void*) android_server_InputManager_nativeGetInputDeviceIds },
- { "nativeGetInputConfiguration", "(Landroid/content/res/Configuration;)V",
- (void*) android_server_InputManager_nativeGetInputConfiguration },
- { "nativeTransferTouchFocus", "(Landroid/view/InputChannel;Landroid/view/InputChannel;)Z",
- (void*) android_server_InputManager_nativeTransferTouchFocus },
- { "nativeSetPointerSpeed", "(I)V",
- (void*) android_server_InputManager_nativeSetPointerSpeed },
- { "nativeSetShowTouches", "(Z)V",
- (void*) android_server_InputManager_nativeSetShowTouches },
- { "nativeDump", "()Ljava/lang/String;",
- (void*) android_server_InputManager_nativeDump },
- { "nativeMonitor", "()V",
- (void*) android_server_InputManager_nativeMonitor },
+ "(ILandroid/view/InputChannel;Lcom/android/server/input/InputWindowHandle;Z)V",
+ (void*) nativeRegisterInputChannel },
+ { "nativeUnregisterInputChannel", "(ILandroid/view/InputChannel;)V",
+ (void*) nativeUnregisterInputChannel },
+ { "nativeSetInputFilterEnabled", "(IZ)V",
+ (void*) nativeSetInputFilterEnabled },
+ { "nativeInjectInputEvent", "(ILandroid/view/InputEvent;IIIII)I",
+ (void*) nativeInjectInputEvent },
+ { "nativeSetInputWindows", "(I[Lcom/android/server/input/InputWindowHandle;)V",
+ (void*) nativeSetInputWindows },
+ { "nativeSetFocusedApplication", "(ILcom/android/server/input/InputApplicationHandle;)V",
+ (void*) nativeSetFocusedApplication },
+ { "nativeSetInputDispatchMode", "(IZZ)V",
+ (void*) nativeSetInputDispatchMode },
+ { "nativeSetSystemUiVisibility", "(II)V",
+ (void*) nativeSetSystemUiVisibility },
+ { "nativeGetInputDevice", "(II)Landroid/view/InputDevice;",
+ (void*) nativeGetInputDevice },
+ { "nativeGetInputDeviceIds", "(I)[I",
+ (void*) nativeGetInputDeviceIds },
+ { "nativeGetInputConfiguration", "(ILandroid/content/res/Configuration;)V",
+ (void*) nativeGetInputConfiguration },
+ { "nativeTransferTouchFocus", "(ILandroid/view/InputChannel;Landroid/view/InputChannel;)Z",
+ (void*) nativeTransferTouchFocus },
+ { "nativeSetPointerSpeed", "(II)V",
+ (void*) nativeSetPointerSpeed },
+ { "nativeSetShowTouches", "(IZ)V",
+ (void*) nativeSetShowTouches },
+ { "nativeDump", "(I)Ljava/lang/String;",
+ (void*) nativeDump },
+ { "nativeMonitor", "(I)V",
+ (void*) nativeMonitor },
};
#define FIND_CLASS(var, className) \
@@ -1406,77 +1345,77 @@ static JNINativeMethod gInputManagerMethods[] = {
LOG_FATAL_IF(! var, "Unable to find field " fieldName);
int register_android_server_InputManager(JNIEnv* env) {
- int res = jniRegisterNativeMethods(env, "com/android/server/wm/InputManager",
+ int res = jniRegisterNativeMethods(env, "com/android/server/input/InputManagerService",
gInputManagerMethods, NELEM(gInputManagerMethods));
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
// Callbacks
jclass clazz;
- FIND_CLASS(clazz, "com/android/server/wm/InputManager$Callbacks");
+ FIND_CLASS(clazz, "com/android/server/input/InputManagerService");
- GET_METHOD_ID(gCallbacksClassInfo.notifyConfigurationChanged, clazz,
+ GET_METHOD_ID(gServiceClassInfo.notifyConfigurationChanged, clazz,
"notifyConfigurationChanged", "(J)V");
- GET_METHOD_ID(gCallbacksClassInfo.notifyLidSwitchChanged, clazz,
+ GET_METHOD_ID(gServiceClassInfo.notifyLidSwitchChanged, clazz,
"notifyLidSwitchChanged", "(JZ)V");
- GET_METHOD_ID(gCallbacksClassInfo.notifyInputChannelBroken, clazz,
- "notifyInputChannelBroken", "(Lcom/android/server/wm/InputWindowHandle;)V");
+ GET_METHOD_ID(gServiceClassInfo.notifyInputChannelBroken, clazz,
+ "notifyInputChannelBroken", "(Lcom/android/server/input/InputWindowHandle;)V");
- GET_METHOD_ID(gCallbacksClassInfo.notifyANR, clazz,
+ GET_METHOD_ID(gServiceClassInfo.notifyANR, clazz,
"notifyANR",
- "(Lcom/android/server/wm/InputApplicationHandle;Lcom/android/server/wm/InputWindowHandle;)J");
+ "(Lcom/android/server/input/InputApplicationHandle;Lcom/android/server/input/InputWindowHandle;)J");
- GET_METHOD_ID(gCallbacksClassInfo.filterInputEvent, clazz,
+ GET_METHOD_ID(gServiceClassInfo.filterInputEvent, clazz,
"filterInputEvent", "(Landroid/view/InputEvent;I)Z");
- GET_METHOD_ID(gCallbacksClassInfo.interceptKeyBeforeQueueing, clazz,
+ GET_METHOD_ID(gServiceClassInfo.interceptKeyBeforeQueueing, clazz,
"interceptKeyBeforeQueueing", "(Landroid/view/KeyEvent;IZ)I");
- GET_METHOD_ID(gCallbacksClassInfo.interceptMotionBeforeQueueingWhenScreenOff,
+ GET_METHOD_ID(gServiceClassInfo.interceptMotionBeforeQueueingWhenScreenOff,
clazz,
"interceptMotionBeforeQueueingWhenScreenOff", "(I)I");
- GET_METHOD_ID(gCallbacksClassInfo.interceptKeyBeforeDispatching, clazz,
+ GET_METHOD_ID(gServiceClassInfo.interceptKeyBeforeDispatching, clazz,
"interceptKeyBeforeDispatching",
- "(Lcom/android/server/wm/InputWindowHandle;Landroid/view/KeyEvent;I)J");
+ "(Lcom/android/server/input/InputWindowHandle;Landroid/view/KeyEvent;I)J");
- GET_METHOD_ID(gCallbacksClassInfo.dispatchUnhandledKey, clazz,
+ GET_METHOD_ID(gServiceClassInfo.dispatchUnhandledKey, clazz,
"dispatchUnhandledKey",
- "(Lcom/android/server/wm/InputWindowHandle;Landroid/view/KeyEvent;I)Landroid/view/KeyEvent;");
+ "(Lcom/android/server/input/InputWindowHandle;Landroid/view/KeyEvent;I)Landroid/view/KeyEvent;");
- GET_METHOD_ID(gCallbacksClassInfo.checkInjectEventsPermission, clazz,
+ GET_METHOD_ID(gServiceClassInfo.checkInjectEventsPermission, clazz,
"checkInjectEventsPermission", "(II)Z");
- GET_METHOD_ID(gCallbacksClassInfo.getVirtualKeyQuietTimeMillis, clazz,
+ GET_METHOD_ID(gServiceClassInfo.getVirtualKeyQuietTimeMillis, clazz,
"getVirtualKeyQuietTimeMillis", "()I");
- GET_METHOD_ID(gCallbacksClassInfo.getExcludedDeviceNames, clazz,
+ GET_METHOD_ID(gServiceClassInfo.getExcludedDeviceNames, clazz,
"getExcludedDeviceNames", "()[Ljava/lang/String;");
- GET_METHOD_ID(gCallbacksClassInfo.getKeyRepeatTimeout, clazz,
+ GET_METHOD_ID(gServiceClassInfo.getKeyRepeatTimeout, clazz,
"getKeyRepeatTimeout", "()I");
- GET_METHOD_ID(gCallbacksClassInfo.getKeyRepeatDelay, clazz,
+ GET_METHOD_ID(gServiceClassInfo.getKeyRepeatDelay, clazz,
"getKeyRepeatDelay", "()I");
- GET_METHOD_ID(gCallbacksClassInfo.getHoverTapTimeout, clazz,
+ GET_METHOD_ID(gServiceClassInfo.getHoverTapTimeout, clazz,
"getHoverTapTimeout", "()I");
- GET_METHOD_ID(gCallbacksClassInfo.getHoverTapSlop, clazz,
+ GET_METHOD_ID(gServiceClassInfo.getHoverTapSlop, clazz,
"getHoverTapSlop", "()I");
- GET_METHOD_ID(gCallbacksClassInfo.getDoubleTapTimeout, clazz,
+ GET_METHOD_ID(gServiceClassInfo.getDoubleTapTimeout, clazz,
"getDoubleTapTimeout", "()I");
- GET_METHOD_ID(gCallbacksClassInfo.getLongPressTimeout, clazz,
+ GET_METHOD_ID(gServiceClassInfo.getLongPressTimeout, clazz,
"getLongPressTimeout", "()I");
- GET_METHOD_ID(gCallbacksClassInfo.getPointerLayer, clazz,
+ GET_METHOD_ID(gServiceClassInfo.getPointerLayer, clazz,
"getPointerLayer", "()I");
- GET_METHOD_ID(gCallbacksClassInfo.getPointerIcon, clazz,
+ GET_METHOD_ID(gServiceClassInfo.getPointerIcon, clazz,
"getPointerIcon", "()Landroid/view/PointerIcon;");
// KeyEvent
@@ -1484,7 +1423,6 @@ int register_android_server_InputManager(JNIEnv* env) {
FIND_CLASS(gKeyEventClassInfo.clazz, "android/view/KeyEvent");
gKeyEventClassInfo.clazz = jclass(env->NewGlobalRef(gKeyEventClassInfo.clazz));
-
// MotionEvent
FIND_CLASS(gMotionEventClassInfo.clazz, "android/view/MotionEvent");
diff --git a/services/jni/com_android_server_InputWindowHandle.cpp b/services/jni/com_android_server_input_InputWindowHandle.cpp
index 0607eee..01fb781 100644
--- a/services/jni/com_android_server_InputWindowHandle.cpp
+++ b/services/jni/com_android_server_input_InputWindowHandle.cpp
@@ -24,8 +24,8 @@
#include <android_view_InputChannel.h>
#include <android/graphics/Region.h>
-#include "com_android_server_InputWindowHandle.h"
-#include "com_android_server_InputApplicationHandle.h"
+#include "com_android_server_input_InputWindowHandle.h"
+#include "com_android_server_input_InputApplicationHandle.h"
namespace android {
@@ -218,19 +218,19 @@ static JNINativeMethod gInputWindowHandleMethods[] = {
LOG_FATAL_IF(! var, "Unable to find field " fieldName);
int register_android_server_InputWindowHandle(JNIEnv* env) {
- int res = jniRegisterNativeMethods(env, "com/android/server/wm/InputWindowHandle",
+ int res = jniRegisterNativeMethods(env, "com/android/server/input/InputWindowHandle",
gInputWindowHandleMethods, NELEM(gInputWindowHandleMethods));
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
jclass clazz;
- FIND_CLASS(clazz, "com/android/server/wm/InputWindowHandle");
+ FIND_CLASS(clazz, "com/android/server/input/InputWindowHandle");
GET_FIELD_ID(gInputWindowHandleClassInfo.ptr, clazz,
"ptr", "I");
GET_FIELD_ID(gInputWindowHandleClassInfo.inputApplicationHandle,
clazz,
- "inputApplicationHandle", "Lcom/android/server/wm/InputApplicationHandle;");
+ "inputApplicationHandle", "Lcom/android/server/input/InputApplicationHandle;");
GET_FIELD_ID(gInputWindowHandleClassInfo.inputChannel, clazz,
"inputChannel", "Landroid/view/InputChannel;");
diff --git a/services/jni/com_android_server_InputWindowHandle.h b/services/jni/com_android_server_input_InputWindowHandle.h
index 2cfa17d3..2cfa17d3 100644
--- a/services/jni/com_android_server_InputWindowHandle.h
+++ b/services/jni/com_android_server_input_InputWindowHandle.h