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

Commit 5f1bab52 authored by Lucas Dupin's avatar Lucas Dupin Committed by android-build-merger
Browse files

Merge changes Ia438f4a2,I356c2d57 into pi-dev

am: f5d216cc

Change-Id: I9d5b266c1ebe8f72fea98516add59a3abe434fbb
parents 41e229ae f5d216cc
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui;

import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.util.Assert;

import android.os.Handler;
@@ -30,9 +31,13 @@ public class DejankUtils {

    private static final Choreographer sChoreographer = Choreographer.getInstance();
    private static final Handler sHandler = new Handler();

    private static final ArrayList<Runnable> sPendingRunnables = new ArrayList<>();

    /**
     * Only for testing.
     */
    private static boolean sImmediate;

    private static final Runnable sAnimationCallbackRunnable = new Runnable() {
        @Override
        public void run() {
@@ -51,6 +56,10 @@ public class DejankUtils {
     * <p>Needs to be called from the main thread.
     */
    public static void postAfterTraversal(Runnable r) {
        if (sImmediate) {
            r.run();
            return;
        }
        Assert.isMainThread();
        sPendingRunnables.add(r);
        postAnimationCallback();
@@ -71,4 +80,9 @@ public class DejankUtils {
        sChoreographer.postCallback(Choreographer.CALLBACK_ANIMATION, sAnimationCallbackRunnable,
                null);
    }

    @VisibleForTesting
    public static void setImmediate(boolean immediate) {
        sImmediate = immediate;
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.internal.logging.MetricsLogger;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.Dependency.DependencyProvider;
import com.android.systemui.classifier.FalsingManager;
import com.android.systemui.keyguard.DismissCallbackRegistry;
import com.android.systemui.qs.QSTileHost;
import com.android.systemui.statusbar.KeyguardIndicationController;
@@ -95,7 +96,7 @@ public class SystemUIFactory {
            LockPatternUtils lockPatternUtils,
            ViewGroup container, DismissCallbackRegistry dismissCallbackRegistry) {
        return new KeyguardBouncer(context, callback, lockPatternUtils, container,
                dismissCallbackRegistry);
                dismissCallbackRegistry, FalsingManager.getInstance(context));
    }

    public ScrimController createScrimController(LightBarController lightBarController,
+32 −12
Original line number Diff line number Diff line
@@ -16,10 +16,14 @@

package com.android.systemui.statusbar.phone;

import static com.android.keyguard.KeyguardHostView.OnDismissAction;
import static com.android.keyguard.KeyguardSecurityModel.SecurityMode;

import android.content.Context;
import android.os.Handler;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;
import android.util.MathUtils;
import android.util.Slog;
import android.util.StatsLog;
@@ -29,7 +33,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowInsets;
import android.view.accessibility.AccessibilityEvent;

import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardHostView;
@@ -42,9 +45,6 @@ import com.android.systemui.DejankUtils;
import com.android.systemui.classifier.FalsingManager;
import com.android.systemui.keyguard.DismissCallbackRegistry;

import static com.android.keyguard.KeyguardHostView.OnDismissAction;
import static com.android.keyguard.KeyguardSecurityModel.SecurityMode;

/**
 * A class which manages the bouncer on the lockscreen.
 */
@@ -76,13 +76,13 @@ public class KeyguardBouncer {

    public KeyguardBouncer(Context context, ViewMediatorCallback callback,
            LockPatternUtils lockPatternUtils, ViewGroup container,
            DismissCallbackRegistry dismissCallbackRegistry) {
            DismissCallbackRegistry dismissCallbackRegistry, FalsingManager falsingManager) {
        mContext = context;
        mCallback = callback;
        mLockPatternUtils = lockPatternUtils;
        mContainer = container;
        KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallback);
        mFalsingManager = FalsingManager.getInstance(mContext);
        mFalsingManager = falsingManager;
        mDismissCallbackRegistry = dismissCallbackRegistry;
        mHandler = new Handler();
    }
@@ -91,7 +91,14 @@ public class KeyguardBouncer {
        show(resetSecuritySelection, true /* notifyFalsing */);
    }

    public void show(boolean resetSecuritySelection, boolean notifyFalsing) {
    /**
     * Shows the bouncer.
     *
     * @param resetSecuritySelection Cleans keyguard view
     * @param animated true when the bouncer show show animated, false when the user will be
     *                 dragging it and animation should be deferred.
     */
    public void show(boolean resetSecuritySelection, boolean animated) {
        final int keyguardUserId = KeyguardUpdateMonitor.getCurrentUser();
        if (keyguardUserId == UserHandle.USER_SYSTEM && UserManager.isSplitSystemUser()) {
            // In split system user mode, we never unlock system user.
@@ -104,9 +111,11 @@ public class KeyguardBouncer {
        // are valid.
        // Later, at the end of the animation, when the bouncer is at the top of the screen,
        // onFullyShown() will be called and FalsingManager will stop recording touches.
        if (notifyFalsing) {
        if (animated) {
            mFalsingManager.onBouncerShown();
            setExpansion(0);
        }

        if (resetSecuritySelection) {
            // showPrimarySecurityScreen() updates the current security method. This is needed in
            // case we are already showing and the current security method changed.
@@ -157,7 +166,9 @@ public class KeyguardBouncer {
    public void onFullyHidden() {
        if (!mShowingSoon) {
            cancelShowRunnable();
            if (mRoot != null) {
                mRoot.setVisibility(View.INVISIBLE);
            }
            mFalsingManager.onBouncerHidden();
        }
    }
@@ -202,11 +213,19 @@ public class KeyguardBouncer {
     *               and {@link KeyguardSecurityView#PROMPT_REASON_RESTART}
     */
    public void showPromptReason(int reason) {
        if (mKeyguardView != null) {
            mKeyguardView.showPromptReason(reason);
        } else {
            Log.w(TAG, "Trying to show prompt reason on empty bouncer");
        }
    }

    public void showMessage(String message, int color) {
        if (mKeyguardView != null) {
            mKeyguardView.showMessage(message, color);
        } else {
            Log.w(TAG, "Trying to show message on empty bouncer");
        }
    }

    private void cancelShowRunnable() {
@@ -290,7 +309,8 @@ public class KeyguardBouncer {
     */
    public void setExpansion(float fraction) {
        if (mKeyguardView != null) {
            mKeyguardView.setAlpha(MathUtils.map(ALPHA_EXPANSION_THRESHOLD, 1, 1, 0, fraction));
            float alpha = MathUtils.map(ALPHA_EXPANSION_THRESHOLD, 1, 1, 0, fraction);
            mKeyguardView.setAlpha(MathUtils.constrain(alpha, 0f, 1f));
            mKeyguardView.setTranslationY(fraction * mKeyguardView.getHeight());
        }
    }
+11 −0
Original line number Diff line number Diff line
@@ -947,6 +947,17 @@ public abstract class PanelView extends FrameLayout {
        return mClosing || mLaunchingNotification;
    }

    /**
     * Bouncer might need a scrim when you double tap on notifications or edit QS.
     * On other cases, when you drag up the bouncer with the finger or just fling,
     * the scrim should be hidden to avoid occluding the clock.
     *
     * @return true when we need a scrim to show content on top of the notification panel.
     */
    public boolean needsScrimming() {
        return !isTracking() && !isCollapsing() && !isFullyCollapsed();
    }

    public boolean isTracking() {
        return mTracking;
    }
+1 −1
Original line number Diff line number Diff line
@@ -449,7 +449,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
        if (mNeedsDrawableColorUpdate) {
            mNeedsDrawableColorUpdate = false;
            final GradientColors currentScrimColors;
            if (mState == ScrimState.KEYGUARD || mState == ScrimState.BOUNCER_OCCLUDED
            if (mState == ScrimState.KEYGUARD || mState == ScrimState.BOUNCER_SCRIMMED
                    || mState == ScrimState.BOUNCER) {
                // Always animate color changes if we're seeing the keyguard
                mScrimInFront.setColors(mLockColors, true /* animated */);
Loading