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

This commit is contained in:
Beverly Tai
2023-02-08 12:53:04 +00:00
committed by Android (Google) Code Review
5 changed files with 110 additions and 8 deletions

View File

@@ -16,9 +16,11 @@
package com.android.keyguard.logging package com.android.keyguard.logging
import com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController
import com.android.systemui.log.dagger.KeyguardLog import com.android.systemui.log.dagger.KeyguardLog
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.statusbar.KeyguardIndicationController
import com.google.errorprone.annotations.CompileTimeConstant import com.google.errorprone.annotations.CompileTimeConstant
import javax.inject.Inject import javax.inject.Inject
@@ -76,4 +78,46 @@ constructor(
{ "$str1 msgId: $str2 msg: $str3" } { "$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)}"
}
}
} }

View File

@@ -24,6 +24,7 @@ import android.text.TextUtils;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import com.android.keyguard.logging.KeyguardLogger;
import com.android.systemui.Dumpable; import com.android.systemui.Dumpable;
import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -64,6 +65,7 @@ public class KeyguardIndicationRotateTextViewController extends
2000L + KeyguardIndicationTextView.Y_IN_DURATION; 2000L + KeyguardIndicationTextView.Y_IN_DURATION;
private final StatusBarStateController mStatusBarStateController; private final StatusBarStateController mStatusBarStateController;
private final KeyguardLogger mLogger;
private final float mMaxAlpha; private final float mMaxAlpha;
private final ColorStateList mInitialTextColorState; private final ColorStateList mInitialTextColorState;
@@ -85,7 +87,8 @@ public class KeyguardIndicationRotateTextViewController extends
public KeyguardIndicationRotateTextViewController( public KeyguardIndicationRotateTextViewController(
KeyguardIndicationTextView view, KeyguardIndicationTextView view,
@Main DelayableExecutor executor, @Main DelayableExecutor executor,
StatusBarStateController statusBarStateController StatusBarStateController statusBarStateController,
KeyguardLogger logger
) { ) {
super(view); super(view);
mMaxAlpha = view.getAlpha(); mMaxAlpha = view.getAlpha();
@@ -93,6 +96,7 @@ public class KeyguardIndicationRotateTextViewController extends
mInitialTextColorState = mView != null mInitialTextColorState = mView != null
? mView.getTextColors() : ColorStateList.valueOf(Color.WHITE); ? mView.getTextColors() : ColorStateList.valueOf(Color.WHITE);
mStatusBarStateController = statusBarStateController; mStatusBarStateController = statusBarStateController;
mLogger = logger;
init(); init();
} }
@@ -259,6 +263,8 @@ public class KeyguardIndicationRotateTextViewController extends
mLastIndicationSwitch = SystemClock.uptimeMillis(); mLastIndicationSwitch = SystemClock.uptimeMillis();
if (!TextUtils.equals(previousMessage, mCurrMessage) if (!TextUtils.equals(previousMessage, mCurrMessage)
|| previousIndicationType != mCurrIndicationType) { || previousIndicationType != mCurrIndicationType) {
mLogger.logKeyguardSwitchIndication(type,
mCurrMessage != null ? mCurrMessage.toString() : null);
mView.switchIndication(mIndicationMessages.get(type)); mView.switchIndication(mIndicationMessages.get(type));
} }
@@ -352,9 +358,10 @@ public class KeyguardIndicationRotateTextViewController extends
@Override @Override
public void dump(PrintWriter pw, String[] args) { public void dump(PrintWriter pw, String[] args) {
pw.println("KeyguardIndicationRotatingTextViewController:"); pw.println("KeyguardIndicationRotatingTextViewController:");
pw.println(" currentMessage=" + mView.getText()); pw.println(" currentTextViewMessage=" + mView.getText());
pw.println(" currentStoredMessage=" + mView.getMessage());
pw.println(" dozing:" + mIsDozing); pw.println(" dozing:" + mIsDozing);
pw.println(" queue:" + mIndicationQueue.toString()); pw.println(" queue:" + mIndicationQueue);
pw.println(" showNextIndicationRunnable:" + mShowNextIndicationRunnable); pw.println(" showNextIndicationRunnable:" + mShowNextIndicationRunnable);
if (hasIndications()) { if (hasIndications()) {
@@ -398,4 +405,40 @@ public class KeyguardIndicationRotateTextViewController extends
}) })
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface IndicationType{} 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 + "]";
}
}
} }

