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

Commit 5b7793ca authored by Adrian Roos's avatar Adrian Roos Committed by Android (Google) Code Review
Browse files

Merge "Expand scrim all the way to the right" into mnc-dev

parents a1e60f1f 2f2bd9a8
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
<!-- This is the combined status bar / notification panel window. -->
<com.android.systemui.statusbar.phone.StatusBarWindowView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:sysui="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">
@@ -29,6 +30,7 @@
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:visibility="gone"
            sysui:ignoreRightInset="true"
            >
        <ImageView android:id="@+id/backdrop_back"
                   android:layout_width="match_parent"
@@ -44,7 +46,9 @@
    <com.android.systemui.statusbar.ScrimView android:id="@+id/scrim_behind"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:importantForAccessibility="no" />
        android:importantForAccessibility="no"
        sysui:ignoreRightInset="true"
        />

    <com.android.systemui.statusbar.AlphaOptimizedView
        android:id="@+id/heads_up_scrim"
@@ -89,6 +93,8 @@
    <com.android.systemui.statusbar.ScrimView android:id="@+id/scrim_in_front"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:importantForAccessibility="no" />
        android:importantForAccessibility="no"
        sysui:ignoreRightInset="true"
        />

</com.android.systemui.statusbar.phone.StatusBarWindowView>
+4 −0
Original line number Diff line number Diff line
@@ -82,5 +82,9 @@
        <attr name="fillColor" format="integer" />
        <attr name="singleToneColor" format="integer" />
    </declare-styleable>

    <declare-styleable name="StatusBarWindowView_Layout">
        <attr name="ignoreRightInset" format="boolean" />
    </declare-styleable>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -232,6 +232,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
    /** Allow some time inbetween the long press for back and recents. */
    private static final int LOCK_TO_APP_GESTURE_TOLERENCE = 200;

    /** If true, the system is in the half-boot-to-decryption-screen state.
     * Prudently disable QS and notifications.  */
    private static final boolean ONLY_CORE_APPS;

    static {
+54 −5
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone;

import android.app.StatusBarManager;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
@@ -50,6 +51,8 @@ public class StatusBarWindowView extends FrameLayout {
    private NotificationPanelView mNotificationPanel;
    private View mBrightnessMirror;

    private int mRightInset = 0;

    PhoneStatusBar mService;
    private final Paint mTransparentSrcPaint = new Paint();

@@ -63,14 +66,18 @@ public class StatusBarWindowView extends FrameLayout {
    @Override
    protected boolean fitSystemWindows(Rect insets) {
        if (getFitsSystemWindows()) {
            boolean changed = insets.left != getPaddingLeft()
            boolean paddingChanged = insets.left != getPaddingLeft()
                    || insets.top != getPaddingTop()
                    || insets.right != getPaddingRight()
                    || insets.bottom != getPaddingBottom();

            // Drop top inset, apply right and left inset and pass through bottom inset.
            if (changed) {
                setPadding(insets.left, 0, insets.right, 0);
            // Super-special right inset handling, because scrims and backdrop need to ignore it.
            if (insets.right != mRightInset) {
                mRightInset = insets.right;
                applyMargins();
            }
            // Drop top inset, apply left inset and pass through bottom inset.
            if (paddingChanged) {
                setPadding(insets.left, 0, 0, 0);
            }
            insets.left = 0;
            insets.top = 0;
@@ -88,6 +95,30 @@ public class StatusBarWindowView extends FrameLayout {
        return false;
    }

    private void applyMargins() {
        final int N = getChildCount();
        for (int i = 0; i < N; i++) {
            View child = getChildAt(i);
            if (child.getLayoutParams() instanceof LayoutParams) {
                LayoutParams lp = (LayoutParams) child.getLayoutParams();
                if (!lp.ignoreRightInset && lp.rightMargin != mRightInset) {
                    lp.rightMargin = mRightInset;
                    child.requestLayout();
                }
            }
        }
    }

    @Override
    public FrameLayout.LayoutParams generateLayoutParams(AttributeSet attrs) {
        return new LayoutParams(getContext(), attrs);
    }

    @Override
    protected FrameLayout.LayoutParams generateDefaultLayoutParams() {
        return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    }

    @Override
    protected void onAttachedToWindow () {
        super.onAttachedToWindow();
@@ -244,5 +275,23 @@ public class StatusBarWindowView extends FrameLayout {
            mStackScrollLayout.cancelExpandHelper();
        }
    }

    public class LayoutParams extends FrameLayout.LayoutParams {

        public boolean ignoreRightInset;

        public LayoutParams(int width, int height) {
            super(width, height);
        }

        public LayoutParams(Context c, AttributeSet attrs) {
            super(c, attrs);

            TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.StatusBarWindowView_Layout);
            ignoreRightInset = a.getBoolean(
                    R.styleable.StatusBarWindowView_Layout_ignoreRightInset, false);
            a.recycle();
        }
    }
}