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

Commit dde5ee69 authored by Dave Mankoff's avatar Dave Mankoff
Browse files

Change FalsingManager to an interface for easier swapping.

This is a refactor. It touches a lot of files, but zero functionality.
The primary change is changing FalsingManager.getInstance() into
FalsingManagerFactory.getInstance(); chaning FalsingManager into an
interface, and then turning the existing FalsingManager into
FalsingManagerImpl, an implementation of that interface. Other changes
are merely references to those classes.

Bug: 130256776
Test: atest SystemUITests
Change-Id: I5d64a7673e4efc554105dd841b27807361ed3828
parent 82f3599b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.SystemUIFactory;
import com.android.systemui.classifier.FalsingLog;
import com.android.systemui.classifier.FalsingManager;
import com.android.systemui.classifier.FalsingManagerFactory;
import com.android.systemui.fragments.FragmentHostManager;
import com.android.systemui.plugins.qs.QS;
import com.android.systemui.qs.car.CarQSFragment;
@@ -794,7 +794,7 @@ public class CarStatusBar extends StatusBar implements
            KeyguardUpdateMonitor.getInstance(mContext).dump(fd, pw, args);
        }

        FalsingManager.getInstance(mContext).dump(pw);
        FalsingManagerFactory.getInstance(mContext).dump(pw);
        FalsingLog.dump(pw);

        pw.println("SharedPreferences:");
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ 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.FalsingManager}.
 * {@link com.android.systemui.classifier.FalsingManagerFactory.FalsingManager}.
 */
@ProvidesInterface(action = FalsingPlugin.ACTION, version = FalsingPlugin.VERSION)
public interface FalsingPlugin extends Plugin {
+3 −2
Original line number Diff line number Diff line
@@ -34,7 +34,8 @@ import android.view.View;
import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityEvent;

import com.android.systemui.classifier.FalsingManager;
import com.android.systemui.classifier.FalsingManagerFactory;
import com.android.systemui.classifier.FalsingManagerFactory.FalsingManager;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.statusbar.FlingAnimationUtils;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
@@ -112,7 +113,7 @@ public class SwipeHelper implements Gefingerpoken {
        mDensityScale =  res.getDisplayMetrics().density;
        mFalsingThreshold = res.getDimensionPixelSize(R.dimen.swipe_helper_falsing_threshold);
        mFadeDependingOnAmountSwiped = res.getBoolean(R.bool.config_fadeDependingOnAmountSwiped);
        mFalsingManager = FalsingManager.getInstance(context);
        mFalsingManager = FalsingManagerFactory.getInstance(context);
        mFlingAnimationUtils = new FlingAnimationUtils(context, getMaxEscapeAnimDuration() / 1000f);
    }

+4 −3
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.assist.AssistManager;
import com.android.systemui.classifier.FalsingManager;
import com.android.systemui.classifier.FalsingManagerFactory;
import com.android.systemui.dock.DockManager;
import com.android.systemui.fragments.FragmentService;
import com.android.systemui.keyguard.DismissCallbackRegistry;
@@ -129,8 +129,9 @@ public class SystemUIFactory {
            DismissCallbackRegistry dismissCallbackRegistry,
            KeyguardBouncer.BouncerExpansionCallback expansionCallback) {
        return new KeyguardBouncer(context, callback, lockPatternUtils, container,
                dismissCallbackRegistry, FalsingManager.getInstance(context), expansionCallback,
                KeyguardUpdateMonitor.getInstance(context), new Handler(Looper.getMainLooper()));
                dismissCallbackRegistry, FalsingManagerFactory.getInstance(context),
                expansionCallback, KeyguardUpdateMonitor.getInstance(context),
                new Handler(Looper.getMainLooper()));
    }

    public ScrimController createScrimController(ScrimView scrimBehind, ScrimView scrimInFront,
+116 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 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.content.Context;
import android.net.Uri;
import android.view.MotionEvent;

import java.io.PrintWriter;

/**
 * When the phone is locked, listens to touch, sensor and phone events and sends them to
 * DataCollector and HumanInteractionClassifier.
 *
 * It does not collect touch events when the bouncer shows up.
 */
public class FalsingManagerFactory {
    private static FalsingManager sInstance = null;

    private FalsingManagerFactory() {}

    public static FalsingManager getInstance(Context context) {
        if (sInstance == null) {
            sInstance = new FalsingManagerImpl(context);
        }
        return sInstance;
    }

    public interface FalsingManager {
        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);
    }
}
Loading