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

Commit 5b505035 authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Add keyguardIndication debug logs" into tm-qpr-dev

parents 61db5d25 c66723bd
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -16,9 +16,11 @@

package com.android.keyguard.logging

import com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController
import com.android.systemui.log.dagger.KeyguardLog
import com.android.systemui.plugins.log.LogBuffer
import com.android.systemui.plugins.log.LogLevel
import com.android.systemui.statusbar.KeyguardIndicationController
import com.google.errorprone.annotations.CompileTimeConstant
import javax.inject.Inject

@@ -76,4 +78,46 @@ constructor(
            { "$str1 msgId: $str2 msg: $str3" }
        )
    }

    fun logUpdateDeviceEntryIndication(
        animate: Boolean,
        visible: Boolean,
        dozing: Boolean,
    ) {
        buffer.log(
            KeyguardIndicationController.TAG,
            LogLevel.DEBUG,
            {
                bool1 = animate
                bool2 = visible
                bool3 = dozing
            },
            { "updateDeviceEntryIndication animate:$bool1 visible:$bool2 dozing $bool3" }
        )
    }

    fun logKeyguardSwitchIndication(
        type: Int,
        message: String?,
    ) {
        buffer.log(
            KeyguardIndicationController.TAG,
            LogLevel.DEBUG,
            {
                int1 = type
                str1 = message
            },
            { "keyguardSwitchIndication ${getKeyguardSwitchIndicationNonSensitiveLog(int1, str1)}" }
        )
    }

    fun getKeyguardSwitchIndicationNonSensitiveLog(type: Int, message: String?): String {
        // only show the battery string. other strings may contain sensitive info
        return if (type == KeyguardIndicationRotateTextViewController.INDICATION_TYPE_BATTERY) {
            "type=${KeyguardIndicationRotateTextViewController.indicationTypeToString(type)}" +
                " message=$message"
        } else {
            "type=${KeyguardIndicationRotateTextViewController.indicationTypeToString(type)}"
        }
    }
}
+46 −3
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.text.TextUtils;

import androidx.annotation.IntDef;

import com.android.keyguard.logging.KeyguardLogger;
import com.android.systemui.Dumpable;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -64,6 +65,7 @@ public class KeyguardIndicationRotateTextViewController extends
            2000L + KeyguardIndicationTextView.Y_IN_DURATION;

    private final StatusBarStateController mStatusBarStateController;
    private final KeyguardLogger mLogger;
    private final float mMaxAlpha;
    private final ColorStateList mInitialTextColorState;

@@ -85,7 +87,8 @@ public class KeyguardIndicationRotateTextViewController extends
    public KeyguardIndicationRotateTextViewController(
            KeyguardIndicationTextView view,
            @Main DelayableExecutor executor,
            StatusBarStateController statusBarStateController
            StatusBarStateController statusBarStateController,
            KeyguardLogger logger
    ) {
        super(view);
        mMaxAlpha = view.getAlpha();
@@ -93,6 +96,7 @@ public class KeyguardIndicationRotateTextViewController extends
        mInitialTextColorState = mView != null
                ? mView.getTextColors() : ColorStateList.valueOf(Color.WHITE);
        mStatusBarStateController = statusBarStateController;
        mLogger = logger;
        init();
    }

@@ -259,6 +263,8 @@ public class KeyguardIndicationRotateTextViewController extends
        mLastIndicationSwitch = SystemClock.uptimeMillis();
        if (!TextUtils.equals(previousMessage, mCurrMessage)
                || previousIndicationType != mCurrIndicationType) {
            mLogger.logKeyguardSwitchIndication(type,
                    mCurrMessage != null ? mCurrMessage.toString() : null);
            mView.switchIndication(mIndicationMessages.get(type));
        }

