Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/StatusBarStateController.java +0 −7 Original line number Diff line number Diff line Loading @@ -123,13 +123,6 @@ public interface StatusBarStateController { */ default void onDozeAmountChanged(float linear, float eased) {} /** * Callback to be notified when the fullscreen or immersive state changes. * * @param isFullscreen if any of the system bar is hidden by the focused window. */ default void onFullscreenStateChanged(boolean isFullscreen) {} /** * Callback to be notified when the pulsing state changes */ Loading packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java +0 −36 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.systemui.statusbar; import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS; import static com.android.internal.jank.InteractionJankMonitor.CUJ_LOCKSCREEN_TRANSITION_FROM_AOD; import static com.android.internal.jank.InteractionJankMonitor.CUJ_LOCKSCREEN_TRANSITION_TO_AOD; Loading @@ -31,13 +29,7 @@ import android.text.format.DateFormat; import android.util.FloatProperty; import android.util.Log; import android.view.Choreographer; import android.view.InsetsFlags; import android.view.View; import android.view.ViewDebug; import android.view.WindowInsets; import android.view.WindowInsets.Type.InsetsType; import android.view.WindowInsetsController.Appearance; import android.view.WindowInsetsController.Behavior; import android.view.animation.Interpolator; import androidx.annotation.NonNull; Loading Loading @@ -553,34 +545,6 @@ public class StatusBarStateControllerImpl implements return mKeyguardRequested; } @Override public void setSystemBarAttributes(@Appearance int appearance, @Behavior int behavior, @InsetsType int requestedVisibleTypes, String packageName) { boolean isFullscreen = (requestedVisibleTypes & WindowInsets.Type.statusBars()) == 0 || (requestedVisibleTypes & WindowInsets.Type.navigationBars()) == 0; if (mIsFullscreen != isFullscreen) { mIsFullscreen = isFullscreen; synchronized (mListeners) { for (RankedListener rl : new ArrayList<>(mListeners)) { rl.mListener.onFullscreenStateChanged(isFullscreen); } } } // TODO (b/190543382): Finish the logging logic. // This section can be removed if we don't need to print it on logcat. if (DEBUG_IMMERSIVE_APPS) { boolean dim = (appearance & APPEARANCE_LOW_PROFILE_BARS) != 0; String behaviorName = ViewDebug.flagsToString(InsetsFlags.class, "behavior", behavior); String requestedVisibleTypesString = WindowInsets.Type.toString(requestedVisibleTypes); if (requestedVisibleTypesString.isEmpty()) { requestedVisibleTypesString = "none"; } Log.d(TAG, packageName + " dim=" + dim + " behavior=" + behaviorName + " requested visible types: " + requestedVisibleTypesString); } } @Override public void setPulsing(boolean pulsing) { if (mPulsing != pulsing) { Loading packages/SystemUI/src/com/android/systemui/statusbar/SysuiStatusBarStateController.java +0 −9 Original line number Diff line number Diff line Loading @@ -20,9 +20,6 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; import android.annotation.IntDef; import android.view.View; import android.view.WindowInsets.Type.InsetsType; import android.view.WindowInsetsController.Appearance; import android.view.WindowInsetsController.Behavior; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.phone.CentralSurfaces; Loading Loading @@ -150,12 +147,6 @@ public interface SysuiStatusBarStateController extends StatusBarStateController */ boolean isKeyguardRequested(); /** * Set the system bar attributes */ void setSystemBarAttributes(@Appearance int appearance, @Behavior int behavior, @InsetsType int requestedVisibleTypes, String packageName); /** * Set pulsing */ Loading packages/SystemUI/src/com/android/systemui/statusbar/data/repository/StatusBarModeRepository.kt +53 −0 Original line number Diff line number Diff line Loading @@ -17,14 +17,22 @@ package com.android.systemui.statusbar.data.repository import android.view.WindowInsets import android.view.WindowInsetsController import com.android.internal.statusbar.LetterboxDetails import com.android.internal.view.AppearanceRegion import com.android.systemui.CoreStartable import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.DisplayId import com.android.systemui.statusbar.CommandQueue import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn /** * A repository for the current mode of the status bar on the homescreen (translucent, transparent, Loading @@ -45,6 +53,14 @@ interface StatusBarModeRepository { */ val isTransientShown: StateFlow<Boolean> /** * True the focused window is fullscreen (aka immersive) and false otherwise. * * Typically, the only time the status bar window is hidden is when the focused window is * fullscreen. */ val isInFullscreenMode: StateFlow<Boolean> /** * Requests for the status bar to be shown transiently. * Loading @@ -66,6 +82,7 @@ interface StatusBarModeRepository { class StatusBarModeRepositoryImpl @Inject constructor( @Application scope: CoroutineScope, @DisplayId thisDisplayId: Int, private val commandQueue: CommandQueue, ) : StatusBarModeRepository, CoreStartable { Loading Loading @@ -94,6 +111,23 @@ constructor( ): Boolean { return displayId == thisDisplayId && (types and WindowInsets.Type.statusBars() != 0) } override fun onSystemBarAttributesChanged( displayId: Int, @WindowInsetsController.Appearance appearance: Int, appearanceRegions: Array<AppearanceRegion>, navbarColorManagedByIme: Boolean, @WindowInsetsController.Behavior behavior: Int, @WindowInsets.Type.InsetsType requestedVisibleTypes: Int, packageName: String, letterboxDetails: Array<LetterboxDetails>, ) { if (displayId != thisDisplayId) return _originalStatusBarAttributes.value = StatusBarAttributes( requestedVisibleTypes, ) } } override fun start() { Loading @@ -103,6 +137,17 @@ constructor( private val _isTransientShown = MutableStateFlow(false) override val isTransientShown: StateFlow<Boolean> = _isTransientShown.asStateFlow() private val _originalStatusBarAttributes = MutableStateFlow<StatusBarAttributes?>(null) override val isInFullscreenMode: StateFlow<Boolean> = _originalStatusBarAttributes .map { params -> val requestedVisibleTypes = params?.requestedVisibleTypes ?: return@map false // When the status bar is not requested visible, we assume we're in fullscreen mode. requestedVisibleTypes and WindowInsets.Type.statusBars() == 0 } .stateIn(scope, SharingStarted.Eagerly, false) override fun showTransient() { _isTransientShown.value = true } Loading @@ -110,4 +155,12 @@ constructor( override fun clearTransient() { _isTransientShown.value = false } /** * Internal class keeping track of the raw status bar attributes received from the callback. * Should never be exposed. */ private data class StatusBarAttributes( @WindowInsets.Type.InsetsType val requestedVisibleTypes: Int, ) } packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +10 −9 Original line number Diff line number Diff line Loading @@ -563,8 +563,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { private final Executor mUiBgExecutor; protected boolean mDozing; private boolean mIsFullscreen; boolean mCloseQsBeforeScreenOff; private final NotificationMediaManager mMediaManager; Loading Loading @@ -1192,6 +1190,9 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mDemoModeController.addCallback(mDemoModeCallback); mJavaAdapter.alwaysCollectFlow( mStatusBarModeRepository.isTransientShown(), this::onTransientShownChanged); mJavaAdapter.alwaysCollectFlow( mStatusBarModeRepository.isInFullscreenMode(), this::onStatusBarFullscreenChanged); mCommandQueueCallbacks = mCommandQueueCallbacksLazy.get(); mCommandQueue.addCallback(mCommandQueueCallbacks); Loading Loading @@ -1733,6 +1734,10 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { maybeUpdateBarMode(); } private void onStatusBarFullscreenChanged(boolean isWindowShown) { maybeUpdateBarMode(); } private void maybeUpdateBarMode() { final int barMode = barMode(isTransientShown(), mAppearance); if (updateBarMode(barMode)) { Loading @@ -1752,8 +1757,10 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { } private @TransitionMode int barMode(boolean isTransient, int appearance) { boolean isFullscreen = mStatusBarModeRepository.isInFullscreenMode().getValue(); final int lightsOutOpaque = APPEARANCE_LOW_PROFILE_BARS | APPEARANCE_OPAQUE_STATUS_BARS; if (mOngoingCallController.hasOngoingCall() && mIsFullscreen) { if (mOngoingCallController.hasOngoingCall() && isFullscreen) { // Force show the status bar if there's an ongoing call. return MODE_SEMI_TRANSPARENT; } else if (isTransient) { return MODE_SEMI_TRANSPARENT; Loading Loading @@ -3349,12 +3356,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { updateReportRejectedTouchVisibility(); Trace.endSection(); } @Override public void onFullscreenStateChanged(boolean isFullscreen) { mIsFullscreen = isFullscreen; maybeUpdateBarMode(); } }; private final BatteryController.BatteryStateChangeCallback mBatteryStateChangeCallback = Loading Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/StatusBarStateController.java +0 −7 Original line number Diff line number Diff line Loading @@ -123,13 +123,6 @@ public interface StatusBarStateController { */ default void onDozeAmountChanged(float linear, float eased) {} /** * Callback to be notified when the fullscreen or immersive state changes. * * @param isFullscreen if any of the system bar is hidden by the focused window. */ default void onFullscreenStateChanged(boolean isFullscreen) {} /** * Callback to be notified when the pulsing state changes */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java +0 −36 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.systemui.statusbar; import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS; import static com.android.internal.jank.InteractionJankMonitor.CUJ_LOCKSCREEN_TRANSITION_FROM_AOD; import static com.android.internal.jank.InteractionJankMonitor.CUJ_LOCKSCREEN_TRANSITION_TO_AOD; Loading @@ -31,13 +29,7 @@ import android.text.format.DateFormat; import android.util.FloatProperty; import android.util.Log; import android.view.Choreographer; import android.view.InsetsFlags; import android.view.View; import android.view.ViewDebug; import android.view.WindowInsets; import android.view.WindowInsets.Type.InsetsType; import android.view.WindowInsetsController.Appearance; import android.view.WindowInsetsController.Behavior; import android.view.animation.Interpolator; import androidx.annotation.NonNull; Loading Loading @@ -553,34 +545,6 @@ public class StatusBarStateControllerImpl implements return mKeyguardRequested; } @Override public void setSystemBarAttributes(@Appearance int appearance, @Behavior int behavior, @InsetsType int requestedVisibleTypes, String packageName) { boolean isFullscreen = (requestedVisibleTypes & WindowInsets.Type.statusBars()) == 0 || (requestedVisibleTypes & WindowInsets.Type.navigationBars()) == 0; if (mIsFullscreen != isFullscreen) { mIsFullscreen = isFullscreen; synchronized (mListeners) { for (RankedListener rl : new ArrayList<>(mListeners)) { rl.mListener.onFullscreenStateChanged(isFullscreen); } } } // TODO (b/190543382): Finish the logging logic. // This section can be removed if we don't need to print it on logcat. if (DEBUG_IMMERSIVE_APPS) { boolean dim = (appearance & APPEARANCE_LOW_PROFILE_BARS) != 0; String behaviorName = ViewDebug.flagsToString(InsetsFlags.class, "behavior", behavior); String requestedVisibleTypesString = WindowInsets.Type.toString(requestedVisibleTypes); if (requestedVisibleTypesString.isEmpty()) { requestedVisibleTypesString = "none"; } Log.d(TAG, packageName + " dim=" + dim + " behavior=" + behaviorName + " requested visible types: " + requestedVisibleTypesString); } } @Override public void setPulsing(boolean pulsing) { if (mPulsing != pulsing) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/SysuiStatusBarStateController.java +0 −9 Original line number Diff line number Diff line Loading @@ -20,9 +20,6 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; import android.annotation.IntDef; import android.view.View; import android.view.WindowInsets.Type.InsetsType; import android.view.WindowInsetsController.Appearance; import android.view.WindowInsetsController.Behavior; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.phone.CentralSurfaces; Loading Loading @@ -150,12 +147,6 @@ public interface SysuiStatusBarStateController extends StatusBarStateController */ boolean isKeyguardRequested(); /** * Set the system bar attributes */ void setSystemBarAttributes(@Appearance int appearance, @Behavior int behavior, @InsetsType int requestedVisibleTypes, String packageName); /** * Set pulsing */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/data/repository/StatusBarModeRepository.kt +53 −0 Original line number Diff line number Diff line Loading @@ -17,14 +17,22 @@ package com.android.systemui.statusbar.data.repository import android.view.WindowInsets import android.view.WindowInsetsController import com.android.internal.statusbar.LetterboxDetails import com.android.internal.view.AppearanceRegion import com.android.systemui.CoreStartable import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.DisplayId import com.android.systemui.statusbar.CommandQueue import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn /** * A repository for the current mode of the status bar on the homescreen (translucent, transparent, Loading @@ -45,6 +53,14 @@ interface StatusBarModeRepository { */ val isTransientShown: StateFlow<Boolean> /** * True the focused window is fullscreen (aka immersive) and false otherwise. * * Typically, the only time the status bar window is hidden is when the focused window is * fullscreen. */ val isInFullscreenMode: StateFlow<Boolean> /** * Requests for the status bar to be shown transiently. * Loading @@ -66,6 +82,7 @@ interface StatusBarModeRepository { class StatusBarModeRepositoryImpl @Inject constructor( @Application scope: CoroutineScope, @DisplayId thisDisplayId: Int, private val commandQueue: CommandQueue, ) : StatusBarModeRepository, CoreStartable { Loading Loading @@ -94,6 +111,23 @@ constructor( ): Boolean { return displayId == thisDisplayId && (types and WindowInsets.Type.statusBars() != 0) } override fun onSystemBarAttributesChanged( displayId: Int, @WindowInsetsController.Appearance appearance: Int, appearanceRegions: Array<AppearanceRegion>, navbarColorManagedByIme: Boolean, @WindowInsetsController.Behavior behavior: Int, @WindowInsets.Type.InsetsType requestedVisibleTypes: Int, packageName: String, letterboxDetails: Array<LetterboxDetails>, ) { if (displayId != thisDisplayId) return _originalStatusBarAttributes.value = StatusBarAttributes( requestedVisibleTypes, ) } } override fun start() { Loading @@ -103,6 +137,17 @@ constructor( private val _isTransientShown = MutableStateFlow(false) override val isTransientShown: StateFlow<Boolean> = _isTransientShown.asStateFlow() private val _originalStatusBarAttributes = MutableStateFlow<StatusBarAttributes?>(null) override val isInFullscreenMode: StateFlow<Boolean> = _originalStatusBarAttributes .map { params -> val requestedVisibleTypes = params?.requestedVisibleTypes ?: return@map false // When the status bar is not requested visible, we assume we're in fullscreen mode. requestedVisibleTypes and WindowInsets.Type.statusBars() == 0 } .stateIn(scope, SharingStarted.Eagerly, false) override fun showTransient() { _isTransientShown.value = true } Loading @@ -110,4 +155,12 @@ constructor( override fun clearTransient() { _isTransientShown.value = false } /** * Internal class keeping track of the raw status bar attributes received from the callback. * Should never be exposed. */ private data class StatusBarAttributes( @WindowInsets.Type.InsetsType val requestedVisibleTypes: Int, ) }
packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +10 −9 Original line number Diff line number Diff line Loading @@ -563,8 +563,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { private final Executor mUiBgExecutor; protected boolean mDozing; private boolean mIsFullscreen; boolean mCloseQsBeforeScreenOff; private final NotificationMediaManager mMediaManager; Loading Loading @@ -1192,6 +1190,9 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mDemoModeController.addCallback(mDemoModeCallback); mJavaAdapter.alwaysCollectFlow( mStatusBarModeRepository.isTransientShown(), this::onTransientShownChanged); mJavaAdapter.alwaysCollectFlow( mStatusBarModeRepository.isInFullscreenMode(), this::onStatusBarFullscreenChanged); mCommandQueueCallbacks = mCommandQueueCallbacksLazy.get(); mCommandQueue.addCallback(mCommandQueueCallbacks); Loading Loading @@ -1733,6 +1734,10 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { maybeUpdateBarMode(); } private void onStatusBarFullscreenChanged(boolean isWindowShown) { maybeUpdateBarMode(); } private void maybeUpdateBarMode() { final int barMode = barMode(isTransientShown(), mAppearance); if (updateBarMode(barMode)) { Loading @@ -1752,8 +1757,10 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { } private @TransitionMode int barMode(boolean isTransient, int appearance) { boolean isFullscreen = mStatusBarModeRepository.isInFullscreenMode().getValue(); final int lightsOutOpaque = APPEARANCE_LOW_PROFILE_BARS | APPEARANCE_OPAQUE_STATUS_BARS; if (mOngoingCallController.hasOngoingCall() && mIsFullscreen) { if (mOngoingCallController.hasOngoingCall() && isFullscreen) { // Force show the status bar if there's an ongoing call. return MODE_SEMI_TRANSPARENT; } else if (isTransient) { return MODE_SEMI_TRANSPARENT; Loading Loading @@ -3349,12 +3356,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { updateReportRejectedTouchVisibility(); Trace.endSection(); } @Override public void onFullscreenStateChanged(boolean isFullscreen) { mIsFullscreen = isFullscreen; maybeUpdateBarMode(); } }; private final BatteryController.BatteryStateChangeCallback mBatteryStateChangeCallback = Loading