12/N Remove QSLogger from QSPanel
This removes the last view injection from QSPanel. Bug: 168904199 Test: atest SystemUITests Change-Id: Ief5dab7206212c1d233b3f3eaca94f09310a9996
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -107,6 +107,11 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
|
||||
mDumpManager = dumpManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInit() {
|
||||
mQSLogger.logAllTilesChangeListening(mView.isListening(), mView.getDumpableTag(), "");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onViewAttached() {
|
||||
mQsTileRevealController = createTileRevealController();
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
@@ -99,15 +94,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();
|
||||
|
||||
Reference in New Issue
Block a user