Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 676f4151 authored by axfordjc's avatar axfordjc
Browse files

Reduce lockscreen bottom area on small land screens - legacy support

See:
- ag/24656550 - Reduce lockscreen bottom area on small land screens
- this CL only 'adds support for the new lockscreen implementation'
- but this is currently also guarded by flags:
    - MIGRATE_SPLIT_KEYGUARD_BOTTOM_AREA (b/290652751)
    - MIGRATE_LOCK_ICON (b/290652751)

This CL 'adds support for the old implementation for lockscreen'

- lock icon moved downwards (reduced margins), and centred by including left + right insets when calculating midpoint (screen centre is used when UDFPS is not enabled)
- indication area moved downwards (reduced margins)

This is a required feature for landscape lockscreen for small screens

Guarded by flag "lockscreen.enable_landscape" (b/293252410)

Bug: 296571001
Bug: 293252410

Test: LockIconViewControllerTest
Change-Id: I97c1d21c13249a7e655098d44d331b5af4c41df7
parent 60485875
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.keyguard;

import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
import static android.hardware.biometrics.BiometricSourceType.FINGERPRINT;

import static com.android.keyguard.LockIconView.ICON_FINGERPRINT;
import static com.android.keyguard.LockIconView.ICON_LOCK;
import static com.android.keyguard.LockIconView.ICON_UNLOCK;
@@ -44,6 +45,7 @@ import android.view.HapticFeedbackConstants;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -422,7 +424,13 @@ public class LockIconViewController implements Dumpable {
    private void updateConfiguration() {
        WindowManager windowManager = mContext.getSystemService(WindowManager.class);
        Rect bounds = windowManager.getCurrentWindowMetrics().getBounds();
        WindowInsets insets = windowManager.getCurrentWindowMetrics().getWindowInsets();
        mWidthPixels = bounds.right;
        if (mFeatureFlags.isEnabled(Flags.LOCKSCREEN_ENABLE_LANDSCAPE)) {
            // Assumed to be initially neglected as there are no left or right insets in portrait
            // However, on landscape, these insets need to included when calculating the midpoint
            mWidthPixels -= insets.getSystemWindowInsetLeft() + insets.getSystemWindowInsetRight();
        }
        mHeightPixels = bounds.bottom;
        mBottomPaddingPx = mResources.getDimensionPixelSize(R.dimen.lock_icon_margin_bottom);
        mDefaultPaddingPx = mResources.getDimensionPixelSize(R.dimen.lock_icon_padding);
+13 −1
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import com.android.systemui.keyguard.ui.viewmodel.KeyguardBottomAreaViewModel
import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.statusbar.VibratorHelper
import com.android.systemui.util.animation.requiresRemeasuring

/**
 * Renders the bottom area of the lock-screen. Concerned primarily with the quick affordance UI
@@ -61,6 +60,7 @@ constructor(
    }

    private var ambientIndicationArea: View? = null
    private var keyguardIndicationArea: View? = null
    private var binding: KeyguardBottomAreaViewBinder.Binding? = null
    private var lockIconViewController: LockIconViewController? = null

@@ -124,8 +124,20 @@ constructor(
    override fun onConfigurationChanged(newConfig: Configuration) {
        super.onConfigurationChanged(newConfig)
        binding?.onConfigurationChanged()

        keyguardIndicationArea?.let {
            val params = it.layoutParams as FrameLayout.LayoutParams
            params.bottomMargin =
                resources.getDimensionPixelSize(R.dimen.keyguard_indication_margin_bottom)
            it.layoutParams = params
        }
    }

    /** Returns a list of animators to use to animate the indication areas. */
    @Deprecated("Deprecated as part of b/278057014")
    val indicationAreaAnimators: List<ViewPropertyAnimator>
        get() = checkNotNull(binding).getIndicationAreaAnimators()

    override fun hasOverlappingRendering(): Boolean {
        return false
    }
+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.keyguard;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession;
import static com.android.systemui.flags.Flags.DOZING_MIGRATION_1;
import static com.android.systemui.flags.Flags.FACE_AUTH_REFACTOR;
import static com.android.systemui.flags.Flags.LOCKSCREEN_ENABLE_LANDSCAPE;
import static com.android.systemui.flags.Flags.LOCKSCREEN_WALLPAPER_DREAM_ENABLED;
import static com.android.systemui.flags.Flags.MIGRATE_LOCK_ICON;

@@ -146,6 +147,7 @@ public class LockIconViewControllerBaseTest extends SysuiTestCase {
        mFeatureFlags.set(FACE_AUTH_REFACTOR, false);
        mFeatureFlags.set(MIGRATE_LOCK_ICON, false);
        mFeatureFlags.set(LOCKSCREEN_WALLPAPER_DREAM_ENABLED, false);
        mFeatureFlags.set(LOCKSCREEN_ENABLE_LANDSCAPE, false);
        mUnderTest = new LockIconViewController(
                mStatusBarStateController,
                mKeyguardUpdateMonitor,