Loading packages/SystemUI/src/com/android/keyguard/logging/KeyguardLogger.kt +44 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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)}" } } } packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java +46 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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(); Loading @@ -93,6 +96,7 @@ public class KeyguardIndicationRotateTextViewController extends mInitialTextColorState = mView != null ? mView.getTextColors() : ColorStateList.valueOf(Color.WHITE); mStatusBarStateController = statusBarStateController; mLogger = logger; init(); } Loading Loading @@ -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)); } Loading Loading @@ -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()) { Loading Loading @@ -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 + "]"; } } } packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +9 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -329,7 +330,9 @@ public class KeyguardIndicationController { mRotateTextViewController = new KeyguardIndicationRotateTextViewController( mLockScreenIndicationView, mExecutor, mStatusBarStateController); mStatusBarStateController, mKeyguardLogger ); updateDeviceEntryIndication(false /* animate */); updateOrganizedOwnedDevice(); if (mBroadcastReceiver == null) { Loading Loading @@ -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; } Loading Loading @@ -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 { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java +7 −0 Original line number Diff line number Diff line Loading @@ -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); Loading packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewControllerTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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()); Loading Loading
packages/SystemUI/src/com/android/keyguard/logging/KeyguardLogger.kt +44 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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)}" } } }
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java +46 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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(); Loading @@ -93,6 +96,7 @@ public class KeyguardIndicationRotateTextViewController extends mInitialTextColorState = mView != null ? mView.getTextColors() : ColorStateList.valueOf(Color.WHITE); mStatusBarStateController = statusBarStateController; mLogger = logger; init(); } Loading Loading @@ -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)); } Loading Loading @@ -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()) { Loading Loading @@ -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 + "]"; } } }
packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +9 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -329,7 +330,9 @@ public class KeyguardIndicationController { mRotateTextViewController = new KeyguardIndicationRotateTextViewController( mLockScreenIndicationView, mExecutor, mStatusBarStateController); mStatusBarStateController, mKeyguardLogger ); updateDeviceEntryIndication(false /* animate */); updateOrganizedOwnedDevice(); if (mBroadcastReceiver == null) { Loading Loading @@ -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; } Loading Loading @@ -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 { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java +7 −0 Original line number Diff line number Diff line Loading @@ -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); Loading
packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewControllerTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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()); Loading