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

Commit 914eab0d authored by Graciela Wissen Putri's avatar Graciela Wissen Putri
Browse files

[1/n] Move freeform caption dimen to core

The caption height is required to ensure bounds consider caption insets
when app is first launched as modifying this in Shell will be too late.

Flag: com.android.window.flags.exclude_caption_from_app_bounds
Test: m
Bug: 399544381
Change-Id: Id9619d4168de9d16fa345faf6cf09ae4a6bc64a8
parent d7aec9a6
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.internal.policy;

import android.annotation.DimenRes;
import android.annotation.NonNull;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Insets;
@@ -99,4 +101,19 @@ public final class SystemBarUtils {
    public static int getTaskbarHeight(Resources res) {
        return res.getDimensionPixelSize(R.dimen.taskbar_frame_height);
    }

    /**
     * Gets the default app header height in desktop view in pixels.
     */
    public static int getDesktopViewAppHeaderHeightPx(@NonNull Context context) {
        return context.getResources().getDimensionPixelSize(getDesktopViewAppHeaderHeightId());
    }

    /**
     * Gets the dimen resource id of the default app header height in desktop view.
     */
    @DimenRes
    public static int getDesktopViewAppHeaderHeightId() {
        return R.dimen.desktop_view_default_header_height;
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -1235,4 +1235,7 @@

    <!-- The maximum width for a context menu icon -->
    <dimen name="list_menu_item_icon_max_width">24dp</dimen>

    <!-- Default height of desktop view header for freeform tasks on launch. -->
    <dimen name="desktop_view_default_header_height">40dp</dimen>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -5974,4 +5974,6 @@
  <!-- Enable OEMs to support scale up anim across tasks.-->
  <java-symbol type="bool" name="config_enableCrossTaskScaleUpAnimation" />

  <!-- Default height of desktop view header for freeform tasks on launch. -->
  <java-symbol type="dimen" name="desktop_view_default_header_height" />
</resources>
+0 −3
Original line number Diff line number Diff line
@@ -437,9 +437,6 @@
    <!-- 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">40dp</dimen>

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

+0 −10
Original line number Diff line number Diff line
@@ -18,10 +18,8 @@

package com.android.wm.shell.desktopmode

import android.annotation.DimenRes
import android.app.ActivityManager.RunningTaskInfo
import android.app.TaskInfo
import android.content.Context
import android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK
import android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
@@ -38,7 +36,6 @@ import android.graphics.Rect
import android.os.SystemProperties
import android.util.Size
import android.window.DesktopModeFlags
import com.android.wm.shell.R
import com.android.wm.shell.ShellTaskOrganizer
import com.android.wm.shell.common.DisplayController
import com.android.wm.shell.common.DisplayLayout
@@ -265,13 +262,6 @@ fun isTaskBoundsEqual(taskBounds: Rect, stableBounds: Rect): Boolean {
    return taskBounds == stableBounds
}

/** Returns the app header height in desktop mode in pixels. */
fun getAppHeaderHeight(context: Context): Int =
    context.resources.getDimensionPixelSize(getAppHeaderHeightId())

/** Returns the resource id of the app header height in desktop mode. */
@DimenRes fun getAppHeaderHeightId(): Int = R.dimen.desktop_mode_freeform_decor_caption_height

/**
 * Returns the task bounds a launching task should inherit from an existing running instance.
 * Returns null if there are no bounds to inherit.
Loading