Merge "[Bouncer] Separate keyguard message areas." into tm-qpr-dev

This commit is contained in:
Aaron Liu
2022-09-09 16:21:54 +00:00
committed by Android (Google) Code Review
33 changed files with 261 additions and 142 deletions

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 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
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.keyguard.BouncerKeyguardMessageArea
android:id="@+id/bouncer_message_area"
style="@style/Keyguard.TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/keyguard_lock_padding"
android:ellipsize="marquee"
android:focusable="true"
android:gravity="center"
android:singleLine="true" />
</merge>

View File

@@ -28,6 +28,7 @@
android:layout_gravity="center_horizontal|bottom" android:layout_gravity="center_horizontal|bottom"
android:gravity="bottom" android:gravity="bottom"
> >
<include layout="@layout/keyguard_bouncer_message_area"/>
<Space <Space
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -31,6 +31,7 @@
android:layout_gravity="center_horizontal|bottom" android:layout_gravity="center_horizontal|bottom"
android:clipChildren="false" android:clipChildren="false"
android:clipToPadding="false"> android:clipToPadding="false">
<include layout="@layout/keyguard_bouncer_message_area"/>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/pattern_container" android:id="@+id/pattern_container"

View File

@@ -27,6 +27,7 @@
android:clipToPadding="false" android:clipToPadding="false"
android:orientation="vertical" android:orientation="vertical"
androidprv:layout_maxWidth="@dimen/keyguard_security_width"> androidprv:layout_maxWidth="@dimen/keyguard_security_width">
<include layout="@layout/keyguard_bouncer_message_area"/>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/pin_container" android:id="@+id/pin_container"
@@ -189,8 +190,6 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<include layout="@layout/keyguard_eca" <include layout="@layout/keyguard_eca"
android:id="@+id/keyguard_selector_fade_container" android:id="@+id/keyguard_selector_fade_container"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -26,20 +26,17 @@
android:layout_height="match_parent" android:layout_height="match_parent"
androidprv:layout_maxWidth="@dimen/keyguard_security_width" androidprv:layout_maxWidth="@dimen/keyguard_security_width"
android:layout_gravity="center_horizontal|bottom"> android:layout_gravity="center_horizontal|bottom">
<include layout="@layout/keyguard_bouncer_message_area" />
<Space <Space
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1" />
/>
<ImageView <ImageView
android:id="@+id/keyguard_sim" android:id="@+id/keyguard_sim"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:tint="@color/background_protected" android:tint="@color/background_protected"
android:src="@drawable/ic_lockscreen_sim"/> android:src="@drawable/ic_lockscreen_sim"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -52,14 +49,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/eca_overlap" /> android:layout_marginTop="@dimen/eca_overlap" />
<RelativeLayout <RelativeLayout
android:id="@+id/row0" android:id="@+id/row0"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="4dp" android:paddingBottom="4dp"
> >
<com.android.keyguard.PasswordTextView <com.android.keyguard.PasswordTextView
android:id="@+id/simPinEntry" android:id="@+id/simPinEntry"
style="@style/Widget.TextView.Password" style="@style/Widget.TextView.Password"
@@ -195,7 +190,6 @@
/> />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<include layout="@layout/keyguard_eca" <include layout="@layout/keyguard_eca"
android:id="@+id/keyguard_selector_fade_container" android:id="@+id/keyguard_selector_fade_container"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -205,5 +199,4 @@
android:layout_marginTop="@dimen/keyguard_eca_top_margin" android:layout_marginTop="@dimen/keyguard_eca_top_margin"
android:layout_marginBottom="2dp" android:layout_marginBottom="2dp"
android:gravity="center_horizontal"/> android:gravity="center_horizontal"/>
</com.android.keyguard.KeyguardSimPinView> </com.android.keyguard.KeyguardSimPinView>

View File

@@ -27,12 +27,12 @@
android:layout_height="match_parent" android:layout_height="match_parent"
androidprv:layout_maxWidth="@dimen/keyguard_security_width" androidprv:layout_maxWidth="@dimen/keyguard_security_width"
android:layout_gravity="center_horizontal|bottom"> android:layout_gravity="center_horizontal|bottom">
<include layout="@layout/keyguard_bouncer_message_area"/>
<Space <Space
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1" />
/>
<ImageView <ImageView
android:id="@+id/keyguard_sim" android:id="@+id/keyguard_sim"

View File

@@ -88,7 +88,7 @@
android:layout_marginTop="@dimen/status_bar_height" android:layout_marginTop="@dimen/status_bar_height"
android:layout_gravity="top|center_horizontal" android:layout_gravity="top|center_horizontal"
android:gravity="center_horizontal"> android:gravity="center_horizontal">
<com.android.keyguard.KeyguardMessageArea <com.android.keyguard.AuthKeyguardMessageArea
android:id="@+id/keyguard_message_area" android:id="@+id/keyguard_message_area"
style="@style/Keyguard.TextView" style="@style/Keyguard.TextView"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@@ -23,7 +23,7 @@
<dimen name="status_view_margin_horizontal">124dp</dimen> <dimen name="status_view_margin_horizontal">124dp</dimen>
<dimen name="keyguard_clock_top_margin">80dp</dimen> <dimen name="keyguard_clock_top_margin">80dp</dimen>
<dimen name="keyguard_status_view_bottom_margin">80dp</dimen> <dimen name="keyguard_status_view_bottom_margin">80dp</dimen>
<dimen name="bouncer_user_switcher_y_trans">90dp</dimen> <dimen name="bouncer_user_switcher_y_trans">200dp</dimen>
<dimen name="large_screen_shade_header_left_padding">24dp</dimen> <dimen name="large_screen_shade_header_left_padding">24dp</dimen>
<dimen name="qqs_layout_padding_bottom">40dp</dimen> <dimen name="qqs_layout_padding_bottom">40dp</dimen>

View File

@@ -0,0 +1,33 @@
/*
* Copyright (C) 2022 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
*/
package com.android.keyguard
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
import android.util.AttributeSet
/**
* Displays security messages for auth outside of the security method (pin, password, pattern), like
* biometric auth.
*/
class AuthKeyguardMessageArea(context: Context?, attrs: AttributeSet?) :
KeyguardMessageArea(context, attrs) {
override fun updateTextColor() {
setTextColor(ColorStateList.valueOf(Color.WHITE))
}
}

