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

Commit fc546a96 authored by Thales Lima's avatar Thales Lima
Browse files

sysui: show security footer on the bottom when in split shade mode

When showing the notification shade in split mode, the security footer
should always be shown after the footer. This also updates resources to
have a best usage of configs and dimensions.

Fixes: 188906516
Test: Added tests to QSPanelTest
Change-Id: Iea29490aa73bc4fb3fe3cce82e181a22adca2937
parent 540cfa9b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -32,11 +32,11 @@
    -->
    <dimen name="qs_customize_header_min_height">48dp</dimen>

    <!--  In landscape the security footer is actually part of the header,
    and needs to be as short as the header  -->
    <dimen name="qs_security_footer_single_line_height">@*android:dimen/quick_qs_offset_height</dimen>
    <dimen name="qs_footer_padding">14dp</dimen>
    <dimen name="qs_footers_margin_bottom">0dp</dimen>
    <dimen name="qs_security_footer_background_inset">12dp</dimen>
    <dimen name="qs_security_footer_corner_radius">28dp</dimen>

    <dimen name="battery_detail_graph_space_top">9dp</dimen>
    <dimen name="battery_detail_graph_space_bottom">9dp</dimen>
+2 −0
Original line number Diff line number Diff line
@@ -38,4 +38,6 @@
    <!-- Max number of columns for quick controls area -->
    <integer name="controls_max_columns">4</integer>

    <!-- How many lines to show in the security footer -->
    <integer name="qs_security_footer_maxLines">1</integer>
</resources>
+5 −0
Original line number Diff line number Diff line
@@ -95,4 +95,9 @@
    <dimen name="controls_top_margin">24dp</dimen>

    <dimen name="global_actions_grid_item_layout_height">80dp</dimen>

    <!--  For large screens the security footer appears below the footer,
    same as phones in portrait  -->
    <dimen name="qs_security_footer_single_line_height">48dp</dimen>
    <dimen name="qs_security_footer_background_inset">0dp</dimen>
</resources>
+20 −21
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import com.android.systemui.settings.brightness.BrightnessSlider;
import com.android.systemui.statusbar.policy.BrightnessMirrorController;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.tuner.TunerService.Tunable;
import com.android.systemui.util.animation.UniqueObjectHostView;

import java.util.ArrayList;
import java.util.List;
@@ -316,7 +315,6 @@ public class QSPanel extends LinearLayout implements Tunable {
        super.onConfigurationChanged(newConfig);
        mOnConfigurationChangedListeners.forEach(
                listener -> listener.onConfigurationChange(newConfig));
        switchSecurityFooter();
    }

    @Override
@@ -359,25 +357,21 @@ public class QSPanel extends LinearLayout implements Tunable {
            switchToParent(mFooter, parent, index);
            index++;
        }

        // The security footer is switched on orientation changes
    }

    private void switchSecurityFooter() {
        if (mSecurityFooter != null) {
            if (mContext.getResources().getConfiguration().orientation
    /** Switch the security footer between top and bottom of QS depending on orientation. */
    public void switchSecurityFooter(boolean shouldUseSplitNotificationShade) {
        if (mSecurityFooter == null) return;

        if (!shouldUseSplitNotificationShade
                && mContext.getResources().getConfiguration().orientation
                == Configuration.ORIENTATION_LANDSCAPE && mHeaderContainer != null) {
            // Adding the security view to the header, that enables us to avoid scrolling
            switchToParent(mSecurityFooter, mHeaderContainer, 0);
        } else {
                // Where should this go? If there's media, right before it. Otherwise, at the end.
                View mediaView = findViewByPredicate(v -> v instanceof UniqueObjectHostView);
                int index = -1;
                if (mediaView != null) {
                    index = indexOfChild(mediaView);
                }
                switchToParent(mSecurityFooter, this, index);
            }
            // Add after the footer
            int index = indexOfChild(mFooter);
            switchToParent(mSecurityFooter, this, index + 1);
        }
    }

@@ -652,9 +646,14 @@ public class QSPanel extends LinearLayout implements Tunable {
        return mListening;
    }

    public void setSecurityFooter(View view) {
    /**
     * Set the security footer view and switch it into the right place
     * @param view the view in question
     * @param shouldUseSplitNotificationShade if QS is in split shade mode
     */
    public void setSecurityFooter(View view, boolean shouldUseSplitNotificationShade) {
        mSecurityFooter = view;
        switchSecurityFooter();
        switchSecurityFooter(shouldUseSplitNotificationShade);
    }

    protected void setPageMargin(int pageMargin) {
+2 −1
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
                refreshAllTiles();
            }
            updateBrightnessMirror();
            mView.switchSecurityFooter(mShouldUseSplitNotificationShade);
        }
    };

@@ -141,7 +142,7 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
            refreshAllTiles();
        }
        mView.addOnConfigurationChangedListener(mOnConfigurationChangedListener);
        mView.setSecurityFooter(mQsSecurityFooter.getView());
        mView.setSecurityFooter(mQsSecurityFooter.getView(), mShouldUseSplitNotificationShade);
        switchTileLayout(true);
        if (mBrightnessMirrorController != null) {
            mBrightnessMirrorController.addCallback(mBrightnessMirrorListener);
Loading