blob: a265a5e1d5a7887e83eb0bcab8032424c0571819 [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
19import android.content.Context;
20import android.database.ContentObserver;
21import android.hardware.Sensor;
22import android.hardware.SensorEvent;
23import android.hardware.SensorEventListener;
24import android.hardware.SensorManager;
Adrian Roos7bb38a92016-07-21 11:44:01 -070025import android.net.Uri;
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070026import android.os.Handler;
Selim Cinekf8c4add2017-06-08 09:54:58 -070027import android.os.Looper;
Adrian Roosc5584ce2016-02-24 14:17:19 -080028import android.os.PowerManager;
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070029import android.os.UserHandle;
30import android.provider.Settings;
Adrian Roos004437e2017-08-16 11:58:02 +020031import android.view.InputDevice;
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070032import android.view.MotionEvent;
Adrian Roosca664b92016-04-18 14:40:27 -070033import android.view.accessibility.AccessibilityManager;
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070034
Jorim Jaggie549a8d2017-05-15 02:40:05 +020035import com.android.systemui.Dependency;
36import com.android.systemui.UiOffloadThread;
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070037import com.android.systemui.analytics.DataCollector;
38import com.android.systemui.statusbar.StatusBarState;
Adrian Roos7a8ae8a2017-08-02 16:26:50 +020039import com.android.systemui.util.AsyncSensorManager;
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070040
Adrian Roos401caae2016-03-04 13:35:21 -080041import java.io.PrintWriter;
42
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070043/**
44 * When the phone is locked, listens to touch, sensor and phone events and sends them to
45 * DataCollector and HumanInteractionClassifier.
46 *
47 * It does not collect touch events when the bouncer shows up.
48 */
49public class FalsingManager implements SensorEventListener {
50 private static final String ENFORCE_BOUNCER = "falsing_manager_enforce_bouncer";
51
Blazej Magnowski6dc59b42015-09-22 15:14:20 -070052 private static final int[] CLASSIFIER_SENSORS = new int[] {
53 Sensor.TYPE_PROXIMITY,
54 };
55
56 private static final int[] COLLECTOR_SENSORS = new int[] {
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070057 Sensor.TYPE_ACCELEROMETER,
58 Sensor.TYPE_GYROSCOPE,
59 Sensor.TYPE_PROXIMITY,
60 Sensor.TYPE_LIGHT,
61 Sensor.TYPE_ROTATION_VECTOR,
62 };
63
Selim Cinekf8c4add2017-06-08 09:54:58 -070064 private final Handler mHandler = new Handler(Looper.getMainLooper());
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070065 private final Context mContext;
66
67 private final SensorManager mSensorManager;
68 private final DataCollector mDataCollector;
69 private final HumanInteractionClassifier mHumanInteractionClassifier;
Adrian Roosca664b92016-04-18 14:40:27 -070070 private final AccessibilityManager mAccessibilityManager;
Jorim Jaggie549a8d2017-05-15 02:40:05 +020071 private final UiOffloadThread mUiOffloadThread;
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070072
73 private static FalsingManager sInstance = null;
74
75 private boolean mEnforceBouncer = false;
76 private boolean mBouncerOn = false;
77 private boolean mSessionActive = false;
Adrian Roos004437e2017-08-16 11:58:02 +020078 private boolean mIsTouchScreen = true;
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070079 private int mState = StatusBarState.SHADE;
Adrian Roosc5584ce2016-02-24 14:17:19 -080080 private boolean mScreenOn;
Adrian Roose395b5d2017-06-28 16:52:37 +020081 private boolean mShowingAod;
Adrian Roos8e291a52016-12-09 16:10:19 -080082 private Runnable mPendingWtf;
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070083
84 protected final ContentObserver mSettingsObserver = new ContentObserver(mHandler) {
85 @Override
86 public void onChange(boolean selfChange) {
87 updateConfiguration();
88 }
89 };
90
91 private FalsingManager(Context context) {
92 mContext = context;
Adrian Roos7a8ae8a2017-08-02 16:26:50 +020093 mSensorManager = Dependency.get(AsyncSensorManager.class);
Adrian Roosca664b92016-04-18 14:40:27 -070094 mAccessibilityManager = context.getSystemService(AccessibilityManager.class);
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070095 mDataCollector = DataCollector.getInstance(mContext);
96 mHumanInteractionClassifier = HumanInteractionClassifier.getInstance(mContext);
Jorim Jaggie549a8d2017-05-15 02:40:05 +020097 mUiOffloadThread = Dependency.get(UiOffloadThread.class);
Adrian Roosc5584ce2016-02-24 14:17:19 -080098 mScreenOn = context.getSystemService(PowerManager.class).isInteractive();
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -070099
100 mContext.getContentResolver().registerContentObserver(
101 Settings.Secure.getUriFor(ENFORCE_BOUNCER), false,
102 mSettingsObserver,
103 UserHandle.USER_ALL);
104
105 updateConfiguration();
106 }
107
108 public static FalsingManager getInstance(Context context) {
109 if (sInstance == null) {
110 sInstance = new FalsingManager(context);
111 }
112 return sInstance;
113 }
114
115 private void updateConfiguration() {
116 mEnforceBouncer = 0 != Settings.Secure.getInt(mContext.getContentResolver(),
117 ENFORCE_BOUNCER, 0);
118 }
119
Adrian Roosc5584ce2016-02-24 14:17:19 -0800120 private boolean shouldSessionBeActive() {
Adrian Roos401caae2016-03-04 13:35:21 -0800121 if (FalsingLog.ENABLED && FalsingLog.VERBOSE)
122 FalsingLog.v("shouldBeActive", new StringBuilder()
123 .append("enabled=").append(isEnabled() ? 1 : 0)
124 .append(" mScreenOn=").append(mScreenOn ? 1 : 0)
125 .append(" mState=").append(StatusBarState.toShortString(mState))
126 .toString()
127 );
Adrian Roose395b5d2017-06-28 16:52:37 +0200128 return isEnabled() && mScreenOn && (mState == StatusBarState.KEYGUARD) && !mShowingAod;
Adrian Roosc5584ce2016-02-24 14:17:19 -0800129 }
130
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700131 private boolean sessionEntrypoint() {
Adrian Roosc5584ce2016-02-24 14:17:19 -0800132 if (!mSessionActive && shouldSessionBeActive()) {
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700133 onSessionStart();
134 return true;
135 }
136 return false;
137 }
138
Adrian Roosc5584ce2016-02-24 14:17:19 -0800139 private void sessionExitpoint(boolean force) {
140 if (mSessionActive && (force || !shouldSessionBeActive())) {
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700141 mSessionActive = false;
Jorim Jaggie549a8d2017-05-15 02:40:05 +0200142
143 // This can be expensive, and doesn't need to happen on the main thread.
144 mUiOffloadThread.submit(() -> {
145 mSensorManager.unregisterListener(this);
146 });
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700147 }
148 }
149
Adrian Roose395b5d2017-06-28 16:52:37 +0200150 public void updateSessionActive() {
151 if (shouldSessionBeActive()) {
152 sessionEntrypoint();
153 } else {
154 sessionExitpoint(false /* force */);
155 }
156 }
157
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700158 private void onSessionStart() {
Adrian Roos401caae2016-03-04 13:35:21 -0800159 if (FalsingLog.ENABLED) {
160 FalsingLog.i("onSessionStart", "classifierEnabled=" + isClassiferEnabled());
Adrian Roos8e291a52016-12-09 16:10:19 -0800161 clearPendingWtf();
Adrian Roos401caae2016-03-04 13:35:21 -0800162 }
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700163 mBouncerOn = false;
164 mSessionActive = true;
Blazej Magnowski6dc59b42015-09-22 15:14:20 -0700165
166 if (mHumanInteractionClassifier.isEnabled()) {
167 registerSensors(CLASSIFIER_SENSORS);
168 }
Adrian Roos7bb38a92016-07-21 11:44:01 -0700169 if (mDataCollector.isEnabledFull()) {
Blazej Magnowski6dc59b42015-09-22 15:14:20 -0700170 registerSensors(COLLECTOR_SENSORS);
171 }
Selim Cinek1ed50042018-01-18 17:12:32 -0800172 if (mDataCollector.isEnabled()) {
173 mDataCollector.onFalsingSessionStarted();
174 }
Blazej Magnowski6dc59b42015-09-22 15:14:20 -0700175 }
176
177 private void registerSensors(int [] sensors) {
178 for (int sensorType : sensors) {
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700179 Sensor s = mSensorManager.getDefaultSensor(sensorType);
180 if (s != null) {
Jorim Jaggie549a8d2017-05-15 02:40:05 +0200181
182 // This can be expensive, and doesn't need to happen on the main thread.
183 mUiOffloadThread.submit(() -> {
184 mSensorManager.registerListener(this, s, SensorManager.SENSOR_DELAY_GAME);
185 });
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700186 }
187 }
188 }
189
Blazej Magnowski6dc59b42015-09-22 15:14:20 -0700190 public boolean isClassiferEnabled() {
191 return mHumanInteractionClassifier.isEnabled();
192 }
193
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700194 private boolean isEnabled() {
195 return mHumanInteractionClassifier.isEnabled() || mDataCollector.isEnabled();
196 }
197
198 /**
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700199 * @return true if the classifier determined that this is not a human interacting with the phone
200 */
Blazej Magnowski9f01c5b2015-09-17 15:14:29 -0700201 public boolean isFalseTouch() {
Adrian Roos401caae2016-03-04 13:35:21 -0800202 if (FalsingLog.ENABLED) {
Adrian Roos6a04cb12016-03-14 20:21:02 -0700203 // We're getting some false wtfs from touches that happen after the device went
204 // to sleep. Only report missing sessions that happen when the device is interactive.
Adrian Roos8e291a52016-12-09 16:10:19 -0800205 if (!mSessionActive && mContext.getSystemService(PowerManager.class).isInteractive()
206 && mPendingWtf == null) {
207 int enabled = isEnabled() ? 1 : 0;
208 int screenOn = mScreenOn ? 1 : 0;
209 String state = StatusBarState.toShortString(mState);
210 Throwable here = new Throwable("here");
211 FalsingLog.wLogcat("isFalseTouch", new StringBuilder()
Adrian Roos401caae2016-03-04 13:35:21 -0800212 .append("Session is not active, yet there's a query for a false touch.")
Adrian Roos8e291a52016-12-09 16:10:19 -0800213 .append(" enabled=").append(enabled)
214 .append(" mScreenOn=").append(screenOn)
215 .append(" mState=").append(state)
216 .append(". Escalating to WTF if screen does not turn on soon.")
Adrian Roos401caae2016-03-04 13:35:21 -0800217 .toString());
Adrian Roos8e291a52016-12-09 16:10:19 -0800218
219 // Unfortunately we're also getting false positives for touches that happen right
220 // after the screen turns on, but before that notification has made it to us.
221 // Unfortunately there's no good way to catch that, except to wait and see if we get
222 // the screen on notification soon.
223 mPendingWtf = () -> FalsingLog.wtf("isFalseTouch", new StringBuilder()
224 .append("Session did not become active after query for a false touch.")
225 .append(" enabled=").append(enabled)
226 .append('/').append(isEnabled() ? 1 : 0)
227 .append(" mScreenOn=").append(screenOn)
228 .append('/').append(mScreenOn ? 1 : 0)
229 .append(" mState=").append(state)
230 .append('/').append(StatusBarState.toShortString(mState))
231 .append(". Look for warnings ~1000ms earlier to see root cause.")
232 .toString(), here);
233 mHandler.postDelayed(mPendingWtf, 1000);
Adrian Roos401caae2016-03-04 13:35:21 -0800234 }
235 }
Adrian Roosca664b92016-04-18 14:40:27 -0700236 if (mAccessibilityManager.isTouchExplorationEnabled()) {
237 // Touch exploration triggers false positives in the classifier and
238 // already sufficiently prevents false unlocks.
239 return false;
240 }
Adrian Roos004437e2017-08-16 11:58:02 +0200241 if (!mIsTouchScreen) {
242 // Unlocking with input devices besides the touchscreen should already be sufficiently
243 // anti-falsed.
244 return false;
245 }
Blazej Magnowski9f01c5b2015-09-17 15:14:29 -0700246 return mHumanInteractionClassifier.isFalseTouch();
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700247 }
248
Adrian Roos8e291a52016-12-09 16:10:19 -0800249 private void clearPendingWtf() {
250 if (mPendingWtf != null) {
251 mHandler.removeCallbacks(mPendingWtf);
252 mPendingWtf = null;
253 }
254 }
255
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700256 @Override
257 public synchronized void onSensorChanged(SensorEvent event) {
258 mDataCollector.onSensorChanged(event);
259 mHumanInteractionClassifier.onSensorChanged(event);
260 }
261
262 @Override
263 public void onAccuracyChanged(Sensor sensor, int accuracy) {
264 mDataCollector.onAccuracyChanged(sensor, accuracy);
265 }
266
267 public boolean shouldEnforceBouncer() {
268 return mEnforceBouncer;
269 }
270
Adrian Roose395b5d2017-06-28 16:52:37 +0200271 public void setShowingAod(boolean showingAod) {
272 mShowingAod = showingAod;
273 updateSessionActive();
274 }
275
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700276 public void setStatusBarState(int state) {
Adrian Roos401caae2016-03-04 13:35:21 -0800277 if (FalsingLog.ENABLED) {
278 FalsingLog.i("setStatusBarState", new StringBuilder()
279 .append("from=").append(StatusBarState.toShortString(mState))
280 .append(" to=").append(StatusBarState.toShortString(state))
281 .toString());
282 }
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700283 mState = state;
Adrian Roose395b5d2017-06-28 16:52:37 +0200284 updateSessionActive();
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700285 }
286
287 public void onScreenTurningOn() {
Adrian Roos401caae2016-03-04 13:35:21 -0800288 if (FalsingLog.ENABLED) {
289 FalsingLog.i("onScreenTurningOn", new StringBuilder()
290 .append("from=").append(mScreenOn ? 1 : 0)
291 .toString());
Adrian Roos8e291a52016-12-09 16:10:19 -0800292 clearPendingWtf();
Adrian Roos401caae2016-03-04 13:35:21 -0800293 }
Adrian Roosc5584ce2016-02-24 14:17:19 -0800294 mScreenOn = true;
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700295 if (sessionEntrypoint()) {
296 mDataCollector.onScreenTurningOn();
297 }
298 }
299
300 public void onScreenOnFromTouch() {
Adrian Roos401caae2016-03-04 13:35:21 -0800301 if (FalsingLog.ENABLED) {
302 FalsingLog.i("onScreenOnFromTouch", new StringBuilder()
303 .append("from=").append(mScreenOn ? 1 : 0)
304 .toString());
305 }
Adrian Roosc5584ce2016-02-24 14:17:19 -0800306 mScreenOn = true;
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700307 if (sessionEntrypoint()) {
308 mDataCollector.onScreenOnFromTouch();
309 }
310 }
311
312 public void onScreenOff() {
Adrian Roos401caae2016-03-04 13:35:21 -0800313 if (FalsingLog.ENABLED) {
314 FalsingLog.i("onScreenOff", new StringBuilder()
315 .append("from=").append(mScreenOn ? 1 : 0)
316 .toString());
317 }
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700318 mDataCollector.onScreenOff();
Adrian Roosc5584ce2016-02-24 14:17:19 -0800319 mScreenOn = false;
320 sessionExitpoint(false /* force */);
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700321 }
322
323 public void onSucccessfulUnlock() {
Adrian Roos401caae2016-03-04 13:35:21 -0800324 if (FalsingLog.ENABLED) {
325 FalsingLog.i("onSucccessfulUnlock", "");
326 }
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700327 mDataCollector.onSucccessfulUnlock();
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700328 }
329
330 public void onBouncerShown() {
Adrian Roos401caae2016-03-04 13:35:21 -0800331 if (FalsingLog.ENABLED) {
332 FalsingLog.i("onBouncerShown", new StringBuilder()
333 .append("from=").append(mBouncerOn ? 1 : 0)
334 .toString());
335 }
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700336 if (!mBouncerOn) {
337 mBouncerOn = true;
338 mDataCollector.onBouncerShown();
339 }
340 }
341
342 public void onBouncerHidden() {
Adrian Roos401caae2016-03-04 13:35:21 -0800343 if (FalsingLog.ENABLED) {
344 FalsingLog.i("onBouncerHidden", new StringBuilder()
345 .append("from=").append(mBouncerOn ? 1 : 0)
346 .toString());
347 }
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700348 if (mBouncerOn) {
349 mBouncerOn = false;
350 mDataCollector.onBouncerHidden();
351 }
352 }
353
354 public void onQsDown() {
Adrian Roos401caae2016-03-04 13:35:21 -0800355 if (FalsingLog.ENABLED) {
356 FalsingLog.i("onQsDown", "");
357 }
Blazej Magnowski9f01c5b2015-09-17 15:14:29 -0700358 mHumanInteractionClassifier.setType(Classifier.QUICK_SETTINGS);
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700359 mDataCollector.onQsDown();
360 }
361
362 public void setQsExpanded(boolean expanded) {
363 mDataCollector.setQsExpanded(expanded);
364 }
365
Lucas Dupinbc9aac12018-03-04 20:18:15 -0800366 public void onTrackingStarted(boolean secure) {
Adrian Roos401caae2016-03-04 13:35:21 -0800367 if (FalsingLog.ENABLED) {
368 FalsingLog.i("onTrackingStarted", "");
369 }
Lucas Dupinbc9aac12018-03-04 20:18:15 -0800370 mHumanInteractionClassifier.setType(secure ?
371 Classifier.BOUNCER_UNLOCK : Classifier.UNLOCK);
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700372 mDataCollector.onTrackingStarted();
373 }
374
375 public void onTrackingStopped() {
376 mDataCollector.onTrackingStopped();
377 }
378
379 public void onNotificationActive() {
380 mDataCollector.onNotificationActive();
381 }
382
Adrian Roos9f0b0022016-11-09 15:56:50 -0800383 public void onNotificationDoubleTap(boolean accepted, float dx, float dy) {
384 if (FalsingLog.ENABLED) {
385 FalsingLog.i("onNotificationDoubleTap", "accepted=" + accepted
386 + " dx=" + dx + " dy=" + dy + " (px)");
387 }
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700388 mDataCollector.onNotificationDoubleTap();
389 }
390
391 public void setNotificationExpanded() {
392 mDataCollector.setNotificationExpanded();
393 }
394
395 public void onNotificatonStartDraggingDown() {
Adrian Roos401caae2016-03-04 13:35:21 -0800396 if (FalsingLog.ENABLED) {
397 FalsingLog.i("onNotificatonStartDraggingDown", "");
398 }
Blazej Magnowski9f01c5b2015-09-17 15:14:29 -0700399 mHumanInteractionClassifier.setType(Classifier.NOTIFICATION_DRAG_DOWN);
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700400 mDataCollector.onNotificatonStartDraggingDown();
401 }
402
403 public void onNotificatonStopDraggingDown() {
404 mDataCollector.onNotificatonStopDraggingDown();
405 }
406
407 public void onNotificationDismissed() {
408 mDataCollector.onNotificationDismissed();
409 }
410
411 public void onNotificatonStartDismissing() {
Adrian Roos401caae2016-03-04 13:35:21 -0800412 if (FalsingLog.ENABLED) {
413 FalsingLog.i("onNotificatonStartDismissing", "");
414 }
Blazej Magnowski9f01c5b2015-09-17 15:14:29 -0700415 mHumanInteractionClassifier.setType(Classifier.NOTIFICATION_DISMISS);
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700416 mDataCollector.onNotificatonStartDismissing();
417 }
418
419 public void onNotificatonStopDismissing() {
420 mDataCollector.onNotificatonStopDismissing();
421 }
422
423 public void onCameraOn() {
424 mDataCollector.onCameraOn();
425 }
426
427 public void onLeftAffordanceOn() {
428 mDataCollector.onLeftAffordanceOn();
429 }
430
431 public void onAffordanceSwipingStarted(boolean rightCorner) {
Adrian Roos401caae2016-03-04 13:35:21 -0800432 if (FalsingLog.ENABLED) {
433 FalsingLog.i("onAffordanceSwipingStarted", "");
434 }
Blazej Magnowski9f01c5b2015-09-17 15:14:29 -0700435 if (rightCorner) {
436 mHumanInteractionClassifier.setType(Classifier.RIGHT_AFFORDANCE);
437 } else {
438 mHumanInteractionClassifier.setType(Classifier.LEFT_AFFORDANCE);
439 }
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700440 mDataCollector.onAffordanceSwipingStarted(rightCorner);
441 }
442
443 public void onAffordanceSwipingAborted() {
444 mDataCollector.onAffordanceSwipingAborted();
445 }
446
447 public void onUnlockHintStarted() {
448 mDataCollector.onUnlockHintStarted();
449 }
450
451 public void onCameraHintStarted() {
452 mDataCollector.onCameraHintStarted();
453 }
454
455 public void onLeftAffordanceHintStarted() {
456 mDataCollector.onLeftAffordanceHintStarted();
457 }
458
459 public void onTouchEvent(MotionEvent event, int width, int height) {
Adrian Roos004437e2017-08-16 11:58:02 +0200460 if (event.getAction() == MotionEvent.ACTION_DOWN) {
461 mIsTouchScreen = event.isFromSource(InputDevice.SOURCE_TOUCHSCREEN);
462 }
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700463 if (mSessionActive && !mBouncerOn) {
464 mDataCollector.onTouchEvent(event, width, height);
465 mHumanInteractionClassifier.onTouchEvent(event);
466 }
467 }
Adrian Roos401caae2016-03-04 13:35:21 -0800468
469 public void dump(PrintWriter pw) {
470 pw.println("FALSING MANAGER");
471 pw.print("classifierEnabled="); pw.println(isClassiferEnabled() ? 1 : 0);
472 pw.print("mSessionActive="); pw.println(mSessionActive ? 1 : 0);
473 pw.print("mBouncerOn="); pw.println(mSessionActive ? 1 : 0);
474 pw.print("mState="); pw.println(StatusBarState.toShortString(mState));
475 pw.print("mScreenOn="); pw.println(mScreenOn ? 1 : 0);
476 pw.println();
477 }
Adrian Roos7bb38a92016-07-21 11:44:01 -0700478
479 public Uri reportRejectedTouch() {
480 if (mDataCollector.isEnabled()) {
481 return mDataCollector.reportRejectedTouch();
482 }
483 return null;
484 }
485
486 public boolean isReportingEnabled() {
487 return mDataCollector.isReportingEnabled();
488 }
Blazej Magnowski0e2ffbd2015-09-10 14:37:17 -0700489}