Loading packages/SystemUI/res-keyguard/layout/keyguard_password_motion_layout.xml 0 → 100644 +129 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ** ** Copyright 2023, 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. */ --> <!-- This file is needed when flag lockscreen.enable_landscape is on Required for landscape lockscreen on small screens. --> <com.android.keyguard.KeyguardPasswordView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/res-auto" android:id="@+id/keyguard_password_view" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" androidprv:layout_maxWidth="@dimen/keyguard_security_width" android:layout_gravity="center_horizontal|bottom" android:gravity="bottom"> <!-- Layout here is visually identical to the previous keyguard_password_view. I.E., 'constraints here effectively the same as the previous linear layout' --> <androidx.constraintlayout.motion.widget.MotionLayout android:id="@+id/password_container" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:clipChildren="false" android:clipToPadding="false" android:layoutDirection="ltr" android:orientation="vertical" androidprv:layoutDescription="@xml/keyguard_password_scene"> <!-- Guideline need to align password right of centre, when on small screen landscape layout --> <androidx.constraintlayout.widget.Guideline android:id="@+id/password_center_guideline" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" androidprv:layout_constraintGuide_percent="0.5" /> <LinearLayout android:id="@+id/keyguard_bouncer_message_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:clipChildren="false" android:clipToPadding="false" android:layoutDirection="ltr" android:orientation="vertical" androidprv:layout_constraintTop_toTopOf="parent"> <include layout="@layout/keyguard_bouncer_message_area" /> <com.android.systemui.bouncer.ui.BouncerMessageView android:id="@+id/bouncer_message_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" /> </LinearLayout> <FrameLayout android:id="@+id/passwordEntry_container" android:layout_width="280dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:theme="?attr/passwordStyle" androidprv:layout_constraintBottom_toTopOf="@+id/keyguard_selector_fade_container" androidprv:layout_constraintEnd_toEndOf="parent" androidprv:layout_constraintHorizontal_bias="0.5" androidprv:layout_constraintStart_toStartOf="parent" androidprv:layout_constraintTop_toBottomOf="@+id/keyguard_bouncer_message_container" androidprv:layout_constraintVertical_bias="0.7777"> <EditText android:id="@+id/passwordEntry" android:layout_width="match_parent" android:layout_height="wrap_content" android:contentDescription="@string/keyguard_accessibility_password" android:gravity="center_horizontal" android:imeOptions="flagForceAscii|actionDone" android:inputType="textPassword" android:maxLength="500" android:singleLine="true" android:textAppearance="?android:attr/textAppearanceMedium" android:textCursorDrawable="@null" android:textSize="16sp" android:textStyle="normal" /> <ImageView android:id="@+id/switch_ime_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end|center_vertical" android:layout_marginBottom="12dp" android:background="?android:attr/selectableItemBackground" android:clickable="true" android:contentDescription="@string/accessibility_ime_switch_button" android:padding="8dip" android:src="@drawable/ic_lockscreen_ime" android:tint="?android:attr/textColorPrimary" android:visibility="gone" /> </FrameLayout> <include android:id="@+id/keyguard_selector_fade_container" layout="@layout/keyguard_eca" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="12dp" android:orientation="vertical" androidprv:layout_constraintBottom_toBottomOf="parent" /> </androidx.constraintlayout.motion.widget.MotionLayout> </com.android.keyguard.KeyguardPasswordView> No newline at end of file packages/SystemUI/res-keyguard/xml/keyguard_password_scene.xml 0 → 100644 +49 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <MotionScene xmlns:android="http://schemas.android.com/apk/res/android" xmlns:motion="http://schemas.android.com/apk/res-auto" xmlns:androidprv="http://schemas.android.com/apk/res-auto"> <Transition motion:constraintSetStart="@id/single_constraints" motion:constraintSetEnd="@+id/split_constraints" motion:duration="0" motion:autoTransition="none" /> <!-- No changes to default layout --> <ConstraintSet android:id="@+id/single_constraints" /> <ConstraintSet android:id="@+id/split_constraints"> <Constraint android:id="@+id/keyguard_bouncer_message_container" android:layout_width="0dp" android:layout_height="wrap_content" androidprv:layout_constraintEnd_toStartOf="@+id/password_center_guideline" androidprv:layout_constraintStart_toStartOf="parent" androidprv:layout_constraintTop_toTopOf="parent" androidprv:layout_constraintBottom_toTopOf="@+id/keyguard_selector_fade_container" androidprv:layout_constraintVertical_chainStyle="spread_inside" /> <Constraint android:id="@+id/passwordEntry_container" android:layout_width="280dp" android:layout_height="wrap_content" androidprv:layout_constraintVertical_bias="0.5" androidprv:layout_constraintHorizontal_bias="0.5" androidprv:layout_constraintEnd_toEndOf="parent" androidprv:layout_constraintStart_toStartOf="@+id/password_center_guideline" androidprv:layout_constraintBottom_toBottomOf="parent" androidprv:layout_constraintTop_toTopOf="parent"/> <Constraint android:id="@+id/keyguard_selector_fade_container" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="@dimen/keyguard_eca_top_margin" android:layout_marginBottom="@dimen/keyguard_eca_bottom_margin" androidprv:layout_constraintBottom_toBottomOf="parent" androidprv:layout_constraintEnd_toStartOf="@+id/password_center_guideline" androidprv:layout_constraintStart_toStartOf="parent" androidprv:layout_constraintTop_toBottomOf="@+id/keyguard_bouncer_message_container" /> </ConstraintSet> </MotionScene> No newline at end of file packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java +1 −1 Original line number Diff line number Diff line Loading @@ -257,7 +257,7 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView> keyguardSecurityCallback, mMessageAreaControllerFactory, mLatencyTracker, mInputMethodManager, emergencyButtonController, mMainExecutor, mResources, mFalsingCollector, mKeyguardViewController, mFeatureFlags); mDevicePostureController, mFeatureFlags); } else if (keyguardInputView instanceof KeyguardPINView) { ((KeyguardPINView) keyguardInputView).setIsLockScreenLandscapeEnabled( mFeatureFlags.isEnabled(LOCKSCREEN_ENABLE_LANDSCAPE)); Loading packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java +61 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.keyguard; import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; import static android.view.WindowInsets.Type.ime; import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_DEVICE_ADMIN; Loading @@ -27,6 +28,8 @@ import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_RESTART_FO import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_TIMEOUT; import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_TRUSTAGENT_EXPIRED; import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_USER_REQUEST; import static com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POSTURE_CLOSED; import static com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POSTURE_UNKNOWN; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; Loading @@ -46,12 +49,16 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.constraintlayout.motion.widget.MotionLayout; import com.android.app.animation.Interpolators; import com.android.internal.widget.LockscreenCredential; import com.android.internal.widget.TextViewInputDisabler; import com.android.systemui.DejankUtils; import com.android.systemui.R; import com.android.systemui.statusbar.policy.DevicePostureController; /** * Displays an alphanumeric (latin-1) key entry for the user to enter * an unlock password Loading @@ -68,10 +75,14 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView { private TextView mPasswordEntry; private TextViewInputDisabler mPasswordEntryDisabler; private Interpolator mLinearOutSlowInInterpolator; private Interpolator mFastOutLinearInInterpolator; private DisappearAnimationListener mDisappearAnimationListener; @Nullable private MotionLayout mContainerMotionLayout; private boolean mAlreadyUsingSplitBouncer = false; private boolean mIsLockScreenLandscapeEnabled = false; @DevicePostureController.DevicePostureInt private int mLastDevicePosture = DEVICE_POSTURE_UNKNOWN; private static final int[] DISABLE_STATE_SET = {-android.R.attr.state_enabled}; private static final int[] ENABLE_STATE_SET = {android.R.attr.state_enabled}; Loading @@ -89,6 +100,21 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView { context, android.R.interpolator.fast_out_linear_in); } /** * Use motion layout (new bouncer implementation) if LOCKSCREEN_ENABLE_LANDSCAPE flag is * enabled */ public void setIsLockScreenLandscapeEnabled() { mIsLockScreenLandscapeEnabled = true; findContainerLayout(); } private void findContainerLayout() { if (mIsLockScreenLandscapeEnabled) { mContainerMotionLayout = findViewById(R.id.password_container); } } @Override protected void resetState() { } Loading Loading @@ -124,6 +150,40 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView { } } void onDevicePostureChanged(@DevicePostureController.DevicePostureInt int posture) { if (mLastDevicePosture == posture) return; mLastDevicePosture = posture; if (mIsLockScreenLandscapeEnabled) { boolean useSplitBouncerAfterFold = mLastDevicePosture == DEVICE_POSTURE_CLOSED && getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE; if (mAlreadyUsingSplitBouncer != useSplitBouncerAfterFold) { updateConstraints(useSplitBouncerAfterFold); } } } @Override protected void updateConstraints(boolean useSplitBouncer) { mAlreadyUsingSplitBouncer = useSplitBouncer; KeyguardSecurityViewFlipper.LayoutParams params = (KeyguardSecurityViewFlipper.LayoutParams) getLayoutParams(); if (useSplitBouncer) { if (mContainerMotionLayout == null) return; mContainerMotionLayout.jumpToState(R.id.split_constraints); params.maxWidth = Integer.MAX_VALUE; } else { mContainerMotionLayout.jumpToState(R.id.single_constraints); params.maxWidth = getResources() .getDimensionPixelSize(R.dimen.keyguard_security_width); } setLayoutParams(params); } @Override protected void onFinishInflate() { Loading packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java +15 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.keyguard; import static com.android.systemui.flags.Flags.LOCKSCREEN_ENABLE_LANDSCAPE; import android.content.res.Resources; import android.os.UserHandle; import android.text.Editable; Loading @@ -41,6 +43,7 @@ import com.android.systemui.R; import com.android.systemui.classifier.FalsingCollector; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.statusbar.policy.DevicePostureController; import com.android.systemui.util.concurrency.DelayableExecutor; import java.util.List; Loading @@ -49,8 +52,10 @@ public class KeyguardPasswordViewController extends KeyguardAbsKeyInputViewController<KeyguardPasswordView> { private static final int DELAY_MILLIS_TO_REEVALUATE_IME_SWITCH_ICON = 500; // 500ms private final KeyguardSecurityCallback mKeyguardSecurityCallback; private final DevicePostureController mPostureController; private final DevicePostureController.Callback mPostureCallback = posture -> mView.onDevicePostureChanged(posture); private final InputMethodManager mInputMethodManager; private final DelayableExecutor mMainExecutor; private final KeyguardViewController mKeyguardViewController; Loading Loading @@ -106,14 +111,19 @@ public class KeyguardPasswordViewController @Main Resources resources, FalsingCollector falsingCollector, KeyguardViewController keyguardViewController, DevicePostureController postureController, FeatureFlags featureFlags) { super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback, messageAreaControllerFactory, latencyTracker, falsingCollector, emergencyButtonController, featureFlags); mKeyguardSecurityCallback = keyguardSecurityCallback; mInputMethodManager = inputMethodManager; mPostureController = postureController; mMainExecutor = mainExecutor; mKeyguardViewController = keyguardViewController; if (featureFlags.isEnabled(LOCKSCREEN_ENABLE_LANDSCAPE)) { view.setIsLockScreenLandscapeEnabled(); } mShowImeAtScreenOn = resources.getBoolean(R.bool.kg_show_ime_at_screen_on); mPasswordEntry = mView.findViewById(mView.getPasswordTextViewId()); mSwitchImeButton = mView.findViewById(R.id.switch_ime_button); Loading @@ -127,6 +137,9 @@ public class KeyguardPasswordViewController mPasswordEntry.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); mView.onDevicePostureChanged(mPostureController.getDevicePosture()); mPostureController.addCallback(mPostureCallback); // Set selected property on so the view can send accessibility events. mPasswordEntry.setSelected(true); mPasswordEntry.setOnEditorActionListener(mOnEditorActionListener); Loading Loading @@ -164,6 +177,7 @@ public class KeyguardPasswordViewController protected void onViewDetached() { super.onViewDetached(); mPasswordEntry.setOnEditorActionListener(null); mPostureController.removeCallback(mPostureCallback); } @Override Loading Loading
packages/SystemUI/res-keyguard/layout/keyguard_password_motion_layout.xml 0 → 100644 +129 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ** ** Copyright 2023, 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. */ --> <!-- This file is needed when flag lockscreen.enable_landscape is on Required for landscape lockscreen on small screens. --> <com.android.keyguard.KeyguardPasswordView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/res-auto" android:id="@+id/keyguard_password_view" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" androidprv:layout_maxWidth="@dimen/keyguard_security_width" android:layout_gravity="center_horizontal|bottom" android:gravity="bottom"> <!-- Layout here is visually identical to the previous keyguard_password_view. I.E., 'constraints here effectively the same as the previous linear layout' --> <androidx.constraintlayout.motion.widget.MotionLayout android:id="@+id/password_container" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:clipChildren="false" android:clipToPadding="false" android:layoutDirection="ltr" android:orientation="vertical" androidprv:layoutDescription="@xml/keyguard_password_scene"> <!-- Guideline need to align password right of centre, when on small screen landscape layout --> <androidx.constraintlayout.widget.Guideline android:id="@+id/password_center_guideline" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" androidprv:layout_constraintGuide_percent="0.5" /> <LinearLayout android:id="@+id/keyguard_bouncer_message_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:clipChildren="false" android:clipToPadding="false" android:layoutDirection="ltr" android:orientation="vertical" androidprv:layout_constraintTop_toTopOf="parent"> <include layout="@layout/keyguard_bouncer_message_area" /> <com.android.systemui.bouncer.ui.BouncerMessageView android:id="@+id/bouncer_message_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" /> </LinearLayout> <FrameLayout android:id="@+id/passwordEntry_container" android:layout_width="280dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:theme="?attr/passwordStyle" androidprv:layout_constraintBottom_toTopOf="@+id/keyguard_selector_fade_container" androidprv:layout_constraintEnd_toEndOf="parent" androidprv:layout_constraintHorizontal_bias="0.5" androidprv:layout_constraintStart_toStartOf="parent" androidprv:layout_constraintTop_toBottomOf="@+id/keyguard_bouncer_message_container" androidprv:layout_constraintVertical_bias="0.7777"> <EditText android:id="@+id/passwordEntry" android:layout_width="match_parent" android:layout_height="wrap_content" android:contentDescription="@string/keyguard_accessibility_password" android:gravity="center_horizontal" android:imeOptions="flagForceAscii|actionDone" android:inputType="textPassword" android:maxLength="500" android:singleLine="true" android:textAppearance="?android:attr/textAppearanceMedium" android:textCursorDrawable="@null" android:textSize="16sp" android:textStyle="normal" /> <ImageView android:id="@+id/switch_ime_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end|center_vertical" android:layout_marginBottom="12dp" android:background="?android:attr/selectableItemBackground" android:clickable="true" android:contentDescription="@string/accessibility_ime_switch_button" android:padding="8dip" android:src="@drawable/ic_lockscreen_ime" android:tint="?android:attr/textColorPrimary" android:visibility="gone" /> </FrameLayout> <include android:id="@+id/keyguard_selector_fade_container" layout="@layout/keyguard_eca" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="12dp" android:orientation="vertical" androidprv:layout_constraintBottom_toBottomOf="parent" /> </androidx.constraintlayout.motion.widget.MotionLayout> </com.android.keyguard.KeyguardPasswordView> No newline at end of file
packages/SystemUI/res-keyguard/xml/keyguard_password_scene.xml 0 → 100644 +49 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <MotionScene xmlns:android="http://schemas.android.com/apk/res/android" xmlns:motion="http://schemas.android.com/apk/res-auto" xmlns:androidprv="http://schemas.android.com/apk/res-auto"> <Transition motion:constraintSetStart="@id/single_constraints" motion:constraintSetEnd="@+id/split_constraints" motion:duration="0" motion:autoTransition="none" /> <!-- No changes to default layout --> <ConstraintSet android:id="@+id/single_constraints" /> <ConstraintSet android:id="@+id/split_constraints"> <Constraint android:id="@+id/keyguard_bouncer_message_container" android:layout_width="0dp" android:layout_height="wrap_content" androidprv:layout_constraintEnd_toStartOf="@+id/password_center_guideline" androidprv:layout_constraintStart_toStartOf="parent" androidprv:layout_constraintTop_toTopOf="parent" androidprv:layout_constraintBottom_toTopOf="@+id/keyguard_selector_fade_container" androidprv:layout_constraintVertical_chainStyle="spread_inside" /> <Constraint android:id="@+id/passwordEntry_container" android:layout_width="280dp" android:layout_height="wrap_content" androidprv:layout_constraintVertical_bias="0.5" androidprv:layout_constraintHorizontal_bias="0.5" androidprv:layout_constraintEnd_toEndOf="parent" androidprv:layout_constraintStart_toStartOf="@+id/password_center_guideline" androidprv:layout_constraintBottom_toBottomOf="parent" androidprv:layout_constraintTop_toTopOf="parent"/> <Constraint android:id="@+id/keyguard_selector_fade_container" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="@dimen/keyguard_eca_top_margin" android:layout_marginBottom="@dimen/keyguard_eca_bottom_margin" androidprv:layout_constraintBottom_toBottomOf="parent" androidprv:layout_constraintEnd_toStartOf="@+id/password_center_guideline" androidprv:layout_constraintStart_toStartOf="parent" androidprv:layout_constraintTop_toBottomOf="@+id/keyguard_bouncer_message_container" /> </ConstraintSet> </MotionScene> No newline at end of file
packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java +1 −1 Original line number Diff line number Diff line Loading @@ -257,7 +257,7 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView> keyguardSecurityCallback, mMessageAreaControllerFactory, mLatencyTracker, mInputMethodManager, emergencyButtonController, mMainExecutor, mResources, mFalsingCollector, mKeyguardViewController, mFeatureFlags); mDevicePostureController, mFeatureFlags); } else if (keyguardInputView instanceof KeyguardPINView) { ((KeyguardPINView) keyguardInputView).setIsLockScreenLandscapeEnabled( mFeatureFlags.isEnabled(LOCKSCREEN_ENABLE_LANDSCAPE)); Loading
packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java +61 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.keyguard; import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; import static android.view.WindowInsets.Type.ime; import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_DEVICE_ADMIN; Loading @@ -27,6 +28,8 @@ import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_RESTART_FO import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_TIMEOUT; import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_TRUSTAGENT_EXPIRED; import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_USER_REQUEST; import static com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POSTURE_CLOSED; import static com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POSTURE_UNKNOWN; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; Loading @@ -46,12 +49,16 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.constraintlayout.motion.widget.MotionLayout; import com.android.app.animation.Interpolators; import com.android.internal.widget.LockscreenCredential; import com.android.internal.widget.TextViewInputDisabler; import com.android.systemui.DejankUtils; import com.android.systemui.R; import com.android.systemui.statusbar.policy.DevicePostureController; /** * Displays an alphanumeric (latin-1) key entry for the user to enter * an unlock password Loading @@ -68,10 +75,14 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView { private TextView mPasswordEntry; private TextViewInputDisabler mPasswordEntryDisabler; private Interpolator mLinearOutSlowInInterpolator; private Interpolator mFastOutLinearInInterpolator; private DisappearAnimationListener mDisappearAnimationListener; @Nullable private MotionLayout mContainerMotionLayout; private boolean mAlreadyUsingSplitBouncer = false; private boolean mIsLockScreenLandscapeEnabled = false; @DevicePostureController.DevicePostureInt private int mLastDevicePosture = DEVICE_POSTURE_UNKNOWN; private static final int[] DISABLE_STATE_SET = {-android.R.attr.state_enabled}; private static final int[] ENABLE_STATE_SET = {android.R.attr.state_enabled}; Loading @@ -89,6 +100,21 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView { context, android.R.interpolator.fast_out_linear_in); } /** * Use motion layout (new bouncer implementation) if LOCKSCREEN_ENABLE_LANDSCAPE flag is * enabled */ public void setIsLockScreenLandscapeEnabled() { mIsLockScreenLandscapeEnabled = true; findContainerLayout(); } private void findContainerLayout() { if (mIsLockScreenLandscapeEnabled) { mContainerMotionLayout = findViewById(R.id.password_container); } } @Override protected void resetState() { } Loading Loading @@ -124,6 +150,40 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView { } } void onDevicePostureChanged(@DevicePostureController.DevicePostureInt int posture) { if (mLastDevicePosture == posture) return; mLastDevicePosture = posture; if (mIsLockScreenLandscapeEnabled) { boolean useSplitBouncerAfterFold = mLastDevicePosture == DEVICE_POSTURE_CLOSED && getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE; if (mAlreadyUsingSplitBouncer != useSplitBouncerAfterFold) { updateConstraints(useSplitBouncerAfterFold); } } } @Override protected void updateConstraints(boolean useSplitBouncer) { mAlreadyUsingSplitBouncer = useSplitBouncer; KeyguardSecurityViewFlipper.LayoutParams params = (KeyguardSecurityViewFlipper.LayoutParams) getLayoutParams(); if (useSplitBouncer) { if (mContainerMotionLayout == null) return; mContainerMotionLayout.jumpToState(R.id.split_constraints); params.maxWidth = Integer.MAX_VALUE; } else { mContainerMotionLayout.jumpToState(R.id.single_constraints); params.maxWidth = getResources() .getDimensionPixelSize(R.dimen.keyguard_security_width); } setLayoutParams(params); } @Override protected void onFinishInflate() { Loading
packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java +15 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.keyguard; import static com.android.systemui.flags.Flags.LOCKSCREEN_ENABLE_LANDSCAPE; import android.content.res.Resources; import android.os.UserHandle; import android.text.Editable; Loading @@ -41,6 +43,7 @@ import com.android.systemui.R; import com.android.systemui.classifier.FalsingCollector; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.statusbar.policy.DevicePostureController; import com.android.systemui.util.concurrency.DelayableExecutor; import java.util.List; Loading @@ -49,8 +52,10 @@ public class KeyguardPasswordViewController extends KeyguardAbsKeyInputViewController<KeyguardPasswordView> { private static final int DELAY_MILLIS_TO_REEVALUATE_IME_SWITCH_ICON = 500; // 500ms private final KeyguardSecurityCallback mKeyguardSecurityCallback; private final DevicePostureController mPostureController; private final DevicePostureController.Callback mPostureCallback = posture -> mView.onDevicePostureChanged(posture); private final InputMethodManager mInputMethodManager; private final DelayableExecutor mMainExecutor; private final KeyguardViewController mKeyguardViewController; Loading Loading @@ -106,14 +111,19 @@ public class KeyguardPasswordViewController @Main Resources resources, FalsingCollector falsingCollector, KeyguardViewController keyguardViewController, DevicePostureController postureController, FeatureFlags featureFlags) { super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback, messageAreaControllerFactory, latencyTracker, falsingCollector, emergencyButtonController, featureFlags); mKeyguardSecurityCallback = keyguardSecurityCallback; mInputMethodManager = inputMethodManager; mPostureController = postureController; mMainExecutor = mainExecutor; mKeyguardViewController = keyguardViewController; if (featureFlags.isEnabled(LOCKSCREEN_ENABLE_LANDSCAPE)) { view.setIsLockScreenLandscapeEnabled(); } mShowImeAtScreenOn = resources.getBoolean(R.bool.kg_show_ime_at_screen_on); mPasswordEntry = mView.findViewById(mView.getPasswordTextViewId()); mSwitchImeButton = mView.findViewById(R.id.switch_ime_button); Loading @@ -127,6 +137,9 @@ public class KeyguardPasswordViewController mPasswordEntry.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); mView.onDevicePostureChanged(mPostureController.getDevicePosture()); mPostureController.addCallback(mPostureCallback); // Set selected property on so the view can send accessibility events. mPasswordEntry.setSelected(true); mPasswordEntry.setOnEditorActionListener(mOnEditorActionListener); Loading Loading @@ -164,6 +177,7 @@ public class KeyguardPasswordViewController protected void onViewDetached() { super.onViewDetached(); mPasswordEntry.setOnEditorActionListener(null); mPostureController.removeCallback(mPostureCallback); } @Override Loading