Merge "Replace InputManager.getInstance() with getSystemService() from context" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4400f5d760
@@ -403,7 +403,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
|
||||
InputDevice.SOURCE_KEYBOARD);
|
||||
|
||||
ev.setDisplayId(mContext.getDisplay().getDisplayId());
|
||||
if (!InputManager.getInstance()
|
||||
if (!mContext.getSystemService(InputManager.class)
|
||||
.injectInputEvent(ev, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC)) {
|
||||
Log.e(TAG, "Inject input event fail");
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ class BubblesNavBarGestureTracker {
|
||||
|
||||
stopInternal();
|
||||
|
||||
mInputMonitor = InputManager.getInstance().monitorGestureInput(GESTURE_MONITOR,
|
||||
mContext.getDisplayId());
|
||||
mInputMonitor = mContext.getSystemService(InputManager.class)
|
||||
.monitorGestureInput(GESTURE_MONITOR, mContext.getDisplayId());
|
||||
InputChannel inputChannel = mInputMonitor.getInputChannel();
|
||||
|
||||
BubblesNavBarMotionEventHandler motionEventHandler =
|
||||
|
||||
@@ -228,7 +228,7 @@ public class PipResizeGestureHandler {
|
||||
|
||||
if (mIsEnabled) {
|
||||
// Register input event receiver
|
||||
mInputMonitor = InputManager.getInstance().monitorGestureInput(
|
||||
mInputMonitor = mContext.getSystemService(InputManager.class).monitorGestureInput(
|
||||
"pip-resize", mDisplayId);
|
||||
try {
|
||||
mMainExecutor.executeBlocking(() -> {
|
||||
|
||||
@@ -505,7 +505,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
|
||||
}
|
||||
|
||||
private void createInputChannel(int displayId) {
|
||||
final InputManager inputManager = InputManager.getInstance();
|
||||
final InputManager inputManager = mContext.getSystemService(InputManager.class);
|
||||
final InputMonitor inputMonitor =
|
||||
mInputMonitorFactory.create(inputManager, mContext);
|
||||
final EventReceiver eventReceiver = new EventReceiver(inputMonitor,
|
||||
|
||||
@@ -65,7 +65,7 @@ class TaskOperations {
|
||||
InputDevice.SOURCE_KEYBOARD);
|
||||
|
||||
ev.setDisplayId(mContext.getDisplay().getDisplayId());
|
||||
if (!InputManager.getInstance()
|
||||
if (!mContext.getSystemService(InputManager.class)
|
||||
.injectInputEvent(ev, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC)) {
|
||||
Log.e(TAG, "Inject input event fail");
|
||||
}
|
||||
|
||||
@@ -58,13 +58,13 @@ import com.android.systemui.statusbar.phone.CentralSurfaces;
|
||||
import com.android.systemui.statusbar.phone.StatusBarWindowCallback;
|
||||
import com.android.systemui.util.Assert;
|
||||
|
||||
import dagger.Lazy;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.Lazy;
|
||||
|
||||
/**
|
||||
* Class to register system actions with accessibility framework.
|
||||
*/
|
||||
@@ -473,7 +473,7 @@ public class SystemActions implements CoreStartable {
|
||||
KeyEvent event = KeyEvent.obtain(downTime, time, action, keyCode, 0, 0,
|
||||
KeyCharacterMap.VIRTUAL_KEYBOARD, 0, KeyEvent.FLAG_FROM_SYSTEM,
|
||||
InputDevice.SOURCE_KEYBOARD, null);
|
||||
InputManager.getInstance()
|
||||
mContext.getSystemService(InputManager.class)
|
||||
.injectInputEvent(event, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
|
||||
event.recycle();
|
||||
}
|
||||
|
||||
@@ -580,7 +580,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
|
||||
}
|
||||
|
||||
// Register input event receiver
|
||||
mInputMonitor = InputManager.getInstance().monitorGestureInput(
|
||||
mInputMonitor = mContext.getSystemService(InputManager.class).monitorGestureInput(
|
||||
"edge-swipe", mDisplayId);
|
||||
mInputEventReceiver = new InputChannelCompat.InputEventReceiver(
|
||||
mInputMonitor.getInputChannel(), Looper.getMainLooper(),
|
||||
@@ -1039,7 +1039,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
|
||||
InputDevice.SOURCE_KEYBOARD);
|
||||
|
||||
ev.setDisplayId(mContext.getDisplay().getDisplayId());
|
||||
return InputManager.getInstance()
|
||||
return mContext.getSystemService(InputManager.class)
|
||||
.injectInputEvent(ev, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
|
||||
}
|
||||
|
||||
|
||||
@@ -356,7 +356,7 @@ public final class KeyboardShortcuts {
|
||||
* Keyboard with its default map.
|
||||
*/
|
||||
private void retrieveKeyCharacterMap(int deviceId) {
|
||||
final InputManager inputManager = InputManager.getInstance();
|
||||
final InputManager inputManager = mContext.getSystemService(InputManager.class);
|
||||
mBackupKeyCharacterMap = inputManager.getInputDevice(-1).getKeyCharacterMap();
|
||||
if (deviceId != -1) {
|
||||
final InputDevice inputDevice = inputManager.getInputDevice(deviceId);
|
||||
|
||||
@@ -335,7 +335,7 @@ public class SystemActionPerformer {
|
||||
KeyEvent event = KeyEvent.obtain(downTime, time, action, keyCode, 0, 0,
|
||||
KeyCharacterMap.VIRTUAL_KEYBOARD, 0, KeyEvent.FLAG_FROM_SYSTEM,
|
||||
InputDevice.SOURCE_KEYBOARD, null);
|
||||
InputManager.getInstance()
|
||||
mContext.getSystemService(InputManager.class)
|
||||
.injectInputEvent(event, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
|
||||
event.recycle();
|
||||
}
|
||||
|
||||
@@ -7357,7 +7357,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
ProtoLog.w(WM_ERROR, "unable to restore pointer icon");
|
||||
}
|
||||
} else {
|
||||
InputManager.getInstance().setPointerIconType(PointerIcon.TYPE_DEFAULT);
|
||||
mContext.getSystemService(InputManager.class)
|
||||
.setPointerIconType(PointerIcon.TYPE_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user