@@ -352,9 +358,10 @@ public class KeyguardIndicationRotateTextViewController extends
    @Override
    public void dump(PrintWriter pw, String[] args) {
        pw.println("KeyguardIndicationRotatingTextViewController:");
        pw.println("    currentMessage=" + mView.getText());
        pw.println("    currentTextViewMessage=" + mView.getText());
        pw.println("    currentStoredMessage=" + mView.getMessage());
        pw.println("    dozing:" + mIsDozing);
        pw.println("    queue:" + mIndicationQueue.toString());
        pw.println("    queue:" + mIndicationQueue);
        pw.println("    showNextIndicationRunnable:" + mShowNextIndicationRunnable);

        if (hasIndications()) {
@@ -398,4 +405,40 @@ public class KeyguardIndicationRotateTextViewController extends
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface IndicationType{}

    /**
     * Get human-readable string representation of the indication type.
     */
    public static String indicationTypeToString(@IndicationType int type) {
        switch (type) {
            case INDICATION_TYPE_NONE:
                return "none";
            case INDICATION_TYPE_DISCLOSURE:
                return "disclosure";
            case INDICATION_TYPE_OWNER_INFO:
                return "owner_info";
            case INDICATION_TYPE_LOGOUT:
                return "logout";
            case INDICATION_TYPE_BATTERY:
                return "battery";
            case INDICATION_TYPE_ALIGNMENT:
                return "alignment";
            case INDICATION_TYPE_TRANSIENT:
                return "transient";
            case INDICATION_TYPE_TRUST:
                return "trust";
            case INDICATION_TYPE_PERSISTENT_UNLOCK_MESSAGE:
                return "persistent_unlock_message";
            case INDICATION_TYPE_USER_LOCKED:
                return "user_locked";
            case INDICATION_TYPE_REVERSE_CHARGING:
                return "reverse_charging";
            case INDICATION_TYPE_BIOMETRIC_MESSAGE:
                return "biometric_message";
            case INDICATION_TYPE_BIOMETRIC_MESSAGE_FOLLOW_UP:
                return "biometric_message_followup";
            default:
                return "unknown[" + type + "]";
        }
    }
}
+9 −4
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ import com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController;
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.domain.interactor.AlternateBouncerInteractor;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.log.LogLevel;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
@@ -127,7 +128,7 @@ import javax.inject.Inject;
@SysUISingleton
public class KeyguardIndicationController {

    private static final String TAG = "KeyguardIndication";
    public static final String TAG = "KeyguardIndication";
    private static final boolean DEBUG_CHARGING_SPEED = false;

    private static final int MSG_SHOW_ACTION_TO_UNLOCK = 1;
@@ -329,7 +330,9 @@ public class KeyguardIndicationController {
        mRotateTextViewController = new KeyguardIndicationRotateTextViewController(
                mLockScreenIndicationView,
                mExecutor,
            mStatusBarStateController);
                mStatusBarStateController,
                mKeyguardLogger
        );
        updateDeviceEntryIndication(false /* animate */);
        updateOrganizedOwnedDevice();
        if (mBroadcastReceiver == null) {
@@ -830,6 +833,7 @@ public class KeyguardIndicationController {
     * may continuously be cycled through.
     */
    protected final void updateDeviceEntryIndication(boolean animate) {
        mKeyguardLogger.logUpdateDeviceEntryIndication(animate, mVisible, mDozing);
        if (!mVisible) {
            return;
        }
@@ -1417,6 +1421,7 @@ public class KeyguardIndicationController {
        public void onKeyguardShowingChanged() {
            // All transient messages are gone the next time keyguard is shown
            if (!mKeyguardStateController.isShowing()) {
                mKeyguardLogger.log(TAG, LogLevel.DEBUG, "clear messages");
                mTopIndicationView.clearMessages();
                mRotateTextViewController.clearMessages();
            } else {
+7 −0
Original line number Diff line number Diff line
@@ -165,6 +165,13 @@ public class KeyguardIndicationTextView extends TextView {
        }
    }

    /**
     * Get the message that should be shown after the previous text animates out.
     */
    public CharSequence getMessage() {
        return mMessage;
    }

    private AnimatorSet getOutAnimator() {
        AnimatorSet animatorSet = new AnimatorSet();
        Animator fadeOut = ObjectAnimator.ofFloat(this, View.ALPHA, 0f);
+4 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import android.testing.TestableLooper.RunWithLooper;

import androidx.test.filters.SmallTest;

import com.android.keyguard.logging.KeyguardLogger;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
@@ -66,6 +67,8 @@ public class KeyguardIndicationRotateTextViewControllerTest extends SysuiTestCas
    private KeyguardIndicationTextView mView;
    @Mock
    private StatusBarStateController mStatusBarStateController;
    @Mock
    private KeyguardLogger mLogger;
    @Captor
    private ArgumentCaptor<StatusBarStateController.StateListener> mStatusBarStateListenerCaptor;

@@ -77,7 +80,7 @@ public class KeyguardIndicationRotateTextViewControllerTest extends SysuiTestCas
        MockitoAnnotations.initMocks(this);
        when(mView.getTextColors()).thenReturn(ColorStateList.valueOf(Color.WHITE));
        mController = new KeyguardIndicationRotateTextViewController(mView, mExecutor,
                mStatusBarStateController);
                mStatusBarStateController, mLogger);
        mController.onViewAttached();

        verify(mStatusBarStateController).addCallback(mStatusBarStateListenerCaptor.capture());