1 /* 2 * Copyright (C) 2020 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 17 package com.android.systemui.classifier; 18 19 import android.view.KeyEvent; 20 import android.view.MotionEvent; 21 22 /** 23 * Defines a class that can be used to ingest system events for later processing. 24 */ 25 public interface FalsingCollector { 26 /** */ onSuccessfulUnlock()27 void onSuccessfulUnlock(); 28 29 /** */ setShowingAod(boolean showingAod)30 void setShowingAod(boolean showingAod); 31 32 /** */ shouldEnforceBouncer()33 boolean shouldEnforceBouncer(); 34 35 /** */ onScreenOnFromTouch()36 void onScreenOnFromTouch(); 37 38 /** */ isReportingEnabled()39 boolean isReportingEnabled(); 40 41 /** */ onScreenTurningOn()42 void onScreenTurningOn(); 43 44 /** */ onScreenOff()45 void onScreenOff(); 46 47 /** */ onBouncerShown()48 void onBouncerShown(); 49 50 /** */ onBouncerHidden()51 void onBouncerHidden(); 52 53 /** 54 * Call this to record a KeyEvent in the {@link com.android.systemui.plugins.FalsingManager}. 55 * 56 * This may decide to only collect certain KeyEvents and ignore others. Do not assume all 57 * KeyEvents are collected. 58 */ onKeyEvent(KeyEvent ev)59 void onKeyEvent(KeyEvent ev); 60 61 /** 62 * Call this to record a MotionEvent in the {@link com.android.systemui.plugins.FalsingManager}. 63 * 64 * Be sure to call {@link #onMotionEventComplete()} after the rest of SystemUI is done with the 65 * MotionEvent. 66 */ onTouchEvent(MotionEvent ev)67 void onTouchEvent(MotionEvent ev); 68 69 /** 70 * Call this once SystemUI has completed all processing of a given MotionEvent. 71 * 72 * See {@link #onTouchEvent(MotionEvent)}. 73 */ onMotionEventComplete()74 void onMotionEventComplete(); 75 76 /** */ avoidGesture()77 void avoidGesture(); 78 79 /** */ cleanup()80 void cleanup(); 81 82 /** */ updateFalseConfidence(FalsingClassifier.Result result)83 void updateFalseConfidence(FalsingClassifier.Result result); 84 85 /** Indicates an a11y action was made. */ onA11yAction()86 void onA11yAction(); 87 88 /** Initialize the class. */ init()89 void init(); 90 } 91 92