diff --git a/packages/SystemUI/res/layout/quick_status_bar_header_date_privacy.xml b/packages/SystemUI/res/layout/quick_status_bar_header_date_privacy.xml
index d0e3d3cc3945d..51cab0a0050e6 100644
--- a/packages/SystemUI/res/layout/quick_status_bar_header_date_privacy.xml
+++ b/packages/SystemUI/res/layout/quick_status_bar_header_date_privacy.xml
@@ -29,12 +29,12 @@
android:paddingTop="@dimen/status_bar_padding_top"
android:minHeight="48dp">
-
-
+
-
-
+
diff --git a/packages/SystemUI/res/values-land/integers.xml b/packages/SystemUI/res/values-land/integers.xml
new file mode 100644
index 0000000000000..5937a075ed430
--- /dev/null
+++ b/packages/SystemUI/res/values-land/integers.xml
@@ -0,0 +1,19 @@
+
+
+
+ 1
+
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index 01a668487af39..ad4886c5abbe8 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -42,6 +42,7 @@ import com.android.systemui.settings.brightness.BrightnessSlider;
import com.android.systemui.statusbar.policy.BrightnessMirrorController;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.tuner.TunerService.Tunable;
+import com.android.systemui.util.animation.UniqueObjectHostView;
import java.util.ArrayList;
import java.util.List;
@@ -384,12 +385,17 @@ public class QSPanel extends LinearLayout implements Tunable {
private void switchSecurityFooter() {
if (mSecurityFooter != null) {
if (mContext.getResources().getConfiguration().orientation
- == Configuration.ORIENTATION_LANDSCAPE && mHeaderContainer != null
- && !mSecurityFooter.getParent().equals(mHeaderContainer)) {
+ == Configuration.ORIENTATION_LANDSCAPE && mHeaderContainer != null) {
// Adding the security view to the header, that enables us to avoid scrolling
switchToParent(mSecurityFooter, mHeaderContainer, 0);
} else {
- switchToParent(mSecurityFooter, this, -1);
+ // Where should this go? If there's media, right before it. Otherwise, at the end.
+ View mediaView = findViewByPredicate(v -> v instanceof UniqueObjectHostView);
+ int index = -1;
+ if (mediaView != null) {
+ index = indexOfChild(mediaView);
+ }
+ switchToParent(mSecurityFooter, this, index);
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
index f66872286f90a..08a68bc8a9a7a 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
@@ -68,7 +68,9 @@ public class QuickStatusBarHeader extends FrameLayout {
private Space mDatePrivacySeparator;
private View mClockIconsSeparator;
private boolean mShowClockIconsSeparator;
- private ViewGroup mRightLayout;
+ private View mRightLayout;
+ private View mDateContainer;
+ private View mPrivacyContainer;
private BatteryMeterView mBatteryRemainingIcon;
private StatusIconContainer mIconContainer;
@@ -129,6 +131,8 @@ public class QuickStatusBarHeader extends FrameLayout {
mSecurityHeaderView = findViewById(R.id.header_text_container);
mClockIconsSeparator = findViewById(R.id.separator);
mRightLayout = findViewById(R.id.rightLayout);
+ mDateContainer = findViewById(R.id.date_container);
+ mPrivacyContainer = findViewById(R.id.privacy_container);
mClockView = findViewById(R.id.clock);
mDatePrivacySeparator = findViewById(R.id.space);
@@ -179,6 +183,7 @@ public class QuickStatusBarHeader extends FrameLayout {
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
updateResources();
+ setDatePrivacyContainersWidth(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE);
}
@Override
@@ -187,6 +192,18 @@ public class QuickStatusBarHeader extends FrameLayout {
updateResources();
}
+ private void setDatePrivacyContainersWidth(boolean landscape) {
+ LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mDateContainer.getLayoutParams();
+ lp.width = landscape ? WRAP_CONTENT : 0;
+ lp.weight = landscape ? 0f : 1f;
+ mDateContainer.setLayoutParams(lp);
+
+ lp = (LinearLayout.LayoutParams) mPrivacyContainer.getLayoutParams();
+ lp.width = landscape ? WRAP_CONTENT : 0;
+ lp.weight = landscape ? 0f : 1f;
+ mPrivacyContainer.setLayoutParams(lp);
+ }
+
void updateResources() {
Resources resources = mContext.getResources();