From ffb69af6d1a34c89d0cf68379fa9cabeb0f85e36 Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Fri, 7 Jan 2022 11:32:10 -0500 Subject: [PATCH] Bouncer User Switcher - Use flags The user switcher will be enabled per device, mostly for larger form factors. Add a flag based on a config value, that can be overlayed or overriden with the flag app. Also correct some layout issues and positioning for pin/pw/pattern for larger form factors. Bug: 206825213 Test: atest KeyguardSecurityContainerTest Change-Id: Ib8c059bd5739162d3ffe7a1c86fcd757e87701bf --- .../layout/keyguard_host_view.xml | 2 -- .../layout/keyguard_password_view.xml | 1 + .../layout/keyguard_pattern_view.xml | 2 ++ .../res-keyguard/layout/keyguard_pin_view.xml | 1 + .../layout/keyguard_sim_pin_view.xml | 2 +- .../layout/keyguard_sim_puk_view.xml | 2 +- .../res-keyguard/values-sw720dp/bools.xml | 26 ------------------- .../SystemUI/res-keyguard/values/config.xml | 2 +- .../SystemUI/res-keyguard/values/dimens.xml | 1 - .../keyguard/KeyguardSecurityContainer.java | 10 ++++--- .../KeyguardSecurityContainerController.java | 13 +++++++--- .../src/com/android/systemui/flags/Flags.java | 9 +++++-- ...yguardSecurityContainerControllerTest.java | 5 +++- 13 files changed, 35 insertions(+), 41 deletions(-) delete mode 100644 packages/SystemUI/res-keyguard/values-sw720dp/bools.xml diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_host_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_host_view.xml index 1e142eaeef86f..e64b586a3e6fe 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_host_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_host_view.xml @@ -46,8 +46,6 @@ android:clipChildren="false" android:clipToPadding="false" android:paddingTop="@dimen/keyguard_security_view_top_margin" - android:paddingStart="@dimen/keyguard_security_view_lateral_margin" - android:paddingEnd="@dimen/keyguard_security_view_lateral_margin" android:layout_gravity="center" android:gravity="center"> diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml index e1550aa0c87c1..e77e084c48e8f 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml @@ -25,6 +25,7 @@ android:layout_height="match_parent" androidprv:layout_maxWidth="@dimen/keyguard_security_width" androidprv:layout_maxHeight="@dimen/keyguard_security_height" + android:layout_gravity="center_horizontal|bottom" android:gravity="bottom" > diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_pattern_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_pattern_view.xml index f613a195ea67d..231ead8dc2735 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_pattern_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_pattern_view.xml @@ -28,6 +28,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" androidprv:layout_maxWidth="@dimen/keyguard_security_width" + android:layout_gravity="center_horizontal|bottom" android:clipChildren="false" android:clipToPadding="false"> @@ -65,6 +66,7 @@ android:orientation="vertical" android:layout_gravity="bottom|center_horizontal" android:layout_marginTop="@dimen/keyguard_eca_top_margin" + android:layout_marginBottom="@dimen/keyguard_eca_bottom_margin" android:gravity="center_horizontal" /> diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml index 94566c78cc933..7ce6f0e56b8f8 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml @@ -25,6 +25,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" androidprv:layout_maxWidth="@dimen/keyguard_security_width" + android:layout_gravity="center_horizontal|bottom" android:orientation="vertical" > diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml index 3e34e4b255eb6..b765f497f9c4e 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml @@ -25,7 +25,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" androidprv:layout_maxWidth="@dimen/keyguard_security_width" - android:gravity="center_horizontal"> + android:layout_gravity="center_horizontal|bottom"> + android:layout_gravity="center_horizontal|bottom"> - - - - - false - - - true - diff --git a/packages/SystemUI/res-keyguard/values/config.xml b/packages/SystemUI/res-keyguard/values/config.xml index 6194aa0956106..e8244433260d9 100644 --- a/packages/SystemUI/res-keyguard/values/config.xml +++ b/packages/SystemUI/res-keyguard/values/config.xml @@ -27,6 +27,6 @@ false - false + false diff --git a/packages/SystemUI/res-keyguard/values/dimens.xml b/packages/SystemUI/res-keyguard/values/dimens.xml index c8bb8e99be17a..cbf4f83daeb54 100644 --- a/packages/SystemUI/res-keyguard/values/dimens.xml +++ b/packages/SystemUI/res-keyguard/values/dimens.xml @@ -37,7 +37,6 @@ 8dp - 20dp 18dp 12dp diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index b5ea498f185dd..3fab72441c894 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -616,9 +616,13 @@ public class KeyguardSecurityContainer extends FrameLayout { final View view = getChildAt(i); if (view.getVisibility() != GONE) { int updatedWidthMeasureSpec = mViewMode.getChildWidthMeasureSpec(widthMeasureSpec); + final LayoutParams lp = (LayoutParams) view.getLayoutParams(); + + // When using EXACTLY spec, measure will use the layout width if > 0. Set before + // measuring the child + lp.width = MeasureSpec.getSize(updatedWidthMeasureSpec); measureChildWithMargins(view, updatedWidthMeasureSpec, 0, heightMeasureSpec, 0); - final LayoutParams lp = (LayoutParams) view.getLayoutParams(); maxWidth = Math.max(maxWidth, view.getMeasuredWidth() + lp.leftMargin + lp.rightMargin); maxHeight = Math.max(maxHeight, @@ -969,7 +973,7 @@ public class KeyguardSecurityContainer extends FrameLayout { public int getChildWidthMeasureSpec(int parentWidthMeasureSpec) { return MeasureSpec.makeMeasureSpec( MeasureSpec.getSize(parentWidthMeasureSpec) / 2, - MeasureSpec.getMode(parentWidthMeasureSpec)); + MeasureSpec.EXACTLY); } @Override @@ -1026,7 +1030,7 @@ public class KeyguardSecurityContainer extends FrameLayout { public int getChildWidthMeasureSpec(int parentWidthMeasureSpec) { return MeasureSpec.makeMeasureSpec( MeasureSpec.getSize(parentWidthMeasureSpec) / 2, - MeasureSpec.getMode(parentWidthMeasureSpec)); + MeasureSpec.EXACTLY); } private void updateSecurityViewGravity() { diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java index 2fb2211150eca..49a8022356191 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java @@ -51,6 +51,8 @@ import com.android.settingslib.utils.ThreadUtils; import com.android.systemui.Gefingerpoken; import com.android.systemui.R; import com.android.systemui.classifier.FalsingCollector; +import com.android.systemui.flags.FeatureFlags; +import com.android.systemui.flags.Flags; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.shared.system.SysUiStatsLog; import com.android.systemui.statusbar.policy.ConfigurationController; @@ -83,6 +85,7 @@ public class KeyguardSecurityContainerController extends ViewController