Loading packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java +5 −2 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import com.android.systemui.screenshot.ReferenceScreenshotModule; import com.android.systemui.shade.NotificationShadeWindowControllerImpl; import com.android.systemui.shade.ShadeController; import com.android.systemui.shade.ShadeControllerImpl; import com.android.systemui.shade.ShadeExpansionStateManager; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl; Loading Loading @@ -162,7 +163,8 @@ public abstract class ReferenceSystemUIModule { ConfigurationController configurationController, @Main Handler handler, AccessibilityManagerWrapper accessibilityManagerWrapper, UiEventLogger uiEventLogger) { UiEventLogger uiEventLogger, ShadeExpansionStateManager shadeExpansionStateManager) { return new HeadsUpManagerPhone( context, headsUpManagerLogger, Loading @@ -173,7 +175,8 @@ public abstract class ReferenceSystemUIModule { configurationController, handler, accessibilityManagerWrapper, uiEventLogger uiEventLogger, shadeExpansionStateManager ); } Loading packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +1 −5 Original line number Diff line number Diff line Loading @@ -3394,11 +3394,7 @@ public final class NotificationPanelViewController implements Dumpable { boolean isExpanded = !isFullyCollapsed() || mExpectingSynthesizedDown; if (mPanelExpanded != isExpanded) { mPanelExpanded = isExpanded; mHeadsUpManager.setIsPanelExpanded(isExpanded); mStatusBarTouchableRegionManager.setPanelExpanded(isExpanded); mCentralSurfaces.setPanelExpanded(isExpanded); mShadeExpansionStateManager.onShadeExpansionFullyChanged(isExpanded); if (!isExpanded && mQs != null && mQs.isCustomizing()) { mQs.closeCustomizer(); } Loading packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java +10 −9 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import android.view.WindowManager; import android.view.WindowManager.LayoutParams; import android.view.WindowManagerGlobal; import com.android.internal.annotations.VisibleForTesting; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.Dumpable; import com.android.systemui.R; Loading Loading @@ -158,6 +159,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW SysuiStatusBarStateController.RANK_STATUS_BAR_WINDOW_CONTROLLER); configurationController.addCallback(this); shadeExpansionStateManager.addQsExpansionListener(this::onQsExpansionChanged); shadeExpansionStateManager.addFullExpansionListener(this::onShadeExpansionFullyChanged); float desiredPreferredRefreshRate = context.getResources() .getInteger(R.integer.config_keyguardRefreshRate); Loading Loading @@ -204,6 +206,14 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW } } @VisibleForTesting void onShadeExpansionFullyChanged(Boolean isExpanded) { if (mCurrentState.mPanelExpanded != isExpanded) { mCurrentState.mPanelExpanded = isExpanded; apply(mCurrentState); } } /** * Register a listener to monitor scrims visibility * @param listener A listener to monitor scrims visibility Loading Loading @@ -698,15 +708,6 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW apply(mCurrentState); } @Override public void setPanelExpanded(boolean isExpanded) { if (mCurrentState.mPanelExpanded == isExpanded) { return; } mCurrentState.mPanelExpanded = isExpanded; apply(mCurrentState); } @Override public void onRemoteInputActive(boolean remoteInputActive) { mCurrentState.mRemoteInputActive = remoteInputActive; Loading packages/SystemUI/src/com/android/systemui/shade/ShadeExpansionStateManager.kt +17 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import javax.inject.Inject class ShadeExpansionStateManager @Inject constructor() : ShadeStateEvents { private val expansionListeners = CopyOnWriteArrayList<ShadeExpansionListener>() private val fullExpansionListeners = CopyOnWriteArrayList<ShadeFullExpansionListener>() private val qsExpansionListeners = CopyOnWriteArrayList<ShadeQsExpansionListener>() private val stateListeners = CopyOnWriteArrayList<ShadeStateListener>() private val shadeStateEventsListeners = CopyOnWriteArrayList<ShadeStateEventsListener>() Loading Loading @@ -62,6 +63,15 @@ class ShadeExpansionStateManager @Inject constructor() : ShadeStateEvents { expansionListeners.remove(listener) } fun addFullExpansionListener(listener: ShadeFullExpansionListener) { fullExpansionListeners.add(listener) listener.onShadeExpansionFullyChanged(qsExpanded) } fun removeFullExpansionListener(listener: ShadeFullExpansionListener) { fullExpansionListeners.remove(listener) } fun addQsExpansionListener(listener: ShadeQsExpansionListener) { qsExpansionListeners.add(listener) listener.onQsExpansionChanged(qsExpanded) Loading Loading @@ -156,6 +166,13 @@ class ShadeExpansionStateManager @Inject constructor() : ShadeStateEvents { qsExpansionListeners.forEach { it.onQsExpansionChanged(qsExpanded) } } fun onShadeExpansionFullyChanged(isExpanded: Boolean) { this.expanded = isExpanded debugLog("expanded=$isExpanded") fullExpansionListeners.forEach { it.onShadeExpansionFullyChanged(isExpanded) } } /** Updates the panel state if necessary. */ fun updateState(@PanelState state: Int) { debugLog( Loading packages/SystemUI/src/com/android/systemui/shade/ShadeFullExpansionListener.kt 0 → 100644 +23 −0 Original line number Diff line number Diff line /* * 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 /** A listener interface to be notified of expansion events for the notification shade. */ fun interface ShadeFullExpansionListener { /** Invoked whenever the shade expansion changes, when it is fully collapsed or expanded */ fun onShadeExpansionFullyChanged(isExpanded: Boolean) } Loading
packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java +5 −2 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import com.android.systemui.screenshot.ReferenceScreenshotModule; import com.android.systemui.shade.NotificationShadeWindowControllerImpl; import com.android.systemui.shade.ShadeController; import com.android.systemui.shade.ShadeControllerImpl; import com.android.systemui.shade.ShadeExpansionStateManager; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl; Loading Loading @@ -162,7 +163,8 @@ public abstract class ReferenceSystemUIModule { ConfigurationController configurationController, @Main Handler handler, AccessibilityManagerWrapper accessibilityManagerWrapper, UiEventLogger uiEventLogger) { UiEventLogger uiEventLogger, ShadeExpansionStateManager shadeExpansionStateManager) { return new HeadsUpManagerPhone( context, headsUpManagerLogger, Loading @@ -173,7 +175,8 @@ public abstract class ReferenceSystemUIModule { configurationController, handler, accessibilityManagerWrapper, uiEventLogger uiEventLogger, shadeExpansionStateManager ); } Loading
packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +1 −5 Original line number Diff line number Diff line Loading @@ -3394,11 +3394,7 @@ public final class NotificationPanelViewController implements Dumpable { boolean isExpanded = !isFullyCollapsed() || mExpectingSynthesizedDown; if (mPanelExpanded != isExpanded) { mPanelExpanded = isExpanded; mHeadsUpManager.setIsPanelExpanded(isExpanded); mStatusBarTouchableRegionManager.setPanelExpanded(isExpanded); mCentralSurfaces.setPanelExpanded(isExpanded); mShadeExpansionStateManager.onShadeExpansionFullyChanged(isExpanded); if (!isExpanded && mQs != null && mQs.isCustomizing()) { mQs.closeCustomizer(); } Loading
packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java +10 −9 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import android.view.WindowManager; import android.view.WindowManager.LayoutParams; import android.view.WindowManagerGlobal; import com.android.internal.annotations.VisibleForTesting; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.Dumpable; import com.android.systemui.R; Loading Loading @@ -158,6 +159,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW SysuiStatusBarStateController.RANK_STATUS_BAR_WINDOW_CONTROLLER); configurationController.addCallback(this); shadeExpansionStateManager.addQsExpansionListener(this::onQsExpansionChanged); shadeExpansionStateManager.addFullExpansionListener(this::onShadeExpansionFullyChanged); float desiredPreferredRefreshRate = context.getResources() .getInteger(R.integer.config_keyguardRefreshRate); Loading Loading @@ -204,6 +206,14 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW } } @VisibleForTesting void onShadeExpansionFullyChanged(Boolean isExpanded) { if (mCurrentState.mPanelExpanded != isExpanded) { mCurrentState.mPanelExpanded = isExpanded; apply(mCurrentState); } } /** * Register a listener to monitor scrims visibility * @param listener A listener to monitor scrims visibility Loading Loading @@ -698,15 +708,6 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW apply(mCurrentState); } @Override public void setPanelExpanded(boolean isExpanded) { if (mCurrentState.mPanelExpanded == isExpanded) { return; } mCurrentState.mPanelExpanded = isExpanded; apply(mCurrentState); } @Override public void onRemoteInputActive(boolean remoteInputActive) { mCurrentState.mRemoteInputActive = remoteInputActive; Loading
packages/SystemUI/src/com/android/systemui/shade/ShadeExpansionStateManager.kt +17 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import javax.inject.Inject class ShadeExpansionStateManager @Inject constructor() : ShadeStateEvents { private val expansionListeners = CopyOnWriteArrayList<ShadeExpansionListener>() private val fullExpansionListeners = CopyOnWriteArrayList<ShadeFullExpansionListener>() private val qsExpansionListeners = CopyOnWriteArrayList<ShadeQsExpansionListener>() private val stateListeners = CopyOnWriteArrayList<ShadeStateListener>() private val shadeStateEventsListeners = CopyOnWriteArrayList<ShadeStateEventsListener>() Loading Loading @@ -62,6 +63,15 @@ class ShadeExpansionStateManager @Inject constructor() : ShadeStateEvents { expansionListeners.remove(listener) } fun addFullExpansionListener(listener: ShadeFullExpansionListener) { fullExpansionListeners.add(listener) listener.onShadeExpansionFullyChanged(qsExpanded) } fun removeFullExpansionListener(listener: ShadeFullExpansionListener) { fullExpansionListeners.remove(listener) } fun addQsExpansionListener(listener: ShadeQsExpansionListener) { qsExpansionListeners.add(listener) listener.onQsExpansionChanged(qsExpanded) Loading Loading @@ -156,6 +166,13 @@ class ShadeExpansionStateManager @Inject constructor() : ShadeStateEvents { qsExpansionListeners.forEach { it.onQsExpansionChanged(qsExpanded) } } fun onShadeExpansionFullyChanged(isExpanded: Boolean) { this.expanded = isExpanded debugLog("expanded=$isExpanded") fullExpansionListeners.forEach { it.onShadeExpansionFullyChanged(isExpanded) } } /** Updates the panel state if necessary. */ fun updateState(@PanelState state: Int) { debugLog( Loading
packages/SystemUI/src/com/android/systemui/shade/ShadeFullExpansionListener.kt 0 → 100644 +23 −0 Original line number Diff line number Diff line /* * 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 /** A listener interface to be notified of expansion events for the notification shade. */ fun interface ShadeFullExpansionListener { /** Invoked whenever the shade expansion changes, when it is fully collapsed or expanded */ fun onShadeExpansionFullyChanged(isExpanded: Boolean) }