summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dave Mankoff <mankoff@google.com> 2020-10-23 16:28:29 -0400
committer Dave Mankoff <mankoff@google.com> 2020-11-18 14:17:34 -0500
commitacb10036b4bee6bf5a34b1fb25cbbcef800035c7 (patch)
treeb78c42b71c51f86625562590772b04d55da88c1e
parentab5513293964fce59f2e613faf941b2765a9dd0f (diff)
12/N Remove QSLogger from QSPanel
This removes the last view injection from QSPanel. Bug: 168904199 Test: atest SystemUITests Change-Id: Ief5dab7206212c1d233b3f3eaca94f09310a9996
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSFragment.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSPanel.java17
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java12
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java4
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.java26
8 files changed, 27 insertions, 65 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
index 043f5f1610a6..dbdd04a1e3ba 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
@@ -300,7 +300,7 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
? View.VISIBLE
: View.INVISIBLE);
mHeader.setExpanded((keyguardShowing && !mHeaderAnimating && !mShowCollapsedOnKeyguard)
- || (mQsExpanded && !mStackScrollerOverscrolling));
+ || (mQsExpanded && !mStackScrollerOverscrolling), mQuickQSPanelController);
mFooter.setVisibility(
!mQsDisabled && (mQsExpanded || !keyguardShowing || mHeaderAnimating
|| mShowCollapsedOnKeyguard)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index c080eccc1d8c..87a8da0cfa95 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -16,7 +16,6 @@
package com.android.systemui.qs;
-import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
import static com.android.systemui.util.Utils.useQsMediaPlayer;
import android.annotation.NonNull;
@@ -40,7 +39,6 @@ import com.android.internal.widget.RemeasuringLinearLayout;
import com.android.systemui.R;
import com.android.systemui.plugins.qs.DetailAdapter;
import com.android.systemui.plugins.qs.QSTile;
-import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.settings.brightness.BrightnessSlider;
import com.android.systemui.statusbar.policy.BrightnessMirrorController;
import com.android.systemui.tuner.TunerService;
@@ -50,9 +48,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
-import javax.inject.Inject;
-import javax.inject.Named;
-
/** View that represents the quick settings tile panel (when expanded/pulled down). **/
public class QSPanel extends LinearLayout implements Tunable {
@@ -83,7 +78,6 @@ public class QSPanel extends LinearLayout implements Tunable {
protected boolean mListening;
private QSDetail.Callback mCallback;
- private final QSLogger mQSLogger;
protected QSTileHost mHost;
private final List<OnConfigurationChangedListener> mOnConfigurationChangedListeners =
new ArrayList<>();
@@ -119,19 +113,12 @@ public class QSPanel extends LinearLayout implements Tunable {
private int mFooterMarginStartHorizontal;
private Consumer<Boolean> mMediaVisibilityChangedListener;
-
- @Inject
- public QSPanel(
- @Named(VIEW_CONTEXT) Context context,
- AttributeSet attrs,
- QSLogger qsLogger
- ) {
+ public QSPanel(Context context, AttributeSet attrs) {
super(context, attrs);
mUsingMediaPlayer = useQsMediaPlayer(context);
mMediaTotalBottomMargin = getResources().getDimensionPixelSize(
R.dimen.quick_settings_bottom_margin_media);
mContext = context;
- mQSLogger = qsLogger;
setOrientation(VERTICAL);
@@ -161,7 +148,6 @@ public class QSPanel extends LinearLayout implements Tunable {
lp = new LayoutParams(LayoutParams.MATCH_PARENT, 0, 1);
addView(mHorizontalLinearLayout, lp);
}
- mQSLogger.logAllTilesChangeListening(mListening, getDumpableTag(), "");
}
protected void onMediaVisibilityChanged(Boolean visible) {
@@ -439,7 +425,6 @@ public class QSPanel extends LinearLayout implements Tunable {
public void setExpanded(boolean expanded) {
if (mExpanded == expanded) return;
- mQSLogger.logPanelExpanded(expanded, getDumpableTag());
mExpanded = expanded;
if (!mExpanded && mTileLayout instanceof PagedTileLayout) {
((PagedTileLayout) mTileLayout).setCurrentItem(0, false);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java
index 18c2925b7fd9..4418a7415c60 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java
@@ -108,6 +108,11 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
}
@Override
+ protected void onInit() {
+ mQSLogger.logAllTilesChangeListening(mView.isListening(), mView.getDumpableTag(), "");
+ }
+
+ @Override
protected void onViewAttached() {
mQsTileRevealController = createTileRevealController();
if (mQsTileRevealController != null) {
@@ -221,6 +226,11 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
/** */
public void setExpanded(boolean expanded) {
+ if (mView.isExpanded() == expanded) {
+ return;
+ }
+ mQSLogger.logPanelExpanded(expanded, mView.getDumpableTag());
+
mView.setExpanded(expanded);
mMetricsLogger.visibility(MetricsEvent.QS_PANEL, expanded);
if (!expanded) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
index bbd0c1abb239..c89f8e58f980 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
@@ -16,8 +16,6 @@
package com.android.systemui.qs;
-import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
-
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Rect;
@@ -31,10 +29,6 @@ import com.android.systemui.R;
import com.android.systemui.plugins.qs.QSTile;
import com.android.systemui.plugins.qs.QSTile.SignalState;
import com.android.systemui.plugins.qs.QSTile.State;
-import com.android.systemui.qs.logging.QSLogger;
-
-import javax.inject.Inject;
-import javax.inject.Named;
/**
* Version of QSPanel that only shows N Quick Tiles in the QS Header.
@@ -49,14 +43,8 @@ public class QuickQSPanel extends QSPanel {
private boolean mDisabledByPolicy;
private int mMaxTiles;
-
- @Inject
- public QuickQSPanel(
- @Named(VIEW_CONTEXT) Context context,
- AttributeSet attrs,
- QSLogger qsLogger,
- UiEventLogger uiEventLogger) {
- super(context, attrs, qsLogger);
+ public QuickQSPanel(Context context, AttributeSet attrs) {
+ super(context, attrs);
mMaxTiles = Math.min(DEFAULT_MAX_TILES,
getResources().getInteger(R.integer.quick_qs_panel_max_columns));
applyBottomMargin((View) mRegularTileLayout);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
index 6020e21035a8..b85ad8195edd 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
@@ -311,10 +311,11 @@ public class QuickStatusBarHeader extends RelativeLayout implements LifecycleOwn
.build();
}
- public void setExpanded(boolean expanded) {
+ /** */
+ public void setExpanded(boolean expanded, QuickQSPanelController quickQSPanelController) {
if (mExpanded == expanded) return;
mExpanded = expanded;
- mHeaderQsPanel.setExpanded(expanded);
+ quickQSPanelController.setExpanded(expanded);
updateEverything();
}
diff --git a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
index 4b4e1df21bd0..cdc5d8795b91 100644
--- a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
+++ b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
@@ -24,8 +24,6 @@ import android.view.LayoutInflater;
import android.view.View;
import com.android.systemui.dagger.SysUISingleton;
-import com.android.systemui.qs.QSPanel;
-import com.android.systemui.qs.QuickQSPanel;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import java.lang.reflect.InvocationTargetException;
@@ -93,16 +91,6 @@ public class InjectionInflationController {
* Creates the NotificationStackScrollLayout.
*/
NotificationStackScrollLayout createNotificationStackScrollLayout();
-
- /**
- * Creates the QSPanel.
- */
- QSPanel createQSPanel();
-
- /**
- * Creates the QuickQSPanel.
- */
- QuickQSPanel createQuickQSPanel();
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java
index 3817703fe135..0dc268a3c186 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java
@@ -168,14 +168,18 @@ public class QSPanelControllerBaseTest extends SysuiTestCase {
@Test
public void testSetExpanded_Metrics() {
+ when(mQSPanel.isExpanded()).thenReturn(false);
mController.setExpanded(true);
verify(mMetricsLogger).visibility(eq(MetricsEvent.QS_PANEL), eq(true));
+ verify(mQSLogger).logPanelExpanded(true, mQSPanel.getDumpableTag());
assertEquals(1, mUiEventLogger.numLogs());
assertEquals(QSEvent.QS_PANEL_EXPANDED.getId(), mUiEventLogger.eventId(0));
mUiEventLogger.getLogs().clear();
+ when(mQSPanel.isExpanded()).thenReturn(true);
mController.setExpanded(false);
verify(mMetricsLogger).visibility(eq(MetricsEvent.QS_PANEL), eq(false));
+ verify(mQSLogger).logPanelExpanded(false, mQSPanel.getDumpableTag());
assertEquals(1, mUiEventLogger.numLogs());
assertEquals(QSEvent.QS_PANEL_COLLAPSED.getId(), mUiEventLogger.eventId(0));
mUiEventLogger.getLogs().clear();
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 900f989c3bdf..a726181fc702 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.java
@@ -17,13 +17,10 @@ package com.android.systemui.qs;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import android.content.Context;
-import android.os.UserManager;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
import android.testing.TestableLooper.RunWithLooper;
@@ -32,13 +29,11 @@ import android.widget.FrameLayout;
import androidx.test.filters.SmallTest;
-import com.android.systemui.Dependency;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.qs.QSTileView;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
-import com.android.systemui.statusbar.policy.SecurityController;
import org.junit.Before;
import org.junit.Test;
@@ -76,16 +71,16 @@ public class QSPanelTest extends SysuiTestCase {
MockitoAnnotations.initMocks(this);
mTestableLooper = TestableLooper.get(this);
- // Dependencies for QSSecurityFooter
- mDependency.injectTestDependency(ActivityStarter.class, mActivityStarter);
- mDependency.injectMockDependency(SecurityController.class);
- mDependency.injectTestDependency(Dependency.BG_LOOPER, mTestableLooper.getLooper());
- mContext.addMockSystemService(Context.USER_SERVICE, mock(UserManager.class));
+// // Dependencies for QSSecurityFooter
+// mDependency.injectTestDependency(ActivityStarter.class, mActivityStarter);
+// mDependency.injectMockDependency(SecurityController.class);
+// mDependency.injectTestDependency(Dependency.BG_LOOPER, mTestableLooper.getLooper());
+// mContext.addMockSystemService(Context.USER_SERVICE, mock(UserManager.class));
mDndTileRecord.tile = dndTile;
mDndTileRecord.tileView = mQSTileView;
mTestableLooper.runWithLooper(() -> {
- mQsPanel = new QSPanel(mContext, null, mQSLogger);
+ mQsPanel = new QSPanel(mContext, null);
mQsPanel.onFinishInflate();
// Provides a parent with non-zero size for QSPanel
mParentView = new FrameLayout(mContext);
@@ -100,15 +95,6 @@ public class QSPanelTest extends SysuiTestCase {
}
@Test
- public void testSetExpanded_Metrics() {
- mQsPanel.setExpanded(true);
- verify(mQSLogger).logPanelExpanded(true, mQsPanel.getDumpableTag());
-
- mQsPanel.setExpanded(false);
- verify(mQSLogger).logPanelExpanded(false, mQsPanel.getDumpableTag());
- }
-
- @Test
public void testOpenDetailsWithExistingTile_NoException() {
mTestableLooper.processAllMessages();
mQsPanel.openDetails(dndTile);