Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b79a130 authored by Ying Xu's avatar Ying Xu
Browse files

Add QSlog for the background color change of the Internet Tile

Bug: 250618218
Test: manual tests
Change-Id: I9a20393cc86c27fbf11beccee64c9746a94900a6
parent 793936a1
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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();
+27 −3
Original line number Diff line number Diff line
@@ -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
        }, {
            "[$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
        }, {
            "mLastTileState=$int1, Callback=$str1."
            "[$str1] state=$int1, disabledByPolicy=$bool1, color=$int2."
        })
    }

+11 −1
Original line number Diff line number Diff line
@@ -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(
+2 −1
Original line number Diff line number Diff line
@@ -383,7 +383,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 = 0;
            handleUpdateCellularState(state, arg);