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

Commit 3e3ee0b1 authored by Tracy Zhou's avatar Tracy Zhou Committed by Android (Google) Code Review
Browse files

Merge "Fix crash from folding/unfolding" into main

parents f431ab4d 95c4c8d2
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -25,8 +25,6 @@ import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
import static com.android.launcher3.taskbar.LauncherTaskbarUIController.SYSUI_SURFACE_PROGRESS_INDEX;
import static com.android.launcher3.taskbar.TaskbarManager.isPhoneButtonNavMode;
import static com.android.launcher3.taskbar.TaskbarManager.isPhoneMode;
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_A11Y;
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_BACK;
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_HOME;
@@ -239,7 +237,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
        Point p = !mContext.isUserSetupComplete()
                ? new Point(0, mControllers.taskbarActivityContext.getSetupWindowHeight())
                : DimensionUtils.getTaskbarPhoneDimensions(deviceProfile, resources,
                        TaskbarManager.isPhoneMode(deviceProfile));
                        mContext.isPhoneMode());
        mNavButtonsView.getLayoutParams().height = p.y;

        mIsImeRenderingNavButtons =
@@ -305,7 +303,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
            initButtons(mNavButtonContainer, mEndContextualContainer,
                    mControllers.navButtonController);
            updateButtonLayoutSpacing();
            updateStateForFlag(FLAG_SMALL_SCREEN, isPhoneButtonNavMode(mContext));
            updateStateForFlag(FLAG_SMALL_SCREEN, mContext.isPhoneButtonNavMode());

            mPropertyHolders.add(new StatePropertyHolder(
                    mControllers.taskbarDragLayerController.getNavbarBackgroundAlpha(),
@@ -388,7 +386,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
        int navButtonSize = mContext.getResources().getDimensionPixelSize(
                R.dimen.taskbar_nav_buttons_size);
        boolean isRtl = Utilities.isRtl(mContext.getResources());
        if (!isPhoneMode(mContext.getDeviceProfile())) {
        if (!mContext.isPhoneMode()) {
            mPropertyHolders.add(new StatePropertyHolder(
                    mBackButton, flags -> (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0
                            || (flags & FLAG_KEYGUARD_VISIBLE) != 0,
@@ -632,7 +630,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
     * Sets the translationY of the nav buttons based on the current device state.
     */
    public void updateNavButtonTranslationY() {
        if (isPhoneButtonNavMode(mContext)) {
        if (mContext.isPhoneButtonNavMode()) {
            return;
        }
        final float normalTranslationY = mTaskbarNavButtonTranslationY.value;
@@ -751,9 +749,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
                            dp, mNavButtonsView, mImeSwitcherButton,
                            mControllers.rotationButtonController.getRotationButton(),
                            mA11yButton, res, isInKidsMode, isInSetup, isThreeButtonNav,
                            TaskbarManager.isPhoneMode(dp),
                            mWindowManagerProxy.getRotation(mContext));
            navButtonLayoutter.layoutButtons(dp, isA11yButtonPersistent());
                            mContext.isPhoneMode(), mWindowManagerProxy.getRotation(mContext));
            navButtonLayoutter.layoutButtons(mContext, isA11yButtonPersistent());
            updateNavButtonColor();
            return;
        }
+3 −7
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
        mControllers = controllers;
        DeviceProfile deviceProfile = mActivity.getDeviceProfile();
        Resources resources = mActivity.getResources();
        if (isPhoneGestureNavMode(mActivity.getDeviceProfile())) {
        if (mActivity.isPhoneGestureNavMode()) {
            mTaskbarSize = resources.getDimensionPixelSize(R.dimen.taskbar_phone_size);
            mStashedHandleWidth =
                    resources.getDimensionPixelSize(R.dimen.taskbar_stashed_small_screen);
@@ -120,7 +120,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
        mStashedHandleView.getLayoutParams().height = mTaskbarSize + taskbarBottomMargin;

        mTaskbarStashedHandleAlpha.get(ALPHA_INDEX_STASHED).setValue(
                isPhoneGestureNavMode(deviceProfile) ? 1 : 0);
                mActivity.isPhoneGestureNavMode() ? 1 : 0);
        mTaskbarStashedHandleHintScale.updateValue(1f);

        final int stashedTaskbarHeight = mControllers.taskbarStashController.getStashedHeight();
@@ -148,7 +148,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
            view.setPivotY(stashedCenterY);
        });
        initRegionSampler();
        if (isPhoneGestureNavMode(deviceProfile)) {
        if (mActivity.isPhoneGestureNavMode()) {
            onIsStashedChanged(true);
        }
    }
@@ -184,10 +184,6 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
        mRegionSamplingHelper = null;
    }

    private boolean isPhoneGestureNavMode(DeviceProfile deviceProfile) {
        return TaskbarManager.isPhoneMode(deviceProfile) && !mActivity.isThreeButtonNav();
    }

    public MultiPropertyFactory<View> getStashedHandleAlpha() {
        return mTaskbarStashedHandleAlpha;
    }
+25 −6
Original line number Diff line number Diff line
@@ -214,7 +214,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        Context c = getApplicationContext();
        mWindowManager = c.getSystemService(WindowManager.class);

        boolean phoneMode = TaskbarManager.isPhoneMode(mDeviceProfile);
        boolean phoneMode = isPhoneMode();
        mLeftCorner = phoneMode
                ? null
                : display.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_LEFT);
@@ -387,6 +387,28 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        }
    }

    /**
     * @return {@code true} if the device profile isn't a large screen profile and we are using a
     * single window for taskbar and navbar.
     */
    public boolean isPhoneMode() {
        return ENABLE_TASKBAR_NAVBAR_UNIFICATION && mDeviceProfile.isPhone;
    }

    /**
     * @return {@code true} if {@link #isPhoneMode()} is true and we're using 3 button-nav
     */
    public boolean isPhoneButtonNavMode() {
        return isPhoneMode() && isThreeButtonNav();
    }

    /**
     * @return {@code true} if {@link #isPhoneMode()} is true and we're using gesture nav
     */
    public boolean isPhoneGestureNavMode() {
        return isPhoneMode() && !isThreeButtonNav();
    }

    /**
     * Show Taskbar upon receiving broadcast
     */
@@ -464,9 +486,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        windowLayoutParams.privateFlags =
                WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
        windowLayoutParams.accessibilityTitle = getString(
                TaskbarManager.isPhoneMode(mDeviceProfile)
                        ? R.string.taskbar_phone_a11y_title
                        : R.string.taskbar_a11y_title);
                isPhoneMode() ? R.string.taskbar_phone_a11y_title : R.string.taskbar_a11y_title);

        return windowLayoutParams;
    }
