From b65b62304f4b31432fe9634c80394d054584da90 Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Wed, 14 Apr 2021 10:40:13 -0400 Subject: [PATCH] Remove QS flag Completely remove the flag and clean up old layouts and some old code. Test: manual Bug: 185250134 Change-Id: I539de8f3a80814b2e386d7ebbf7013d4f60ef67e --- .../res/layout/qs_customize_panel_content.xml | 2 - .../SystemUI/res/layout/qs_footer_impl.xml | 158 +++++++++-------- .../res/layout/qs_footer_impl_two_lines.xml | 159 ------------------ .../SystemUI/res/layout/qs_paged_page.xml | 5 +- .../res/layout/qs_paged_page_side_labels.xml | 23 --- .../res/layout/qs_paged_tile_layout.xml | 5 +- .../qs_paged_tile_layout_side_labels.xml | 27 --- packages/SystemUI/res/layout/qs_panel.xml | 5 +- packages/SystemUI/res/values/attrs.xml | 4 - packages/SystemUI/res/values/flags.xml | 2 - .../android/systemui/qs/PagedTileLayout.java | 32 +--- .../com/android/systemui/qs/QSAnimator.java | 100 ++++------- .../android/systemui/qs/QSContainerImpl.java | 4 - .../com/android/systemui/qs/QSFooterView.java | 8 - .../src/com/android/systemui/qs/QSPanel.java | 93 +--------- .../systemui/qs/QSPanelController.java | 6 - .../systemui/qs/QSPanelControllerBase.java | 5 +- .../com/android/systemui/qs/QuickQSPanel.java | 25 +-- .../systemui/qs/customize/QSCustomizer.java | 13 -- .../systemui/qs/customize/TileAdapter.java | 26 +-- .../systemui/qs/dagger/QSFlagsModule.java | 9 +- .../systemui/qs/tileimpl/QSFactoryImpl.java | 16 +- .../systemui/qs/tileimpl/QSTileImpl.java | 4 +- .../systemui/statusbar/FeatureFlags.java | 5 - .../com/android/systemui/qs/QSPanelTest.java | 2 +- .../qs/customize/TileAdapterTest.java | 2 +- 26 files changed, 154 insertions(+), 586 deletions(-) delete mode 100644 packages/SystemUI/res/layout/qs_footer_impl_two_lines.xml delete mode 100644 packages/SystemUI/res/layout/qs_paged_page_side_labels.xml delete mode 100644 packages/SystemUI/res/layout/qs_paged_tile_layout_side_labels.xml diff --git a/packages/SystemUI/res/layout/qs_customize_panel_content.xml b/packages/SystemUI/res/layout/qs_customize_panel_content.xml index 7cce1ba36bd93..6a1be81dadf56 100644 --- a/packages/SystemUI/res/layout/qs_customize_panel_content.xml +++ b/packages/SystemUI/res/layout/qs_customize_panel_content.xml @@ -45,8 +45,6 @@ android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" - android:paddingLeft="@dimen/qs_tile_layout_margin_side" - android:paddingRight="@dimen/qs_tile_layout_margin_side" android:paddingBottom="28dp" android:clipToPadding="false" android:scrollIndicators="top" diff --git a/packages/SystemUI/res/layout/qs_footer_impl.xml b/packages/SystemUI/res/layout/qs_footer_impl.xml index 02179722b35c5..343b398e30036 100644 --- a/packages/SystemUI/res/layout/qs_footer_impl.xml +++ b/packages/SystemUI/res/layout/qs_footer_impl.xml @@ -1,6 +1,6 @@ - + android:orientation="vertical"> + + + + + + + + + + + + - - - - - - - - - - + android:tint="?android:attr/colorForeground" /> + android:scaleType="centerInside" /> + android:src="@drawable/ic_settings" + android:tint="?android:attr/colorForeground" /> + android:visibility="invisible" /> - + + + + + diff --git a/packages/SystemUI/res/layout/qs_footer_impl_two_lines.xml b/packages/SystemUI/res/layout/qs_footer_impl_two_lines.xml deleted file mode 100644 index 343b398e30036..0000000000000 --- a/packages/SystemUI/res/layout/qs_footer_impl_two_lines.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/SystemUI/res/layout/qs_paged_page.xml b/packages/SystemUI/res/layout/qs_paged_page.xml index 5c8b2b08324f0..c83077371bb06 100644 --- a/packages/SystemUI/res/layout/qs_paged_page.xml +++ b/packages/SystemUI/res/layout/qs_paged_page.xml @@ -1,6 +1,6 @@ - - - diff --git a/packages/SystemUI/res/layout/qs_paged_tile_layout.xml b/packages/SystemUI/res/layout/qs_paged_tile_layout.xml index 46a7cf6440bbc..c3f11138129f7 100644 --- a/packages/SystemUI/res/layout/qs_paged_tile_layout.xml +++ b/packages/SystemUI/res/layout/qs_paged_tile_layout.xml @@ -1,6 +1,6 @@ - - diff --git a/packages/SystemUI/res/layout/qs_panel.xml b/packages/SystemUI/res/layout/qs_panel.xml index dc595eecf8901..dbe1c614e1967 100644 --- a/packages/SystemUI/res/layout/qs_panel.xml +++ b/packages/SystemUI/res/layout/qs_panel.xml @@ -43,10 +43,7 @@ android:background="@android:color/transparent" android:focusable="true" android:accessibilityTraversalBefore="@android:id/edit"> - + diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml index e4bdbf3f0727e..f489fe846ff3a 100644 --- a/packages/SystemUI/res/values/attrs.xml +++ b/packages/SystemUI/res/values/attrs.xml @@ -176,10 +176,6 @@ - - - - diff --git a/packages/SystemUI/res/values/flags.xml b/packages/SystemUI/res/values/flags.xml index 088ea08025c14..5827f4e6ad3a6 100644 --- a/packages/SystemUI/res/values/flags.xml +++ b/packages/SystemUI/res/values/flags.xml @@ -28,8 +28,6 @@ false - true - false diff --git a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java index 32723b4db6a39..f7fa5bfc42488 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java +++ b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java @@ -8,7 +8,6 @@ import android.animation.PropertyValuesHolder; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; -import android.content.res.TypedArray; import android.graphics.Rect; import android.os.Bundle; import android.util.AttributeSet; @@ -71,8 +70,6 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { private int mMinRows = 1; private int mMaxColumns = TileLayout.NO_MAX_COLUMNS; - private final boolean mSideLabels; - public PagedTileLayout(Context context, AttributeSet attrs) { super(context, attrs); mScroller = new Scroller(context, SCROLL_CUBIC); @@ -83,14 +80,9 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { mLayoutDirection = getLayoutDirection(); mClippingRect = new Rect(); - TypedArray t = context.getTheme().obtainStyledAttributes( - attrs, R.styleable.PagedTileLayout, 0, 0); - mSideLabels = t.getBoolean(R.styleable.PagedTileLayout_sideLabels, false); - t.recycle(); - if (mSideLabels) { - setPageMargin(context.getResources().getDimensionPixelOffset( + // Make sure there's a space between pages when scroling + setPageMargin(context.getResources().getDimensionPixelOffset( R.dimen.qs_tile_margin_horizontal)); - } } private int mLastMaxHeight = -1; @@ -228,8 +220,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { private TileLayout createTileLayout() { TileLayout page = (TileLayout) LayoutInflater.from(getContext()) - .inflate(mSideLabels ? R.layout.qs_paged_page_side_labels - : R.layout.qs_paged_page, this, false); + .inflate(R.layout.qs_paged_page, this, false); page.setMinRows(mMinRows); page.setMaxColumns(mMaxColumns); return page; @@ -345,9 +336,8 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { // Update bottom padding, useful for removing extra space once the panel page indicator is // hidden. Resources res = getContext().getResources(); - if (mSideLabels) { - setPageMargin(res.getDimensionPixelOffset(R.dimen.qs_tile_margin_horizontal)); - } + setPageMargin(res.getDimensionPixelOffset(R.dimen.qs_tile_margin_horizontal)); + setPadding(0, 0, 0, getContext().getResources().getDimensionPixelSize( R.dimen.qs_paged_tile_layout_padding_bottom)); @@ -550,18 +540,6 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { } }; - public static class TilePage extends TileLayout { - - public TilePage(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public boolean isFull() { - return mRecords.size() >= maxTiles(); - } - - } - private final PagerAdapter mAdapter = new PagerAdapter() { @Override public void destroyItem(ViewGroup container, int position, Object object) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java index ea471b957d684..cefcd4a5194c1 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java @@ -33,7 +33,6 @@ import com.android.systemui.qs.TouchAnimator.Listener; import com.android.systemui.qs.dagger.QSScope; import com.android.systemui.qs.tileimpl.HeightOverrideable; import com.android.systemui.statusbar.CrossFadeHelper; -import com.android.systemui.statusbar.FeatureFlags; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService.Tunable; @@ -102,14 +101,13 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha private final Executor mExecutor; private final TunerService mTunerService; private boolean mShowCollapsedOnKeyguard; - private final FeatureFlags mFeatureFlags; @Inject public QSAnimator(QS qs, QuickQSPanel quickPanel, QuickStatusBarHeader quickStatusBarHeader, QSPanelController qsPanelController, QuickQSPanelController quickQSPanelController, QSTileHost qsTileHost, QSSecurityFooter securityFooter, @Main Executor executor, TunerService tunerService, - FeatureFlags featureFlags, QSExpansionPathInterpolator qsExpansionPathInterpolator) { + QSExpansionPathInterpolator qsExpansionPathInterpolator) { mQs = qs; mQuickQsPanel = quickPanel; mQsPanelController = qsPanelController; @@ -119,7 +117,6 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha mHost = qsTileHost; mExecutor = executor; mTunerService = tunerService; - mFeatureFlags = featureFlags; mQSExpansionPathInterpolator = qsExpansionPathInterpolator; mHost.addCallback(this); mQsPanelController.addOnAttachStateChangeListener(this); @@ -247,7 +244,6 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha + mQs.getHeader().getPaddingBottom(); firstPageBuilder.addFloat(tileLayout, "translationY", heightDiff, 0); - boolean qsSideLabelsEnabled = mFeatureFlags.isQSLabelsEnabled(); int qqsTileHeight = 0; if (mQsPanelController.areThereTiles()) { @@ -275,22 +271,19 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha if (count < tileLayout.getNumVisibleTiles()) { getRelativePosition(loc1, quickTileView, view); getRelativePosition(loc2, tileView, view); - int yOffset = qsSideLabelsEnabled - ? loc2[1] - loc1[1] - : mQuickStatusBarHeader.getOffsetTranslation(); + int yOffset = loc2[1] - loc1[1]; // Move the quick tile right from its location to the new one. - View v = qsSideLabelsEnabled ? quickTileView.getIcon() : quickTileView; + View v = quickTileView.getIcon(); translationXBuilder.addFloat(v, "translationX", 0, xDiff); translationYBuilder.addFloat(v, "translationY", 0, yDiff - yOffset); mAllViews.add(v); // Move the real tile from the quick tile position to its final // location. - v = qsSideLabelsEnabled ? tileIcon : tileView; + v = tileIcon; translationXBuilder.addFloat(v, "translationX", -xDiff, 0); translationYBuilder.addFloat(v, "translationY", -yDiff + yOffset, 0); - if (qsSideLabelsEnabled) { // Offset the translation animation on the views // (that goes from 0 to getOffsetTranslation) int offsetWithQSBHTranslation = @@ -300,28 +293,24 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha translationYBuilder.addFloat(tileView, "translationY", -offsetWithQSBHTranslation, 0); - if (mQQSTileHeightAnimator == null) { - mQQSTileHeightAnimator = new HeightExpansionAnimator(this, - quickTileView.getHeight(), tileView.getHeight()); - qqsTileHeight = quickTileView.getHeight(); - } - - mQQSTileHeightAnimator.addView(quickTileView); - View qqsLabelContainer = quickTileView.getLabelContainer(); - View qsLabelContainer = tileView.getLabelContainer(); - - getRelativePosition(loc1, qqsLabelContainer, view); - getRelativePosition(loc2, qsLabelContainer, view); - yDiff = loc2[1] - loc1[1] - yOffset; - - translationYBuilder.addFloat(qqsLabelContainer, "translationY", 0, - yDiff); - translationYBuilder.addFloat(qsLabelContainer, "translationY", -yDiff, - 0); - mAllViews.add(qqsLabelContainer); - mAllViews.add(qsLabelContainer); + if (mQQSTileHeightAnimator == null) { + mQQSTileHeightAnimator = new HeightExpansionAnimator(this, + quickTileView.getHeight(), tileView.getHeight()); + qqsTileHeight = quickTileView.getHeight(); } + mQQSTileHeightAnimator.addView(quickTileView); + View qqsLabelContainer = quickTileView.getLabelContainer(); + View qsLabelContainer = tileView.getLabelContainer(); + + getRelativePosition(loc1, qqsLabelContainer, view); + getRelativePosition(loc2, qsLabelContainer, view); + yDiff = loc2[1] - loc1[1] - yOffset; + + translationYBuilder.addFloat(qqsLabelContainer, "translationY", 0, yDiff); + translationYBuilder.addFloat(qsLabelContainer, "translationY", -yDiff, 0); + mAllViews.add(qqsLabelContainer); + mAllViews.add(qsLabelContainer); } else { // These tiles disappear when expanding firstPageBuilder.addFloat(quickTileView, "alpha", 1, 0); translationYBuilder.addFloat(quickTileView, "translationY", 0, yDiff); @@ -333,11 +322,7 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha translationX); } - if (qsSideLabelsEnabled) { - mQuickQsViews.add(tileView); - } else { - mQuickQsViews.add(tileView.getIconWithBackground()); - } + mQuickQsViews.add(tileView); mAllViews.add(tileView.getIcon()); mAllViews.add(quickTileView); } else if (mFullRows && isIconInAnimatedRow(count)) { @@ -346,27 +331,22 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha mAllViews.add(tileIcon); } else { - if (!qsSideLabelsEnabled) { - firstPageBuilder.addFloat(tileView, "alpha", 0, 1); - firstPageBuilder.addFloat(tileView, "translationY", -heightDiff, 0); - } else { - // Pretend there's a corresponding QQS tile (for the position) that we are - // expanding from. - SideLabelTileLayout qqsLayout = - (SideLabelTileLayout) mQuickQsPanel.getTileLayout(); - getRelativePosition(loc1, qqsLayout, view); - getRelativePosition(loc2, tileView, view); - int diff = loc2[1] - (loc1[1] + qqsLayout.getPhantomTopPosition(count)); - translationYBuilder.addFloat(tileView, "translationY", -diff, 0); - if (mOtherTilesExpandAnimator == null) { - mOtherTilesExpandAnimator = - new HeightExpansionAnimator( - this, qqsTileHeight, tileView.getHeight()); - } - mOtherTilesExpandAnimator.addView(tileView); - tileView.setClipChildren(true); - tileView.setClipToPadding(true); + // Pretend there's a corresponding QQS tile (for the position) that we are + // expanding from. + SideLabelTileLayout qqsLayout = + (SideLabelTileLayout) mQuickQsPanel.getTileLayout(); + getRelativePosition(loc1, qqsLayout, view); + getRelativePosition(loc2, tileView, view); + int diff = loc2[1] - (loc1[1] + qqsLayout.getPhantomTopPosition(count)); + translationYBuilder.addFloat(tileView, "translationY", -diff, 0); + if (mOtherTilesExpandAnimator == null) { + mOtherTilesExpandAnimator = + new HeightExpansionAnimator( + this, qqsTileHeight, tileView.getHeight()); } + mOtherTilesExpandAnimator.addView(tileView); + tileView.setClipChildren(true); + tileView.setClipToPadding(true); } mAllViews.add(tileView); @@ -392,7 +372,6 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha .build(); // Fade in the tiles/labels as we reach the final position. Builder builder = new Builder() - .setStartDelay(qsSideLabelsEnabled ? 0 : EXPANDED_TILE_DELAY) .addFloat(tileLayout, "alpha", 0, 1); mFirstPageDelayedAnimator = builder.build(); @@ -470,12 +449,7 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha // Returns true if the view is a possible page in PagedTileLayout private boolean isAPage(View view) { - if (view instanceof PagedTileLayout.TilePage) { - return true; - } else if (view instanceof SideLabelTileLayout) { - return !(view instanceof QuickQSPanel.QQSSideLabelTileLayout); - } - return false; + return view.getClass().equals(SideLabelTileLayout.class); } public void setPosition(float position) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java index 5256bc45b7b5d..4ab44c75a8ed6 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java @@ -22,7 +22,6 @@ import android.content.Context; import android.content.res.Configuration; import android.graphics.Point; import android.util.AttributeSet; -import android.util.Pair; import android.view.View; import android.widget.FrameLayout; @@ -288,9 +287,6 @@ public class QSContainerImpl extends FrameLayout { if (view == mQSPanelContainer) { // QS panel lays out some of its content full width qsPanelController.setContentMargins(mContentPadding, mContentPadding); - Pair margins = qsPanelController.getVisualSideMargins(); - // Apply paddings based on QSPanel - mQSCustomizer.setContentPaddings(margins.first, margins.second); } else if (view == mHeader) { // The header contains the QQS panel which needs to have special padding, to // visually align them. diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooterView.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooterView.java index eb7b115700a76..37187135968e7 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFooterView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooterView.java @@ -71,7 +71,6 @@ public class QSFooterView extends FrameLayout { private float mExpansionAmount; protected View mEdit; - protected View mEditContainer; private TouchAnimator mSettingsCogAnimator; private View mActionsContainer; @@ -107,7 +106,6 @@ public class QSFooterView extends FrameLayout { mMultiUserAvatar = mMultiUserSwitch.findViewById(R.id.multi_user_avatar); mActionsContainer = requireViewById(R.id.qs_footer_actions_container); - mEditContainer = findViewById(R.id.qs_footer_actions_edit_container); mBuildText = findViewById(R.id.build); mTunerIcon = requireViewById(R.id.tuner_icon); @@ -185,9 +183,6 @@ public class QSFooterView extends FrameLayout { .addFloat(mPageIndicator, "alpha", 0, 1) .addFloat(mBuildText, "alpha", 0, 1) .setStartDelay(0.9f); - if (mEditContainer != null) { - builder.addFloat(mEditContainer, "alpha", 0, 1); - } return builder.build(); } @@ -283,9 +278,6 @@ public class QSFooterView extends FrameLayout { mTunerIcon.setVisibility(isTunerEnabled ? View.VISIBLE : View.INVISIBLE); final boolean isDemo = UserManager.isDeviceInDemoMode(mContext); mMultiUserSwitch.setVisibility(showUserSwitcher() ? View.VISIBLE : View.GONE); - if (mEditContainer != null) { - mEditContainer.setVisibility(isDemo || !mExpanded ? View.INVISIBLE : View.VISIBLE); - } mSettingsButton.setVisibility(isDemo || !mExpanded ? View.INVISIBLE : View.VISIBLE); mBuildText.setVisibility(mExpanded && mShouldShowBuildText ? View.VISIBLE : View.GONE); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 27cc2687606b8..f89e70a08cc7e 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -27,12 +27,10 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.AttributeSet; -import android.util.Pair; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.view.ViewStub; import android.widget.LinearLayout; import com.android.internal.logging.UiEventLogger; @@ -72,8 +70,6 @@ public class QSPanel extends LinearLayout implements Tunable { private final H mHandler = new H(); /** Whether or not the QS media player feature is enabled. */ protected boolean mUsingMediaPlayer; - private int mVisualMarginStart; - private int mVisualMarginEnd; protected boolean mExpanded; protected boolean mListening; @@ -96,7 +92,6 @@ public class QSPanel extends LinearLayout implements Tunable { private PageIndicator mFooterPageIndicator; private int mContentMarginStart; private int mContentMarginEnd; - private int mVisualTilePadding; private boolean mUsingHorizontalLayout; private Record mDetailRecord; @@ -111,9 +106,7 @@ public class QSPanel extends LinearLayout implements Tunable { protected QSTileLayout mTileLayout; private int mLastOrientation = -1; private int mMediaTotalBottomMargin; - private int mFooterMarginStartHorizontal; private Consumer mMediaVisibilityChangedListener; - protected boolean mSideLabels; public QSPanel(Context context, AttributeSet attrs) { super(context, attrs); @@ -128,21 +121,7 @@ public class QSPanel extends LinearLayout implements Tunable { } - protected void inflateQSFooter(boolean newFooter) { - ViewStub stub = findViewById(R.id.qs_footer_stub); - if (stub != null) { - stub.setLayoutResource( - newFooter ? R.layout.qs_footer_impl_two_lines : R.layout.qs_footer_impl); - stub.inflate(); - mFooter = findViewById(R.id.qs_footer); - } - } - - void initialize(boolean sideLabels) { - mSideLabels = sideLabels; - - inflateQSFooter(sideLabels); - + void initialize() { mRegularTileLayout = createRegularTileLayout(); mTileLayout = mRegularTileLayout; @@ -195,8 +174,7 @@ public class QSPanel extends LinearLayout implements Tunable { public QSTileLayout createRegularTileLayout() { if (mRegularTileLayout == null) { mRegularTileLayout = (QSTileLayout) LayoutInflater.from(mContext) - .inflate(mSideLabels ? R.layout.qs_paged_tile_layout_side_labels - : R.layout.qs_paged_tile_layout, this, false); + .inflate(R.layout.qs_paged_tile_layout, this, false); } return mRegularTileLayout; } @@ -311,11 +289,6 @@ public class QSPanel extends LinearLayout implements Tunable { } public void updateResources() { - int tileSize = getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_size); - int tileBg = getResources().getDimensionPixelSize(R.dimen.qs_tile_background_size); - mFooterMarginStartHorizontal = getResources().getDimensionPixelSize( - R.dimen.qs_footer_horizontal_margin); - mVisualTilePadding = mSideLabels ? 0 : (int) ((tileSize - tileBg) / 2.0f); updatePadding(); updatePageIndicator(); @@ -358,6 +331,7 @@ public class QSPanel extends LinearLayout implements Tunable { @Override protected void onFinishInflate() { super.onFinishInflate(); + mFooter = findViewById(R.id.qs_footer); mDivider = findViewById(R.id.divider); } @@ -638,60 +612,10 @@ public class QSPanel extends LinearLayout implements Tunable { // to the edge like the brightness slider mContentMarginStart = startMargin; mContentMarginEnd = endMargin; - updateTileLayoutMargins(mContentMarginStart - mVisualTilePadding, - mContentMarginEnd - mVisualTilePadding); updateMediaHostContentMargins(mediaHostView); - updateFooterMargin(); updateDividerMargin(); } - private void updateFooterMargin() { - if (mFooter != null) { - int footerMargin = 0; - int indicatorMargin = 0; - if (mUsingHorizontalLayout && !mSideLabels) { - footerMargin = mFooterMarginStartHorizontal; - indicatorMargin = footerMargin - mVisualMarginEnd; - } - updateMargins(mFooter, footerMargin, 0); - // The page indicator isn't centered anymore because of the visual positioning. - // Let's fix it by adding some margin - if (mFooterPageIndicator != null) { - updateMargins(mFooterPageIndicator, 0, indicatorMargin); - } - } - } - - /** - * Update the margins of all tile Layouts. - * - * @param visualMarginStart the visual start margin of the tile, adjusted for local insets - * to the tile. This can be set on a tileLayout - * @param visualMarginEnd the visual end margin of the tile, adjusted for local insets - * to the tile. This can be set on a tileLayout - */ - private void updateTileLayoutMargins(int visualMarginStart, int visualMarginEnd) { - mVisualMarginStart = visualMarginStart; - mVisualMarginEnd = visualMarginEnd; - updateTileLayoutMargins(); - } - - public Pair getVisualSideMargins() { - if (mSideLabels) { - return new Pair(0, 0); - } else { - return new Pair(mVisualMarginStart, mUsingHorizontalLayout ? 0 : mVisualMarginEnd); - } - } - - private void updateTileLayoutMargins() { - int marginEnd = mVisualMarginEnd; - if (mUsingHorizontalLayout || mSideLabels) { - marginEnd = 0; - } - updateMargins((View) mTileLayout, mSideLabels ? 0 : mVisualMarginStart, marginEnd); - } - private void updateDividerMargin() { if (mDivider == null) return; updateMargins(mDivider, mContentMarginStart, mContentMarginEnd); @@ -769,22 +693,13 @@ public class QSPanel extends LinearLayout implements Tunable { newLayout.setListening(mListening, uiEventLogger); if (needsDynamicRowsAndColumns()) { newLayout.setMinRows(horizontal ? 2 : 1); - // Let's use 3 columns to match the current layout - int columns; - if (mSideLabels) { - columns = horizontal ? 2 : 4; - } else { - columns = horizontal ? 3 : TileLayout.NO_MAX_COLUMNS; - } - newLayout.setMaxColumns(columns); + newLayout.setMaxColumns(horizontal ? 2 : 4); } updateMargins(mediaHostView); } } private void updateMargins(ViewGroup mediaHostView) { - updateTileLayoutMargins(); - updateFooterMargin(); updateDividerMargin(); updateMediaHostContentMargins(mediaHostView); updateHorizontalLinearLayoutMargins(); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java index eda1abb0997ec..5b6b5dfd123db 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java @@ -22,7 +22,6 @@ import static com.android.systemui.qs.dagger.QSFragmentModule.QS_USING_MEDIA_PLA import android.annotation.NonNull; import android.content.res.Configuration; -import android.util.Pair; import android.view.View; import android.view.ViewGroup; @@ -290,11 +289,6 @@ public class QSPanelController extends QSPanelControllerBase { mView.setContentMargins(startMargin, endMargin, mMediaHost.getHostView()); } - /** */ - public Pair getVisualSideMargins() { - return mView.getVisualSideMargins(); - } - /** */ public void showDetailAdapter(DetailAdapter detailAdapter, int x, int y) { mView.showDetailAdapter(true, detailAdapter, new int[]{x, y}); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java index e41a0389e8c1e..925c9ebfe2983 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java @@ -75,8 +75,6 @@ public abstract class QSPanelControllerBase extends ViewContr private float mRevealExpansion; private final QSHost.Callback mQSHostCallback = this::setTiles; - protected boolean mShowLabels = true; - protected boolean mQSLabelFlag; private final QSPanel.OnConfigurationChangedListener mOnConfigurationChangedListener = new QSPanel.OnConfigurationChangedListener() { @@ -121,14 +119,13 @@ public abstract class QSPanelControllerBase extends ViewContr mQSLogger = qsLogger; mDumpManager = dumpManager; mFeatureFlags = featureFlags; - mQSLabelFlag = featureFlags.isQSLabelsEnabled(); mShouldUseSplitNotificationShade = Utils.shouldUseSplitNotificationShade(mFeatureFlags, getResources()); } @Override protected void onInit() { - mView.initialize(mQSLabelFlag); + mView.initialize(); mQSLogger.logAllTilesChangeListening(mView.isListening(), mView.getDumpableTag(), ""); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java index e7828c366b640..63733b3926318 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java @@ -50,16 +50,11 @@ public class QuickQSPanel extends QSPanel { } @Override - void initialize(boolean sideLabels) { - super.initialize(sideLabels); + void initialize() { + super.initialize(); applyBottomMargin((View) mRegularTileLayout); } - @Override - protected void inflateQSFooter(boolean newFooter) { - // No footer - } - private void applyBottomMargin(View view) { int margin = getResources().getDimensionPixelSize(R.dimen.qs_header_tile_margin_bottom); MarginLayoutParams layoutParams = (MarginLayoutParams) view.getLayoutParams(); @@ -74,22 +69,14 @@ public class QuickQSPanel extends QSPanel { @Override public TileLayout createRegularTileLayout() { - if (mSideLabels) { - return new QQSSideLabelTileLayout(mContext); - } else { - return new QuickQSPanel.HeaderTileLayout(mContext); - } + return new QQSSideLabelTileLayout(mContext); } @Override protected QSTileLayout createHorizontalTileLayout() { - if (mSideLabels) { - TileLayout t = createRegularTileLayout(); - t.setMaxColumns(2); - return t; - } else { - return new DoubleLineTileLayout(mContext); - } + TileLayout t = createRegularTileLayout(); + t.setMaxColumns(2); + return t; } @Override diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java index 30a08c6f1b66b..7518b200c7e27 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java @@ -141,19 +141,6 @@ public class QSCustomizer extends LinearLayout { } } - /** - * Sets the padding for the RecyclerView. Also, updates the margin between the tiles in the - * {@link TileAdapter}. - */ - public void setContentPaddings(int paddingStart, int paddingEnd) { - mRecyclerView.setPaddingRelative( - paddingStart, - mRecyclerView.getPaddingTop(), - paddingEnd, - mRecyclerView.getPaddingBottom() - ); - } - /** Hide the customizer. */ public void hide(boolean animate) { if (isShown) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java index 006b23098622a..50805330cf1f8 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java @@ -14,8 +14,6 @@ package com.android.systemui.qs.customize; -import static com.android.systemui.qs.dagger.QSFlagsModule.QS_LABELS_FLAG; - import android.content.ComponentName; import android.content.Context; import android.content.res.Resources; @@ -61,7 +59,6 @@ import java.util.ArrayList; import java.util.List; import javax.inject.Inject; -import javax.inject.Named; /** */ @QSScope @@ -110,25 +107,21 @@ public class TileAdapter extends RecyclerView.Adapter implements TileSta private final AccessibilityDelegateCompat mAccessibilityDelegate; private RecyclerView mRecyclerView; private int mNumColumns; - private final boolean mUseHorizontalTiles; @Inject public TileAdapter( @QSThemedContext Context context, QSTileHost qsHost, - UiEventLogger uiEventLogger, - @Named(QS_LABELS_FLAG) boolean useHorizontalTiles - ) { + UiEventLogger uiEventLogger) { mContext = context; mHost = qsHost; mUiEventLogger = uiEventLogger; mItemTouchHelper = new ItemTouchHelper(mCallbacks); mDecoration = new TileItemDecoration(context); - mMarginDecoration = new MarginTileDecoration(!useHorizontalTiles); + mMarginDecoration = new MarginTileDecoration(); mMinNumTiles = context.getResources().getInteger(R.integer.quick_settings_min_num_tiles); mNumColumns = context.getResources().getInteger(NUM_COLUMNS_ID); mAccessibilityDelegate = new TileAdapterDelegate(); - mUseHorizontalTiles = useHorizontalTiles; mSizeLookup.setSpanIndexCacheEnabled(true); } @@ -287,9 +280,7 @@ public class TileAdapter extends RecyclerView.Adapter implements TileSta } FrameLayout frame = (FrameLayout) inflater.inflate(R.layout.qs_customize_tile_frame, parent, false); - View view = mUseHorizontalTiles - ? new CustomizeTileViewHorizontal(context, new QSIconViewImpl(context)) - : new CustomizeTileView(context, new QSIconViewImpl(context)); + View view = new CustomizeTileViewHorizontal(context, new QSIconViewImpl(context)); frame.addView(view); return new Holder(frame); } @@ -715,11 +706,6 @@ public class TileAdapter extends RecyclerView.Adapter implements TileSta private static class MarginTileDecoration extends ItemDecoration { private int mHalfMargin; - private final boolean mUseOutsideMargins; - - private MarginTileDecoration(boolean useOutsideMargins) { - mUseOutsideMargins = useOutsideMargins; - } public void setHalfMargin(int halfMargin) { mHalfMargin = halfMargin; @@ -738,9 +724,9 @@ public class TileAdapter extends RecyclerView.Adapter implements TileSta if (view instanceof TextView) { super.getItemOffsets(outRect, view, parent, state); } else { - if (mUseOutsideMargins || (column != 0 && column != lm.getSpanCount() - 1)) { - // Using outside margins or in a column that's not leftmost or rightmost - // (half of the margin between columns). + if (column != 0 && column != lm.getSpanCount() - 1) { + // In a column that's not leftmost or rightmost (half of the margin between + // columns). outRect.left = mHalfMargin; outRect.right = mHalfMargin; } else if (column == 0) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/dagger/QSFlagsModule.java b/packages/SystemUI/src/com/android/systemui/qs/dagger/QSFlagsModule.java index 10192bc20df9c..a1e1d64abdc7a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/dagger/QSFlagsModule.java +++ b/packages/SystemUI/src/com/android/systemui/qs/dagger/QSFlagsModule.java @@ -30,18 +30,11 @@ import dagger.Provides; @Module public interface QSFlagsModule { - String QS_LABELS_FLAG = "qs_labels_flag"; + String RBC_AVAILABLE = "rbc_available"; String PM_LITE_ENABLED = "pm_lite"; String PM_LITE_SETTING = "sysui_pm_lite"; - @Provides - @SysUISingleton - @Named(QS_LABELS_FLAG) - static boolean provideQSFlag(FeatureFlags featureFlags) { - return featureFlags.isQSLabelsEnabled(); - } - /** */ @Provides @SysUISingleton diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java index 9b0536c595adb..3437dd595152a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java @@ -14,8 +14,6 @@ package com.android.systemui.qs.tileimpl; -import static com.android.systemui.qs.dagger.QSFlagsModule.QS_LABELS_FLAG; - import android.content.Context; import android.os.Build; import android.util.Log; @@ -56,7 +54,6 @@ import com.android.systemui.qs.tiles.WorkModeTile; import com.android.systemui.util.leak.GarbageMonitor; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Provider; import dagger.Lazy; @@ -97,12 +94,9 @@ public class QSFactoryImpl implements QSFactory { private final Lazy mQsHostLazy; private final Provider mCustomTileBuilderProvider; - private final boolean mSideLabels; - @Inject public QSFactoryImpl( Lazy qsHostLazy, - @Named(QS_LABELS_FLAG) boolean useSideLabels, Provider customTileBuilderProvider, Provider wifiTileProvider, Provider internetTileProvider, @@ -134,8 +128,6 @@ public class QSFactoryImpl implements QSFactory { mQsHostLazy = qsHostLazy; mCustomTileBuilderProvider = customTileBuilderProvider; - mSideLabels = useSideLabels; - mWifiTileProvider = wifiTileProvider; mInternetTileProvider = internetTileProvider; mBluetoothTileProvider = bluetoothTileProvider; @@ -251,12 +243,6 @@ public class QSFactoryImpl implements QSFactory { @Override public QSTileView createTileView(Context context, QSTile tile, boolean collapsedView) { QSIconView icon = tile.createTileView(context); - if (mSideLabels) { - return new QSTileViewHorizontal(context, icon, collapsedView); - } else if (collapsedView) { - return new QSTileBaseView(context, icon, collapsedView); - } else { - return new com.android.systemui.qs.tileimpl.QSTileView(context, icon); - } + return new QSTileViewHorizontal(context, icon, collapsedView); } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java index aa8ce85f5950a..ba69dd530eac1 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java @@ -66,9 +66,9 @@ import com.android.systemui.plugins.qs.QSIconView; import com.android.systemui.plugins.qs.QSTile; import com.android.systemui.plugins.qs.QSTile.State; import com.android.systemui.plugins.statusbar.StatusBarStateController; -import com.android.systemui.qs.PagedTileLayout.TilePage; import com.android.systemui.qs.QSEvent; import com.android.systemui.qs.QSHost; +import com.android.systemui.qs.SideLabelTileLayout; import com.android.systemui.qs.logging.QSLogger; import java.io.FileDescriptor; @@ -497,7 +497,7 @@ public abstract class QSTileImpl implements QSTile, Lifecy private void updateIsFullQs() { for (Object listener : mListeners) { - if (TilePage.class.equals(listener.getClass())) { + if (SideLabelTileLayout.class.equals(listener.getClass())) { mIsFullQs = 1; return; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java b/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java index ec3a857dbc840..17b489ca24909 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java @@ -53,11 +53,6 @@ public class FeatureFlags { return mFlagReader.isEnabled(R.bool.flag_notification_twocolumn); } - // Does not support runtime changes - public boolean isQSLabelsEnabled() { - return mFlagReader.isEnabled(R.bool.flag_qs_labels); - } - public boolean isKeyguardLayoutEnabled() { return mFlagReader.isEnabled(R.bool.flag_keyguard_layout); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.java index acedf59bdd145..4f8859927d06a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.java @@ -81,7 +81,7 @@ public class QSPanelTest extends SysuiTestCase { mTestableLooper.runWithLooper(() -> { mQsPanel = new QSPanel(mContext, null); - mQsPanel.initialize(false); + mQsPanel.initialize(); mQsPanel.onFinishInflate(); // Provides a parent with non-zero size for QSPanel mParentView = new FrameLayout(mContext); diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileAdapterTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileAdapterTest.java index 62cc9b7e36021..3d53062d7d02f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileAdapterTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileAdapterTest.java @@ -49,7 +49,7 @@ public class TileAdapterTest extends SysuiTestCase { MockitoAnnotations.initMocks(this); TestableLooper.get(this).runWithLooper(() -> mTileAdapter = - new TileAdapter(mContext, mQSTileHost, new UiEventLoggerFake(), /* qsFlag */false)); + new TileAdapter(mContext, mQSTileHost, new UiEventLoggerFake())); } @Test