Merge "Update LogBuffer pattern in some keyguard code" into tm-qpr-dev am: b6fe548430 am: a776a5ea14
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20838593 Change-Id: I835742ca53edc8f92ee90e1f1adf1372b2b540ee Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -54,7 +54,6 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
defStyleAttr: Int = 0,
|
||||
defStyleRes: Int = 0
|
||||
) : TextView(context, attrs, defStyleAttr, defStyleRes) {
|
||||
var tag: String = "UnnamedClockView"
|
||||
var logBuffer: LogBuffer? = null
|
||||
|
||||
private val time = Calendar.getInstance()
|
||||
@@ -132,7 +131,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
logBuffer?.log(tag, DEBUG, "onAttachedToWindow")
|
||||
logBuffer?.log(TAG, DEBUG, "onAttachedToWindow")
|
||||
refreshFormat()
|
||||
}
|
||||
|
||||
@@ -148,7 +147,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
time.timeInMillis = timeOverrideInMillis ?: System.currentTimeMillis()
|
||||
contentDescription = DateFormat.format(descFormat, time)
|
||||
val formattedText = DateFormat.format(format, time)
|
||||
logBuffer?.log(tag, DEBUG,
|
||||
logBuffer?.log(TAG, DEBUG,
|
||||
{ str1 = formattedText?.toString() },
|
||||
{ "refreshTime: new formattedText=$str1" }
|
||||
)
|
||||
@@ -157,7 +156,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
// relayout if the text didn't actually change.
|
||||
if (!TextUtils.equals(text, formattedText)) {
|
||||
text = formattedText
|
||||
logBuffer?.log(tag, DEBUG,
|
||||
logBuffer?.log(TAG, DEBUG,
|
||||
{ str1 = formattedText?.toString() },
|
||||
{ "refreshTime: done setting new time text to: $str1" }
|
||||
)
|
||||
@@ -167,17 +166,17 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
// without being notified TextInterpolator being notified.
|
||||
if (layout != null) {
|
||||
textAnimator?.updateLayout(layout)
|
||||
logBuffer?.log(tag, DEBUG, "refreshTime: done updating textAnimator layout")
|
||||
logBuffer?.log(TAG, DEBUG, "refreshTime: done updating textAnimator layout")
|
||||
}
|
||||
requestLayout()
|
||||
logBuffer?.log(tag, DEBUG, "refreshTime: after requestLayout")
|
||||
logBuffer?.log(TAG, DEBUG, "refreshTime: after requestLayout")
|
||||
}
|
||||
}
|
||||
|
||||
fun onTimeZoneChanged(timeZone: TimeZone?) {
|
||||
time.timeZone = timeZone
|
||||
refreshFormat()
|
||||
logBuffer?.log(tag, DEBUG,
|
||||
logBuffer?.log(TAG, DEBUG,
|
||||
{ str1 = timeZone?.toString() },
|
||||
{ "onTimeZoneChanged newTimeZone=$str1" }
|
||||
)
|
||||
@@ -194,7 +193,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
} else {
|
||||
animator.updateLayout(layout)
|
||||
}
|
||||
logBuffer?.log(tag, DEBUG, "onMeasure")
|
||||
logBuffer?.log(TAG, DEBUG, "onMeasure")
|
||||
}
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
@@ -206,12 +205,12 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
} else {
|
||||
super.onDraw(canvas)
|
||||
}
|
||||
logBuffer?.log(tag, DEBUG, "onDraw lastDraw")
|
||||
logBuffer?.log(TAG, DEBUG, "onDraw")
|
||||
}
|
||||
|
||||
override fun invalidate() {
|
||||
super.invalidate()
|
||||
logBuffer?.log(tag, DEBUG, "invalidate")
|
||||
logBuffer?.log(TAG, DEBUG, "invalidate")
|
||||
}
|
||||
|
||||
override fun onTextChanged(
|
||||
@@ -221,7 +220,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
lengthAfter: Int
|
||||
) {
|
||||
super.onTextChanged(text, start, lengthBefore, lengthAfter)
|
||||
logBuffer?.log(tag, DEBUG,
|
||||
logBuffer?.log(TAG, DEBUG,
|
||||
{ str1 = text.toString() },
|
||||
{ "onTextChanged text=$str1" }
|
||||
)
|
||||
@@ -238,7 +237,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
fun animateColorChange() {
|
||||
logBuffer?.log(tag, DEBUG, "animateColorChange")
|
||||
logBuffer?.log(TAG, DEBUG, "animateColorChange")
|
||||
setTextStyle(
|
||||
weight = lockScreenWeight,
|
||||
textSize = -1f,
|
||||
@@ -260,7 +259,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
fun animateAppearOnLockscreen() {
|
||||
logBuffer?.log(tag, DEBUG, "animateAppearOnLockscreen")
|
||||
logBuffer?.log(TAG, DEBUG, "animateAppearOnLockscreen")
|
||||
setTextStyle(
|
||||
weight = dozingWeight,
|
||||
textSize = -1f,
|
||||
@@ -285,7 +284,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
if (isAnimationEnabled && textAnimator == null) {
|
||||
return
|
||||
}
|
||||
logBuffer?.log(tag, DEBUG, "animateFoldAppear")
|
||||
logBuffer?.log(TAG, DEBUG, "animateFoldAppear")
|
||||
setTextStyle(
|
||||
weight = lockScreenWeightInternal,
|
||||
textSize = -1f,
|
||||
@@ -312,7 +311,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
// Skip charge animation if dozing animation is already playing.
|
||||
return
|
||||
}
|
||||
logBuffer?.log(tag, DEBUG, "animateCharge")
|
||||
logBuffer?.log(TAG, DEBUG, "animateCharge")
|
||||
val startAnimPhase2 = Runnable {
|
||||
setTextStyle(
|
||||
weight = if (isDozing()) dozingWeight else lockScreenWeight,
|
||||
@@ -336,7 +335,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
fun animateDoze(isDozing: Boolean, animate: Boolean) {
|
||||
logBuffer?.log(tag, DEBUG, "animateDoze")
|
||||
logBuffer?.log(TAG, DEBUG, "animateDoze")
|
||||
setTextStyle(
|
||||
weight = if (isDozing) dozingWeight else lockScreenWeight,
|
||||
textSize = -1f,
|
||||
@@ -455,7 +454,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
isSingleLineInternal && !use24HourFormat -> Patterns.sClockView12
|
||||
else -> DOUBLE_LINE_FORMAT_12_HOUR
|
||||
}
|
||||
logBuffer?.log(tag, DEBUG,
|
||||
logBuffer?.log(TAG, DEBUG,
|
||||
{ str1 = format?.toString() },
|
||||
{ "refreshFormat format=$str1" }
|
||||
)
|
||||
@@ -466,6 +465,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
|
||||
fun dump(pw: PrintWriter) {
|
||||
pw.println("$this")
|
||||
pw.println(" alpha=$alpha")
|
||||
pw.println(" measuredWidth=$measuredWidth")
|
||||
pw.println(" measuredHeight=$measuredHeight")
|
||||
pw.println(" singleLineInternal=$isSingleLineInternal")
|
||||
@@ -626,7 +626,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TAG = AnimatableClockView::class.simpleName
|
||||
private val TAG = AnimatableClockView::class.simpleName!!
|
||||
const val ANIMATION_DURATION_FOLD_TO_AOD: Int = 600
|
||||
private const val DOUBLE_LINE_FORMAT_12_HOUR = "hh\nmm"
|
||||
private const val DOUBLE_LINE_FORMAT_24_HOUR = "HH\nmm"
|
||||
|
||||
@@ -88,13 +88,6 @@ class DefaultClockController(
|
||||
events.onTimeTick()
|
||||
}
|
||||
|
||||
override fun setLogBuffer(logBuffer: LogBuffer) {
|
||||
smallClock.view.tag = "smallClockView"
|
||||
largeClock.view.tag = "largeClockView"
|
||||
smallClock.view.logBuffer = logBuffer
|
||||
largeClock.view.logBuffer = logBuffer
|
||||
}
|
||||
|
||||
open inner class DefaultClockFaceController(
|
||||
override val view: AnimatableClockView,
|
||||
) : ClockFaceController {
|
||||
@@ -104,6 +97,12 @@ class DefaultClockController(
|
||||
private var isRegionDark = false
|
||||
protected var targetRegion: Rect? = null
|
||||
|
||||
override var logBuffer: LogBuffer?
|
||||
get() = view.logBuffer
|
||||
set(value) {
|
||||
view.logBuffer = value
|
||||
}
|
||||
|
||||
init {
|
||||
view.setColors(currentColor, currentColor)
|
||||
}
|
||||
|
||||
@@ -71,9 +71,6 @@ interface ClockController {
|
||||
|
||||
/** Optional method for dumping debug information */
|
||||
fun dump(pw: PrintWriter) {}
|
||||
|
||||
/** Optional method for debug logging */
|
||||
fun setLogBuffer(logBuffer: LogBuffer) {}
|
||||
}
|
||||
|
||||
/** Interface for a specific clock face version rendered by the clock */
|
||||
@@ -83,6 +80,9 @@ interface ClockFaceController {
|
||||
|
||||
/** Events specific to this clock face */
|
||||
val events: ClockFaceEvents
|
||||
|
||||
/** Some clocks may log debug information */
|
||||
var logBuffer: LogBuffer?
|
||||
}
|
||||
|
||||
/** Events that should call when various rendering parameters change */
|
||||
|
||||
@@ -159,8 +159,13 @@ constructor(
|
||||
* bug report more actionable, so using the [log] with a messagePrinter to add more detail to
|
||||
* every log may do more to improve overall logging than adding more logs with this method.
|
||||
*/
|
||||
fun log(tag: String, level: LogLevel, @CompileTimeConstant message: String) =
|
||||
log(tag, level, { str1 = message }, { str1!! })
|
||||
@JvmOverloads
|
||||
fun log(
|
||||
tag: String,
|
||||
level: LogLevel,
|
||||
@CompileTimeConstant message: String,
|
||||
exception: Throwable? = null,
|
||||
) = log(tag, level, { str1 = message }, { str1!! }, exception)
|
||||
|
||||
/**
|
||||
* You should call [log] instead of this method.
|
||||
|
||||
@@ -38,9 +38,11 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
|
||||
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
|
||||
import com.android.systemui.keyguard.shared.model.TransitionState
|
||||
import com.android.systemui.lifecycle.repeatWhenAttached
|
||||
import com.android.systemui.log.dagger.KeyguardClockLog
|
||||
import com.android.systemui.log.dagger.KeyguardSmallClockLog
|
||||
import com.android.systemui.log.dagger.KeyguardLargeClockLog
|
||||
import com.android.systemui.plugins.ClockController
|
||||
import com.android.systemui.plugins.log.LogBuffer
|
||||
import com.android.systemui.plugins.log.LogLevel.DEBUG
|
||||
import com.android.systemui.shared.regionsampling.RegionSampler
|
||||
import com.android.systemui.statusbar.policy.BatteryController
|
||||
import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback
|
||||
@@ -73,16 +75,18 @@ open class ClockEventController @Inject constructor(
|
||||
private val context: Context,
|
||||
@Main private val mainExecutor: Executor,
|
||||
@Background private val bgExecutor: Executor,
|
||||
@KeyguardClockLog private val logBuffer: LogBuffer?,
|
||||
@KeyguardSmallClockLog private val smallLogBuffer: LogBuffer?,
|
||||
@KeyguardLargeClockLog private val largeLogBuffer: LogBuffer?,
|
||||
private val featureFlags: FeatureFlags
|
||||
) {
|
||||
var clock: ClockController? = null
|
||||
set(value) {
|
||||
field = value
|
||||
if (value != null) {
|
||||
if (logBuffer != null) {
|
||||
value.setLogBuffer(logBuffer)
|
||||
}
|
||||
smallLogBuffer?.log(TAG, DEBUG, {}, { "New Clock" })
|
||||
value.smallClock.logBuffer = smallLogBuffer
|
||||
largeLogBuffer?.log(TAG, DEBUG, {}, { "New Clock" })
|
||||
value.largeClock.logBuffer = largeLogBuffer
|
||||
|
||||
value.initialize(resources, dozeAmount, 0f)
|
||||
updateRegionSamplers(value)
|
||||
@@ -325,4 +329,8 @@ open class ClockEventController @Inject constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TAG = ClockEventController::class.simpleName!!
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -20,11 +19,15 @@ import com.android.keyguard.dagger.KeyguardStatusViewScope;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.animation.Interpolators;
|
||||
import com.android.systemui.plugins.ClockController;
|
||||
import com.android.systemui.plugins.log.LogBuffer;
|
||||
import com.android.systemui.plugins.log.LogLevel;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import kotlin.Unit;
|
||||
|
||||
/**
|
||||
* Switch to show plugin clock when plugin is connected, otherwise it will show default clock.
|
||||
*/
|
||||
@@ -87,6 +90,7 @@ public class KeyguardClockSwitch extends RelativeLayout {
|
||||
private int mClockSwitchYAmount;
|
||||
@VisibleForTesting boolean mChildrenAreLaidOut = false;
|
||||
@VisibleForTesting boolean mAnimateOnLayout = true;
|
||||
private LogBuffer mLogBuffer = null;
|
||||
|
||||
public KeyguardClockSwitch(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -113,6 +117,14 @@ public class KeyguardClockSwitch extends RelativeLayout {
|
||||
onDensityOrFontScaleChanged();
|
||||
}
|
||||
|
||||
public void setLogBuffer(LogBuffer logBuffer) {
|
||||
mLogBuffer = logBuffer;
|
||||
}
|
||||
|
||||
public LogBuffer getLogBuffer() {
|
||||
return mLogBuffer;
|
||||
}
|
||||
|
||||
void setClock(ClockController clock, int statusBarState) {
|
||||
mClock = clock;
|
||||
|
||||
@@ -121,12 +133,16 @@ public class KeyguardClockSwitch extends RelativeLayout {
|
||||
mLargeClockFrame.removeAllViews();
|
||||
|
||||
if (clock == null) {
|
||||
Log.e(TAG, "No clock being shown");
|
||||
if (mLogBuffer != null) {
|
||||
mLogBuffer.log(TAG, LogLevel.ERROR, "No clock being shown");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Attach small and big clock views to hierarchy.
|
||||
Log.i(TAG, "Attached new clock views to switch");
|
||||
if (mLogBuffer != null) {
|
||||
mLogBuffer.log(TAG, LogLevel.INFO, "Attached new clock views to switch");
|
||||
}
|
||||
mSmallClockFrame.addView(clock.getSmallClock().getView());
|
||||
mLargeClockFrame.addView(clock.getLargeClock().getView());
|
||||
updateClockTargetRegions();
|
||||
@@ -152,8 +168,18 @@ public class KeyguardClockSwitch extends RelativeLayout {
|
||||
}
|
||||
|
||||
private void updateClockViews(boolean useLargeClock, boolean animate) {
|
||||
Log.i(TAG, "updateClockViews; useLargeClock=" + useLargeClock + "; animate=" + animate
|
||||
+ "; mChildrenAreLaidOut=" + mChildrenAreLaidOut);
|
||||
if (mLogBuffer != null) {
|
||||
mLogBuffer.log(TAG, LogLevel.DEBUG, (msg) -> {
|
||||
msg.setBool1(useLargeClock);
|
||||
msg.setBool2(animate);
|
||||
msg.setBool3(mChildrenAreLaidOut);
|
||||
return Unit.INSTANCE;
|
||||
}, (msg) -> "updateClockViews"
|
||||
+ "; useLargeClock=" + msg.getBool1()
|
||||
+ "; animate=" + msg.getBool2()
|
||||
+ "; mChildrenAreLaidOut=" + msg.getBool3());
|
||||
}
|
||||
|
||||
if (mClockInAnim != null) mClockInAnim.cancel();
|
||||
if (mClockOutAnim != null) mClockOutAnim.cancel();
|
||||
if (mStatusAreaAnim != null) mStatusAreaAnim.cancel();
|
||||
@@ -269,7 +295,9 @@ public class KeyguardClockSwitch extends RelativeLayout {
|
||||
public void dump(PrintWriter pw, String[] args) {
|
||||
pw.println("KeyguardClockSwitch:");
|
||||
pw.println(" mSmallClockFrame: " + mSmallClockFrame);
|
||||
pw.println(" mSmallClockFrame.alpha: " + mSmallClockFrame.getAlpha());
|
||||
pw.println(" mLargeClockFrame: " + mLargeClockFrame);
|
||||
pw.println(" mLargeClockFrame.alpha: " + mLargeClockFrame.getAlpha());
|
||||
pw.println(" mStatusArea: " + mStatusArea);
|
||||
pw.println(" mDisplayedClockSize: " + mDisplayedClockSize);
|
||||
}
|
||||
|
||||
@@ -38,8 +38,11 @@ import com.android.systemui.R;
|
||||
import com.android.systemui.dagger.qualifiers.Main;
|
||||
import com.android.systemui.dump.DumpManager;
|
||||
import com.android.systemui.keyguard.KeyguardUnlockAnimationController;
|
||||
import com.android.systemui.log.dagger.KeyguardClockLog;
|
||||
import com.android.systemui.plugins.ClockAnimations;
|
||||
import com.android.systemui.plugins.ClockController;
|
||||
import com.android.systemui.plugins.log.LogBuffer;
|
||||
import com.android.systemui.plugins.log.LogLevel;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.shared.clocks.ClockRegistry;
|
||||
import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController;
|
||||
@@ -62,6 +65,8 @@ import javax.inject.Inject;
|
||||
*/
|
||||
public class KeyguardClockSwitchController extends ViewController<KeyguardClockSwitch>
|
||||
implements Dumpable {
|
||||
private static final String TAG = "KeyguardClockSwitchController";
|
||||
|
||||
private final StatusBarStateController mStatusBarStateController;
|
||||
private final ClockRegistry mClockRegistry;
|
||||
private final KeyguardSliceViewController mKeyguardSliceViewController;
|
||||
@@ -70,6 +75,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
|
||||
private final SecureSettings mSecureSettings;
|
||||
private final DumpManager mDumpManager;
|
||||
private final ClockEventController mClockEventController;
|
||||
private final LogBuffer mLogBuffer;
|
||||
|
||||
private FrameLayout mSmallClockFrame; // top aligned clock
|
||||
private FrameLayout mLargeClockFrame; // centered clock
|
||||
@@ -119,7 +125,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
|
||||
SecureSettings secureSettings,
|
||||
@Main Executor uiExecutor,
|
||||
DumpManager dumpManager,
|
||||
ClockEventController clockEventController) {
|
||||
ClockEventController clockEventController,
|
||||
@KeyguardClockLog LogBuffer logBuffer) {
|
||||
super(keyguardClockSwitch);
|
||||
mStatusBarStateController = statusBarStateController;
|
||||
mClockRegistry = clockRegistry;
|
||||
@@ -131,6 +138,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
|
||||
mKeyguardUnlockAnimationController = keyguardUnlockAnimationController;
|
||||
mDumpManager = dumpManager;
|
||||
mClockEventController = clockEventController;
|
||||
mLogBuffer = logBuffer;
|
||||
mView.setLogBuffer(mLogBuffer);
|
||||
|
||||
mClockChangedListener = () -> {
|
||||
setClock(mClockRegistry.createCurrentClock());
|
||||
@@ -378,6 +387,10 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
|
||||
}
|
||||
|
||||
private void setClock(ClockController clock) {
|
||||
if (clock != null && mLogBuffer != null) {
|
||||
mLogBuffer.log(TAG, LogLevel.INFO, "New Clock");
|
||||
}
|
||||
|
||||
mClockEventController.setClock(clock);
|
||||
mView.setClock(clock, mStatusBarStateController.getState());
|
||||
}
|
||||
|
||||
@@ -17,36 +17,46 @@
|
||||
package com.android.keyguard.logging
|
||||
|
||||
import com.android.systemui.log.dagger.KeyguardLog
|
||||
import com.android.systemui.plugins.log.ConstantStringsLogger
|
||||
import com.android.systemui.plugins.log.ConstantStringsLoggerImpl
|
||||
import com.android.systemui.plugins.log.LogBuffer
|
||||
import com.android.systemui.plugins.log.LogLevel.DEBUG
|
||||
import com.android.systemui.plugins.log.LogLevel.ERROR
|
||||
import com.android.systemui.plugins.log.LogLevel.INFO
|
||||
import com.android.systemui.plugins.log.LogLevel.VERBOSE
|
||||
import com.android.systemui.plugins.log.LogLevel
|
||||
import com.google.errorprone.annotations.CompileTimeConstant
|
||||
import javax.inject.Inject
|
||||
|
||||
private const val TAG = "KeyguardLog"
|
||||
private const val BIO_TAG = "KeyguardLog"
|
||||
|
||||
/**
|
||||
* Generic logger for keyguard that's wrapping [LogBuffer]. This class should be used for adding
|
||||
* temporary logs or logs for smaller classes when creating whole new [LogBuffer] wrapper might be
|
||||
* an overkill.
|
||||
*/
|
||||
class KeyguardLogger @Inject constructor(@KeyguardLog val buffer: LogBuffer) :
|
||||
ConstantStringsLogger by ConstantStringsLoggerImpl(buffer, TAG) {
|
||||
class KeyguardLogger
|
||||
@Inject
|
||||
constructor(
|
||||
@KeyguardLog val buffer: LogBuffer,
|
||||
) {
|
||||
@JvmOverloads
|
||||
fun log(
|
||||
tag: String,
|
||||
level: LogLevel,
|
||||
@CompileTimeConstant msg: String,
|
||||
ex: Throwable? = null,
|
||||
) = buffer.log(tag, level, msg, ex)
|
||||
|
||||
fun logException(ex: Exception, @CompileTimeConstant logMsg: String) {
|
||||
buffer.log(TAG, ERROR, {}, { logMsg }, exception = ex)
|
||||
}
|
||||
|
||||
fun v(msg: String, arg: Any) {
|
||||
buffer.log(TAG, VERBOSE, { str1 = arg.toString() }, { "$msg: $str1" })
|
||||
}
|
||||
|
||||
fun i(msg: String, arg: Any) {
|
||||
buffer.log(TAG, INFO, { str1 = arg.toString() }, { "$msg: $str1" })
|
||||
fun log(
|
||||
tag: String,
|
||||
level: LogLevel,
|
||||
@CompileTimeConstant msg: String,
|
||||
arg: Any,
|
||||
) {
|
||||
buffer.log(
|
||||
tag,
|
||||
level,
|
||||
{
|
||||
str1 = msg
|
||||
str2 = arg.toString()
|
||||
},
|
||||
{ "$str1: $str2" }
|
||||
)
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
@@ -56,8 +66,8 @@ class KeyguardLogger @Inject constructor(@KeyguardLog val buffer: LogBuffer) :
|
||||
msg: String? = null
|
||||
) {
|
||||
buffer.log(
|
||||
TAG,
|
||||
DEBUG,
|
||||
BIO_TAG,
|
||||
LogLevel.DEBUG,
|
||||
{
|
||||
str1 = context
|
||||
str2 = "$msgId"
|
||||
|
||||
@@ -19,11 +19,14 @@ package com.android.systemui.keyguard.domain.interactor
|
||||
import com.android.keyguard.logging.KeyguardLogger
|
||||
import com.android.systemui.dagger.SysUISingleton
|
||||
import com.android.systemui.dagger.qualifiers.Application
|
||||
import com.android.systemui.plugins.log.LogLevel.VERBOSE
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
private val TAG = KeyguardTransitionAuditLogger::class.simpleName!!
|
||||
|
||||
/** Collect flows of interest for auditing keyguard transitions. */
|
||||
@SysUISingleton
|
||||
class KeyguardTransitionAuditLogger
|
||||
@@ -37,35 +40,47 @@ constructor(
|
||||
|
||||
fun start() {
|
||||
scope.launch {
|
||||
keyguardInteractor.wakefulnessModel.collect { logger.v("WakefulnessModel", it) }
|
||||
keyguardInteractor.wakefulnessModel.collect {
|
||||
logger.log(TAG, VERBOSE, "WakefulnessModel", it)
|
||||
}
|
||||
}
|
||||
|
||||
scope.launch {
|
||||
keyguardInteractor.isBouncerShowing.collect { logger.v("Bouncer showing", it) }
|
||||
keyguardInteractor.isBouncerShowing.collect {
|
||||
logger.log(TAG, VERBOSE, "Bouncer showing", it)
|
||||
}
|
||||
}
|
||||
|
||||
scope.launch { keyguardInteractor.isDozing.collect { logger.v("isDozing", it) } }
|
||||
scope.launch {
|
||||
keyguardInteractor.isDozing.collect { logger.log(TAG, VERBOSE, "isDozing", it) }
|
||||
}
|
||||
|
||||
scope.launch { keyguardInteractor.isDreaming.collect { logger.v("isDreaming", it) } }
|
||||
scope.launch {
|
||||
keyguardInteractor.isDreaming.collect { logger.log(TAG, VERBOSE, "isDreaming", it) }
|
||||
}
|
||||
|
||||
scope.launch {
|
||||
interactor.finishedKeyguardTransitionStep.collect {
|
||||
logger.i("Finished transition", it)
|
||||
logger.log(TAG, VERBOSE, "Finished transition", it)
|
||||
}
|
||||
}
|
||||
|
||||
scope.launch {
|
||||
interactor.canceledKeyguardTransitionStep.collect {
|
||||
logger.i("Canceled transition", it)
|
||||
logger.log(TAG, VERBOSE, "Canceled transition", it)
|
||||
}
|
||||
}
|
||||
|
||||
scope.launch {
|
||||
interactor.startedKeyguardTransitionStep.collect { logger.i("Started transition", it) }
|
||||
interactor.startedKeyguardTransitionStep.collect {
|
||||
logger.log(TAG, VERBOSE, "Started transition", it)
|
||||
}
|
||||
}
|
||||
|
||||
scope.launch {
|
||||
keyguardInteractor.dozeTransitionModel.collect { logger.i("Doze transition", it) }
|
||||
keyguardInteractor.dozeTransitionModel.collect {
|
||||
logger.log(TAG, VERBOSE, "Doze transition", it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,3 +23,15 @@ import javax.inject.Qualifier
|
||||
@MustBeDocumented
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class KeyguardClockLog
|
||||
|
||||
/** A [com.android.systemui.plugins.log.LogBuffer] for small keyguard clock logs. */
|
||||
@Qualifier
|
||||
@MustBeDocumented
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class KeyguardSmallClockLog
|
||||
|
||||
/** A [com.android.systemui.plugins.log.LogBuffer] for large keyguard clock logs. */
|
||||
@Qualifier
|
||||
@MustBeDocumented
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class KeyguardLargeClockLog
|
||||
|
||||
@@ -335,13 +335,33 @@ public class LogModule {
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a {@link LogBuffer} for keyguard clock logs.
|
||||
* Provides a {@link LogBuffer} for general keyguard clock logs.
|
||||
*/
|
||||
@Provides
|
||||
@SysUISingleton
|
||||
@KeyguardClockLog
|
||||
public static LogBuffer provideKeyguardClockLog(LogBufferFactory factory) {
|
||||
return factory.create("KeyguardClockLog", 500);
|
||||
return factory.create("KeyguardClockLog", 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a {@link LogBuffer} for keyguard small clock logs.
|
||||
*/
|
||||
@Provides
|
||||
@SysUISingleton
|
||||
@KeyguardSmallClockLog
|
||||
public static LogBuffer provideKeyguardSmallClockLog(LogBufferFactory factory) {
|
||||
return factory.create("KeyguardSmallClockLog", 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a {@link LogBuffer} for keyguard large clock logs.
|
||||
*/
|
||||
@Provides
|
||||
@SysUISingleton
|
||||
@KeyguardLargeClockLog
|
||||
public static LogBuffer provideKeyguardLargeClockLog(LogBufferFactory factory) {
|
||||
return factory.create("KeyguardLargeClockLog", 100);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,6 +41,7 @@ import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewCont
|
||||
import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_USER_LOCKED;
|
||||
import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_ON;
|
||||
import static com.android.systemui.plugins.FalsingManager.LOW_PENALTY;
|
||||
import static com.android.systemui.plugins.log.LogLevel.ERROR;
|
||||
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -1044,7 +1045,7 @@ public class KeyguardIndicationController {
|
||||
mChargingTimeRemaining = mPowerPluggedIn
|
||||
? mBatteryInfo.computeChargeTimeRemaining() : -1;
|
||||
} catch (RemoteException e) {
|
||||
mKeyguardLogger.logException(e, "Error calling IBatteryStats");
|
||||
mKeyguardLogger.log(TAG, ERROR, "Error calling IBatteryStats", e);
|
||||
mChargingTimeRemaining = -1;
|
||||
}
|
||||
updateDeviceEntryIndication(!wasPluggedIn && mPowerPluggedInWired);
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.android.systemui.R;
|
||||
import com.android.systemui.animation.Interpolators;
|
||||
import com.android.systemui.battery.BatteryMeterViewController;
|
||||
import com.android.systemui.dagger.qualifiers.Main;
|
||||
import com.android.systemui.plugins.log.LogLevel;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.shade.NotificationPanelViewController;
|
||||
import com.android.systemui.statusbar.CommandQueue;
|
||||
@@ -76,6 +77,7 @@ import javax.inject.Inject;
|
||||
|
||||
/** View Controller for {@link com.android.systemui.statusbar.phone.KeyguardStatusBarView}. */
|
||||
public class KeyguardStatusBarViewController extends ViewController<KeyguardStatusBarView> {
|
||||
private static final String TAG = "KeyguardStatusBarViewController";
|
||||
private static final AnimationProperties KEYGUARD_HUN_PROPERTIES =
|
||||
new AnimationProperties().setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
|
||||
|
||||
@@ -422,7 +424,7 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
|
||||
|
||||
/** Animate the keyguard status bar in. */
|
||||
public void animateKeyguardStatusBarIn() {
|
||||
mLogger.d("animating status bar in");
|
||||
mLogger.log(TAG, LogLevel.DEBUG, "animating status bar in");
|
||||
if (mDisableStateTracker.isDisabled()) {
|
||||
// If our view is disabled, don't allow us to animate in.
|
||||
return;
|
||||
@@ -438,7 +440,7 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
|
||||
|
||||
/** Animate the keyguard status bar out. */
|
||||
public void animateKeyguardStatusBarOut(long startDelay, long duration) {
|
||||
mLogger.d("animating status bar out");
|
||||
mLogger.log(TAG, LogLevel.DEBUG, "animating status bar out");
|
||||
ValueAnimator anim = ValueAnimator.ofFloat(mView.getAlpha(), 0f);
|
||||
anim.addUpdateListener(mAnimatorUpdateListener);
|
||||
anim.setStartDelay(startDelay);
|
||||
|
||||
@@ -84,7 +84,8 @@ class ClockEventControllerTest : SysuiTestCase() {
|
||||
@Mock private lateinit var transitionRepository: KeyguardTransitionRepository
|
||||
@Mock private lateinit var commandQueue: CommandQueue
|
||||
private lateinit var repository: FakeKeyguardRepository
|
||||
@Mock private lateinit var logBuffer: LogBuffer
|
||||
@Mock private lateinit var smallLogBuffer: LogBuffer
|
||||
@Mock private lateinit var largeLogBuffer: LogBuffer
|
||||
private lateinit var underTest: ClockEventController
|
||||
|
||||
@Before
|
||||
@@ -111,7 +112,8 @@ class ClockEventControllerTest : SysuiTestCase() {
|
||||
context,
|
||||
mainExecutor,
|
||||
bgExecutor,
|
||||
logBuffer,
|
||||
smallLogBuffer,
|
||||
largeLogBuffer,
|
||||
featureFlags
|
||||
)
|
||||
underTest.clock = clock
|
||||
|
||||
@@ -48,6 +48,7 @@ import com.android.systemui.plugins.ClockAnimations;
|
||||
import com.android.systemui.plugins.ClockController;
|
||||
import com.android.systemui.plugins.ClockEvents;
|
||||
import com.android.systemui.plugins.ClockFaceController;
|
||||
import com.android.systemui.plugins.log.LogBuffer;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.shared.clocks.AnimatableClockView;
|
||||
import com.android.systemui.shared.clocks.ClockRegistry;
|
||||
@@ -115,6 +116,8 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
|
||||
private FrameLayout mLargeClockFrame;
|
||||
@Mock
|
||||
private SecureSettings mSecureSettings;
|
||||
@Mock
|
||||
private LogBuffer mLogBuffer;
|
||||
|
||||
private final View mFakeSmartspaceView = new View(mContext);
|
||||
|
||||
@@ -156,7 +159,8 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
|
||||
mSecureSettings,
|
||||
mExecutor,
|
||||
mDumpManager,
|
||||
mClockEventController
|
||||
mClockEventController,
|
||||
mLogBuffer
|
||||
);
|
||||
|
||||
when(mStatusBarStateController.getState()).thenReturn(StatusBarState.SHADE);
|
||||
|
||||
Reference in New Issue
Block a user