Merge "Table logging for state of NotificationShadeWindow" into tm-qpr-dev am: 04f7a3b26e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20836629 Change-Id: Ib9438c70f3327334e8609f767eac743574d4df49 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -53,13 +53,13 @@ import com.android.systemui.biometrics.AuthController;
|
||||
import com.android.systemui.colorextraction.SysuiColorExtractor;
|
||||
import com.android.systemui.dagger.SysUISingleton;
|
||||
import com.android.systemui.dump.DumpManager;
|
||||
import com.android.systemui.dump.DumpsysTableLogger;
|
||||
import com.android.systemui.keyguard.KeyguardViewMediator;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
|
||||
import com.android.systemui.statusbar.NotificationShadeWindowController;
|
||||
import com.android.systemui.statusbar.StatusBarState;
|
||||
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
||||
import com.android.systemui.statusbar.phone.CentralSurfaces;
|
||||
import com.android.systemui.statusbar.phone.DozeParameters;
|
||||
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
||||
import com.android.systemui.statusbar.phone.ScreenOffAnimationController;
|
||||
@@ -73,10 +73,8 @@ import java.io.PrintWriter;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -90,6 +88,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
Dumpable, ConfigurationListener {
|
||||
|
||||
private static final String TAG = "NotificationShadeWindowController";
|
||||
private static final int MAX_STATE_CHANGES_BUFFER_SIZE = 100;
|
||||
|
||||
private final Context mContext;
|
||||
private final WindowManager mWindowManager;
|
||||
@@ -109,7 +108,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
private boolean mHasTopUi;
|
||||
private boolean mHasTopUiChanged;
|
||||
private float mScreenBrightnessDoze;
|
||||
private final State mCurrentState = new State();
|
||||
private final NotificationShadeWindowState mCurrentState = new NotificationShadeWindowState();
|
||||
private OtherwisedCollapsedListener mListener;
|
||||
private ForcePluginOpenListener mForcePluginOpenListener;
|
||||
private Consumer<Integer> mScrimsVisibilityListener;
|
||||
@@ -126,6 +125,9 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
private int mDeferWindowLayoutParams;
|
||||
private boolean mLastKeyguardRotationAllowed;
|
||||
|
||||
private final NotificationShadeWindowState.Buffer mStateBuffer =
|
||||
new NotificationShadeWindowState.Buffer(MAX_STATE_CHANGES_BUFFER_SIZE);
|
||||
|
||||
@Inject
|
||||
public NotificationShadeWindowControllerImpl(Context context, WindowManager windowManager,
|
||||
IActivityManager activityManager, DozeParameters dozeParameters,
|
||||
@@ -211,8 +213,8 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
|
||||
@VisibleForTesting
|
||||
void onShadeExpansionFullyChanged(Boolean isExpanded) {
|
||||
if (mCurrentState.mPanelExpanded != isExpanded) {
|
||||
mCurrentState.mPanelExpanded = isExpanded;
|
||||
if (mCurrentState.panelExpanded != isExpanded) {
|
||||
mCurrentState.panelExpanded = isExpanded;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
}
|
||||
@@ -298,10 +300,10 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
mNotificationShadeView.setSystemUiVisibility(vis);
|
||||
}
|
||||
|
||||
private void applyKeyguardFlags(State state) {
|
||||
final boolean keyguardOrAod = state.mKeyguardShowing
|
||||
|| (state.mDozing && mDozeParameters.getAlwaysOn());
|
||||
if ((keyguardOrAod && !state.mBackdropShowing && !state.mLightRevealScrimOpaque)
|
||||
private void applyKeyguardFlags(NotificationShadeWindowState state) {
|
||||
final boolean keyguardOrAod = state.keyguardShowing
|
||||
|| (state.dozing && mDozeParameters.getAlwaysOn());
|
||||
if ((keyguardOrAod && !state.mediaBackdropShowing && !state.lightRevealScrimOpaque)
|
||||
|| mKeyguardViewMediator.isAnimatingBetweenKeyguardAndSurfaceBehind()) {
|
||||
// Show the wallpaper if we're on keyguard/AOD and the wallpaper is not occluded by a
|
||||
// solid backdrop. Also, show it if we are currently animating between the
|
||||
@@ -312,15 +314,15 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
mLpChanged.flags &= ~LayoutParams.FLAG_SHOW_WALLPAPER;
|
||||
}
|
||||
|
||||
if (state.mDozing) {
|
||||
if (state.dozing) {
|
||||
mLpChanged.privateFlags |= LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
|
||||
} else {
|
||||
mLpChanged.privateFlags &= ~LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
|
||||
}
|
||||
|
||||
if (mKeyguardPreferredRefreshRate > 0) {
|
||||
boolean onKeyguard = state.mStatusBarState == StatusBarState.KEYGUARD
|
||||
&& !state.mKeyguardFadingAway && !state.mKeyguardGoingAway;
|
||||
boolean onKeyguard = state.statusBarState == StatusBarState.KEYGUARD
|
||||
&& !state.keyguardFadingAway && !state.keyguardGoingAway;
|
||||
if (onKeyguard
|
||||
&& mAuthController.isUdfpsEnrolled(KeyguardUpdateMonitor.getCurrentUser())) {
|
||||
// both max and min display refresh rate must be set to take effect:
|
||||
@@ -334,9 +336,9 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
(long) mKeyguardPreferredRefreshRate);
|
||||
} else if (mKeyguardMaxRefreshRate > 0) {
|
||||
boolean bypassOnKeyguard = mKeyguardBypassController.getBypassEnabled()
|
||||
&& state.mStatusBarState == StatusBarState.KEYGUARD
|
||||
&& !state.mKeyguardFadingAway && !state.mKeyguardGoingAway;
|
||||
if (state.mDozing || bypassOnKeyguard) {
|
||||
&& state.statusBarState == StatusBarState.KEYGUARD
|
||||
&& !state.keyguardFadingAway && !state.keyguardGoingAway;
|
||||
if (state.dozing || bypassOnKeyguard) {
|
||||
mLpChanged.preferredMaxDisplayRefreshRate = mKeyguardMaxRefreshRate;
|
||||
} else {
|
||||
mLpChanged.preferredMaxDisplayRefreshRate = 0;
|
||||
@@ -345,7 +347,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
(long) mLpChanged.preferredMaxDisplayRefreshRate);
|
||||
}
|
||||
|
||||
if (state.mBouncerShowing && !isDebuggable()) {
|
||||
if (state.bouncerShowing && !isDebuggable()) {
|
||||
mLpChanged.flags |= LayoutParams.FLAG_SECURE;
|
||||
} else {
|
||||
mLpChanged.flags &= ~LayoutParams.FLAG_SECURE;
|
||||
@@ -356,8 +358,8 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
return Build.IS_DEBUGGABLE;
|
||||
}
|
||||
|
||||
private void adjustScreenOrientation(State state) {
|
||||
if (state.mBouncerShowing || state.isKeyguardShowingAndNotOccluded() || state.mDozing) {
|
||||
private void adjustScreenOrientation(NotificationShadeWindowState state) {
|
||||
if (state.bouncerShowing || state.isKeyguardShowingAndNotOccluded() || state.dozing) {
|
||||
if (mKeyguardStateController.isKeyguardScreenRotationAllowed()) {
|
||||
mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
|
||||
} else {
|
||||
@@ -368,10 +370,10 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
}
|
||||
}
|
||||
|
||||
private void applyFocusableFlag(State state) {
|
||||
boolean panelFocusable = state.mNotificationShadeFocusable && state.mPanelExpanded;
|
||||
if (state.mBouncerShowing && (state.mKeyguardOccluded || state.mKeyguardNeedsInput)
|
||||
|| ENABLE_REMOTE_INPUT && state.mRemoteInputActive
|
||||
private void applyFocusableFlag(NotificationShadeWindowState state) {
|
||||
boolean panelFocusable = state.notificationShadeFocusable && state.panelExpanded;
|
||||
if (state.bouncerShowing && (state.keyguardOccluded || state.keyguardNeedsInput)
|
||||
|| ENABLE_REMOTE_INPUT && state.remoteInputActive
|
||||
// Make the panel focusable if we're doing the screen off animation, since the light
|
||||
// reveal scrim is drawing in the panel and should consume touch events so that they
|
||||
// don't go to the app behind.
|
||||
@@ -381,7 +383,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
} else if (state.isKeyguardShowingAndNotOccluded() || panelFocusable) {
|
||||
mLpChanged.flags &= ~LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||
// Make sure to remove FLAG_ALT_FOCUSABLE_IM when keyguard needs input.
|
||||
if (state.mKeyguardNeedsInput && state.isKeyguardShowingAndNotOccluded()) {
|
||||
if (state.keyguardNeedsInput && state.isKeyguardShowingAndNotOccluded()) {
|
||||
mLpChanged.flags &= ~LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
||||
} else {
|
||||
mLpChanged.flags |= LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
||||
@@ -392,19 +394,19 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
}
|
||||
}
|
||||
|
||||
private void applyForceShowNavigationFlag(State state) {
|
||||
if (state.mPanelExpanded || state.mBouncerShowing
|
||||
|| ENABLE_REMOTE_INPUT && state.mRemoteInputActive) {
|
||||
private void applyForceShowNavigationFlag(NotificationShadeWindowState state) {
|
||||
if (state.panelExpanded || state.bouncerShowing
|
||||
|| ENABLE_REMOTE_INPUT && state.remoteInputActive) {
|
||||
mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
|
||||
} else {
|
||||
mLpChanged.privateFlags &= ~LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
|
||||
}
|
||||
}
|
||||
|
||||
private void applyVisibility(State state) {
|
||||
private void applyVisibility(NotificationShadeWindowState state) {
|
||||
boolean visible = isExpanded(state);
|
||||
mLogger.logApplyVisibility(visible);
|
||||
if (state.mForcePluginOpen) {
|
||||
if (state.forcePluginOpen) {
|
||||
if (mListener != null) {
|
||||
mListener.setWouldOtherwiseCollapse(visible);
|
||||
}
|
||||
@@ -420,16 +422,16 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isExpanded(State state) {
|
||||
return !state.mForceCollapsed && (state.isKeyguardShowingAndNotOccluded()
|
||||
|| state.mPanelVisible || state.mKeyguardFadingAway || state.mBouncerShowing
|
||||
|| state.mHeadsUpShowing
|
||||
|| state.mScrimsVisibility != ScrimController.TRANSPARENT)
|
||||
|| state.mBackgroundBlurRadius > 0
|
||||
|| state.mLaunchingActivity;
|
||||
private boolean isExpanded(NotificationShadeWindowState state) {
|
||||
return !state.forceWindowCollapsed && (state.isKeyguardShowingAndNotOccluded()
|
||||
|| state.panelVisible || state.keyguardFadingAway || state.bouncerShowing
|
||||
|| state.headsUpNotificationShowing
|
||||
|| state.scrimsVisibility != ScrimController.TRANSPARENT)
|
||||
|| state.backgroundBlurRadius > 0
|
||||
|| state.launchingActivityFromNotification;
|
||||
}
|
||||
|
||||
private void applyFitsSystemWindows(State state) {
|
||||
private void applyFitsSystemWindows(NotificationShadeWindowState state) {
|
||||
boolean fitsSystemWindows = !state.isKeyguardShowingAndNotOccluded();
|
||||
if (mNotificationShadeView != null
|
||||
&& mNotificationShadeView.getFitsSystemWindows() != fitsSystemWindows) {
|
||||
@@ -438,21 +440,21 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
}
|
||||
}
|
||||
|
||||
private void applyUserActivityTimeout(State state) {
|
||||
private void applyUserActivityTimeout(NotificationShadeWindowState state) {
|
||||
if (state.isKeyguardShowingAndNotOccluded()
|
||||
&& state.mStatusBarState == StatusBarState.KEYGUARD
|
||||
&& !state.mQsExpanded) {
|
||||
mLpChanged.userActivityTimeout = state.mBouncerShowing
|
||||
&& state.statusBarState == StatusBarState.KEYGUARD
|
||||
&& !state.qsExpanded) {
|
||||
mLpChanged.userActivityTimeout = state.bouncerShowing
|
||||
? KeyguardViewMediator.AWAKE_INTERVAL_BOUNCER_MS : mLockScreenDisplayTimeout;
|
||||
} else {
|
||||
mLpChanged.userActivityTimeout = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void applyInputFeatures(State state) {
|
||||
private void applyInputFeatures(NotificationShadeWindowState state) {
|
||||
if (state.isKeyguardShowingAndNotOccluded()
|
||||
&& state.mStatusBarState == StatusBarState.KEYGUARD
|
||||
&& !state.mQsExpanded && !state.mForceUserActivity) {
|
||||
&& state.statusBarState == StatusBarState.KEYGUARD
|
||||
&& !state.qsExpanded && !state.forceUserActivity) {
|
||||
mLpChanged.inputFeatures |=
|
||||
LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
|
||||
} else {
|
||||
@@ -461,7 +463,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
}
|
||||
}
|
||||
|
||||
private void applyStatusBarColorSpaceAgnosticFlag(State state) {
|
||||
private void applyStatusBarColorSpaceAgnosticFlag(NotificationShadeWindowState state) {
|
||||
if (!isExpanded(state)) {
|
||||
mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;
|
||||
} else {
|
||||
@@ -487,8 +489,8 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
applyWindowLayoutParams();
|
||||
}
|
||||
|
||||
private void apply(State state) {
|
||||
mLogger.logNewState(state);
|
||||
private void apply(NotificationShadeWindowState state) {
|
||||
logState(state);
|
||||
applyKeyguardFlags(state);
|
||||
applyFocusableFlag(state);
|
||||
applyForceShowNavigationFlag(state);
|
||||
@@ -517,6 +519,38 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
notifyStateChangedCallbacks();
|
||||
}
|
||||
|
||||
private void logState(NotificationShadeWindowState state) {
|
||||
mStateBuffer.insert(
|
||||
state.keyguardShowing,
|
||||
state.keyguardOccluded,
|
||||
state.keyguardNeedsInput,
|
||||
state.panelVisible,
|
||||
state.panelExpanded,
|
||||
state.notificationShadeFocusable,
|
||||
state.bouncerShowing,
|
||||
state.keyguardFadingAway,
|
||||
state.keyguardGoingAway,
|
||||
state.qsExpanded,
|
||||
state.headsUpNotificationShowing,
|
||||
state.lightRevealScrimOpaque,
|
||||
state.forceWindowCollapsed,
|
||||
state.forceDozeBrightness,
|
||||
state.forceUserActivity,
|
||||
state.launchingActivityFromNotification,
|
||||
state.mediaBackdropShowing,
|
||||
state.wallpaperSupportsAmbientMode,
|
||||
state.windowNotTouchable,
|
||||
state.componentsForcingTopUi,
|
||||
state.forceOpenTokens,
|
||||
state.statusBarState,
|
||||
state.remoteInputActive,
|
||||
state.forcePluginOpen,
|
||||
state.dozing,
|
||||
state.scrimsVisibility,
|
||||
state.backgroundBlurRadius
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyStateChangedCallbacks() {
|
||||
// Copy callbacks to separate ArrayList to avoid concurrent modification
|
||||
@@ -525,36 +559,36 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
for (StatusBarWindowCallback cb : activeCallbacks) {
|
||||
cb.onStateChanged(mCurrentState.mKeyguardShowing,
|
||||
mCurrentState.mKeyguardOccluded,
|
||||
mCurrentState.mBouncerShowing,
|
||||
mCurrentState.mDozing,
|
||||
mCurrentState.mPanelExpanded);
|
||||
cb.onStateChanged(mCurrentState.keyguardShowing,
|
||||
mCurrentState.keyguardOccluded,
|
||||
mCurrentState.bouncerShowing,
|
||||
mCurrentState.dozing,
|
||||
mCurrentState.panelExpanded);
|
||||
}
|
||||
}
|
||||
|
||||
private void applyModalFlag(State state) {
|
||||
if (state.mHeadsUpShowing) {
|
||||
private void applyModalFlag(NotificationShadeWindowState state) {
|
||||
if (state.headsUpNotificationShowing) {
|
||||
mLpChanged.flags |= LayoutParams.FLAG_NOT_TOUCH_MODAL;
|
||||
} else {
|
||||
mLpChanged.flags &= ~LayoutParams.FLAG_NOT_TOUCH_MODAL;
|
||||
}
|
||||
}
|
||||
|
||||
private void applyBrightness(State state) {
|
||||
if (state.mForceDozeBrightness) {
|
||||
private void applyBrightness(NotificationShadeWindowState state) {
|
||||
if (state.forceDozeBrightness) {
|
||||
mLpChanged.screenBrightness = mScreenBrightnessDoze;
|
||||
} else {
|
||||
mLpChanged.screenBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
private void applyHasTopUi(State state) {
|
||||
mHasTopUiChanged = !state.mComponentsForcingTopUi.isEmpty() || isExpanded(state);
|
||||
private void applyHasTopUi(NotificationShadeWindowState state) {
|
||||
mHasTopUiChanged = !state.componentsForcingTopUi.isEmpty() || isExpanded(state);
|
||||
}
|
||||
|
||||
private void applyNotTouchable(State state) {
|
||||
if (state.mNotTouchable) {
|
||||
private void applyNotTouchable(NotificationShadeWindowState state) {
|
||||
if (state.windowNotTouchable) {
|
||||
mLpChanged.flags |= LayoutParams.FLAG_NOT_TOUCHABLE;
|
||||
} else {
|
||||
mLpChanged.flags &= ~LayoutParams.FLAG_NOT_TOUCHABLE;
|
||||
@@ -576,88 +610,88 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
|
||||
@Override
|
||||
public void setKeyguardShowing(boolean showing) {
|
||||
mCurrentState.mKeyguardShowing = showing;
|
||||
mCurrentState.keyguardShowing = showing;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setKeyguardOccluded(boolean occluded) {
|
||||
mCurrentState.mKeyguardOccluded = occluded;
|
||||
mCurrentState.keyguardOccluded = occluded;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setKeyguardNeedsInput(boolean needsInput) {
|
||||
mCurrentState.mKeyguardNeedsInput = needsInput;
|
||||
mCurrentState.keyguardNeedsInput = needsInput;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPanelVisible(boolean visible) {
|
||||
if (mCurrentState.mPanelVisible == visible
|
||||
&& mCurrentState.mNotificationShadeFocusable == visible) {
|
||||
if (mCurrentState.panelVisible == visible
|
||||
&& mCurrentState.notificationShadeFocusable == visible) {
|
||||
return;
|
||||
}
|
||||
mLogger.logShadeVisibleAndFocusable(visible);
|
||||
mCurrentState.mPanelVisible = visible;
|
||||
mCurrentState.mNotificationShadeFocusable = visible;
|
||||
mCurrentState.panelVisible = visible;
|
||||
mCurrentState.notificationShadeFocusable = visible;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNotificationShadeFocusable(boolean focusable) {
|
||||
mLogger.logShadeFocusable(focusable);
|
||||
mCurrentState.mNotificationShadeFocusable = focusable;
|
||||
mCurrentState.notificationShadeFocusable = focusable;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBouncerShowing(boolean showing) {
|
||||
mCurrentState.mBouncerShowing = showing;
|
||||
mCurrentState.bouncerShowing = showing;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackdropShowing(boolean showing) {
|
||||
mCurrentState.mBackdropShowing = showing;
|
||||
mCurrentState.mediaBackdropShowing = showing;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setKeyguardFadingAway(boolean keyguardFadingAway) {
|
||||
mCurrentState.mKeyguardFadingAway = keyguardFadingAway;
|
||||
mCurrentState.keyguardFadingAway = keyguardFadingAway;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
private void onQsExpansionChanged(Boolean expanded) {
|
||||
mCurrentState.mQsExpanded = expanded;
|
||||
mCurrentState.qsExpanded = expanded;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setForceUserActivity(boolean forceUserActivity) {
|
||||
mCurrentState.mForceUserActivity = forceUserActivity;
|
||||
mCurrentState.forceUserActivity = forceUserActivity;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLaunchingActivity(boolean launching) {
|
||||
mCurrentState.mLaunchingActivity = launching;
|
||||
mCurrentState.launchingActivityFromNotification = launching;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLaunchingActivity() {
|
||||
return mCurrentState.mLaunchingActivity;
|
||||
return mCurrentState.launchingActivityFromNotification;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScrimsVisibility(int scrimsVisibility) {
|
||||
if (scrimsVisibility == mCurrentState.mScrimsVisibility) {
|
||||
if (scrimsVisibility == mCurrentState.scrimsVisibility) {
|
||||
return;
|
||||
}
|
||||
boolean wasExpanded = isExpanded(mCurrentState);
|
||||
mCurrentState.mScrimsVisibility = scrimsVisibility;
|
||||
mCurrentState.scrimsVisibility = scrimsVisibility;
|
||||
if (wasExpanded != isExpanded(mCurrentState)) {
|
||||
apply(mCurrentState);
|
||||
}
|
||||
@@ -671,31 +705,31 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
*/
|
||||
@Override
|
||||
public void setBackgroundBlurRadius(int backgroundBlurRadius) {
|
||||
if (mCurrentState.mBackgroundBlurRadius == backgroundBlurRadius) {
|
||||
if (mCurrentState.backgroundBlurRadius == backgroundBlurRadius) {
|
||||
return;
|
||||
}
|
||||
mCurrentState.mBackgroundBlurRadius = backgroundBlurRadius;
|
||||
mCurrentState.backgroundBlurRadius = backgroundBlurRadius;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadsUpShowing(boolean showing) {
|
||||
mCurrentState.mHeadsUpShowing = showing;
|
||||
mCurrentState.headsUpNotificationShowing = showing;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLightRevealScrimOpaque(boolean opaque) {
|
||||
if (mCurrentState.mLightRevealScrimOpaque == opaque) {
|
||||
if (mCurrentState.lightRevealScrimOpaque == opaque) {
|
||||
return;
|
||||
}
|
||||
mCurrentState.mLightRevealScrimOpaque = opaque;
|
||||
mCurrentState.lightRevealScrimOpaque = opaque;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWallpaperSupportsAmbientMode(boolean supportsAmbientMode) {
|
||||
mCurrentState.mWallpaperSupportsAmbientMode = supportsAmbientMode;
|
||||
mCurrentState.wallpaperSupportsAmbientMode = supportsAmbientMode;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@@ -703,7 +737,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
* @param state The {@link StatusBarStateController} of the status bar.
|
||||
*/
|
||||
private void setStatusBarState(int state) {
|
||||
mCurrentState.mStatusBarState = state;
|
||||
mCurrentState.statusBarState = state;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@@ -714,13 +748,13 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
*/
|
||||
@Override
|
||||
public void setForceWindowCollapsed(boolean force) {
|
||||
mCurrentState.mForceCollapsed = force;
|
||||
mCurrentState.forceWindowCollapsed = force;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteInputActive(boolean remoteInputActive) {
|
||||
mCurrentState.mRemoteInputActive = remoteInputActive;
|
||||
mCurrentState.remoteInputActive = remoteInputActive;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@@ -730,32 +764,32 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
*/
|
||||
@Override
|
||||
public void setForceDozeBrightness(boolean forceDozeBrightness) {
|
||||
if (mCurrentState.mForceDozeBrightness == forceDozeBrightness) {
|
||||
if (mCurrentState.forceDozeBrightness == forceDozeBrightness) {
|
||||
return;
|
||||
}
|
||||
mCurrentState.mForceDozeBrightness = forceDozeBrightness;
|
||||
mCurrentState.forceDozeBrightness = forceDozeBrightness;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDozing(boolean dozing) {
|
||||
mCurrentState.mDozing = dozing;
|
||||
mCurrentState.dozing = dozing;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setForcePluginOpen(boolean forceOpen, Object token) {
|
||||
if (forceOpen) {
|
||||
mCurrentState.mForceOpenTokens.add(token);
|
||||
mCurrentState.forceOpenTokens.add(token);
|
||||
} else {
|
||||
mCurrentState.mForceOpenTokens.remove(token);
|
||||
mCurrentState.forceOpenTokens.remove(token);
|
||||
}
|
||||
final boolean previousForceOpenState = mCurrentState.mForcePluginOpen;
|
||||
mCurrentState.mForcePluginOpen = !mCurrentState.mForceOpenTokens.isEmpty();
|
||||
if (previousForceOpenState != mCurrentState.mForcePluginOpen) {
|
||||
final boolean previousForceOpenState = mCurrentState.forcePluginOpen;
|
||||
mCurrentState.forcePluginOpen = !mCurrentState.forceOpenTokens.isEmpty();
|
||||
if (previousForceOpenState != mCurrentState.forcePluginOpen) {
|
||||
apply(mCurrentState);
|
||||
if (mForcePluginOpenListener != null) {
|
||||
mForcePluginOpenListener.onChange(mCurrentState.mForcePluginOpen);
|
||||
mForcePluginOpenListener.onChange(mCurrentState.forcePluginOpen);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -765,12 +799,12 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
*/
|
||||
@Override
|
||||
public boolean getForcePluginOpen() {
|
||||
return mCurrentState.mForcePluginOpen;
|
||||
return mCurrentState.forcePluginOpen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNotTouchable(boolean notTouchable) {
|
||||
mCurrentState.mNotTouchable = notTouchable;
|
||||
mCurrentState.windowNotTouchable = notTouchable;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@@ -779,7 +813,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
*/
|
||||
@Override
|
||||
public boolean getPanelExpanded() {
|
||||
return mCurrentState.mPanelExpanded;
|
||||
return mCurrentState.panelExpanded;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -802,11 +836,16 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
if (mNotificationShadeView != null && mNotificationShadeView.getViewRootImpl() != null) {
|
||||
mNotificationShadeView.getViewRootImpl().dump(" ", pw);
|
||||
}
|
||||
new DumpsysTableLogger(
|
||||
TAG,
|
||||
NotificationShadeWindowState.TABLE_HEADERS,
|
||||
mStateBuffer.toList()
|
||||
).printTableData(pw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShowingWallpaper() {
|
||||
return !mCurrentState.mBackdropShowing;
|
||||
return !mCurrentState.mediaBackdropShowing;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -836,7 +875,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
*/
|
||||
@Override
|
||||
public void setKeyguardGoingAway(boolean goingAway) {
|
||||
mCurrentState.mKeyguardGoingAway = goingAway;
|
||||
mCurrentState.keyguardGoingAway = goingAway;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
@@ -848,87 +887,13 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
||||
@Override
|
||||
public void setRequestTopUi(boolean requestTopUi, String componentTag) {
|
||||
if (requestTopUi) {
|
||||
mCurrentState.mComponentsForcingTopUi.add(componentTag);
|
||||
mCurrentState.componentsForcingTopUi.add(componentTag);
|
||||
} else {
|
||||
mCurrentState.mComponentsForcingTopUi.remove(componentTag);
|
||||
mCurrentState.componentsForcingTopUi.remove(componentTag);
|
||||
}
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
private static class State {
|
||||
boolean mKeyguardShowing;
|
||||
boolean mKeyguardOccluded;
|
||||
boolean mKeyguardNeedsInput;
|
||||
boolean mPanelVisible;
|
||||
boolean mPanelExpanded;
|
||||
boolean mNotificationShadeFocusable;
|
||||
boolean mBouncerShowing;
|
||||
boolean mKeyguardFadingAway;
|
||||
boolean mKeyguardGoingAway;
|
||||
boolean mQsExpanded;
|
||||
boolean mHeadsUpShowing;
|
||||
boolean mLightRevealScrimOpaque;
|
||||
boolean mForceCollapsed;
|
||||
boolean mForceDozeBrightness;
|
||||
boolean mForceUserActivity;
|
||||
boolean mLaunchingActivity;
|
||||
boolean mBackdropShowing;
|
||||
boolean mWallpaperSupportsAmbientMode;
|
||||
boolean mNotTouchable;
|
||||
Set<String> mComponentsForcingTopUi = new HashSet<>();
|
||||
Set<Object> mForceOpenTokens = new HashSet<>();
|
||||
|
||||
/**
|
||||
* The status bar state from {@link CentralSurfaces}.
|
||||
*/
|
||||
int mStatusBarState;
|
||||
|
||||
boolean mRemoteInputActive;
|
||||
boolean mForcePluginOpen;
|
||||
boolean mDozing;
|
||||
int mScrimsVisibility;
|
||||
int mBackgroundBlurRadius;
|
||||
|
||||
private boolean isKeyguardShowingAndNotOccluded() {
|
||||
return mKeyguardShowing && !mKeyguardOccluded;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new StringBuilder()
|
||||
.append("State{")
|
||||
.append(" mKeyguardShowing=").append(mKeyguardShowing)
|
||||
.append(", mKeyguardOccluded=").append(mKeyguardOccluded)
|
||||
.append(", mKeyguardNeedsInput=").append(mKeyguardNeedsInput)
|
||||
.append(", mPanelVisible=").append(mPanelVisible)
|
||||
.append(", mPanelExpanded=").append(mPanelExpanded)
|
||||
.append(", mNotificationShadeFocusable=").append(mNotificationShadeFocusable)
|
||||
.append(", mBouncerShowing=").append(mBouncerShowing)
|
||||
.append(", mKeyguardFadingAway=").append(mKeyguardFadingAway)
|
||||
.append(", mKeyguardGoingAway=").append(mKeyguardGoingAway)
|
||||
.append(", mQsExpanded=").append(mQsExpanded)
|
||||
.append(", mHeadsUpShowing=").append(mHeadsUpShowing)
|
||||
.append(", mLightRevealScrimOpaque=").append(mLightRevealScrimOpaque)
|
||||
.append(", mForceCollapsed=").append(mForceCollapsed)
|
||||
.append(", mForceDozeBrightness=").append(mForceDozeBrightness)
|
||||
.append(", mForceUserActivity=").append(mForceUserActivity)
|
||||
.append(", mLaunchingActivity=").append(mLaunchingActivity)
|
||||
.append(", mBackdropShowing=").append(mBackdropShowing)
|
||||
.append(", mWallpaperSupportsAmbientMode=")
|
||||
.append(mWallpaperSupportsAmbientMode)
|
||||
.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();
|
||||
}
|
||||
}
|
||||
|
||||
private final StateListener mStateListener = new StateListener() {
|
||||
@Override
|
||||
public void onStateChanged(int newState) {
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* 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 com.android.systemui.dump.DumpsysTableLogger
|
||||
import com.android.systemui.dump.Row
|
||||
import com.android.systemui.plugins.util.RingBuffer
|
||||
import com.android.systemui.shade.NotificationShadeWindowState.Buffer
|
||||
import com.android.systemui.statusbar.StatusBarState
|
||||
|
||||
/**
|
||||
* Represents state of shade window, used by [NotificationShadeWindowControllerImpl].
|
||||
* Contains nested class [Buffer] for pretty table logging in bug reports.
|
||||
*/
|
||||
class NotificationShadeWindowState(
|
||||
@JvmField var keyguardShowing: Boolean = false,
|
||||
@JvmField var keyguardOccluded: Boolean = false,
|
||||
@JvmField var keyguardNeedsInput: Boolean = false,
|
||||
@JvmField var panelVisible: Boolean = false,
|
||||
/** shade panel is expanded (expansion fraction > 0) */
|
||||
@JvmField var panelExpanded: Boolean = false,
|
||||
@JvmField var notificationShadeFocusable: Boolean = false,
|
||||
@JvmField var bouncerShowing: Boolean = false,
|
||||
@JvmField var keyguardFadingAway: Boolean = false,
|
||||
@JvmField var keyguardGoingAway: Boolean = false,
|
||||
@JvmField var qsExpanded: Boolean = false,
|
||||
@JvmField var headsUpNotificationShowing: Boolean = false,
|
||||
@JvmField var lightRevealScrimOpaque: Boolean = false,
|
||||
@JvmField var forceWindowCollapsed: Boolean = false,
|
||||
@JvmField var forceDozeBrightness: Boolean = false,
|
||||
// TODO: forceUserActivity seems to be unused, delete?
|
||||
@JvmField var forceUserActivity: Boolean = false,
|
||||
@JvmField var launchingActivityFromNotification: Boolean = false,
|
||||
@JvmField var mediaBackdropShowing: Boolean = false,
|
||||
@JvmField var wallpaperSupportsAmbientMode: Boolean = false,
|
||||
@JvmField var windowNotTouchable: Boolean = false,
|
||||
@JvmField var componentsForcingTopUi: MutableSet<String> = mutableSetOf(),
|
||||
@JvmField var forceOpenTokens: MutableSet<Any> = mutableSetOf(),
|
||||
/** one of [StatusBarState] */
|
||||
@JvmField var statusBarState: Int = 0,
|
||||
@JvmField var remoteInputActive: Boolean = false,
|
||||
@JvmField var forcePluginOpen: Boolean = false,
|
||||
@JvmField var dozing: Boolean = false,
|
||||
@JvmField var scrimsVisibility: Int = 0,
|
||||
@JvmField var backgroundBlurRadius: Int = 0,
|
||||
) {
|
||||
|
||||
fun isKeyguardShowingAndNotOccluded(): Boolean {
|
||||
return keyguardShowing && !keyguardOccluded
|
||||
}
|
||||
|
||||
/** List of [String] to be used as a [Row] with [DumpsysTableLogger]. */
|
||||
val asStringList: List<String> by lazy {
|
||||
listOf(
|
||||
keyguardShowing.toString(),
|
||||
keyguardOccluded.toString(),
|
||||
keyguardNeedsInput.toString(),
|
||||
panelVisible.toString(),
|
||||
panelExpanded.toString(),
|
||||
notificationShadeFocusable.toString(),
|
||||
bouncerShowing.toString(),
|
||||
keyguardFadingAway.toString(),
|
||||
keyguardGoingAway.toString(),
|
||||
qsExpanded.toString(),
|
||||
headsUpNotificationShowing.toString(),
|
||||
lightRevealScrimOpaque.toString(),
|
||||
forceWindowCollapsed.toString(),
|
||||
forceDozeBrightness.toString(),
|
||||
forceUserActivity.toString(),
|
||||
launchingActivityFromNotification.toString(),
|
||||
mediaBackdropShowing.toString(),
|
||||
wallpaperSupportsAmbientMode.toString(),
|
||||
windowNotTouchable.toString(),
|
||||
componentsForcingTopUi.toString(),
|
||||
forceOpenTokens.toString(),
|
||||
StatusBarState.toString(statusBarState),
|
||||
remoteInputActive.toString(),
|
||||
forcePluginOpen.toString(),
|
||||
dozing.toString(),
|
||||
scrimsVisibility.toString(),
|
||||
backgroundBlurRadius.toString()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* [RingBuffer] to store [NotificationShadeWindowState]. After the buffer is full, it will
|
||||
* recycle old events.
|
||||
*/
|
||||
class Buffer(capacity: Int) {
|
||||
|
||||
private val buffer = RingBuffer(capacity) { NotificationShadeWindowState() }
|
||||
|
||||
/** Insert a new element in the buffer. */
|
||||
fun insert(
|
||||
keyguardShowing: Boolean,
|
||||
keyguardOccluded: Boolean,
|
||||
keyguardNeedsInput: Boolean,
|
||||
panelVisible: Boolean,
|
||||
panelExpanded: Boolean,
|
||||
notificationShadeFocusable: Boolean,
|
||||
bouncerShowing: Boolean,
|
||||
keyguardFadingAway: Boolean,
|
||||
keyguardGoingAway: Boolean,
|
||||
qsExpanded: Boolean,
|
||||
headsUpShowing: Boolean,
|
||||
lightRevealScrimOpaque: Boolean,
|
||||
forceCollapsed: Boolean,
|
||||
forceDozeBrightness: Boolean,
|
||||
forceUserActivity: Boolean,
|
||||
launchingActivity: Boolean,
|
||||
backdropShowing: Boolean,
|
||||
wallpaperSupportsAmbientMode: Boolean,
|
||||
notTouchable: Boolean,
|
||||
componentsForcingTopUi: MutableSet<String>,
|
||||
forceOpenTokens: MutableSet<Any>,
|
||||
statusBarState: Int,
|
||||
remoteInputActive: Boolean,
|
||||
forcePluginOpen: Boolean,
|
||||
dozing: Boolean,
|
||||
scrimsVisibility: Int,
|
||||
backgroundBlurRadius: Int,
|
||||
) {
|
||||
buffer.advance().apply {
|
||||
this.keyguardShowing = keyguardShowing
|
||||
this.keyguardOccluded = keyguardOccluded
|
||||
this.keyguardNeedsInput = keyguardNeedsInput
|
||||
this.panelVisible = panelVisible
|
||||
this.panelExpanded = panelExpanded
|
||||
this.notificationShadeFocusable = notificationShadeFocusable
|
||||
this.bouncerShowing = bouncerShowing
|
||||
this.keyguardFadingAway = keyguardFadingAway
|
||||
this.keyguardGoingAway = keyguardGoingAway
|
||||
this.qsExpanded = qsExpanded
|
||||
this.headsUpNotificationShowing = headsUpShowing
|
||||
this.lightRevealScrimOpaque = lightRevealScrimOpaque
|
||||
this.forceWindowCollapsed = forceCollapsed
|
||||
this.forceDozeBrightness = forceDozeBrightness
|
||||
this.forceUserActivity = forceUserActivity
|
||||
this.launchingActivityFromNotification = launchingActivity
|
||||
this.mediaBackdropShowing = backdropShowing
|
||||
this.wallpaperSupportsAmbientMode = wallpaperSupportsAmbientMode
|
||||
this.windowNotTouchable = notTouchable
|
||||
this.componentsForcingTopUi.clear()
|
||||
this.componentsForcingTopUi.addAll(componentsForcingTopUi)
|
||||
this.forceOpenTokens.clear()
|
||||
this.forceOpenTokens.addAll(forceOpenTokens)
|
||||
this.statusBarState = statusBarState
|
||||
this.remoteInputActive = remoteInputActive
|
||||
this.forcePluginOpen = forcePluginOpen
|
||||
this.dozing = dozing
|
||||
this.scrimsVisibility = scrimsVisibility
|
||||
this.backgroundBlurRadius = backgroundBlurRadius
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the content of the buffer (sorted from latest to newest).
|
||||
*
|
||||
* @see [NotificationShadeWindowState.asStringList]
|
||||
*/
|
||||
fun toList(): List<Row> {
|
||||
return buffer.asSequence().map { it.asStringList }.toList()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
/** Headers for dumping a table using [DumpsysTableLogger]. */
|
||||
@JvmField
|
||||
val TABLE_HEADERS =
|
||||
listOf(
|
||||
"keyguardShowing",
|
||||
"keyguardOccluded",
|
||||
"keyguardNeedsInput",
|
||||
"panelVisible",
|
||||
"panelExpanded",
|
||||
"notificationShadeFocusable",
|
||||
"bouncerShowing",
|
||||
"keyguardFadingAway",
|
||||
"keyguardGoingAway",
|
||||
"qsExpanded",
|
||||
"headsUpShowing",
|
||||
"lightRevealScrimOpaque",
|
||||
"forceCollapsed",
|
||||
"forceDozeBrightness",
|
||||
"forceUserActivity",
|
||||
"launchingActivity",
|
||||
"backdropShowing",
|
||||
"wallpaperSupportsAmbientMode",
|
||||
"notTouchable",
|
||||
"componentsForcingTopUi",
|
||||
"forceOpenTokens",
|
||||
"statusBarState",
|
||||
"remoteInputActive",
|
||||
"forcePluginOpen",
|
||||
"dozing",
|
||||
"scrimsVisibility",
|
||||
"backgroundBlurRadius"
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user