Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7995239 authored by Michael Wright's avatar Michael Wright
Browse files

Expose input region monitoring to system components.

This is to allow SysUI to detect system-wide gestures.

Test: manual
Bug: 123748692
Change-Id: Ic1e2cd6afea219d0e20b29e7150c9a42b75c7a67
parent 0a0a49be
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -375,6 +375,7 @@ java_defaults {
        "core/java/android/view/IDisplayFoldListener.aidl",
        "core/java/android/view/IGraphicsStats.aidl",
        "core/java/android/view/IGraphicsStatsCallback.aidl",
        "core/java/android/view/IInputMonitorHost.aidl",
        "core/java/android/view/IInputFilter.aidl",
        "core/java/android/view/IInputFilterHost.aidl",
        "core/java/android/view/IOnKeyguardExitResult.aidl",
+5 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.hardware.input;

import android.graphics.Rect;
import android.hardware.input.InputDeviceIdentifier;
import android.hardware.input.KeyboardLayout;
import android.hardware.input.IInputDevicesChangedListener;
@@ -24,6 +25,7 @@ import android.hardware.input.TouchCalibration;
import android.os.IBinder;
import android.view.InputDevice;
import android.view.InputEvent;
import android.view.InputMonitor;
import android.view.PointerIcon;

/** @hide */
@@ -82,4 +84,7 @@ interface IInputManager {
    void setCustomPointerIcon(in PointerIcon icon);

    void requestPointerCapture(IBinder windowToken, boolean enabled);

    /** Create an input monitor for gestures. */
    InputMonitor monitorGestureInput(String name, int displayId);
}
+14 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.util.Log;
import android.util.SparseArray;
import android.view.InputDevice;
import android.view.InputEvent;
import android.view.InputMonitor;
import android.view.MotionEvent;
import android.view.PointerIcon;

@@ -933,6 +934,19 @@ public final class InputManager {
        }
    }

    /**
     * Monitor input on the specified display for gestures.
     *
     * @hide
     */
    public InputMonitor monitorGestureInput(String name, int displayId) {
        try {
            return mIm.monitorGestureInput(name, displayId);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

    private void populateInputDevicesLocked() {
        if (mInputDevicesChangedListener == null) {
            final InputDevicesChangedListener listener = new InputDevicesChangedListener();
+25 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2019, 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.view;

/**
 * @hide
 */
oneway interface IInputMonitorHost {
    void pilferPointers();
    void dispose();
}
+11 −11
Original line number Diff line number Diff line
@@ -17,8 +17,8 @@
package android.view;

import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Slog;

Loading