summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java
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/com/android/keyguard/KeyguardHostViewController.java
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/com/android/keyguard/KeyguardHostViewController.java')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java22
1 files changed, 21 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);
+ }
+ }
+ }
}