Merge "Table logging for state of NotificationShadeWindow" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
04f7a3b26e
@@ -53,13 +53,13 @@ import com.android.systemui.biometrics.AuthController;
|
|||||||
import com.android.systemui.colorextraction.SysuiColorExtractor;
|
import com.android.systemui.colorextraction.SysuiColorExtractor;
|
||||||
import com.android.systemui.dagger.SysUISingleton;
|
import com.android.systemui.dagger.SysUISingleton;
|
||||||
import com.android.systemui.dump.DumpManager;
|
import com.android.systemui.dump.DumpManager;
|
||||||
|
import com.android.systemui.dump.DumpsysTableLogger;
|
||||||
import com.android.systemui.keyguard.KeyguardViewMediator;
|
import com.android.systemui.keyguard.KeyguardViewMediator;
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
|
||||||
import com.android.systemui.statusbar.NotificationShadeWindowController;
|
import com.android.systemui.statusbar.NotificationShadeWindowController;
|
||||||
import com.android.systemui.statusbar.StatusBarState;
|
import com.android.systemui.statusbar.StatusBarState;
|
||||||
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
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.DozeParameters;
|
||||||
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
||||||
import com.android.systemui.statusbar.phone.ScreenOffAnimationController;
|
import com.android.systemui.statusbar.phone.ScreenOffAnimationController;
|
||||||
@@ -73,10 +73,8 @@ 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.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -90,6 +88,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
Dumpable, ConfigurationListener {
|
Dumpable, ConfigurationListener {
|
||||||
|
|
||||||
private static final String TAG = "NotificationShadeWindowController";
|
private static final String TAG = "NotificationShadeWindowController";
|
||||||
|
private static final int MAX_STATE_CHANGES_BUFFER_SIZE = 100;
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final WindowManager mWindowManager;
|
private final WindowManager mWindowManager;
|
||||||
@@ -109,7 +108,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
private boolean mHasTopUi;
|
private boolean mHasTopUi;
|
||||||
private boolean mHasTopUiChanged;
|
private boolean mHasTopUiChanged;
|
||||||
private float mScreenBrightnessDoze;
|
private float mScreenBrightnessDoze;
|
||||||
private final State mCurrentState = new State();
|
private final NotificationShadeWindowState mCurrentState = new NotificationShadeWindowState();
|
||||||
private OtherwisedCollapsedListener mListener;
|
private OtherwisedCollapsedListener mListener;
|
||||||
private ForcePluginOpenListener mForcePluginOpenListener;
|
private ForcePluginOpenListener mForcePluginOpenListener;
|
||||||
private Consumer<Integer> mScrimsVisibilityListener;
|
private Consumer<Integer> mScrimsVisibilityListener;
|
||||||
@@ -126,6 +125,9 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
private int mDeferWindowLayoutParams;
|
private int mDeferWindowLayoutParams;
|
||||||
private boolean mLastKeyguardRotationAllowed;
|
private boolean mLastKeyguardRotationAllowed;
|
||||||
|
|
||||||
|
private final NotificationShadeWindowState.Buffer mStateBuffer =
|
||||||
|
new NotificationShadeWindowState.Buffer(MAX_STATE_CHANGES_BUFFER_SIZE);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public NotificationShadeWindowControllerImpl(Context context, WindowManager windowManager,
|
public NotificationShadeWindowControllerImpl(Context context, WindowManager windowManager,
|
||||||
IActivityManager activityManager, DozeParameters dozeParameters,
|
IActivityManager activityManager, DozeParameters dozeParameters,
|
||||||
@@ -211,8 +213,8 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void onShadeExpansionFullyChanged(Boolean isExpanded) {
|
void onShadeExpansionFullyChanged(Boolean isExpanded) {
|
||||||
if (mCurrentState.mPanelExpanded != isExpanded) {
|
if (mCurrentState.panelExpanded != isExpanded) {
|
||||||
mCurrentState.mPanelExpanded = isExpanded;
|
mCurrentState.panelExpanded = isExpanded;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -298,10 +300,10 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
mNotificationShadeView.setSystemUiVisibility(vis);
|
mNotificationShadeView.setSystemUiVisibility(vis);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyKeyguardFlags(State state) {
|
private void applyKeyguardFlags(NotificationShadeWindowState state) {
|
||||||
final boolean keyguardOrAod = state.mKeyguardShowing
|
final boolean keyguardOrAod = state.keyguardShowing
|
||||||
|| (state.mDozing && mDozeParameters.getAlwaysOn());
|
|| (state.dozing && mDozeParameters.getAlwaysOn());
|
||||||
if ((keyguardOrAod && !state.mBackdropShowing && !state.mLightRevealScrimOpaque)
|
if ((keyguardOrAod && !state.mediaBackdropShowing && !state.lightRevealScrimOpaque)
|
||||||
|| mKeyguardViewMediator.isAnimatingBetweenKeyguardAndSurfaceBehind()) {
|
|| mKeyguardViewMediator.isAnimatingBetweenKeyguardAndSurfaceBehind()) {
|
||||||
// Show the wallpaper if we're on keyguard/AOD and the wallpaper is not occluded by a
|
// 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
|
// 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;
|
mLpChanged.flags &= ~LayoutParams.FLAG_SHOW_WALLPAPER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.mDozing) {
|
if (state.dozing) {
|
||||||
mLpChanged.privateFlags |= LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
|
mLpChanged.privateFlags |= LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
|
||||||
} else {
|
} else {
|
||||||
mLpChanged.privateFlags &= ~LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
|
mLpChanged.privateFlags &= ~LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mKeyguardPreferredRefreshRate > 0) {
|
if (mKeyguardPreferredRefreshRate > 0) {
|
||||||
boolean onKeyguard = state.mStatusBarState == StatusBarState.KEYGUARD
|
boolean onKeyguard = state.statusBarState == StatusBarState.KEYGUARD
|
||||||
&& !state.mKeyguardFadingAway && !state.mKeyguardGoingAway;
|
&& !state.keyguardFadingAway && !state.keyguardGoingAway;
|
||||||
if (onKeyguard
|
if (onKeyguard
|
||||||
&& mAuthController.isUdfpsEnrolled(KeyguardUpdateMonitor.getCurrentUser())) {
|
&& mAuthController.isUdfpsEnrolled(KeyguardUpdateMonitor.getCurrentUser())) {
|
||||||
// both max and min display refresh rate must be set to take effect:
|
// both max and min display refresh rate must be set to take effect:
|
||||||
@@ -334,9 +336,9 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
(long) mKeyguardPreferredRefreshRate);
|
(long) mKeyguardPreferredRefreshRate);
|
||||||
} else if (mKeyguardMaxRefreshRate > 0) {
|
} else if (mKeyguardMaxRefreshRate > 0) {
|
||||||
boolean bypassOnKeyguard = mKeyguardBypassController.getBypassEnabled()
|
boolean bypassOnKeyguard = mKeyguardBypassController.getBypassEnabled()
|
||||||
&& state.mStatusBarState == StatusBarState.KEYGUARD
|
&& state.statusBarState == StatusBarState.KEYGUARD
|
||||||
&& !state.mKeyguardFadingAway && !state.mKeyguardGoingAway;
|
&& !state.keyguardFadingAway && !state.keyguardGoingAway;
|
||||||
if (state.mDozing || bypassOnKeyguard) {
|
if (state.dozing || bypassOnKeyguard) {
|
||||||
mLpChanged.preferredMaxDisplayRefreshRate = mKeyguardMaxRefreshRate;
|
mLpChanged.preferredMaxDisplayRefreshRate = mKeyguardMaxRefreshRate;
|
||||||
} else {
|
} else {
|
||||||
mLpChanged.preferredMaxDisplayRefreshRate = 0;
|
mLpChanged.preferredMaxDisplayRefreshRate = 0;
|
||||||
@@ -345,7 +347,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
(long) mLpChanged.preferredMaxDisplayRefreshRate);
|
(long) mLpChanged.preferredMaxDisplayRefreshRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.mBouncerShowing && !isDebuggable()) {
|
if (state.bouncerShowing && !isDebuggable()) {
|
||||||
mLpChanged.flags |= LayoutParams.FLAG_SECURE;
|
mLpChanged.flags |= LayoutParams.FLAG_SECURE;
|
||||||
} else {
|
} else {
|
||||||
mLpChanged.flags &= ~LayoutParams.FLAG_SECURE;
|
mLpChanged.flags &= ~LayoutParams.FLAG_SECURE;
|
||||||
@@ -356,8 +358,8 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
return Build.IS_DEBUGGABLE;
|
return Build.IS_DEBUGGABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void adjustScreenOrientation(State state) {
|
private void adjustScreenOrientation(NotificationShadeWindowState state) {
|
||||||
if (state.mBouncerShowing || state.isKeyguardShowingAndNotOccluded() || state.mDozing) {
|
if (state.bouncerShowing || state.isKeyguardShowingAndNotOccluded() || state.dozing) {
|
||||||
if (mKeyguardStateController.isKeyguardScreenRotationAllowed()) {
|
if (mKeyguardStateController.isKeyguardScreenRotationAllowed()) {
|
||||||
mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
|
mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
|
||||||
} else {
|
} else {
|
||||||
@@ -368,10 +370,10 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyFocusableFlag(State state) {
|
private void applyFocusableFlag(NotificationShadeWindowState state) {
|
||||||
boolean panelFocusable = state.mNotificationShadeFocusable && state.mPanelExpanded;
|
boolean panelFocusable = state.notificationShadeFocusable && state.panelExpanded;
|
||||||
if (state.mBouncerShowing && (state.mKeyguardOccluded || state.mKeyguardNeedsInput)
|
if (state.bouncerShowing && (state.keyguardOccluded || state.keyguardNeedsInput)
|
||||||
|| ENABLE_REMOTE_INPUT && state.mRemoteInputActive
|
|| ENABLE_REMOTE_INPUT && state.remoteInputActive
|
||||||
// Make the panel focusable if we're doing the screen off animation, since the light
|
// 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
|
// reveal scrim is drawing in the panel and should consume touch events so that they
|
||||||
// don't go to the app behind.
|
// don't go to the app behind.
|
||||||
@@ -381,7 +383,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
} else if (state.isKeyguardShowingAndNotOccluded() || panelFocusable) {
|
} else if (state.isKeyguardShowingAndNotOccluded() || panelFocusable) {
|
||||||
mLpChanged.flags &= ~LayoutParams.FLAG_NOT_FOCUSABLE;
|
mLpChanged.flags &= ~LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||||
// Make sure to remove FLAG_ALT_FOCUSABLE_IM when keyguard needs input.
|
// 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;
|
mLpChanged.flags &= ~LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
||||||
} else {
|
} else {
|
||||||
mLpChanged.flags |= LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
mLpChanged.flags |= LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
||||||
@@ -392,19 +394,19 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyForceShowNavigationFlag(State state) {
|
private void applyForceShowNavigationFlag(NotificationShadeWindowState state) {
|
||||||
if (state.mPanelExpanded || state.mBouncerShowing
|
if (state.panelExpanded || state.bouncerShowing
|
||||||
|| ENABLE_REMOTE_INPUT && state.mRemoteInputActive) {
|
|| ENABLE_REMOTE_INPUT && state.remoteInputActive) {
|
||||||
mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
|
mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
|
||||||
} else {
|
} else {
|
||||||
mLpChanged.privateFlags &= ~LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
|
mLpChanged.privateFlags &= ~LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyVisibility(State state) {
|
private void applyVisibility(NotificationShadeWindowState state) {
|
||||||
boolean visible = isExpanded(state);
|
boolean visible = isExpanded(state);
|
||||||
mLogger.logApplyVisibility(visible);
|
mLogger.logApplyVisibility(visible);
|
||||||
if (state.mForcePluginOpen) {
|
if (state.forcePluginOpen) {
|
||||||
if (mListener != null) {
|
if (mListener != null) {
|
||||||
mListener.setWouldOtherwiseCollapse(visible);
|
mListener.setWouldOtherwiseCollapse(visible);
|
||||||
}
|
}
|
||||||
@@ -420,16 +422,16 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isExpanded(State state) {
|
private boolean isExpanded(NotificationShadeWindowState state) {
|
||||||
return !state.mForceCollapsed && (state.isKeyguardShowingAndNotOccluded()
|
return !state.forceWindowCollapsed && (state.isKeyguardShowingAndNotOccluded()
|
||||||
|| state.mPanelVisible || state.mKeyguardFadingAway || state.mBouncerShowing
|
|| state.panelVisible || state.keyguardFadingAway || state.bouncerShowing
|
||||||
|| state.mHeadsUpShowing
|
|| state.headsUpNotificationShowing
|
||||||
|| state.mScrimsVisibility != ScrimController.TRANSPARENT)
|
|| state.scrimsVisibility != ScrimController.TRANSPARENT)
|
||||||
|| state.mBackgroundBlurRadius > 0
|
|| state.backgroundBlurRadius > 0
|
||||||
|| state.mLaunchingActivity;
|
|| state.launchingActivityFromNotification;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyFitsSystemWindows(State state) {
|
private void applyFitsSystemWindows(NotificationShadeWindowState state) {
|
||||||
boolean fitsSystemWindows = !state.isKeyguardShowingAndNotOccluded();
|
boolean fitsSystemWindows = !state.isKeyguardShowingAndNotOccluded();
|
||||||
if (mNotificationShadeView != null
|
if (mNotificationShadeView != null
|
||||||
&& mNotificationShadeView.getFitsSystemWindows() != fitsSystemWindows) {
|
&& 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()
|
if (state.isKeyguardShowingAndNotOccluded()
|
||||||
&& state.mStatusBarState == StatusBarState.KEYGUARD
|
&& state.statusBarState == StatusBarState.KEYGUARD
|
||||||
&& !state.mQsExpanded) {
|
&& !state.qsExpanded) {
|
||||||
mLpChanged.userActivityTimeout = state.mBouncerShowing
|
mLpChanged.userActivityTimeout = state.bouncerShowing
|
||||||
? KeyguardViewMediator.AWAKE_INTERVAL_BOUNCER_MS : mLockScreenDisplayTimeout;
|
? KeyguardViewMediator.AWAKE_INTERVAL_BOUNCER_MS : mLockScreenDisplayTimeout;
|
||||||
} else {
|
} else {
|
||||||
mLpChanged.userActivityTimeout = -1;
|
mLpChanged.userActivityTimeout = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyInputFeatures(State state) {
|
private void applyInputFeatures(NotificationShadeWindowState state) {
|
||||||
if (state.isKeyguardShowingAndNotOccluded()
|
if (state.isKeyguardShowingAndNotOccluded()
|
||||||
&& state.mStatusBarState == StatusBarState.KEYGUARD
|
&& state.statusBarState == StatusBarState.KEYGUARD
|
||||||
&& !state.mQsExpanded && !state.mForceUserActivity) {
|
&& !state.qsExpanded && !state.forceUserActivity) {
|
||||||
mLpChanged.inputFeatures |=
|
mLpChanged.inputFeatures |=
|
||||||
LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
|
LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
|
||||||
} else {
|
} else {
|
||||||
@@ -461,7 +463,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyStatusBarColorSpaceAgnosticFlag(State state) {
|
private void applyStatusBarColorSpaceAgnosticFlag(NotificationShadeWindowState state) {
|
||||||
if (!isExpanded(state)) {
|
if (!isExpanded(state)) {
|
||||||
mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;
|
mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;
|
||||||
} else {
|
} else {
|
||||||
@@ -487,8 +489,8 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
applyWindowLayoutParams();
|
applyWindowLayoutParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void apply(State state) {
|
private void apply(NotificationShadeWindowState state) {
|
||||||
mLogger.logNewState(state);
|
logState(state);
|
||||||
applyKeyguardFlags(state);
|
applyKeyguardFlags(state);
|
||||||
applyFocusableFlag(state);
|
applyFocusableFlag(state);
|
||||||
applyForceShowNavigationFlag(state);
|
applyForceShowNavigationFlag(state);
|
||||||
@@ -517,6 +519,38 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
notifyStateChangedCallbacks();
|
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
|
@Override
|
||||||
public void notifyStateChangedCallbacks() {
|
public void notifyStateChangedCallbacks() {
|
||||||
// Copy callbacks to separate ArrayList to avoid concurrent modification
|
// Copy callbacks to separate ArrayList to avoid concurrent modification
|
||||||
@@ -525,36 +559,36 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
for (StatusBarWindowCallback cb : activeCallbacks) {
|
for (StatusBarWindowCallback cb : activeCallbacks) {
|
||||||
cb.onStateChanged(mCurrentState.mKeyguardShowing,
|
cb.onStateChanged(mCurrentState.keyguardShowing,
|
||||||
mCurrentState.mKeyguardOccluded,
|
mCurrentState.keyguardOccluded,
|
||||||
mCurrentState.mBouncerShowing,
|
mCurrentState.bouncerShowing,
|
||||||
mCurrentState.mDozing,
|
mCurrentState.dozing,
|
||||||
mCurrentState.mPanelExpanded);
|
mCurrentState.panelExpanded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyModalFlag(State state) {
|
private void applyModalFlag(NotificationShadeWindowState state) {
|
||||||
if (state.mHeadsUpShowing) {
|
if (state.headsUpNotificationShowing) {
|
||||||
mLpChanged.flags |= LayoutParams.FLAG_NOT_TOUCH_MODAL;
|
mLpChanged.flags |= LayoutParams.FLAG_NOT_TOUCH_MODAL;
|
||||||
} else {
|
} else {
|
||||||
mLpChanged.flags &= ~LayoutParams.FLAG_NOT_TOUCH_MODAL;
|
mLpChanged.flags &= ~LayoutParams.FLAG_NOT_TOUCH_MODAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyBrightness(State state) {
|
private void applyBrightness(NotificationShadeWindowState state) {
|
||||||
if (state.mForceDozeBrightness) {
|
if (state.forceDozeBrightness) {
|
||||||
mLpChanged.screenBrightness = mScreenBrightnessDoze;
|
mLpChanged.screenBrightness = mScreenBrightnessDoze;
|
||||||
} else {
|
} else {
|
||||||
mLpChanged.screenBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
|
mLpChanged.screenBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyHasTopUi(State state) {
|
private void applyHasTopUi(NotificationShadeWindowState state) {
|
||||||
mHasTopUiChanged = !state.mComponentsForcingTopUi.isEmpty() || isExpanded(state);
|
mHasTopUiChanged = !state.componentsForcingTopUi.isEmpty() || isExpanded(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyNotTouchable(State state) {
|
private void applyNotTouchable(NotificationShadeWindowState state) {
|
||||||
if (state.mNotTouchable) {
|
if (state.windowNotTouchable) {
|
||||||
mLpChanged.flags |= LayoutParams.FLAG_NOT_TOUCHABLE;
|
mLpChanged.flags |= LayoutParams.FLAG_NOT_TOUCHABLE;
|
||||||
} else {
|
} else {
|
||||||
mLpChanged.flags &= ~LayoutParams.FLAG_NOT_TOUCHABLE;
|
mLpChanged.flags &= ~LayoutParams.FLAG_NOT_TOUCHABLE;
|
||||||
@@ -576,88 +610,88 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setKeyguardShowing(boolean showing) {
|
public void setKeyguardShowing(boolean showing) {
|
||||||
mCurrentState.mKeyguardShowing = showing;
|
mCurrentState.keyguardShowing = showing;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setKeyguardOccluded(boolean occluded) {
|
public void setKeyguardOccluded(boolean occluded) {
|
||||||
mCurrentState.mKeyguardOccluded = occluded;
|
mCurrentState.keyguardOccluded = occluded;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setKeyguardNeedsInput(boolean needsInput) {
|
public void setKeyguardNeedsInput(boolean needsInput) {
|
||||||
mCurrentState.mKeyguardNeedsInput = needsInput;
|
mCurrentState.keyguardNeedsInput = needsInput;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPanelVisible(boolean visible) {
|
public void setPanelVisible(boolean visible) {
|
||||||
if (mCurrentState.mPanelVisible == visible
|
if (mCurrentState.panelVisible == visible
|
||||||
&& mCurrentState.mNotificationShadeFocusable == visible) {
|
&& mCurrentState.notificationShadeFocusable == visible) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mLogger.logShadeVisibleAndFocusable(visible);
|
mLogger.logShadeVisibleAndFocusable(visible);
|
||||||
mCurrentState.mPanelVisible = visible;
|
mCurrentState.panelVisible = visible;
|
||||||
mCurrentState.mNotificationShadeFocusable = visible;
|
mCurrentState.notificationShadeFocusable = visible;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNotificationShadeFocusable(boolean focusable) {
|
public void setNotificationShadeFocusable(boolean focusable) {
|
||||||
mLogger.logShadeFocusable(focusable);
|
mLogger.logShadeFocusable(focusable);
|
||||||
mCurrentState.mNotificationShadeFocusable = focusable;
|
mCurrentState.notificationShadeFocusable = focusable;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBouncerShowing(boolean showing) {
|
public void setBouncerShowing(boolean showing) {
|
||||||
mCurrentState.mBouncerShowing = showing;
|
mCurrentState.bouncerShowing = showing;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBackdropShowing(boolean showing) {
|
public void setBackdropShowing(boolean showing) {
|
||||||
mCurrentState.mBackdropShowing = showing;
|
mCurrentState.mediaBackdropShowing = showing;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setKeyguardFadingAway(boolean keyguardFadingAway) {
|
public void setKeyguardFadingAway(boolean keyguardFadingAway) {
|
||||||
mCurrentState.mKeyguardFadingAway = keyguardFadingAway;
|
mCurrentState.keyguardFadingAway = keyguardFadingAway;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onQsExpansionChanged(Boolean expanded) {
|
private void onQsExpansionChanged(Boolean expanded) {
|
||||||
mCurrentState.mQsExpanded = expanded;
|
mCurrentState.qsExpanded = expanded;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setForceUserActivity(boolean forceUserActivity) {
|
public void setForceUserActivity(boolean forceUserActivity) {
|
||||||
mCurrentState.mForceUserActivity = forceUserActivity;
|
mCurrentState.forceUserActivity = forceUserActivity;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLaunchingActivity(boolean launching) {
|
public void setLaunchingActivity(boolean launching) {
|
||||||
mCurrentState.mLaunchingActivity = launching;
|
mCurrentState.launchingActivityFromNotification = launching;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLaunchingActivity() {
|
public boolean isLaunchingActivity() {
|
||||||
return mCurrentState.mLaunchingActivity;
|
return mCurrentState.launchingActivityFromNotification;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setScrimsVisibility(int scrimsVisibility) {
|
public void setScrimsVisibility(int scrimsVisibility) {
|
||||||
if (scrimsVisibility == mCurrentState.mScrimsVisibility) {
|
if (scrimsVisibility == mCurrentState.scrimsVisibility) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean wasExpanded = isExpanded(mCurrentState);
|
boolean wasExpanded = isExpanded(mCurrentState);
|
||||||
mCurrentState.mScrimsVisibility = scrimsVisibility;
|
mCurrentState.scrimsVisibility = scrimsVisibility;
|
||||||
if (wasExpanded != isExpanded(mCurrentState)) {
|
if (wasExpanded != isExpanded(mCurrentState)) {
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
@@ -671,31 +705,31 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setBackgroundBlurRadius(int backgroundBlurRadius) {
|
public void setBackgroundBlurRadius(int backgroundBlurRadius) {
|
||||||
if (mCurrentState.mBackgroundBlurRadius == backgroundBlurRadius) {
|
if (mCurrentState.backgroundBlurRadius == backgroundBlurRadius) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mCurrentState.mBackgroundBlurRadius = backgroundBlurRadius;
|
mCurrentState.backgroundBlurRadius = backgroundBlurRadius;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHeadsUpShowing(boolean showing) {
|
public void setHeadsUpShowing(boolean showing) {
|
||||||
mCurrentState.mHeadsUpShowing = showing;
|
mCurrentState.headsUpNotificationShowing = showing;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLightRevealScrimOpaque(boolean opaque) {
|
public void setLightRevealScrimOpaque(boolean opaque) {
|
||||||
if (mCurrentState.mLightRevealScrimOpaque == opaque) {
|
if (mCurrentState.lightRevealScrimOpaque == opaque) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mCurrentState.mLightRevealScrimOpaque = opaque;
|
mCurrentState.lightRevealScrimOpaque = opaque;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setWallpaperSupportsAmbientMode(boolean supportsAmbientMode) {
|
public void setWallpaperSupportsAmbientMode(boolean supportsAmbientMode) {
|
||||||
mCurrentState.mWallpaperSupportsAmbientMode = supportsAmbientMode;
|
mCurrentState.wallpaperSupportsAmbientMode = supportsAmbientMode;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -703,7 +737,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
* @param state The {@link StatusBarStateController} of the status bar.
|
* @param state The {@link StatusBarStateController} of the status bar.
|
||||||
*/
|
*/
|
||||||
private void setStatusBarState(int state) {
|
private void setStatusBarState(int state) {
|
||||||
mCurrentState.mStatusBarState = state;
|
mCurrentState.statusBarState = state;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -714,13 +748,13 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setForceWindowCollapsed(boolean force) {
|
public void setForceWindowCollapsed(boolean force) {
|
||||||
mCurrentState.mForceCollapsed = force;
|
mCurrentState.forceWindowCollapsed = force;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemoteInputActive(boolean remoteInputActive) {
|
public void onRemoteInputActive(boolean remoteInputActive) {
|
||||||
mCurrentState.mRemoteInputActive = remoteInputActive;
|
mCurrentState.remoteInputActive = remoteInputActive;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -730,32 +764,32 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setForceDozeBrightness(boolean forceDozeBrightness) {
|
public void setForceDozeBrightness(boolean forceDozeBrightness) {
|
||||||
if (mCurrentState.mForceDozeBrightness == forceDozeBrightness) {
|
if (mCurrentState.forceDozeBrightness == forceDozeBrightness) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mCurrentState.mForceDozeBrightness = forceDozeBrightness;
|
mCurrentState.forceDozeBrightness = forceDozeBrightness;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDozing(boolean dozing) {
|
public void setDozing(boolean dozing) {
|
||||||
mCurrentState.mDozing = dozing;
|
mCurrentState.dozing = dozing;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setForcePluginOpen(boolean forceOpen, Object token) {
|
public void setForcePluginOpen(boolean forceOpen, Object token) {
|
||||||
if (forceOpen) {
|
if (forceOpen) {
|
||||||
mCurrentState.mForceOpenTokens.add(token);
|
mCurrentState.forceOpenTokens.add(token);
|
||||||
} else {
|
} else {
|
||||||
mCurrentState.mForceOpenTokens.remove(token);
|
mCurrentState.forceOpenTokens.remove(token);
|
||||||
}
|
}
|
||||||
final boolean previousForceOpenState = mCurrentState.mForcePluginOpen;
|
final boolean previousForceOpenState = mCurrentState.forcePluginOpen;
|
||||||
mCurrentState.mForcePluginOpen = !mCurrentState.mForceOpenTokens.isEmpty();
|
mCurrentState.forcePluginOpen = !mCurrentState.forceOpenTokens.isEmpty();
|
||||||
if (previousForceOpenState != mCurrentState.mForcePluginOpen) {
|
if (previousForceOpenState != mCurrentState.forcePluginOpen) {
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
if (mForcePluginOpenListener != null) {
|
if (mForcePluginOpenListener != null) {
|
||||||
mForcePluginOpenListener.onChange(mCurrentState.mForcePluginOpen);
|
mForcePluginOpenListener.onChange(mCurrentState.forcePluginOpen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -765,12 +799,12 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean getForcePluginOpen() {
|
public boolean getForcePluginOpen() {
|
||||||
return mCurrentState.mForcePluginOpen;
|
return mCurrentState.forcePluginOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNotTouchable(boolean notTouchable) {
|
public void setNotTouchable(boolean notTouchable) {
|
||||||
mCurrentState.mNotTouchable = notTouchable;
|
mCurrentState.windowNotTouchable = notTouchable;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -779,7 +813,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean getPanelExpanded() {
|
public boolean getPanelExpanded() {
|
||||||
return mCurrentState.mPanelExpanded;
|
return mCurrentState.panelExpanded;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -802,11 +836,16 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
if (mNotificationShadeView != null && mNotificationShadeView.getViewRootImpl() != null) {
|
if (mNotificationShadeView != null && mNotificationShadeView.getViewRootImpl() != null) {
|
||||||
mNotificationShadeView.getViewRootImpl().dump(" ", pw);
|
mNotificationShadeView.getViewRootImpl().dump(" ", pw);
|
||||||
}
|
}
|
||||||
|
new DumpsysTableLogger(
|
||||||
|
TAG,
|
||||||
|
NotificationShadeWindowState.TABLE_HEADERS,
|
||||||
|
mStateBuffer.toList()
|
||||||
|
).printTableData(pw);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isShowingWallpaper() {
|
public boolean isShowingWallpaper() {
|
||||||
return !mCurrentState.mBackdropShowing;
|
return !mCurrentState.mediaBackdropShowing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -836,7 +875,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setKeyguardGoingAway(boolean goingAway) {
|
public void setKeyguardGoingAway(boolean goingAway) {
|
||||||
mCurrentState.mKeyguardGoingAway = goingAway;
|
mCurrentState.keyguardGoingAway = goingAway;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -848,87 +887,13 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
@Override
|
@Override
|
||||||
public void setRequestTopUi(boolean requestTopUi, String componentTag) {
|
public void setRequestTopUi(boolean requestTopUi, String componentTag) {
|
||||||
if (requestTopUi) {
|
if (requestTopUi) {
|
||||||
mCurrentState.mComponentsForcingTopUi.add(componentTag);
|
mCurrentState.componentsForcingTopUi.add(componentTag);
|
||||||
} else {
|
} else {
|
||||||
mCurrentState.mComponentsForcingTopUi.remove(componentTag);
|
mCurrentState.componentsForcingTopUi.remove(componentTag);
|
||||||
}
|
}
|
||||||
apply(mCurrentState);
|
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() {
|
private final StateListener mStateListener = new StateListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onStateChanged(int newState) {
|
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