Move some APIs from window manager to input manager.
Simplified input injection API down to just one call.
Removed all input state reading API. It was only used by the
window manager policy and required a permission that applications
could not obtain. READ_INPUT_STATE is now unused and deprecated.
Change-Id: I41278141586ddee9468cae0fb59ff0dced6cbc00
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
index cc07240..0c8208f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
@@ -23,6 +23,7 @@
import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
import android.graphics.RectF;
+import android.hardware.input.InputManager;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.ServiceManager;
@@ -47,7 +48,6 @@
final float GLOW_MAX_SCALE_FACTOR = 1.8f;
final float BUTTON_QUIESCENT_ALPHA = 0.6f;
- IWindowManager mWindowManager;
long mDownTime;
int mCode;
int mTouchSlop;
@@ -93,9 +93,6 @@
a.recycle();
- mWindowManager = IWindowManager.Stub.asInterface(
- ServiceManager.getService(Context.WINDOW_SERVICE));
-
setClickable(true);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
}
@@ -276,12 +273,7 @@
0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
flags | KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY,
InputDevice.SOURCE_KEYBOARD);
- try {
- //Slog.d(TAG, "injecting event " + ev);
- mWindowManager.injectInputEventNoWait(ev);
- } catch (RemoteException ex) {
- // System process is dead
- }
+ InputManager.injectInputEvent(ev, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
}
}