View File

@@ -0,0 +1,61 @@
/*
* Copyright (C) 2022 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
*/
package com.android.keyguard
import android.content.Context
import android.content.res.ColorStateList
import android.content.res.TypedArray
import android.graphics.Color
import android.util.AttributeSet
import com.android.settingslib.Utils
/** Displays security messages for the keyguard bouncer. */
class BouncerKeyguardMessageArea(context: Context?, attrs: AttributeSet?) :
KeyguardMessageArea(context, attrs) {
private val DEFAULT_COLOR = -1
private var mDefaultColorState: ColorStateList? = null
private var mNextMessageColorState: ColorStateList? = ColorStateList.valueOf(DEFAULT_COLOR)
override fun updateTextColor() {
var colorState = mDefaultColorState
mNextMessageColorState?.defaultColor?.let { color ->
if (color != DEFAULT_COLOR) {
colorState = mNextMessageColorState
mNextMessageColorState = ColorStateList.valueOf(DEFAULT_COLOR)
}
}
setTextColor(colorState)
}
override fun setNextMessageColor(colorState: ColorStateList?) {
mNextMessageColorState = colorState
}
override fun onThemeChanged() {
val array: TypedArray =
mContext.obtainStyledAttributes(intArrayOf(android.R.attr.textColorPrimary))
val newTextColors: ColorStateList = ColorStateList.valueOf(array.getColor(0, Color.RED))
array.recycle()
mDefaultColorState = newTextColors
super.onThemeChanged()
}
override fun reloadColor() {
mDefaultColorState = Utils.getColorAttr(context, android.R.attr.textColorPrimary)
super.reloadColor()
}
}

View File

