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

Commit b0f1da28 authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge "Prevent taskbar on phone from crashing" into udc-dev

parents b167b596 f00760ac
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -714,6 +714,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
     * setup wizard, or normal 3 button nav.
     */
    private void updateButtonLayoutSpacing() {
        boolean isThreeButtonNav = mContext.isThreeButtonNav();

        DeviceProfile dp = mContext.getDeviceProfile();
        Resources res = mContext.getResources();
        boolean isInSetup = !mContext.isUserSetupComplete();
@@ -721,7 +723,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
        boolean isInKidsMode = mContext.isNavBarKidsModeActive();

        if (TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW) {
            boolean isThreeButtonNav = mContext.isThreeButtonNav();
            if (!isThreeButtonNav) {
                return;
            }

            NavButtonLayoutter navButtonLayoutter =
                    NavButtonLayoutFactory.Companion.getUiLayoutter(
@@ -803,7 +807,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
            mNavButtonContainer.requestLayout();

            mHomeButton.setOnLongClickListener(null);
        } else if (mContext.isThreeButtonNav()) {
        } else if (isThreeButtonNav) {
            final RotateDrawable rotateDrawable = new RotateDrawable();
            rotateDrawable.setDrawable(mContext.getDrawable(R.drawable.ic_sysbar_back));
            rotateDrawable.setFromDegrees(0f);
+9 −2
Original line number Diff line number Diff line
@@ -186,7 +186,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        mRightCorner = display.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_RIGHT);

        // Inflate views.
        int taskbarLayout = DisplayController.isTransientTaskbar(this)
        boolean phoneMode = TaskbarManager.isPhoneMode(mDeviceProfile);
        int taskbarLayout = DisplayController.isTransientTaskbar(this) && !phoneMode
                ? R.layout.transient_taskbar
                : R.layout.taskbar;
        mDragLayer = (TaskbarDragLayer) mLayoutInflater.inflate(taskbarLayout, null, false);
@@ -254,6 +255,12 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
                sharedState.systemBarAttrsBehavior);
        onNavButtonsDarkIntensityChanged(sharedState.navButtonsDarkIntensity);

        if (FLAG_HIDE_NAVBAR_WINDOW) {
            // W/ the flag not set this entire class gets re-created, which resets the value of
            // mIsDestroyed. We re-use the class for small-screen, so we explicitly have to mark
            // this class as non-destroyed
            mIsDestroyed = false;
        }

        if (!mAddedWindow) {
            mWindowManager.addView(mDragLayer, mWindowLayoutParams);
@@ -334,7 +341,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
    public WindowManager.LayoutParams createDefaultWindowLayoutParams(int type, String title) {
        DeviceProfile deviceProfile = getDeviceProfile();
        // Taskbar is on the logical bottom of the screen
        boolean isVerticalBarLayout = TaskbarManager.isPhoneMode(deviceProfile) &&
        boolean isVerticalBarLayout = TaskbarManager.isPhoneButtonNavMode(this) &&
                deviceProfile.isLandscape;

        int windowFlags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+10 −1
Original line number Diff line number Diff line
@@ -16,11 +16,13 @@

package com.android.launcher3.taskbar

import android.content.res.Resources
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.Path
import android.graphics.RectF
import com.android.launcher3.DeviceProfile
import com.android.launcher3.R
import com.android.launcher3.Utilities
import com.android.launcher3.Utilities.mapRange
@@ -61,7 +63,7 @@ class TaskbarBackgroundRenderer(context: TaskbarActivityContext) {
    private val invertedLeftCornerPath: Path = Path()
    private val invertedRightCornerPath: Path = Path()

    private val stashedHandleWidth =
    private var stashedHandleWidth =
        context.resources.getDimensionPixelSize(R.dimen.taskbar_stashed_handle_width)

    private val stashedHandleHeight =
@@ -86,6 +88,13 @@ class TaskbarBackgroundRenderer(context: TaskbarActivityContext) {
        setCornerRoundness(DEFAULT_ROUNDNESS)
    }

    fun updateStashedHandleWidth(dp: DeviceProfile, res: Resources) {
        stashedHandleWidth = res.getDimensionPixelSize(
                if (TaskbarManager.isPhoneMode(dp)) R.dimen.taskbar_stashed_small_screen
                else R.dimen.taskbar_stashed_handle_width
        )
    }

    /**
     * Sets the roundness of the round corner above Taskbar. No effect on transient Taskkbar.
     *
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {

    public void init(TaskbarDragLayerController.TaskbarDragLayerCallbacks callbacks) {
        mControllerCallbacks = callbacks;

        mBackgroundRenderer.updateStashedHandleWidth(mActivity.getDeviceProfile(), getResources());
        recreateControllers();
    }

+2 −1
Original line number Diff line number Diff line
@@ -114,7 +114,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
        mActivityContext = ActivityContext.lookupContext(context);
        mIconLayoutBounds = mActivityContext.getTransientTaskbarBounds();
        Resources resources = getResources();
        boolean isTransientTaskbar = DisplayController.isTransientTaskbar(mActivityContext);
        boolean isTransientTaskbar = DisplayController.isTransientTaskbar(mActivityContext)
                && !TaskbarManager.isPhoneMode(mActivityContext.getDeviceProfile());
        mIsRtl = Utilities.isRtl(resources);
        mTransientTaskbarMinWidth = mContext.getResources().getDimension(
                R.dimen.transient_taskbar_min_width);
Loading