diff options
| author | 2021-03-29 13:41:56 -0400 | |
|---|---|---|
| committer | 2021-03-30 10:41:18 -0400 | |
| commit | c334ea0e8d2b4493fbdad3944d60123d48893ef3 (patch) | |
| tree | 40c06b8eeec01e1b3435f1d68a56941ea81cd9bb | |
| parent | ec012bc42632f59cfa7ab0872a66da246897593e (diff) | |
Reduce log importance and improve logging
The first time after QS is created, there are no tiles to animate, so we
should skip logging that we cannot find each tile. This is ok.
Otherwise, warn when we cannot find a tile that should be there.
Bug: 181269159
Test: build and check log
Change-Id: I7e60ba9ce5fd8ca9dc0b1e0b5a6180249c741db4
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java | 196 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java | 3 |
2 files changed, 103 insertions, 96 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java index ee0b0c28b0c5..a089a05f2776 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java @@ -233,44 +233,45 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha boolean qsSideLabelsEnabled = mFeatureFlags.isQSLabelsEnabled(); int qqsTileHeight = 0; - for (QSTile tile : tiles) { - QSTileView tileView = mQsPanelController.getTileView(tile); - if (tileView == null) { - Log.e(TAG, "tileView is null " + tile.getTileSpec()); - continue; - } - final View tileIcon = tileView.getIcon().getIconView(); - View view = mQs.getView(); - - // This case: less tiles to animate in small displays. - if (count < mQuickQSPanelController.getTileLayout().getNumVisibleTiles() - && mAllowFancy) { - // Quick tiles. - QSTileView quickTileView = mQuickQSPanelController.getTileView(tile); - if (quickTileView == null) continue; - - getRelativePosition(loc1, quickTileView.getIcon().getIconView(), view); - getRelativePosition(loc2, tileIcon, view); - final int xDiff = loc2[0] - loc1[0]; - int yDiff = loc2[1] - loc1[1]; - - if (count < tileLayout.getNumVisibleTiles()) { - getRelativePosition(loc1, quickTileView, view); - getRelativePosition(loc2, tileView, view); - int yOffset = qsSideLabelsEnabled - ? loc2[1] - loc1[1] - : mQuickStatusBarHeader.getOffsetTranslation(); - // Move the quick tile right from its location to the new one. - View v = qsSideLabelsEnabled ? quickTileView.getIcon() : quickTileView; - 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; - translationXBuilder.addFloat(v, "translationX", -xDiff, 0); - translationYBuilder.addFloat(v, "translationY", -yDiff + yOffset, 0); + if (mQsPanelController.areThereTiles()) { + for (QSTile tile : tiles) { + QSTileView tileView = mQsPanelController.getTileView(tile); + if (tileView == null) { + Log.e(TAG, "tileView is null " + tile.getTileSpec()); + continue; + } + final View tileIcon = tileView.getIcon().getIconView(); + View view = mQs.getView(); + + // This case: less tiles to animate in small displays. + if (count < mQuickQSPanelController.getTileLayout().getNumVisibleTiles() + && mAllowFancy) { + // Quick tiles. + QSTileView quickTileView = mQuickQSPanelController.getTileView(tile); + if (quickTileView == null) continue; + + getRelativePosition(loc1, quickTileView.getIcon().getIconView(), view); + getRelativePosition(loc2, tileIcon, view); + final int xDiff = loc2[0] - loc1[0]; + int yDiff = loc2[1] - loc1[1]; + + if (count < tileLayout.getNumVisibleTiles()) { + getRelativePosition(loc1, quickTileView, view); + getRelativePosition(loc2, tileView, view); + int yOffset = qsSideLabelsEnabled + ? loc2[1] - loc1[1] + : mQuickStatusBarHeader.getOffsetTranslation(); + // Move the quick tile right from its location to the new one. + View v = qsSideLabelsEnabled ? quickTileView.getIcon() : quickTileView; + 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; + translationXBuilder.addFloat(v, "translationX", -xDiff, 0); + translationYBuilder.addFloat(v, "translationY", -yDiff + yOffset, 0); if (qsSideLabelsEnabled) { // Offset the translation animation on the views @@ -282,75 +283,78 @@ 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(); + 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); } - mQQSTileHeightAnimator.addView(quickTileView); - View qqsLabelContainer = quickTileView.getLabelContainer(); - View qsLabelContainer = tileView.getLabelContainer(); + } else { // These tiles disappear when expanding + firstPageBuilder.addFloat(quickTileView, "alpha", 1, 0); + translationYBuilder.addFloat(quickTileView, "translationY", 0, yDiff); - 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); + // xDiff is negative here and this makes it "more" negative + final int translationX = + mQsPanelController.isLayoutRtl() ? xDiff - width : xDiff + width; + translationXBuilder.addFloat(quickTileView, "translationX", 0, + translationX); } - } else { // These tiles disappear when expanding - firstPageBuilder.addFloat(quickTileView, "alpha", 1, 0); - translationYBuilder.addFloat(quickTileView, "translationY", 0, yDiff); - - // xDiff is negative here and this makes it "more" negative - final int translationX = - mQsPanelController.isLayoutRtl() ? xDiff - width : xDiff + width; - translationXBuilder.addFloat(quickTileView, "translationX", 0, - translationX); - } - - if (qsSideLabelsEnabled) { - mQuickQsViews.add(tileView); - } else { - mQuickQsViews.add(tileView.getIconWithBackground()); - } - mAllViews.add(tileView.getIcon()); - mAllViews.add(quickTileView); - } else if (mFullRows && isIconInAnimatedRow(count)) { - - firstPageBuilder.addFloat(tileView, "translationY", -heightDiff, 0); + if (qsSideLabelsEnabled) { + mQuickQsViews.add(tileView); + } else { + mQuickQsViews.add(tileView.getIconWithBackground()); + } + mAllViews.add(tileView.getIcon()); + mAllViews.add(quickTileView); + } else if (mFullRows && isIconInAnimatedRow(count)) { - mAllViews.add(tileIcon); - } else { - if (!qsSideLabelsEnabled) { - firstPageBuilder.addFloat(tileView, "alpha", 0, 1); firstPageBuilder.addFloat(tileView, "translationY", -heightDiff, 0); + + mAllViews.add(tileIcon); } 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()); + 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); } - mOtherTilesExpandAnimator.addView(tileView); - tileView.setClipChildren(true); - tileView.setClipToPadding(true); } - } - mAllViews.add(tileView); - count++; + mAllViews.add(tileView); + count++; + } } if (mAllowFancy) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java index 6386365c2966..86836f935aba 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java @@ -228,6 +228,9 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr return mHost.createTile(subPanel); } + boolean areThereTiles() { + return !mRecords.isEmpty(); + } QSTileView getTileView(QSTile tile) { for (QSPanelControllerBase.TileRecord r : mRecords) { |