Merge "Add QSlog for the background color change of the Internet Tile" into tm-qpr-dev am: 818a28d53a am: f08ac519b5

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20405381

Change-Id: I51b8e80f0af4fd36093372f2b6edbb209885db78
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Ying Xu
2022-11-12 03:42:56 +00:00
committed by Automerger Merge Worker
4 changed files with 52 additions and 5 deletions

View File

@@ -25,6 +25,7 @@ import android.content.ComponentName;
import android.content.res.Configuration;
import android.content.res.Configuration.Orientation;
import android.metrics.LogMaker;
import android.util.Log;
import android.view.View;
import com.android.internal.annotations.VisibleForTesting;
@@ -38,6 +39,7 @@ import com.android.systemui.plugins.qs.QSTileView;
import com.android.systemui.qs.customize.QSCustomizerController;
import com.android.systemui.qs.external.CustomTile;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileViewImpl;
import com.android.systemui.util.LargeScreenUtils;
import com.android.systemui.util.ViewController;
import com.android.systemui.util.animation.DisappearParameters;
@@ -237,6 +239,16 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
private void addTile(final QSTile tile, boolean collapsedView) {
final TileRecord r =
new TileRecord(tile, mHost.createTileView(getContext(), tile, collapsedView));
// TODO(b/250618218): Remove the QSLogger in QSTileViewImpl once we know the root cause of
// b/250618218.
try {
QSTileViewImpl qsTileView = (QSTileViewImpl) (r.tileView);
if (qsTileView != null) {
qsTileView.setQsLogger(mQSLogger);
}
} catch (ClassCastException e) {
Log.e(TAG, "Failed to cast QSTileView to QSTileViewImpl", e);
}
mView.addTile(r);
mRecords.add(r);
mCachedSpecs = getTilesSpecs();

View File

@@ -129,12 +129,36 @@ class QSLogger @Inject constructor(
})
}
fun logInternetTileUpdate(lastType: Int, callback: String) {
fun logInternetTileUpdate(tileSpec: String, lastType: Int, callback: String) {
log(VERBOSE, {
str1 = tileSpec
int1 = lastType
str1 = callback
str2 = callback
}, {
"mLastTileState=$int1, Callback=$str1."
"[$str1] mLastTileState=$int1, Callback=$str2."
})
}
// TODO(b/250618218): Remove this method once we know the root cause of b/250618218.
fun logTileBackgroundColorUpdateIfInternetTile(
tileSpec: String,
state: Int,
disabledByPolicy: Boolean,
color: Int
) {
// This method is added to further debug b/250618218 which has only been observed from the
// InternetTile, so we are only logging the background color change for the InternetTile
// to avoid spamming the QSLogger.
if (tileSpec != "internet") {
return
}
log(VERBOSE, {
str1 = tileSpec
int1 = state
bool1 = disabledByPolicy
int2 = color
}, {
"[$str1] state=$int1, disabledByPolicy=$bool1, color=$int2."
})
}

View File

@@ -50,6 +50,7 @@ import com.android.systemui.plugins.qs.QSIconView
import com.android.systemui.plugins.qs.QSTile
import com.android.systemui.plugins.qs.QSTile.BooleanState
import com.android.systemui.plugins.qs.QSTileView
import com.android.systemui.qs.logging.QSLogger
import com.android.systemui.qs.tileimpl.QSIconViewImpl.QS_ANIM_LENGTH
import java.util.Objects
@@ -116,7 +117,7 @@ open class QSTileViewImpl @JvmOverloads constructor(
protected lateinit var sideView: ViewGroup
private lateinit var customDrawableView: ImageView
private lateinit var chevronView: ImageView
private var mQsLogger: QSLogger? = null
protected var showRippleEffect = true
private lateinit var ripple: RippleDrawable
@@ -188,6 +189,10 @@ open class QSTileViewImpl @JvmOverloads constructor(
updateHeight()
}
fun setQsLogger(qsLogger: QSLogger) {
mQsLogger = qsLogger
}
fun updateResources() {
FontSizeUtils.updateFontSize(label, R.dimen.qs_tile_text_size)
FontSizeUtils.updateFontSize(secondaryLabel, R.dimen.qs_tile_text_size)
@@ -493,6 +498,11 @@ open class QSTileViewImpl @JvmOverloads constructor(
// Colors
if (state.state != lastState || state.disabledByPolicy || lastDisabledByPolicy) {
singleAnimator.cancel()
mQsLogger?.logTileBackgroundColorUpdateIfInternetTile(
state.spec,
state.state,
state.disabledByPolicy,
getBackgroundColorForState(state.state, state.disabledByPolicy))
if (allowAnimations) {
singleAnimator.setValues(
colorValuesHolder(

View File

@@ -387,7 +387,8 @@ public class InternetTile extends QSTileImpl<SignalState> {
@Override
protected void handleUpdateState(SignalState state, Object arg) {
mQSLogger.logInternetTileUpdate(mLastTileState, arg == null ? "null" : arg.toString());
mQSLogger.logInternetTileUpdate(
getTileSpec(), mLastTileState, arg == null ? "null" : arg.toString());
if (arg instanceof CellularCallbackInfo) {
mLastTileState = LAST_STATE_CELLULAR;
handleUpdateCellularState(state, arg);