summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Aaron Heuckroth <nesciosquid@google.com> 2019-02-26 14:30:40 -0500
committer Aaron Heuckroth <nesciosquid@google.com> 2019-02-27 15:50:08 -0500
commitd005334b92ba4fed680bae6581f5a782ec6d832f (patch)
tree5e07038b0fe07676f1911a19b716ec7476c98f6e
parent437ca649d67d0071d67617db6579854ba0b302e5 (diff)
Initialize rotation when HardwareUILayout is constructed in landscape.
Test: Automated tests pass, classic power menu appears correct when created in landscape mode. Fixes: 126220438 Fixes: 126221661 Change-Id: I63863c21d09b35100a9ed89d0c2ed0d3868e3aea
-rw-r--r--packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java b/packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java
index 2a1d066d356e..f5451e952dd9 100644
--- a/packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java
@@ -63,6 +63,9 @@ public class HardwareUiLayout extends MultiListLayout implements Tunable {
public HardwareUiLayout(Context context, AttributeSet attrs) {
super(context, attrs);
+ // Manually re-initialize mRotation to portrait-mode, since this view must always
+ // be constructed in portrait mode and rotated into the correct initial position.
+ mRotation = ROTATION_NONE;
updateSettings();
}
@@ -172,6 +175,10 @@ public class HardwareUiLayout extends MultiListLayout implements Tunable {
mSeparatedView.setBackground(mSeparatedViewBackground);
updateEdgeMargin(mEdgeBleed ? 0 : getEdgePadding());
mOldHeight = mList.getMeasuredHeight();
+
+ // Must be called to initialize view rotation correctly.
+ // Requires LayoutParams, hence why this isn't called during the constructor.
+ updateRotation();
} else {
return;
}
@@ -189,7 +196,18 @@ public class HardwareUiLayout extends MultiListLayout implements Tunable {
mSwapOrientation = swapOrientation;
}
- @Override
+ private void updateRotation() {
+ int rotation = RotationUtils.getRotation(getContext());
+ if (rotation != mRotation) {
+ rotate(mRotation, rotation);
+ mRotation = rotation;
+ }
+ }
+
+ /**
+ * Requires LayoutParams to be set to work correctly, and therefore must be run after after
+ * the HardwareUILayout has been added to the view hierarchy.
+ */
protected void rotate(int from, int to) {
super.rotate(from, to);
if (from != ROTATION_NONE && to != ROTATION_NONE) {
@@ -522,4 +540,4 @@ public class HardwareUiLayout extends MultiListLayout implements Tunable {
inoutInfo.contentInsets.set(mList.getLeft(), mList.getTop(),
0, getBottom() - mList.getBottom());
};
-}
+} \ No newline at end of file