View File

@@ -95,6 +95,7 @@ import com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController;
import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.domain.interactor.AlternateBouncerInteractor; import com.android.systemui.keyguard.domain.interactor.AlternateBouncerInteractor;
import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.log.LogLevel;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.KeyguardIndicationTextView; import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
@@ -127,7 +128,7 @@ import javax.inject.Inject;
@SysUISingleton @SysUISingleton
public class KeyguardIndicationController { 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 boolean DEBUG_CHARGING_SPEED = false;
private static final int MSG_SHOW_ACTION_TO_UNLOCK = 1; private static final int MSG_SHOW_ACTION_TO_UNLOCK = 1;
@@ -329,7 +330,9 @@ public class KeyguardIndicationController {
mRotateTextViewController = new KeyguardIndicationRotateTextViewController( mRotateTextViewController = new KeyguardIndicationRotateTextViewController(
mLockScreenIndicationView, mLockScreenIndicationView,
mExecutor, mExecutor,
mStatusBarStateController); mStatusBarStateController,
mKeyguardLogger
);
updateDeviceEntryIndication(false /* animate */); updateDeviceEntryIndication(false /* animate */);
updateOrganizedOwnedDevice(); updateOrganizedOwnedDevice();
if (mBroadcastReceiver == null) { if (mBroadcastReceiver == null) {
@@ -830,6 +833,7 @@ public class KeyguardIndicationController {
* may continuously be cycled through. * may continuously be cycled through.
*/ */
protected final void updateDeviceEntryIndication(boolean animate) { protected final void updateDeviceEntryIndication(boolean animate) {
mKeyguardLogger.logUpdateDeviceEntryIndication(animate, mVisible, mDozing);
if (!mVisible) { if (!mVisible) {
return; return;
} }
@@ -1417,6 +1421,7 @@ public class KeyguardIndicationController {
public void onKeyguardShowingChanged() { public void onKeyguardShowingChanged() {
// All transient messages are gone the next time keyguard is shown // All transient messages are gone the next time keyguard is shown
if (!mKeyguardStateController.isShowing()) { if (!mKeyguardStateController.isShowing()) {
mKeyguardLogger.log(TAG, LogLevel.DEBUG, "clear messages");
mTopIndicationView.clearMessages(); mTopIndicationView.clearMessages();
mRotateTextViewController.clearMessages(); mRotateTextViewController.clearMessages();
} else { } else {

View File

@@ -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() { private AnimatorSet getOutAnimator() {
AnimatorSet animatorSet = new AnimatorSet(); AnimatorSet animatorSet = new AnimatorSet();
Animator fadeOut = ObjectAnimator.ofFloat(this, View.ALPHA, 0f); Animator fadeOut = ObjectAnimator.ofFloat(this, View.ALPHA, 0f);

View File

@@ -38,6 +38,7 @@ import android.testing.TestableLooper.RunWithLooper;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import com.android.keyguard.logging.KeyguardLogger;
import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.phone.KeyguardIndicationTextView; import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
@@ -66,6 +67,8 @@ public class KeyguardIndicationRotateTextViewControllerTest extends SysuiTestCas
private KeyguardIndicationTextView mView; private KeyguardIndicationTextView mView;
@Mock @Mock
private StatusBarStateController mStatusBarStateController; private StatusBarStateController mStatusBarStateController;
@Mock
private KeyguardLogger mLogger;
@Captor @Captor
private ArgumentCaptor<StatusBarStateController.StateListener> mStatusBarStateListenerCaptor; private ArgumentCaptor<StatusBarStateController.StateListener> mStatusBarStateListenerCaptor;
@@ -77,7 +80,7 @@ public class KeyguardIndicationRotateTextViewControllerTest extends SysuiTestCas
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
when(mView.getTextColors()).thenReturn(ColorStateList.valueOf(Color.WHITE)); when(mView.getTextColors()).thenReturn(ColorStateList.valueOf(Color.WHITE));
mController = new KeyguardIndicationRotateTextViewController(mView, mExecutor, mController = new KeyguardIndicationRotateTextViewController(mView, mExecutor,
mStatusBarStateController); mStatusBarStateController, mLogger);
mController.onViewAttached(); mController.onViewAttached();
verify(mStatusBarStateController).addCallback(mStatusBarStateListenerCaptor.capture()); verify(mStatusBarStateController).addCallback(mStatusBarStateListenerCaptor.capture());