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

Commit 8012d7bd authored by Dave Mankoff's avatar Dave Mankoff
Browse files

Refactor parts of FalsingManager into FalsingCollector

This CL separates out the two roles of the FalsingManager. It
introduces the FalsingCollector, used by SystemUI to report events
that may be interesting to Falsing, such as touch events, sensor
events, and general user actions.

The FalsingManager, meanwhile, continues to support the methods

This helps breakup the monolithic FalsingManger into more manageable
pieces, reducing the API surface area of FalsingManager significantly.

Bug: 172655679
Test: atest SystemUITests && manual
Change-Id: I92f8e3747f5c4a04eaa64e1a8b626c2a07c480aa
parent 8b0cc5a2
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -33,6 +33,13 @@ java_library {
    srcs: ["src/com/android/systemui/EventLogTags.logtags"],
}

java_library {
    name: "SystemUI-sensors",
    srcs: [
        "src/com/android/systemui/util/sensors/ThresholdSensor.java",
    ]
}

android_library {
    name: "SystemUI-core",
    srcs: [
+2 −1
Original line number Diff line number Diff line
@@ -19,7 +19,8 @@ java_library {
    srcs: ["src/**/*.java"],

    static_libs: [
        "PluginCoreLib"
        "PluginCoreLib",
        "SystemUI-sensors",
    ],

}
+4 −54
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.net.Uri;
import android.view.MotionEvent;

import com.android.systemui.plugins.annotations.ProvidesInterface;
import com.android.systemui.util.sensors.ThresholdSensor;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -35,12 +36,6 @@ public interface FalsingManager {

    void onSuccessfulUnlock();

    void onNotificationActive();

    void setShowingAod(boolean showingAod);

    void onNotificatonStartDraggingDown();

    boolean isUnlockingDisabled();

    /** Returns true if the gesture should be rejected. */
@@ -82,66 +77,21 @@ public interface FalsingManager {
     */
    boolean isFalseDoubleTap();

    void onNotificatonStopDraggingDown();

    void setNotificationExpanded();

    boolean isClassifierEnabled();

    void onQsDown();

    void setQsExpanded(boolean expanded);

    boolean shouldEnforceBouncer();

    void onTrackingStarted(boolean secure);

    void onTrackingStopped();

    void onLeftAffordanceOn();

    void onCameraOn();

    void onAffordanceSwipingStarted(boolean rightCorner);

    void onAffordanceSwipingAborted();

    void onStartExpandingFromPulse();

    void onExpansionFromPulseStopped();

    Uri reportRejectedTouch();

    void onScreenOnFromTouch();

    boolean isReportingEnabled();

    void onUnlockHintStarted();

    void onCameraHintStarted();

    void onLeftAffordanceHintStarted();

    void onScreenTurningOn();

    void onScreenOff();

    void onNotificationStopDismissing();

    void onNotificationDismissed();

    void onNotificationStartDismissing();

    void onNotificationDoubleTap(boolean accepted, float dx, float dy);

    void onBouncerShown();

    void onBouncerHidden();

    void onTouchEvent(MotionEvent ev, int width, int height);

    /** From com.android.systemui.Dumpable. */
    void dump(FileDescriptor fd, PrintWriter pw, String[] args);

    void cleanup();

    /** Call to report a ProximityEvent to the FalsingManager. */
    void onProximityEvent(ThresholdSensor.ThresholdSensorEvent proximityEvent);
}
+121 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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 com.android.systemui.classifier;

import android.view.MotionEvent;

/**
 * Defines a class that can be used to ingest system events for later processing.
 */
public interface FalsingCollector {
    /** */
    void onSuccessfulUnlock();

    /** */
    void onNotificationActive();

    /** */
    void setShowingAod(boolean showingAod);

    /** */
    void onNotificationStartDraggingDown();

    /** */
    void onNotificationStopDraggingDown();

    /** */
    void setNotificationExpanded();

    /** */
    void onQsDown();

    /** */
    void setQsExpanded(boolean expanded);

    /** */
    boolean shouldEnforceBouncer();

    /** */
    void onTrackingStarted(boolean secure);

    /** */
    void onTrackingStopped();

    /** */
    void onLeftAffordanceOn();

    /** */
    void onCameraOn();

    /** */
    void onAffordanceSwipingStarted(boolean rightCorner);

    /** */
    void onAffordanceSwipingAborted();

    /** */
    void onStartExpandingFromPulse();

    /** */
    void onExpansionFromPulseStopped();

    /** */
    void onScreenOnFromTouch();

    /** */
    boolean isReportingEnabled();

    /** */
    void onUnlockHintStarted();

    /** */
    void onCameraHintStarted();

    /** */
    void onLeftAffordanceHintStarted();

    /** */
    void onScreenTurningOn();

    /** */
    void onScreenOff();

    /** */
    void onNotificationStopDismissing();

    /** */
    void onNotificationDismissed();

    /** */
    void onNotificationStartDismissing();

    /** */
    void onNotificationDoubleTap(boolean accepted, float dx, float dy);

    /** */
    void onBouncerShown();

    /** */
    void onBouncerHidden();

    /** */
    void onTouchEvent(MotionEvent ev, int width, int height);

    /** */
    void cleanup();
}
+152 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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 com.android.systemui.classifier;

import android.view.MotionEvent;

/** */
public class FalsingCollectorFake implements FalsingCollector {
    @Override
    public void onSuccessfulUnlock() {
    }

    @Override
    public void onNotificationActive() {
    }

    @Override
    public void setShowingAod(boolean showingAod) {
    }

    @Override
    public void onNotificationStartDraggingDown() {
    }

    @Override
    public void onNotificationStopDraggingDown() {
    }

    @Override
    public void setNotificationExpanded() {
    }

    @Override
    public void onQsDown() {
    }

    @Override
    public void setQsExpanded(boolean expanded) {
    }

    @Override
    public boolean shouldEnforceBouncer() {
        return false;
    }

    @Override
    public void onTrackingStarted(boolean secure) {
    }

    @Override
    public void onTrackingStopped() {
    }

    @Override
    public void onLeftAffordanceOn() {
    }

    @Override
    public void onCameraOn() {
    }

    @Override
    public void onAffordanceSwipingStarted(boolean rightCorner) {
    }

    @Override
    public void onAffordanceSwipingAborted() {
    }

    @Override
    public void onStartExpandingFromPulse() {
    }

    @Override
    public void onExpansionFromPulseStopped() {
    }

    @Override
    public void onScreenOnFromTouch() {
    }

    @Override
    public boolean isReportingEnabled() {
        return false;
    }

    @Override
    public void onUnlockHintStarted() {
    }

    @Override
    public void onCameraHintStarted() {
    }

    @Override
    public void onLeftAffordanceHintStarted() {
    }

    @Override
    public void onScreenTurningOn() {
    }

    @Override
    public void onScreenOff() {
    }

    @Override
    public void onNotificationStopDismissing() {
    }

    @Override
    public void onNotificationDismissed() {
    }

    @Override
    public void onNotificationStartDismissing() {
    }

    @Override
    public void onNotificationDoubleTap(boolean accepted, float dx, float dy) {
    }

    @Override
    public void onBouncerShown() {
    }

    @Override
    public void onBouncerHidden() {
    }

    @Override
    public void onTouchEvent(MotionEvent ev, int width, int height) {
    }

    @Override
    public void cleanup() {
    }
}
Loading