[DO NOT MERGE] Lockscreen/Shade upscaling
Aligns shade width and clock placement with latest UX specs. Removes concept of a fixed stack scroller width in favor of margins that adjust across various swXXXdp files. For phones, this means the shade takes up the entire width, for larger portrait devices, a sizeable margin, and for larger landscape devices, a smaller but visible margin. Remove unused code from KeyguardStatusView Fixes: 214596698 Test: atest NotificationPanelViewControllerTest && Tested landscape and portrait across all device categories Change-Id: Ie384d88c9a2c20516c29dc49b9b7cc54de89917c Change-Id: I82764f776aa43ba69d7bf93b76af111e20fd07b8
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
systemui:layout_constraintStart_toStartOf="parent"
|
||||
systemui:layout_constraintEnd_toEndOf="parent"
|
||||
systemui:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginHorizontal="@dimen/status_view_margin_horizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/half_shelf"
|
||||
android:layout_width="@dimen/qs_panel_width"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="bottom"
|
||||
|
||||
@@ -94,10 +94,11 @@
|
||||
<FrameLayout
|
||||
android:id="@+id/qs_frame"
|
||||
android:layout="@layout/qs_panel"
|
||||
android:layout_width="@dimen/qs_panel_width"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
android:layout_marginHorizontal="@dimen/notification_panel_margin_horizontal"
|
||||
systemui:viewType="com.android.systemui.plugins.qs.QS"
|
||||
systemui:layout_constraintStart_toStartOf="parent"
|
||||
systemui:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -115,8 +116,9 @@
|
||||
<com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
|
||||
android:id="@+id/notification_stack_scroller"
|
||||
android:layout_marginTop="@dimen/notification_panel_margin_top"
|
||||
android:layout_width="@dimen/notification_panel_width"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="@dimen/notification_panel_margin_horizontal"
|
||||
android:layout_marginBottom="@dimen/notification_panel_margin_bottom"
|
||||
android:importantForAccessibility="no"
|
||||
systemui:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/plugin_frame"
|
||||
android:theme="@style/Theme.SystemUI.QuickSettings"
|
||||
android:layout_width="@dimen/qs_panel_width"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/notification_side_paddings"
|
||||
|
||||
@@ -46,4 +46,5 @@
|
||||
the shade -->
|
||||
<dimen name="lockscreen_shade_media_transition_distance">200dp</dimen>
|
||||
|
||||
<dimen name="notification_panel_margin_horizontal">12dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Size of the panel of large phones on portrait. This shouldn't fill, but have some padding on the side -->
|
||||
<dimen name="notification_panel_width">504dp</dimen>
|
||||
|
||||
<dimen name="notification_panel_margin_horizontal">60dp</dimen>
|
||||
<dimen name="status_view_margin_horizontal">62dp</dimen>
|
||||
<dimen name="keyguard_clock_top_margin">40dp</dimen>
|
||||
<dimen name="keyguard_status_view_bottom_margin">40dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -22,4 +22,6 @@
|
||||
<dimen name="notification_panel_margin_bottom">56dp</dimen>
|
||||
|
||||
<dimen name="keyguard_split_shade_top_margin">72dp</dimen>
|
||||
|
||||
<dimen name="notification_panel_margin_horizontal">24dp</dimen>
|
||||
</resources>
|
||||
|
||||
27
packages/SystemUI/res/values-sw720dp-port/dimens.xml
Normal file
27
packages/SystemUI/res/values-sw720dp-port/dimens.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2022, 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<!-- These resources are around just to allow their values to be customized
|
||||
for different hardware and product builds. -->
|
||||
<resources>
|
||||
<dimen name="status_view_margin_horizontal">124dp</dimen>
|
||||
<dimen name="notification_panel_margin_horizontal">120dp</dimen>
|
||||
<dimen name="keyguard_clock_top_margin">80dp</dimen>
|
||||
<dimen name="keyguard_status_view_bottom_margin">80dp</dimen>
|
||||
</resources>
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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>
|
||||
<!-- Standard notification width + gravity -->
|
||||
<dimen name="notification_panel_width">-1px</dimen> <!-- match_parent -->
|
||||
</resources>
|
||||
@@ -388,13 +388,10 @@
|
||||
|
||||
<dimen name="split_shade_notifications_scrim_margin_bottom">0dp</dimen>
|
||||
|
||||
<dimen name="notification_panel_width">@dimen/match_parent</dimen>
|
||||
<dimen name="notification_panel_margin_horizontal">0dp</dimen>
|
||||
|
||||
<dimen name="brightness_mirror_height">48dp</dimen>
|
||||
|
||||
<!-- The width of the panel that holds the quick settings. -->
|
||||
<dimen name="qs_panel_width">@dimen/notification_panel_width</dimen>
|
||||
|
||||
<dimen name="volume_dialog_panel_transparent_padding_right">8dp</dimen>
|
||||
|
||||
<dimen name="volume_dialog_panel_transparent_padding">20dp</dimen>
|
||||
@@ -1391,4 +1388,6 @@
|
||||
|
||||
<!-- The margin applied between complications -->
|
||||
<dimen name="dream_overlay_complication_margin">0dp</dimen>
|
||||
|
||||
<dimen name="status_view_margin_horizontal">0dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package com.android.keyguard;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.IActivityManager;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
@@ -27,7 +25,6 @@ import android.widget.GridLayout;
|
||||
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.statusbar.CrossFadeHelper;
|
||||
|
||||
@@ -44,9 +41,6 @@ public class KeyguardStatusView extends GridLayout {
|
||||
private static final boolean DEBUG = KeyguardConstants.DEBUG;
|
||||
private static final String TAG = "KeyguardStatusView";
|
||||
|
||||
private final LockPatternUtils mLockPatternUtils;
|
||||
private final IActivityManager mIActivityManager;
|
||||
|
||||
private ViewGroup mStatusViewContainer;
|
||||
private KeyguardClockSwitch mClockView;
|
||||
private KeyguardSliceView mKeyguardSlice;
|
||||
@@ -56,14 +50,6 @@ public class KeyguardStatusView extends GridLayout {
|
||||
private int mTextColor;
|
||||
private float mChildrenAlphaExcludingSmartSpace = 1f;
|
||||
|
||||
/**
|
||||
* Bottom margin that defines the margin between bottom of smart space and top of notification
|
||||
* icons on AOD.
|
||||
*/
|
||||
private int mIconTopMargin;
|
||||
private int mIconTopMarginWithHeader;
|
||||
private boolean mShowingHeader;
|
||||
|
||||
public KeyguardStatusView(Context context) {
|
||||
this(context, null, 0);
|
||||
}
|
||||
@@ -74,8 +60,6 @@ public class KeyguardStatusView extends GridLayout {
|
||||
|
||||
public KeyguardStatusView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
mIActivityManager = ActivityManager.getService();
|
||||
mLockPatternUtils = new LockPatternUtils(getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,25 +75,11 @@ public class KeyguardStatusView extends GridLayout {
|
||||
mKeyguardSlice = findViewById(R.id.keyguard_slice_view);
|
||||
mTextColor = mClockView.getCurrentTextColor();
|
||||
|
||||
mKeyguardSlice.setContentChangeListener(this::onSliceContentChanged);
|
||||
onSliceContentChanged();
|
||||
|
||||
mMediaHostContainer = findViewById(R.id.status_view_media_container);
|
||||
|
||||
updateDark();
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves clock, adjusting margins when slice content changes.
|
||||
*/
|
||||
private void onSliceContentChanged() {
|
||||
final boolean hasHeader = mKeyguardSlice.hasHeader();
|
||||
if (mShowingHeader == hasHeader) {
|
||||
return;
|
||||
}
|
||||
mShowingHeader = hasHeader;
|
||||
}
|
||||
|
||||
void setDarkAmount(float darkAmount) {
|
||||
if (mDarkAmount == darkAmount) {
|
||||
return;
|
||||
@@ -158,10 +128,4 @@ public class KeyguardStatusView extends GridLayout {
|
||||
mKeyguardSlice.dump(fd, pw, args);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadBottomMargin() {
|
||||
mIconTopMargin = getResources().getDimensionPixelSize(R.dimen.widget_vertical_padding);
|
||||
mIconTopMarginWithHeader = getResources().getDimensionPixelSize(
|
||||
R.dimen.widget_vertical_padding_with_header);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1144,8 +1144,9 @@ public class NotificationPanelViewController extends PanelViewController
|
||||
mSplitShadeNotificationsScrimMarginBottom =
|
||||
mResources.getDimensionPixelSize(
|
||||
R.dimen.split_shade_notifications_scrim_margin_bottom);
|
||||
int qsWidth = mResources.getDimensionPixelSize(R.dimen.qs_panel_width);
|
||||
int panelWidth = mResources.getDimensionPixelSize(R.dimen.notification_panel_width);
|
||||
|
||||
int panelMarginHorizontal = mResources.getDimensionPixelSize(
|
||||
R.dimen.notification_panel_margin_horizontal);
|
||||
|
||||
final boolean newShouldUseSplitNotificationShade =
|
||||
Utils.shouldUseSplitNotificationShade(mResources);
|
||||
@@ -1167,11 +1168,12 @@ public class NotificationPanelViewController extends PanelViewController
|
||||
ensureAllViewsHaveIds(mNotificationContainerParent);
|
||||
ConstraintSet constraintSet = new ConstraintSet();
|
||||
constraintSet.clone(mNotificationContainerParent);
|
||||
|
||||
int statusViewMarginHorizontal = mResources.getDimensionPixelSize(
|
||||
R.dimen.status_view_margin_horizontal);
|
||||
constraintSet.setMargin(R.id.keyguard_status_view, START, statusViewMarginHorizontal);
|
||||
constraintSet.setMargin(R.id.keyguard_status_view, END, statusViewMarginHorizontal);
|
||||
if (mShouldUseSplitNotificationShade) {
|
||||
// width = 0 to take up all available space within constraints
|
||||
qsWidth = 0;
|
||||
panelWidth = 0;
|
||||
constraintSet.connect(R.id.qs_frame, END, R.id.qs_edge_guideline, END);
|
||||
constraintSet.connect(
|
||||
R.id.notification_stack_scroller, START,
|
||||
@@ -1184,11 +1186,15 @@ public class NotificationPanelViewController extends PanelViewController
|
||||
constraintSet.constrainHeight(R.id.split_shade_status_bar, WRAP_CONTENT);
|
||||
}
|
||||
}
|
||||
constraintSet.getConstraint(R.id.notification_stack_scroller).layout.mWidth = panelWidth;
|
||||
constraintSet.getConstraint(R.id.qs_frame).layout.mWidth = qsWidth;
|
||||
constraintSet.setMargin(R.id.notification_stack_scroller, START,
|
||||
mShouldUseSplitNotificationShade ? 0 : panelMarginHorizontal);
|
||||
constraintSet.setMargin(R.id.notification_stack_scroller, END, panelMarginHorizontal);
|
||||
constraintSet.setMargin(R.id.notification_stack_scroller, TOP, topMargin);
|
||||
constraintSet.setMargin(R.id.notification_stack_scroller, BOTTOM,
|
||||
notificationsBottomMargin);
|
||||
constraintSet.setMargin(R.id.qs_frame, START, panelMarginHorizontal);
|
||||
constraintSet.setMargin(R.id.qs_frame, END,
|
||||
mShouldUseSplitNotificationShade ? 0 : panelMarginHorizontal);
|
||||
constraintSet.setMargin(R.id.qs_frame, TOP, topMargin);
|
||||
constraintSet.applyTo(mNotificationContainerParent);
|
||||
mAmbientState.setStackTopMargin(topMargin);
|
||||
|
||||
@@ -390,8 +390,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
||||
when(mResources.getBoolean(R.bool.config_enableNotificationShadeDrag)).thenReturn(true);
|
||||
when(mResources.getDimensionPixelSize(R.dimen.notifications_top_padding_split_shade))
|
||||
.thenReturn(NOTIFICATION_SCRIM_TOP_PADDING_IN_SPLIT_SHADE);
|
||||
when(mResources.getDimensionPixelSize(R.dimen.qs_panel_width)).thenReturn(400);
|
||||
when(mResources.getDimensionPixelSize(R.dimen.notification_panel_width)).thenReturn(400);
|
||||
when(mResources.getDimensionPixelSize(R.dimen.notification_panel_margin_horizontal))
|
||||
.thenReturn(10);
|
||||
when(mView.getContext()).thenReturn(getContext());
|
||||
when(mView.findViewById(R.id.keyguard_header)).thenReturn(mKeyguardStatusBar);
|
||||
when(mView.findViewById(R.id.keyguard_user_switcher_view)).thenReturn(mUserSwitcherView);
|
||||
@@ -790,25 +790,31 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSinglePaneShadeLayout_childrenHaveConstantWidth() {
|
||||
enableSplitShade(/* enabled= */ false);
|
||||
|
||||
mNotificationPanelViewController.updateResources();
|
||||
|
||||
assertThat(getConstraintSetLayout(R.id.qs_frame).mWidth)
|
||||
.isEqualTo(mResources.getDimensionPixelSize(R.dimen.qs_panel_width));
|
||||
assertThat(getConstraintSetLayout(R.id.notification_stack_scroller).mWidth)
|
||||
.isEqualTo(mResources.getDimensionPixelSize(R.dimen.notification_panel_width));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSplitShadeLayout_childrenHaveZeroWidth() {
|
||||
public void testSplitShadeLayout_childrenHaveInsideMarginsOfZero() {
|
||||
enableSplitShade(/* enabled= */ true);
|
||||
|
||||
mNotificationPanelViewController.updateResources();
|
||||
|
||||
assertThat(getConstraintSetLayout(R.id.qs_frame).mWidth).isEqualTo(0);
|
||||
assertThat(getConstraintSetLayout(R.id.notification_stack_scroller).mWidth).isEqualTo(0);
|
||||
assertThat(getConstraintSetLayout(R.id.qs_frame).startMargin).isEqualTo(10);
|
||||
assertThat(getConstraintSetLayout(R.id.qs_frame).endMargin).isEqualTo(0);
|
||||
assertThat(getConstraintSetLayout(R.id.notification_stack_scroller).startMargin)
|
||||
.isEqualTo(0);
|
||||
assertThat(getConstraintSetLayout(R.id.notification_stack_scroller).endMargin)
|
||||
.isEqualTo(10);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSinglePaneLayout_childrenHaveEqualMargins() {
|
||||
enableSplitShade(/* enabled= */ false);
|
||||
|
||||
mNotificationPanelViewController.updateResources();
|
||||
|
||||
assertThat(getConstraintSetLayout(R.id.qs_frame).startMargin).isEqualTo(10);
|
||||
assertThat(getConstraintSetLayout(R.id.qs_frame).endMargin).isEqualTo(10);
|
||||
assertThat(getConstraintSetLayout(R.id.notification_stack_scroller).startMargin)
|
||||
.isEqualTo(10);
|
||||
assertThat(getConstraintSetLayout(R.id.notification_stack_scroller).endMargin)
|
||||
.isEqualTo(10);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user