summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
authorJamie Garside <jgarside@google.com>2021-03-05 14:13:39 +0000
committerJamie Garside <jgarside@google.com>2021-03-12 16:44:20 +0000
commitab26e99bd2ab64cf2cf0e9b24e5424b23ce7039a (patch)
tree4188f0db77f106139879dd7fb306873cde03ce51 /packages/SystemUI/src
parenta455e38605d467094fb57b72c1bb00dc3a1641e7 (diff)
Make KeyguardBouncer react to device config changes.
Test: Existing tests updated (atest SystemUITests). Bug: 181127471 Change-Id: I5d03bf807d420e0f976632fb7b916197488c6667
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java22
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java11
4 files changed, 46 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java
index ea60f0d40369..72dd72eb1676 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java
@@ -29,6 +29,7 @@ import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnKeyListener;
import android.view.ViewTreeObserver;
+import android.widget.FrameLayout;
import com.android.keyguard.KeyguardSecurityContainer.SecurityCallback;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
@@ -180,6 +181,7 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>
/** Initialize the Controller. */
public void onInit() {
mKeyguardSecurityContainerController.init();
+ updateResources();
}
@Override
@@ -467,5 +469,23 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>
mSecurityCallback.finish(strongAuth, currentUser);
}
-
+ /**
+ * Apply keyguard configuration from the currently active resources. This can be called when the
+ * device configuration changes, to re-apply some resources that are qualified on the device
+ * configuration.
+ */
+ public void updateResources() {
+ int gravity = mView.getResources().getInteger(R.integer.keyguard_host_view_gravity);
+
+ // Android SysUI uses a FrameLayout as the top-level, but Auto uses RelativeLayout.
+ // We're just changing the gravity here though (which can't be applied to RelativeLayout),
+ // so only attempt the update if mView is inside a FrameLayout.
+ if (mView.getLayoutParams() instanceof FrameLayout.LayoutParams) {
+ FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mView.getLayoutParams();
+ if (lp.gravity != gravity) {
+ lp.gravity = gravity;
+ mView.setLayoutParams(lp);
+ }
+ }
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
index 713daaa9fd4a..6b69103f6030 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
@@ -533,6 +533,17 @@ public class KeyguardBouncer {
}
}
+ /**
+ * Apply keyguard configuration from the currently active resources. This can be called when the
+ * device configuration changes, to re-apply some resources that are qualified on the device
+ * configuration.
+ */
+ public void updateResources() {
+ if (mKeyguardViewController != null) {
+ mKeyguardViewController.updateResources();
+ }
+ }
+
public void dump(PrintWriter pw) {
pw.println("KeyguardBouncer");
pw.println(" isShowing(): " + isShowing());
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 117921dd860c..5036f27460b4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -2951,6 +2951,9 @@ public class StatusBar extends SystemUI implements DemoMode,
if (mBrightnessMirrorController != null) {
mBrightnessMirrorController.updateResources();
}
+ if (mStatusBarKeyguardViewManager != null) {
+ mStatusBarKeyguardViewManager.updateResources();
+ }
mPowerButtonReveal = new PowerButtonReveal(mContext.getResources().getDimensionPixelSize(
R.dimen.global_actions_top_padding));
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index 01ada0f4c86c..3e305f03a872 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -1050,6 +1050,17 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|| mBouncer.isFullscreenBouncer();
}
+ /**
+ * Apply keyguard configuration from the currently active resources. This can be called when the
+ * device configuration changes, to re-apply some resources that are qualified on the device
+ * configuration.
+ */
+ public void updateResources() {
+ if (mBouncer != null) {
+ mBouncer.updateResources();
+ }
+ }
+
public void dump(PrintWriter pw) {
pw.println("StatusBarKeyguardViewManager:");
pw.println(" mShowing: " + mShowing);