Merge "Recalculate max # notifs on keyguard w/ udfps"

This commit is contained in:
Beverly Tai
2020-11-02 21:05:02 +00:00
committed by Android (Google) Code Review
13 changed files with 95 additions and 22 deletions

View File

@@ -73,7 +73,7 @@
android:id="@+id/gradient_clock_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="100dp"
android:textSize="80dp"
android:letterSpacing="0.02"
android:lineSpacingMultiplier=".8"
android:includeFontPadding="false"

View File

@@ -94,6 +94,7 @@ import com.android.settingslib.fuelgauge.BatteryStatus;
import com.android.systemui.DejankUtils;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Background;
@@ -235,6 +236,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
private final Context mContext;
private final boolean mIsPrimaryUser;
private final boolean mIsAutomotive;
private final AuthController mAuthController;
private final StatusBarStateController mStatusBarStateController;
HashMap<Integer, SimData> mSimDatas = new HashMap<>();
HashMap<Integer, ServiceState> mServiceStates = new HashMap<Integer, ServiceState>();
@@ -1581,7 +1583,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
RingerModeTracker ringerModeTracker,
@Background Executor backgroundExecutor,
StatusBarStateController statusBarStateController,
LockPatternUtils lockPatternUtils) {
LockPatternUtils lockPatternUtils,
AuthController authController) {
mContext = context;
mSubscriptionManager = SubscriptionManager.from(context);
mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
@@ -1591,6 +1594,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
mRingerModeTracker = ringerModeTracker;
mStatusBarStateController = statusBarStateController;
mLockPatternUtils = lockPatternUtils;
mAuthController = authController;
dumpManager.registerDumpable(getClass().getName(), this);
mHandler = new Handler(mainLooper) {
@@ -1853,7 +1857,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
private void updateLockScreenMode() {
mLockScreenMode = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.SHOW_NEW_LOCKSCREEN, 0);
Settings.Global.SHOW_NEW_LOCKSCREEN, mAuthController.isUdfpsEnrolled() ? 1 : 0);
}
private final UserSwitchObserver mUserSwitchObserver = new UserSwitchObserver() {

View File

@@ -29,6 +29,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.graphics.RectF;
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricPrompt;
import android.hardware.biometrics.IBiometricSysuiReceiver;
@@ -243,6 +244,13 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
}
}
/**
* @return where the UDFPS exists on the screen in pixels.
*/
public RectF getUdfpsRegion() {
return mUdfpsController == null ? null : mUdfpsController.getSensorLocation();
}
/**
* Requests fingerprint scan.
*
@@ -478,7 +486,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
/**
* Whether the current user has a UDFP enrolled.
*/
public boolean hasUdfpsEnrolled() {
public boolean isUdfpsEnrolled() {
// TODO: (b/171392825) right now only checks whether the UDFPS sensor exists on this device
// but not whether user has enrolled or not
return mUdfpsController != null;

View File

@@ -25,6 +25,7 @@ import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.RectF;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.hardware.fingerprint.IUdfpsOverlayController;
@@ -244,6 +245,13 @@ class UdfpsController implements DozeReceiver {
mView.dozeTimeTick();
}
/**
* @return where the UDFPS exists on the screen in pixels.
*/
public RectF getSensorLocation() {
return mView.getSensorRect();
}
private void setShowOverlay(boolean show) {
if (show == mIsOverlayRequested) {
return;

View File

@@ -196,6 +196,10 @@ public class UdfpsView extends View implements DozeReceiver,
canvas.restore();
}
RectF getSensorRect() {
return new RectF(mSensorRect);
}
void setHbmSupported(boolean hbmSupported) {
mHbmSupported = hbmSupported;
}

View File

@@ -156,7 +156,7 @@ public class DozeSensors {
findSensorWithType(config.udfpsLongPressSensorType()),
"doze_pulse_on_auth",
true /* settingDef */,
authController.hasUdfpsEnrolled() /* configured */,
authController.isUdfpsEnrolled() /* configured */,
DozeLog.REASON_SENSOR_UDFPS_LONG_PRESS,
true /* reports touch coordinates */,
true /* touchscreen */,

View File

@@ -86,9 +86,14 @@ public class KeyguardClockPositionAlgorithm {
private int mMaxShadeBottom;
/**
* Minimum distance from the status bar.
* Recommended distance from the status bar without the lock icon.
*/
private int mContainerTopPadding;
private int mContainerTopPaddingWithoutLockIcon;
/**
* Recommended distance from the status bar with the lock icon.
*/
private int mContainerTopPaddingWithLockIcon;
/**
* @see NotificationPanelViewController#getExpandedFraction()
@@ -131,24 +136,31 @@ public class KeyguardClockPositionAlgorithm {
public void loadDimens(Resources res) {
mClockNotificationsMargin = res.getDimensionPixelSize(
R.dimen.keyguard_clock_notifications_margin);
mContainerTopPaddingWithoutLockIcon =
res.getDimensionPixelSize(R.dimen.keyguard_clock_top_margin) / 2;
// Consider the lock icon when determining the minimum top padding between the status bar
// and top of the clock.
mContainerTopPadding = Math.max(res.getDimensionPixelSize(
R.dimen.keyguard_clock_top_margin),
res.getDimensionPixelSize(R.dimen.keyguard_lock_height)
+ res.getDimensionPixelSize(R.dimen.keyguard_lock_padding)
+ res.getDimensionPixelSize(R.dimen.keyguard_clock_lock_margin));
mContainerTopPaddingWithLockIcon =
Math.max(res.getDimensionPixelSize(R.dimen.keyguard_clock_top_margin),
res.getDimensionPixelSize(R.dimen.keyguard_lock_height)
+ res.getDimensionPixelSize(R.dimen.keyguard_lock_padding)
+ res.getDimensionPixelSize(R.dimen.keyguard_clock_lock_margin));
mBurnInPreventionOffsetX = res.getDimensionPixelSize(
R.dimen.burn_in_prevention_offset_x);
mBurnInPreventionOffsetY = res.getDimensionPixelSize(
R.dimen.burn_in_prevention_offset_y);
}
public void setup(int minTopMargin, int maxShadeBottom, int notificationStackHeight,
/**
* Sets up algorithm values.
*/
public void setup(int statusBarMinHeight, int maxShadeBottom, int notificationStackHeight,
float panelExpansion, int parentHeight, int keyguardStatusHeight, int clockPreferredY,
boolean hasCustomClock, boolean hasVisibleNotifs, float dark, float emptyDragAmount,
boolean bypassEnabled, int unlockedStackScrollerPadding) {
mMinTopMargin = minTopMargin + mContainerTopPadding;
boolean bypassEnabled, int unlockedStackScrollerPadding, boolean udfpsEnrolled) {
mMinTopMargin = statusBarMinHeight + (udfpsEnrolled ? mContainerTopPaddingWithoutLockIcon :
mContainerTopPaddingWithLockIcon);
mMaxShadeBottom = maxShadeBottom;
mNotificationStackHeight = notificationStackHeight;
mPanelExpansion = panelExpansion;

View File

@@ -16,6 +16,8 @@
package com.android.systemui.statusbar.phone;
import static android.view.View.GONE;
import static com.android.systemui.statusbar.phone.LockIcon.STATE_BIOMETRICS_ERROR;
import static com.android.systemui.statusbar.phone.LockIcon.STATE_LOCKED;
import static com.android.systemui.statusbar.phone.LockIcon.STATE_LOCK_OPEN;
@@ -37,6 +39,7 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.R;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dock.DockManager;
@@ -74,6 +77,7 @@ public class LockscreenLockIconController {
private final KeyguardStateController mKeyguardStateController;
private final Resources mResources;
private final HeadsUpManagerPhone mHeadsUpManagerPhone;
private final AuthController mAuthController;
private boolean mKeyguardShowing;
private boolean mKeyguardJustShown;
private boolean mBlockUpdates;
@@ -322,7 +326,8 @@ public class LockscreenLockIconController {
@Nullable DockManager dockManager,
KeyguardStateController keyguardStateController,
@Main Resources resources,
HeadsUpManagerPhone headsUpManagerPhone) {
HeadsUpManagerPhone headsUpManagerPhone,
AuthController authController) {
mLockscreenGestureLogger = lockscreenGestureLogger;
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mLockPatternUtils = lockPatternUtils;
@@ -337,6 +342,7 @@ public class LockscreenLockIconController {
mKeyguardStateController = keyguardStateController;
mResources = resources;
mHeadsUpManagerPhone = headsUpManagerPhone;
mAuthController = authController;
mKeyguardIndicationController.setLockIconController(this);
}
@@ -502,6 +508,11 @@ public class LockscreenLockIconController {
* @return true if the visibility changed
*/
private boolean updateIconVisibility() {
if (mAuthController.isUdfpsEnrolled()) {
boolean changed = mLockIcon.getVisibility() == GONE;
mLockIcon.setVisibility(GONE);
return changed;
}
boolean onAodOrDocked = mStatusBarStateController.isDozing() || mDocked;
boolean invisible = onAodOrDocked || mWakeAndUnlockRunning || mShowingLaunchAffordance;
boolean fingerprintOrBypass = mFingerprintUnlock

View File

@@ -77,6 +77,7 @@ import com.android.keyguard.dagger.KeyguardStatusViewComponent;
import com.android.systemui.DejankUtils;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.classifier.Classifier;
import com.android.systemui.dagger.qualifiers.DisplayId;
import com.android.systemui.dagger.qualifiers.Main;
@@ -263,6 +264,7 @@ public class NotificationPanelViewController extends PanelViewController {
private final KeyguardBypassController mKeyguardBypassController;
private final KeyguardUpdateMonitor mUpdateMonitor;
private final ConversationNotificationManager mConversationNotificationManager;
private final AuthController mAuthController;
private final MediaHierarchyManager mMediaHierarchyManager;
private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
private final KeyguardStatusViewComponent.Factory mKeyguardStatusViewComponentFactory;
@@ -516,7 +518,8 @@ public class NotificationPanelViewController extends PanelViewController {
NotificationStackScrollLayoutController notificationStackScrollLayoutController,
KeyguardStatusViewComponent.Factory keyguardStatusViewComponentFactory,
NotificationGroupManagerLegacy groupManager,
NotificationIconAreaController notificationIconAreaController) {
NotificationIconAreaController notificationIconAreaController,
AuthController authController) {
super(view, falsingManager, dozeLog, keyguardStateController,
(SysuiStatusBarStateController) statusBarStateController, vibratorHelper,
latencyTracker, flingAnimationUtilsBuilder, statusBarTouchableRegionManager);
@@ -581,6 +584,7 @@ public class NotificationPanelViewController extends PanelViewController {
mLockscreenUserManager = notificationLockscreenUserManager;
mEntryManager = notificationEntryManager;
mConversationNotificationManager = conversationNotificationManager;
mAuthController = authController;
mView.setBackgroundColor(Color.TRANSPARENT);
OnAttachStateChangeListener onAttachStateChangeListener = new OnAttachStateChangeListener();
@@ -868,7 +872,8 @@ public class NotificationPanelViewController extends PanelViewController {
- mShelfHeight / 2.0f - mDarkIconSize / 2.0f),
clockPreferredY, hasCustomClock(),
hasVisibleNotifications, mInterpolatedDarkAmount, mEmptyDragAmount,
bypassEnabled, getUnlockedStackScrollerPadding());
bypassEnabled, getUnlockedStackScrollerPadding(),
mAuthController.isUdfpsEnrolled());
mClockPositionAlgorithm.run(mClockPositionResult);
mKeyguardStatusViewController.updatePosition(
mClockPositionResult.clockX, mClockPositionResult.clockY, animateClock);
@@ -908,6 +913,13 @@ public class NotificationPanelViewController extends PanelViewController {
mNotificationStackScrollLayoutController.getHeight() - minPadding - shelfSize
- Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding)
- mKeyguardStatusViewController.getLogoutButtonHeight();
if (mAuthController.isUdfpsEnrolled()) {
availableSpace = mNotificationStackScrollLayoutController.getHeight()
- minPadding - shelfSize
- (mStatusBar.getDisplayHeight() - mAuthController.getUdfpsRegion().top);
}
int count = 0;
ExpandableView previousView = null;
for (int i = 0; i < mNotificationStackScrollLayoutController.getChildCount(); i++) {

View File

@@ -79,6 +79,7 @@ import com.android.internal.widget.ILockSettings;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor.BiometricAuthenticated;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -156,6 +157,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
private LiveData<Integer> mRingerModeLiveData;
@Mock
private StatusBarStateController mStatusBarStateController;
@Mock
private AuthController mAuthController;
// Direct executor
private Executor mBackgroundExecutor = Runnable::run;
private TestableLooper mTestableLooper;
@@ -198,6 +201,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
when(mTelephonyManager.getServiceStateForSubscriber(anyInt()))
.thenReturn(new ServiceState());
when(mLockPatternUtils.getLockSettings()).thenReturn(mLockSettings);
when(mAuthController.isUdfpsEnrolled()).thenReturn(false);
mSpiedContext.addMockSystemService(TrustManager.class, mTrustManager);
mSpiedContext.addMockSystemService(FingerprintManager.class, mFingerprintManager);
mSpiedContext.addMockSystemService(BiometricManager.class, mBiometricManager);
@@ -796,7 +800,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
TestableLooper.get(KeyguardUpdateMonitorTest.this).getLooper(),
mBroadcastDispatcher, mDumpManager,
mRingerModeTracker, mBackgroundExecutor,
mStatusBarStateController, mLockPatternUtils);
mStatusBarStateController, mLockPatternUtils,
mAuthController);
setStrongAuthTracker(KeyguardUpdateMonitorTest.this.mStrongAuthTracker);
}

View File

@@ -384,7 +384,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mNotificationStackHeight,
mPanelExpansion, SCREEN_HEIGHT, mKeyguardStatusHeight, mPreferredClockY,
mHasCustomClock, mHasVisibleNotifs, mDark, ZERO_DRAG, false /* bypassEnabled */,
0 /* unlockedStackScrollerPadding */);
0 /* unlockedStackScrollerPadding */, false /* udfpsEnrolled */);
mClockPositionAlgorithm.run(mClockPosition);
}
}

View File

@@ -32,6 +32,7 @@ import androidx.test.runner.AndroidJUnit4;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.dock.DockManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.KeyguardIndicationController;
@@ -80,6 +81,8 @@ public class LockscreenIconControllerTest extends SysuiTestCase {
private Resources mResources;
@Mock
private HeadsUpManagerPhone mHeadsUpManagerPhone;
@Mock
private AuthController mAuthController;
private LockscreenLockIconController mLockIconController;
private OnAttachStateChangeListener mOnAttachStateChangeListener;
@@ -89,13 +92,14 @@ public class LockscreenIconControllerTest extends SysuiTestCase {
public void setUp() {
MockitoAnnotations.initMocks(this);
when(mAuthController.isUdfpsEnrolled()).thenReturn(false);
when(mLockIcon.getContext()).thenReturn(mContext);
mLockIconController = new LockscreenLockIconController(
mLockscreenGestureLogger, mKeyguardUpdateMonitor, mLockPatternUtils,
mShadeController, mAccessibilityController, mKeyguardIndicationController,
mStatusBarStateController, mConfigurationController, mNotificationWakeUpCoordinator,
mKeyguardBypassController, mDockManager, mKeyguardStateController, mResources,
mHeadsUpManagerPhone);
mHeadsUpManagerPhone, mAuthController);
ArgumentCaptor<OnAttachStateChangeListener> onAttachStateChangeListenerArgumentCaptor =
ArgumentCaptor.forClass(OnAttachStateChangeListener.class);

View File

@@ -58,6 +58,7 @@ import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.dagger.KeyguardStatusViewComponent;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.doze.DozeLog;
import com.android.systemui.media.MediaHierarchyManager;
@@ -194,6 +195,8 @@ public class NotificationPanelViewTest extends SysuiTestCase {
private KeyguardStatusViewController mKeyguardStatusViewController;
@Mock
private NotificationStackScrollLayoutController mNotificationStackScrollLayoutController;
@Mock
private AuthController mAuthController;
private NotificationPanelViewController mNotificationPanelViewController;
private View.AccessibilityDelegate mAccessibiltyDelegate;
@@ -201,6 +204,7 @@ public class NotificationPanelViewTest extends SysuiTestCase {
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
when(mAuthController.isUdfpsEnrolled()).thenReturn(false);
when(mHeadsUpCallback.getContext()).thenReturn(mContext);
when(mView.getResources()).thenReturn(mResources);
when(mResources.getConfiguration()).thenReturn(mConfiguration);
@@ -267,7 +271,8 @@ public class NotificationPanelViewTest extends SysuiTestCase {
mNotificationStackScrollLayoutController,
mKeyguardStatusViewComponentFactory,
mGroupManager,
mNotificationAreaController);
mNotificationAreaController,
mAuthController);
mNotificationPanelViewController.initDependencies(
mStatusBar,
mNotificationShelfController);