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

Commit 9190766f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Use Launcher smartspace instead of SysUI's for the shared element...

Merge "Use Launcher smartspace instead of SysUI's for the shared element transition." into tm-dev am: 7b5e80f2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17892808



Change-Id: I60c0027c0cdbb725911f58bc0db32a951306d1dc
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 6af80881 7b5e80f2
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -16,17 +16,20 @@

package com.android.systemui.shared.system.smartspace;

import android.graphics.Rect;
import com.android.systemui.shared.system.smartspace.SmartspaceState;

// Methods for System UI to interface with Launcher to perform the unlock animation.
interface ILauncherUnlockAnimationController {
    // Prepares Launcher for the unlock animation by setting scale/alpha/etc. to their starting
    // values.
    void prepareForUnlock(boolean willAnimateSmartspace, int selectedPage);
    void prepareForUnlock(boolean animateSmartspace, in Rect lockscreenSmartspaceBounds,
        int selectedPage);

    // Set the unlock percentage. This is used when System UI is controlling each frame of the
    // unlock animation, such as during a swipe to unlock touch gesture.
    oneway void setUnlockAmount(float amount);
    // unlock animation, such as during a swipe to unlock touch gesture. Will not apply this change
    // if the unlock amount is animating unless forceIfAnimating is true.
    oneway void setUnlockAmount(float amount, boolean forceIfAnimating);

