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

Commit 46121d2f authored by Dave Mankoff's avatar Dave Mankoff
Browse files

Show a small toast when a double tap is needed.

When falsing rejects a single tap, we now
show a toast on top of the shade and quick settings.

Bug: 188895666
Test: atest SystemUITests && manual
Change-Id: I9705803a57dc3ea4af987583c0eaeff2498fb288
parent 186fbcc2
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -129,7 +129,21 @@
            android:layout_marginTop="@dimen/status_bar_header_height_keyguard"
            android:text="@string/report_rejected_touch"
            android:visibility="gone" />

        <com.android.systemui.statusbar.phone.TapAgainView
            android:id="@+id/shade_falsing_tap_again"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            systemui:layout_constraintLeft_toLeftOf="parent"
            systemui:layout_constraintRight_toRightOf="parent"
            systemui:layout_constraintBottom_toBottomOf="parent"
            android:layout_marginBottom="20dp"
            android:paddingLeft="20dp"
            android:paddingRight="20dp"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:elevation="10dp"
            android:visibility="gone"
        />
    </com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer>

    <FrameLayout
+6 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ public class FalsingManagerFake implements FalsingManager {
    private boolean mIsFalseRobustTap;

    private final List<FalsingBeliefListener> mFalsingBeliefListeners = new ArrayList<>();
    private final List<FalsingTapListener> mTapListeners = new ArrayList<>();

    @Override
    public void onSuccessfulUnlock() {
@@ -148,11 +149,15 @@ public class FalsingManagerFake implements FalsingManager {

    @Override
    public void addTapListener(FalsingTapListener falsingTapListener) {

        mTapListeners.add(falsingTapListener);
    }

    @Override
    public void removeTapListener(FalsingTapListener falsingTapListener) {
        mTapListeners.remove(falsingTapListener);
    }

    public List<FalsingTapListener> getTapListeners() {
        return mTapListeners;
    }
}
+0 −1
Original line number Diff line number Diff line
@@ -142,7 +142,6 @@ public class KeyguardIndicationTextView extends TextView {
        Animator yTranslate =
                ObjectAnimator.ofFloat(this, View.TRANSLATION_Y, 0, -getYTranslationPixels());
        yTranslate.setDuration(getFadeOutDuration());
        fadeOut.setInterpolator(Interpolators.FAST_OUT_LINEAR_IN);
        animatorSet.playTogether(fadeOut, yTranslate);

        return animatorSet;
+6 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.util.AttributeSet;

import com.android.systemui.R;

public class NotificationPanelView extends PanelView {

    private static final boolean DEBUG = false;
@@ -92,6 +94,10 @@ public class NotificationPanelView extends PanelView {
        mRtlChangeListener = listener;
    }

    public TapAgainView getTapAgainView() {
        return findViewById(R.id.shade_falsing_tap_again);
    }

    interface RtlChangeListener {
        void onRtlPropertielsChanged(int layoutDirection);
    }
+19 −8
Original line number Diff line number Diff line
@@ -97,8 +97,8 @@ import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.dagger.qualifiers.DisplayId;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.doze.DozeLog;
import com.android.systemui.fragments.FragmentHostManager;
import com.android.systemui.fragments.FragmentHostManager.FragmentListener;
import com.android.systemui.fragments.FragmentService;
import com.android.systemui.media.KeyguardMediaController;
import com.android.systemui.media.MediaDataManager;
import com.android.systemui.media.MediaHierarchyManager;
@@ -306,6 +306,7 @@ public class NotificationPanelViewController extends PanelViewController {
    private final KeyguardUserSwitcherComponent.Factory mKeyguardUserSwitcherComponentFactory;
    private final KeyguardStatusBarViewComponent.Factory mKeyguardStatusBarViewComponentFactory;
    private final QSDetailDisplayer mQSDetailDisplayer;
    private final FragmentService mFragmentService;
    private final FeatureFlags mFeatureFlags;
    private final ScrimController mScrimController;
    private final PrivacyDotViewController mPrivacyDotViewController;
@@ -314,6 +315,7 @@ public class NotificationPanelViewController extends PanelViewController {
    // If there are exactly 1 + mMaxKeyguardNotifications, then still shows all notifications
    private final int mMaxKeyguardNotifications;
    private final LockscreenShadeTransitionController mLockscreenShadeTransitionController;
    private final TapAgainViewController mTapAgainViewController;
    private boolean mShouldUseSplitNotificationShade;
    // Current max allowed keyguard notifications determined by measuring the panel
    private int mMaxAllowedKeyguardNotifications;
@@ -603,7 +605,12 @@ public class NotificationPanelViewController extends PanelViewController {
    private final FalsingTapListener mFalsingTapListener = new FalsingTapListener() {
        @Override
        public void onDoubleTapRequired() {
            showTransientIndication(R.string.notification_tap_again);
            if (mStatusBarStateController.getState() == StatusBarState.SHADE_LOCKED) {
                mTapAgainViewController.show();
            } else {
                mKeyguardIndicationController.showTransientIndication(
                        R.string.notification_tap_again);
            }
            mVibratorHelper.vibrate(VibrationEffect.EFFECT_STRENGTH_MEDIUM);
        }
    };
@@ -652,6 +659,8 @@ public class NotificationPanelViewController extends PanelViewController {
            QuickAccessWalletClient quickAccessWalletClient,
            KeyguardMediaController keyguardMediaController,
            PrivacyDotViewController privacyDotViewController,
            TapAgainViewController tapAgainViewController,
            FragmentService fragmentService,
            @Main Executor uiExecutor,
            SecureSettings secureSettings) {
        super(view, falsingManager, dozeLog, keyguardStateController,
@@ -678,6 +687,7 @@ public class NotificationPanelViewController extends PanelViewController {
        mKeyguardQsUserSwitchComponentFactory = keyguardQsUserSwitchComponentFactory;
        mKeyguardUserSwitcherComponentFactory = keyguardUserSwitcherComponentFactory;
        mQSDetailDisplayer = qsDetailDisplayer;
        mFragmentService = fragmentService;
        mKeyguardUserSwitcherEnabled = mResources.getBoolean(
                com.android.internal.R.bool.config_keyguardUserSwitcher);
        mKeyguardQsUserSwitchEnabled =
@@ -704,6 +714,7 @@ public class NotificationPanelViewController extends PanelViewController {
        mUserManager = userManager;
        mMediaDataManager = mediaDataManager;
        mQuickAccessWalletClient = quickAccessWalletClient;
        mTapAgainViewController = tapAgainViewController;
        mUiExecutor = uiExecutor;
        mSecureSettings = secureSettings;
        pulseExpansionHandler.setPulseExpandAbortListener(() -> {
@@ -842,6 +853,8 @@ public class NotificationPanelViewController extends PanelViewController {
        if (mShouldUseSplitNotificationShade) {
            updateResources();
        }

        mTapAgainViewController.init();
    }

    @Override
@@ -3671,10 +3684,6 @@ public class NotificationPanelViewController extends PanelViewController {
        updateMaxDisplayedNotifications(true);
    }

    public void showTransientIndication(int id) {
        mKeyguardIndicationController.showTransientIndication(id);
    }

    public void setAlpha(float alpha) {
        mView.setAlpha(alpha);
    }
@@ -4260,7 +4269,8 @@ public class NotificationPanelViewController extends PanelViewController {
    private class OnAttachStateChangeListener implements View.OnAttachStateChangeListener {
        @Override
        public void onViewAttachedToWindow(View v) {
            FragmentHostManager.get(mView).addTagListener(QS.TAG, mFragmentListener);
            mFragmentService.getFragmentHostManager(mView)
                            .addTagListener(QS.TAG, mFragmentListener);
            mStatusBarStateController.addCallback(mStatusBarStateListener);
            mConfigurationController.addCallback(mConfigurationListener);
            mUpdateMonitor.registerCallback(mKeyguardUpdateCallback);
@@ -4274,7 +4284,8 @@ public class NotificationPanelViewController extends PanelViewController {

        @Override
        public void onViewDetachedFromWindow(View v) {
            FragmentHostManager.get(mView).removeTagListener(QS.TAG, mFragmentListener);
            mFragmentService.getFragmentHostManager(mView)
                            .removeTagListener(QS.TAG, mFragmentListener);
            mStatusBarStateController.removeCallback(mStatusBarStateListener);
            mConfigurationController.removeCallback(mConfigurationListener);
            mUpdateMonitor.removeCallback(mKeyguardUpdateCallback);
Loading