From 5f2121d729c487f7b0421d108027ade1e6f56337 Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Tue, 23 Nov 2021 08:08:52 -0500 Subject: [PATCH] Bouncer updates Part one of many, to add a multi-user switcher to the bouncer for supported displays. This CL: 1. Removes a config that was not-needed, in favor of the can_use_one_handed_bouncer resource. 2. Adds a new boolean resource to determine when to use the new bouncer layout with user switcher Test: atest KeyguardHostViewControllerTest KeyguardSecurityContainerControllerTest Bug: 206825213 Change-Id: I18e5e8ef68a57c5c633664062bb2f4fd5d7b778f --- core/res/res/values-sw600dp/config.xml | 5 -- core/res/res/values/config.xml | 4 -- core/res/res/values/symbols.xml | 2 - packages/SystemUI/docs/keyguard/bouncer.md | 9 +++ .../values-sw600dp-land/bools.xml | 2 + .../res-keyguard/values-sw720dp/bools.xml | 6 ++ .../SystemUI/res-keyguard/values/config.xml | 6 ++ .../keyguard/KeyguardHostViewController.java | 4 +- .../KeyguardSecurityContainerController.java | 17 +++--- .../keyguard/KeyguardSecurityModel.java | 9 --- .../KeyguardHostViewControllerTest.java | 6 -- ...yguardSecurityContainerControllerTest.java | 60 ++----------------- 12 files changed, 40 insertions(+), 90 deletions(-) diff --git a/core/res/res/values-sw600dp/config.xml b/core/res/res/values-sw600dp/config.xml index 861e329f2de96..34b6a54be4931 100644 --- a/core/res/res/values-sw600dp/config.xml +++ b/core/res/res/values-sw600dp/config.xml @@ -51,10 +51,5 @@ true - - - true - diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index c8750b35073eb..2b830b483d8da 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -5087,10 +5087,6 @@ false - - false - true diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index f8036b51fdc53..45d9a36d244d2 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -4326,8 +4326,6 @@ - - diff --git a/packages/SystemUI/docs/keyguard/bouncer.md b/packages/SystemUI/docs/keyguard/bouncer.md index 51f851608a347..b0c718d594691 100644 --- a/packages/SystemUI/docs/keyguard/bouncer.md +++ b/packages/SystemUI/docs/keyguard/bouncer.md @@ -2,6 +2,13 @@ [KeyguardBouncer][1] is the component responsible for displaying the security method set by the user (password, PIN, pattern) as well as SIM-related security methods, allowing the user to unlock the device or SIM. +## Supported States + +1. Phone, portrait mode - The default and typically only way to view the bouncer. Screen cannot rotate. +1. Phone, landscape - Can only get into this state via lockscreen activities. Launch camera, rotate to landscape, tap lock icon is one example. +1. Foldables - Both landscape and portrait are supported. In landscape, the bouncer can appear on either of the hinge and can be dragged to the other side. Also refered to as "OneHandedMode in [KeyguardSecurityContainerController][3] +1. Tablets - The bouncer is supplemented with user icons and a multi-user switcher, when available. + ## Components The bouncer contains a hierarchy of controllers/views to render the user's security method and to manage the authentication attempts. @@ -11,6 +18,8 @@ The bouncer contains a hierarchy of controllers/views to render the user's secur 1. [KeyguardSecurityContainerController][3] - Manages unlock attempt responses, one-handed use 1. [KeyguardSecurityViewFlipperController][4] - Based upon the [KeyguardSecurityModel#SecurityMode][5], will instantiate the required view and controller. PIN, Pattern, etc. +Fun fact: Naming comes from the concept of a bouncer at a bar or nightclub, who prevent troublemakers from entering or eject them from the premises. + [1]: /frameworks/base/packages/SystemUI/com/android/systemui/statusbar/phone/KeyguardBouncer [2]: /frameworks/base/packages/SystemUI/com/android/keyguard/KeyguardHostViewController [3]: /frameworks/base/packages/SystemUI/com/android/keyguard/KeyguardSecurityContainerController diff --git a/packages/SystemUI/res-keyguard/values-sw600dp-land/bools.xml b/packages/SystemUI/res-keyguard/values-sw600dp-land/bools.xml index e09bf7e37ed0c..625ce1fe2f1d3 100644 --- a/packages/SystemUI/res-keyguard/values-sw600dp-land/bools.xml +++ b/packages/SystemUI/res-keyguard/values-sw600dp-land/bools.xml @@ -16,5 +16,7 @@ --> + true diff --git a/packages/SystemUI/res-keyguard/values-sw720dp/bools.xml b/packages/SystemUI/res-keyguard/values-sw720dp/bools.xml index e09bf7e37ed0c..4daa6488a6603 100644 --- a/packages/SystemUI/res-keyguard/values-sw720dp/bools.xml +++ b/packages/SystemUI/res-keyguard/values-sw720dp/bools.xml @@ -16,5 +16,11 @@ --> + true + + + true diff --git a/packages/SystemUI/res-keyguard/values/config.xml b/packages/SystemUI/res-keyguard/values/config.xml index 6176f7c1dd0ac..6194aa0956106 100644 --- a/packages/SystemUI/res-keyguard/values/config.xml +++ b/packages/SystemUI/res-keyguard/values/config.xml @@ -22,5 +22,11 @@ false + false + + false + diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java index 3ebd652b3467c..986f296571e94 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java @@ -479,9 +479,7 @@ public class KeyguardHostViewController extends ViewController Resources resources = mView.getResources(); - if (resources.getBoolean(R.bool.can_use_one_handed_bouncer) - && resources.getBoolean( - com.android.internal.R.bool.config_enableDynamicKeyguardPositioning)) { + if (resources.getBoolean(R.bool.can_use_one_handed_bouncer)) { gravity = resources.getInteger( R.integer.keyguard_host_view_one_handed_gravity); } else { diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java index d4d3d5b3ea2d0..dfbee9828dd1a 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java @@ -496,19 +496,22 @@ public class KeyguardSecurityContainerController extends ViewController