Merge "Adding logging to NotificationShadeWindowController" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
56fbcccf2a
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.systemui.plugins.log
|
||||||
|
|
||||||
|
import com.google.errorprone.annotations.CompileTimeConstant
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handy for adding basic logging with CompileTimeConstant strings - so logging with no variables.
|
||||||
|
* Most likely you want to delegate it to [ConstantStringsLoggerImpl].
|
||||||
|
*/
|
||||||
|
interface ConstantStringsLogger {
|
||||||
|
fun v(@CompileTimeConstant msg: String)
|
||||||
|
|
||||||
|
fun d(@CompileTimeConstant msg: String)
|
||||||
|
|
||||||
|
fun w(@CompileTimeConstant msg: String)
|
||||||
|
|
||||||
|
fun e(@CompileTimeConstant msg: String)
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.systemui.plugins.log
|
||||||
|
|
||||||
|
import com.google.errorprone.annotations.CompileTimeConstant
|
||||||
|
|
||||||
|
class ConstantStringsLoggerImpl(val buffer: LogBuffer, val tag: String) : ConstantStringsLogger {
|
||||||
|
override fun v(@CompileTimeConstant msg: String) = buffer.log(tag, LogLevel.VERBOSE, msg)
|
||||||
|
|
||||||
|
override fun d(@CompileTimeConstant msg: String) = buffer.log(tag, LogLevel.DEBUG, msg)
|
||||||
|
|
||||||
|
override fun w(@CompileTimeConstant msg: String) = buffer.log(tag, LogLevel.WARNING, msg)
|
||||||
|
|
||||||
|
override fun e(@CompileTimeConstant msg: String) = buffer.log(tag, LogLevel.ERROR, msg)
|
||||||
|
}
|
||||||
@@ -17,12 +17,13 @@
|
|||||||
package com.android.keyguard.logging
|
package com.android.keyguard.logging
|
||||||
|
|
||||||
import com.android.systemui.log.dagger.KeyguardLog
|
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.LogBuffer
|
||||||
import com.android.systemui.plugins.log.LogLevel.DEBUG
|
import com.android.systemui.plugins.log.LogLevel.DEBUG
|
||||||
import com.android.systemui.plugins.log.LogLevel.ERROR
|
import com.android.systemui.plugins.log.LogLevel.ERROR
|
||||||
import com.android.systemui.plugins.log.LogLevel.INFO
|
import com.android.systemui.plugins.log.LogLevel.INFO
|
||||||
import com.android.systemui.plugins.log.LogLevel.VERBOSE
|
import com.android.systemui.plugins.log.LogLevel.VERBOSE
|
||||||
import com.android.systemui.plugins.log.LogLevel.WARNING
|
|
||||||
import com.google.errorprone.annotations.CompileTimeConstant
|
import com.google.errorprone.annotations.CompileTimeConstant
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@@ -33,14 +34,8 @@ private const val TAG = "KeyguardLog"
|
|||||||
* temporary logs or logs for smaller classes when creating whole new [LogBuffer] wrapper might be
|
* temporary logs or logs for smaller classes when creating whole new [LogBuffer] wrapper might be
|
||||||
* an overkill.
|
* an overkill.
|
||||||
*/
|
*/
|
||||||
class KeyguardLogger @Inject constructor(@KeyguardLog private val buffer: LogBuffer) {
|
class KeyguardLogger @Inject constructor(@KeyguardLog private val buffer: LogBuffer) :
|
||||||
fun d(@CompileTimeConstant msg: String) = buffer.log(TAG, DEBUG, msg)
|
ConstantStringsLogger by ConstantStringsLoggerImpl(buffer, TAG) {
|
||||||
|
|
||||||
fun e(@CompileTimeConstant msg: String) = buffer.log(TAG, ERROR, msg)
|
|
||||||
|
|
||||||
fun v(@CompileTimeConstant msg: String) = buffer.log(TAG, VERBOSE, msg)
|
|
||||||
|
|
||||||
fun w(@CompileTimeConstant msg: String) = buffer.log(TAG, WARNING, msg)
|
|
||||||
|
|
||||||
fun logException(ex: Exception, @CompileTimeConstant logMsg: String) {
|
fun logException(ex: Exception, @CompileTimeConstant logMsg: String) {
|
||||||
buffer.log(TAG, ERROR, {}, { logMsg }, exception = ex)
|
buffer.log(TAG, ERROR, {}, { logMsg }, exception = ex)
|
||||||
|
|||||||
@@ -94,6 +94,14 @@ public class LogModule {
|
|||||||
return factory.create("LSShadeTransitionLog", 50);
|
return factory.create("LSShadeTransitionLog", 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Provides a logging buffer for shade window messages. */
|
||||||
|
@Provides
|
||||||
|
@SysUISingleton
|
||||||
|
@ShadeWindowLog
|
||||||
|
public static LogBuffer provideShadeWindowLogBuffer(LogBufferFactory factory) {
|
||||||
|
return factory.create("ShadeWindowLog", 600, false);
|
||||||
|
}
|
||||||
|
|
||||||
/** Provides a logging buffer for Shade messages. */
|
/** Provides a logging buffer for Shade messages. */
|
||||||
@Provides
|
@Provides
|
||||||
@SysUISingleton
|
@SysUISingleton
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.systemui.log.dagger;
|
||||||
|
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
|
import com.android.systemui.plugins.log.LogBuffer;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
|
||||||
|
import javax.inject.Qualifier;
|
||||||
|
|
||||||
|
/** A {@link LogBuffer} for shade window modification messages. */
|
||||||
|
@Qualifier
|
||||||
|
@Documented
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
public @interface ShadeWindowLog {
|
||||||
|
}
|
||||||
@@ -18,12 +18,13 @@ package com.android.systemui.qs.logging
|
|||||||
|
|
||||||
import android.service.quicksettings.Tile
|
import android.service.quicksettings.Tile
|
||||||
import com.android.systemui.log.dagger.QSLog
|
import com.android.systemui.log.dagger.QSLog
|
||||||
|
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.LogBuffer
|
||||||
import com.android.systemui.plugins.log.LogLevel
|
import com.android.systemui.plugins.log.LogLevel
|
||||||
import com.android.systemui.plugins.log.LogLevel.DEBUG
|
import com.android.systemui.plugins.log.LogLevel.DEBUG
|
||||||
import com.android.systemui.plugins.log.LogLevel.ERROR
|
import com.android.systemui.plugins.log.LogLevel.ERROR
|
||||||
import com.android.systemui.plugins.log.LogLevel.VERBOSE
|
import com.android.systemui.plugins.log.LogLevel.VERBOSE
|
||||||
import com.android.systemui.plugins.log.LogLevel.WARNING
|
|
||||||
import com.android.systemui.plugins.log.LogMessage
|
import com.android.systemui.plugins.log.LogMessage
|
||||||
import com.android.systemui.plugins.qs.QSTile
|
import com.android.systemui.plugins.qs.QSTile
|
||||||
import com.android.systemui.statusbar.StatusBarState
|
import com.android.systemui.statusbar.StatusBarState
|
||||||
@@ -32,17 +33,8 @@ import javax.inject.Inject
|
|||||||
|
|
||||||
private const val TAG = "QSLog"
|
private const val TAG = "QSLog"
|
||||||
|
|
||||||
class QSLogger @Inject constructor(
|
class QSLogger @Inject constructor(@QSLog private val buffer: LogBuffer) :
|
||||||
@QSLog private val buffer: LogBuffer
|
ConstantStringsLogger by ConstantStringsLoggerImpl(buffer, TAG) {
|
||||||
) {
|
|
||||||
|
|
||||||
fun d(@CompileTimeConstant msg: String) = buffer.log(TAG, DEBUG, msg)
|
|
||||||
|
|
||||||
fun e(@CompileTimeConstant msg: String) = buffer.log(TAG, ERROR, msg)
|
|
||||||
|
|
||||||
fun v(@CompileTimeConstant msg: String) = buffer.log(TAG, VERBOSE, msg)
|
|
||||||
|
|
||||||
fun w(@CompileTimeConstant msg: String) = buffer.log(TAG, WARNING, msg)
|
|
||||||
|
|
||||||
fun logException(@CompileTimeConstant logMsg: String, ex: Exception) {
|
fun logException(@CompileTimeConstant logMsg: String, ex: Exception) {
|
||||||
buffer.log(TAG, ERROR, {}, { logMsg }, exception = ex)
|
buffer.log(TAG, ERROR, {}, { logMsg }, exception = ex)
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ import com.android.systemui.statusbar.policy.KeyguardStateController;
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.lang.ref.Reference;
|
import java.lang.ref.Reference;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -96,6 +95,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
private final IActivityManager mActivityManager;
|
private final IActivityManager mActivityManager;
|
||||||
private final DozeParameters mDozeParameters;
|
private final DozeParameters mDozeParameters;
|
||||||
private final KeyguardStateController mKeyguardStateController;
|
private final KeyguardStateController mKeyguardStateController;
|
||||||
|
private final ShadeWindowLogger mLogger;
|
||||||
private final LayoutParams mLpChanged;
|
private final LayoutParams mLpChanged;
|
||||||
private final long mLockScreenDisplayTimeout;
|
private final long mLockScreenDisplayTimeout;
|
||||||
private final float mKeyguardPreferredRefreshRate; // takes precedence over max
|
private final float mKeyguardPreferredRefreshRate; // takes precedence over max
|
||||||
@@ -137,12 +137,14 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
KeyguardStateController keyguardStateController,
|
KeyguardStateController keyguardStateController,
|
||||||
ScreenOffAnimationController screenOffAnimationController,
|
ScreenOffAnimationController screenOffAnimationController,
|
||||||
AuthController authController,
|
AuthController authController,
|
||||||
ShadeExpansionStateManager shadeExpansionStateManager) {
|
ShadeExpansionStateManager shadeExpansionStateManager,
|
||||||
|
ShadeWindowLogger logger) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mWindowManager = windowManager;
|
mWindowManager = windowManager;
|
||||||
mActivityManager = activityManager;
|
mActivityManager = activityManager;
|
||||||
mDozeParameters = dozeParameters;
|
mDozeParameters = dozeParameters;
|
||||||
mKeyguardStateController = keyguardStateController;
|
mKeyguardStateController = keyguardStateController;
|
||||||
|
mLogger = logger;
|
||||||
mScreenBrightnessDoze = mDozeParameters.getScreenBrightnessDoze();
|
mScreenBrightnessDoze = mDozeParameters.getScreenBrightnessDoze();
|
||||||
mLpChanged = new LayoutParams();
|
mLpChanged = new LayoutParams();
|
||||||
mKeyguardViewMediator = keyguardViewMediator;
|
mKeyguardViewMediator = keyguardViewMediator;
|
||||||
@@ -396,11 +398,13 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
|
|
||||||
private void applyVisibility(State state) {
|
private void applyVisibility(State state) {
|
||||||
boolean visible = isExpanded(state);
|
boolean visible = isExpanded(state);
|
||||||
|
mLogger.logApplyVisibility(visible);
|
||||||
if (state.mForcePluginOpen) {
|
if (state.mForcePluginOpen) {
|
||||||
if (mListener != null) {
|
if (mListener != null) {
|
||||||
mListener.setWouldOtherwiseCollapse(visible);
|
mListener.setWouldOtherwiseCollapse(visible);
|
||||||
}
|
}
|
||||||
visible = true;
|
visible = true;
|
||||||
|
mLogger.d("Visibility forced to be true");
|
||||||
}
|
}
|
||||||
if (mNotificationShadeView != null) {
|
if (mNotificationShadeView != null) {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
@@ -463,6 +467,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
|
|
||||||
private void applyWindowLayoutParams() {
|
private void applyWindowLayoutParams() {
|
||||||
if (mDeferWindowLayoutParams == 0 && mLp != null && mLp.copyFrom(mLpChanged) != 0) {
|
if (mDeferWindowLayoutParams == 0 && mLp != null && mLp.copyFrom(mLpChanged) != 0) {
|
||||||
|
mLogger.logApplyingWindowLayoutParams(mLp);
|
||||||
Trace.beginSection("updateViewLayout");
|
Trace.beginSection("updateViewLayout");
|
||||||
mWindowManager.updateViewLayout(mNotificationShadeView, mLp);
|
mWindowManager.updateViewLayout(mNotificationShadeView, mLp);
|
||||||
Trace.endSection();
|
Trace.endSection();
|
||||||
@@ -478,6 +483,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void apply(State state) {
|
private void apply(State state) {
|
||||||
|
mLogger.logNewState(state);
|
||||||
applyKeyguardFlags(state);
|
applyKeyguardFlags(state);
|
||||||
applyFocusableFlag(state);
|
applyFocusableFlag(state);
|
||||||
applyForceShowNavigationFlag(state);
|
applyForceShowNavigationFlag(state);
|
||||||
@@ -587,6 +593,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
&& mCurrentState.mNotificationShadeFocusable == visible) {
|
&& mCurrentState.mNotificationShadeFocusable == visible) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
mLogger.logShadeVisibleAndFocusable(visible);
|
||||||
mCurrentState.mPanelVisible = visible;
|
mCurrentState.mPanelVisible = visible;
|
||||||
mCurrentState.mNotificationShadeFocusable = visible;
|
mCurrentState.mNotificationShadeFocusable = visible;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
@@ -594,6 +601,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNotificationShadeFocusable(boolean focusable) {
|
public void setNotificationShadeFocusable(boolean focusable) {
|
||||||
|
mLogger.logShadeFocusable(focusable);
|
||||||
mCurrentState.mNotificationShadeFocusable = focusable;
|
mCurrentState.mNotificationShadeFocusable = focusable;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
@@ -730,16 +738,15 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Set<Object> mForceOpenTokens = new HashSet<>();
|
|
||||||
@Override
|
@Override
|
||||||
public void setForcePluginOpen(boolean forceOpen, Object token) {
|
public void setForcePluginOpen(boolean forceOpen, Object token) {
|
||||||
if (forceOpen) {
|
if (forceOpen) {
|
||||||
mForceOpenTokens.add(token);
|
mCurrentState.mForceOpenTokens.add(token);
|
||||||
} else {
|
} else {
|
||||||
mForceOpenTokens.remove(token);
|
mCurrentState.mForceOpenTokens.remove(token);
|
||||||
}
|
}
|
||||||
final boolean previousForceOpenState = mCurrentState.mForcePluginOpen;
|
final boolean previousForceOpenState = mCurrentState.mForcePluginOpen;
|
||||||
mCurrentState.mForcePluginOpen = !mForceOpenTokens.isEmpty();
|
mCurrentState.mForcePluginOpen = !mCurrentState.mForceOpenTokens.isEmpty();
|
||||||
if (previousForceOpenState != mCurrentState.mForcePluginOpen) {
|
if (previousForceOpenState != mCurrentState.mForcePluginOpen) {
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
if (mForcePluginOpenListener != null) {
|
if (mForcePluginOpenListener != null) {
|
||||||
@@ -864,6 +871,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
boolean mWallpaperSupportsAmbientMode;
|
boolean mWallpaperSupportsAmbientMode;
|
||||||
boolean mNotTouchable;
|
boolean mNotTouchable;
|
||||||
Set<String> mComponentsForcingTopUi = new HashSet<>();
|
Set<String> mComponentsForcingTopUi = new HashSet<>();
|
||||||
|
Set<Object> mForceOpenTokens = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The status bar state from {@link CentralSurfaces}.
|
* The status bar state from {@link CentralSurfaces}.
|
||||||
@@ -882,28 +890,37 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder result = new StringBuilder();
|
return new StringBuilder()
|
||||||
String newLine = "\n";
|
.append("State{")
|
||||||
result.append("Window State {");
|
.append(" mKeyguardShowing=").append(mKeyguardShowing)
|
||||||
result.append(newLine);
|
.append(", mKeyguardOccluded=").append(mKeyguardOccluded)
|
||||||
|
.append(", mKeyguardNeedsInput=").append(mKeyguardNeedsInput)
|
||||||
Field[] fields = this.getClass().getDeclaredFields();
|
.append(", mPanelVisible=").append(mPanelVisible)
|
||||||
|
.append(", mPanelExpanded=").append(mPanelExpanded)
|
||||||
// Print field names paired with their values
|
.append(", mNotificationShadeFocusable=").append(mNotificationShadeFocusable)
|
||||||
for (Field field : fields) {
|
.append(", mBouncerShowing=").append(mBouncerShowing)
|
||||||
result.append(" ");
|
.append(", mKeyguardFadingAway=").append(mKeyguardFadingAway)
|
||||||
try {
|
.append(", mKeyguardGoingAway=").append(mKeyguardGoingAway)
|
||||||
result.append(field.getName());
|
.append(", mQsExpanded=").append(mQsExpanded)
|
||||||
result.append(": ");
|
.append(", mHeadsUpShowing=").append(mHeadsUpShowing)
|
||||||
//requires access to private field:
|
.append(", mLightRevealScrimOpaque=").append(mLightRevealScrimOpaque)
|
||||||
result.append(field.get(this));
|
.append(", mForceCollapsed=").append(mForceCollapsed)
|
||||||
} catch (IllegalAccessException ex) {
|
.append(", mForceDozeBrightness=").append(mForceDozeBrightness)
|
||||||
}
|
.append(", mForceUserActivity=").append(mForceUserActivity)
|
||||||
result.append(newLine);
|
.append(", mLaunchingActivity=").append(mLaunchingActivity)
|
||||||
}
|
.append(", mBackdropShowing=").append(mBackdropShowing)
|
||||||
result.append("}");
|
.append(", mWallpaperSupportsAmbientMode=")
|
||||||
|
.append(mWallpaperSupportsAmbientMode)
|
||||||
return result.toString();
|
.append(", mNotTouchable=").append(mNotTouchable)
|
||||||
|
.append(", mComponentsForcingTopUi=").append(mComponentsForcingTopUi)
|
||||||
|
.append(", mForceOpenTokens=").append(mForceOpenTokens)
|
||||||
|
.append(", mStatusBarState=").append(mStatusBarState)
|
||||||
|
.append(", mRemoteInputActive=").append(mRemoteInputActive)
|
||||||
|
.append(", mForcePluginOpen=").append(mForcePluginOpen)
|
||||||
|
.append(", mDozing=").append(mDozing)
|
||||||
|
.append(", mScrimsVisibility=").append(mScrimsVisibility)
|
||||||
|
.append(", mBackgroundBlurRadius=").append(mBackgroundBlurRadius)
|
||||||
|
.append('}').toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.systemui.shade
|
||||||
|
|
||||||
|
import android.view.WindowManager
|
||||||
|
import com.android.systemui.log.dagger.ShadeWindowLog
|
||||||
|
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
|
||||||
|
import com.android.systemui.plugins.log.LogLevel.DEBUG
|
||||||
|
import com.android.systemui.plugins.log.LogMessage
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
private const val TAG = "systemui.shadewindow"
|
||||||
|
|
||||||
|
class ShadeWindowLogger @Inject constructor(@ShadeWindowLog private val buffer: LogBuffer) :
|
||||||
|
ConstantStringsLogger by ConstantStringsLoggerImpl(buffer, TAG) {
|
||||||
|
|
||||||
|
fun logApplyingWindowLayoutParams(lp: WindowManager.LayoutParams) {
|
||||||
|
log(DEBUG, { str1 = lp.toString() }, { "Applying new window layout params: $str1" })
|
||||||
|
}
|
||||||
|
|
||||||
|
fun logNewState(state: Any) {
|
||||||
|
log(DEBUG, { str1 = state.toString() }, { "Applying new state: $str1" })
|
||||||
|
}
|
||||||
|
|
||||||
|
private inline fun log(
|
||||||
|
logLevel: LogLevel,
|
||||||
|
initializer: LogMessage.() -> Unit,
|
||||||
|
noinline printer: LogMessage.() -> String
|
||||||
|
) {
|
||||||
|
buffer.log(TAG, logLevel, initializer, printer)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun logApplyVisibility(visible: Boolean) {
|
||||||
|
log(DEBUG, { bool1 = visible }, { "Updating visibility, should be visible : $bool1" })
|
||||||
|
}
|
||||||
|
|
||||||
|
fun logShadeVisibleAndFocusable(visible: Boolean) {
|
||||||
|
log(
|
||||||
|
DEBUG,
|
||||||
|
{ bool1 = visible },
|
||||||
|
{ "Updating shade, should be visible and focusable: $bool1" }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun logShadeFocusable(focusable: Boolean) {
|
||||||
|
log(DEBUG, { bool1 = focusable }, { "Updating shade, should be focusable : $bool1" })
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -70,6 +70,7 @@ import com.android.systemui.settings.UserTracker;
|
|||||||
import com.android.systemui.shade.NotificationShadeWindowControllerImpl;
|
import com.android.systemui.shade.NotificationShadeWindowControllerImpl;
|
||||||
import com.android.systemui.shade.ShadeController;
|
import com.android.systemui.shade.ShadeController;
|
||||||
import com.android.systemui.shade.ShadeExpansionStateManager;
|
import com.android.systemui.shade.ShadeExpansionStateManager;
|
||||||
|
import com.android.systemui.shade.ShadeWindowLogger;
|
||||||
import com.android.systemui.statusbar.NotificationShadeDepthController;
|
import com.android.systemui.statusbar.NotificationShadeDepthController;
|
||||||
import com.android.systemui.statusbar.NotificationShadeWindowController;
|
import com.android.systemui.statusbar.NotificationShadeWindowController;
|
||||||
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
||||||
@@ -132,6 +133,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
|
|||||||
private @Mock SysuiColorExtractor mColorExtractor;
|
private @Mock SysuiColorExtractor mColorExtractor;
|
||||||
private @Mock AuthController mAuthController;
|
private @Mock AuthController mAuthController;
|
||||||
private @Mock ShadeExpansionStateManager mShadeExpansionStateManager;
|
private @Mock ShadeExpansionStateManager mShadeExpansionStateManager;
|
||||||
|
private @Mock ShadeWindowLogger mShadeWindowLogger;
|
||||||
private DeviceConfigProxy mDeviceConfig = new DeviceConfigProxyFake();
|
private DeviceConfigProxy mDeviceConfig = new DeviceConfigProxyFake();
|
||||||
private FakeExecutor mUiBgExecutor = new FakeExecutor(new FakeSystemClock());
|
private FakeExecutor mUiBgExecutor = new FakeExecutor(new FakeSystemClock());
|
||||||
|
|
||||||
@@ -155,7 +157,8 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
|
|||||||
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
||||||
mConfigurationController, mViewMediator, mKeyguardBypassController,
|
mConfigurationController, mViewMediator, mKeyguardBypassController,
|
||||||
mColorExtractor, mDumpManager, mKeyguardStateController,
|
mColorExtractor, mDumpManager, mKeyguardStateController,
|
||||||
mScreenOffAnimationController, mAuthController, mShadeExpansionStateManager);
|
mScreenOffAnimationController, mAuthController, mShadeExpansionStateManager,
|
||||||
|
mShadeWindowLogger);
|
||||||
|
|
||||||
createAndStartViewMediator();
|
createAndStartViewMediator();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
|
|||||||
@Mock private ScreenOffAnimationController mScreenOffAnimationController;
|
@Mock private ScreenOffAnimationController mScreenOffAnimationController;
|
||||||
@Mock private AuthController mAuthController;
|
@Mock private AuthController mAuthController;
|
||||||
@Mock private ShadeExpansionStateManager mShadeExpansionStateManager;
|
@Mock private ShadeExpansionStateManager mShadeExpansionStateManager;
|
||||||
|
@Mock private ShadeWindowLogger mShadeWindowLogger;
|
||||||
@Captor private ArgumentCaptor<WindowManager.LayoutParams> mLayoutParameters;
|
@Captor private ArgumentCaptor<WindowManager.LayoutParams> mLayoutParameters;
|
||||||
|
|
||||||
private NotificationShadeWindowControllerImpl mNotificationShadeWindowController;
|
private NotificationShadeWindowControllerImpl mNotificationShadeWindowController;
|
||||||
@@ -104,7 +105,8 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
|
|||||||
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
||||||
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
||||||
mColorExtractor, mDumpManager, mKeyguardStateController,
|
mColorExtractor, mDumpManager, mKeyguardStateController,
|
||||||
mScreenOffAnimationController, mAuthController, mShadeExpansionStateManager) {
|
mScreenOffAnimationController, mAuthController, mShadeExpansionStateManager,
|
||||||
|
mShadeWindowLogger) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean isDebuggable() {
|
protected boolean isDebuggable() {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ import com.android.systemui.shade.NotificationShadeWindowControllerImpl;
|
|||||||
import com.android.systemui.shade.NotificationShadeWindowView;
|
import com.android.systemui.shade.NotificationShadeWindowView;
|
||||||
import com.android.systemui.shade.ShadeController;
|
import com.android.systemui.shade.ShadeController;
|
||||||
import com.android.systemui.shade.ShadeExpansionStateManager;
|
import com.android.systemui.shade.ShadeExpansionStateManager;
|
||||||
|
import com.android.systemui.shade.ShadeWindowLogger;
|
||||||
import com.android.systemui.shared.system.QuickStepContract;
|
import com.android.systemui.shared.system.QuickStepContract;
|
||||||
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
|
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
|
||||||
import com.android.systemui.statusbar.RankingBuilder;
|
import com.android.systemui.statusbar.RankingBuilder;
|
||||||
@@ -273,6 +274,8 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
private Optional<OneHandedController> mOneHandedOptional;
|
private Optional<OneHandedController> mOneHandedOptional;
|
||||||
@Mock
|
@Mock
|
||||||
private UserManager mUserManager;
|
private UserManager mUserManager;
|
||||||
|
@Mock
|
||||||
|
private ShadeWindowLogger mShadeWindowLogger;
|
||||||
|
|
||||||
private TestableBubblePositioner mPositioner;
|
private TestableBubblePositioner mPositioner;
|
||||||
|
|
||||||
@@ -297,7 +300,8 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
||||||
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
||||||
mColorExtractor, mDumpManager, mKeyguardStateController,
|
mColorExtractor, mDumpManager, mKeyguardStateController,
|
||||||
mScreenOffAnimationController, mAuthController, mShadeExpansionStateManager);
|
mScreenOffAnimationController, mAuthController, mShadeExpansionStateManager,
|
||||||
|
mShadeWindowLogger);
|
||||||
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
|
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
|
||||||
mNotificationShadeWindowController.attach();
|
mNotificationShadeWindowController.attach();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user