@@ -50,7 +50,6 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
private final FalsingCollector mFalsingCollector; private final FalsingCollector mFalsingCollector;
private final EmergencyButtonController mEmergencyButtonController; private final EmergencyButtonController mEmergencyButtonController;
private CountDownTimer mCountdownTimer; private CountDownTimer mCountdownTimer;
protected KeyguardMessageAreaController mMessageAreaController;
private boolean mDismissing; private boolean mDismissing;
protected AsyncTask<?, ?, ?> mPendingLockCheck; protected AsyncTask<?, ?, ?> mPendingLockCheck;
protected boolean mResumed; protected boolean mResumed;
@@ -80,14 +79,13 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
KeyguardMessageAreaController.Factory messageAreaControllerFactory, KeyguardMessageAreaController.Factory messageAreaControllerFactory,
LatencyTracker latencyTracker, FalsingCollector falsingCollector, LatencyTracker latencyTracker, FalsingCollector falsingCollector,
EmergencyButtonController emergencyButtonController) { EmergencyButtonController emergencyButtonController) {
super(view, securityMode, keyguardSecurityCallback, emergencyButtonController); super(view, securityMode, keyguardSecurityCallback, emergencyButtonController,
messageAreaControllerFactory);
mKeyguardUpdateMonitor = keyguardUpdateMonitor; mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mLockPatternUtils = lockPatternUtils; mLockPatternUtils = lockPatternUtils;
mLatencyTracker = latencyTracker; mLatencyTracker = latencyTracker;
mFalsingCollector = falsingCollector; mFalsingCollector = falsingCollector;
mEmergencyButtonController = emergencyButtonController; mEmergencyButtonController = emergencyButtonController;
KeyguardMessageArea kma = KeyguardMessageArea.findSecurityMessageDisplay(mView);
mMessageAreaController = messageAreaControllerFactory.create(kma);
} }
abstract void resetState(); abstract void resetState();
@@ -95,7 +93,6 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
@Override @Override
public void onInit() { public void onInit() {
super.onInit(); super.onInit();
mMessageAreaController.init();
} }
@Override @Override
@@ -134,6 +131,10 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
@Override @Override
public void showMessage(CharSequence message, ColorStateList colorState) { public void showMessage(CharSequence message, ColorStateList colorState) {
if (mMessageAreaController == null) {
return;
}
if (colorState != null) { if (colorState != null) {
mMessageAreaController.setNextMessageColor(colorState); mMessageAreaController.setNextMessageColor(colorState);
} }

View File

@@ -17,9 +17,11 @@
package com.android.keyguard; package com.android.keyguard;
import android.annotation.CallSuper; import android.annotation.CallSuper;
import android.annotation.Nullable;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.content.res.Resources; import android.content.res.Resources;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import com.android.internal.util.LatencyTracker; import com.android.internal.util.LatencyTracker;
@@ -44,6 +46,7 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
private final EmergencyButton mEmergencyButton; private final EmergencyButton mEmergencyButton;
private final EmergencyButtonController mEmergencyButtonController; private final EmergencyButtonController mEmergencyButtonController;
private boolean mPaused; private boolean mPaused;
protected KeyguardMessageAreaController<BouncerKeyguardMessageArea> mMessageAreaController;
// The following is used to ignore callbacks from SecurityViews that are no longer current // The following is used to ignore callbacks from SecurityViews that are no longer current
// (e.g. face unlock). This avoids unwanted asynchronous events from messing with the // (e.g. face unlock). This avoids unwanted asynchronous events from messing with the
@@ -71,12 +74,24 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
protected KeyguardInputViewController(T view, SecurityMode securityMode, protected KeyguardInputViewController(T view, SecurityMode securityMode,
KeyguardSecurityCallback keyguardSecurityCallback, KeyguardSecurityCallback keyguardSecurityCallback,
EmergencyButtonController emergencyButtonController) { EmergencyButtonController emergencyButtonController,
@Nullable KeyguardMessageAreaController.Factory messageAreaControllerFactory) {
super(view); super(view);
mSecurityMode = securityMode; mSecurityMode = securityMode;
mKeyguardSecurityCallback = keyguardSecurityCallback; mKeyguardSecurityCallback = keyguardSecurityCallback;
mEmergencyButton = view == null ? null : view.findViewById(R.id.emergency_call_button); mEmergencyButton = view == null ? null : view.findViewById(R.id.emergency_call_button);
mEmergencyButtonController = emergencyButtonController; mEmergencyButtonController = emergencyButtonController;
if (messageAreaControllerFactory != null) {
try {
BouncerKeyguardMessageArea kma = view.requireViewById(R.id.bouncer_message_area);
mMessageAreaController = messageAreaControllerFactory.create(kma);
mMessageAreaController.init();
mMessageAreaController.setIsVisible(true);
} catch (IllegalArgumentException exception) {
Log.e("KeyguardInputViewController",
"Ensure that a BouncerKeyguardMessageArea is included in the layout");
}
}
} }
@Override @Override

View File

@@ -17,9 +17,7 @@
package com.android.keyguard; package com.android.keyguard;
import android.content.Context; import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.SystemClock; import android.os.SystemClock;
@@ -33,7 +31,6 @@ import android.widget.TextView;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.android.internal.policy.SystemBarUtils; import com.android.internal.policy.SystemBarUtils;
import com.android.settingslib.Utils;
import com.android.systemui.R; import com.android.systemui.R;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@@ -41,7 +38,7 @@ import java.lang.ref.WeakReference;
/*** /***
* Manages a number of views inside of the given layout. See below for a list of widgets. * Manages a number of views inside of the given layout. See below for a list of widgets.
*/ */
public class KeyguardMessageArea extends TextView implements SecurityMessageDisplay { public abstract class KeyguardMessageArea extends TextView implements SecurityMessageDisplay {
/** Handler token posted with accessibility announcement runnables. */ /** Handler token posted with accessibility announcement runnables. */
private static final Object ANNOUNCE_TOKEN = new Object(); private static final Object ANNOUNCE_TOKEN = new Object();
@@ -50,15 +47,11 @@ public class KeyguardMessageArea extends TextView implements SecurityMessageDisp
* lift-to-type from interrupting itself. * lift-to-type from interrupting itself.
*/ */
private static final long ANNOUNCEMENT_DELAY = 250; private static final long ANNOUNCEMENT_DELAY = 250;
private static final int DEFAULT_COLOR = -1;
private final Handler mHandler; private final Handler mHandler;
private ColorStateList mDefaultColorState;
private CharSequence mMessage; private CharSequence mMessage;
private ColorStateList mNextMessageColorState = ColorStateList.valueOf(DEFAULT_COLOR); private boolean mIsVisible;
private boolean mBouncerShowing;
private boolean mAltBouncerShowing;
/** /**
* Container that wraps the KeyguardMessageArea - may be null if current view hierarchy doesn't * Container that wraps the KeyguardMessageArea - may be null if current view hierarchy doesn't
* contain {@link R.id.keyguard_message_area_container}. * contain {@link R.id.keyguard_message_area_container}.
@@ -96,23 +89,11 @@ public class KeyguardMessageArea extends TextView implements SecurityMessageDisp
mContainer.setLayoutParams(lp); mContainer.setLayoutParams(lp);
} }
@Override protected void onThemeChanged() {
public void setNextMessageColor(ColorStateList colorState) {
mNextMessageColorState = colorState;
}
void onThemeChanged() {
TypedArray array = mContext.obtainStyledAttributes(new int[] {
android.R.attr.textColorPrimary
});
ColorStateList newTextColors = ColorStateList.valueOf(array.getColor(0, Color.RED));
array.recycle();
mDefaultColorState = newTextColors;
update(); update();
} }
void reloadColor() { protected void reloadColor() {
mDefaultColorState = Utils.getColorAttr(getContext(), android.R.attr.textColorPrimary);
update(); update();
} }
@@ -151,17 +132,6 @@ public class KeyguardMessageArea extends TextView implements SecurityMessageDisp
setMessage(message); setMessage(message);
} }
public static KeyguardMessageArea findSecurityMessageDisplay(View v) {
KeyguardMessageArea messageArea = v.findViewById(R.id.keyguard_message_area);
if (messageArea == null) {
messageArea = v.getRootView().findViewById(R.id.keyguard_message_area);
}
if (messageArea == null) {
throw new RuntimeException("Can't find keyguard_message_area in " + v.getClass());
}
return messageArea;
}
private void securityMessageChanged(CharSequence message) { private void securityMessageChanged(CharSequence message) {
mMessage = message; mMessage = message;
update(); update();
@@ -177,40 +147,23 @@ public class KeyguardMessageArea extends TextView implements SecurityMessageDisp
void update() { void update() {
CharSequence status = mMessage; CharSequence status = mMessage;
setVisibility(TextUtils.isEmpty(status) || (!mBouncerShowing && !mAltBouncerShowing) setVisibility(TextUtils.isEmpty(status) || (!mIsVisible) ? INVISIBLE : VISIBLE);
? INVISIBLE : VISIBLE);
setText(status); setText(status);
ColorStateList colorState = mDefaultColorState; updateTextColor();
if (mNextMessageColorState.getDefaultColor() != DEFAULT_COLOR) {
colorState = mNextMessageColorState;
mNextMessageColorState = ColorStateList.valueOf(DEFAULT_COLOR);
}
if (mAltBouncerShowing) {
// alt bouncer has a black scrim, so always show the text in white
colorState = ColorStateList.valueOf(Color.WHITE);
}
setTextColor(colorState);
} }
/** /**
* Set whether the bouncer is fully showing * Set whether the bouncer is fully showing
*/ */
public void setBouncerShowing(boolean bouncerShowing) { public void setIsVisible(boolean isVisible) {
if (mBouncerShowing != bouncerShowing) { if (mIsVisible != isVisible) {
mBouncerShowing = bouncerShowing; mIsVisible = isVisible;
update(); update();
} }
} }
/** /** Set the text color */
* Set whether the alt bouncer is showing protected abstract void updateTextColor();
*/
void setAltBouncerShowing(boolean showing) {
if (mAltBouncerShowing != showing) {
mAltBouncerShowing = showing;
update();
}
}
/** /**
* Runnable used to delay accessibility announcements. * Runnable used to delay accessibility announcements.

View File

@@ -26,11 +26,14 @@ import com.android.systemui.util.ViewController;
import javax.inject.Inject; import javax.inject.Inject;
/** Controller for a {@link KeyguardMessageAreaController}. */ /**
public class KeyguardMessageAreaController extends ViewController<KeyguardMessageArea> { * Controller for a {@link KeyguardMessageAreaController}.
* @param <T> A subclass of KeyguardMessageArea.
*/
public class KeyguardMessageAreaController<T extends KeyguardMessageArea>
extends ViewController<T> {
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private final ConfigurationController mConfigurationController; private final ConfigurationController mConfigurationController;
private boolean mAltBouncerShowing;
private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() { private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
public void onFinishedGoingToSleep(int why) { public void onFinishedGoingToSleep(int why) {
@@ -59,7 +62,7 @@ public class KeyguardMessageAreaController extends ViewController<KeyguardMessag
} }
}; };
private KeyguardMessageAreaController(KeyguardMessageArea view, protected KeyguardMessageAreaController(T view,
KeyguardUpdateMonitor keyguardUpdateMonitor, KeyguardUpdateMonitor keyguardUpdateMonitor,
ConfigurationController configurationController) { ConfigurationController configurationController) {
super(view); super(view);
@@ -83,17 +86,10 @@ public class KeyguardMessageAreaController extends ViewController<KeyguardMessag
} }
/** /**
* Set whether alt bouncer is showing * Indicate that view is visible and can display messages.
*/ */
public void setAltBouncerShowing(boolean showing) { public void setIsVisible(boolean isVisible) {
mView.setAltBouncerShowing(showing); mView.setIsVisible(isVisible);
}
/**
* Set bouncer is fully showing
*/
public void setBouncerShowing(boolean showing) {
mView.setBouncerShowing(showing);
} }
public void setMessage(CharSequence s) { public void setMessage(CharSequence s) {

View File

@@ -71,7 +71,7 @@ public class KeyguardPatternView extends KeyguardInputView
*/ */
private long mLastPokeTime = -UNLOCK_PATTERN_WAKE_INTERVAL_MS; private long mLastPokeTime = -UNLOCK_PATTERN_WAKE_INTERVAL_MS;
KeyguardMessageArea mSecurityMessageDisplay; BouncerKeyguardMessageArea mSecurityMessageDisplay;
private View mEcaView; private View mEcaView;
private ConstraintLayout mContainer; private ConstraintLayout mContainer;
@@ -120,7 +120,7 @@ public class KeyguardPatternView extends KeyguardInputView
@Override @Override
protected void onAttachedToWindow() { protected void onAttachedToWindow() {
super.onAttachedToWindow(); super.onAttachedToWindow();
mSecurityMessageDisplay = KeyguardMessageArea.findSecurityMessageDisplay(this); mSecurityMessageDisplay = findViewById(R.id.bouncer_message_area);
} }
@Override @Override

View File

@@ -59,12 +59,9 @@ public class KeyguardPatternViewController
private final LatencyTracker mLatencyTracker; private final LatencyTracker mLatencyTracker;
private final FalsingCollector mFalsingCollector; private final FalsingCollector mFalsingCollector;
private final EmergencyButtonController mEmergencyButtonController; private final EmergencyButtonController mEmergencyButtonController;
private final KeyguardMessageAreaController.Factory mMessageAreaControllerFactory;
private final DevicePostureController mPostureController; private final DevicePostureController mPostureController;
private final DevicePostureController.Callback mPostureCallback = private final DevicePostureController.Callback mPostureCallback =
posture -> mView.onDevicePostureChanged(posture); posture -> mView.onDevicePostureChanged(posture);
private KeyguardMessageAreaController mMessageAreaController;
private LockPatternView mLockPatternView; private LockPatternView mLockPatternView;
private CountDownTimer mCountdownTimer; private CountDownTimer mCountdownTimer;
private AsyncTask<?, ?, ?> mPendingLockCheck; private AsyncTask<?, ?, ?> mPendingLockCheck;
@@ -201,15 +198,13 @@ public class KeyguardPatternViewController
EmergencyButtonController emergencyButtonController, EmergencyButtonController emergencyButtonController,
KeyguardMessageAreaController.Factory messageAreaControllerFactory, KeyguardMessageAreaController.Factory messageAreaControllerFactory,
DevicePostureController postureController) { DevicePostureController postureController) {
super(view, securityMode, keyguardSecurityCallback, emergencyButtonController); super(view, securityMode, keyguardSecurityCallback, emergencyButtonController,
messageAreaControllerFactory);
mKeyguardUpdateMonitor = keyguardUpdateMonitor; mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mLockPatternUtils = lockPatternUtils; mLockPatternUtils = lockPatternUtils;
mLatencyTracker = latencyTracker; mLatencyTracker = latencyTracker;
mFalsingCollector = falsingCollector; mFalsingCollector = falsingCollector;
mEmergencyButtonController = emergencyButtonController; mEmergencyButtonController = emergencyButtonController;
mMessageAreaControllerFactory = messageAreaControllerFactory;
KeyguardMessageArea kma = KeyguardMessageArea.findSecurityMessageDisplay(mView);
mMessageAreaController = mMessageAreaControllerFactory.create(kma);
mLockPatternView = mView.findViewById(R.id.lockPatternView); mLockPatternView = mView.findViewById(R.id.lockPatternView);
mPostureController = postureController; mPostureController = postureController;
} }
@@ -217,7 +212,6 @@ public class KeyguardPatternViewController
@Override @Override
public void onInit() { public void onInit() {
super.onInit(); super.onInit();
mMessageAreaController.init();
} }
@Override @Override
@@ -346,6 +340,9 @@ public class KeyguardPatternViewController
@Override @Override
public void showMessage(CharSequence message, ColorStateList colorState) { public void showMessage(CharSequence message, ColorStateList colorState) {
if (mMessageAreaController == null) {
return;
}
if (colorState != null) { if (colorState != null) {
mMessageAreaController.setNextMessageColor(colorState); mMessageAreaController.setNextMessageColor(colorState);
} }

View File

@@ -665,7 +665,8 @@ public class KeyguardSecurityContainer extends FrameLayout {
// When using EXACTLY spec, measure will use the layout width if > 0. Set before // When using EXACTLY spec, measure will use the layout width if > 0. Set before
// measuring the child // measuring the child
lp.width = MeasureSpec.getSize(updatedWidthMeasureSpec); lp.width = MeasureSpec.getSize(updatedWidthMeasureSpec);
measureChildWithMargins(view, updatedWidthMeasureSpec, 0, heightMeasureSpec, 0); measureChildWithMargins(view, updatedWidthMeasureSpec, 0,
heightMeasureSpec, 0);
maxWidth = Math.max(maxWidth, maxWidth = Math.max(maxWidth,
view.getMeasuredWidth() + lp.leftMargin + lp.rightMargin); view.getMeasuredWidth() + lp.leftMargin + lp.rightMargin);
@@ -1306,7 +1307,6 @@ public class KeyguardSecurityContainer extends FrameLayout {
int yTrans = mResources.getDimensionPixelSize(R.dimen.bouncer_user_switcher_y_trans); int yTrans = mResources.getDimensionPixelSize(R.dimen.bouncer_user_switcher_y_trans);
if (mResources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { if (mResources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
mUserSwitcherViewGroup.setTranslationY(yTrans); mUserSwitcherViewGroup.setTranslationY(yTrans);
mViewFlipper.setTranslationY(-yTrans);
} else { } else {
// Attempt to reposition a bit higher to make up for this frame being a bit lower // Attempt to reposition a bit higher to make up for this frame being a bit lower
// on the device // on the device

View File

@@ -146,7 +146,8 @@ public class KeyguardSecurityViewFlipperController
protected NullKeyguardInputViewController(SecurityMode securityMode, protected NullKeyguardInputViewController(SecurityMode securityMode,
KeyguardSecurityCallback keyguardSecurityCallback, KeyguardSecurityCallback keyguardSecurityCallback,
EmergencyButtonController emergencyButtonController) { EmergencyButtonController emergencyButtonController) {
super(null, securityMode, keyguardSecurityCallback, emergencyButtonController); super(null, securityMode, keyguardSecurityCallback, emergencyButtonController,
null);
} }
@Override @Override

View File

@@ -20,7 +20,8 @@ import android.content.res.ColorStateList;
public interface SecurityMessageDisplay { public interface SecurityMessageDisplay {
void setNextMessageColor(ColorStateList colorState); /** Set text color for the next security message. */
default void setNextMessageColor(ColorStateList colorState) {}
void setMessage(CharSequence msg); void setMessage(CharSequence msg);

View File

@@ -29,6 +29,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
import com.android.keyguard.AuthKeyguardMessageArea;
import com.android.keyguard.LockIconViewController; import com.android.keyguard.LockIconViewController;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.classifier.FalsingCollector; import com.android.systemui.classifier.FalsingCollector;
@@ -138,6 +139,13 @@ public class NotificationShadeWindowViewController {
return mView.findViewById(R.id.keyguard_bouncer_container); return mView.findViewById(R.id.keyguard_bouncer_container);
} }
/**
* @return Location where to place the KeyguardMessageArea
*/
public AuthKeyguardMessageArea getKeyguardMessageArea() {
return mView.findViewById(R.id.keyguard_message_area);
}
/** Inflates the {@link R.layout#status_bar_expanded} layout and sets it up. */ /** Inflates the {@link R.layout#status_bar_expanded} layout and sets it up. */
public void setupExpandedStatusBar() { public void setupExpandedStatusBar() {
mStackScrollLayout = mView.findViewById(R.id.notification_stack_scroller); mStackScrollLayout = mView.findViewById(R.id.notification_stack_scroller);

View File

@@ -932,7 +932,7 @@ public class KeyguardIndicationController {
return; // udfps affordance is highlighted, no need to show action to unlock return; // udfps affordance is highlighted, no need to show action to unlock
} else if (mKeyguardUpdateMonitor.isFaceEnrolled()) { } else if (mKeyguardUpdateMonitor.isFaceEnrolled()) {
String message = mContext.getString(R.string.keyguard_retry); String message = mContext.getString(R.string.keyguard_retry);
mStatusBarKeyguardViewManager.showBouncerMessage(message, mInitialTextColorState); mStatusBarKeyguardViewManager.setKeyguardMessage(message, mInitialTextColorState);
} }
} else { } else {
final boolean canSkipBouncer = mKeyguardUpdateMonitor.getUserCanSkipBouncer( final boolean canSkipBouncer = mKeyguardUpdateMonitor.getUserCanSkipBouncer(
@@ -1080,7 +1080,7 @@ public class KeyguardIndicationController {
} }
return; return;
} else if (mStatusBarKeyguardViewManager.isBouncerShowing()) { } else if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
mStatusBarKeyguardViewManager.showBouncerMessage(helpString, mStatusBarKeyguardViewManager.setKeyguardMessage(helpString,
mInitialTextColorState); mInitialTextColorState);
} else if (mScreenLifecycle.getScreenState() == SCREEN_ON) { } else if (mScreenLifecycle.getScreenState() == SCREEN_ON) {
if (isCoExFaceAcquisitionMessage && msgId == FACE_ACQUIRED_TOO_DARK) { if (isCoExFaceAcquisitionMessage && msgId == FACE_ACQUIRED_TOO_DARK) {
@@ -1155,7 +1155,7 @@ public class KeyguardIndicationController {
showActionToUnlock(); showActionToUnlock();
} }
} else if (mStatusBarKeyguardViewManager.isBouncerShowing()) { } else if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
mStatusBarKeyguardViewManager.showBouncerMessage(errString, mInitialTextColorState); mStatusBarKeyguardViewManager.setKeyguardMessage(errString, mInitialTextColorState);
} else if (mScreenLifecycle.getScreenState() == SCREEN_ON) { } else if (mScreenLifecycle.getScreenState() == SCREEN_ON) {
showBiometricMessage(errString); showBiometricMessage(errString);
} else { } else {

View File

@@ -40,6 +40,7 @@ import androidx.lifecycle.LifecycleOwner;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.statusbar.RegisterStatusBarResult; import com.android.internal.statusbar.RegisterStatusBarResult;
import com.android.keyguard.AuthKeyguardMessageArea;
import com.android.keyguard.FaceAuthApiRequestReason; import com.android.keyguard.FaceAuthApiRequestReason;
import com.android.systemui.Dumpable; import com.android.systemui.Dumpable;
import com.android.systemui.animation.ActivityLaunchAnimator; import com.android.systemui.animation.ActivityLaunchAnimator;
@@ -220,6 +221,9 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn
ViewGroup getBouncerContainer(); ViewGroup getBouncerContainer();
/** Get the Keyguard Message Area that displays auth messages. */
AuthKeyguardMessageArea getKeyguardMessageArea();
int getStatusBarHeight(); int getStatusBarHeight();
void updateQsExpansionEnabled(); void updateQsExpansionEnabled();

View File

@@ -120,6 +120,7 @@ import com.android.internal.logging.UiEventLoggerImpl;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.statusbar.IStatusBarService; import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.RegisterStatusBarResult; import com.android.internal.statusbar.RegisterStatusBarResult;
import com.android.keyguard.AuthKeyguardMessageArea;
import com.android.keyguard.FaceAuthApiRequestReason; import com.android.keyguard.FaceAuthApiRequestReason;
import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.keyguard.KeyguardUpdateMonitorCallback;
@@ -1581,6 +1582,11 @@ public class CentralSurfacesImpl extends CoreStartable implements
return mNotificationShadeWindowViewController.getBouncerContainer(); return mNotificationShadeWindowViewController.getBouncerContainer();
} }
@Override
public AuthKeyguardMessageArea getKeyguardMessageArea() {
return mNotificationShadeWindowViewController.getKeyguardMessageArea();
}
@Override @Override
public int getStatusBarHeight() { public int getStatusBarHeight() {
return mStatusBarWindowController.getStatusBarHeight(); return mStatusBarWindowController.getStatusBarHeight();

View File

@@ -44,7 +44,7 @@ import androidx.annotation.VisibleForTesting;
import com.android.internal.util.LatencyTracker; import com.android.internal.util.LatencyTracker;
import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardMessageArea; import com.android.keyguard.AuthKeyguardMessageArea;
import com.android.keyguard.KeyguardMessageAreaController; import com.android.keyguard.KeyguardMessageAreaController;
import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.keyguard.KeyguardUpdateMonitorCallback;
@@ -122,7 +122,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
private final DreamOverlayStateController mDreamOverlayStateController; private final DreamOverlayStateController mDreamOverlayStateController;
@Nullable @Nullable
private final FoldAodAnimationController mFoldAodAnimationController; private final FoldAodAnimationController mFoldAodAnimationController;
private KeyguardMessageAreaController mKeyguardMessageAreaController; private KeyguardMessageAreaController<AuthKeyguardMessageArea> mKeyguardMessageAreaController;
private final Lazy<com.android.systemui.shade.ShadeController> mShadeController; private final Lazy<com.android.systemui.shade.ShadeController> mShadeController;
private final BouncerExpansionCallback mExpansionCallback = new BouncerExpansionCallback() { private final BouncerExpansionCallback mExpansionCallback = new BouncerExpansionCallback() {
@@ -311,7 +311,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mBypassController = bypassController; mBypassController = bypassController;
mNotificationContainer = notificationContainer; mNotificationContainer = notificationContainer;
mKeyguardMessageAreaController = mKeyguardMessageAreaFactory.create( mKeyguardMessageAreaController = mKeyguardMessageAreaFactory.create(
KeyguardMessageArea.findSecurityMessageDisplay(container)); centralSurfaces.getKeyguardMessageArea());
registerListeners(); registerListeners();
} }
@@ -616,7 +616,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
private void updateAlternateAuthShowing(boolean updateScrim) { private void updateAlternateAuthShowing(boolean updateScrim) {
final boolean isShowingAltAuth = isShowingAlternateAuth(); final boolean isShowingAltAuth = isShowingAlternateAuth();
if (mKeyguardMessageAreaController != null) { if (mKeyguardMessageAreaController != null) {
mKeyguardMessageAreaController.setAltBouncerShowing(isShowingAltAuth); mKeyguardMessageAreaController.setIsVisible(isShowingAltAuth);
mKeyguardMessageAreaController.setMessage("");
} }
mBypassController.setAltBouncerShowing(isShowingAltAuth); mBypassController.setAltBouncerShowing(isShowingAltAuth);
mKeyguardUpdateManager.setUdfpsBouncerShowing(isShowingAltAuth); mKeyguardUpdateManager.setUdfpsBouncerShowing(isShowingAltAuth);
@@ -1043,7 +1044,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
if (bouncerShowing != mLastBouncerShowing || mFirstUpdate) { if (bouncerShowing != mLastBouncerShowing || mFirstUpdate) {
mNotificationShadeWindowController.setBouncerShowing(bouncerShowing); mNotificationShadeWindowController.setBouncerShowing(bouncerShowing);
mCentralSurfaces.setBouncerShowing(bouncerShowing); mCentralSurfaces.setBouncerShowing(bouncerShowing);
mKeyguardMessageAreaController.setBouncerShowing(bouncerShowing);
} }
if (occluded != mLastOccluded || mFirstUpdate) { if (occluded != mLastOccluded || mFirstUpdate) {
@@ -1192,7 +1192,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
} }
} }
public void showBouncerMessage(String message, ColorStateList colorState) { /** Display security message to relevant KeyguardMessageArea. */
public void setKeyguardMessage(String message, ColorStateList colorState) {
if (isShowingAlternateAuth()) { if (isShowingAlternateAuth()) {
if (mKeyguardMessageAreaController != null) { if (mKeyguardMessageAreaController != null) {
mKeyguardMessageAreaController.setMessage(message); mKeyguardMessageAreaController.setMessage(message);

View File

@@ -33,14 +33,14 @@ import org.mockito.MockitoAnnotations;
@SmallTest @SmallTest
@RunWith(AndroidTestingRunner.class) @RunWith(AndroidTestingRunner.class)
@RunWithLooper @RunWithLooper
public class KeyguardMessageAreaTest extends SysuiTestCase { public class AuthKeyguardMessageAreaTest extends SysuiTestCase {
private KeyguardMessageArea mKeyguardMessageArea; private KeyguardMessageArea mKeyguardMessageArea;
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
mKeyguardMessageArea = new KeyguardMessageArea(mContext, null); mKeyguardMessageArea = new AuthKeyguardMessageArea(mContext, null);
mKeyguardMessageArea.setBouncerShowing(true); mKeyguardMessageArea.setIsVisible(true);
} }
@Test @Test
@@ -53,7 +53,7 @@ public class KeyguardMessageAreaTest extends SysuiTestCase {
@Test @Test
public void testHiddenWhenBouncerHidden() { public void testHiddenWhenBouncerHidden() {
mKeyguardMessageArea.setBouncerShowing(false); mKeyguardMessageArea.setIsVisible(false);
mKeyguardMessageArea.setVisibility(View.INVISIBLE); mKeyguardMessageArea.setVisibility(View.INVISIBLE);
mKeyguardMessageArea.setMessage("oobleck"); mKeyguardMessageArea.setMessage("oobleck");
assertThat(mKeyguardMessageArea.getVisibility()).isEqualTo(View.INVISIBLE); assertThat(mKeyguardMessageArea.getVisibility()).isEqualTo(View.INVISIBLE);

View File

@@ -56,7 +56,7 @@ public class KeyguardAbsKeyInputViewControllerTest extends SysuiTestCase {
@Mock @Mock
private PasswordTextView mPasswordEntry; private PasswordTextView mPasswordEntry;
@Mock @Mock
private KeyguardMessageArea mKeyguardMessageArea; private BouncerKeyguardMessageArea mKeyguardMessageArea;
@Mock @Mock
private KeyguardUpdateMonitor mKeyguardUpdateMonitor; private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@Mock @Mock
@@ -85,7 +85,7 @@ public class KeyguardAbsKeyInputViewControllerTest extends SysuiTestCase {
when(mAbsKeyInputView.getPasswordTextViewId()).thenReturn(1); when(mAbsKeyInputView.getPasswordTextViewId()).thenReturn(1);
when(mAbsKeyInputView.findViewById(1)).thenReturn(mPasswordEntry); when(mAbsKeyInputView.findViewById(1)).thenReturn(mPasswordEntry);
when(mAbsKeyInputView.isAttachedToWindow()).thenReturn(true); when(mAbsKeyInputView.isAttachedToWindow()).thenReturn(true);
when(mAbsKeyInputView.findViewById(R.id.keyguard_message_area)) when(mAbsKeyInputView.requireViewById(R.id.bouncer_message_area))
.thenReturn(mKeyguardMessageArea); .thenReturn(mKeyguardMessageArea);
mKeyguardAbsKeyInputViewController = new KeyguardAbsKeyInputViewController(mAbsKeyInputView, mKeyguardAbsKeyInputViewController = new KeyguardAbsKeyInputViewController(mAbsKeyInputView,
mKeyguardUpdateMonitor, mSecurityMode, mLockPatternUtils, mKeyguardSecurityCallback, mKeyguardUpdateMonitor, mSecurityMode, mLockPatternUtils, mKeyguardSecurityCallback,

View File

@@ -89,8 +89,8 @@ public class KeyguardMessageAreaControllerTest extends SysuiTestCase {
@Test @Test
public void testSetBouncerVisible() { public void testSetBouncerVisible() {
mMessageAreaController.setBouncerShowing(true); mMessageAreaController.setIsVisible(true);
verify(mKeyguardMessageArea).setBouncerShowing(true); verify(mKeyguardMessageArea).setIsVisible(true);
} }
@Test @Test

View File

@@ -64,9 +64,10 @@ class KeyguardPasswordViewControllerTest : SysuiTestCase() {
@Mock @Mock
lateinit var keyguardViewController: KeyguardViewController lateinit var keyguardViewController: KeyguardViewController
@Mock @Mock
private lateinit var mKeyguardMessageArea: KeyguardMessageArea private lateinit var mKeyguardMessageArea: BouncerKeyguardMessageArea
@Mock @Mock
private lateinit var mKeyguardMessageAreaController: KeyguardMessageAreaController private lateinit var mKeyguardMessageAreaController:
KeyguardMessageAreaController<BouncerKeyguardMessageArea>
private lateinit var keyguardPasswordViewController: KeyguardPasswordViewController private lateinit var keyguardPasswordViewController: KeyguardPasswordViewController
@@ -74,7 +75,8 @@ class KeyguardPasswordViewControllerTest : SysuiTestCase() {
fun setup() { fun setup() {
MockitoAnnotations.initMocks(this) MockitoAnnotations.initMocks(this)
Mockito.`when`( Mockito.`when`(
keyguardPasswordView.findViewById<KeyguardMessageArea>(R.id.keyguard_message_area) keyguardPasswordView
.requireViewById<BouncerKeyguardMessageArea>(R.id.bouncer_message_area)
).thenReturn(mKeyguardMessageArea) ).thenReturn(mKeyguardMessageArea)
Mockito.`when`(messageAreaControllerFactory.create(mKeyguardMessageArea)) Mockito.`when`(messageAreaControllerFactory.create(mKeyguardMessageArea))
.thenReturn(mKeyguardMessageAreaController) .thenReturn(mKeyguardMessageAreaController)

View File

@@ -66,10 +66,11 @@ class KeyguardPatternViewControllerTest : SysuiTestCase() {
var mKeyguardMessageAreaControllerFactory: KeyguardMessageAreaController.Factory var mKeyguardMessageAreaControllerFactory: KeyguardMessageAreaController.Factory
@Mock @Mock
private lateinit var mKeyguardMessageArea: KeyguardMessageArea private lateinit var mKeyguardMessageArea: BouncerKeyguardMessageArea
@Mock @Mock
private lateinit var mKeyguardMessageAreaController: KeyguardMessageAreaController private lateinit var mKeyguardMessageAreaController:
KeyguardMessageAreaController<BouncerKeyguardMessageArea>
@Mock @Mock
private lateinit var mLockPatternView: LockPatternView private lateinit var mLockPatternView: LockPatternView
@@ -83,7 +84,8 @@ class KeyguardPatternViewControllerTest : SysuiTestCase() {
fun setup() { fun setup() {
MockitoAnnotations.initMocks(this) MockitoAnnotations.initMocks(this)
`when`(mKeyguardPatternView.isAttachedToWindow).thenReturn(true) `when`(mKeyguardPatternView.isAttachedToWindow).thenReturn(true)
`when`(mKeyguardPatternView.findViewById<KeyguardMessageArea>(R.id.keyguard_message_area)) `when`(mKeyguardPatternView
.requireViewById<BouncerKeyguardMessageArea>(R.id.bouncer_message_area))
.thenReturn(mKeyguardMessageArea) .thenReturn(mKeyguardMessageArea)
`when`(mKeyguardPatternView.findViewById<LockPatternView>(R.id.lockPatternView)) `when`(mKeyguardPatternView.findViewById<LockPatternView>(R.id.lockPatternView))
.thenReturn(mLockPatternView) .thenReturn(mLockPatternView)

View File

@@ -51,7 +51,7 @@ public class KeyguardPinBasedInputViewControllerTest extends SysuiTestCase {
@Mock @Mock
private PasswordTextView mPasswordEntry; private PasswordTextView mPasswordEntry;
@Mock @Mock
private KeyguardMessageArea mKeyguardMessageArea; private BouncerKeyguardMessageArea mKeyguardMessageArea;
@Mock @Mock
private KeyguardUpdateMonitor mKeyguardUpdateMonitor; private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@Mock @Mock
@@ -90,7 +90,7 @@ public class KeyguardPinBasedInputViewControllerTest extends SysuiTestCase {
when(mPinBasedInputView.findViewById(1)).thenReturn(mPasswordEntry); when(mPinBasedInputView.findViewById(1)).thenReturn(mPasswordEntry);
when(mPinBasedInputView.isAttachedToWindow()).thenReturn(true); when(mPinBasedInputView.isAttachedToWindow()).thenReturn(true);
when(mPinBasedInputView.getButtons()).thenReturn(mButtons); when(mPinBasedInputView.getButtons()).thenReturn(mButtons);
when(mPinBasedInputView.findViewById(R.id.keyguard_message_area)) when(mPinBasedInputView.requireViewById(R.id.bouncer_message_area))
.thenReturn(mKeyguardMessageArea); .thenReturn(mKeyguardMessageArea);
when(mPinBasedInputView.findViewById(R.id.delete_button)) when(mPinBasedInputView.findViewById(R.id.delete_button))
.thenReturn(mDeleteButton); .thenReturn(mDeleteButton);

View File

@@ -41,6 +41,7 @@ import android.content.res.Resources;
import android.hardware.biometrics.BiometricSourceType; import android.hardware.biometrics.BiometricSourceType;
import android.testing.AndroidTestingRunner; import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper; import android.testing.TestableLooper;
import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.WindowInsetsController; import android.view.WindowInsetsController;
@@ -117,7 +118,7 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
@Mock @Mock
private KeyguardMessageAreaController mKeyguardMessageAreaController; private KeyguardMessageAreaController mKeyguardMessageAreaController;
@Mock @Mock
private KeyguardMessageArea mKeyguardMessageArea; private BouncerKeyguardMessageArea mKeyguardMessageArea;
@Mock @Mock
private ConfigurationController mConfigurationController; private ConfigurationController mConfigurationController;
@Mock @Mock
@@ -163,9 +164,10 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
when(mAdminSecondaryLockScreenControllerFactory.create(any(KeyguardSecurityCallback.class))) when(mAdminSecondaryLockScreenControllerFactory.create(any(KeyguardSecurityCallback.class)))
.thenReturn(mAdminSecondaryLockScreenController); .thenReturn(mAdminSecondaryLockScreenController);
when(mSecurityViewFlipper.getWindowInsetsController()).thenReturn(mWindowInsetsController); when(mSecurityViewFlipper.getWindowInsetsController()).thenReturn(mWindowInsetsController);
mKeyguardPasswordView = spy(new KeyguardPasswordView(getContext())); mKeyguardPasswordView = spy((KeyguardPasswordView) LayoutInflater.from(mContext).inflate(
R.layout.keyguard_password_view, null));
when(mKeyguardPasswordView.getRootView()).thenReturn(mSecurityViewFlipper); when(mKeyguardPasswordView.getRootView()).thenReturn(mSecurityViewFlipper);
when(mKeyguardPasswordView.findViewById(R.id.keyguard_message_area)) when(mKeyguardPasswordView.requireViewById(R.id.bouncer_message_area))
.thenReturn(mKeyguardMessageArea); .thenReturn(mKeyguardMessageArea);
when(mKeyguardMessageAreaControllerFactory.create(any(KeyguardMessageArea.class))) when(mKeyguardMessageAreaControllerFactory.create(any(KeyguardMessageArea.class)))
.thenReturn(mKeyguardMessageAreaController); .thenReturn(mKeyguardMessageAreaController);

View File

@@ -19,8 +19,10 @@ package com.android.systemui.shade
import android.testing.AndroidTestingRunner import android.testing.AndroidTestingRunner
import android.testing.TestableLooper.RunWithLooper import android.testing.TestableLooper.RunWithLooper
import android.view.MotionEvent import android.view.MotionEvent
import android.view.ViewGroup
import androidx.test.filters.SmallTest import androidx.test.filters.SmallTest
import com.android.keyguard.LockIconViewController import com.android.keyguard.LockIconViewController
import com.android.systemui.R
import com.android.systemui.SysuiTestCase import com.android.systemui.SysuiTestCase
import com.android.systemui.classifier.FalsingCollectorFake import com.android.systemui.classifier.FalsingCollectorFake
import com.android.systemui.dock.DockManager import com.android.systemui.dock.DockManager
@@ -246,6 +248,18 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
verify(phoneStatusBarViewController).sendTouchToView(nextEvent) verify(phoneStatusBarViewController).sendTouchToView(nextEvent)
assertThat(returnVal).isTrue() assertThat(returnVal).isTrue()
} }
@Test
fun testGetBouncerContainer() {
underTest.bouncerContainer
verify(view).findViewById<ViewGroup>(R.id.keyguard_bouncer_container)
}
@Test
fun testGetKeyguardMessageArea() {
underTest.keyguardMessageArea
verify(view).findViewById<ViewGroup>(R.id.keyguard_message_area)
}
} }
private val downEv = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0) private val downEv = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0)

View File

@@ -639,7 +639,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
mController.getKeyguardCallback().onBiometricError(FACE_ERROR_TIMEOUT, mController.getKeyguardCallback().onBiometricError(FACE_ERROR_TIMEOUT,
"A message", BiometricSourceType.FACE); "A message", BiometricSourceType.FACE);
verify(mStatusBarKeyguardViewManager).showBouncerMessage(eq(message), any()); verify(mStatusBarKeyguardViewManager).setKeyguardMessage(eq(message), any());
} }
@Test @Test