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

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

Snap for 12742097 from f274d3ca to 25Q1-release

Change-Id: Iabe3a51adf01a05806e36a3c0274ecb4166fef1b
parents 63d08c4e f274d3ca
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ import android.view.ViewTreeObserver;
import android.view.animation.Interpolator;
import android.widget.HorizontalScrollView;
import android.widget.TextView;
import android.window.OnBackInvokedDispatcher;
import android.window.WindowOnBackInvokedDispatcher;

import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
@@ -109,6 +111,8 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {

    @Nullable private AnimatorSet mOpenAnimation;

    private boolean mIsBackCallbackRegistered = false;

    @Nullable private KeyboardQuickSwitchViewController.ViewCallbacks mViewCallbacks;

    public KeyboardQuickSwitchView(@NonNull Context context) {
@@ -158,6 +162,34 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
        mIsRtl = Utilities.isRtl(resources);
    }

    private void registerOnBackInvokedCallback() {
        OnBackInvokedDispatcher dispatcher = findOnBackInvokedDispatcher();

        if (isOnBackInvokedCallbackEnabled(dispatcher)
                && !mIsBackCallbackRegistered) {
            dispatcher.registerOnBackInvokedCallback(
                    OnBackInvokedDispatcher.PRIORITY_OVERLAY, mViewCallbacks.onBackInvokedCallback);
            mIsBackCallbackRegistered = true;
        }
    }

    private void unregisterOnBackInvokedCallback() {
        OnBackInvokedDispatcher dispatcher = findOnBackInvokedDispatcher();

        if (isOnBackInvokedCallbackEnabled(dispatcher)
                && mIsBackCallbackRegistered) {
            dispatcher.unregisterOnBackInvokedCallback(
                    mViewCallbacks.onBackInvokedCallback);
            mIsBackCallbackRegistered = false;
        }
    }

    private boolean isOnBackInvokedCallbackEnabled(OnBackInvokedDispatcher dispatcher) {
        return dispatcher instanceof WindowOnBackInvokedDispatcher
                && ((WindowOnBackInvokedDispatcher) dispatcher).isOnBackInvokedCallbackEnabled()
                && mViewCallbacks != null;
    }

    private KeyboardQuickSwitchTaskView createAndAddTaskView(
            int index,
            boolean isFinalView,
@@ -277,6 +309,7 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
                new ViewTreeObserver.OnGlobalLayoutListener() {
                    @Override
                    public void onGlobalLayout() {
                        registerOnBackInvokedCallback();
                        animateOpen(currentFocusIndexOverride);

                        getViewTreeObserver().removeOnGlobalLayoutListener(this);
@@ -293,6 +326,9 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
    }

    void resetViewCallbacks() {
        // Unregister the back invoked callback after the view is closed and before the
        // mViewCallbacks is reset.
        unregisterOnBackInvokedCallback();
        mViewCallbacks = null;
    }

+2 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.animation.AnimationUtils;
import android.window.OnBackInvokedCallback;
import android.window.RemoteTransition;

import androidx.annotation.NonNull;
@@ -331,6 +332,7 @@ public class KeyboardQuickSwitchViewController {
    }

    class ViewCallbacks {
        public final OnBackInvokedCallback onBackInvokedCallback = () -> closeQuickSwitchView(true);

        boolean onKeyUp(int keyCode, KeyEvent event, boolean isRTL, boolean allowTraversal) {
            if (keyCode != KeyEvent.KEYCODE_TAB
+41 −2
Original line number Diff line number Diff line
@@ -69,14 +69,17 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
    public static final int ALL_APPS_PAGE_PROGRESS_INDEX = 1;
    public static final int WIDGETS_PAGE_PROGRESS_INDEX = 2;
    public static final int SYSUI_SURFACE_PROGRESS_INDEX = 3;
    public static final int LAUNCHER_PAUSE_PROGRESS_INDEX = 4;

    public static final int DISPLAY_PROGRESS_COUNT = 4;
    public static final int DISPLAY_PROGRESS_COUNT = 5;

    private final AnimatedFloat mTaskbarInAppDisplayProgress = new AnimatedFloat(
            this::onInAppDisplayProgressChanged);
    private final MultiPropertyFactory<AnimatedFloat> mTaskbarInAppDisplayProgressMultiProp =
            new MultiPropertyFactory<>(mTaskbarInAppDisplayProgress,
                    AnimatedFloat.VALUE, DISPLAY_PROGRESS_COUNT, Float::max);
    private final AnimatedFloat mLauncherPauseProgress = new AnimatedFloat(
            this::onLauncherPauseProgressUpdate);

    private final QuickstepLauncher mLauncher;
    private final HomeVisibilityState mHomeState;
@@ -499,7 +502,8 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
                "MINUS_ONE_PAGE_PROGRESS_INDEX",
                "ALL_APPS_PAGE_PROGRESS_INDEX",
                "WIDGETS_PAGE_PROGRESS_INDEX",
                "SYSUI_SURFACE_PROGRESS_INDEX");
                "SYSUI_SURFACE_PROGRESS_INDEX",
                "LAUNCHER_PAUSE_PROGRESS_INDEX");

        mTaskbarLauncherStateController.dumpLogs(prefix + "\t", pw);
    }
@@ -529,4 +533,39 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
            mLauncher.getWorkspace().onOverlayScrollChanged(0);
        }
    }

    /**
     * Called when Launcher Activity resumed while staying at home.
     * <p>
     * Shift nav buttons up to at-home position.
     */
    public void onLauncherResume() {
        mLauncherPauseProgress.animateToValue(0.0f).start();
    }

    /**
     * Called when Launcher Activity paused while staying at home.
     * <p>
     * To avoid UI clash between taskbar & bottom sheet, shift nav buttons down to in-app position.
     */
    public void onLauncherPause() {
        mLauncherPauseProgress.animateToValue(1.0f).start();
    }

    /**
     * On launcher stop, avoid animating taskbar & overriding pre-existing animations.
     */
    public void onLauncherStop() {
        mLauncherPauseProgress.cancelAnimation();
        mLauncherPauseProgress.updateValue(0.0f);
    }

    private void onLauncherPauseProgressUpdate() {
        // If we are not aligned with hotseat, setting this will clobber the 3 button nav position.
        // So in that case, treat the progress as 0 instead.
        float pauseProgress = isIconAlignedWithHotseat() ? mLauncherPauseProgress.value : 0;
        onTaskbarInAppDisplayProgressUpdate(pauseProgress, LAUNCHER_PAUSE_PROGRESS_INDEX);
    }


}
+16 −0
Original line number Diff line number Diff line
@@ -801,6 +801,10 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
        if (mLauncherUnfoldAnimationController != null) {
            mLauncherUnfoldAnimationController.onResume();
        }

        if (mTaskbarUIController != null && FeatureFlags.enableHomeTransitionListener()) {
            mTaskbarUIController.onLauncherResume();
        }
    }

    @Override
@@ -821,6 +825,18 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
                        .playPlaceholderDismissAnim(this, LAUNCHER_SPLIT_SELECTION_EXIT_INTERRUPTED);
            }
        }

        if (mTaskbarUIController != null && FeatureFlags.enableHomeTransitionListener()) {
            mTaskbarUIController.onLauncherPause();
        }
    }

    @Override
    protected void onStop() {
        super.onStop();
        if (mTaskbarUIController != null && FeatureFlags.enableHomeTransitionListener()) {
            mTaskbarUIController.onLauncherStop();
        }
    }

    @Override
+1 −0
Original line number Diff line number Diff line
@@ -2085,6 +2085,7 @@ public abstract class AbsSwipeUpHandler<
        if (mRecentsView != null) {
            mRecentsView.removeOnScrollChangedListener(mOnRecentsScrollListener);
        }
        mGestureState.getContainerInterface().setOnDeferredActivityLaunchCallback(null);
    }

    private void resetStateForAnimationCancel() {
Loading