Merge "Group window relayout requests" into sc-v2-dev

This commit is contained in:
TreeHugger Robot
2022-03-10 04:03:07 +00:00
committed by Android (Google) Code Review
10 changed files with 145 additions and 67 deletions

View File

@@ -112,6 +112,7 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.phone.BiometricUnlockController; import com.android.systemui.statusbar.phone.BiometricUnlockController;
import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.DozeParameters;
@@ -324,6 +325,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
// the properties of the keyguard // the properties of the keyguard
private final KeyguardUpdateMonitor mUpdateMonitor; private final KeyguardUpdateMonitor mUpdateMonitor;
private final Lazy<NotificationShadeWindowController> mNotificationShadeWindowControllerLazy;
/** /**
* Last SIM state reported by the telephony system. * Last SIM state reported by the telephony system.
@@ -846,7 +848,8 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
KeyguardStateController keyguardStateController, KeyguardStateController keyguardStateController,
Lazy<KeyguardUnlockAnimationController> keyguardUnlockAnimationControllerLazy, Lazy<KeyguardUnlockAnimationController> keyguardUnlockAnimationControllerLazy,
UnlockedScreenOffAnimationController unlockedScreenOffAnimationController, UnlockedScreenOffAnimationController unlockedScreenOffAnimationController,
Lazy<NotificationShadeDepthController> notificationShadeDepthController) { Lazy<NotificationShadeDepthController> notificationShadeDepthController,
Lazy<NotificationShadeWindowController> notificationShadeWindowControllerLazy) {
super(context); super(context);
mFalsingCollector = falsingCollector; mFalsingCollector = falsingCollector;
mLockPatternUtils = lockPatternUtils; mLockPatternUtils = lockPatternUtils;
@@ -862,6 +865,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
mKeyguardDisplayManager = keyguardDisplayManager; mKeyguardDisplayManager = keyguardDisplayManager;
dumpManager.registerDumpable(getClass().getName(), this); dumpManager.registerDumpable(getClass().getName(), this);
mDeviceConfig = deviceConfig; mDeviceConfig = deviceConfig;
mNotificationShadeWindowControllerLazy = notificationShadeWindowControllerLazy;
mShowHomeOverLockscreen = mDeviceConfig.getBoolean( mShowHomeOverLockscreen = mDeviceConfig.getBoolean(
DeviceConfig.NAMESPACE_SYSTEMUI, DeviceConfig.NAMESPACE_SYSTEMUI,
NAV_BAR_HANDLE_SHOW_OVER_LOCKSCREEN, NAV_BAR_HANDLE_SHOW_OVER_LOCKSCREEN,
@@ -1889,10 +1893,13 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
Trace.beginSection( Trace.beginSection(
"KeyguardViewMediator#handleMessage START_KEYGUARD_EXIT_ANIM"); "KeyguardViewMediator#handleMessage START_KEYGUARD_EXIT_ANIM");
StartKeyguardExitAnimParams params = (StartKeyguardExitAnimParams) msg.obj; StartKeyguardExitAnimParams params = (StartKeyguardExitAnimParams) msg.obj;
handleStartKeyguardExitAnimation(params.startTime, params.fadeoutDuration, mNotificationShadeWindowControllerLazy.get().batchApplyWindowLayoutParams(
params.mApps, params.mWallpapers, params.mNonApps, () -> {
params.mFinishedCallback); handleStartKeyguardExitAnimation(params.startTime,
params.fadeoutDuration, params.mApps, params.mWallpapers,
params.mNonApps, params.mFinishedCallback);
mFalsingCollector.onSuccessfulUnlock(); mFalsingCollector.onSuccessfulUnlock();
});
Trace.endSection(); Trace.endSection();
break; break;
case CANCEL_KEYGUARD_EXIT_ANIM: case CANCEL_KEYGUARD_EXIT_ANIM:
@@ -2190,10 +2197,12 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
mKeyguardGoingAwayRunnable.run(); mKeyguardGoingAwayRunnable.run();
} else { } else {
// TODO(bc-unlock): Fill parameters // TODO(bc-unlock): Fill parameters
mNotificationShadeWindowControllerLazy.get().batchApplyWindowLayoutParams(() -> {
handleStartKeyguardExitAnimation( handleStartKeyguardExitAnimation(
SystemClock.uptimeMillis() + mHideAnimation.getStartOffset(), SystemClock.uptimeMillis() + mHideAnimation.getStartOffset(),
mHideAnimation.getDuration(), null /* apps */, null /* wallpapers */, mHideAnimation.getDuration(), null /* apps */, null /* wallpapers */,
null /* nonApps */, null /* finishedCallback */); null /* nonApps */, null /* finishedCallback */);
});
} }
} }
Trace.endSection(); Trace.endSection();

