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

Commit faf9e70c authored by axfordjc's avatar axfordjc
Browse files

flag guarding getWindowInsets()

Reading insets was needed to properly centre the lock icon.
The insets were only included when calculating the mid-point when the lockscreen.enable_landscape flag is enabled. However, the insets where read outside of flag-guarding.
Now, the insets are only read if the flag is on.

Bug: 296571001
Bug: 293252410
Bug: 300763027

Test: LockIconViewControllerTest
Change-Id: I915642c7d6afc52b1f00d0874bd0bbd215feefa1
parent 6c29a6fb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -424,11 +424,11 @@ 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
            WindowInsets insets = windowManager.getCurrentWindowMetrics().getWindowInsets();
            mWidthPixels -= insets.getSystemWindowInsetLeft() + insets.getSystemWindowInsetRight();
        }
        mHeightPixels = bounds.bottom;
+2 −2
Original line number Diff line number Diff line
@@ -29,11 +29,11 @@ import androidx.constraintlayout.widget.ConstraintSet
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.keyguard.LockIconView
import com.android.keyguard.LockIconViewController
import com.android.systemui.res.R
import com.android.systemui.biometrics.AuthController
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.keyguard.shared.model.KeyguardSection
import com.android.systemui.res.R
import com.android.systemui.shade.NotificationPanelView
import javax.inject.Inject

@@ -73,11 +73,11 @@ constructor(
        val mBottomPaddingPx =
            context.resources.getDimensionPixelSize(R.dimen.lock_icon_margin_bottom)
        val bounds = windowManager.currentWindowMetrics.bounds
        val insets = windowManager.currentWindowMetrics.windowInsets
        var widthPixels = bounds.right.toFloat()
        if (featureFlags.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.
            val insets = windowManager.currentWindowMetrics.windowInsets
            widthPixels -= (insets.systemWindowInsetLeft + insets.systemWindowInsetRight).toFloat()
        }
        val heightPixels = bounds.bottom.toFloat()