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

Commit bf1899e6 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

BG protection for user switcher on Keyguard.

Also fixes the position.

Bug: 15757197
Bug: 15545213
Change-Id: I9fab98652ab1ccad4e02d5cfa17b212a72a0a0b3
parent 04e5f72c
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -50,12 +50,8 @@
        android:visibility="gone"
        />

    <include
        layout="@layout/keyguard_status_bar"
        android:visibility="invisible" />

    <com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer
        android:layout_width="@dimen/notification_panel_width"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="@integer/notification_panel_layout_gravity"
        android:id="@+id/notification_container_parent"
@@ -64,8 +60,9 @@

        <com.android.systemui.statusbar.phone.ObservableScrollView
            android:id="@+id/scroll_view"
            android:layout_width="match_parent"
            android:layout_width="@dimen/notification_panel_width"
            android:layout_height="match_parent"
            android:layout_gravity="@integer/notification_panel_layout_gravity"
            android:scrollbars="none"
            android:overScrollMode="never"
            android:fillViewport="true">
@@ -97,8 +94,9 @@

        <com.android.systemui.statusbar.stack.NotificationStackScrollLayout
            android:id="@+id/notification_stack_scroller"
            android:layout_width="match_parent"
            android:layout_width="@dimen/notification_panel_width"
            android:layout_height="match_parent"
            android:layout_gravity="@integer/notification_panel_layout_gravity"
            android:layout_marginBottom="@dimen/close_handle_underlap"/>

        <ViewStub
@@ -109,6 +107,10 @@
            android:layout_gravity="end"
            android:layout="@layout/keyguard_user_switcher" />

        <include
            layout="@layout/keyguard_status_bar"
            android:visibility="invisible" />

    </com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer>

    <include layout="@layout/status_bar_expanded_header" />
+0 −3
Original line number Diff line number Diff line
@@ -72,9 +72,6 @@
    <!-- Margin on the left side of the carrier text on Keyguard -->
    <dimen name="keyguard_carrier_text_margin">24dp</dimen>

    <!-- end margin for system icons if multi user switch is hidden -->
    <dimen name="system_icons_switcher_hidden_expanded_margin">20dp</dimen>

    <!-- The width/height of the phone/camera/unlock icon on keyguard. -->
    <dimen name="keyguard_affordance_height">80dp</dimen>
    <dimen name="keyguard_affordance_width">120dp</dimen>
+2 −0
Original line number Diff line number Diff line
@@ -103,4 +103,6 @@
    <color name="notification_guts_btn_color">#FFFFFFFF</color>

    <color name="search_panel_card_color">#ffffff</color>

    <color name="keyguard_user_switcher_background_gradient_color">#77000000</color>
</resources>
+18 −2
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import com.android.systemui.statusbar.GestureRecorder;
import com.android.systemui.statusbar.KeyguardAffordanceView;
import com.android.systemui.statusbar.MirrorView;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.stack.StackStateAnimator;

@@ -62,6 +63,7 @@ public class NotificationPanelView extends PanelView implements

    private KeyguardAffordanceHelper mAfforanceHelper;
    private StatusBarHeaderView mHeader;
    private KeyguardUserSwitcher mKeyguardUserSwitcher;
    private KeyguardStatusBarView mKeyguardStatusBar;
    private View mQsContainer;
    private QSPanel mQsPanel;
@@ -225,11 +227,18 @@ public class NotificationPanelView extends PanelView implements
            mHeader.post(mUpdateHeader);
        }

        lp = (FrameLayout.LayoutParams) mNotificationContainerParent.getLayoutParams();
        lp = (FrameLayout.LayoutParams) mNotificationStackScroller.getLayoutParams();
        if (lp.width != panelWidth) {
            lp.width = panelWidth;
            lp.gravity = panelGravity;
            mNotificationContainerParent.setLayoutParams(lp);
            mNotificationStackScroller.setLayoutParams(lp);
        }

        lp = (FrameLayout.LayoutParams) mScrollView.getLayoutParams();
        if (lp.width != panelWidth) {
            lp.width = panelWidth;
            lp.gravity = panelGravity;
            mScrollView.setLayoutParams(lp);
        }
    }

@@ -939,6 +948,9 @@ public class NotificationPanelView extends PanelView implements
                && !mStackScrollerOverscrolling && mQsScrimEnabled
                        ? View.VISIBLE
                        : View.INVISIBLE);
        if (mKeyguardUserSwitcher != null && mQsExpanded && !mStackScrollerOverscrolling) {
            mKeyguardUserSwitcher.hide();
        }
    }

    private void setQsExpansion(float height) {
@@ -1704,6 +1716,10 @@ public class NotificationPanelView extends PanelView implements
        }
    }

    public void setKeyguardUserSwitcher(KeyguardUserSwitcher keyguardUserSwitcher) {
        mKeyguardUserSwitcher = keyguardUserSwitcher;
    }

    private final Runnable mUpdateHeader = new Runnable() {
        @Override
        public void run() {
+17 −3
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ public class NotificationsQuickSettingsContainer extends FrameLayout
    private View mScrollView;
    private View mUserSwitcher;
    private View mStackScroller;
    private View mKeyguardStatusBar;
    private boolean mInflated;

    public NotificationsQuickSettingsContainer(Context context, AttributeSet attrs) {
@@ -46,6 +47,7 @@ public class NotificationsQuickSettingsContainer extends FrameLayout
        super.onFinishInflate();
        mScrollView = findViewById(R.id.scroll_view);
        mStackScroller = findViewById(R.id.notification_stack_scroller);
        mKeyguardStatusBar = findViewById(R.id.keyguard_header);
        ViewStub userSwitcher = (ViewStub) findViewById(R.id.keyguard_user_switcher);
        userSwitcher.setOnInflateListener(this);
        mUserSwitcher = userSwitcher;
@@ -61,16 +63,28 @@ public class NotificationsQuickSettingsContainer extends FrameLayout
    @Override
    protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
        boolean userSwitcherVisible = mInflated && mUserSwitcher.getVisibility() == View.VISIBLE;
        boolean statusBarVisible = mKeyguardStatusBar.getVisibility() == View.VISIBLE;

        // Invert the order of the scroll view and user switcher such that the notifications receive
        // touches first but the panel gets drawn above.
        if (child == mScrollView) {
            return super.drawChild(canvas, mStackScroller, drawingTime);
        } else if (child == mStackScroller) {
            return super.drawChild(canvas, userSwitcherVisible ? mUserSwitcher : mScrollView,
            return super.drawChild(canvas,
                    userSwitcherVisible && statusBarVisible ? mUserSwitcher
                    : statusBarVisible ? mKeyguardStatusBar
                    : userSwitcherVisible ? mUserSwitcher
                    : mScrollView,
                    drawingTime);
        } else if (child == mUserSwitcher) {
            return super.drawChild(canvas, userSwitcherVisible ? mScrollView : mUserSwitcher,
            return super.drawChild(canvas,
                    userSwitcherVisible && statusBarVisible ? mKeyguardStatusBar
                    : mScrollView,
                    drawingTime);
        } else if (child == mKeyguardStatusBar) {
            return super.drawChild(canvas,
                    userSwitcherVisible && statusBarVisible ? mScrollView
                    : mScrollView,
                    drawingTime);
        }else {
            return super.drawChild(canvas, child, drawingTime);
Loading