View File

@@ -42,6 +42,7 @@ import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.navigationbar.NavigationModeController; import com.android.systemui.navigationbar.NavigationModeController;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.statusbar.phone.KeyguardLiftController; import com.android.systemui.statusbar.phone.KeyguardLiftController;
@@ -97,7 +98,8 @@ public class KeyguardModule {
KeyguardStateController keyguardStateController, KeyguardStateController keyguardStateController,
Lazy<KeyguardUnlockAnimationController> keyguardUnlockAnimationController, Lazy<KeyguardUnlockAnimationController> keyguardUnlockAnimationController,
UnlockedScreenOffAnimationController unlockedScreenOffAnimationController, UnlockedScreenOffAnimationController unlockedScreenOffAnimationController,
Lazy<NotificationShadeDepthController> notificationShadeDepthController) { Lazy<NotificationShadeDepthController> notificationShadeDepthController,
Lazy<NotificationShadeWindowController> notificationShadeWindowController) {
return new KeyguardViewMediator( return new KeyguardViewMediator(
context, context,
falsingCollector, falsingCollector,
@@ -120,7 +122,8 @@ public class KeyguardModule {
keyguardStateController, keyguardStateController,
keyguardUnlockAnimationController, keyguardUnlockAnimationController,
unlockedScreenOffAnimationController, unlockedScreenOffAnimationController,
notificationShadeDepthController notificationShadeDepthController,
notificationShadeWindowController
); );
} }

View File

