Merge "Adding extra logging for tiles distribution across pages" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9316cd8e71
@@ -123,7 +123,7 @@ public class LogModule {
|
|||||||
@SysUISingleton
|
@SysUISingleton
|
||||||
@QSLog
|
@QSLog
|
||||||
public static LogBuffer provideQuickSettingsLogBuffer(LogBufferFactory factory) {
|
public static LogBuffer provideQuickSettingsLogBuffer(LogBufferFactory factory) {
|
||||||
return factory.create("QSLog", 500 /* maxSize */, false /* systrace */);
|
return factory.create("QSLog", 700 /* maxSize */, false /* systrace */);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Provides a logging buffer for {@link com.android.systemui.broadcast.BroadcastDispatcher} */
|
/** Provides a logging buffer for {@link com.android.systemui.broadcast.BroadcastDispatcher} */
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import android.content.Context;
|
|||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -31,6 +30,7 @@ import com.android.systemui.R;
|
|||||||
import com.android.systemui.plugins.qs.QSTile;
|
import com.android.systemui.plugins.qs.QSTile;
|
||||||
import com.android.systemui.qs.QSPanel.QSTileLayout;
|
import com.android.systemui.qs.QSPanel.QSTileLayout;
|
||||||
import com.android.systemui.qs.QSPanelControllerBase.TileRecord;
|
import com.android.systemui.qs.QSPanelControllerBase.TileRecord;
|
||||||
|
import com.android.systemui.qs.logging.QSLogger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -38,11 +38,9 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
||||||
|
|
||||||
private static final boolean DEBUG = false;
|
|
||||||
private static final String CURRENT_PAGE = "current_page";
|
private static final String CURRENT_PAGE = "current_page";
|
||||||
private static final int NO_PAGE = -1;
|
private static final int NO_PAGE = -1;
|
||||||
|
|
||||||
private static final String TAG = "PagedTileLayout";
|
|
||||||
private static final int REVEAL_SCROLL_DURATION_MILLIS = 750;
|
private static final int REVEAL_SCROLL_DURATION_MILLIS = 750;
|
||||||
private static final float BOUNCE_ANIMATION_TENSION = 1.3f;
|
private static final float BOUNCE_ANIMATION_TENSION = 1.3f;
|
||||||
private static final long BOUNCE_ANIMATION_DURATION = 450L;
|
private static final long BOUNCE_ANIMATION_DURATION = 450L;
|
||||||
@@ -55,6 +53,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
|||||||
private final ArrayList<TileRecord> mTiles = new ArrayList<>();
|
private final ArrayList<TileRecord> mTiles = new ArrayList<>();
|
||||||
private final ArrayList<TileLayout> mPages = new ArrayList<>();
|
private final ArrayList<TileLayout> mPages = new ArrayList<>();
|
||||||
|
|
||||||
|
private QSLogger mLogger;
|
||||||
@Nullable
|
@Nullable
|
||||||
private PageIndicator mPageIndicator;
|
private PageIndicator mPageIndicator;
|
||||||
private float mPageIndicatorPosition;
|
private float mPageIndicatorPosition;
|
||||||
@@ -146,9 +145,15 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
|||||||
}
|
}
|
||||||
if (mLayoutOrientation != newConfig.orientation) {
|
if (mLayoutOrientation != newConfig.orientation) {
|
||||||
mLayoutOrientation = newConfig.orientation;
|
mLayoutOrientation = newConfig.orientation;
|
||||||
mDistributeTiles = true;
|
forceTilesRedistribution("orientation changed to " + mLayoutOrientation);
|
||||||
setCurrentItem(0, false);
|
setCurrentItem(0, false);
|
||||||
mPageToRestore = 0;
|
mPageToRestore = 0;
|
||||||
|
} else {
|
||||||
|
// logging in case we missed redistribution because orientation was not changed
|
||||||
|
// while configuration changed, can be removed after b/255208946 is fixed
|
||||||
|
mLogger.d(
|
||||||
|
"Orientation didn't change, tiles might be not redistributed, new config",
|
||||||
|
newConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +231,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
|||||||
// Keep on drawing until the animation has finished.
|
// Keep on drawing until the animation has finished.
|
||||||
postInvalidateOnAnimation();
|
postInvalidateOnAnimation();
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
Log.e(TAG, "FakeDragBy called before begin", e);
|
mLogger.logException("FakeDragBy called before begin", e);
|
||||||
// If we were trying to fake drag, it means we just added a new tile to the last
|
// If we were trying to fake drag, it means we just added a new tile to the last
|
||||||
// page, so animate there.
|
// page, so animate there.
|
||||||
final int lastPageNumber = mPages.size() - 1;
|
final int lastPageNumber = mPages.size() - 1;
|
||||||
@@ -246,7 +251,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
|||||||
super.endFakeDrag();
|
super.endFakeDrag();
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
// Not sure what's going on. Let's log it
|
// Not sure what's going on. Let's log it
|
||||||
Log.e(TAG, "endFakeDrag called without velocityTracker", e);
|
mLogger.logException("endFakeDrag called without velocityTracker", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,14 +309,14 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
|||||||
@Override
|
@Override
|
||||||
public void addTile(TileRecord tile) {
|
public void addTile(TileRecord tile) {
|
||||||
mTiles.add(tile);
|
mTiles.add(tile);
|
||||||
mDistributeTiles = true;
|
forceTilesRedistribution("adding new tile");
|
||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeTile(TileRecord tile) {
|
public void removeTile(TileRecord tile) {
|
||||||
if (mTiles.remove(tile)) {
|
if (mTiles.remove(tile)) {
|
||||||
mDistributeTiles = true;
|
forceTilesRedistribution("removing tile");
|
||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -367,19 +372,11 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
|||||||
final int tilesPerPageCount = mPages.get(0).maxTiles();
|
final int tilesPerPageCount = mPages.get(0).maxTiles();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
final int totalTilesCount = mTiles.size();
|
final int totalTilesCount = mTiles.size();
|
||||||
if (DEBUG) {
|
mLogger.logTileDistributionInProgress(tilesPerPageCount, totalTilesCount);
|
||||||
Log.d(TAG, "Distributing tiles: "
|
|
||||||
+ "[tilesPerPageCount=" + tilesPerPageCount + "]"
|
|
||||||
+ "[totalTilesCount=" + totalTilesCount + "]"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < totalTilesCount; i++) {
|
for (int i = 0; i < totalTilesCount; i++) {
|
||||||
TileRecord tile = mTiles.get(i);
|
TileRecord tile = mTiles.get(i);
|
||||||
if (mPages.get(index).mRecords.size() == tilesPerPageCount) index++;
|
if (mPages.get(index).mRecords.size() == tilesPerPageCount) index++;
|
||||||
if (DEBUG) {
|
mLogger.logTileDistributed(tile.tile.getClass().getSimpleName(), index);
|
||||||
Log.d(TAG, "Adding " + tile.tile.getClass().getSimpleName() + " to "
|
|
||||||
+ index);
|
|
||||||
}
|
|
||||||
mPages.get(index).addTile(tile);
|
mPages.get(index).addTile(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -394,11 +391,11 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (mPages.size() < numPages) {
|
while (mPages.size() < numPages) {
|
||||||
if (DEBUG) Log.d(TAG, "Adding page");
|
mLogger.d("Adding new page");
|
||||||
mPages.add(createTileLayout());
|
mPages.add(createTileLayout());
|
||||||
}
|
}
|
||||||
while (mPages.size() > numPages) {
|
while (mPages.size() > numPages) {
|
||||||
if (DEBUG) Log.d(TAG, "Removing page");
|
mLogger.d("Removing page");
|
||||||
mPages.remove(mPages.size() - 1);
|
mPages.remove(mPages.size() - 1);
|
||||||
}
|
}
|
||||||
mPageIndicator.setNumPages(mPages.size());
|
mPageIndicator.setNumPages(mPages.size());
|
||||||
@@ -417,8 +414,12 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
|||||||
changed |= mPages.get(i).updateResources();
|
changed |= mPages.get(i).updateResources();
|
||||||
}
|
}
|
||||||
if (changed) {
|
if (changed) {
|
||||||
mDistributeTiles = true;
|
forceTilesRedistribution("resources in pages changed");
|
||||||
requestLayout();
|
requestLayout();
|
||||||
|
} else {
|
||||||
|
// logging in case we missed redistribution because number of column in updateResources
|
||||||
|
// was not changed, can be removed after b/255208946 is fixed
|
||||||
|
mLogger.d("resource in pages didn't change, tiles might be not redistributed");
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
@@ -430,7 +431,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
|||||||
for (int i = 0; i < mPages.size(); i++) {
|
for (int i = 0; i < mPages.size(); i++) {
|
||||||
if (mPages.get(i).setMinRows(minRows)) {
|
if (mPages.get(i).setMinRows(minRows)) {
|
||||||
changed = true;
|
changed = true;
|
||||||
mDistributeTiles = true;
|
forceTilesRedistribution("minRows changed in page");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
@@ -443,7 +444,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
|||||||
for (int i = 0; i < mPages.size(); i++) {
|
for (int i = 0; i < mPages.size(); i++) {
|
||||||
if (mPages.get(i).setMaxColumns(maxColumns)) {
|
if (mPages.get(i).setMaxColumns(maxColumns)) {
|
||||||
changed = true;
|
changed = true;
|
||||||
mDistributeTiles = true;
|
forceTilesRedistribution("maxColumns in pages changed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
@@ -710,14 +711,14 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
|||||||
private final PagerAdapter mAdapter = new PagerAdapter() {
|
private final PagerAdapter mAdapter = new PagerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||||
if (DEBUG) Log.d(TAG, "Destantiating " + position);
|
mLogger.d("Destantiating page at", position);
|
||||||
container.removeView((View) object);
|
container.removeView((View) object);
|
||||||
updateListening();
|
updateListening();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object instantiateItem(ViewGroup container, int position) {
|
public Object instantiateItem(ViewGroup container, int position) {
|
||||||
if (DEBUG) Log.d(TAG, "Instantiating " + position);
|
mLogger.d("Instantiating page at", position);
|
||||||
if (isLayoutRtl()) {
|
if (isLayoutRtl()) {
|
||||||
position = mPages.size() - 1 - position;
|
position = mPages.size() - 1 - position;
|
||||||
}
|
}
|
||||||
@@ -745,10 +746,15 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
|||||||
* Force all tiles to be redistributed across pages.
|
* Force all tiles to be redistributed across pages.
|
||||||
* Should be called when one of the following changes: rows, columns, number of tiles.
|
* Should be called when one of the following changes: rows, columns, number of tiles.
|
||||||
*/
|
*/
|
||||||
public void forceTilesRedistribution() {
|
public void forceTilesRedistribution(String reason) {
|
||||||
|
mLogger.d("forcing tile redistribution across pages, reason", reason);
|
||||||
mDistributeTiles = true;
|
mDistributeTiles = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLogger(QSLogger qsLogger) {
|
||||||
|
mLogger = qsLogger;
|
||||||
|
}
|
||||||
|
|
||||||
public interface PageListener {
|
public interface PageListener {
|
||||||
int INVALID_PAGE = -1;
|
int INVALID_PAGE = -1;
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import com.android.internal.logging.UiEventLogger;
|
|||||||
import com.android.internal.widget.RemeasuringLinearLayout;
|
import com.android.internal.widget.RemeasuringLinearLayout;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.plugins.qs.QSTile;
|
import com.android.systemui.plugins.qs.QSTile;
|
||||||
|
import com.android.systemui.qs.logging.QSLogger;
|
||||||
import com.android.systemui.settings.brightness.BrightnessSliderController;
|
import com.android.systemui.settings.brightness.BrightnessSliderController;
|
||||||
import com.android.systemui.tuner.TunerService;
|
import com.android.systemui.tuner.TunerService;
|
||||||
import com.android.systemui.tuner.TunerService.Tunable;
|
import com.android.systemui.tuner.TunerService.Tunable;
|
||||||
@@ -106,6 +107,7 @@ public class QSPanel extends LinearLayout implements Tunable {
|
|||||||
private ViewGroup mMediaHostView;
|
private ViewGroup mMediaHostView;
|
||||||
private boolean mShouldMoveMediaOnExpansion = true;
|
private boolean mShouldMoveMediaOnExpansion = true;
|
||||||
private boolean mUsingCombinedHeaders = false;
|
private boolean mUsingCombinedHeaders = false;
|
||||||
|
private QSLogger mQsLogger;
|
||||||
|
|
||||||
public QSPanel(Context context, AttributeSet attrs) {
|
public QSPanel(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
@@ -122,7 +124,8 @@ public class QSPanel extends LinearLayout implements Tunable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialize() {
|
void initialize(QSLogger qsLogger) {
|
||||||
|
mQsLogger = qsLogger;
|
||||||
mTileLayout = getOrCreateTileLayout();
|
mTileLayout = getOrCreateTileLayout();
|
||||||
|
|
||||||
if (mUsingMediaPlayer) {
|
if (mUsingMediaPlayer) {
|
||||||
@@ -206,6 +209,7 @@ public class QSPanel extends LinearLayout implements Tunable {
|
|||||||
if (mTileLayout == null) {
|
if (mTileLayout == null) {
|
||||||
mTileLayout = (QSTileLayout) LayoutInflater.from(mContext)
|
mTileLayout = (QSTileLayout) LayoutInflater.from(mContext)
|
||||||
.inflate(R.layout.qs_paged_tile_layout, this, false);
|
.inflate(R.layout.qs_paged_tile_layout, this, false);
|
||||||
|
mTileLayout.setLogger(mQsLogger);
|
||||||
mTileLayout.setSquishinessFraction(mSquishinessFraction);
|
mTileLayout.setSquishinessFraction(mSquishinessFraction);
|
||||||
}
|
}
|
||||||
return mTileLayout;
|
return mTileLayout;
|
||||||
@@ -735,6 +739,8 @@ public class QSPanel extends LinearLayout implements Tunable {
|
|||||||
default void setExpansion(float expansion, float proposedTranslation) {}
|
default void setExpansion(float expansion, float proposedTranslation) {}
|
||||||
|
|
||||||
int getNumVisibleTiles();
|
int getNumVisibleTiles();
|
||||||
|
|
||||||
|
default void setLogger(QSLogger qsLogger) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnConfigurationChangedListener {
|
interface OnConfigurationChangedListener {
|
||||||
|
|||||||
@@ -122,9 +122,8 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
|
|||||||
}
|
}
|
||||||
switchTileLayout(true);
|
switchTileLayout(true);
|
||||||
mBrightnessMirrorHandler.onQsPanelAttached();
|
mBrightnessMirrorHandler.onQsPanelAttached();
|
||||||
|
PagedTileLayout pagedTileLayout= ((PagedTileLayout) mView.getOrCreateTileLayout());
|
||||||
((PagedTileLayout) mView.getOrCreateTileLayout())
|
pagedTileLayout.setOnTouchListener(mTileLayoutTouchListener);
|
||||||
.setOnTouchListener(mTileLayoutTouchListener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -150,7 +149,8 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSplitShadeChanged() {
|
protected void onSplitShadeChanged() {
|
||||||
((PagedTileLayout) mView.getOrCreateTileLayout()).forceTilesRedistribution();
|
((PagedTileLayout) mView.getOrCreateTileLayout())
|
||||||
|
.forceTilesRedistribution("Split shade state changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
|
|||||||
protected final MediaHost mMediaHost;
|
protected final MediaHost mMediaHost;
|
||||||
protected final MetricsLogger mMetricsLogger;
|
protected final MetricsLogger mMetricsLogger;
|
||||||
private final UiEventLogger mUiEventLogger;
|
private final UiEventLogger mUiEventLogger;
|
||||||
private final QSLogger mQSLogger;
|
protected final QSLogger mQSLogger;
|
||||||
private final DumpManager mDumpManager;
|
private final DumpManager mDumpManager;
|
||||||
protected final ArrayList<TileRecord> mRecords = new ArrayList<>();
|
protected final ArrayList<TileRecord> mRecords = new ArrayList<>();
|
||||||
protected boolean mShouldUseSplitNotificationShade;
|
protected boolean mShouldUseSplitNotificationShade;
|
||||||
@@ -152,7 +152,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onInit() {
|
protected void onInit() {
|
||||||
mView.initialize();
|
mView.initialize(mQSLogger);
|
||||||
mQSLogger.logAllTilesChangeListening(mView.isListening(), mView.getDumpableTag(), "");
|
mQSLogger.logAllTilesChangeListening(mView.isListening(), mView.getDumpableTag(), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,6 +430,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
|
|||||||
pw.println(" horizontal layout: " + mUsingHorizontalLayout);
|
pw.println(" horizontal layout: " + mUsingHorizontalLayout);
|
||||||
pw.println(" last orientation: " + mLastOrientation);
|
pw.println(" last orientation: " + mLastOrientation);
|
||||||
}
|
}
|
||||||
|
pw.println(" mShouldUseSplitNotificationShade: " + mShouldUseSplitNotificationShade);
|
||||||
}
|
}
|
||||||
|
|
||||||
public QSPanel.QSTileLayout getTileLayout() {
|
public QSPanel.QSTileLayout getTileLayout() {
|
||||||
|
|||||||
@@ -21,10 +21,13 @@ import com.android.systemui.log.dagger.QSLog
|
|||||||
import com.android.systemui.plugins.log.LogBuffer
|
import com.android.systemui.plugins.log.LogBuffer
|
||||||
import com.android.systemui.plugins.log.LogLevel
|
import com.android.systemui.plugins.log.LogLevel
|
||||||
import com.android.systemui.plugins.log.LogLevel.DEBUG
|
import com.android.systemui.plugins.log.LogLevel.DEBUG
|
||||||
|
import com.android.systemui.plugins.log.LogLevel.ERROR
|
||||||
import com.android.systemui.plugins.log.LogLevel.VERBOSE
|
import com.android.systemui.plugins.log.LogLevel.VERBOSE
|
||||||
|
import com.android.systemui.plugins.log.LogLevel.WARNING
|
||||||
import com.android.systemui.plugins.log.LogMessage
|
import com.android.systemui.plugins.log.LogMessage
|
||||||
import com.android.systemui.plugins.qs.QSTile
|
import com.android.systemui.plugins.qs.QSTile
|
||||||
import com.android.systemui.statusbar.StatusBarState
|
import com.android.systemui.statusbar.StatusBarState
|
||||||
|
import com.google.errorprone.annotations.CompileTimeConstant
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
private const val TAG = "QSLog"
|
private const val TAG = "QSLog"
|
||||||
@@ -33,6 +36,26 @@ class QSLogger @Inject constructor(
|
|||||||
@QSLog private val buffer: LogBuffer
|
@QSLog private val buffer: LogBuffer
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
fun d(@CompileTimeConstant msg: String) = buffer.log(TAG, DEBUG, msg)
|
||||||
|
|
||||||
|
fun e(@CompileTimeConstant msg: String) = buffer.log(TAG, ERROR, msg)
|
||||||
|
|
||||||
|
fun v(@CompileTimeConstant msg: String) = buffer.log(TAG, VERBOSE, msg)
|
||||||
|
|
||||||
|
fun w(@CompileTimeConstant msg: String) = buffer.log(TAG, WARNING, msg)
|
||||||
|
|
||||||
|
fun logException(@CompileTimeConstant logMsg: String, ex: Exception) {
|
||||||
|
buffer.log(TAG, ERROR, {}, { logMsg }, exception = ex)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun v(@CompileTimeConstant msg: String, arg: Any) {
|
||||||
|
buffer.log(TAG, VERBOSE, { str1 = arg.toString() }, { "$msg: $str1" })
|
||||||
|
}
|
||||||
|
|
||||||
|
fun d(@CompileTimeConstant msg: String, arg: Any) {
|
||||||
|
buffer.log(TAG, DEBUG, { str1 = arg.toString() }, { "$msg: $str1" })
|
||||||
|
}
|
||||||
|
|
||||||
fun logTileAdded(tileSpec: String) {
|
fun logTileAdded(tileSpec: String) {
|
||||||
log(DEBUG, {
|
log(DEBUG, {
|
||||||
str1 = tileSpec
|
str1 = tileSpec
|
||||||
@@ -236,6 +259,24 @@ class QSLogger @Inject constructor(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun logTileDistributionInProgress(tilesPerPageCount: Int, totalTilesCount: Int) {
|
||||||
|
log(DEBUG, {
|
||||||
|
int1 = tilesPerPageCount
|
||||||
|
int2 = totalTilesCount
|
||||||
|
}, {
|
||||||
|
"Distributing tiles: [tilesPerPageCount=$int1] [totalTilesCount=$int2]"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun logTileDistributed(tileName: String, pageIndex: Int) {
|
||||||
|
log(DEBUG, {
|
||||||
|
str1 = tileName
|
||||||
|
int1 = pageIndex
|
||||||
|
}, {
|
||||||
|
"Adding $str1 to page number $int1"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
private fun toStateString(state: Int): String {
|
private fun toStateString(state: Int): String {
|
||||||
return when (state) {
|
return when (state) {
|
||||||
Tile.STATE_ACTIVE -> "active"
|
Tile.STATE_ACTIVE -> "active"
|
||||||
|
|||||||
@@ -226,7 +226,8 @@ public class QSPanelControllerBaseTest extends SysuiTestCase {
|
|||||||
+ " " + mockTileViewString + "\n"
|
+ " " + mockTileViewString + "\n"
|
||||||
+ " media bounds: null\n"
|
+ " media bounds: null\n"
|
||||||
+ " horizontal layout: false\n"
|
+ " horizontal layout: false\n"
|
||||||
+ " last orientation: 0\n";
|
+ " last orientation: 0\n"
|
||||||
|
+ " mShouldUseSplitNotificationShade: false\n";
|
||||||
assertEquals(expected, w.getBuffer().toString());
|
assertEquals(expected, w.getBuffer().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -135,10 +135,10 @@ class QSPanelControllerTest : SysuiTestCase() {
|
|||||||
fun configurationChange_onlySplitShadeConfigChanges_tileAreRedistributed() {
|
fun configurationChange_onlySplitShadeConfigChanges_tileAreRedistributed() {
|
||||||
testableResources.addOverride(R.bool.config_use_split_notification_shade, false)
|
testableResources.addOverride(R.bool.config_use_split_notification_shade, false)
|
||||||
controller.mOnConfigurationChangedListener.onConfigurationChange(configuration)
|
controller.mOnConfigurationChangedListener.onConfigurationChange(configuration)
|
||||||
verify(pagedTileLayout, never()).forceTilesRedistribution()
|
verify(pagedTileLayout, never()).forceTilesRedistribution(any())
|
||||||
|
|
||||||
testableResources.addOverride(R.bool.config_use_split_notification_shade, true)
|
testableResources.addOverride(R.bool.config_use_split_notification_shade, true)
|
||||||
controller.mOnConfigurationChangedListener.onConfigurationChange(configuration)
|
controller.mOnConfigurationChangedListener.onConfigurationChange(configuration)
|
||||||
verify(pagedTileLayout).forceTilesRedistribution()
|
verify(pagedTileLayout).forceTilesRedistribution("Split shade state changed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import androidx.test.filters.SmallTest
|
|||||||
import com.android.systemui.R
|
import com.android.systemui.R
|
||||||
import com.android.systemui.SysuiTestCase
|
import com.android.systemui.SysuiTestCase
|
||||||
import com.android.systemui.plugins.qs.QSTile
|
import com.android.systemui.plugins.qs.QSTile
|
||||||
|
import com.android.systemui.qs.logging.QSLogger
|
||||||
import com.android.systemui.qs.tileimpl.QSIconViewImpl
|
import com.android.systemui.qs.tileimpl.QSIconViewImpl
|
||||||
import com.android.systemui.qs.tileimpl.QSTileViewImpl
|
import com.android.systemui.qs.tileimpl.QSTileViewImpl
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
@@ -34,6 +35,7 @@ import org.junit.After
|
|||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito.mock
|
import org.mockito.Mockito.mock
|
||||||
import org.mockito.Mockito.verify
|
import org.mockito.Mockito.verify
|
||||||
import org.mockito.MockitoAnnotations
|
import org.mockito.MockitoAnnotations
|
||||||
@@ -42,6 +44,9 @@ import org.mockito.MockitoAnnotations
|
|||||||
@RunWithLooper
|
@RunWithLooper
|
||||||
@SmallTest
|
@SmallTest
|
||||||
class QSPanelTest : SysuiTestCase() {
|
class QSPanelTest : SysuiTestCase() {
|
||||||
|
|
||||||
|
@Mock private lateinit var qsLogger: QSLogger
|
||||||
|
|
||||||
private lateinit var testableLooper: TestableLooper
|
private lateinit var testableLooper: TestableLooper
|
||||||
private lateinit var qsPanel: QSPanel
|
private lateinit var qsPanel: QSPanel
|
||||||
|
|
||||||
@@ -57,7 +62,7 @@ class QSPanelTest : SysuiTestCase() {
|
|||||||
qsPanel = QSPanel(context, null)
|
qsPanel = QSPanel(context, null)
|
||||||
qsPanel.mUsingMediaPlayer = true
|
qsPanel.mUsingMediaPlayer = true
|
||||||
|
|
||||||
qsPanel.initialize()
|
qsPanel.initialize(qsLogger)
|
||||||
// QSPanel inflates a footer inside of it, mocking it here
|
// QSPanel inflates a footer inside of it, mocking it here
|
||||||
footer = LinearLayout(context).apply { id = R.id.qs_footer }
|
footer = LinearLayout(context).apply { id = R.id.qs_footer }
|
||||||
qsPanel.addView(footer, MATCH_PARENT, 100)
|
qsPanel.addView(footer, MATCH_PARENT, 100)
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ import android.view.accessibility.AccessibilityNodeInfo
|
|||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import androidx.test.filters.SmallTest
|
import androidx.test.filters.SmallTest
|
||||||
import com.android.systemui.SysuiTestCase
|
import com.android.systemui.SysuiTestCase
|
||||||
|
import com.android.systemui.qs.logging.QSLogger
|
||||||
import com.google.common.truth.Truth
|
import com.google.common.truth.Truth
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
import org.mockito.MockitoAnnotations
|
import org.mockito.MockitoAnnotations
|
||||||
|
|
||||||
@@ -19,6 +21,8 @@ import org.mockito.MockitoAnnotations
|
|||||||
@SmallTest
|
@SmallTest
|
||||||
class QuickQSPanelTest : SysuiTestCase() {
|
class QuickQSPanelTest : SysuiTestCase() {
|
||||||
|
|
||||||
|
@Mock private lateinit var qsLogger: QSLogger
|
||||||
|
|
||||||
private lateinit var testableLooper: TestableLooper
|
private lateinit var testableLooper: TestableLooper
|
||||||
private lateinit var quickQSPanel: QuickQSPanel
|
private lateinit var quickQSPanel: QuickQSPanel
|
||||||
|
|
||||||
@@ -32,7 +36,7 @@ class QuickQSPanelTest : SysuiTestCase() {
|
|||||||
|
|
||||||
testableLooper.runWithLooper {
|
testableLooper.runWithLooper {
|
||||||
quickQSPanel = QuickQSPanel(mContext, null)
|
quickQSPanel = QuickQSPanel(mContext, null)
|
||||||
quickQSPanel.initialize()
|
quickQSPanel.initialize(qsLogger)
|
||||||
|
|
||||||
quickQSPanel.onFinishInflate()
|
quickQSPanel.onFinishInflate()
|
||||||
// Provides a parent with non-zero size for QSPanel
|
// Provides a parent with non-zero size for QSPanel
|
||||||
|
|||||||
Reference in New Issue
Block a user