Loading packages/SystemUI/src/com/android/systemui/scene/ui/view/WindowRootView.kt +12 −29 Original line number Diff line number Diff line Loading @@ -30,19 +30,14 @@ import com.android.systemui.compose.ComposeInitializer import com.android.systemui.res.R /** A view that can serve as the root of the main SysUI window. */ open class WindowRootView( context: Context, attrs: AttributeSet?, ) : FrameLayout( context, attrs, ) { open class WindowRootView(context: Context, attrs: AttributeSet?) : FrameLayout(context, attrs) { private lateinit var layoutInsetsController: LayoutInsetsController private var leftInset = 0 private var rightInset = 0 private var previousInsets: WindowInsets? = null override fun onAttachedToWindow() { super.onAttachedToWindow() Loading @@ -66,11 +61,14 @@ open class WindowRootView( override fun generateDefaultLayoutParams(): FrameLayout.LayoutParams? { return LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT FrameLayout.LayoutParams.MATCH_PARENT, ) } override fun onApplyWindowInsets(windowInsets: WindowInsets): WindowInsets? { if (windowInsets == previousInsets) { return windowInsets } val insets = windowInsets.getInsetsIgnoringVisibility(WindowInsets.Type.systemBars()) if (fitsSystemWindows) { val paddingChanged = insets.top != paddingTop || insets.bottom != paddingBottom Loading @@ -95,7 +93,7 @@ open class WindowRootView( leftInset = pairInsets.first rightInset = pairInsets.second applyMargins() return windowInsets return windowInsets.also { previousInsets = WindowInsets(it) } } fun setLayoutInsetsController(layoutInsetsController: LayoutInsetsController) { Loading Loading @@ -143,37 +141,22 @@ open class WindowRootView( interface LayoutInsetsController { /** Update the insets and calculate them accordingly. */ fun getinsets( windowInsets: WindowInsets?, displayCutout: DisplayCutout?, ): Pair<Int, Int> fun getinsets(windowInsets: WindowInsets?, displayCutout: DisplayCutout?): Pair<Int, Int> } private class LayoutParams : FrameLayout.LayoutParams { var ignoreRightInset = false constructor( width: Int, height: Int, ) : super( width, height, ) constructor(width: Int, height: Int) : super(width, height) @SuppressLint("CustomViewStyleable") constructor( context: Context, attrs: AttributeSet?, ) : super( context, attrs, ) { constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { val obtainedAttributes = context.obtainStyledAttributes(attrs, R.styleable.StatusBarWindowView_Layout) ignoreRightInset = obtainedAttributes.getBoolean( R.styleable.StatusBarWindowView_Layout_ignoreRightInset, false false, ) obtainedAttributes.recycle() } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java +10 −3 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import kotlinx.coroutines.flow.StateFlowKt; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Objects; /** * The header group on Keyguard. Loading Loading @@ -103,6 +104,9 @@ public class KeyguardStatusBarView extends RelativeLayout { */ private int mCutoutSideNudge = 0; @Nullable private WindowInsets mPreviousInsets = null; private DisplayCutout mDisplayCutout; private int mRoundedCornerPadding = 0; // right and left padding applied to this view to account for cutouts and rounded corners Loading Loading @@ -284,10 +288,13 @@ public class KeyguardStatusBarView extends RelativeLayout { WindowInsets updateWindowInsets( WindowInsets insets, StatusBarContentInsetsProvider insetsProvider) { if (!Objects.equals(mPreviousInsets, insets)) { mLayoutState = LAYOUT_NONE; if (updateLayoutConsideringCutout(insetsProvider)) { requestLayout(); } mPreviousInsets = new WindowInsets(insets); } return super.onApplyWindowInsets(insets); } Loading Loading
packages/SystemUI/src/com/android/systemui/scene/ui/view/WindowRootView.kt +12 −29 Original line number Diff line number Diff line Loading @@ -30,19 +30,14 @@ import com.android.systemui.compose.ComposeInitializer import com.android.systemui.res.R /** A view that can serve as the root of the main SysUI window. */ open class WindowRootView( context: Context, attrs: AttributeSet?, ) : FrameLayout( context, attrs, ) { open class WindowRootView(context: Context, attrs: AttributeSet?) : FrameLayout(context, attrs) { private lateinit var layoutInsetsController: LayoutInsetsController private var leftInset = 0 private var rightInset = 0 private var previousInsets: WindowInsets? = null override fun onAttachedToWindow() { super.onAttachedToWindow() Loading @@ -66,11 +61,14 @@ open class WindowRootView( override fun generateDefaultLayoutParams(): FrameLayout.LayoutParams? { return LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT FrameLayout.LayoutParams.MATCH_PARENT, ) } override fun onApplyWindowInsets(windowInsets: WindowInsets): WindowInsets? { if (windowInsets == previousInsets) { return windowInsets } val insets = windowInsets.getInsetsIgnoringVisibility(WindowInsets.Type.systemBars()) if (fitsSystemWindows) { val paddingChanged = insets.top != paddingTop || insets.bottom != paddingBottom Loading @@ -95,7 +93,7 @@ open class WindowRootView( leftInset = pairInsets.first rightInset = pairInsets.second applyMargins() return windowInsets return windowInsets.also { previousInsets = WindowInsets(it) } } fun setLayoutInsetsController(layoutInsetsController: LayoutInsetsController) { Loading Loading @@ -143,37 +141,22 @@ open class WindowRootView( interface LayoutInsetsController { /** Update the insets and calculate them accordingly. */ fun getinsets( windowInsets: WindowInsets?, displayCutout: DisplayCutout?, ): Pair<Int, Int> fun getinsets(windowInsets: WindowInsets?, displayCutout: DisplayCutout?): Pair<Int, Int> } private class LayoutParams : FrameLayout.LayoutParams { var ignoreRightInset = false constructor( width: Int, height: Int, ) : super( width, height, ) constructor(width: Int, height: Int) : super(width, height) @SuppressLint("CustomViewStyleable") constructor( context: Context, attrs: AttributeSet?, ) : super( context, attrs, ) { constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { val obtainedAttributes = context.obtainStyledAttributes(attrs, R.styleable.StatusBarWindowView_Layout) ignoreRightInset = obtainedAttributes.getBoolean( R.styleable.StatusBarWindowView_Layout_ignoreRightInset, false false, ) obtainedAttributes.recycle() } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java +10 −3 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import kotlinx.coroutines.flow.StateFlowKt; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Objects; /** * The header group on Keyguard. Loading Loading @@ -103,6 +104,9 @@ public class KeyguardStatusBarView extends RelativeLayout { */ private int mCutoutSideNudge = 0; @Nullable private WindowInsets mPreviousInsets = null; private DisplayCutout mDisplayCutout; private int mRoundedCornerPadding = 0; // right and left padding applied to this view to account for cutouts and rounded corners Loading Loading @@ -284,10 +288,13 @@ public class KeyguardStatusBarView extends RelativeLayout { WindowInsets updateWindowInsets( WindowInsets insets, StatusBarContentInsetsProvider insetsProvider) { if (!Objects.equals(mPreviousInsets, insets)) { mLayoutState = LAYOUT_NONE; if (updateLayoutConsideringCutout(insetsProvider)) { requestLayout(); } mPreviousInsets = new WindowInsets(insets); } return super.onApplyWindowInsets(insets); } Loading