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

Commit cdfa13da authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add support for FalsingPlugin to supply a replacement FalsingManager." into qt-dev

parents 7de91bb8 468d4f6f
Loading
Loading
Loading
Loading
+106 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.plugins;

import android.net.Uri;
import android.view.MotionEvent;

import com.android.systemui.plugins.annotations.ProvidesInterface;

import java.io.PrintWriter;

/**
 * Interface that decides whether a touch on the phone was accidental. i.e. Pocket Dialing.
 *
 * {@see com.android.systemui.classifier.FalsingManagerImpl}
 */
@ProvidesInterface(version = FalsingManager.VERSION)
public interface FalsingManager {
    int VERSION = 1;

    void onSucccessfulUnlock();

    void onNotificationActive();

    void setShowingAod(boolean showingAod);

    void onNotificatonStartDraggingDown();

    boolean isUnlockingDisabled();

    boolean isFalseTouch();

    void onNotificatonStopDraggingDown();

    void setNotificationExpanded();

    boolean isClassiferEnabled();

    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 onNotificatonStopDismissing();

    void onNotificationDismissed();

    void onNotificatonStartDismissing();

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

    void onBouncerShown();

    void onBouncerHidden();

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

    void dump(PrintWriter pw);
}
+16 −3
Original line number Diff line number Diff line
@@ -16,18 +16,22 @@

package com.android.systemui.plugins;

import android.content.Context;

import com.android.systemui.plugins.annotations.DependsOn;
import com.android.systemui.plugins.annotations.ProvidesInterface;

/**
 * Used to capture Falsing data (related to unlocking the screen).
 *
 * The intent is that the data can later be analyzed to validate the quality of the
 * {@link com.android.systemui.classifier.FalsingManagerFactory.FalsingManager}.
 * {@link FalsingManager}.
 */
@ProvidesInterface(action = FalsingPlugin.ACTION, version = FalsingPlugin.VERSION)
@DependsOn(target = FalsingManager.class)
public interface FalsingPlugin extends Plugin {
    String ACTION = "com.android.systemui.action.FALSING_PLUGIN";
    int VERSION = 1;
    int VERSION = 2;

    /**
     * Called when there is data to be recorded.
@@ -35,5 +39,14 @@ public interface FalsingPlugin extends Plugin {
     * @param success Indicates whether the action is considered a success.
     * @param data The raw data to be recorded for analysis.
     */
    void dataCollected(boolean success, byte[] data);
    default void dataCollected(boolean success, byte[] data) { }

    /**
     * Return a {@link FalsingManager} to be used in place of the system's default.
     *
     * @param context
     */
    default FalsingManager getFalsingManager(Context context) {
        return null;
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.PluginDependencyProvider;
import com.android.systemui.plugins.VolumeDialogController;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -302,6 +303,7 @@ public class Dependency extends SystemUI {
    @Inject Lazy<DockManager> mDockManager;
    @Inject Lazy<ChannelEditorDialogController> mChannelEditorDialogController;
    @Inject Lazy<INotificationManager> mINotificationManager;
    @Inject Lazy<FalsingManager> mFalsingManager;

    @Inject
    public Dependency() {
@@ -479,6 +481,7 @@ public class Dependency extends SystemUI {
        mProviders.put(DockManager.class, mDockManager::get);
        mProviders.put(ChannelEditorDialogController.class, mChannelEditorDialogController::get);
        mProviders.put(INotificationManager.class, mINotificationManager::get);
        mProviders.put(FalsingManager.class, mFalsingManager::get);

        // TODO(b/118592525): to support multi-display , we start to add something which is
        //                    per-display, while others may be global. I think it's time to add
+7 −0
Original line number Diff line number Diff line
@@ -18,8 +18,10 @@ package com.android.systemui;

import com.android.systemui.appops.AppOpsController;
import com.android.systemui.appops.AppOpsControllerImpl;
import com.android.systemui.classifier.FalsingManagerProxy;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.VolumeDialogController;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.power.PowerNotificationWarnings;
@@ -234,4 +236,9 @@ public abstract class DependencyBinder {
     */
    @Binds
    public abstract QSHost provideQsHost(QSTileHost controllerImpl);

    /**
     */
    @Binds
    public abstract FalsingManager provideFalsingmanager(FalsingManagerProxy falsingManagerImpl);
}
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityEvent;

import com.android.systemui.classifier.FalsingManagerFactory;
import com.android.systemui.classifier.FalsingManagerFactory.FalsingManager;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.statusbar.FlingAnimationUtils;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
Loading