diff options
| author | 2023-02-08 13:27:12 +0000 | |
|---|---|---|
| committer | 2023-02-08 13:27:12 +0000 | |
| commit | 71c6d78bf71aeae531df611426050c6f56148f07 (patch) | |
| tree | a15a5a7be743b35a5cd6eb4d4ac3a616d27b4e67 | |
| parent | aaad76c2700a3355c1c7a4fa9e4c7001f09a4d6f (diff) | |
| parent | 5b505035a9c76c6631071005dc86f2ff5d867fd6 (diff) | |
Merge "Add keyguardIndication debug logs" into tm-qpr-dev am: 5b505035a9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21181347
Change-Id: I27a7f08a06a750ae76b5a0de21e1f8543e84b981
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
5 files changed, 110 insertions, 8 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/logging/KeyguardLogger.kt b/packages/SystemUI/src/com/android/keyguard/logging/KeyguardLogger.kt index 2c7eceba48a2..379c78ad8d0e 100644 --- a/packages/SystemUI/src/com/android/keyguard/logging/KeyguardLogger.kt +++ b/packages/SystemUI/src/com/android/keyguard/logging/KeyguardLogger.kt @@ -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)}" + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java index 9235e10209d4..0745456b3e43 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java @@ -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 + "]"; + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index 4bf84f76d224..62b0852c6de9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -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; @@ -327,9 +328,11 @@ public class KeyguardIndicationController { mInitialTextColorState = mTopIndicationView != null ? mTopIndicationView.getTextColors() : ColorStateList.valueOf(Color.WHITE); mRotateTextViewController = new KeyguardIndicationRotateTextViewController( - mLockScreenIndicationView, - mExecutor, - mStatusBarStateController); + mLockScreenIndicationView, + mExecutor, + 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 { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java index d24469e8421e..b1553b0d306f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java @@ -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); diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewControllerTest.java index 22906761ac32..c3b0e5226a64 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewControllerTest.java @@ -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()); |