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

Commit 15455f2c authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/24248316',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/24248316', 'googleplex-android-review.googlesource.com/24281855', 'googleplex-android-review.googlesource.com/24026547', 'googleplex-android-review.googlesource.com/24284551', 'googleplex-android-review.googlesource.com/24034687'] into sparse-10615697-L90400000962407107.
SPARSE_CHANGE: Iaffbb53b29578c0575a7737c8aacdc8ca547b426
SPARSE_CHANGE: Id2e796edee45dae281f867c2b1549a80984c8a8e
SPARSE_CHANGE: I35df87ef05cb75dcd551cc4899a0a9863fdcbcc7
SPARSE_CHANGE: I890d102d10a3efa230e26e4e9753f9c66b71afdb
SPARSE_CHANGE: I67149c6faa2766be6d2537f2315dd2734bdd0447

Change-Id: I4931755494c45d9122f70e20665069a8102ed55a
parents d57c8563 daa23804
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -786,8 +786,6 @@ public class KeyguardSecurityContainer extends ConstraintLayout {

    void reloadColors() {
        mViewMode.reloadColors();
        setBackgroundColor(Utils.getColorAttrDefaultColor(getContext(),
                com.android.internal.R.attr.materialColorSurface));
    }

    /** Handles density or font scale changes. */
+77 −5
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ import android.view.WindowManagerPolicyConstants;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
@@ -167,6 +168,8 @@ import com.android.wm.shell.keyguard.KeyguardTransitions;
import dagger.Lazy;

import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Objects;
@@ -251,6 +254,22 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
    private static final int SYSTEM_READY = 18;
    private static final int CANCEL_KEYGUARD_EXIT_ANIM = 19;

    /** Enum for reasons behind updating wakeAndUnlock state. */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(
            value = {
                    WakeAndUnlockUpdateReason.HIDE,
                    WakeAndUnlockUpdateReason.SHOW,
                    WakeAndUnlockUpdateReason.FULFILL,
                    WakeAndUnlockUpdateReason.WAKE_AND_UNLOCK,
            })
    @interface WakeAndUnlockUpdateReason {
        int HIDE = 0;
        int SHOW = 1;
        int FULFILL = 2;
        int WAKE_AND_UNLOCK = 3;
    }

    /**
     * The default amount of time we stay awake (used for all key input)
     */
@@ -812,7 +831,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
            // dreaming. It's time to wake up.
            if (mUnlockingAndWakingFromDream) {
                Log.d(TAG, "waking from dream after unlock");
                mUnlockingAndWakingFromDream = false;
                setUnlockAndWakeFromDream(false, WakeAndUnlockUpdateReason.FULFILL);

                if (mKeyguardStateController.isShowing()) {
                    Log.d(TAG, "keyguard showing after keyguardGone, dismiss");
@@ -2654,7 +2673,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,

            mKeyguardExitAnimationRunner = null;
            mWakeAndUnlocking = false;
            mUnlockingAndWakingFromDream = false;
            setUnlockAndWakeFromDream(false, WakeAndUnlockUpdateReason.SHOW);
            setPendingLock(false);

            // Force if we we're showing in the middle of hiding, to ensure we end up in the correct
@@ -2760,6 +2779,51 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
        tryKeyguardDone();
    };

    private void setUnlockAndWakeFromDream(boolean updatedValue,
            @WakeAndUnlockUpdateReason int reason) {
        if (updatedValue == mUnlockingAndWakingFromDream) {
            return;
        }

        final String reasonDescription;

        switch(reason) {
            case WakeAndUnlockUpdateReason.FULFILL:
                reasonDescription = "fulfilling existing request";
                break;
            case WakeAndUnlockUpdateReason.HIDE:
                reasonDescription = "hiding keyguard";
                break;
            case WakeAndUnlockUpdateReason.SHOW:
                reasonDescription = "showing keyguard";
                break;
            case WakeAndUnlockUpdateReason.WAKE_AND_UNLOCK:
                reasonDescription = "waking to unlock";
                break;
            default:
                throw new IllegalStateException("Unexpected value: " + reason);
        }

        final boolean unsetUnfulfilled = !updatedValue
                && reason != WakeAndUnlockUpdateReason.FULFILL;

        mUnlockingAndWakingFromDream = updatedValue;

        final String description;

        if (unsetUnfulfilled) {
            description = "Interrupting request to wake and unlock";
        } else if (mUnlockingAndWakingFromDream) {
            description = "Initiating request to wake and unlock";
        } else {
            description = "Fulfilling request to wake and unlock";
        }

        Log.d(TAG, String.format(
                "Updating waking and unlocking request to %b. description:[%s]. reason:[%s]",
                mUnlockingAndWakingFromDream,  description, reasonDescription));
    }

    /**
     * Handle message sent by {@link #hideLocked()}
     * @see #HIDE
@@ -2779,8 +2843,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,

            mHiding = true;

            mUnlockingAndWakingFromDream = mStatusBarStateController.isDreaming()
                    && !mStatusBarStateController.isDozing();
            // If waking and unlocking, waking from dream has been set properly.
            if (!mWakeAndUnlocking) {
                setUnlockAndWakeFromDream(mStatusBarStateController.isDreaming()
                        && mPM.isInteractive(), WakeAndUnlockUpdateReason.HIDE);
            }

            if ((mShowing && !mOccluded) || mUnlockingAndWakingFromDream) {
                if (mUnlockingAndWakingFromDream) {
@@ -3282,9 +3349,14 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
        }
    }

    public void onWakeAndUnlocking() {
    /**
     * Informs the keyguard view mediator that the device is waking and unlocking.
     * @param fromDream Whether waking and unlocking is happening over an interactive dream.
     */
    public void onWakeAndUnlocking(boolean fromDream) {
        Trace.beginSection("KeyguardViewMediator#onWakeAndUnlocking");
        mWakeAndUnlocking = true;
        setUnlockAndWakeFromDream(fromDream, WakeAndUnlockUpdateReason.WAKE_AND_UNLOCK);

        mKeyguardViewControllerLazy.get().notifyKeyguardAuthenticated(/* primaryAuth */ false);
        userActivity();
+2 −2
Original line number Diff line number Diff line
@@ -463,7 +463,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
        };

        final boolean wakingFromDream = mMode == MODE_WAKE_AND_UNLOCK_FROM_DREAM
                && !mStatusBarStateController.isDozing();
                && mPowerManager.isInteractive();

        if (mMode != MODE_NONE && !wakingFromDream) {
            wakeUp.run();
@@ -501,7 +501,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
                    // later to awaken.
                }
                mNotificationShadeWindowController.setNotificationShadeFocusable(false);
                mKeyguardViewMediator.onWakeAndUnlocking();
                mKeyguardViewMediator.onWakeAndUnlocking(wakingFromDream);
                Trace.endSection();
                break;
            case MODE_ONLY_WAKE:
+7 −0
Original line number Diff line number Diff line
@@ -1509,6 +1509,13 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
            mColors.setSupportsDarkText(
                    ColorUtils.calculateContrast(mColors.getMainColor(), Color.WHITE) > 4.5);
        }

        int surface = Utils.getColorAttr(mScrimBehind.getContext(),
                com.android.internal.R.attr.materialColorSurface).getDefaultColor();
        for (ScrimState state : ScrimState.values()) {
            state.setSurfaceColor(surface);
        }

        mNeedsDrawableColorUpdate = true;
    }

