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

Commit 62d56487 authored by Maryam Dehaini's avatar Maryam Dehaini
Browse files

Change fullscreen caption height to 36dp

Change the fullscreen caption height so that it matches the status bar
height.

Bug: 297559120
Test: Open fullscreen task. Status bar icons should be vertically
centered in the caption.

Change-Id: Ia2208514b85680405989cb8034cf293f96bd660b
parent 37e92b6e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -26,8 +26,8 @@
    <ImageButton
        android:id="@+id/caption_handle"
        android:layout_width="128dp"
        android:layout_height="42dp"
        android:paddingVertical="19dp"
        android:layout_height="@dimen/desktop_mode_fullscreen_decor_caption_height"
        android:paddingVertical="16dp"
        android:contentDescription="@string/handle_text"
        android:src="@drawable/decor_handle_dark"
        tools:tint="@color/desktop_mode_caption_handle_bar_dark"
+6 −0
Original line number Diff line number Diff line
@@ -401,6 +401,12 @@
    <!-- Height of button (32dp)  + 2 * margin (5dp each). -->
    <dimen name="freeform_decor_caption_height">42dp</dimen>

    <!-- Height of desktop mode caption for freeform tasks. -->
    <dimen name="desktop_mode_freeform_decor_caption_height">42dp</dimen>

    <!-- Height of desktop mode caption for fullscreen tasks. -->
    <dimen name="desktop_mode_fullscreen_decor_caption_height">36dp</dimen>

    <!-- The width of the maximize menu in desktop mode. -->
    <dimen name="desktop_mode_maximize_menu_width">287dp</dimen>

+3 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.wm.shell.windowdecor;

import android.app.ActivityManager.RunningTaskInfo;
import android.app.WindowConfiguration;
import android.app.WindowConfiguration.WindowingMode;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
@@ -114,7 +115,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
        mRelayoutParams.reset();
        mRelayoutParams.mRunningTaskInfo = taskInfo;
        mRelayoutParams.mLayoutResId = R.layout.caption_window_decor;
        mRelayoutParams.mCaptionHeightId = getCaptionHeightId();
        mRelayoutParams.mCaptionHeightId = getCaptionHeightId(taskInfo.getWindowingMode());
        mRelayoutParams.mShadowRadiusId = shadowRadiusID;
        mRelayoutParams.mApplyStartTransactionOnDraw = applyStartTransactionOnDraw;

@@ -227,7 +228,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
    }

    @Override
    int getCaptionHeightId() {
    int getCaptionHeightId(@WindowingMode int windowingMode) {
        return R.dimen.freeform_decor_caption_height;
    }
}
+12 −8
Original line number Diff line number Diff line
@@ -17,8 +17,10 @@
package com.android.wm.shell.windowdecor;

import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;

import android.app.ActivityManager;
import android.app.WindowConfiguration.WindowingMode;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
@@ -180,7 +182,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
        mRelayoutParams.reset();
        mRelayoutParams.mRunningTaskInfo = taskInfo;
        mRelayoutParams.mLayoutResId = windowDecorLayoutId;
        mRelayoutParams.mCaptionHeightId = getCaptionHeightId();
        mRelayoutParams.mCaptionHeightId = getCaptionHeightId(taskInfo.getWindowingMode());
        mRelayoutParams.mShadowRadiusId = shadowRadiusID;
        mRelayoutParams.mApplyStartTransactionOnDraw = applyStartTransactionOnDraw;

@@ -286,7 +288,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin

        final int displayWidth = displayLayout.width();
        final int displayHeight = displayLayout.height();
        final int captionHeight = getCaptionHeight();
        final int captionHeight = getCaptionHeight(mTaskInfo.getWindowingMode());

        final ImageButton maximizeWindowButton =
                mResult.mRootView.findViewById(R.id.maximize_window);
@@ -545,7 +547,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
        super.close();
    }

    private int getDesktopModeWindowDecorLayoutId(int windowingMode) {
    private int getDesktopModeWindowDecorLayoutId(@WindowingMode int windowingMode) {
        return windowingMode == WINDOWING_MODE_FREEFORM
                ? R.layout.desktop_mode_app_controls_window_decor
                : R.layout.desktop_mode_focused_window_decor;
@@ -574,7 +576,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
            exclusionRegion = new Region();
        }
        exclusionRegion.union(new Rect(0, 0, mResult.mWidth,
                getCaptionHeight()));
                getCaptionHeight(mTaskInfo.getWindowingMode())));
        exclusionRegion.translate(mPositionInParent.x, mPositionInParent.y);
        return exclusionRegion;
    }
@@ -590,12 +592,14 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
    }

    @Override
    int getCaptionHeightId() {
        return R.dimen.freeform_decor_caption_height;
    int getCaptionHeightId(@WindowingMode int windowingMode) {
        return windowingMode == WINDOWING_MODE_FULLSCREEN
                ? R.dimen.desktop_mode_fullscreen_decor_caption_height
                : R.dimen.desktop_mode_freeform_decor_caption_height;
    }

    private int getCaptionHeight() {
        return loadDimensionPixelSize(mContext.getResources(), getCaptionHeightId());
    private int getCaptionHeight(@WindowingMode int windowingMode) {
        return loadDimensionPixelSize(mContext.getResources(), getCaptionHeightId(windowingMode));
    }

    /**
+3 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;

import android.app.ActivityManager.RunningTaskInfo;
import android.app.WindowConfiguration.WindowingMode;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -336,7 +337,7 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer>
        }
    }

    int getCaptionHeightId() {
    int getCaptionHeightId(@WindowingMode int windowingMode) {
        return Resources.ID_NULL;
    }

@@ -458,7 +459,7 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer>
     * Adds caption inset source to a WCT
     */
    public void addCaptionInset(WindowContainerTransaction wct) {
        final int captionHeightId = getCaptionHeightId();
        final int captionHeightId = getCaptionHeightId(mTaskInfo.getWindowingMode());
        if (!ViewRootImpl.CAPTION_ON_SHELL || captionHeightId == Resources.ID_NULL) {
            return;
        }