    // Play a full unlock animation from 0f to 1f. This is used when System UI is unlocking from a
    // single action, such as biometric auth, and doesn't need to control individual frames.
+0 −45
Original line number Diff line number Diff line
@@ -58,9 +58,7 @@ import com.android.systemui.util.ViewController;
import com.android.systemui.util.settings.SecureSettings;

import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.Executor;

@@ -133,14 +131,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
    private final KeyguardUnlockAnimationController.KeyguardUnlockAnimationListener
            mKeyguardUnlockAnimationListener =
            new KeyguardUnlockAnimationController.KeyguardUnlockAnimationListener() {
                @Override
                public void onSmartspaceSharedElementTransitionStarted() {
                    // The smartspace needs to be able to translate out of bounds in order to
                    // end up where the launcher's smartspace is, while its container is being
                    // swiped off the top of the screen.
                    setClipChildrenForUnlock(false);
                }

                @Override
                public void onUnlockAnimationFinished() {
                    // For performance reasons, reset this once the unlock animation ends.
@@ -390,41 +380,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
        if (mStatusArea != null) {
            PropertyAnimator.setProperty(mStatusArea, AnimatableProperty.TRANSLATION_X,
                    x, props, animate);

            // If we're unlocking with the SmartSpace shared element transition, let the controller
            // know that it should re-position our SmartSpace.
            if (mKeyguardUnlockAnimationController.isUnlockingWithSmartSpaceTransition()) {
                mKeyguardUnlockAnimationController.updateLockscreenSmartSpacePosition();
            }
        }
    }

    /** Sets an alpha value on every child view except for the smartspace. */
    public void setChildrenAlphaExcludingSmartspace(float alpha) {
        final Set<View> excludedViews = new HashSet<>();

        if (mSmartspaceView != null) {
            excludedViews.add(mStatusArea);
        }

        // Don't change the alpha of the invisible clock.
        if (mCurrentClockSize == LARGE) {
            excludedViews.add(mClockFrame);
        } else {
            excludedViews.add(mLargeClockFrame);
        }

        setChildrenAlphaExcluding(alpha, excludedViews);
    }

    /** Sets an alpha value on every child view except for the views in the provided set. */
    public void setChildrenAlphaExcluding(float alpha, Set<View> excludedViews) {
        for (int i = 0; i < mView.getChildCount(); i++) {
            final View child = mView.getChildAt(i);

            if (!excludedViews.contains(child)) {
                child.setAlpha(alpha);
            }
        }
    }

+0 −22
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ public class KeyguardStatusView extends GridLayout {

    private float mDarkAmount = 0;
    private int mTextColor;
    private float mChildrenAlphaExcludingSmartSpace = 1f;

    public KeyguardStatusView(Context context) {
        this(context, null, 0);
@@ -95,23 +94,6 @@ public class KeyguardStatusView extends GridLayout {
        mClockView.setTextColor(blendedTextColor);
    }

    public void setChildrenAlphaExcludingClockView(float alpha) {
        setChildrenAlphaExcluding(alpha, Set.of(mClockView));
    }

    /** Sets an alpha value on every view except for the views in the provided set. */
    public void setChildrenAlphaExcluding(float alpha, Set<View> excludedViews) {
        mChildrenAlphaExcludingSmartSpace = alpha;

        for (int i = 0; i < mStatusViewContainer.getChildCount(); i++) {
            final View child = mStatusViewContainer.getChildAt(i);

            if (!excludedViews.contains(child)) {
                child.setAlpha(alpha);
            }
        }
    }

    /** Sets a translationY value on every child view except for the media view. */
    public void setChildrenTranslationYExcludingMediaView(float translationY) {
        setChildrenTranslationYExcluding(translationY, Set.of(mMediaHostContainer));
@@ -128,10 +110,6 @@ public class KeyguardStatusView extends GridLayout {
        }
    }

    public float getChildrenAlphaExcludingSmartSpace() {
        return mChildrenAlphaExcludingSmartSpace;
    }

    public void dump(PrintWriter pw, String[] args) {
        pw.println("KeyguardStatusView:");
        pw.println("  mDarkAmount: " + mDarkAmount);
+1 −41
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.graphics.Rect;
import android.util.Slog;

import com.android.keyguard.KeyguardClockSwitch.ClockSize;
import com.android.systemui.keyguard.KeyguardUnlockAnimationController;
import com.android.systemui.statusbar.notification.AnimatableProperty;
import com.android.systemui.statusbar.notification.PropertyAnimator;
import com.android.systemui.statusbar.notification.stack.AnimationProperties;
@@ -49,10 +48,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
    private final KeyguardClockSwitchController mKeyguardClockSwitchController;
    private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
    private final ConfigurationController mConfigurationController;
    private final DozeParameters mDozeParameters;
    private final KeyguardVisibilityHelper mKeyguardVisibilityHelper;
    private final KeyguardUnlockAnimationController mKeyguardUnlockAnimationController;
    private final KeyguardStateController mKeyguardStateController;
    private final Rect mClipBounds = new Rect();

    @Inject
@@ -64,18 +60,14 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
            KeyguardUpdateMonitor keyguardUpdateMonitor,
            ConfigurationController configurationController,
            DozeParameters dozeParameters,
            KeyguardUnlockAnimationController keyguardUnlockAnimationController,
            ScreenOffAnimationController screenOffAnimationController) {
        super(keyguardStatusView);
        mKeyguardSliceViewController = keyguardSliceViewController;
        mKeyguardClockSwitchController = keyguardClockSwitchController;
        mKeyguardUpdateMonitor = keyguardUpdateMonitor;
        mConfigurationController = configurationController;
        mDozeParameters = dozeParameters;
        mKeyguardStateController = keyguardStateController;
        mKeyguardVisibilityHelper = new KeyguardVisibilityHelper(mView, keyguardStateController,
                dozeParameters, screenOffAnimationController, /* animateYPos= */ true);
        mKeyguardUnlockAnimationController = keyguardUnlockAnimationController;
    }

    @Override
@@ -87,14 +79,12 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
    protected void onViewAttached() {
        mKeyguardUpdateMonitor.registerCallback(mInfoCallback);
        mConfigurationController.addCallback(mConfigurationListener);
        mKeyguardStateController.addCallback(mKeyguardStateControllerCallback);
    }

    @Override
    protected void onViewDetached() {
        mKeyguardUpdateMonitor.removeCallback(mInfoCallback);
        mConfigurationController.removeCallback(mConfigurationListener);
        mKeyguardStateController.removeCallback(mKeyguardStateControllerCallback);
    }

    /**
@@ -148,24 +138,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
     */
    public void setAlpha(float alpha) {
        if (!mKeyguardVisibilityHelper.isVisibilityAnimating()) {
            // If we're capable of performing the SmartSpace shared element transition, and we are
            // going to (we're swiping to dismiss vs. bringing up the PIN screen), then fade out
            // everything except for the SmartSpace.
            if (mKeyguardUnlockAnimationController.isUnlockingWithSmartSpaceTransition()) {
                mView.setChildrenAlphaExcludingClockView(alpha);
                mKeyguardClockSwitchController.setChildrenAlphaExcludingSmartspace(alpha);
            } else if (!mKeyguardVisibilityHelper.isVisibilityAnimating()) {
                // Otherwise, we can just set the alpha for the entire container.
            mView.setAlpha(alpha);

                // If we previously unlocked with the shared element transition, some child views
                // might still have alpha = 0f. Set them back to 1f since we're just using the
                // parent container's alpha.
                if (mView.getChildrenAlphaExcludingSmartSpace() < 1f) {
                    mView.setChildrenAlphaExcludingClockView(1f);
                    mKeyguardClockSwitchController.setChildrenAlphaExcludingSmartspace(1f);
                }
            }
        }
    }

@@ -289,19 +262,6 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
        }
    };

    private KeyguardStateController.Callback mKeyguardStateControllerCallback =
            new KeyguardStateController.Callback() {
        @Override
        public void onKeyguardShowingChanged() {
            // If we explicitly re-show the keyguard, make sure that all the child views are
            // visible. They might have been animating out as part of the SmartSpace shared
            // element transition.
            if (mKeyguardStateController.isShowing()) {
                mView.setChildrenAlphaExcludingClockView(1f);
            }
        }
    };

    /**
     * Rect that specifies how KSV should be clipped, on its parent's coordinates.
     */
+239 −401

File changed.

Preview size limit exceeded, changes collapsed.

Loading