@@ -480,8 +500,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
                ENABLE_TASKBAR_NAVBAR_UNIFICATION ? TYPE_NAVIGATION_BAR : TYPE_NAVIGATION_BAR_PANEL;
        WindowManager.LayoutParams windowLayoutParams =
                createDefaultWindowLayoutParams(windowType, TaskbarActivityContext.WINDOW_TITLE);
        boolean isPhoneNavMode = TaskbarManager.isPhoneButtonNavMode(this);
        if (!isPhoneNavMode) {
        if (!isPhoneButtonNavMode()) {
            return windowLayoutParams;
        }

+2 −3
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.graphics.Paint
import android.graphics.Path
import android.graphics.RectF
import com.android.app.animation.Interpolators
import com.android.launcher3.DeviceProfile
import com.android.launcher3.R
import com.android.launcher3.Utilities
import com.android.launcher3.Utilities.mapRange
@@ -95,10 +94,10 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
        setCornerRoundness(DEFAULT_ROUNDNESS)
    }

    fun updateStashedHandleWidth(dp: DeviceProfile, res: Resources) {
    fun updateStashedHandleWidth(context: TaskbarActivityContext, res: Resources) {
        stashedHandleWidth =
            res.getDimensionPixelSize(
                if (TaskbarManager.isPhoneMode(dp)) R.dimen.taskbar_stashed_small_screen
                if (context.isPhoneMode) R.dimen.taskbar_stashed_small_screen
                else R.dimen.taskbar_stashed_handle_width
            )
    }
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {

    public void init(TaskbarDragLayerController.TaskbarDragLayerCallbacks callbacks) {
        mControllerCallbacks = callbacks;
        mBackgroundRenderer.updateStashedHandleWidth(mActivity.getDeviceProfile(), getResources());
        mBackgroundRenderer.updateStashedHandleWidth(mActivity, getResources());
        recreateControllers();
    }

Loading