@@ -18,6 +18,7 @@ package com.android.systemui.statusbar;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.android.systemui.statusbar.phone.StatusBarWindowCallback; import com.android.systemui.statusbar.phone.StatusBarWindowCallback;
@@ -187,6 +188,14 @@ public interface NotificationShadeWindowController extends RemoteInputController
*/ */
default void setLightRevealScrimOpaque(boolean opaque) {} default void setLightRevealScrimOpaque(boolean opaque) {}
/**
* Defer any application of window {@link WindowManager.LayoutParams} until {@code scope} is
* fully applied.
*/
default void batchApplyWindowLayoutParams(@NonNull Runnable scope) {
scope.run();
}
/** /**
* Custom listener to pipe data back to plugins about whether or not the status bar would be * Custom listener to pipe data back to plugins about whether or not the status bar would be
* collapsed if not for the plugin. * collapsed if not for the plugin.

View File

@@ -145,6 +145,7 @@ import com.android.systemui.statusbar.LockscreenShadeTransitionController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.NotificationShelfController; import com.android.systemui.statusbar.NotificationShelfController;
import com.android.systemui.statusbar.PulseExpansionHandler; import com.android.systemui.statusbar.PulseExpansionHandler;
import com.android.systemui.statusbar.RemoteInputController; import com.android.systemui.statusbar.RemoteInputController;
@@ -664,7 +665,9 @@ public class NotificationPanelViewController extends PanelViewController {
NotificationLockscreenUserManager notificationLockscreenUserManager, NotificationLockscreenUserManager notificationLockscreenUserManager,
NotificationEntryManager notificationEntryManager, NotificationEntryManager notificationEntryManager,
KeyguardStateController keyguardStateController, KeyguardStateController keyguardStateController,
StatusBarStateController statusBarStateController, DozeLog dozeLog, StatusBarStateController statusBarStateController,
NotificationShadeWindowController notificationShadeWindowController,
DozeLog dozeLog,
DozeParameters dozeParameters, CommandQueue commandQueue, VibratorHelper vibratorHelper, DozeParameters dozeParameters, CommandQueue commandQueue, VibratorHelper vibratorHelper,
LatencyTracker latencyTracker, PowerManager powerManager, LatencyTracker latencyTracker, PowerManager powerManager,
AccessibilityManager accessibilityManager, @DisplayId int displayId, AccessibilityManager accessibilityManager, @DisplayId int displayId,
@@ -716,6 +719,7 @@ public class NotificationPanelViewController extends PanelViewController {
dozeLog, dozeLog,
keyguardStateController, keyguardStateController,
(SysuiStatusBarStateController) statusBarStateController, (SysuiStatusBarStateController) statusBarStateController,
notificationShadeWindowController,
vibratorHelper, vibratorHelper,
statusBarKeyguardViewManager, statusBarKeyguardViewManager,
latencyTracker, latencyTracker,

View File

@@ -107,6 +107,12 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
private final SysuiColorExtractor mColorExtractor; private final SysuiColorExtractor mColorExtractor;
private final UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController; private final UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
private float mFaceAuthDisplayBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE; private float mFaceAuthDisplayBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
/**
* Layout params would be aggregated and dispatched all at once if this is > 0.
*
* @see #batchApplyWindowLayoutParams(Runnable)
*/
private int mDeferWindowLayoutParams;
@Inject @Inject
public NotificationShadeWindowControllerImpl(Context context, WindowManager windowManager, public NotificationShadeWindowControllerImpl(Context context, WindowManager windowManager,
@@ -433,6 +439,20 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
} }
} }
private void applyWindowLayoutParams() {
if (mDeferWindowLayoutParams == 0 && mLp != null && mLp.copyFrom(mLpChanged) != 0) {
mWindowManager.updateViewLayout(mNotificationShadeView, mLp);
}
}
@Override
public void batchApplyWindowLayoutParams(Runnable scope) {
mDeferWindowLayoutParams++;
scope.run();
mDeferWindowLayoutParams--;
applyWindowLayoutParams();
}
private void apply(State state) { private void apply(State state) {
applyKeyguardFlags(state); applyKeyguardFlags(state);
applyFocusableFlag(state); applyFocusableFlag(state);
@@ -447,9 +467,8 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
applyHasTopUi(state); applyHasTopUi(state);
applyNotTouchable(state); applyNotTouchable(state);
applyStatusBarColorSpaceAgnosticFlag(state); applyStatusBarColorSpaceAgnosticFlag(state);
if (mLp != null && mLp.copyFrom(mLpChanged) != 0) { applyWindowLayoutParams();
mWindowManager.updateViewLayout(mNotificationShadeView, mLp);
}
if (mHasTopUi != mHasTopUiChanged) { if (mHasTopUi != mHasTopUiChanged) {
whitelistIpcs(() -> { whitelistIpcs(() -> {
try { try {
@@ -722,6 +741,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
pw.println(TAG + ":"); pw.println(TAG + ":");
pw.println(" mKeyguardMaxRefreshRate=" + mKeyguardMaxRefreshRate); pw.println(" mKeyguardMaxRefreshRate=" + mKeyguardMaxRefreshRate);
pw.println(" mKeyguardPreferredRefreshRate=" + mKeyguardPreferredRefreshRate); pw.println(" mKeyguardPreferredRefreshRate=" + mKeyguardPreferredRefreshRate);
pw.println(" mDeferWindowLayoutParams=" + mDeferWindowLayoutParams);
pw.println(mCurrentState); pw.println(mCurrentState);
if (mNotificationShadeView != null && mNotificationShadeView.getViewRootImpl() != null) { if (mNotificationShadeView != null && mNotificationShadeView.getViewRootImpl() != null) {
mNotificationShadeView.getViewRootImpl().dump(" ", pw); mNotificationShadeView.getViewRootImpl().dump(" ", pw);

View File

@@ -54,6 +54,7 @@ import com.android.systemui.animation.Interpolators;
import com.android.systemui.classifier.Classifier; import com.android.systemui.classifier.Classifier;
import com.android.systemui.doze.DozeLog; import com.android.systemui.doze.DozeLog;
import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.FalsingManager;
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.VibratorHelper; import com.android.systemui.statusbar.VibratorHelper;
@@ -177,6 +178,7 @@ public abstract class PanelViewController {
private boolean mExpandLatencyTracking; private boolean mExpandLatencyTracking;
private final PanelView mView; private final PanelView mView;
private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
private final NotificationShadeWindowController mNotificationShadeWindowController;
protected final Resources mResources; protected final Resources mResources;
protected final KeyguardStateController mKeyguardStateController; protected final KeyguardStateController mKeyguardStateController;
protected final SysuiStatusBarStateController mStatusBarStateController; protected final SysuiStatusBarStateController mStatusBarStateController;
@@ -215,6 +217,7 @@ public abstract class PanelViewController {
DozeLog dozeLog, DozeLog dozeLog,
KeyguardStateController keyguardStateController, KeyguardStateController keyguardStateController,
SysuiStatusBarStateController statusBarStateController, SysuiStatusBarStateController statusBarStateController,
NotificationShadeWindowController notificationShadeWindowController,
VibratorHelper vibratorHelper, VibratorHelper vibratorHelper,
StatusBarKeyguardViewManager statusBarKeyguardViewManager, StatusBarKeyguardViewManager statusBarKeyguardViewManager,
LatencyTracker latencyTracker, LatencyTracker latencyTracker,
@@ -247,6 +250,7 @@ public abstract class PanelViewController {
mResources = mView.getResources(); mResources = mView.getResources();
mKeyguardStateController = keyguardStateController; mKeyguardStateController = keyguardStateController;
mStatusBarStateController = statusBarStateController; mStatusBarStateController = statusBarStateController;
mNotificationShadeWindowController = notificationShadeWindowController;
mFlingAnimationUtils = flingAnimationUtilsBuilder mFlingAnimationUtils = flingAnimationUtilsBuilder
.reset() .reset()
.setMaxLengthSeconds(0.6f) .setMaxLengthSeconds(0.6f)
@@ -743,6 +747,7 @@ public abstract class PanelViewController {
if (isNaN(h)) { if (isNaN(h)) {
Log.wtf(TAG, "ExpandedHeight set to NaN"); Log.wtf(TAG, "ExpandedHeight set to NaN");
} }
mNotificationShadeWindowController.batchApplyWindowLayoutParams(()-> {
if (mExpandLatencyTracking && h != 0f) { if (mExpandLatencyTracking && h != 0f) {
DejankUtils.postAfterTraversal( DejankUtils.postAfterTraversal(
() -> mLatencyTracker.onActionEnd(LatencyTracker.ACTION_EXPAND_PANEL)); () -> mLatencyTracker.onActionEnd(LatencyTracker.ACTION_EXPAND_PANEL));
@@ -771,6 +776,7 @@ public abstract class PanelViewController {
maxPanelHeight == 0 ? 0 : mExpandedHeight / maxPanelHeight); maxPanelHeight == 0 ? 0 : mExpandedHeight / maxPanelHeight);
onHeightUpdated(mExpandedHeight); onHeightUpdated(mExpandedHeight);
updatePanelExpansionAndVisibility(); updatePanelExpansionAndVisibility();
});
} }
/** /**

View File

@@ -3559,6 +3559,7 @@ public class StatusBar extends SystemUI implements
public void onStartedWakingUp() { public void onStartedWakingUp() {
String tag = "StatusBar#onStartedWakingUp"; String tag = "StatusBar#onStartedWakingUp";
DejankUtils.startDetectingBlockingIpcs(tag); DejankUtils.startDetectingBlockingIpcs(tag);
mNotificationShadeWindowController.batchApplyWindowLayoutParams(()-> {
mDeviceInteractive = true; mDeviceInteractive = true;
mWakeUpCoordinator.setWakingUp(true); mWakeUpCoordinator.setWakingUp(true);
if (!mKeyguardBypassController.getBypassEnabled()) { if (!mKeyguardBypassController.getBypassEnabled()) {
@@ -3575,10 +3576,12 @@ public class StatusBar extends SystemUI implements
// If we are waking up during the screen off animation, we should undo making the // If we are waking up during the screen off animation, we should undo making the
// expanded visible (we did that so the LightRevealScrim would be visible). // expanded visible (we did that so the LightRevealScrim would be visible).
if (mUnlockedScreenOffAnimationController.isScreenOffLightRevealAnimationPlaying()) { if (mUnlockedScreenOffAnimationController
.isScreenOffLightRevealAnimationPlaying()) {
makeExpandedInvisible(); makeExpandedInvisible();
} }
});
DejankUtils.stopDetectingBlockingIpcs(tag); DejankUtils.stopDetectingBlockingIpcs(tag);
} }

View File

@@ -51,6 +51,7 @@ import com.android.systemui.classifier.FalsingCollectorFake;
import com.android.systemui.dump.DumpManager; import com.android.systemui.dump.DumpManager;
import com.android.systemui.navigationbar.NavigationModeController; import com.android.systemui.navigationbar.NavigationModeController;
import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
@@ -64,9 +65,6 @@ import com.android.systemui.util.DeviceConfigProxyFake;
import com.android.systemui.util.concurrency.FakeExecutor; import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.time.FakeSystemClock; import com.android.systemui.util.time.FakeSystemClock;
import java.util.Optional;
import java.util.function.Function;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -75,6 +73,11 @@ import org.mockito.ArgumentMatchers;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import java.util.Optional;
import java.util.function.Function;
import dagger.Lazy;
@RunWith(AndroidTestingRunner.class) @RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper @TestableLooper.RunWithLooper
@SmallTest @SmallTest
@@ -103,6 +106,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
private @Mock KeyguardUnlockAnimationController mKeyguardUnlockAnimationController; private @Mock KeyguardUnlockAnimationController mKeyguardUnlockAnimationController;
private @Mock UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController; private @Mock UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
private @Mock IKeyguardDrawnCallback mKeyguardDrawnCallback; private @Mock IKeyguardDrawnCallback mKeyguardDrawnCallback;
private @Mock Lazy<NotificationShadeWindowController> mNotificationShadeWindowControllerLazy;
private DeviceConfigProxy mDeviceConfig = new DeviceConfigProxyFake(); private DeviceConfigProxy mDeviceConfig = new DeviceConfigProxyFake();
private FakeExecutor mUiBgExecutor = new FakeExecutor(new FakeSystemClock()); private FakeExecutor mUiBgExecutor = new FakeExecutor(new FakeSystemClock());
@@ -144,7 +148,8 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
mKeyguardStateController, mKeyguardStateController,
() -> mKeyguardUnlockAnimationController, () -> mKeyguardUnlockAnimationController,
mUnlockedScreenOffAnimationController, mUnlockedScreenOffAnimationController,
() -> mNotificationShadeDepthController); () -> mNotificationShadeDepthController,
mNotificationShadeWindowControllerLazy);
mViewMediator.start(); mViewMediator.start();
} }

View File

@@ -23,7 +23,6 @@ import static com.android.keyguard.KeyguardClockSwitch.SMALL;
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
import static com.android.systemui.statusbar.StatusBarState.SHADE; import static com.android.systemui.statusbar.StatusBarState.SHADE;
import static com.android.systemui.statusbar.StatusBarState.SHADE_LOCKED; import static com.android.systemui.statusbar.StatusBarState.SHADE_LOCKED;
import static com.android.systemui.statusbar.notification.ViewGroupFadeHelper.reset;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
@@ -107,6 +106,7 @@ import com.android.systemui.statusbar.LockscreenShadeTransitionController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.NotificationShelfController; import com.android.systemui.statusbar.NotificationShelfController;
import com.android.systemui.statusbar.PulseExpansionHandler; import com.android.systemui.statusbar.PulseExpansionHandler;
import com.android.systemui.statusbar.StatusBarStateControllerImpl; import com.android.systemui.statusbar.StatusBarStateControllerImpl;
@@ -305,6 +305,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
@Mock @Mock
private NotificationsQSContainerController mNotificationsQSContainerController; private NotificationsQSContainerController mNotificationsQSContainerController;
@Mock @Mock
private NotificationShadeWindowController mNotificationShadeWindowController;
@Mock
private FeatureFlags mFeatureFlags; private FeatureFlags mFeatureFlags;
private Optional<SysUIUnfoldComponent> mSysUIUnfoldComponent = Optional.empty(); private Optional<SysUIUnfoldComponent> mSysUIUnfoldComponent = Optional.empty();
private SysuiStatusBarStateController mStatusBarStateController; private SysuiStatusBarStateController mStatusBarStateController;
@@ -402,8 +404,10 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
when(mLayoutInflater.inflate(eq(R.layout.keyguard_bottom_area), any(), anyBoolean())) when(mLayoutInflater.inflate(eq(R.layout.keyguard_bottom_area), any(), anyBoolean()))
.thenReturn(mKeyguardBottomArea); .thenReturn(mKeyguardBottomArea);
when(mNotificationRemoteInputManager.isRemoteInputActive()).thenReturn(false); when(mNotificationRemoteInputManager.isRemoteInputActive()).thenReturn(false);
doAnswer(invocation -> {
reset(mView); ((Runnable) invocation.getArgument(0)).run();
return null;
}).when(mNotificationShadeWindowController).batchApplyWindowLayoutParams(any());
mNotificationPanelViewController = new NotificationPanelViewController(mView, mNotificationPanelViewController = new NotificationPanelViewController(mView,
mResources, mResources,
@@ -412,8 +416,9 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
coordinator, expansionHandler, mDynamicPrivacyController, mKeyguardBypassController, coordinator, expansionHandler, mDynamicPrivacyController, mKeyguardBypassController,
mFalsingManager, new FalsingCollectorFake(), mFalsingManager, new FalsingCollectorFake(),
mNotificationLockscreenUserManager, mNotificationEntryManager, mNotificationLockscreenUserManager, mNotificationEntryManager,
mKeyguardStateController, mStatusBarStateController, mDozeLog, mKeyguardStateController, mStatusBarStateController,
mDozeParameters, mCommandQueue, mVibratorHelper, mNotificationShadeWindowController,
mDozeLog, mDozeParameters, mCommandQueue, mVibratorHelper,
mLatencyTracker, mPowerManager, mAccessibilityManager, 0, mUpdateMonitor, mLatencyTracker, mPowerManager, mAccessibilityManager, 0, mUpdateMonitor,
mMetricsLogger, mActivityManager, mConfigurationController, mMetricsLogger, mActivityManager, mConfigurationController,
() -> flingAnimationUtilsBuilder, mStatusBarTouchableRegionManager, () -> flingAnimationUtilsBuilder, mStatusBarTouchableRegionManager,

View File

@@ -26,6 +26,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset; import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@@ -225,4 +226,17 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
assertThat((mLayoutParameters.getValue().flags & FLAG_NOT_FOCUSABLE) != 0).isTrue(); assertThat((mLayoutParameters.getValue().flags & FLAG_NOT_FOCUSABLE) != 0).isTrue();
assertThat((mLayoutParameters.getValue().flags & FLAG_ALT_FOCUSABLE_IM) == 0).isTrue(); assertThat((mLayoutParameters.getValue().flags & FLAG_ALT_FOCUSABLE_IM) == 0).isTrue();
} }
@Test
public void batchApplyWindowLayoutParams_doesNotDispatchEvents() {
mNotificationShadeWindowController.setForceDozeBrightness(true);
verify(mWindowManager).updateViewLayout(any(), any());
clearInvocations(mWindowManager);
mNotificationShadeWindowController.batchApplyWindowLayoutParams(()-> {
mNotificationShadeWindowController.setForceDozeBrightness(false);
verify(mWindowManager, never()).updateViewLayout(any(), any());
});
verify(mWindowManager).updateViewLayout(any(), any());
}
} }