Merge changes Ifcd1f115,I4988c09c into tm-dev
* changes: Renaming SplitShadeHeader to LargeScreenShadeHeader Showing wider header/status bar in shade on large screen
This commit is contained in:
committed by
Android (Google) Code Review
commit
463d40b33e
@@ -22,7 +22,6 @@
|
||||
<!-- Overload default clock widget parameters -->
|
||||
<dimen name="widget_big_font_size">88dp</dimen>
|
||||
|
||||
<dimen name="qs_header_system_icons_area_height">0dp</dimen>
|
||||
<dimen name="qs_panel_padding_top">@dimen/qqs_layout_margin_top</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -20,7 +20,7 @@
|
||||
android:id="@+id/split_shade_status_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/split_shade_header_min_height"
|
||||
android:minHeight="@dimen/large_screen_shade_header_min_height"
|
||||
android:clickable="false"
|
||||
android:focusable="true"
|
||||
android:paddingLeft="@dimen/qs_panel_padding"
|
||||
@@ -61,8 +61,8 @@
|
||||
<include
|
||||
android:id="@+id/carrier_group"
|
||||
layout="@layout/qs_carrier_group"
|
||||
app:layout_constraintHeight_min="@dimen/split_shade_header_min_height"
|
||||
android:minHeight="@dimen/split_shade_header_min_height"
|
||||
app:layout_constraintHeight_min="@dimen/large_screen_shade_header_min_height"
|
||||
android:minHeight="@dimen/large_screen_shade_header_min_height"
|
||||
app:layout_constraintWidth_min="48dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
<com.android.systemui.statusbar.phone.StatusIconContainer
|
||||
android:id="@+id/statusIcons"
|
||||
app:layout_constraintHeight_min="@dimen/split_shade_header_min_height"
|
||||
app:layout_constraintHeight_min="@dimen/large_screen_shade_header_min_height"
|
||||
android:paddingEnd="@dimen/signal_cluster_battery_padding"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
@@ -93,7 +93,7 @@
|
||||
android:id="@+id/batteryRemainingIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
app:layout_constraintHeight_min="@dimen/split_shade_header_min_height"
|
||||
app:layout_constraintHeight_min="@dimen/large_screen_shade_header_min_height"
|
||||
app:textAppearance="@style/TextAppearance.QS.Status"
|
||||
app:layout_constraintStart_toEndOf="@id/statusIcons"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
xmlns:systemui="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/split_shade_status_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/split_shade_header_height"
|
||||
android:minHeight="@dimen/split_shade_header_min_height"
|
||||
android:layout_height="@dimen/large_screen_shade_header_height"
|
||||
android:minHeight="@dimen/large_screen_shade_header_min_height"
|
||||
android:clickable="false"
|
||||
android:focusable="true"
|
||||
android:paddingLeft="@dimen/qs_panel_padding"
|
||||
@@ -32,7 +32,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:minWidth="48dp"
|
||||
android:minHeight="@dimen/split_shade_header_min_height"
|
||||
android:minHeight="@dimen/large_screen_shade_header_min_height"
|
||||
android:gravity="start|center_vertical"
|
||||
android:paddingStart="@dimen/status_bar_left_clock_starting_padding"
|
||||
android:paddingEnd="@dimen/status_bar_left_clock_end_padding"
|
||||
@@ -69,7 +69,7 @@
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginStart="8dp"
|
||||
android:focusable="false"
|
||||
android:minHeight="@dimen/split_shade_header_min_height"
|
||||
android:minHeight="@dimen/large_screen_shade_header_min_height"
|
||||
android:minWidth="48dp" />
|
||||
|
||||
<com.android.systemui.statusbar.phone.StatusIconContainer
|
||||
@@ -36,7 +36,6 @@
|
||||
<item name="controls_task_view_width_percentage" translatable="false" format="float" type="dimen">0.45</item>
|
||||
<dimen name="controls_task_view_right_margin">8dp</dimen>
|
||||
|
||||
<dimen name="split_shade_header_height">42dp</dimen>
|
||||
<dimen name="status_bar_header_height_keyguard">42dp</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order to complete by tapping on a button
|
||||
|
||||
@@ -38,4 +38,6 @@
|
||||
<!-- Determines whether to allow the nav bar handle to be forced to be opaque. -->
|
||||
<bool name="allow_force_nav_bar_handle_opaque">false</bool>
|
||||
|
||||
<bool name="config_use_large_screen_shade_header">true</bool>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -67,4 +67,6 @@
|
||||
|
||||
<!-- The width of large/content heavy dialogs (e.g. Internet, Media output, etc) -->
|
||||
<dimen name="large_dialog_width">472dp</dimen>
|
||||
|
||||
<dimen name="large_screen_shade_header_height">42dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
<dimen name="keyguard_split_shade_top_margin">72dp</dimen>
|
||||
|
||||
<dimen name="split_shade_header_height">56dp</dimen>
|
||||
<dimen name="status_bar_header_height_keyguard">56dp</dimen>
|
||||
|
||||
<dimen name="qs_media_session_height_expanded">184dp</dimen>
|
||||
|
||||
@@ -20,5 +20,7 @@
|
||||
<dimen name="status_bar_icon_padding">1dp</dimen>
|
||||
|
||||
<dimen name="controls_padding_horizontal">75dp</dimen>
|
||||
|
||||
<dimen name="large_screen_shade_header_height">56dp</dimen>
|
||||
</resources>
|
||||
|
||||
|
||||
@@ -556,6 +556,9 @@
|
||||
<!-- Whether to use the split 2-column notification shade -->
|
||||
<bool name="config_use_split_notification_shade">false</bool>
|
||||
|
||||
<!-- Whether we use large screen shade header which takes only one row compared to QS header -->
|
||||
<bool name="config_use_large_screen_shade_header">false</bool>
|
||||
|
||||
<!-- Whether notification header should never show section headers. -->
|
||||
<bool name="config_notification_never_show_section_headers">false</bool>
|
||||
|
||||
|
||||
@@ -368,10 +368,12 @@
|
||||
<dimen name="match_parent">-1px</dimen>
|
||||
|
||||
<!-- Height of status bar in split shade mode - visible only on large screens -->
|
||||
<dimen name="split_shade_header_height">@*android:dimen/quick_qs_offset_height</dimen>
|
||||
<dimen name="split_shade_header_min_height">@dimen/qs_header_row_min_height</dimen>
|
||||
<dimen name="large_screen_shade_header_height">@*android:dimen/quick_qs_offset_height</dimen>
|
||||
<dimen name="large_screen_shade_header_min_height">@dimen/qs_header_row_min_height</dimen>
|
||||
|
||||
<!-- The top margin of the panel that holds the list of notifications. -->
|
||||
<!-- The top margin of the panel that holds the list of notifications.
|
||||
On phones it's always 0dp but it's overridden in Car UI
|
||||
-->
|
||||
<dimen name="notification_panel_margin_top">0dp</dimen>
|
||||
|
||||
<!-- The minimum content height for the split shade NSSL.
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
</Transition>
|
||||
|
||||
<Transition
|
||||
android:id="@+id/split_header_transition"
|
||||
app:constraintSetStart="@id/split_header_constraint"
|
||||
app:constraintSetEnd="@id/split_header_constraint"/>
|
||||
android:id="@+id/large_screen_header_transition"
|
||||
app:constraintSetStart="@id/large_screen_header_constraint"
|
||||
app:constraintSetEnd="@id/large_screen_header_constraint"/>
|
||||
|
||||
<!--
|
||||
Placeholder ConstraintSet. They are populated in the controller for this class.
|
||||
@@ -56,6 +56,6 @@
|
||||
|
||||
<ConstraintSet android:id="@id/qs_header_constraint"/>
|
||||
|
||||
<ConstraintSet android:id="@id/split_header_constraint" />
|
||||
<ConstraintSet android:id="@id/large_screen_header_constraint" />
|
||||
|
||||
</MotionScene>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<ConstraintSet
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/split_header_constraint">
|
||||
android:id="@+id/large_screen_header_constraint">
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/clock">
|
||||
@@ -58,7 +58,7 @@
|
||||
<Layout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintHeight_min="@dimen/split_shade_header_min_height"
|
||||
app:layout_constraintHeight_min="@dimen/large_screen_shade_header_min_height"
|
||||
app:layout_constraintStart_toEndOf="@id/statusIcons"
|
||||
app:layout_constraintEnd_toStartOf="@id/privacy_container"
|
||||
app:layout_constraintTop_toTopOf="@id/clock"
|
||||
@@ -47,6 +47,7 @@ import android.widget.TextView;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.util.LargeScreenUtils;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -814,7 +815,7 @@ public class AuthBiometricView extends LinearLayout {
|
||||
}
|
||||
|
||||
private boolean isLargeDisplay() {
|
||||
return com.android.systemui.util.Utils.shouldUseSplitNotificationShade(getResources());
|
||||
return LargeScreenUtils.shouldUseSplitNotificationShade(getResources());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.android.systemui.statusbar.SysuiStatusBarStateController
|
||||
import com.android.systemui.statusbar.notification.stack.MediaContainerView
|
||||
import com.android.systemui.statusbar.phone.KeyguardBypassController
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController
|
||||
import com.android.systemui.util.Utils
|
||||
import com.android.systemui.util.LargeScreenUtils
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Named
|
||||
|
||||
@@ -71,7 +71,7 @@ class KeyguardMediaController @Inject constructor(
|
||||
}
|
||||
|
||||
private fun updateResources() {
|
||||
useSplitShade = Utils.shouldUseSplitNotificationShade(context.resources)
|
||||
useSplitShade = LargeScreenUtils.shouldUseSplitNotificationShade(context.resources)
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -104,6 +104,17 @@ fun isMediaNotification(sbn: StatusBarNotification): Boolean {
|
||||
return sbn.notification.isMediaNotification()
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow recommendations from smartspace to show in media controls.
|
||||
* Requires [Utils.useQsMediaPlayer] to be enabled.
|
||||
* On by default, but can be disabled by setting to 0
|
||||
*/
|
||||
private fun allowMediaRecommendations(context: Context): Boolean {
|
||||
val flag = Settings.Secure.getInt(context.contentResolver,
|
||||
Settings.Secure.MEDIA_CONTROLS_RECOMMENDATION, 1)
|
||||
return Utils.useQsMediaPlayer(context) && flag > 0
|
||||
}
|
||||
|
||||
/**
|
||||
* A class that facilitates management and loading of Media Data, ready for binding.
|
||||
*/
|
||||
@@ -164,7 +175,7 @@ class MediaDataManager(
|
||||
// There should ONLY be at most one Smartspace media recommendation.
|
||||
var smartspaceMediaData: SmartspaceMediaData = EMPTY_SMARTSPACE_MEDIA_DATA
|
||||
private var smartspaceSession: SmartspaceSession? = null
|
||||
private var allowMediaRecommendations = Utils.allowMediaRecommendations(context)
|
||||
private var allowMediaRecommendations = allowMediaRecommendations(context)
|
||||
|
||||
/**
|
||||
* Check whether this notification is an RCN
|
||||
@@ -272,7 +283,7 @@ class MediaDataManager(
|
||||
smartspaceSession?.let { it.requestSmartspaceUpdate() }
|
||||
tunerService.addTunable(object : TunerService.Tunable {
|
||||
override fun onTuningChanged(key: String?, newValue: String?) {
|
||||
allowMediaRecommendations = Utils.allowMediaRecommendations(context)
|
||||
allowMediaRecommendations = allowMediaRecommendations(context)
|
||||
if (!allowMediaRecommendations) {
|
||||
dismissSmartspaceRecommendation(key = smartspaceMediaData.targetId, delay = 0L)
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ import com.android.systemui.statusbar.notification.stack.StackStateAnimator
|
||||
import com.android.systemui.statusbar.phone.KeyguardBypassController
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController
|
||||
import com.android.systemui.util.Utils
|
||||
import com.android.systemui.util.LargeScreenUtils
|
||||
import com.android.systemui.util.animation.UniqueObjectHostView
|
||||
import javax.inject.Inject
|
||||
|
||||
@@ -514,7 +514,7 @@ class MediaHierarchyManager @Inject constructor(
|
||||
private fun updateConfiguration() {
|
||||
distanceForFullShadeTransition = context.resources.getDimensionPixelSize(
|
||||
R.dimen.lockscreen_shade_media_transition_distance)
|
||||
inSplitShade = Utils.shouldUseSplitNotificationShade(context.resources)
|
||||
inSplitShade = LargeScreenUtils.shouldUseSplitNotificationShade(context.resources)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,6 @@ import android.widget.FrameLayout;
|
||||
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;
|
||||
@@ -147,7 +146,7 @@ public class QSContainerImpl extends FrameLayout implements Dumpable {
|
||||
}
|
||||
mQSPanelContainer.setPaddingRelative(
|
||||
mQSPanelContainer.getPaddingStart(),
|
||||
Utils.getQsHeaderSystemIconsAreaHeight(mContext),
|
||||
QSUtils.getQsHeaderSystemIconsAreaHeight(mContext),
|
||||
mQSPanelContainer.getPaddingEnd(),
|
||||
bottomPadding);
|
||||
|
||||
@@ -175,7 +174,6 @@ public class QSContainerImpl extends FrameLayout implements Dumpable {
|
||||
|
||||
public void updateExpansion() {
|
||||
int height = calculateContainerHeight();
|
||||
int scrollBottom = calculateContainerBottom();
|
||||
setBottom(getTop() + height);
|
||||
}
|
||||
|
||||
@@ -187,15 +185,6 @@ public class QSContainerImpl extends FrameLayout implements Dumpable {
|
||||
+ mHeader.getHeight();
|
||||
}
|
||||
|
||||
int calculateContainerBottom() {
|
||||
int heightOverride = mHeightOverride != -1 ? mHeightOverride : getMeasuredHeight();
|
||||
return mQSCustomizer.isCustomizing() ? mQSCustomizer.getHeight()
|
||||
: Math.round(mQsExpansion
|
||||
* (heightOverride + mQSPanelContainer.getScrollRange()
|
||||
- mQSPanelContainer.getScrollY() - mHeader.getHeight()))
|
||||
+ mHeader.getHeight();
|
||||
}
|
||||
|
||||
public void setExpansion(float expansion) {
|
||||
mQsExpansion = expansion;
|
||||
mQSPanelContainer.setScrollingEnabled(expansion > 0f);
|
||||
|
||||
@@ -37,7 +37,7 @@ import com.android.systemui.plugins.qs.QSTileView;
|
||||
import com.android.systemui.qs.customize.QSCustomizerController;
|
||||
import com.android.systemui.qs.external.CustomTile;
|
||||
import com.android.systemui.qs.logging.QSLogger;
|
||||
import com.android.systemui.util.Utils;
|
||||
import com.android.systemui.util.LargeScreenUtils;
|
||||
import com.android.systemui.util.ViewController;
|
||||
import com.android.systemui.util.animation.DisappearParameters;
|
||||
|
||||
@@ -88,7 +88,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
|
||||
@Override
|
||||
public void onConfigurationChange(Configuration newConfig) {
|
||||
mShouldUseSplitNotificationShade =
|
||||
Utils.shouldUseSplitNotificationShade(getResources());
|
||||
LargeScreenUtils.shouldUseSplitNotificationShade(getResources());
|
||||
onConfigurationChanged();
|
||||
if (newConfig.orientation != mLastOrientation) {
|
||||
mLastOrientation = newConfig.orientation;
|
||||
@@ -133,7 +133,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
|
||||
mQSLogger = qsLogger;
|
||||
mDumpManager = dumpManager;
|
||||
mShouldUseSplitNotificationShade =
|
||||
Utils.shouldUseSplitNotificationShade(getResources());
|
||||
LargeScreenUtils.shouldUseSplitNotificationShade(getResources());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
24
packages/SystemUI/src/com/android/systemui/qs/QSUtils.kt
Normal file
24
packages/SystemUI/src/com/android/systemui/qs/QSUtils.kt
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.android.systemui.qs
|
||||
|
||||
import android.content.Context
|
||||
import com.android.internal.policy.SystemBarUtils
|
||||
import com.android.systemui.util.LargeScreenUtils.shouldUseLargeScreenShadeHeader
|
||||
|
||||
object QSUtils {
|
||||
|
||||
/**
|
||||
* Gets the [R.dimen.qs_header_system_icons_area_height] unless we use large screen header.
|
||||
*
|
||||
* It's the same as [com.android.internal.R.dimen.quick_qs_offset_height] except for
|
||||
* sw600dp-land.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getQsHeaderSystemIconsAreaHeight(context: Context): Int {
|
||||
return if (shouldUseLargeScreenShadeHeader(context.resources)) {
|
||||
// value should be 0 when using large screen shade header because it's not expandable
|
||||
0
|
||||
} else {
|
||||
SystemBarUtils.getQuickQsOffsetHeight(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,7 @@ import com.android.systemui.statusbar.phone.StatusBarIconController.TintedIconMa
|
||||
import com.android.systemui.statusbar.phone.StatusIconContainer;
|
||||
import com.android.systemui.statusbar.policy.Clock;
|
||||
import com.android.systemui.statusbar.policy.VariableDateView;
|
||||
import com.android.systemui.util.LargeScreenUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -242,11 +243,10 @@ public class QuickStatusBarHeader extends FrameLayout {
|
||||
|
||||
void updateResources() {
|
||||
Resources resources = mContext.getResources();
|
||||
// status bar is already displayed out of QS in split shade
|
||||
boolean shouldUseSplitShade =
|
||||
resources.getBoolean(R.bool.config_use_split_notification_shade);
|
||||
boolean largeScreenHeaderActive =
|
||||
LargeScreenUtils.shouldUseLargeScreenShadeHeader(resources);
|
||||
|
||||
boolean gone = shouldUseSplitShade || mUseCombinedQSHeader || mQsDisabled;
|
||||
boolean gone = largeScreenHeaderActive || mUseCombinedQSHeader || mQsDisabled;
|
||||
mStatusIconsView.setVisibility(gone ? View.GONE : View.VISIBLE);
|
||||
mDatePrivacyView.setVisibility(gone ? View.GONE : View.VISIBLE);
|
||||
|
||||
@@ -287,7 +287,7 @@ public class QuickStatusBarHeader extends FrameLayout {
|
||||
}
|
||||
|
||||
MarginLayoutParams qqsLP = (MarginLayoutParams) mHeaderQsPanel.getLayoutParams();
|
||||
qqsLP.topMargin = shouldUseSplitShade || !mUseCombinedQSHeader ? mContext.getResources()
|
||||
qqsLP.topMargin = largeScreenHeaderActive || !mUseCombinedQSHeader ? mContext.getResources()
|
||||
.getDimensionPixelSize(R.dimen.qqs_layout_margin_top) : qsOffsetHeight;
|
||||
mHeaderQsPanel.setLayoutParams(qqsLP);
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ import com.android.systemui.R;
|
||||
import com.android.systemui.plugins.qs.QS;
|
||||
import com.android.systemui.plugins.qs.QSContainerController;
|
||||
import com.android.systemui.qs.QSDetailClipper;
|
||||
import com.android.systemui.qs.QSUtils;
|
||||
import com.android.systemui.statusbar.phone.LightBarController;
|
||||
import com.android.systemui.util.Utils;
|
||||
|
||||
/**
|
||||
* Allows full-screen customization of QS, through show() and hide().
|
||||
@@ -86,7 +86,7 @@ public class QSCustomizer extends LinearLayout {
|
||||
|
||||
void updateResources() {
|
||||
LayoutParams lp = (LayoutParams) mTransparentView.getLayoutParams();
|
||||
lp.height = Utils.getQsHeaderSystemIconsAreaHeight(mContext);
|
||||
lp.height = QSUtils.getQsHeaderSystemIconsAreaHeight(mContext);
|
||||
mTransparentView.setLayoutParams(lp);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ import com.android.systemui.statusbar.phone.LSShadeTransitionLogger
|
||||
import com.android.systemui.statusbar.phone.NotificationPanelViewController
|
||||
import com.android.systemui.statusbar.phone.ScrimController
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController
|
||||
import com.android.systemui.util.Utils
|
||||
import com.android.systemui.util.LargeScreenUtils
|
||||
import java.io.FileDescriptor
|
||||
import java.io.PrintWriter
|
||||
import javax.inject.Inject
|
||||
@@ -251,7 +251,7 @@ class LockscreenShadeTransitionController @Inject constructor(
|
||||
R.dimen.lockscreen_shade_udfps_keyguard_transition_distance)
|
||||
statusBarTransitionDistance = context.resources.getDimensionPixelSize(
|
||||
R.dimen.lockscreen_shade_status_bar_transition_distance)
|
||||
useSplitShade = Utils.shouldUseSplitNotificationShade(context.resources)
|
||||
useSplitShade = LargeScreenUtils.shouldUseSplitNotificationShade(context.resources)
|
||||
}
|
||||
|
||||
fun setStackScroller(nsslController: NotificationStackScrollLayoutController) {
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.systemui.statusbar.notification.stack;
|
||||
import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_SHADE_SCROLL_FLING;
|
||||
import static com.android.systemui.statusbar.notification.stack.NotificationPriorityBucketKt.BUCKET_SILENT;
|
||||
import static com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_SWIPE;
|
||||
import static com.android.systemui.util.Utils.shouldUseSplitNotificationShade;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
@@ -110,6 +109,7 @@ import com.android.systemui.statusbar.policy.HeadsUpUtil;
|
||||
import com.android.systemui.statusbar.policy.ScrollAdapter;
|
||||
import com.android.systemui.util.Assert;
|
||||
import com.android.systemui.util.DumpUtilsKt;
|
||||
import com.android.systemui.util.LargeScreenUtils;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
@@ -5540,7 +5540,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
}
|
||||
|
||||
private void updateSplitNotificationShade() {
|
||||
boolean split = shouldUseSplitNotificationShade(getResources());
|
||||
boolean split = LargeScreenUtils.shouldUseSplitNotificationShade(getResources());
|
||||
if (split != mShouldUseSplitNotificationShade) {
|
||||
mShouldUseSplitNotificationShade = split;
|
||||
updateDismissBehavior();
|
||||
|
||||
@@ -148,7 +148,7 @@ public class KeyguardClockPositionAlgorithm {
|
||||
mStatusViewBottomMargin = res.getDimensionPixelSize(
|
||||
R.dimen.keyguard_status_view_bottom_margin);
|
||||
mSplitShadeTopNotificationsMargin =
|
||||
res.getDimensionPixelSize(R.dimen.split_shade_header_height);
|
||||
res.getDimensionPixelSize(R.dimen.large_screen_shade_header_height);
|
||||
mSplitShadeTargetTopMargin =
|
||||
res.getDimensionPixelSize(R.dimen.keyguard_split_shade_top_margin);
|
||||
|
||||
|
||||
@@ -31,35 +31,35 @@ import com.android.systemui.qs.ChipVisibilityListener
|
||||
import com.android.systemui.qs.HeaderPrivacyIconsController
|
||||
import com.android.systemui.qs.carrier.QSCarrierGroupController
|
||||
import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent.CentralSurfacesScope
|
||||
import com.android.systemui.statusbar.phone.dagger.StatusBarViewModule.SPLIT_SHADE_BATTERY_CONTROLLER
|
||||
import com.android.systemui.statusbar.phone.dagger.StatusBarViewModule.SPLIT_SHADE_HEADER
|
||||
import com.android.systemui.statusbar.phone.dagger.StatusBarViewModule.LARGE_SCREEN_BATTERY_CONTROLLER
|
||||
import com.android.systemui.statusbar.phone.dagger.StatusBarViewModule.LARGE_SCREEN_SHADE_HEADER
|
||||
import java.io.FileDescriptor
|
||||
import java.io.PrintWriter
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Named
|
||||
|
||||
@CentralSurfacesScope
|
||||
class SplitShadeHeaderController @Inject constructor(
|
||||
@Named(SPLIT_SHADE_HEADER) private val statusBar: View,
|
||||
class LargeScreenShadeHeaderController @Inject constructor(
|
||||
@Named(LARGE_SCREEN_SHADE_HEADER) private val header: View,
|
||||
private val statusBarIconController: StatusBarIconController,
|
||||
private val privacyIconsController: HeaderPrivacyIconsController,
|
||||
qsCarrierGroupControllerBuilder: QSCarrierGroupController.Builder,
|
||||
featureFlags: FeatureFlags,
|
||||
@Named(SPLIT_SHADE_BATTERY_CONTROLLER) batteryMeterViewController: BatteryMeterViewController,
|
||||
@Named(LARGE_SCREEN_BATTERY_CONTROLLER) batteryMeterViewController: BatteryMeterViewController,
|
||||
dumpManager: DumpManager
|
||||
) : Dumpable {
|
||||
|
||||
companion object {
|
||||
private val HEADER_TRANSITION_ID = R.id.header_transition
|
||||
private val SPLIT_HEADER_TRANSITION_ID = R.id.split_header_transition
|
||||
private val LARGE_SCREEN_HEADER_TRANSITION_ID = R.id.large_screen_header_transition
|
||||
private val QQS_HEADER_CONSTRAINT = R.id.qqs_header_constraint
|
||||
private val QS_HEADER_CONSTRAINT = R.id.qs_header_constraint
|
||||
private val SPLIT_HEADER_CONSTRAINT = R.id.split_header_constraint
|
||||
private val LARGE_SCREEN_HEADER_CONSTRAINT = R.id.large_screen_header_constraint
|
||||
|
||||
private fun Int.stateToString() = when (this) {
|
||||
QQS_HEADER_CONSTRAINT -> "QQS Header"
|
||||
QS_HEADER_CONSTRAINT -> "QS Header"
|
||||
SPLIT_HEADER_CONSTRAINT -> "Split Header"
|
||||
LARGE_SCREEN_HEADER_CONSTRAINT -> "Large Screen Header"
|
||||
else -> "Unknown state"
|
||||
}
|
||||
}
|
||||
@@ -87,19 +87,19 @@ class SplitShadeHeaderController @Inject constructor(
|
||||
onShadeExpandedChanged()
|
||||
}
|
||||
|
||||
var splitShadeMode = false
|
||||
var active = false
|
||||
set(value) {
|
||||
if (field == value) {
|
||||
return
|
||||
}
|
||||
field = value
|
||||
onSplitShadeModeChanged()
|
||||
onHeaderStateChanged()
|
||||
}
|
||||
|
||||
var shadeExpandedFraction = -1f
|
||||
set(value) {
|
||||
if (visible && field != value) {
|
||||
statusBar.alpha = ShadeInterpolation.getContentAlpha(value)
|
||||
header.alpha = ShadeInterpolation.getContentAlpha(value)
|
||||
field = value
|
||||
}
|
||||
}
|
||||
@@ -123,53 +123,53 @@ class SplitShadeHeaderController @Inject constructor(
|
||||
|
||||
private val chipVisibilityListener: ChipVisibilityListener = object : ChipVisibilityListener {
|
||||
override fun onChipVisibilityRefreshed(visible: Boolean) {
|
||||
if (statusBar is MotionLayout) {
|
||||
val state = statusBar.getConstraintSet(QQS_HEADER_CONSTRAINT).apply {
|
||||
if (header is MotionLayout) {
|
||||
val state = header.getConstraintSet(QQS_HEADER_CONSTRAINT).apply {
|
||||
setAlpha(R.id.statusIcons, if (visible) 0f else 1f)
|
||||
setAlpha(R.id.batteryRemainingIcon, if (visible) 0f else 1f)
|
||||
}
|
||||
statusBar.updateState(QQS_HEADER_CONSTRAINT, state)
|
||||
header.updateState(QQS_HEADER_CONSTRAINT, state)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
if (statusBar is MotionLayout) {
|
||||
val context = statusBar.context
|
||||
val resources = statusBar.resources
|
||||
statusBar.getConstraintSet(QQS_HEADER_CONSTRAINT)
|
||||
if (header is MotionLayout) {
|
||||
val context = header.context
|
||||
val resources = header.resources
|
||||
header.getConstraintSet(QQS_HEADER_CONSTRAINT)
|
||||
.load(context, resources.getXml(R.xml.qqs_header))
|
||||
statusBar.getConstraintSet(QS_HEADER_CONSTRAINT)
|
||||
header.getConstraintSet(QS_HEADER_CONSTRAINT)
|
||||
.load(context, resources.getXml(R.xml.qs_header))
|
||||
statusBar.getConstraintSet(SPLIT_HEADER_CONSTRAINT)
|
||||
.load(context, resources.getXml(R.xml.split_header))
|
||||
header.getConstraintSet(LARGE_SCREEN_HEADER_CONSTRAINT)
|
||||
.load(context, resources.getXml(R.xml.large_screen_shade_header))
|
||||
privacyIconsController.chipVisibilityListener = chipVisibilityListener
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
batteryMeterViewController.init()
|
||||
val batteryIcon: BatteryMeterView = statusBar.findViewById(R.id.batteryRemainingIcon)
|
||||
val batteryIcon: BatteryMeterView = header.findViewById(R.id.batteryRemainingIcon)
|
||||
|
||||
// battery settings same as in QS icons
|
||||
batteryMeterViewController.ignoreTunerUpdates()
|
||||
batteryIcon.setPercentShowMode(BatteryMeterView.MODE_ESTIMATE)
|
||||
|
||||
iconContainer = statusBar.findViewById(R.id.statusIcons)
|
||||
iconContainer = header.findViewById(R.id.statusIcons)
|
||||
iconManager = StatusBarIconController.TintedIconManager(iconContainer, featureFlags)
|
||||
iconManager.setTint(Utils.getColorAttrDefaultColor(statusBar.context,
|
||||
iconManager.setTint(Utils.getColorAttrDefaultColor(header.context,
|
||||
android.R.attr.textColorPrimary))
|
||||
|
||||
carrierIconSlots = if (featureFlags.isEnabled(Flags.COMBINED_STATUS_BAR_SIGNAL_ICONS)) {
|
||||
listOf(
|
||||
statusBar.context.getString(com.android.internal.R.string.status_bar_no_calling),
|
||||
statusBar.context.getString(com.android.internal.R.string.status_bar_call_strength)
|
||||
header.context.getString(com.android.internal.R.string.status_bar_no_calling),
|
||||
header.context.getString(com.android.internal.R.string.status_bar_call_strength)
|
||||
)
|
||||
} else {
|
||||
listOf(statusBar.context.getString(com.android.internal.R.string.status_bar_mobile))
|
||||
listOf(header.context.getString(com.android.internal.R.string.status_bar_mobile))
|
||||
}
|
||||
qsCarrierGroupController = qsCarrierGroupControllerBuilder
|
||||
.setQSCarrierGroup(statusBar.findViewById(R.id.carrier_group))
|
||||
.setQSCarrierGroup(header.findViewById(R.id.carrier_group))
|
||||
.build()
|
||||
|
||||
dumpManager.registerDumpable(this)
|
||||
@@ -179,8 +179,8 @@ class SplitShadeHeaderController @Inject constructor(
|
||||
}
|
||||
|
||||
private fun updateScrollY() {
|
||||
if (!splitShadeMode && combinedHeaders) {
|
||||
statusBar.scrollY = qsScrollY
|
||||
if (!active && combinedHeaders) {
|
||||
header.scrollY = qsScrollY
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,8 +194,8 @@ class SplitShadeHeaderController @Inject constructor(
|
||||
updatePosition()
|
||||
}
|
||||
|
||||
private fun onSplitShadeModeChanged() {
|
||||
if (splitShadeMode || combinedHeaders) {
|
||||
private fun onHeaderStateChanged() {
|
||||
if (active || combinedHeaders) {
|
||||
privacyIconsController.onParentVisible()
|
||||
} else {
|
||||
privacyIconsController.onParentInvisible()
|
||||
@@ -205,15 +205,15 @@ class SplitShadeHeaderController @Inject constructor(
|
||||
}
|
||||
|
||||
private fun updateVisibility() {
|
||||
val visibility = if (!splitShadeMode && !combinedHeaders) {
|
||||
val visibility = if (!active && !combinedHeaders) {
|
||||
View.GONE
|
||||
} else if (shadeExpanded) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.INVISIBLE
|
||||
}
|
||||
if (statusBar.visibility != visibility) {
|
||||
statusBar.visibility = visibility
|
||||
if (header.visibility != visibility) {
|
||||
header.visibility = visibility
|
||||
visible = visibility == View.VISIBLE
|
||||
}
|
||||
}
|
||||
@@ -222,20 +222,20 @@ class SplitShadeHeaderController @Inject constructor(
|
||||
if (!combinedHeaders) {
|
||||
return
|
||||
}
|
||||
statusBar as MotionLayout
|
||||
if (splitShadeMode) {
|
||||
statusBar.setTransition(SPLIT_HEADER_TRANSITION_ID)
|
||||
header as MotionLayout
|
||||
if (active) {
|
||||
header.setTransition(LARGE_SCREEN_HEADER_TRANSITION_ID)
|
||||
} else {
|
||||
statusBar.setTransition(HEADER_TRANSITION_ID)
|
||||
statusBar.transitionToStart()
|
||||
header.setTransition(HEADER_TRANSITION_ID)
|
||||
header.transitionToStart()
|
||||
updatePosition()
|
||||
updateScrollY()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updatePosition() {
|
||||
if (statusBar is MotionLayout && !splitShadeMode && visible) {
|
||||
statusBar.setProgress(qsExpandedFraction)
|
||||
if (header is MotionLayout && !active && visible) {
|
||||
header.setProgress(qsExpandedFraction)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,12 +263,12 @@ class SplitShadeHeaderController @Inject constructor(
|
||||
pw.println("visible: $visible")
|
||||
pw.println("shadeExpanded: $shadeExpanded")
|
||||
pw.println("shadeExpandedFraction: $shadeExpandedFraction")
|
||||
pw.println("splitShadeMode: $splitShadeMode")
|
||||
pw.println("active: $active")
|
||||
pw.println("qsExpandedFraction: $qsExpandedFraction")
|
||||
pw.println("qsScrollY: $qsScrollY")
|
||||
if (combinedHeaders) {
|
||||
statusBar as MotionLayout
|
||||
pw.println("currentState: ${statusBar.currentState.stateToString()}")
|
||||
header as MotionLayout
|
||||
pw.println("currentState: ${header.currentState.stateToString()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,6 +187,7 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcherView;
|
||||
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
|
||||
import com.android.systemui.statusbar.window.StatusBarWindowStateController;
|
||||
import com.android.systemui.unfold.SysUIUnfoldComponent;
|
||||
import com.android.systemui.util.LargeScreenUtils;
|
||||
import com.android.systemui.util.ListenerSet;
|
||||
import com.android.systemui.util.Utils;
|
||||
import com.android.systemui.util.settings.SecureSettings;
|
||||
@@ -311,7 +312,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
|
||||
private final LockscreenShadeTransitionController mLockscreenShadeTransitionController;
|
||||
private final TapAgainViewController mTapAgainViewController;
|
||||
private final SplitShadeHeaderController mSplitShadeHeaderController;
|
||||
private final LargeScreenShadeHeaderController mLargeScreenShadeHeaderController;
|
||||
private final RecordingController mRecordingController;
|
||||
private final PanelEventsEmitter mPanelEventsEmitter;
|
||||
private boolean mShouldUseSplitNotificationShade;
|
||||
@@ -336,7 +337,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
private NotificationsQuickSettingsContainer mNotificationContainerParent;
|
||||
private NotificationsQSContainerController mNotificationsQSContainerController;
|
||||
private boolean mAnimateNextPositionUpdate;
|
||||
private float mQuickQsOffsetHeight;
|
||||
private float mQuickQsHeaderHeight;
|
||||
private ScreenOffAnimationController mScreenOffAnimationController;
|
||||
|
||||
private int mTrackingPointer;
|
||||
@@ -387,7 +388,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
private float mDownY;
|
||||
private int mDisplayTopInset = 0; // in pixels
|
||||
private int mDisplayRightInset = 0; // in pixels
|
||||
private int mSplitShadeStatusBarHeight;
|
||||
private int mLargeScreenShadeHeaderHeight;
|
||||
private int mSplitShadeNotificationsScrimMarginBottom;
|
||||
|
||||
private final KeyguardClockPositionAlgorithm
|
||||
@@ -733,7 +734,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
RecordingController recordingController,
|
||||
@Main Executor uiExecutor,
|
||||
SecureSettings secureSettings,
|
||||
SplitShadeHeaderController splitShadeHeaderController,
|
||||
LargeScreenShadeHeaderController largeScreenShadeHeaderController,
|
||||
ScreenOffAnimationController screenOffAnimationController,
|
||||
LockscreenGestureLogger lockscreenGestureLogger,
|
||||
PanelExpansionStateManager panelExpansionStateManager,
|
||||
@@ -791,9 +792,9 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
mFragmentService = fragmentService;
|
||||
mSettingsChangeObserver = new SettingsChangeObserver(handler);
|
||||
mShouldUseSplitNotificationShade =
|
||||
Utils.shouldUseSplitNotificationShade(mResources);
|
||||
LargeScreenUtils.shouldUseSplitNotificationShade(mResources);
|
||||
mView.setWillNotDraw(!DEBUG);
|
||||
mSplitShadeHeaderController = splitShadeHeaderController;
|
||||
mLargeScreenShadeHeaderController = largeScreenShadeHeaderController;
|
||||
mLayoutInflater = layoutInflater;
|
||||
mFeatureFlags = featureFlags;
|
||||
mFalsingManager = falsingManager;
|
||||
@@ -1071,24 +1072,28 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
}
|
||||
|
||||
public void updateResources() {
|
||||
mQuickQsOffsetHeight = SystemBarUtils.getQuickQsOffsetHeight(mView.getContext());
|
||||
mSplitShadeNotificationsScrimMarginBottom =
|
||||
mResources.getDimensionPixelSize(
|
||||
R.dimen.split_shade_notifications_scrim_margin_bottom);
|
||||
|
||||
final boolean newShouldUseSplitNotificationShade =
|
||||
Utils.shouldUseSplitNotificationShade(mResources);
|
||||
LargeScreenUtils.shouldUseSplitNotificationShade(mResources);
|
||||
final boolean splitNotificationShadeChanged =
|
||||
mShouldUseSplitNotificationShade != newShouldUseSplitNotificationShade;
|
||||
|
||||
mShouldUseSplitNotificationShade = newShouldUseSplitNotificationShade;
|
||||
boolean useLargeScreenShadeHeader =
|
||||
LargeScreenUtils.shouldUseLargeScreenShadeHeader(mView.getResources());
|
||||
if (mQs != null) {
|
||||
mQs.setInSplitShade(mShouldUseSplitNotificationShade);
|
||||
}
|
||||
mSplitShadeStatusBarHeight = Utils.getSplitShadeStatusBarHeight(mView.getContext());
|
||||
int topMargin = mShouldUseSplitNotificationShade ? mSplitShadeStatusBarHeight :
|
||||
mLargeScreenShadeHeaderHeight =
|
||||
mResources.getDimensionPixelSize(R.dimen.large_screen_shade_header_height);
|
||||
mQuickQsHeaderHeight = useLargeScreenShadeHeader ? mLargeScreenShadeHeaderHeight :
|
||||
SystemBarUtils.getQuickQsOffsetHeight(mView.getContext());
|
||||
int topMargin = useLargeScreenShadeHeader ? mLargeScreenShadeHeaderHeight :
|
||||
mResources.getDimensionPixelSize(R.dimen.notification_panel_margin_top);
|
||||
mSplitShadeHeaderController.setSplitShadeMode(mShouldUseSplitNotificationShade);
|
||||
mLargeScreenShadeHeaderController.setActive(useLargeScreenShadeHeader);
|
||||
mAmbientState.setStackTopMargin(topMargin);
|
||||
mNotificationsQSContainerController.updateResources();
|
||||
|
||||
@@ -2268,9 +2273,9 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
float shadeExpandedFraction = mTransitioningToFullShadeProgress > 0
|
||||
? mLockscreenShadeTransitionController.getQSDragProgress()
|
||||
: getExpandedFraction();
|
||||
mSplitShadeHeaderController.setShadeExpandedFraction(shadeExpandedFraction);
|
||||
mSplitShadeHeaderController.setQsExpandedFraction(qsExpansionFraction);
|
||||
mSplitShadeHeaderController.setShadeExpanded(mQsVisible);
|
||||
mLargeScreenShadeHeaderController.setShadeExpandedFraction(shadeExpandedFraction);
|
||||
mLargeScreenShadeHeaderController.setQsExpandedFraction(qsExpansionFraction);
|
||||
mLargeScreenShadeHeaderController.setShadeExpanded(mQsVisible);
|
||||
}
|
||||
|
||||
private void onStackYChanged(boolean shouldAnimate) {
|
||||
@@ -2289,7 +2294,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
}
|
||||
|
||||
private void updateQSExpansionEnabledAmbient() {
|
||||
final float scrollRangeToTop = mAmbientState.getTopPadding() - mQuickQsOffsetHeight;
|
||||
final float scrollRangeToTop = mAmbientState.getTopPadding() - mQuickQsHeaderHeight;
|
||||
mQsExpansionEnabledAmbient = mShouldUseSplitNotificationShade
|
||||
|| (mAmbientState.getScrollY() <= scrollRangeToTop);
|
||||
setQsExpansionEnabled();
|
||||
@@ -2315,7 +2320,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
private int calculateTopQsClippingBound(int qsPanelBottomY) {
|
||||
int top;
|
||||
if (mShouldUseSplitNotificationShade) {
|
||||
top = Math.min(qsPanelBottomY, mSplitShadeStatusBarHeight);
|
||||
top = Math.min(qsPanelBottomY, mLargeScreenShadeHeaderHeight);
|
||||
} else {
|
||||
if (mTransitioningToFullShadeProgress > 0.0f) {
|
||||
// If we're transitioning, let's use the actual value. The else case
|
||||
@@ -2452,8 +2457,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
mQsTranslationForFullShadeTransition = qsTranslation;
|
||||
updateQsFrameTranslation();
|
||||
float currentTranslation = mQsFrame.getTranslationY();
|
||||
mQsClipTop = (int) (top - currentTranslation);
|
||||
mQsClipBottom = (int) (bottom - currentTranslation);
|
||||
mQsClipTop = (int) (top - currentTranslation - mQsFrame.getTop());
|
||||
mQsClipBottom = (int) (bottom - currentTranslation - mQsFrame.getTop());
|
||||
mQsVisible = qsVisible;
|
||||
mQs.setFancyClipping(
|
||||
mQsClipTop,
|
||||
@@ -2497,8 +2502,11 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
|
||||
private float getQSEdgePosition() {
|
||||
// TODO: replace StackY with unified calculation
|
||||
return Math.max(mQuickQsOffsetHeight * mAmbientState.getExpansionFraction(),
|
||||
mAmbientState.getStackY() - mAmbientState.getScrollY());
|
||||
return Math.max(mQuickQsHeaderHeight * mAmbientState.getExpansionFraction(),
|
||||
mAmbientState.getStackY()
|
||||
// need to adjust for extra margin introduced by large screen shade header
|
||||
+ mAmbientState.getStackTopMargin() * mAmbientState.getExpansionFraction()
|
||||
- mAmbientState.getScrollY());
|
||||
}
|
||||
|
||||
private int calculateQsBottomPosition(float qsExpansionFraction) {
|
||||
@@ -3530,7 +3538,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
public final QS.ScrollListener mScrollListener = new QS.ScrollListener() {
|
||||
@Override
|
||||
public void onQsPanelScrollChanged(int scrollY) {
|
||||
mSplitShadeHeaderController.setQsScrollY(scrollY);
|
||||
mLargeScreenShadeHeaderController.setQsScrollY(scrollY);
|
||||
if (scrollY > 0 && !mQsFullyExpanded) {
|
||||
if (DEBUG) Log.d(TAG, "Scrolling while not expanded. Forcing expand");
|
||||
// If we are scrolling QS, we should be fully expanded.
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.android.systemui.plugins.qs.QSContainerController
|
||||
import com.android.systemui.recents.OverviewProxyService
|
||||
import com.android.systemui.recents.OverviewProxyService.OverviewProxyListener
|
||||
import com.android.systemui.shared.system.QuickStepContract
|
||||
import com.android.systemui.util.Utils
|
||||
import com.android.systemui.util.LargeScreenUtils
|
||||
import com.android.systemui.util.ViewController
|
||||
import com.android.systemui.util.concurrency.DelayableExecutor
|
||||
import java.util.function.Consumer
|
||||
@@ -50,7 +50,8 @@ class NotificationsQSContainerController @Inject constructor(
|
||||
private var isQSCustomizing = false
|
||||
private var isQSCustomizerAnimating = false
|
||||
|
||||
private var splitShadeStatusBarHeight = 0
|
||||
private var largeScreenShadeHeaderHeight = 0
|
||||
private var largeScreenShadeHeaderActive = false
|
||||
private var notificationsBottomMargin = 0
|
||||
private var scrimShadeBottomMargin = 0
|
||||
private var bottomStableInsets = 0
|
||||
@@ -115,16 +116,18 @@ class NotificationsQSContainerController @Inject constructor(
|
||||
}
|
||||
|
||||
fun updateResources() {
|
||||
val newSplitShadeEnabled = Utils.shouldUseSplitNotificationShade(resources)
|
||||
val newSplitShadeEnabled = LargeScreenUtils.shouldUseSplitNotificationShade(resources)
|
||||
val splitShadeEnabledChanged = newSplitShadeEnabled != splitShadeEnabled
|
||||
splitShadeEnabled = newSplitShadeEnabled
|
||||
largeScreenShadeHeaderActive = LargeScreenUtils.shouldUseLargeScreenShadeHeader(resources)
|
||||
notificationsBottomMargin = resources.getDimensionPixelSize(
|
||||
R.dimen.notification_panel_margin_bottom)
|
||||
splitShadeStatusBarHeight = Utils.getSplitShadeStatusBarHeight(context)
|
||||
largeScreenShadeHeaderHeight =
|
||||
resources.getDimensionPixelSize(R.dimen.large_screen_shade_header_height)
|
||||
panelMarginHorizontal = resources.getDimensionPixelSize(
|
||||
R.dimen.notification_panel_margin_horizontal)
|
||||
topMargin = if (splitShadeEnabled) {
|
||||
splitShadeStatusBarHeight
|
||||
topMargin = if (largeScreenShadeHeaderActive) {
|
||||
largeScreenShadeHeaderHeight
|
||||
} else {
|
||||
resources.getDimensionPixelSize(R.dimen.notification_panel_margin_top)
|
||||
}
|
||||
@@ -229,13 +232,13 @@ class NotificationsQSContainerController @Inject constructor(
|
||||
setKeyguardStatusViewConstraints(constraintSet)
|
||||
setQsConstraints(constraintSet)
|
||||
setNotificationsConstraints(constraintSet)
|
||||
setSplitShadeStatusBarConstraints(constraintSet)
|
||||
setLargeScreenShadeHeaderConstraints(constraintSet)
|
||||
mView.applyConstraints(constraintSet)
|
||||
}
|
||||
|
||||
private fun setSplitShadeStatusBarConstraints(constraintSet: ConstraintSet) {
|
||||
if (splitShadeEnabled) {
|
||||
constraintSet.constrainHeight(R.id.split_shade_status_bar, splitShadeStatusBarHeight)
|
||||
private fun setLargeScreenShadeHeaderConstraints(constraintSet: ConstraintSet) {
|
||||
if (largeScreenShadeHeaderActive) {
|
||||
constraintSet.constrainHeight(R.id.split_shade_status_bar, largeScreenShadeHeaderHeight)
|
||||
} else {
|
||||
if (useCombinedQSHeaders) {
|
||||
constraintSet.constrainHeight(R.id.split_shade_status_bar, WRAP_CONTENT)
|
||||
|
||||
@@ -31,10 +31,10 @@ import com.android.systemui.statusbar.notification.stack.NotificationListContain
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutListContainerModule;
|
||||
import com.android.systemui.statusbar.phone.CentralSurfacesCommandQueueCallbacks;
|
||||
import com.android.systemui.statusbar.phone.LargeScreenShadeHeaderController;
|
||||
import com.android.systemui.statusbar.phone.NotificationPanelViewController;
|
||||
import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
|
||||
import com.android.systemui.statusbar.phone.NotificationShadeWindowViewController;
|
||||
import com.android.systemui.statusbar.phone.SplitShadeHeaderController;
|
||||
import com.android.systemui.statusbar.phone.StatusBarHeadsUpChangeListener;
|
||||
import com.android.systemui.statusbar.phone.StatusBarNotificationActivityStarterModule;
|
||||
import com.android.systemui.statusbar.phone.StatusBarNotificationPresenterModule;
|
||||
@@ -133,9 +133,9 @@ public interface CentralSurfacesComponent {
|
||||
CentralSurfacesCommandQueueCallbacks getCentralSurfacesCommandQueueCallbacks();
|
||||
|
||||
/**
|
||||
* Creates a SplitShadeHeaderController.
|
||||
* Creates a {@link LargeScreenShadeHeaderController}.
|
||||
*/
|
||||
SplitShadeHeaderController getSplitShadeHeaderController();
|
||||
LargeScreenShadeHeaderController getLargeScreenShadeHeaderController();
|
||||
|
||||
/**
|
||||
* Creates a new {@link CollapsedStatusBarFragment} each time it's called. See
|
||||
|
||||
@@ -73,9 +73,9 @@ import dagger.Provides;
|
||||
@Module(subcomponents = StatusBarFragmentComponent.class)
|
||||
public abstract class StatusBarViewModule {
|
||||
|
||||
public static final String SPLIT_SHADE_HEADER = "split_shade_header";
|
||||
public static final String LARGE_SCREEN_SHADE_HEADER = "large_screen_shade_header";
|
||||
private static final String SPLIT_SHADE_BATTERY_VIEW = "split_shade_battery_view";
|
||||
public static final String SPLIT_SHADE_BATTERY_CONTROLLER = "split_shade_battery_controller";
|
||||
public static final String LARGE_SCREEN_BATTERY_CONTROLLER = "split_shade_battery_controller";
|
||||
public static final String STATUS_BAR_FRAGMENT = "status_bar_fragment";
|
||||
|
||||
/** */
|
||||
@@ -159,15 +159,15 @@ public abstract class StatusBarViewModule {
|
||||
|
||||
/** */
|
||||
@Provides
|
||||
@Named(SPLIT_SHADE_HEADER)
|
||||
@Named(LARGE_SCREEN_SHADE_HEADER)
|
||||
@CentralSurfacesComponent.CentralSurfacesScope
|
||||
public static View getSplitShadeStatusBarView(
|
||||
public static View getLargeScreenShadeHeaderBarView(
|
||||
NotificationShadeWindowView notificationShadeWindowView,
|
||||
FeatureFlags featureFlags) {
|
||||
ViewStub stub = notificationShadeWindowView.findViewById(R.id.qs_header_stub);
|
||||
int layoutId = featureFlags.isEnabled(Flags.COMBINED_QS_HEADERS)
|
||||
? R.layout.combined_qs_header
|
||||
: R.layout.split_shade_header;
|
||||
: R.layout.large_screen_shade_header;
|
||||
stub.setLayoutResource(layoutId);
|
||||
View v = stub.inflate();
|
||||
return v;
|
||||
@@ -177,14 +177,15 @@ public abstract class StatusBarViewModule {
|
||||
@Provides
|
||||
@CentralSurfacesComponent.CentralSurfacesScope
|
||||
public static OngoingPrivacyChip getSplitShadeOngoingPrivacyChip(
|
||||
@Named(SPLIT_SHADE_HEADER) View header) {
|
||||
@Named(LARGE_SCREEN_SHADE_HEADER) View header) {
|
||||
return header.findViewById(R.id.privacy_chip);
|
||||
}
|
||||
|
||||
/** */
|
||||
@Provides
|
||||
@CentralSurfacesComponent.CentralSurfacesScope
|
||||
static StatusIconContainer providesStatusIconContainer(@Named(SPLIT_SHADE_HEADER) View header) {
|
||||
static StatusIconContainer providesStatusIconContainer(
|
||||
@Named(LARGE_SCREEN_SHADE_HEADER) View header) {
|
||||
return header.findViewById(R.id.statusIcons);
|
||||
}
|
||||
|
||||
@@ -192,13 +193,13 @@ public abstract class StatusBarViewModule {
|
||||
@Provides
|
||||
@CentralSurfacesComponent.CentralSurfacesScope
|
||||
@Named(SPLIT_SHADE_BATTERY_VIEW)
|
||||
static BatteryMeterView getBatteryMeterView(@Named(SPLIT_SHADE_HEADER) View view) {
|
||||
static BatteryMeterView getBatteryMeterView(@Named(LARGE_SCREEN_SHADE_HEADER) View view) {
|
||||
return view.findViewById(R.id.batteryRemainingIcon);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@CentralSurfacesComponent.CentralSurfacesScope
|
||||
@Named(SPLIT_SHADE_BATTERY_CONTROLLER)
|
||||
@Named(LARGE_SCREEN_BATTERY_CONTROLLER)
|
||||
static BatteryMeterViewController getBatteryMeterViewController(
|
||||
@Named(SPLIT_SHADE_BATTERY_VIEW) BatteryMeterView batteryMeterView,
|
||||
ConfigurationController configurationController,
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import com.android.systemui.dagger.SysUISingleton
|
||||
import com.android.systemui.statusbar.CommandQueue
|
||||
import com.android.systemui.util.Utils
|
||||
import com.android.systemui.util.LargeScreenUtils
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
@@ -42,7 +42,8 @@ class RemoteInputQuickSettingsDisabler @Inject constructor(
|
||||
init {
|
||||
isLandscape =
|
||||
context.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||
shouldUseSplitNotificationShade = Utils.shouldUseSplitNotificationShade(context.resources)
|
||||
shouldUseSplitNotificationShade =
|
||||
LargeScreenUtils.shouldUseSplitNotificationShade(context.resources)
|
||||
configController.addCallback(this)
|
||||
}
|
||||
|
||||
@@ -73,7 +74,7 @@ class RemoteInputQuickSettingsDisabler @Inject constructor(
|
||||
needToRecompute = true
|
||||
}
|
||||
|
||||
val newSplitShadeFlag = Utils.shouldUseSplitNotificationShade(context.resources)
|
||||
val newSplitShadeFlag = LargeScreenUtils.shouldUseSplitNotificationShade(context.resources)
|
||||
if (newSplitShadeFlag != shouldUseSplitNotificationShade) {
|
||||
shouldUseSplitNotificationShade = newSplitShadeFlag
|
||||
needToRecompute = true
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.android.systemui.util
|
||||
|
||||
import android.content.res.Resources
|
||||
import com.android.systemui.R
|
||||
|
||||
object LargeScreenUtils {
|
||||
|
||||
/**
|
||||
* Returns true if the device should use the split notification shade, based on orientation and
|
||||
* screen width.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun shouldUseSplitNotificationShade(resources: Resources): Boolean {
|
||||
return resources.getBoolean(R.bool.config_use_split_notification_shade)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if we should use large screen shade header:
|
||||
* [com.android.systemui.statusbar.phone.LargeScreenShadeHeaderController]
|
||||
* That should be true when we have enough horizontal space to show all info in one row.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun shouldUseLargeScreenShadeHeader(resources: Resources): Boolean {
|
||||
return resources.getBoolean(R.bool.config_use_large_screen_shade_header)
|
||||
}
|
||||
}
|
||||
@@ -25,12 +25,10 @@ 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;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
@@ -50,58 +48,6 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the visibility of an UI element according to the DISABLE_* flags in
|
||||
* {@link android.app.StatusBarManager}.
|
||||
*/
|
||||
public static class DisableStateTracker implements CommandQueue.Callbacks,
|
||||
View.OnAttachStateChangeListener {
|
||||
private final int mMask1;
|
||||
private final int mMask2;
|
||||
private final CommandQueue mCommandQueue;
|
||||
private View mView;
|
||||
private boolean mDisabled;
|
||||
|
||||
public DisableStateTracker(int disableMask, int disable2Mask, CommandQueue commandQueue) {
|
||||
mMask1 = disableMask;
|
||||
mMask2 = disable2Mask;
|
||||
mCommandQueue = commandQueue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAttachedToWindow(View v) {
|
||||
mView = v;
|
||||
mCommandQueue.addCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(View v) {
|
||||
mCommandQueue.removeCallback(this);
|
||||
mView = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets visibility of this {@link View} given the states passed from
|
||||
* {@link com.android.systemui.statusbar.CommandQueue.Callbacks#disable(int, int, int)}.
|
||||
*/
|
||||
@Override
|
||||
public void disable(int displayId, int state1, int state2, boolean animate) {
|
||||
if (displayId != mView.getDisplay().getDisplayId()) {
|
||||
return;
|
||||
}
|
||||
final boolean disabled = ((state1 & mMask1) != 0) || ((state2 & mMask2) != 0);
|
||||
if (disabled == mDisabled) return;
|
||||
mDisabled = disabled;
|
||||
mView.setVisibility(disabled ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
/** @return {@code true} if and only if this {@link View} is currently disabled */
|
||||
public boolean isDisabled() {
|
||||
return mDisabled;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns {@code true} iff the package {@code packageName} is a headless remote display
|
||||
* provider, i.e, that the package holds the privileged {@code REMOTE_DISPLAY_PROVIDER}
|
||||
@@ -150,17 +96,6 @@ public class Utils {
|
||||
return useQsMediaPlayer(context) && flag > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow recommendations from smartspace to show in media controls.
|
||||
* Requires {@link #useQsMediaPlayer(Context)} to be enabled.
|
||||
* On by default, but can be disabled by setting to 0
|
||||
*/
|
||||
public static boolean allowMediaRecommendations(Context context) {
|
||||
int flag = Settings.Secure.getInt(context.getContentResolver(),
|
||||
Settings.Secure.MEDIA_CONTROLS_RECOMMENDATION, 1);
|
||||
return useQsMediaPlayer(context) && flag > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the device should use the collapsed layout for the media player when in
|
||||
* landscape (or seascape) orientation
|
||||
@@ -169,14 +104,6 @@ public class Utils {
|
||||
return resources.getBoolean(R.bool.config_quickSettingsMediaLandscapeCollapsed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the device should use the split notification shade, based on orientation and
|
||||
* screen width.
|
||||
*/
|
||||
public static boolean shouldUseSplitNotificationShade(Resources resources) {
|
||||
return resources.getBoolean(R.bool.config_use_split_notification_shade);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the color provided at the specified {@param attrIndex} in {@param a} if it exists,
|
||||
* otherwise, returns the color from the private attribute {@param privAttrId}.
|
||||
@@ -196,33 +123,6 @@ public class Utils {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link R.dimen#split_shade_header_height}.
|
||||
*
|
||||
* It should be fine to not ignore cutouts as split shade might not want to react to them:
|
||||
* for split shade header, which is only on bigger screens, either cutout won't be a problem
|
||||
* (it's usually centered and in split shade that's likely empty area) or we probably want to
|
||||
* handle it differently.
|
||||
*/
|
||||
public static int getSplitShadeStatusBarHeight(Context context) {
|
||||
return context.getResources().getDimensionPixelSize(R.dimen.split_shade_header_height);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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}.
|
||||
*/
|
||||
|
||||
@@ -279,7 +279,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
||||
public void notifPaddingMakesUpToFullMarginInSplitShade() {
|
||||
when(mResources.getDimensionPixelSize(R.dimen.keyguard_split_shade_top_margin))
|
||||
.thenReturn(100);
|
||||
when(mResources.getDimensionPixelSize(R.dimen.split_shade_header_height))
|
||||
when(mResources.getDimensionPixelSize(R.dimen.large_screen_shade_header_height))
|
||||
.thenReturn(70);
|
||||
mClockPositionAlgorithm.loadDimens(mResources);
|
||||
givenLockScreen();
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.mockito.Mockito.`when` as whenever
|
||||
|
||||
@SmallTest
|
||||
@RunWith(AndroidTestingRunner::class)
|
||||
class SplitShadeHeaderControllerTest : SysuiTestCase() {
|
||||
class LargeScreenShadeHeaderControllerTest : SysuiTestCase() {
|
||||
|
||||
@Mock private lateinit var view: View
|
||||
@Mock private lateinit var statusIcons: StatusIconContainer
|
||||
@@ -43,7 +43,7 @@ class SplitShadeHeaderControllerTest : SysuiTestCase() {
|
||||
@JvmField @Rule val mockitoRule = MockitoJUnit.rule()
|
||||
var viewVisibility = View.GONE
|
||||
|
||||
private lateinit var splitShadeHeaderController: SplitShadeHeaderController
|
||||
private lateinit var mLargeScreenShadeHeaderController: LargeScreenShadeHeaderController
|
||||
private lateinit var carrierIconSlots: List<String>
|
||||
|
||||
@Before
|
||||
@@ -62,7 +62,7 @@ class SplitShadeHeaderControllerTest : SysuiTestCase() {
|
||||
}
|
||||
whenever(view.visibility).thenAnswer { _ -> viewVisibility }
|
||||
whenever(featureFlags.isEnabled(Flags.COMBINED_QS_HEADERS)).thenReturn(false)
|
||||
splitShadeHeaderController = SplitShadeHeaderController(
|
||||
mLargeScreenShadeHeaderController = LargeScreenShadeHeaderController(
|
||||
view,
|
||||
statusBarIconController,
|
||||
privacyIconsController,
|
||||
@@ -76,11 +76,11 @@ class SplitShadeHeaderControllerTest : SysuiTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setVisible_onlyInSplitShade() {
|
||||
fun setVisible_onlyWhenActive() {
|
||||
makeShadeVisible()
|
||||
assertThat(viewVisibility).isEqualTo(View.VISIBLE)
|
||||
|
||||
splitShadeHeaderController.splitShadeMode = false
|
||||
mLargeScreenShadeHeaderController.active = false
|
||||
assertThat(viewVisibility).isEqualTo(View.GONE)
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class SplitShadeHeaderControllerTest : SysuiTestCase() {
|
||||
@Test
|
||||
fun shadeExpandedFraction_updatesAlpha() {
|
||||
makeShadeVisible()
|
||||
splitShadeHeaderController.shadeExpandedFraction = 0.5f
|
||||
mLargeScreenShadeHeaderController.shadeExpandedFraction = 0.5f
|
||||
verify(view).setAlpha(ShadeInterpolation.getContentAlpha(0.5f))
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class SplitShadeHeaderControllerTest : SysuiTestCase() {
|
||||
}
|
||||
|
||||
private fun makeShadeVisible() {
|
||||
splitShadeHeaderController.splitShadeMode = true
|
||||
splitShadeHeaderController.shadeExpanded = true
|
||||
mLargeScreenShadeHeaderController.active = true
|
||||
mLargeScreenShadeHeaderController.shadeExpanded = true
|
||||
}
|
||||
}
|
||||
@@ -288,7 +288,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
||||
@Mock
|
||||
private SecureSettings mSecureSettings;
|
||||
@Mock
|
||||
private SplitShadeHeaderController mSplitShadeHeaderController;
|
||||
private LargeScreenShadeHeaderController mLargeScreenShadeHeaderController;
|
||||
@Mock
|
||||
private ContentResolver mContentResolver;
|
||||
@Mock
|
||||
@@ -498,7 +498,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
||||
mRecordingController,
|
||||
mExecutor,
|
||||
mSecureSettings,
|
||||
mSplitShadeHeaderController,
|
||||
mLargeScreenShadeHeaderController,
|
||||
mScreenOffAnimationController,
|
||||
mLockscreenGestureLogger,
|
||||
new PanelExpansionStateManager(),
|
||||
@@ -918,6 +918,18 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
||||
verify(mKeyguardStatusViewController, never()).displayClock(LARGE, /* animate */ true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLargeScreenHeaderMadeActiveForLargeScreen() {
|
||||
mStatusBarStateController.setState(SHADE);
|
||||
when(mResources.getBoolean(R.bool.config_use_large_screen_shade_header)).thenReturn(true);
|
||||
mNotificationPanelViewController.updateResources();
|
||||
verify(mLargeScreenShadeHeaderController).setActive(true);
|
||||
|
||||
when(mResources.getBoolean(R.bool.config_use_large_screen_shade_header)).thenReturn(false);
|
||||
mNotificationPanelViewController.updateResources();
|
||||
verify(mLargeScreenShadeHeaderController).setActive(false);
|
||||
}
|
||||
|
||||
private void triggerPositionClockAndNotifications() {
|
||||
mNotificationPanelViewController.closeQs();
|
||||
}
|
||||
|
||||
@@ -467,6 +467,29 @@ class NotificationQSContainerControllerTest : SysuiTestCase() {
|
||||
assertThat(getConstraintSetLayout(R.id.qs_frame).startMargin).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testLargeScreenLayout_qsAndNotifsTopMarginIsOfHeaderHeight() {
|
||||
setLargeScreen()
|
||||
val largeScreenHeaderHeight = 100
|
||||
overrideResource(R.dimen.large_screen_shade_header_height, largeScreenHeaderHeight)
|
||||
|
||||
controller.updateResources()
|
||||
|
||||
assertThat(getConstraintSetLayout(R.id.qs_frame).topMargin)
|
||||
.isEqualTo(largeScreenHeaderHeight)
|
||||
assertThat(getConstraintSetLayout(R.id.notification_stack_scroller).topMargin)
|
||||
.isEqualTo(largeScreenHeaderHeight)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testSmallScreenLayout_qsAndNotifsTopMarginIsZero() {
|
||||
setSmallScreen()
|
||||
controller.updateResources()
|
||||
assertThat(getConstraintSetLayout(R.id.qs_frame).topMargin).isEqualTo(0)
|
||||
assertThat(getConstraintSetLayout(R.id.notification_stack_scroller).topMargin)
|
||||
.isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testSinglePaneShadeLayout_qsFrameHasHorizontalMarginsSetToCorrectValue() {
|
||||
disableSplitShade()
|
||||
@@ -537,6 +560,18 @@ class NotificationQSContainerControllerTest : SysuiTestCase() {
|
||||
controller.updateResources()
|
||||
}
|
||||
|
||||
private fun setSmallScreen() {
|
||||
setLargeScreenEnabled(false)
|
||||
}
|
||||
|
||||
private fun setLargeScreen() {
|
||||
setLargeScreenEnabled(true)
|
||||
}
|
||||
|
||||
private fun setLargeScreenEnabled(enabled: Boolean) {
|
||||
overrideResource(R.bool.config_use_large_screen_shade_header, enabled)
|
||||
}
|
||||
|
||||
private fun given(
|
||||
taskbarVisible: Boolean,
|
||||
navigationMode: Int,
|
||||
|
||||
Reference in New Issue
Block a user