diff --git a/packages/SystemUI/res/layout/quick_qs_status_icons.xml b/packages/SystemUI/res/layout/quick_qs_status_icons.xml
index f0229a648612d..a62310be9bac9 100644
--- a/packages/SystemUI/res/layout/quick_qs_status_icons.xml
+++ b/packages/SystemUI/res/layout/quick_qs_status_icons.xml
@@ -28,7 +28,7 @@
-
+ android:layout_gravity="center"
+ android:layout_marginStart="8dp"
+ android:layout_marginEnd="8dp"
+ android:visibility="gone"
+ />
-
+ android:layout_weight="1"
+ >
+
+
+
+
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
index 73a6b34c612ef..b9a5b7984ddef 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
@@ -38,7 +38,6 @@ import com.android.systemui.BatteryMeterView;
import com.android.systemui.R;
import com.android.systemui.animation.Interpolators;
import com.android.systemui.qs.QSDetail.Callback;
-import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.phone.StatusBarIconController.TintedIconManager;
import com.android.systemui.statusbar.phone.StatusBarWindowView;
import com.android.systemui.statusbar.phone.StatusIconContainer;
@@ -67,7 +66,11 @@ public class QuickStatusBarHeader extends FrameLayout {
private View mQSCarriers;
private Clock mClockView;
- private Space mSpace;
+ private Space mDatePrivacySeparator;
+ private View mClockIconsSeparator;
+ private boolean mShowClockIconsSeparator;
+ private ViewGroup mRightLayout;
+
private BatteryMeterView mBatteryRemainingIcon;
private StatusIconContainer mIconContainer;
private View mPrivacyChip;
@@ -117,9 +120,11 @@ public class QuickStatusBarHeader extends FrameLayout {
mPrivacyChip = findViewById(R.id.privacy_chip);
mDateView = findViewById(R.id.date);
mSecurityHeaderView = findViewById(R.id.header_text_container);
+ mClockIconsSeparator = findViewById(R.id.separator);
+ mRightLayout = findViewById(R.id.rightLayout);
mClockView = findViewById(R.id.clock);
- mSpace = findViewById(R.id.space);
+ mDatePrivacySeparator = findViewById(R.id.space);
// Tint for the battery icons are handled in setupHost()
mBatteryRemainingIcon = findViewById(R.id.batteryRemainingIcon);
@@ -230,36 +235,36 @@ public class QuickStatusBarHeader extends FrameLayout {
}
private void updateAlphaAnimator() {
- StatusBarIconView noCallingIcon =
- ((StatusBarIconView) mIconContainer.getViewForSlot(mMobileSlotName));
- StatusBarIconView callStrengthIcon =
- ((StatusBarIconView) mIconContainer.getViewForSlot(mCallStrengthSlotName));
TouchAnimator.Builder builder = new TouchAnimator.Builder()
// The following two views have to be hidden manually, so as not to hide the
// Privacy chip in QQS
.addFloat(mDateView, "alpha", 0, 1)
.addFloat(mSecurityHeaderView, "alpha", 0, 1)
- .addFloat(mQSCarriers, "alpha", 0, 1);
- builder.setListener(new TouchAnimator.ListenerAdapter() {
- @Override
- public void onAnimationAtEnd() {
- mIconContainer.addIgnoredSlot(mMobileSlotName);
- mIconContainer.addIgnoredSlot(mCallStrengthSlotName);
- }
+ .addFloat(mQSCarriers, "alpha", 0, 1)
+ .setListener(new TouchAnimator.ListenerAdapter() {
+ @Override
+ public void onAnimationAtEnd() {
+ mIconContainer.addIgnoredSlot(mMobileSlotName);
+ mIconContainer.addIgnoredSlot(mCallStrengthSlotName);
+ }
- @Override
- public void onAnimationStarted() {
- mIconContainer.addIgnoredSlot(mMobileSlotName);
- mIconContainer.addIgnoredSlot(mCallStrengthSlotName);
- }
+ @Override
+ public void onAnimationStarted() {
+ mIconContainer.addIgnoredSlot(mMobileSlotName);
+ mIconContainer.addIgnoredSlot(mCallStrengthSlotName);
- @Override
- public void onAnimationAtStart() {
- super.onAnimationAtStart();
- mIconContainer.removeIgnoredSlot(mMobileSlotName);
- mIconContainer.removeIgnoredSlot(mCallStrengthSlotName);
- }
- });
+ setSeparatorVisibility(false);
+ }
+
+ @Override
+ public void onAnimationAtStart() {
+ super.onAnimationAtStart();
+ mIconContainer.removeIgnoredSlot(mMobileSlotName);
+ mIconContainer.removeIgnoredSlot(mCallStrengthSlotName);
+
+ setSeparatorVisibility(mShowClockIconsSeparator);
+ }
+ });
mAlphaAnimator = builder.build();
}
@@ -337,20 +342,30 @@ public class QuickStatusBarHeader extends FrameLayout {
cutout, cornerCutoutPadding, -1);
mDatePrivacyView.setPadding(padding.first, 0, padding.second, 0);
mClockIconsView.setPadding(padding.first, 0, padding.second, 0);
- LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mSpace.getLayoutParams();
+ LinearLayout.LayoutParams datePrivacySeparatorLayoutParams =
+ (LinearLayout.LayoutParams) mDatePrivacySeparator.getLayoutParams();
+ LinearLayout.LayoutParams mClockIconsSeparatorLayoutParams =
+ (LinearLayout.LayoutParams) mClockIconsSeparator.getLayoutParams();
boolean cornerCutout = cornerCutoutPadding != null
&& (cornerCutoutPadding.first == 0 || cornerCutoutPadding.second == 0);
if (cutout != null) {
Rect topCutout = cutout.getBoundingRectTop();
if (topCutout.isEmpty() || cornerCutout) {
- lp.width = 0;
- mSpace.setVisibility(View.GONE);
+ datePrivacySeparatorLayoutParams.width = 0;
+ mDatePrivacySeparator.setVisibility(View.GONE);
+ mClockIconsSeparatorLayoutParams.width = 0;
+ setSeparatorVisibility(false);
+ mShowClockIconsSeparator = false;
} else {
- lp.width = topCutout.width();
- mSpace.setVisibility(View.VISIBLE);
+ datePrivacySeparatorLayoutParams.width = topCutout.width();
+ mDatePrivacySeparator.setVisibility(View.VISIBLE);
+ mClockIconsSeparatorLayoutParams.width = topCutout.width();
+ mShowClockIconsSeparator = true;
+ setSeparatorVisibility(mKeyguardExpansionFraction == 0f);
}
}
- mSpace.setLayoutParams(lp);
+ mDatePrivacySeparator.setLayoutParams(datePrivacySeparatorLayoutParams);
+ mClockIconsSeparator.setLayoutParams(mClockIconsSeparatorLayoutParams);
mCutOutPaddingLeft = padding.first;
mCutOutPaddingRight = padding.second;
mWaterfallTopInset = cutout == null ? 0 : cutout.getWaterfallInsets().top;
@@ -358,6 +373,32 @@ public class QuickStatusBarHeader extends FrameLayout {
return super.onApplyWindowInsets(insets);
}
+ /**
+ * Sets the visibility of the separator between clock and icons.
+ *
+ * This separator is "visible" when there is a center cutout, to block that space. In that
+ * case, the clock and the layout on the right (containing the icons and the battery meter) are
+ * set to weight 1 to take the available space.
+ * @param visible whether the separator between clock and icons should be visible.
+ */
+ private void setSeparatorVisibility(boolean visible) {
+ int newVisibility = visible ? View.VISIBLE : View.GONE;
+ if (mClockIconsSeparator.getVisibility() == newVisibility) return;
+
+ mClockIconsSeparator.setVisibility(visible ? View.VISIBLE : View.GONE);
+ mQSCarriers.setVisibility(visible ? View.GONE : View.VISIBLE);
+
+ LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mClockView.getLayoutParams();
+ lp.width = visible ? 0 : WRAP_CONTENT;
+ lp.weight = visible ? 1f : 0f;
+ mClockView.setLayoutParams(lp);
+
+ lp = (LinearLayout.LayoutParams) mRightLayout.getLayoutParams();
+ lp.width = visible ? 0 : WRAP_CONTENT;
+ lp.weight = visible ? 1f : 0f;
+ mRightLayout.setLayoutParams(lp);
+ }
+
private void updateHeadersPadding() {
setContentMargins(mDatePrivacyView, 0, 0);
setContentMargins(mClockIconsView, 0, 0);