summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
diff options
context:
space:
mode:
authorJamie Garside <jgarside@google.com>2021-03-19 16:15:48 +0000
committerJamie Garside <jgarside@google.com>2021-03-24 10:39:14 +0000
commitcaf8a9bfe446d3ed7cfa8e368ad68ba5c31c8693 (patch)
treee83e053df9b4aa2ba44851088c4304d13e788302 /packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
parentb99a0bc491de62de4fefdb59b7fd62bff8c97fe6 (diff)
Ensure bouncer in correct position on swipe. Remove orientationlistener.
This adds a hook to onLayout to move the bouncer to the correct screen side on large format devices. KeyguardBouncer already calls updateLayoutForSecurityMode() when the security mode is created, but this can happen before the bouncer has actually been attached to the screen (hence width = 0, so the bouncer gets left-aligned). It's also done in onResume(), but this is only called when the bouncer is at the correct place after swipe (hence causing the "jump" when swiping up). Also, removes orientationlistener from KeyguardBouncer, and replaces it with a proxied "updateResources" call. I messed up; I thought that orientationlistener worked like deviceorientationlistener, which notifies on screen rotation. Instead, it notifies on _every_ angle change, which would have led to a lot of layout passes as it'd update the bouncer gravity whenever the device moved. Oops. Test: atest SystemUITests: com.android.keyguard.KeyguardSecurityContainerControllerTest Bug: 177303121 Change-Id: I6d68e553c3114e043bcc126ba7b6910f98ce6694
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
index ccba1d59c8d0..760eaecae247 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
@@ -29,6 +29,7 @@ import static com.android.systemui.DejankUtils.whitelistIpcs;
import android.app.admin.DevicePolicyManager;
import android.content.Intent;
import android.content.res.ColorStateList;
+import android.content.res.Configuration;
import android.metrics.LogMaker;
import android.os.UserHandle;
import android.util.Log;
@@ -74,6 +75,8 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
private final SecurityCallback mSecurityCallback;
private final ConfigurationController mConfigurationController;
+ private int mLastOrientation = Configuration.ORIENTATION_UNDEFINED;
+
private SecurityMode mCurrentSecurityMode = SecurityMode.Invalid;
private final Gefingerpoken mGlobalTouchListener = new Gefingerpoken() {
@@ -212,6 +215,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
mAdminSecondaryLockScreenController = adminSecondaryLockScreenControllerFactory.create(
mKeyguardSecurityCallback);
mConfigurationController = configurationController;
+ mLastOrientation = getResources().getConfiguration().orientation;
}
@Override
@@ -498,6 +502,19 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
return getCurrentSecurityController();
}
+ /**
+ * 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 newOrientation = getResources().getConfiguration().orientation;
+ if (newOrientation != mLastOrientation) {
+ mLastOrientation = newOrientation;
+ mView.updateLayoutForSecurityMode(mCurrentSecurityMode);
+ }
+ }
+
static class Factory {
private final KeyguardSecurityContainer mView;