Hide the lock icon if there's no screen lock
Don't show the lock icon on the lock screen if the security mode is set to "none" or "swipe". Test: manual, atest LockscreenIconControllerTest Fixes: 172417353 Change-Id: Ida0b85db7aea01b7ab7b5ebae2fe2a2247f64004
This commit is contained in:
@@ -37,6 +37,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.keyguard.KeyguardSecurityModel;
|
||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||
import com.android.keyguard.KeyguardUpdateMonitorCallback;
|
||||
import com.android.settingslib.Utils;
|
||||
@@ -78,6 +79,7 @@ public class LockscreenLockIconController {
|
||||
private final KeyguardStateController mKeyguardStateController;
|
||||
private final Resources mResources;
|
||||
private final HeadsUpManagerPhone mHeadsUpManagerPhone;
|
||||
private final KeyguardSecurityModel mKeyguardSecurityModel;
|
||||
private boolean mKeyguardShowing;
|
||||
private boolean mKeyguardJustShown;
|
||||
private boolean mBlockUpdates;
|
||||
@@ -326,7 +328,8 @@ public class LockscreenLockIconController {
|
||||
@Nullable DockManager dockManager,
|
||||
KeyguardStateController keyguardStateController,
|
||||
@Main Resources resources,
|
||||
HeadsUpManagerPhone headsUpManagerPhone) {
|
||||
HeadsUpManagerPhone headsUpManagerPhone,
|
||||
KeyguardSecurityModel keyguardSecurityModel) {
|
||||
mLockscreenGestureLogger = lockscreenGestureLogger;
|
||||
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
||||
mLockPatternUtils = lockPatternUtils;
|
||||
@@ -341,6 +344,7 @@ public class LockscreenLockIconController {
|
||||
mKeyguardStateController = keyguardStateController;
|
||||
mResources = resources;
|
||||
mHeadsUpManagerPhone = headsUpManagerPhone;
|
||||
mKeyguardSecurityModel = keyguardSecurityModel;
|
||||
|
||||
mKeyguardIndicationController.setLockIconController(this);
|
||||
}
|
||||
@@ -541,13 +545,20 @@ public class LockscreenLockIconController {
|
||||
* @return true if the visibility changed
|
||||
*/
|
||||
private boolean updateIconVisibility() {
|
||||
if (mLockIcon == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mKeyguardUpdateMonitor.isUdfpsEnrolled()) {
|
||||
boolean changed = mLockIcon.getVisibility() == GONE;
|
||||
mLockIcon.setVisibility(GONE);
|
||||
return changed;
|
||||
}
|
||||
|
||||
boolean onAodOrDocked = mStatusBarStateController.isDozing() || mDocked;
|
||||
boolean invisible = onAodOrDocked || mWakeAndUnlockRunning || mShowingLaunchAffordance;
|
||||
boolean invisible = onAodOrDocked || mWakeAndUnlockRunning || mShowingLaunchAffordance
|
||||
|| (mKeyguardSecurityModel.getSecurityMode(KeyguardUpdateMonitor.getCurrentUser())
|
||||
== KeyguardSecurityModel.SecurityMode.None);
|
||||
boolean fingerprintOrBypass = mFingerprintUnlock
|
||||
|| mKeyguardBypassController.getBypassEnabled();
|
||||
if (fingerprintOrBypass && !mBouncerShowingScrimmed) {
|
||||
@@ -559,11 +570,6 @@ public class LockscreenLockIconController {
|
||||
invisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (mLockIcon == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return mLockIcon.updateIconVisibility(!invisible);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import androidx.test.filters.SmallTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.keyguard.KeyguardSecurityModel;
|
||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||
import com.android.systemui.SysuiTestCase;
|
||||
import com.android.systemui.dock.DockManager;
|
||||
@@ -80,6 +81,8 @@ public class LockscreenIconControllerTest extends SysuiTestCase {
|
||||
private Resources mResources;
|
||||
@Mock
|
||||
private HeadsUpManagerPhone mHeadsUpManagerPhone;
|
||||
@Mock
|
||||
private KeyguardSecurityModel mKeyguardSecurityModel;
|
||||
|
||||
private LockscreenLockIconController mLockIconController;
|
||||
private OnAttachStateChangeListener mOnAttachStateChangeListener;
|
||||
@@ -94,7 +97,7 @@ public class LockscreenIconControllerTest extends SysuiTestCase {
|
||||
mShadeController, mAccessibilityController, mKeyguardIndicationController,
|
||||
mStatusBarStateController, mConfigurationController, mNotificationWakeUpCoordinator,
|
||||
mKeyguardBypassController, mDockManager, mKeyguardStateController, mResources,
|
||||
mHeadsUpManagerPhone);
|
||||
mHeadsUpManagerPhone, mKeyguardSecurityModel);
|
||||
|
||||
ArgumentCaptor<OnAttachStateChangeListener> onAttachStateChangeListenerArgumentCaptor =
|
||||
ArgumentCaptor.forClass(OnAttachStateChangeListener.class);
|
||||
@@ -139,6 +142,15 @@ public class LockscreenIconControllerTest extends SysuiTestCase {
|
||||
sBStateListenerCaptor.getValue().onDozingChanged(true);
|
||||
|
||||
verify(mLockIcon).updateIconVisibility(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVisibility_noBouncer() {
|
||||
// no security (ie: no lock screen OR swipe to unlock)
|
||||
when(mKeyguardSecurityModel.getSecurityMode(anyInt())).thenReturn(
|
||||
KeyguardSecurityModel.SecurityMode.None);
|
||||
|
||||
mOnAttachStateChangeListener.onViewAttachedToWindow(mLockIcon);
|
||||
verify(mLockIcon).updateIconVisibility(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user