Merge "Fix QS visibility logs missing some info" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
df9b2e8d80
@@ -16,6 +16,7 @@ package com.android.systemui.plugins.qs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.metrics.LogMaker;
|
||||
import android.service.quicksettings.Tile;
|
||||
|
||||
import com.android.systemui.plugins.annotations.DependsOn;
|
||||
@@ -66,6 +67,10 @@ public interface QSTile {
|
||||
|
||||
State getState();
|
||||
|
||||
default LogMaker populate(LogMaker logMaker) {
|
||||
return logMaker;
|
||||
}
|
||||
|
||||
@ProvidesInterface(version = Callback.VERSION)
|
||||
public interface Callback {
|
||||
public static final int VERSION = 1;
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.metrics.LogMaker;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.service.quicksettings.Tile;
|
||||
@@ -30,6 +31,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settingslib.Utils;
|
||||
@@ -179,7 +181,7 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
||||
|
||||
public void openDetails(String subPanel) {
|
||||
QSTile tile = getTile(subPanel);
|
||||
showDetailAdapter(true, tile.getDetailAdapter(), new int[] {getWidth() / 2, 0});
|
||||
showDetailAdapter(true, tile.getDetailAdapter(), new int[]{getWidth() / 2, 0});
|
||||
}
|
||||
|
||||
private QSTile getTile(String subPanel) {
|
||||
@@ -485,8 +487,9 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
||||
|
||||
private void logTiles() {
|
||||
for (int i = 0; i < mRecords.size(); i++) {
|
||||
TileRecord tileRecord = mRecords.get(i);
|
||||
mMetricsLogger.visible(tileRecord.tile.getMetricsCategory());
|
||||
QSTile tile = mRecords.get(i).tile;
|
||||
mMetricsLogger.write(tile.populate(new LogMaker(tile.getMetricsCategory())
|
||||
.setType(MetricsEvent.TYPE_OPEN)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,12 +547,13 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
||||
private static final int SHOW_DETAIL = 1;
|
||||
private static final int SET_TILE_VISIBILITY = 2;
|
||||
private static final int ANNOUNCE_FOR_ACCESSIBILITY = 3;
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
if (msg.what == SHOW_DETAIL) {
|
||||
handleShowDetail((Record)msg.obj, msg.arg1 != 0);
|
||||
handleShowDetail((Record) msg.obj, msg.arg1 != 0);
|
||||
} else if (msg.what == ANNOUNCE_FOR_ACCESSIBILITY) {
|
||||
announceForAccessibility((CharSequence)msg.obj);
|
||||
announceForAccessibility((CharSequence) msg.obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -569,8 +573,11 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
||||
|
||||
public interface QSTileLayout {
|
||||
void addTile(TileRecord tile);
|
||||
|
||||
void removeTile(TileRecord tile);
|
||||
|
||||
int getOffsetTop(TileRecord tile);
|
||||
|
||||
boolean updateResources();
|
||||
|
||||
void setListening(boolean listening);
|
||||
|
||||
@@ -157,7 +157,7 @@ public class CustomTile extends QSTileImpl<State> implements TileChangeListener
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LogMaker populate(LogMaker logMaker) {
|
||||
public LogMaker populate(LogMaker logMaker) {
|
||||
return super.populate(logMaker).setComponentName(mComponent);
|
||||
}
|
||||
|
||||
@@ -275,7 +275,6 @@ public class CustomTile extends QSTileImpl<State> implements TileChangeListener
|
||||
} catch (RemoteException e) {
|
||||
// Called through wrapper, won't happen here.
|
||||
}
|
||||
MetricsLogger.action(mContext, getMetricsCategory(), mComponent.getPackageName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -175,7 +175,7 @@ public abstract class QSTileImpl<TState extends State> implements QSTile {
|
||||
mHandler.sendEmptyMessage(H.LONG_CLICK);
|
||||
}
|
||||
|
||||
protected LogMaker populate(LogMaker logMaker) {
|
||||
public LogMaker populate(LogMaker logMaker) {
|
||||
if (mState instanceof BooleanState) {
|
||||
logMaker.addTaggedData(FIELD_QS_VALUE, ((BooleanState) mState).value ? 1 : 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user