+14 −1
Original line number Diff line number Diff line
@@ -122,11 +122,19 @@ public enum ScrimState {
        @Override
        public void prepare(ScrimState previousState) {
            mBehindAlpha = mClipQsScrim ? 1 : mDefaultScrimAlpha;
            mBehindTint = mClipQsScrim ? Color.BLACK : Color.TRANSPARENT;
            mBehindTint = mClipQsScrim ? Color.BLACK : mSurfaceColor;
            mNotifAlpha = mClipQsScrim ? mDefaultScrimAlpha : 0;
            mNotifTint = Color.TRANSPARENT;
            mFrontAlpha = 0f;
        }

        @Override
        public void setSurfaceColor(int surfaceColor) {
            super.setSurfaceColor(surfaceColor);
            if (!mClipQsScrim) {
                mBehindTint = mSurfaceColor;
            }
        }
    },

    /**
@@ -295,6 +303,7 @@ public enum ScrimState {
    int mFrontTint = Color.TRANSPARENT;
    int mBehindTint = Color.TRANSPARENT;
    int mNotifTint = Color.TRANSPARENT;
    int mSurfaceColor = Color.TRANSPARENT;

    boolean mAnimateChange = true;
    float mAodFrontScrimAlpha;
@@ -409,6 +418,10 @@ public enum ScrimState {
        mDefaultScrimAlpha = defaultScrimAlpha;
    }

    public void setSurfaceColor(int surfaceColor) {
        mSurfaceColor = surfaceColor;
    }

    public void setWallpaperSupportsAmbientMode(boolean wallpaperSupportsAmbientMode) {
        mWallpaperSupportsAmbientMode = wallpaperSupportsAmbientMode;
    }
Loading