blob: ae7d142a9e45ed218c6973dd85d882b6ee68f753 [file] [log] [blame]
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -07001/*
2 * Copyright (C) 2015 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
17package com.android.systemui.classifier;
18
Dave Mankoff07fb7b72019-06-10 16:36:19 -040019import android.annotation.IntDef;
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070020import android.hardware.SensorEvent;
21import android.view.MotionEvent;
22
Dave Mankoff07fb7b72019-06-10 16:36:19 -040023import java.lang.annotation.Retention;
24import java.lang.annotation.RetentionPolicy;
25
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070026/**
Blazej Magnowski9f01c5b2015-09-17 15:14:29 -070027 * An abstract class for classifiers for touch and sensor events.
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070028 */
29public abstract class Classifier {
30 public static final int QUICK_SETTINGS = 0;
31 public static final int NOTIFICATION_DISMISS = 1;
32 public static final int NOTIFICATION_DRAG_DOWN = 2;
33 public static final int NOTIFICATION_DOUBLE_TAP = 3;
34 public static final int UNLOCK = 4;
35 public static final int LEFT_AFFORDANCE = 5;
36 public static final int RIGHT_AFFORDANCE = 6;
Blazej Magnowski9f01c5b2015-09-17 15:14:29 -070037 public static final int GENERIC = 7;
Lucas Dupinbc9aac12018-03-04 20:18:15 -080038 public static final int BOUNCER_UNLOCK = 8;
Selim Cinek3d6ae232019-01-04 14:14:33 -080039 public static final int PULSE_EXPAND = 9;
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070040
Dave Mankoff07fb7b72019-06-10 16:36:19 -040041 @IntDef({
42 QUICK_SETTINGS,
43 NOTIFICATION_DISMISS,
44 NOTIFICATION_DRAG_DOWN,
45 NOTIFICATION_DOUBLE_TAP,
46 UNLOCK,
47 LEFT_AFFORDANCE,
48 RIGHT_AFFORDANCE,
49 GENERIC,
50 BOUNCER_UNLOCK,
51 PULSE_EXPAND
52 })
53 @Retention(RetentionPolicy.SOURCE)
54 public @interface InteractionType {}
55
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070056 /**
57 * Contains all the information about touch events from which the classifier can query
58 */
59 protected ClassifierData mClassifierData;
60
61 /**
62 * Informs the classifier that a new touch event has occurred
63 */
64 public void onTouchEvent(MotionEvent event) {
65 }
66
67 /**
68 * Informs the classifier that a sensor change occurred
69 */
70 public void onSensorChanged(SensorEvent event) {
71 }
Adrian Roos401caae2016-03-04 13:35:21 -080072
73 public abstract String getTag();
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070074}