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

Commit 047b2390 authored by Chris Göllner's avatar Chris Göllner Committed by Android (Google) Code Review
Browse files

Merge "Fix height and top padding of shade header and keyguard status bar" into main

parents 79dd6123 7a56e77d
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -257,6 +257,15 @@ flag {
   bug: "298186160"
}

flag {
   name: "centralized_status_bar_dimens_refactor"
   namespace: "systemui"
   description: "Refactors shade header and keyguard status bar to read status bar dimens from a"
        " central place, instead of reading resources directly. This is to take into account display"
        " cutouts and other special cases. "
   bug: "317199366"
}

flag {
  name: "enable_layout_tracing"
  namespace: "systemui"
+0 −1
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@
    android:layout_width="match_parent"
    android:layout_height="@dimen/status_bar_header_height_keyguard"
    android:baselineAligned="false"
    android:gravity="center_vertical"
    >

    <LinearLayout
+11 −1
Original line number Diff line number Diff line
@@ -23,11 +23,13 @@ import androidx.constraintlayout.widget.ConstraintSet.END
import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID
import androidx.constraintlayout.widget.ConstraintSet.START
import androidx.constraintlayout.widget.ConstraintSet.TOP
import com.android.systemui.Flags.centralizedStatusBarDimensRefactor
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.shared.KeyguardShadeMigrationNssl
import com.android.systemui.keyguard.ui.viewmodel.KeyguardSmartspaceViewModel
import com.android.systemui.res.R
import com.android.systemui.scene.shared.flag.SceneContainerFlags
import com.android.systemui.shade.LargeScreenHeaderHelper
import com.android.systemui.shade.NotificationPanelView
import com.android.systemui.statusbar.notification.stack.AmbientState
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController
@@ -35,6 +37,7 @@ import com.android.systemui.statusbar.notification.stack.NotificationStackSizeCa
import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer
import com.android.systemui.statusbar.notification.stack.ui.viewmodel.NotificationStackAppearanceViewModel
import com.android.systemui.statusbar.notification.stack.ui.viewmodel.SharedNotificationContainerViewModel
import dagger.Lazy
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher

@@ -53,6 +56,7 @@ constructor(
    notificationStackSizeCalculator: NotificationStackSizeCalculator,
    private val smartspaceViewModel: KeyguardSmartspaceViewModel,
    @Main mainDispatcher: CoroutineDispatcher,
    private val largeScreenHeaderHelperLazy: Lazy<LargeScreenHeaderHelper>,
) :
    NotificationStackScrollLayoutSection(
        context,
@@ -72,7 +76,13 @@ constructor(
        }
        constraintSet.apply {
            val splitShadeTopMargin =
                context.resources.getDimensionPixelSize(R.dimen.large_screen_shade_header_height)
                if (centralizedStatusBarDimensRefactor()) {
                    largeScreenHeaderHelperLazy.get().getLargeScreenHeaderHeight()
                } else {
                    context.resources.getDimensionPixelSize(
                        R.dimen.large_screen_shade_header_height
                    )
                }
            connect(R.id.nssl_placeholder, TOP, PARENT_ID, TOP, splitShadeTopMargin)

            connect(R.id.nssl_placeholder, START, PARENT_ID, START)
+9 −2
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.systemui.qs;

import static android.app.StatusBarManager.DISABLE2_QUICK_SETTINGS;

import static com.android.systemui.Flags.centralizedStatusBarDimensRefactor;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
@@ -30,6 +32,7 @@ import android.widget.FrameLayout;
import com.android.systemui.Dumpable;
import com.android.systemui.qs.customize.QSCustomizer;
import com.android.systemui.res.R;
import com.android.systemui.shade.LargeScreenHeaderHelper;
import com.android.systemui.shade.TouchLogger;
import com.android.systemui.util.LargeScreenUtils;

@@ -162,8 +165,12 @@ public class QSContainerImpl extends FrameLayout implements Dumpable {
            QuickStatusBarHeaderController quickStatusBarHeaderController) {
        int topPadding = QSUtils.getQsHeaderSystemIconsAreaHeight(mContext);
        if (!LargeScreenUtils.shouldUseLargeScreenShadeHeader(mContext.getResources())) {
            topPadding = mContext.getResources()
                    .getDimensionPixelSize(R.dimen.large_screen_shade_header_height);
            topPadding =
                    centralizedStatusBarDimensRefactor()
                            ? LargeScreenHeaderHelper.getLargeScreenHeaderHeight(mContext)
                            : mContext.getResources()
                                    .getDimensionPixelSize(
                                            R.dimen.large_screen_shade_header_height);
        }
        mQSPanelContainer.setPaddingRelative(
                mQSPanelContainer.getPaddingStart(),
+40 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.shade

import android.content.Context
import com.android.internal.policy.SystemBarUtils
import com.android.systemui.res.R
import javax.inject.Inject
import kotlin.math.max

class LargeScreenHeaderHelper @Inject constructor(private val context: Context) {

    fun getLargeScreenHeaderHeight(): Int = getLargeScreenHeaderHeight(context)

    companion object {
        @JvmStatic
        fun getLargeScreenHeaderHeight(context: Context): Int {
            val defaultHeight =
                context.resources.getDimensionPixelSize(R.dimen.large_screen_shade_header_height)
            val statusBarHeight = SystemBarUtils.getStatusBarHeight(context)
            // Height has to be at least as tall as the status bar, as the status bar height takes
            // into account display cutouts.
            return max(defaultHeight, statusBarHeight)
        }
    }
}
Loading