Merge "Add APIs to get system bar heights" into sc-v2-dev am: 59f51a9538
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15611697 Change-Id: Ia9cb364e66ff9ef778e41d239a78da4b79e6d993
This commit is contained in:
94
core/java/com/android/internal/policy/SystemBarUtils.java
Normal file
94
core/java/com/android/internal/policy/SystemBarUtils.java
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.internal.policy;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Insets;
|
||||
import android.util.RotationUtils;
|
||||
import android.view.DisplayCutout;
|
||||
import android.view.Surface;
|
||||
|
||||
import com.android.internal.R;
|
||||
|
||||
/**
|
||||
* Utility functions for system bars used by both window manager and System UI.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class SystemBarUtils {
|
||||
|
||||
/**
|
||||
* Gets the status bar height.
|
||||
*/
|
||||
public static int getStatusBarHeight(Context context) {
|
||||
return getStatusBarHeight(context.getResources(), context.getDisplay().getCutout());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status bar height with a specific display cutout.
|
||||
*/
|
||||
public static int getStatusBarHeight(Resources res, DisplayCutout cutout) {
|
||||
final int defaultSize = res.getDimensionPixelSize(R.dimen.status_bar_height);
|
||||
final int safeInsetTop = cutout == null ? 0 : cutout.getSafeInsetTop();
|
||||
final int waterfallInsetTop = cutout == null ? 0 : cutout.getWaterfallInsets().top;
|
||||
// The status bar height should be:
|
||||
// Max(top cutout size, (status bar default height + waterfall top size))
|
||||
return Math.max(safeInsetTop, defaultSize + waterfallInsetTop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status bar height for a specific rotation.
|
||||
*/
|
||||
public static int getStatusBarHeightForRotation(
|
||||
Context context, @Surface.Rotation int targetRot) {
|
||||
final int rotation = context.getDisplay().getRotation();
|
||||
final DisplayCutout cutout = context.getDisplay().getCutout();
|
||||
|
||||
Insets insets = cutout == null ? Insets.NONE : Insets.of(cutout.getSafeInsets());
|
||||
Insets waterfallInsets = cutout == null ? Insets.NONE : cutout.getWaterfallInsets();
|
||||
// rotate insets to target rotation if needed.
|
||||
if (rotation != targetRot) {
|
||||
if (!insets.equals(Insets.NONE)) {
|
||||
insets = RotationUtils.rotateInsets(
|
||||
insets, RotationUtils.deltaRotation(rotation, targetRot));
|
||||
}
|
||||
if (!waterfallInsets.equals(Insets.NONE)) {
|
||||
waterfallInsets = RotationUtils.rotateInsets(
|
||||
waterfallInsets, RotationUtils.deltaRotation(rotation, targetRot));
|
||||
}
|
||||
}
|
||||
final int defaultSize =
|
||||
context.getResources().getDimensionPixelSize(R.dimen.status_bar_height);
|
||||
// The status bar height should be:
|
||||
// Max(top cutout size, (status bar default height + waterfall top size))
|
||||
return Math.max(insets.top, defaultSize + waterfallInsets.top);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the height of area above QQS where battery/time go in notification panel. The height
|
||||
* equals to status bar height if status bar height is bigger than the
|
||||
* {@link R.dimen#quick_qs_offset_height}.
|
||||
*/
|
||||
public static int getQuickQsOffsetHeight(Context context) {
|
||||
final int defaultSize = context.getResources().getDimensionPixelSize(
|
||||
R.dimen.quick_qs_offset_height);
|
||||
final int statusBarHeight = getStatusBarHeight(context);
|
||||
// Equals to status bar height if status bar height is bigger.
|
||||
return Math.max(defaultSize, statusBarHeight);
|
||||
}
|
||||
}
|
||||
@@ -27,8 +27,6 @@
|
||||
<dimen name="password_keyboard_spacebar_vertical_correction">2dip</dimen>
|
||||
<dimen name="preference_widget_width">72dp</dimen>
|
||||
|
||||
<!-- Height of the status bar -->
|
||||
<dimen name="status_bar_height">@dimen/status_bar_height_landscape</dimen>
|
||||
<!-- Height of area above QQS where battery/time go -->
|
||||
<dimen name="quick_qs_offset_height">48dp</dimen>
|
||||
<!-- Default height of an action bar. -->
|
||||
|
||||
@@ -39,15 +39,21 @@
|
||||
<!-- Elevation of toast view -->
|
||||
<dimen name="toast_elevation">2dp</dimen>
|
||||
|
||||
<!-- Height of the status bar -->
|
||||
<dimen name="status_bar_height">@dimen/status_bar_height_portrait</dimen>
|
||||
<!-- Height of the status bar in portrait. The height should be
|
||||
Max((status bar content height + waterfall top size), top cutout size) -->
|
||||
<dimen name="status_bar_height_portrait">24dp</dimen>
|
||||
<!-- Height of the status bar in landscape. The height should be
|
||||
Max((status bar content height + waterfall top size), top cutout size) -->
|
||||
<!-- Height of the status bar.
|
||||
Do not read this dimen directly. Use {@link SystemBarUtils#getStatusBarHeight} instead.
|
||||
-->
|
||||
<dimen name="status_bar_height">24dp</dimen>
|
||||
<!-- Height of the status bar in portrait.
|
||||
Do not read this dimen directly. Use {@link SystemBarUtils#getStatusBarHeight} instead.
|
||||
-->
|
||||
<dimen name="status_bar_height_portrait">@dimen/status_bar_height</dimen>
|
||||
<!-- Height of the status bar in landscape.
|
||||
Do not read this dimen directly. Use {@link SystemBarUtils#getStatusBarHeight} instead.
|
||||
-->
|
||||
<dimen name="status_bar_height_landscape">@dimen/status_bar_height_portrait</dimen>
|
||||
<!-- Height of area above QQS where battery/time go -->
|
||||
<!-- Height of area above QQS where battery/time go.
|
||||
Do not read this dimen directly. Use {@link SystemBarUtils#getQuickQsOffsetHeight} instead.
|
||||
-->
|
||||
<dimen name="quick_qs_offset_height">48dp</dimen>
|
||||
<!-- Height of the bottom navigation / system bar. -->
|
||||
<dimen name="navigation_bar_height">48dp</dimen>
|
||||
|
||||
@@ -48,9 +48,11 @@ import android.view.Gravity;
|
||||
import android.view.InsetsSource;
|
||||
import android.view.InsetsState;
|
||||
import android.view.Surface;
|
||||
import android.view.WindowInsets;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -198,12 +200,13 @@ public class DisplayLayout {
|
||||
recalcInsets(res);
|
||||
}
|
||||
|
||||
private void recalcInsets(Resources res) {
|
||||
@VisibleForTesting
|
||||
void recalcInsets(Resources res) {
|
||||
computeNonDecorInsets(res, mRotation, mWidth, mHeight, mCutout, mInsetsState, mUiMode,
|
||||
mNonDecorInsets, mHasNavigationBar);
|
||||
mStableInsets.set(mNonDecorInsets);
|
||||
if (mHasStatusBar) {
|
||||
convertNonDecorInsetsToStableInsets(res, mStableInsets, mWidth, mHeight, mHasStatusBar);
|
||||
convertNonDecorInsetsToStableInsets(res, mStableInsets, mCutout, mHasStatusBar);
|
||||
}
|
||||
mNavBarFrameHeight = getNavigationBarFrameHeight(res, mWidth > mHeight);
|
||||
}
|
||||
@@ -323,12 +326,12 @@ public class DisplayLayout {
|
||||
/**
|
||||
* Calculates the stable insets if we already have the non-decor insets.
|
||||
*/
|
||||
private static void convertNonDecorInsetsToStableInsets(Resources res, Rect inOutInsets,
|
||||
int displayWidth, int displayHeight, boolean hasStatusBar) {
|
||||
private void convertNonDecorInsetsToStableInsets(Resources res, Rect inOutInsets,
|
||||
DisplayCutout cutout, boolean hasStatusBar) {
|
||||
if (!hasStatusBar) {
|
||||
return;
|
||||
}
|
||||
int statusBarHeight = getStatusBarHeight(displayWidth > displayHeight, res);
|
||||
int statusBarHeight = SystemBarUtils.getStatusBarHeight(res, cutout);
|
||||
inOutInsets.top = Math.max(inOutInsets.top, statusBarHeight);
|
||||
}
|
||||
|
||||
@@ -377,35 +380,6 @@ public class DisplayLayout {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the stable insets without running a layout.
|
||||
*
|
||||
* @param displayRotation the current display rotation
|
||||
* @param displayWidth the current display width
|
||||
* @param displayHeight the current display height
|
||||
* @param displayCutout the current display cutout
|
||||
* @param outInsets the insets to return
|
||||
*/
|
||||
static void computeStableInsets(Resources res, int displayRotation, int displayWidth,
|
||||
int displayHeight, DisplayCutout displayCutout, InsetsState insetsState, int uiMode,
|
||||
Rect outInsets, boolean hasNavigationBar, boolean hasStatusBar) {
|
||||
outInsets.setEmpty();
|
||||
|
||||
// Navigation bar and status bar.
|
||||
computeNonDecorInsets(res, displayRotation, displayWidth, displayHeight, displayCutout,
|
||||
insetsState, uiMode, outInsets, hasNavigationBar);
|
||||
convertNonDecorInsetsToStableInsets(res, outInsets, displayWidth, displayHeight,
|
||||
hasStatusBar);
|
||||
}
|
||||
|
||||
/** Retrieve the statusbar height from resources. */
|
||||
static int getStatusBarHeight(boolean landscape, Resources res) {
|
||||
return landscape ? res.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.status_bar_height_landscape)
|
||||
: res.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.status_bar_height_portrait);
|
||||
}
|
||||
|
||||
/** Calculate the DisplayCutout for a particular display size/rotation. */
|
||||
public static DisplayCutout calculateDisplayCutoutForRotation(
|
||||
DisplayCutout cutout, int rotation, int displayWidth, int displayHeight) {
|
||||
|
||||
@@ -39,7 +39,7 @@ import androidx.annotation.GuardedBy;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.wm.shell.common.DisplayController;
|
||||
import com.android.wm.shell.common.DisplayLayout;
|
||||
import com.android.wm.shell.common.ShellExecutor;
|
||||
@@ -307,12 +307,9 @@ class HideDisplayCutoutOrganizer extends DisplayAreaOrganizer {
|
||||
t.apply();
|
||||
}
|
||||
|
||||
private int getStatusBarHeight() {
|
||||
final boolean isLandscape =
|
||||
mIsDefaultPortrait ? isDisplaySizeFlipped() : !isDisplaySizeFlipped();
|
||||
return mContext.getResources().getDimensionPixelSize(
|
||||
isLandscape ? R.dimen.status_bar_height_landscape
|
||||
: R.dimen.status_bar_height_portrait);
|
||||
@VisibleForTesting
|
||||
int getStatusBarHeight() {
|
||||
return SystemBarUtils.getStatusBarHeight(mContext);
|
||||
}
|
||||
|
||||
void dump(@NonNull PrintWriter pw) {
|
||||
|
||||
@@ -21,9 +21,14 @@ import static android.view.Surface.ROTATION_0;
|
||||
import static android.view.Surface.ROTATION_270;
|
||||
import static android.view.Surface.ROTATION_90;
|
||||
|
||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
@@ -35,8 +40,12 @@ import android.view.DisplayInfo;
|
||||
import androidx.test.filters.SmallTest;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.MockitoSession;
|
||||
|
||||
/**
|
||||
* Tests for {@link DisplayLayout}.
|
||||
@@ -46,29 +55,48 @@ import org.junit.Test;
|
||||
*/
|
||||
@SmallTest
|
||||
public class DisplayLayoutTest {
|
||||
private MockitoSession mMockitoSession;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
mMockitoSession = mockitoSession()
|
||||
.initMocks(this)
|
||||
.mockStatic(SystemBarUtils.class)
|
||||
.startMocking();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
mMockitoSession.finishMocking();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInsets() {
|
||||
Resources res = createResources(40, 50, false, 30, 40);
|
||||
Resources res = createResources(40, 50, false);
|
||||
// Test empty display, no bars or anything
|
||||
DisplayInfo info = createDisplayInfo(1000, 1500, 0, ROTATION_0);
|
||||
DisplayLayout dl = new DisplayLayout(info, res, false, false);
|
||||
when(SystemBarUtils.getStatusBarHeight(eq(res), any())).thenReturn(40);
|
||||
dl.recalcInsets(res);
|
||||
assertEquals(new Rect(0, 0, 0, 0), dl.stableInsets());
|
||||
assertEquals(new Rect(0, 0, 0, 0), dl.nonDecorInsets());
|
||||
|
||||
// Test with bars
|
||||
dl = new DisplayLayout(info, res, true, true);
|
||||
dl.recalcInsets(res);
|
||||
assertEquals(new Rect(0, 40, 0, 50), dl.stableInsets());
|
||||
assertEquals(new Rect(0, 0, 0, 50), dl.nonDecorInsets());
|
||||
|
||||
// Test just cutout
|
||||
info = createDisplayInfo(1000, 1500, 60, ROTATION_0);
|
||||
dl = new DisplayLayout(info, res, false, false);
|
||||
dl.recalcInsets(res);
|
||||
assertEquals(new Rect(0, 60, 0, 0), dl.stableInsets());
|
||||
assertEquals(new Rect(0, 60, 0, 0), dl.nonDecorInsets());
|
||||
|
||||
// Test with bars and cutout
|
||||
dl = new DisplayLayout(info, res, true, true);
|
||||
dl.recalcInsets(res);
|
||||
assertEquals(new Rect(0, 60, 0, 50), dl.stableInsets());
|
||||
assertEquals(new Rect(0, 60, 0, 50), dl.nonDecorInsets());
|
||||
}
|
||||
@@ -76,27 +104,30 @@ public class DisplayLayoutTest {
|
||||
@Test
|
||||
public void testRotate() {
|
||||
// Basic rotate utility
|
||||
Resources res = createResources(40, 50, false, 30, 40);
|
||||
Resources res = createResources(40, 50, false);
|
||||
DisplayInfo info = createDisplayInfo(1000, 1500, 60, ROTATION_0);
|
||||
DisplayLayout dl = new DisplayLayout(info, res, true, true);
|
||||
when(SystemBarUtils.getStatusBarHeight(eq(res), any())).thenReturn(40);
|
||||
dl.recalcInsets(res);
|
||||
assertEquals(new Rect(0, 60, 0, 50), dl.stableInsets());
|
||||
assertEquals(new Rect(0, 60, 0, 50), dl.nonDecorInsets());
|
||||
|
||||
// Rotate to 90
|
||||
when(SystemBarUtils.getStatusBarHeight(eq(res), any())).thenReturn(30);
|
||||
dl.rotateTo(res, ROTATION_90);
|
||||
assertEquals(new Rect(60, 30, 0, 40), dl.stableInsets());
|
||||
assertEquals(new Rect(60, 0, 0, 40), dl.nonDecorInsets());
|
||||
|
||||
// Rotate with moving navbar
|
||||
res = createResources(40, 50, true, 30, 40);
|
||||
res = createResources(40, 50, true);
|
||||
dl = new DisplayLayout(info, res, true, true);
|
||||
when(SystemBarUtils.getStatusBarHeight(eq(res), any())).thenReturn(30);
|
||||
dl.rotateTo(res, ROTATION_270);
|
||||
assertEquals(new Rect(40, 30, 60, 0), dl.stableInsets());
|
||||
assertEquals(new Rect(40, 0, 60, 0), dl.nonDecorInsets());
|
||||
}
|
||||
|
||||
private Resources createResources(
|
||||
int navLand, int navPort, boolean navMoves, int statusLand, int statusPort) {
|
||||
private Resources createResources(int navLand, int navPort, boolean navMoves) {
|
||||
Configuration cfg = new Configuration();
|
||||
cfg.uiMode = UI_MODE_TYPE_NORMAL;
|
||||
Resources res = mock(Resources.class);
|
||||
@@ -108,8 +139,6 @@ public class DisplayLayoutTest {
|
||||
doReturn(navPort).when(res).getDimensionPixelSize(R.dimen.navigation_bar_height);
|
||||
doReturn(navLand).when(res).getDimensionPixelSize(R.dimen.navigation_bar_width);
|
||||
doReturn(navMoves).when(res).getBoolean(R.bool.config_navBarCanMove);
|
||||
doReturn(statusLand).when(res).getDimensionPixelSize(R.dimen.status_bar_height_landscape);
|
||||
doReturn(statusPort).when(res).getDimensionPixelSize(R.dimen.status_bar_height_portrait);
|
||||
doReturn(cfg).when(res).getConfiguration();
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ import android.window.WindowContainerToken;
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.filters.SmallTest;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.wm.shell.common.DisplayController;
|
||||
import com.android.wm.shell.common.DisplayLayout;
|
||||
import com.android.wm.shell.common.ShellExecutor;
|
||||
@@ -124,6 +123,7 @@ public class HideDisplayCutoutOrganizerTest {
|
||||
|
||||
@Test
|
||||
public void testEnableHideDisplayCutout() {
|
||||
doReturn(mFakeStatusBarHeightPortrait).when(mOrganizer).getStatusBarHeight();
|
||||
mOrganizer.enableHideDisplayCutout();
|
||||
|
||||
verify(mOrganizer).registerOrganizer(DisplayAreaOrganizer.FEATURE_HIDE_DISPLAY_CUTOUT);
|
||||
@@ -154,8 +154,7 @@ public class HideDisplayCutoutOrganizerTest {
|
||||
doReturn(mFakeDefaultBounds).when(mOrganizer).getDisplayBoundsOfNaturalOrientation();
|
||||
doReturn(mFakeDefaultCutoutInsets).when(mOrganizer)
|
||||
.getDisplayCutoutInsetsOfNaturalOrientation();
|
||||
mContext.getOrCreateTestableResources().addOverride(
|
||||
R.dimen.status_bar_height_portrait, mFakeStatusBarHeightPortrait);
|
||||
doReturn(mFakeStatusBarHeightPortrait).when(mOrganizer).getStatusBarHeight();
|
||||
doReturn(Surface.ROTATION_0).when(mDisplayLayout).rotation();
|
||||
mOrganizer.enableHideDisplayCutout();
|
||||
|
||||
@@ -173,8 +172,7 @@ public class HideDisplayCutoutOrganizerTest {
|
||||
doReturn(mFakeDefaultBounds).when(mOrganizer).getDisplayBoundsOfNaturalOrientation();
|
||||
doReturn(mFakeDefaultCutoutInsets).when(mOrganizer)
|
||||
.getDisplayCutoutInsetsOfNaturalOrientation();
|
||||
mContext.getOrCreateTestableResources().addOverride(
|
||||
R.dimen.status_bar_height_landscape, mFakeStatusBarHeightLandscape);
|
||||
doReturn(mFakeStatusBarHeightLandscape).when(mOrganizer).getStatusBarHeight();
|
||||
doReturn(Surface.ROTATION_90).when(mDisplayLayout).rotation();
|
||||
mOrganizer.enableHideDisplayCutout();
|
||||
|
||||
@@ -192,8 +190,7 @@ public class HideDisplayCutoutOrganizerTest {
|
||||
doReturn(mFakeDefaultBounds).when(mOrganizer).getDisplayBoundsOfNaturalOrientation();
|
||||
doReturn(mFakeDefaultCutoutInsets).when(mOrganizer)
|
||||
.getDisplayCutoutInsetsOfNaturalOrientation();
|
||||
mContext.getOrCreateTestableResources().addOverride(
|
||||
R.dimen.status_bar_height_landscape, mFakeStatusBarHeightLandscape);
|
||||
doReturn(mFakeStatusBarHeightLandscape).when(mOrganizer).getStatusBarHeight();
|
||||
doReturn(Surface.ROTATION_270).when(mDisplayLayout).rotation();
|
||||
mOrganizer.enableHideDisplayCutout();
|
||||
|
||||
@@ -211,8 +208,7 @@ public class HideDisplayCutoutOrganizerTest {
|
||||
doReturn(mFakeDefaultBounds).when(mOrganizer).getDisplayBoundsOfNaturalOrientation();
|
||||
doReturn(mFakeDefaultCutoutInsets).when(mOrganizer)
|
||||
.getDisplayCutoutInsetsOfNaturalOrientation();
|
||||
mContext.getOrCreateTestableResources().addOverride(
|
||||
R.dimen.status_bar_height_portrait, mFakeStatusBarHeightPortrait);
|
||||
doReturn(mFakeStatusBarHeightPortrait).when(mOrganizer).getStatusBarHeight();
|
||||
mOrganizer.enableHideDisplayCutout();
|
||||
|
||||
// disable hide display cutout
|
||||
@@ -230,8 +226,7 @@ public class HideDisplayCutoutOrganizerTest {
|
||||
doReturn(200).when(mDisplayLayout).height();
|
||||
doReturn(mFakeDefaultCutoutInsets).when(mOrganizer)
|
||||
.getDisplayCutoutInsetsOfNaturalOrientation();
|
||||
mContext.getOrCreateTestableResources().addOverride(
|
||||
R.dimen.status_bar_height_portrait, mFakeStatusBarHeightPortrait);
|
||||
doReturn(mFakeStatusBarHeightPortrait).when(mOrganizer).getStatusBarHeight();
|
||||
doReturn(Surface.ROTATION_0).when(mDisplayLayout).rotation();
|
||||
mOrganizer.enableHideDisplayCutout();
|
||||
assertThat(mOrganizer.mCurrentDisplayBounds).isEqualTo(new Rect(0, 15, 100, 200));
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
|
||||
<!-- Keyguard messages -->
|
||||
<LinearLayout
|
||||
android:id="@+id/keyguard_message_area_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
|
||||
@@ -27,8 +27,10 @@ import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.R;
|
||||
|
||||
@@ -55,6 +57,8 @@ public class KeyguardMessageArea extends TextView implements SecurityMessageDisp
|
||||
private ColorStateList mNextMessageColorState = ColorStateList.valueOf(DEFAULT_COLOR);
|
||||
private boolean mBouncerVisible;
|
||||
private boolean mAltBouncerShowing;
|
||||
private ViewGroup mContainer;
|
||||
private int mTopMargin;
|
||||
|
||||
public KeyguardMessageArea(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -64,6 +68,24 @@ public class KeyguardMessageArea extends TextView implements SecurityMessageDisp
|
||||
onThemeChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
mContainer = getRootView().findViewById(R.id.keyguard_message_area_container);
|
||||
}
|
||||
|
||||
void onConfigChanged() {
|
||||
final int newTopMargin = SystemBarUtils.getStatusBarHeight(getContext());
|
||||
if (mTopMargin == newTopMargin) {
|
||||
return;
|
||||
}
|
||||
mTopMargin = newTopMargin;
|
||||
ViewGroup.MarginLayoutParams lp =
|
||||
(ViewGroup.MarginLayoutParams) mContainer.getLayoutParams();
|
||||
lp.topMargin = mTopMargin;
|
||||
mContainer.setLayoutParams(lp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNextMessageColor(ColorStateList colorState) {
|
||||
mNextMessageColorState = colorState;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.keyguard;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Configuration;
|
||||
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
|
||||
@@ -47,6 +48,11 @@ public class KeyguardMessageAreaController extends ViewController<KeyguardMessag
|
||||
};
|
||||
|
||||
private ConfigurationListener mConfigurationListener = new ConfigurationListener() {
|
||||
@Override
|
||||
public void onConfigChanged(Configuration newConfig) {
|
||||
mView.onConfigChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onThemeChanged() {
|
||||
mView.onThemeChanged();
|
||||
|
||||
@@ -91,7 +91,7 @@ public class AnalogClockController implements ClockPlugin {
|
||||
mResources = res;
|
||||
mLayoutInflater = inflater;
|
||||
mColorExtractor = colorExtractor;
|
||||
mClockPosition = new SmallClockPosition(res);
|
||||
mClockPosition = new SmallClockPosition(inflater.getContext());
|
||||
}
|
||||
|
||||
private void createViews() {
|
||||
|
||||
@@ -91,7 +91,7 @@ public class BubbleClockController implements ClockPlugin {
|
||||
mResources = res;
|
||||
mLayoutInflater = inflater;
|
||||
mColorExtractor = colorExtractor;
|
||||
mClockPosition = new SmallClockPosition(res);
|
||||
mClockPosition = new SmallClockPosition(inflater.getContext());
|
||||
}
|
||||
|
||||
private void createViews() {
|
||||
|
||||
@@ -16,10 +16,11 @@
|
||||
|
||||
package com.android.keyguard.clock;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.content.Context;
|
||||
import android.util.MathUtils;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.systemui.R;
|
||||
|
||||
/**
|
||||
@@ -40,11 +41,11 @@ class SmallClockPosition {
|
||||
*/
|
||||
private float mDarkAmount;
|
||||
|
||||
SmallClockPosition(Resources res) {
|
||||
this(res.getDimensionPixelSize(R.dimen.status_bar_height),
|
||||
res.getDimensionPixelSize(R.dimen.keyguard_lock_padding),
|
||||
res.getDimensionPixelSize(R.dimen.keyguard_lock_height),
|
||||
res.getDimensionPixelSize(R.dimen.burn_in_prevention_offset_y)
|
||||
SmallClockPosition(Context context) {
|
||||
this(SystemBarUtils.getStatusBarHeight(context),
|
||||
context.getResources().getDimensionPixelSize(R.dimen.keyguard_lock_padding),
|
||||
context.getResources().getDimensionPixelSize(R.dimen.keyguard_lock_height),
|
||||
context.getResources().getDimensionPixelSize(R.dimen.burn_in_prevention_offset_y)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.widget.ImageView;
|
||||
import com.android.systemui.Dumpable;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.qs.customize.QSCustomizer;
|
||||
import com.android.systemui.util.Utils;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
@@ -155,8 +156,7 @@ public class QSContainerImpl extends FrameLayout implements Dumpable {
|
||||
QuickStatusBarHeaderController quickStatusBarHeaderController) {
|
||||
mQSPanelContainer.setPaddingRelative(
|
||||
getPaddingStart(),
|
||||
mContext.getResources()
|
||||
.getDimensionPixelSize(R.dimen.qs_header_system_icons_area_height),
|
||||
Utils.getQsHeaderSystemIconsAreaHeight(mContext),
|
||||
getPaddingEnd(),
|
||||
getPaddingBottom()
|
||||
);
|
||||
|
||||
@@ -40,6 +40,7 @@ import android.widget.TextView;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.UiEventLogger;
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.FontSizeUtils;
|
||||
import com.android.systemui.R;
|
||||
@@ -164,8 +165,7 @@ public class QSDetail extends LinearLayout {
|
||||
public void updateResources() {
|
||||
updateDetailText();
|
||||
MarginLayoutParams lp = (MarginLayoutParams) getLayoutParams();
|
||||
lp.topMargin = mContext.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.quick_qs_offset_height);
|
||||
lp.topMargin = SystemBarUtils.getQuickQsOffsetHeight(mContext);
|
||||
setLayoutParams(lp);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import android.widget.Space;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.battery.BatteryMeterView;
|
||||
@@ -240,8 +241,7 @@ public class QuickStatusBarHeader extends FrameLayout {
|
||||
mRoundedCornerPadding = resources.getDimensionPixelSize(
|
||||
R.dimen.rounded_corner_content_padding);
|
||||
|
||||
int qsOffsetHeight = resources.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.quick_qs_offset_height);
|
||||
int qsOffsetHeight = SystemBarUtils.getQuickQsOffsetHeight(mContext);
|
||||
|
||||
mDatePrivacyView.getLayoutParams().height =
|
||||
Math.max(qsOffsetHeight, mDatePrivacyView.getMinimumHeight());
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.android.systemui.plugins.qs.QS;
|
||||
import com.android.systemui.plugins.qs.QSContainerController;
|
||||
import com.android.systemui.qs.QSDetailClipper;
|
||||
import com.android.systemui.statusbar.phone.LightBarController;
|
||||
import com.android.systemui.util.Utils;
|
||||
|
||||
/**
|
||||
* Allows full-screen customization of QS, through show() and hide().
|
||||
@@ -84,8 +85,7 @@ public class QSCustomizer extends LinearLayout {
|
||||
|
||||
void updateResources() {
|
||||
LayoutParams lp = (LayoutParams) mTransparentView.getLayoutParams();
|
||||
lp.height = mContext.getResources()
|
||||
.getDimensionPixelSize(R.dimen.qs_header_system_icons_area_height);
|
||||
lp.height = Utils.getQsHeaderSystemIconsAreaHeight(mContext);
|
||||
mTransparentView.setLayoutParams(lp);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.view.animation.Interpolator;
|
||||
import android.view.animation.PathInterpolator;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.animation.ShadeInterpolation;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
|
||||
@@ -114,7 +115,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
||||
|
||||
private void initDimens() {
|
||||
Resources res = getResources();
|
||||
mStatusBarHeight = res.getDimensionPixelOffset(R.dimen.status_bar_height);
|
||||
mStatusBarHeight = SystemBarUtils.getStatusBarHeight(mContext);
|
||||
mPaddingBetweenElements = res.getDimensionPixelSize(R.dimen.notification_divider_height);
|
||||
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
|
||||
@@ -71,6 +71,7 @@ import android.widget.ScrollView;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.graphics.ColorUtils;
|
||||
import com.android.internal.jank.InteractionJankMonitor;
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.keyguard.KeyguardSliceView;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.Dependency;
|
||||
@@ -937,7 +938,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
res.getDimensionPixelSize(R.dimen.notification_divider_height));
|
||||
mMinTopOverScrollToEscape = res.getDimensionPixelSize(
|
||||
R.dimen.min_top_overscroll_to_qs);
|
||||
mStatusBarHeight = res.getDimensionPixelSize(R.dimen.status_bar_height);
|
||||
mStatusBarHeight = SystemBarUtils.getStatusBarHeight(mContext);
|
||||
mBottomMargin = res.getDimensionPixelSize(R.dimen.notification_panel_margin_bottom);
|
||||
mMinimumPaddings = res.getDimensionPixelSize(R.dimen.notification_side_paddings);
|
||||
mQsTilePadding = res.getDimensionPixelOffset(R.dimen.qs_tile_margin_horizontal);
|
||||
@@ -948,8 +949,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
mCornerRadius = res.getDimensionPixelSize(R.dimen.notification_corner_radius);
|
||||
mHeadsUpInset = mStatusBarHeight + res.getDimensionPixelSize(
|
||||
R.dimen.heads_up_status_bar_padding);
|
||||
mQsScrollBoundaryPosition = res.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.quick_qs_offset_height);
|
||||
mQsScrollBoundaryPosition = SystemBarUtils.getQuickQsOffsetHeight(mContext);
|
||||
}
|
||||
|
||||
void updateSidePadding(int viewWidth) {
|
||||
@@ -1707,7 +1707,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
super.onConfigurationChanged(newConfig);
|
||||
Resources res = getResources();
|
||||
updateSplitNotificationShade();
|
||||
mStatusBarHeight = res.getDimensionPixelOffset(R.dimen.status_bar_height);
|
||||
mStatusBarHeight = SystemBarUtils.getStatusBarHeight(mContext);
|
||||
float densityScale = res.getDisplayMetrics().density;
|
||||
mSwipeHelper.setDensityScale(densityScale);
|
||||
float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.animation.ShadeInterpolation;
|
||||
import com.android.systemui.statusbar.NotificationShelf;
|
||||
@@ -77,7 +78,7 @@ public class StackScrollAlgorithm {
|
||||
R.dimen.notification_divider_height);
|
||||
mCollapsedSize = res.getDimensionPixelSize(R.dimen.notification_min_height);
|
||||
mClipNotificationScrollToTop = res.getBoolean(R.bool.config_clipNotificationScrollToTop);
|
||||
int statusBarHeight = res.getDimensionPixelSize(R.dimen.status_bar_height);
|
||||
int statusBarHeight = SystemBarUtils.getStatusBarHeight(context);
|
||||
mHeadsUpInset = statusBarHeight + res.getDimensionPixelSize(
|
||||
R.dimen.heads_up_status_bar_padding);
|
||||
mPinnedZTranslationExtra = res.getDimensionPixelSize(
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.util.Pools;
|
||||
import androidx.collection.ArraySet;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.systemui.Dumpable;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
@@ -137,9 +138,8 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
|
||||
|
||||
private void updateResources() {
|
||||
Resources resources = mContext.getResources();
|
||||
mHeadsUpInset =
|
||||
resources.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height)
|
||||
+ resources.getDimensionPixelSize(R.dimen.heads_up_status_bar_padding);
|
||||
mHeadsUpInset = SystemBarUtils.getStatusBarHeight(mContext)
|
||||
+ resources.getDimensionPixelSize(R.dimen.heads_up_status_bar_padding);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowInsets;
|
||||
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.keyguard.KeyguardHostViewController;
|
||||
import com.android.keyguard.KeyguardRootViewController;
|
||||
import com.android.keyguard.KeyguardSecurityModel;
|
||||
@@ -467,8 +468,7 @@ public class KeyguardBouncer {
|
||||
mKeyguardViewController.init();
|
||||
|
||||
mContainer.addView(mRoot, mContainer.getChildCount());
|
||||
mStatusBarHeight = mRoot.getResources().getDimensionPixelOffset(
|
||||
com.android.systemui.R.dimen.status_bar_height);
|
||||
mStatusBarHeight = SystemBarUtils.getStatusBarHeight(mContext);
|
||||
setVisibility(View.INVISIBLE);
|
||||
|
||||
final WindowInsets rootInsets = mRoot.getRootWindowInsets();
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone;
|
||||
|
||||
import static com.android.systemui.DejankUtils.whitelistIpcs;
|
||||
import static com.android.systemui.ScreenDecorations.DisplayCutoutView.boundsFromDirection;
|
||||
import static com.android.systemui.util.Utils.getStatusBarHeaderHeightKeyguard;
|
||||
|
||||
import android.annotation.ColorInt;
|
||||
import android.content.Context;
|
||||
@@ -162,11 +163,8 @@ public class KeyguardStatusBarView extends RelativeLayout {
|
||||
}
|
||||
|
||||
private void updateKeyguardStatusBarHeight() {
|
||||
final int waterfallTop =
|
||||
mDisplayCutout == null ? 0 : mDisplayCutout.getWaterfallInsets().top;
|
||||
MarginLayoutParams lp = (MarginLayoutParams) getLayoutParams();
|
||||
lp.height = getResources().getDimensionPixelSize(
|
||||
R.dimen.status_bar_header_height_keyguard) + waterfallTop;
|
||||
lp.height = getStatusBarHeaderHeightKeyguard(mContext);
|
||||
setLayoutParams(lp);
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ import com.android.internal.jank.InteractionJankMonitor;
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.internal.policy.ScreenDecorationsUtils;
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.internal.util.LatencyTracker;
|
||||
import com.android.keyguard.KeyguardStatusView;
|
||||
import com.android.keyguard.KeyguardStatusViewController;
|
||||
@@ -890,10 +891,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
super.loadDimens();
|
||||
mFlingAnimationUtils = mFlingAnimationUtilsBuilder.get()
|
||||
.setMaxLengthSeconds(0.4f).build();
|
||||
mStatusBarMinHeight = mResources.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.status_bar_height);
|
||||
mStatusBarHeaderHeightKeyguard = mResources.getDimensionPixelSize(
|
||||
R.dimen.status_bar_header_height_keyguard);
|
||||
mStatusBarMinHeight = SystemBarUtils.getStatusBarHeight(mView.getContext());
|
||||
mStatusBarHeaderHeightKeyguard = Utils.getStatusBarHeaderHeightKeyguard(mView.getContext());
|
||||
mQsPeekHeight = mResources.getDimensionPixelSize(R.dimen.qs_peek_height);
|
||||
mClockPositionAlgorithm.loadDimens(mResources);
|
||||
mQsFalsingThreshold = mResources.getDimensionPixelSize(R.dimen.qs_falsing_threshold);
|
||||
@@ -903,8 +902,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
R.dimen.keyguard_indication_bottom_padding);
|
||||
mShelfHeight = mResources.getDimensionPixelSize(R.dimen.notification_shelf_height);
|
||||
mDarkIconSize = mResources.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size_dark);
|
||||
int statusbarHeight = mResources.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.status_bar_height);
|
||||
int statusbarHeight = SystemBarUtils.getStatusBarHeight(mView.getContext());
|
||||
mHeadsUpInset = statusbarHeight + mResources.getDimensionPixelSize(
|
||||
R.dimen.heads_up_status_bar_padding);
|
||||
mDistanceForQSFullShadeTransition = mResources.getDimensionPixelSize(
|
||||
@@ -973,10 +971,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
}
|
||||
|
||||
public void updateResources() {
|
||||
mQuickQsOffsetHeight = mResources.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.quick_qs_offset_height);
|
||||
mSplitShadeStatusBarHeight =
|
||||
mResources.getDimensionPixelSize(R.dimen.split_shade_header_height);
|
||||
mQuickQsOffsetHeight = SystemBarUtils.getQuickQsOffsetHeight(mView.getContext());
|
||||
mSplitShadeStatusBarHeight = Utils.getSplitShadeStatusBarHeight(mView.getContext());
|
||||
int qsWidth = mResources.getDimensionPixelSize(R.dimen.qs_panel_width);
|
||||
int panelWidth = mResources.getDimensionPixelSize(R.dimen.notification_panel_width);
|
||||
mShouldUseSplitNotificationShade =
|
||||
@@ -1002,6 +998,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
constraintSet.connect(
|
||||
R.id.notification_stack_scroller, START,
|
||||
R.id.qs_edge_guideline, START);
|
||||
constraintSet.constrainHeight(R.id.split_shade_status_bar, mSplitShadeStatusBarHeight);
|
||||
} else {
|
||||
constraintSet.connect(R.id.qs_frame, END, PARENT_ID, END);
|
||||
constraintSet.connect(R.id.notification_stack_scroller, START, PARENT_ID, START);
|
||||
|
||||
@@ -35,6 +35,7 @@ import android.view.WindowInsets;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.plugins.DarkIconDispatcher;
|
||||
@@ -223,7 +224,7 @@ public class PhoneStatusBarView extends PanelBar {
|
||||
final int waterfallTopInset =
|
||||
mDisplayCutout == null ? 0 : mDisplayCutout.getWaterfallInsets().top;
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
mStatusBarHeight = getResources().getDimensionPixelSize(R.dimen.status_bar_height);
|
||||
mStatusBarHeight = SystemBarUtils.getStatusBarHeight(mContext);
|
||||
layoutParams.height = mStatusBarHeight - waterfallTopInset;
|
||||
|
||||
int statusBarPaddingTop = getResources().getDimensionPixelSize(
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.view.DisplayCutout
|
||||
import android.view.View.LAYOUT_DIRECTION_RTL
|
||||
import android.view.WindowMetrics
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import com.android.internal.policy.SystemBarUtils
|
||||
import com.android.systemui.Dumpable
|
||||
import com.android.systemui.R
|
||||
import com.android.systemui.dagger.SysUISingleton
|
||||
@@ -174,7 +175,7 @@ class StatusBarContentInsetsProvider @Inject constructor(
|
||||
targetRotation,
|
||||
dc,
|
||||
context.resources.configuration.windowConfiguration.maxBounds,
|
||||
rotatedResources.getDimensionPixelSize(R.dimen.status_bar_height),
|
||||
SystemBarUtils.getStatusBarHeight(context),
|
||||
minLeft,
|
||||
minRight)
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import android.view.ViewTreeObserver;
|
||||
import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
|
||||
import android.view.WindowInsets;
|
||||
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.systemui.Dumpable;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.ScreenDecorations;
|
||||
@@ -172,8 +173,7 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
|
||||
Resources resources = mContext.getResources();
|
||||
mDisplayCutoutTouchableRegionSize = resources.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.display_cutout_touchable_region_size);
|
||||
mStatusBarHeight =
|
||||
resources.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
|
||||
mStatusBarHeight = SystemBarUtils.getStatusBarHeight(mContext);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,6 +40,7 @@ import android.view.Surface;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.dagger.SysUISingleton;
|
||||
import com.android.systemui.dagger.qualifiers.Main;
|
||||
@@ -86,8 +87,7 @@ public class StatusBarWindowController {
|
||||
mResources = resources;
|
||||
|
||||
if (mBarHeight < 0) {
|
||||
mBarHeight = mResources.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.status_bar_height);
|
||||
mBarHeight = SystemBarUtils.getStatusBarHeight(mContext);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,12 +96,11 @@ public class StatusBarWindowController {
|
||||
}
|
||||
|
||||
/**
|
||||
* Rereads the status_bar_height from configuration and reapplys the current state if the height
|
||||
* Rereads the status bar height and reapplys the current state if the height
|
||||
* is different.
|
||||
*/
|
||||
public void refreshStatusBarHeight() {
|
||||
int heightFromConfig = mResources.getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.status_bar_height);
|
||||
int heightFromConfig = SystemBarUtils.getStatusBarHeight(mContext);
|
||||
|
||||
if (mBarHeight != heightFromConfig) {
|
||||
mBarHeight = heightFromConfig;
|
||||
@@ -139,29 +138,20 @@ public class StatusBarWindowController {
|
||||
private WindowManager.LayoutParams getBarLayoutParamsForRotation(int rotation) {
|
||||
int height = mBarHeight;
|
||||
if (INSETS_LAYOUT_GENERALIZATION) {
|
||||
Rect displayBounds = mWindowManager.getCurrentWindowMetrics().getBounds();
|
||||
int defaultAndUpsideDownHeight;
|
||||
int theOtherHeight;
|
||||
if (displayBounds.width() > displayBounds.height()) {
|
||||
defaultAndUpsideDownHeight = mContext.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.status_bar_height_landscape);
|
||||
theOtherHeight = mContext.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.status_bar_height_portrait);
|
||||
} else {
|
||||
defaultAndUpsideDownHeight = mContext.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.status_bar_height_portrait);
|
||||
theOtherHeight = mContext.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.status_bar_height_landscape);
|
||||
}
|
||||
switch (rotation) {
|
||||
case ROTATION_UNDEFINED:
|
||||
case Surface.ROTATION_0:
|
||||
case Surface.ROTATION_180:
|
||||
height = defaultAndUpsideDownHeight;
|
||||
height = SystemBarUtils.getStatusBarHeightForRotation(
|
||||
mContext, Surface.ROTATION_0);
|
||||
break;
|
||||
case Surface.ROTATION_90:
|
||||
height = SystemBarUtils.getStatusBarHeightForRotation(
|
||||
mContext, Surface.ROTATION_90);
|
||||
break;
|
||||
case Surface.ROTATION_270:
|
||||
height = theOtherHeight;
|
||||
height = SystemBarUtils.getStatusBarHeightForRotation(
|
||||
mContext, Surface.ROTATION_270);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,10 @@ import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.provider.Settings;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.DisplayCutout;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
import com.android.systemui.statusbar.CommandQueue;
|
||||
@@ -186,4 +188,39 @@ public class Utils {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link R.dimen#split_shade_header_height}.
|
||||
*
|
||||
* Currently, it's the same as {@link com.android.internal.R.dimen#quick_qs_offset_height}.
|
||||
*/
|
||||
public static int getSplitShadeStatusBarHeight(Context context) {
|
||||
return SystemBarUtils.getQuickQsOffsetHeight(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link R.dimen#qs_header_system_icons_area_height}.
|
||||
*
|
||||
* It's the same as {@link com.android.internal.R.dimen#quick_qs_offset_height} except for
|
||||
* sw600dp-land.
|
||||
*/
|
||||
public static int getQsHeaderSystemIconsAreaHeight(Context context) {
|
||||
final Resources res = context.getResources();
|
||||
if (Utils.shouldUseSplitNotificationShade(res)) {
|
||||
return res.getDimensionPixelSize(R.dimen.qs_header_system_icons_area_height);
|
||||
} else {
|
||||
return SystemBarUtils.getQuickQsOffsetHeight(context);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link R.dimen#status_bar_header_height_keyguard}.
|
||||
*/
|
||||
public static int getStatusBarHeaderHeightKeyguard(Context context) {
|
||||
final int statusBarHeight = SystemBarUtils.getStatusBarHeight(context);
|
||||
final DisplayCutout cutout = context.getDisplay().getCutout();
|
||||
final int waterfallInsetTop = cutout == null ? 0 : cutout.getWaterfallInsets().top;
|
||||
final int statusBarHeaderHeightKeyguard = context.getResources()
|
||||
.getDimensionPixelSize(R.dimen.status_bar_header_height_keyguard);
|
||||
return Math.max(statusBarHeight, statusBarHeaderHeightKeyguard + waterfallInsetTop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class SmallClockPositionTest : SysuiTestCase() {
|
||||
@Test
|
||||
fun loadResources() {
|
||||
// Cover constructor taking Resources object.
|
||||
position = SmallClockPosition(context.resources)
|
||||
position = SmallClockPosition(context)
|
||||
position.setDarkAmount(1f)
|
||||
assertThat(position.preferredY).isGreaterThan(0)
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (C) 2018 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
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Can't link to other dimensions here, but this should be status_bar_height_landscape -->
|
||||
<dimen name="quick_qs_offset_height">28dp</dimen>
|
||||
<!-- Total height of QQS in landscape; quick_qs_offset_height + 128 -->
|
||||
<dimen name="quick_qs_total_height">156dp</dimen>
|
||||
</resources>
|
||||
@@ -44,14 +44,6 @@
|
||||
-->
|
||||
<bool name="config_fillMainBuiltInDisplayCutout">true</bool>
|
||||
|
||||
<!-- Height of the status bar -->
|
||||
<dimen name="status_bar_height_portrait">48dp</dimen>
|
||||
<dimen name="status_bar_height_landscape">28dp</dimen>
|
||||
<!-- Height of area above QQS where battery/time go (equal to status bar height if > 48dp) -->
|
||||
<dimen name="quick_qs_offset_height">48dp</dimen>
|
||||
<!-- Total height of QQS (quick_qs_offset_height + 128) -->
|
||||
<dimen name="quick_qs_total_height">176dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (C) 2018 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
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Can't link to other dimensions here, but this should be status_bar_height_landscape -->
|
||||
<dimen name="quick_qs_offset_height">28dp</dimen>
|
||||
<!-- Total height of QQS in landscape; quick_qs_offset_height + 128 -->
|
||||
<dimen name="quick_qs_total_height">156dp</dimen>
|
||||
</resources>
|
||||
@@ -56,14 +56,6 @@
|
||||
-->
|
||||
<bool name="config_fillMainBuiltInDisplayCutout">true</bool>
|
||||
|
||||
<!-- Height of the status bar -->
|
||||
<dimen name="status_bar_height_portrait">48dp</dimen>
|
||||
<dimen name="status_bar_height_landscape">28dp</dimen>
|
||||
<!-- Height of area above QQS where battery/time go (equal to status bar height if > 48dp) -->
|
||||
<dimen name="quick_qs_offset_height">48dp</dimen>
|
||||
<!-- Total height of QQS (quick_qs_offset_height + 128) -->
|
||||
<dimen name="quick_qs_total_height">176dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (C) 2020 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
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Can't link to other dimensions here, but this should be status_bar_height_landscape -->
|
||||
<dimen name="quick_qs_offset_height">28dp</dimen>
|
||||
<!-- Total height of QQS in landscape; quick_qs_offset_height + 128 -->
|
||||
<dimen name="quick_qs_total_height">156dp</dimen>
|
||||
</resources>
|
||||
@@ -48,14 +48,6 @@
|
||||
-->
|
||||
<bool name="config_fillMainBuiltInDisplayCutout">true</bool>
|
||||
|
||||
<!-- Height of the status bar -->
|
||||
<dimen name="status_bar_height_portrait">136px</dimen>
|
||||
<dimen name="status_bar_height_landscape">28dp</dimen>
|
||||
<!-- Height of area above QQS where battery/time go (equal to status bar) -->
|
||||
<dimen name="quick_qs_offset_height">136px</dimen>
|
||||
<!-- Total height of QQS (quick_qs_offset_height + 128) -->
|
||||
<dimen name="quick_qs_total_height">488px</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (C) 2018 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
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Can't link to other dimensions here, but this should be status_bar_height_landscape -->
|
||||
<dimen name="quick_qs_offset_height">28dp</dimen>
|
||||
<!-- Total height of QQS in landscape; quick_qs_offset_height + 128 -->
|
||||
<dimen name="quick_qs_total_height">156dp</dimen>
|
||||
</resources>
|
||||
@@ -47,14 +47,6 @@
|
||||
-->
|
||||
<bool name="config_fillMainBuiltInDisplayCutout">true</bool>
|
||||
|
||||
<!-- Height of the status bar -->
|
||||
<dimen name="status_bar_height_portrait">48dp</dimen>
|
||||
<dimen name="status_bar_height_landscape">28dp</dimen>
|
||||
<!-- Height of area above QQS where battery/time go (equal to status bar height if > 48dp) -->
|
||||
<dimen name="quick_qs_offset_height">48dp</dimen>
|
||||
<!-- Total height of QQS (quick_qs_offset_height + 128) -->
|
||||
<dimen name="quick_qs_total_height">176dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (C) 2018 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
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Can't link to other dimensions here, but this should be status_bar_height_landscape -->
|
||||
<dimen name="quick_qs_offset_height">28dp</dimen>
|
||||
<!-- Total height of QQS in landscape; quick_qs_offset_height + 128 -->
|
||||
<dimen name="quick_qs_total_height">156dp</dimen>
|
||||
</resources>
|
||||
@@ -47,14 +47,6 @@
|
||||
-->
|
||||
<bool name="config_fillMainBuiltInDisplayCutout">true</bool>
|
||||
|
||||
<!-- Height of the status bar -->
|
||||
<dimen name="status_bar_height_portrait">48dp</dimen>
|
||||
<dimen name="status_bar_height_landscape">28dp</dimen>
|
||||
<!-- Height of area above QQS where battery/time go (equal to status bar height if > 48dp) -->
|
||||
<dimen name="quick_qs_offset_height">48dp</dimen>
|
||||
<!-- Total height of QQS (quick_qs_offset_height + 128) -->
|
||||
<dimen name="quick_qs_total_height">176dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (C) 2020 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.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Can't link to other dimensions here, but this should be status_bar_height_landscape -->
|
||||
<dimen name="quick_qs_offset_height">48dp</dimen>
|
||||
<!-- Total height of QQS in landscape; quick_qs_offset_height + 128 -->
|
||||
<dimen name="quick_qs_total_height">176dp</dimen>
|
||||
</resources>
|
||||
@@ -19,16 +19,6 @@
|
||||
<string translatable="false" name="config_mainBuiltInDisplayCutout"></string>
|
||||
<string translatable="false" name="config_mainBuiltInDisplayCutoutRectApproximation"></string>
|
||||
|
||||
<!-- Height of the status bar in portrait. The height should be
|
||||
Max((status bar content height + waterfall top size), top cutout size) -->
|
||||
<dimen name="status_bar_height_portrait">28dp</dimen>
|
||||
<!-- Max((28 + 20), 0) = 48 -->
|
||||
<dimen name="status_bar_height_landscape">48dp</dimen>
|
||||
<!-- Height of area above QQS where battery/time go (equal to status bar height if > 48dp) -->
|
||||
<dimen name="quick_qs_offset_height">48dp</dimen>
|
||||
<!-- Total height of QQS (quick_qs_offset_height + 128) -->
|
||||
<dimen name="quick_qs_total_height">176dp</dimen>
|
||||
|
||||
<dimen name="waterfall_display_left_edge_size">20dp</dimen>
|
||||
<dimen name="waterfall_display_top_edge_size">0dp</dimen>
|
||||
<dimen name="waterfall_display_right_edge_size">20dp</dimen>
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (C) 2018 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
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Can't link to other dimensions here, but this should be status_bar_height_landscape -->
|
||||
<dimen name="quick_qs_offset_height">28dp</dimen>
|
||||
<!-- Total height of QQS in landscape; quick_qs_offset_height + 128 -->
|
||||
<dimen name="quick_qs_total_height">156dp</dimen>
|
||||
</resources>
|
||||
@@ -47,14 +47,6 @@
|
||||
-->
|
||||
<bool name="config_fillMainBuiltInDisplayCutout">true</bool>
|
||||
|
||||
<!-- Height of the status bar -->
|
||||
<dimen name="status_bar_height_portrait">48dp</dimen>
|
||||
<dimen name="status_bar_height_landscape">28dp</dimen>
|
||||
<!-- Height of area above QQS where battery/time go (equal to status bar height if > 48dp) -->
|
||||
<dimen name="quick_qs_offset_height">48dp</dimen>
|
||||
<!-- Total height of QQS (quick_qs_offset_height + 128) -->
|
||||
<dimen name="quick_qs_total_height">176dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
|
||||
|
||||
@@ -25,12 +25,4 @@
|
||||
by shrinking the display such that it does not overlap the cutout area. -->
|
||||
<bool name="config_maskMainBuiltInDisplayCutout">true</bool>
|
||||
|
||||
<!-- Height of the status bar -->
|
||||
<dimen name="status_bar_height_portrait">28dp</dimen>
|
||||
<dimen name="status_bar_height_landscape">28dp</dimen>
|
||||
|
||||
<!-- Height of area above QQS where battery/time go (equal to status bar height if > 48dp) -->
|
||||
<dimen name="quick_qs_offset_height">48dp</dimen>
|
||||
<!-- Total height of QQS (quick_qs_offset_height + 128) -->
|
||||
<dimen name="quick_qs_total_height">176dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -156,6 +156,7 @@ import com.android.internal.R;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.policy.GestureNavigationSettingsObserver;
|
||||
import com.android.internal.policy.ScreenDecorationsUtils;
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.internal.protolog.common.ProtoLog;
|
||||
import com.android.internal.util.ScreenshotHelper;
|
||||
import com.android.internal.util.function.TriConsumer;
|
||||
@@ -1315,6 +1316,11 @@ public class DisplayPolicy {
|
||||
return Math.max(statusBarHeight, displayFrames.mDisplayCutoutSafe.top);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
int getStatusBarHeightForRotation(@Surface.Rotation int rotation) {
|
||||
return SystemBarUtils.getStatusBarHeightForRotation(mUiContext, rotation);
|
||||
}
|
||||
|
||||
WindowState getStatusBar() {
|
||||
return mStatusBar != null ? mStatusBar : mStatusBarAlt;
|
||||
}
|
||||
@@ -1584,8 +1590,6 @@ public class DisplayPolicy {
|
||||
// For layout, the status bar is always at the top with our fixed height.
|
||||
int statusBarBottom = displayFrames.mUnrestricted.top
|
||||
+ mStatusBarHeightForRotation[displayFrames.mRotation];
|
||||
// Make sure the status bar covers the entire cutout height
|
||||
statusBarBottom = Math.max(statusBarBottom, displayFrames.mDisplayCutoutSafe.top);
|
||||
|
||||
if (displayFrames.mDisplayCutoutSafe.top > displayFrames.mUnrestricted.top) {
|
||||
// Make sure that the zone we're avoiding for the cutout is at least as tall as the
|
||||
@@ -2118,10 +2122,11 @@ public class DisplayPolicy {
|
||||
if (hasStatusBar()) {
|
||||
mStatusBarHeightForRotation[portraitRotation] =
|
||||
mStatusBarHeightForRotation[upsideDownRotation] =
|
||||
res.getDimensionPixelSize(R.dimen.status_bar_height_portrait);
|
||||
getStatusBarHeightForRotation(portraitRotation);
|
||||
mStatusBarHeightForRotation[landscapeRotation] =
|
||||
mStatusBarHeightForRotation[seascapeRotation] =
|
||||
res.getDimensionPixelSize(R.dimen.status_bar_height_landscape);
|
||||
getStatusBarHeightForRotation(landscapeRotation);
|
||||
mStatusBarHeightForRotation[seascapeRotation] =
|
||||
getStatusBarHeightForRotation(seascapeRotation);
|
||||
mDisplayCutoutTouchableRegionSize = res.getDimensionPixelSize(
|
||||
R.dimen.display_cutout_touchable_region_size);
|
||||
} else {
|
||||
|
||||
@@ -31,6 +31,7 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
|
||||
import static com.android.server.wm.utils.CoordinateTransforms.transformPhysicalToLogicalCoordinates;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
@@ -75,13 +76,12 @@ public class DisplayPolicyTestsBase extends WindowTestsBase {
|
||||
final TestContextWrapper context = new TestContextWrapper(
|
||||
mDisplayPolicy.getContext(), mDisplayPolicy.getCurrentUserResources());
|
||||
final TestableResources resources = context.getResourceMocker();
|
||||
resources.addOverride(R.dimen.status_bar_height_portrait, STATUS_BAR_HEIGHT);
|
||||
resources.addOverride(R.dimen.status_bar_height_landscape, STATUS_BAR_HEIGHT);
|
||||
resources.addOverride(R.dimen.navigation_bar_height, NAV_BAR_HEIGHT);
|
||||
resources.addOverride(R.dimen.navigation_bar_height_landscape, NAV_BAR_HEIGHT);
|
||||
resources.addOverride(R.dimen.navigation_bar_width, NAV_BAR_HEIGHT);
|
||||
resources.addOverride(R.dimen.navigation_bar_frame_height_landscape, NAV_BAR_HEIGHT);
|
||||
resources.addOverride(R.dimen.navigation_bar_frame_height, NAV_BAR_HEIGHT);
|
||||
doReturn(STATUS_BAR_HEIGHT).when(mDisplayPolicy).getStatusBarHeightForRotation(anyInt());
|
||||
doReturn(resources.getResources()).when(mDisplayPolicy).getCurrentUserResources();
|
||||
doReturn(true).when(mDisplayPolicy).hasNavigationBar();
|
||||
doReturn(true).when(mDisplayPolicy).hasStatusBar();
|
||||
|
||||
@@ -83,6 +83,8 @@ import android.view.WindowManager;
|
||||
|
||||
import androidx.test.filters.MediumTest;
|
||||
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
|
||||
import libcore.junit.util.compat.CoreCompatChangeRule.DisableCompatChanges;
|
||||
import libcore.junit.util.compat.CoreCompatChangeRule.EnableCompatChanges;
|
||||
|
||||
@@ -2128,8 +2130,7 @@ public class SizeCompatTests extends WindowTestsBase {
|
||||
displayContent.mWmService, mock(Session.class), new TestIWindow(), attrs, token);
|
||||
token.addWindow(statusBar);
|
||||
statusBar.setRequestedSize(displayContent.mBaseDisplayWidth,
|
||||
displayContent.getDisplayUiContext().getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.status_bar_height));
|
||||
SystemBarUtils.getStatusBarHeight(displayContent.getDisplayUiContext()));
|
||||
|
||||
displayPolicy.addWindowLw(statusBar, attrs);
|
||||
displayPolicy.layoutWindowLw(statusBar, null, displayContent.mDisplayFrames);
|
||||
|
||||
Reference in New Issue
Block a user