• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.systemui.shared.system;
17 
18 import android.hardware.input.InputManager;
19 import android.os.Looper;
20 import android.view.Choreographer;
21 import android.view.InputMonitor;
22 
23 import com.android.systemui.shared.system.InputChannelCompat.InputEventListener;
24 import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver;
25 
26 /**
27  * @see android.view.InputMonitor
28  */
29 public class InputMonitorCompat {
30     private final InputMonitor mInputMonitor;
31 
32     /**
33      * Monitor input on the specified display for gestures.
34      */
InputMonitorCompat(String name, int displayId)35     public InputMonitorCompat(String name, int displayId) {
36         mInputMonitor = InputManager.getInstance().monitorGestureInput(name, displayId);
37     }
38 
39     /**
40      * @see InputMonitor#pilferPointers()
41      */
pilferPointers()42     public void pilferPointers() {
43         mInputMonitor.pilferPointers();
44     }
45 
46     /**
47      * @see InputMonitor#dispose()
48      */
dispose()49     public void dispose() {
50         mInputMonitor.dispose();
51     }
52 
53     /**
54      * @see InputMonitor#getInputChannel()
55      */
getInputReceiver(Looper looper, Choreographer choreographer, InputEventListener listener)56     public InputEventReceiver getInputReceiver(Looper looper, Choreographer choreographer,
57             InputEventListener listener) {
58         return new InputEventReceiver(mInputMonitor.getInputChannel(), looper, choreographer,
59                 listener);
60     }
61 }
62