diff options
13 files changed, 35 insertions, 41 deletions
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_host_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_host_view.xml index 1e142eaeef86..e64b586a3e6f 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"> </com.android.keyguard.KeyguardSecurityViewFlipper> diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml index e1550aa0c87c..e77e084c48e8 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 f613a195ea67..231ead8dc273 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" /> </com.android.keyguard.KeyguardPatternView> diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml index 94566c78cc93..7ce6f0e56b8f 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 3e34e4b255eb..b765f497f9c4 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"> <Space android:layout_width="match_parent" diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml index d5510e90af29..917ea6b6c518 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml @@ -26,7 +26,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"> <Space android:layout_width="match_parent" diff --git a/packages/SystemUI/res-keyguard/values-sw720dp/bools.xml b/packages/SystemUI/res-keyguard/values-sw720dp/bools.xml deleted file mode 100644 index 54bb1fcab54b..000000000000 --- a/packages/SystemUI/res-keyguard/values-sw720dp/bools.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2021 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<resources> - <!-- Allows PIN/Pattern to be drawn on one side of a display, and for the user to - switch sides --> - <bool name="can_use_one_handed_bouncer">false</bool> - - <!-- Will display the bouncer on one side of the display, and the current user icon and - user switcher on the other side --> - <bool name="bouncer_display_user_switcher">true</bool> -</resources> diff --git a/packages/SystemUI/res-keyguard/values/config.xml b/packages/SystemUI/res-keyguard/values/config.xml index 6194aa095610..e8244433260d 100644 --- a/packages/SystemUI/res-keyguard/values/config.xml +++ b/packages/SystemUI/res-keyguard/values/config.xml @@ -27,6 +27,6 @@ <bool name="can_use_one_handed_bouncer">false</bool> <!-- Will display the bouncer on one side of the display, and the current user icon and user switcher on the other side --> - <bool name="bouncer_display_user_switcher">false</bool> + <bool name="config_enableBouncerUserSwitcher">false</bool> </resources> diff --git a/packages/SystemUI/res-keyguard/values/dimens.xml b/packages/SystemUI/res-keyguard/values/dimens.xml index c8bb8e99be17..cbf4f83daeb5 100644 --- a/packages/SystemUI/res-keyguard/values/dimens.xml +++ b/packages/SystemUI/res-keyguard/values/dimens.xml @@ -37,7 +37,6 @@ <!-- Margin around the various security views --> <dimen name="keyguard_security_view_top_margin">8dp</dimen> - <dimen name="keyguard_security_view_lateral_margin">20dp</dimen> <dimen name="keyguard_eca_top_margin">18dp</dimen> <dimen name="keyguard_eca_bottom_margin">12dp</dimen> diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index b5ea498f185d..3fab72441c89 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 2fb2211150ec..49a802235619 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<Keyguard private final FalsingManager mFalsingManager; private final UserSwitcherController mUserSwitcherController; private final GlobalSettings mGlobalSettings; + private final FeatureFlags mFeatureFlags; private int mLastOrientation = Configuration.ORIENTATION_UNDEFINED; @@ -238,6 +241,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard FalsingCollector falsingCollector, FalsingManager falsingManager, UserSwitcherController userSwitcherController, + FeatureFlags featureFlags, GlobalSettings globalSettings) { super(view); mLockPatternUtils = lockPatternUtils; @@ -255,6 +259,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard mFalsingCollector = falsingCollector; mFalsingManager = falsingManager; mUserSwitcherController = userSwitcherController; + mFeatureFlags = featureFlags; mGlobalSettings = globalSettings; } @@ -510,7 +515,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard } private boolean canDisplayUserSwitcher() { - return getResources().getBoolean(R.bool.bouncer_display_user_switcher); + return mFeatureFlags.isEnabled(Flags.BOUNCER_USER_SWITCHER); } private void configureMode() { @@ -615,6 +620,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard private final FalsingCollector mFalsingCollector; private final FalsingManager mFalsingManager; private final GlobalSettings mGlobalSettings; + private final FeatureFlags mFeatureFlags; private final UserSwitcherController mUserSwitcherController; @Inject @@ -632,6 +638,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard FalsingCollector falsingCollector, FalsingManager falsingManager, UserSwitcherController userSwitcherController, + FeatureFlags featureFlags, GlobalSettings globalSettings) { mView = view; mAdminSecondaryLockScreenControllerFactory = adminSecondaryLockScreenControllerFactory; @@ -645,6 +652,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard mConfigurationController = configurationController; mFalsingCollector = falsingCollector; mFalsingManager = falsingManager; + mFeatureFlags = featureFlags; mGlobalSettings = globalSettings; mUserSwitcherController = userSwitcherController; } @@ -656,8 +664,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard mKeyguardUpdateMonitor, mKeyguardSecurityModel, mMetricsLogger, mUiEventLogger, mKeyguardStateController, securityCallback, mSecurityViewFlipperController, mConfigurationController, mFalsingCollector, mFalsingManager, - mUserSwitcherController, mGlobalSettings); + mUserSwitcherController, mFeatureFlags, mGlobalSettings); } - } } diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.java b/packages/SystemUI/src/com/android/systemui/flags/Flags.java index 726f8656767c..6580b189da07 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.java +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.java @@ -57,8 +57,10 @@ public class Flags { /***************************************/ // 200 - keyguard/lockscreen - public static final BooleanFlag KEYGUARD_LAYOUT = - new BooleanFlag(200, true); + + // ** Flag retired ** + // public static final BooleanFlag KEYGUARD_LAYOUT = + // new BooleanFlag(200, true); public static final BooleanFlag LOCKSCREEN_ANIMATIONS = new BooleanFlag(201, true); @@ -69,6 +71,9 @@ public class Flags { public static final ResourceBooleanFlag CHARGING_RIPPLE = new ResourceBooleanFlag(203, R.bool.flag_charging_ripple); + public static final ResourceBooleanFlag BOUNCER_USER_SWITCHER = + new ResourceBooleanFlag(204, R.bool.config_enableBouncerUserSwitcher); + /***************************************/ // 300 - power menu public static final BooleanFlag POWER_MENU_LITE = diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java index c873804bc82c..599e5474c564 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java @@ -48,6 +48,7 @@ import com.android.keyguard.KeyguardSecurityModel.SecurityMode; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.classifier.FalsingCollector; +import com.android.systemui.flags.FeatureFlags; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.KeyguardStateController; @@ -116,6 +117,8 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase { @Mock private GlobalSettings mGlobalSettings; @Mock + private FeatureFlags mFeatureFlags; + @Mock private UserSwitcherController mUserSwitcherController; private Configuration mConfiguration; @@ -151,7 +154,7 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase { mKeyguardUpdateMonitor, mKeyguardSecurityModel, mMetricsLogger, mUiEventLogger, mKeyguardStateController, mKeyguardSecurityViewFlipperController, mConfigurationController, mFalsingCollector, mFalsingManager, - mUserSwitcherController, mGlobalSettings).create(mSecurityCallback); + mUserSwitcherController, mFeatureFlags, mGlobalSettings).create(mSecurityCallback); } @Test |