Merge "Fix boot timeout and reduce boot time" into rvc-dev am: 2d695313c9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12085171

Change-Id: I4c24f27c4c182ecc0add98ff64bce4a84df130de
This commit is contained in:
Riddle Hsu
2020-07-07 07:58:43 +00:00
committed by Automerger Merge Worker
7 changed files with 52 additions and 32 deletions

View File

@@ -23,6 +23,7 @@ import android.view.WindowManager;
import com.android.systemui.car.window.SystemUIOverlayWindowController; import com.android.systemui.car.window.SystemUIOverlayWindowController;
import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.dump.DumpManager; import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
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;
@@ -49,12 +50,14 @@ public class DummyNotificationShadeWindowController extends NotificationShadeWin
DozeParameters dozeParameters, DozeParameters dozeParameters,
StatusBarStateController statusBarStateController, StatusBarStateController statusBarStateController,
ConfigurationController configurationController, ConfigurationController configurationController,
KeyguardViewMediator keyguardViewMediator,
KeyguardBypassController keyguardBypassController, KeyguardBypassController keyguardBypassController,
SysuiColorExtractor colorExtractor, SysuiColorExtractor colorExtractor,
DumpManager dumpManager, DumpManager dumpManager,
SystemUIOverlayWindowController overlayWindowController) { SystemUIOverlayWindowController overlayWindowController) {
super(context, windowManager, activityManager, dozeParameters, statusBarStateController, super(context, windowManager, activityManager, dozeParameters, statusBarStateController,
configurationController, keyguardBypassController, colorExtractor, dumpManager); configurationController, keyguardViewMediator, keyguardBypassController,
colorExtractor, dumpManager);
mOverlayWindowController = overlayWindowController; mOverlayWindowController = overlayWindowController;
} }

View File

@@ -84,6 +84,7 @@ public class NotificationShadeWindowController implements Callback, Dumpable,
private final boolean mKeyguardScreenRotation; private final boolean mKeyguardScreenRotation;
private final long mLockScreenDisplayTimeout; private final long mLockScreenDisplayTimeout;
private final Display.Mode mKeyguardDisplayMode; private final Display.Mode mKeyguardDisplayMode;
private final KeyguardViewMediator mKeyguardViewMediator;
private final KeyguardBypassController mKeyguardBypassController; private final KeyguardBypassController mKeyguardBypassController;
private ViewGroup mNotificationShadeView; private ViewGroup mNotificationShadeView;
private LayoutParams mLp; private LayoutParams mLp;
@@ -104,6 +105,7 @@ public class NotificationShadeWindowController implements Callback, Dumpable,
IActivityManager activityManager, DozeParameters dozeParameters, IActivityManager activityManager, DozeParameters dozeParameters,
StatusBarStateController statusBarStateController, StatusBarStateController statusBarStateController,
ConfigurationController configurationController, ConfigurationController configurationController,
KeyguardViewMediator keyguardViewMediator,
KeyguardBypassController keyguardBypassController, SysuiColorExtractor colorExtractor, KeyguardBypassController keyguardBypassController, SysuiColorExtractor colorExtractor,
DumpManager dumpManager) { DumpManager dumpManager) {
mContext = context; mContext = context;
@@ -113,6 +115,7 @@ public class NotificationShadeWindowController implements Callback, Dumpable,
mDozeParameters = dozeParameters; mDozeParameters = dozeParameters;
mScreenBrightnessDoze = mDozeParameters.getScreenBrightnessDoze(); mScreenBrightnessDoze = mDozeParameters.getScreenBrightnessDoze();
mLpChanged = new LayoutParams(); mLpChanged = new LayoutParams();
mKeyguardViewMediator = keyguardViewMediator;
mKeyguardBypassController = keyguardBypassController; mKeyguardBypassController = keyguardBypassController;
mColorExtractor = colorExtractor; mColorExtractor = colorExtractor;
dumpManager.registerDumpable(getClass().getName(), this); dumpManager.registerDumpable(getClass().getName(), this);
@@ -202,6 +205,11 @@ public class NotificationShadeWindowController implements Callback, Dumpable,
mWindowManager.addView(mNotificationShadeView, mLp); mWindowManager.addView(mNotificationShadeView, mLp);
mLpChanged.copyFrom(mLp); mLpChanged.copyFrom(mLp);
onThemeChanged(); onThemeChanged();
// Make the state consistent with KeyguardViewMediator#setupLocked during initialization.
if (mKeyguardViewMediator.isShowingAndNotOccluded()) {
setKeyguardShowing(true);
}
} }
public void setNotificationShadeView(ViewGroup view) { public void setNotificationShadeView(ViewGroup view) {

View File

@@ -63,6 +63,7 @@ import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase;
import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.dump.DumpManager; import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.model.SysUiState; import com.android.systemui.model.SysUiState;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.QuickStepContract;
@@ -135,6 +136,8 @@ public class BubbleControllerTest extends SysuiTestCase {
@Mock @Mock
private SysuiStatusBarStateController mStatusBarStateController; private SysuiStatusBarStateController mStatusBarStateController;
@Mock @Mock
private KeyguardViewMediator mKeyguardViewMediator;
@Mock
private KeyguardBypassController mKeyguardBypassController; private KeyguardBypassController mKeyguardBypassController;
@Mock @Mock
private FloatingContentCoordinator mFloatingContentCoordinator; private FloatingContentCoordinator mFloatingContentCoordinator;
@@ -198,8 +201,8 @@ public class BubbleControllerTest extends SysuiTestCase {
mNotificationShadeWindowController = new NotificationShadeWindowController(mContext, mNotificationShadeWindowController = new NotificationShadeWindowController(mContext,
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController, mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
mConfigurationController, mKeyguardBypassController, mColorExtractor, mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
mDumpManager); mColorExtractor, mDumpManager);
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView); mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
mNotificationShadeWindowController.attach(); mNotificationShadeWindowController.attach();

View File

@@ -60,6 +60,7 @@ import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase;
import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.dump.DumpManager; import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.model.SysUiState; import com.android.systemui.model.SysUiState;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.FeatureFlags; import com.android.systemui.statusbar.FeatureFlags;
@@ -132,6 +133,8 @@ public class NewNotifPipelineBubbleControllerTest extends SysuiTestCase {
@Mock @Mock
private SysuiStatusBarStateController mStatusBarStateController; private SysuiStatusBarStateController mStatusBarStateController;
@Mock @Mock
private KeyguardViewMediator mKeyguardViewMediator;
@Mock
private KeyguardBypassController mKeyguardBypassController; private KeyguardBypassController mKeyguardBypassController;
@Mock @Mock
private FloatingContentCoordinator mFloatingContentCoordinator; private FloatingContentCoordinator mFloatingContentCoordinator;
@@ -194,8 +197,8 @@ public class NewNotifPipelineBubbleControllerTest extends SysuiTestCase {
// Bubbles get added to status bar window view // Bubbles get added to status bar window view
mNotificationShadeWindowController = new NotificationShadeWindowController(mContext, mNotificationShadeWindowController = new NotificationShadeWindowController(mContext,
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController, mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
mConfigurationController, mKeyguardBypassController, mColorExtractor, mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
mDumpManager); mColorExtractor, mDumpManager);
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView); mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
mNotificationShadeWindowController.attach(); mNotificationShadeWindowController.attach();

View File

@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone;
import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
@@ -41,6 +42,7 @@ import com.android.internal.colorextraction.ColorExtractor;
import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase;
import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.dump.DumpManager; import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController;
@@ -63,6 +65,7 @@ public class NotificationShadeWindowControllerTest extends SysuiTestCase {
@Mock private IActivityManager mActivityManager; @Mock private IActivityManager mActivityManager;
@Mock private SysuiStatusBarStateController mStatusBarStateController; @Mock private SysuiStatusBarStateController mStatusBarStateController;
@Mock private ConfigurationController mConfigurationController; @Mock private ConfigurationController mConfigurationController;
@Mock private KeyguardViewMediator mKeyguardViewMediator;
@Mock private KeyguardBypassController mKeyguardBypassController; @Mock private KeyguardBypassController mKeyguardBypassController;
@Mock private SysuiColorExtractor mColorExtractor; @Mock private SysuiColorExtractor mColorExtractor;
@Mock ColorExtractor.GradientColors mGradientColors; @Mock ColorExtractor.GradientColors mGradientColors;
@@ -79,8 +82,8 @@ public class NotificationShadeWindowControllerTest extends SysuiTestCase {
mNotificationShadeWindowController = new NotificationShadeWindowController(mContext, mNotificationShadeWindowController = new NotificationShadeWindowController(mContext,
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController, mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
mConfigurationController, mKeyguardBypassController, mColorExtractor, mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
mDumpManager); mColorExtractor, mDumpManager);
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView); mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
mNotificationShadeWindowController.attach(); mNotificationShadeWindowController.attach();
@@ -119,6 +122,17 @@ public class NotificationShadeWindowControllerTest extends SysuiTestCase {
mNotificationShadeWindowController.setForcePluginOpen(true); mNotificationShadeWindowController.setForcePluginOpen(true);
} }
@Test
public void attach_visibleWithWallpaper() {
clearInvocations(mWindowManager);
when(mKeyguardViewMediator.isShowingAndNotOccluded()).thenReturn(true);
mNotificationShadeWindowController.attach();
verify(mNotificationShadeWindowView).setVisibility(eq(View.VISIBLE));
verify(mWindowManager).updateViewLayout(any(), mLayoutParameters.capture());
assertThat((mLayoutParameters.getValue().flags & FLAG_SHOW_WALLPAPER) != 0).isTrue();
}
@Test @Test
public void setBackgroundBlurRadius_expandedWithBlurs() { public void setBackgroundBlurRadius_expandedWithBlurs() {
mNotificationShadeWindowController.setBackgroundBlurRadius(10); mNotificationShadeWindowController.setBackgroundBlurRadius(10);

View File

@@ -3719,12 +3719,12 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
drawnWindowTypes.put(TYPE_NOTIFICATION_SHADE, true); drawnWindowTypes.put(TYPE_NOTIFICATION_SHADE, true);
final WindowState visibleNotDrawnWindow = getWindow(w -> { final WindowState visibleNotDrawnWindow = getWindow(w -> {
boolean isVisible = w.mViewVisibility == View.VISIBLE && !w.mObscured; final boolean isVisible = w.isVisible() && !w.mObscured;
boolean hasDrawn = w.isDrawnLw() && w.hasDrawnLw(); final boolean isDrawn = w.isDrawnLw();
if (isVisible && !hasDrawn) { if (isVisible && !isDrawn) {
return true; return true;
} }
if (hasDrawn) { if (isDrawn) {
switch (w.mAttrs.type) { switch (w.mAttrs.type) {
case TYPE_BOOT_PROGRESS: case TYPE_BOOT_PROGRESS:
case TYPE_BASE_APPLICATION: case TYPE_BASE_APPLICATION:

View File

@@ -482,12 +482,17 @@ public class DisplayContentTests extends WindowTestsBase {
final DisplayContent defaultDisplay = mWm.getDefaultDisplayContentLocked(); final DisplayContent defaultDisplay = mWm.getDefaultDisplayContentLocked();
final WindowState[] windows = createNotDrawnWindowsOn(defaultDisplay, final WindowState[] windows = createNotDrawnWindowsOn(defaultDisplay,
TYPE_WALLPAPER, TYPE_APPLICATION); TYPE_WALLPAPER, TYPE_APPLICATION);
final WindowState wallpaper = windows[0];
assertTrue(wallpaper.mIsWallpaper);
// By default WindowState#mWallpaperVisible is false.
assertFalse(wallpaper.isVisible());
// Verify waiting for windows to be drawn. // Verify waiting for windows to be drawn.
assertTrue(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot()); assertTrue(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot());
// Verify not waiting for drawn windows. // Verify not waiting for drawn window and invisible wallpaper.
makeWindowsDrawnState(windows, WindowStateAnimator.HAS_DRAWN); setDrawnState(WindowStateAnimator.READY_TO_SHOW, wallpaper);
setDrawnState(WindowStateAnimator.HAS_DRAWN, windows[1]);
assertFalse(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot()); assertFalse(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot());
} }
@@ -508,26 +513,10 @@ public class DisplayContentTests extends WindowTestsBase {
assertTrue(secondaryDisplay.shouldWaitForSystemDecorWindowsOnBoot()); assertTrue(secondaryDisplay.shouldWaitForSystemDecorWindowsOnBoot());
// Verify not waiting for drawn windows on display with system decorations. // Verify not waiting for drawn windows on display with system decorations.
makeWindowsDrawnState(windows, WindowStateAnimator.HAS_DRAWN); setDrawnState(WindowStateAnimator.HAS_DRAWN, windows);
assertFalse(secondaryDisplay.shouldWaitForSystemDecorWindowsOnBoot()); assertFalse(secondaryDisplay.shouldWaitForSystemDecorWindowsOnBoot());
} }
@Test
public void testShouldWaitForSystemDecorWindowsOnBoot_OnWindowReadyToShowAndDrawn() {
mWm.mSystemBooted = true;
final DisplayContent defaultDisplay = mWm.getDefaultDisplayContentLocked();
final WindowState[] windows = createNotDrawnWindowsOn(defaultDisplay,
TYPE_WALLPAPER, TYPE_APPLICATION);
// Verify waiting for windows to be drawn.
makeWindowsDrawnState(windows, WindowStateAnimator.READY_TO_SHOW);
assertTrue(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot());
// Verify not waiting for drawn windows.
makeWindowsDrawnState(windows, WindowStateAnimator.HAS_DRAWN);
assertFalse(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot());
}
private WindowState[] createNotDrawnWindowsOn(DisplayContent displayContent, int... types) { private WindowState[] createNotDrawnWindowsOn(DisplayContent displayContent, int... types) {
final WindowState[] windows = new WindowState[types.length]; final WindowState[] windows = new WindowState[types.length];
for (int i = 0; i < types.length; i++) { for (int i = 0; i < types.length; i++) {
@@ -538,9 +527,9 @@ public class DisplayContentTests extends WindowTestsBase {
return windows; return windows;
} }
private static void makeWindowsDrawnState(WindowState[] windows, int state) { private static void setDrawnState(int state, WindowState... windows) {
for (WindowState window : windows) { for (WindowState window : windows) {
window.mHasSurface = true; window.mHasSurface = state != WindowStateAnimator.NO_SURFACE;
window.mWinAnimator.mDrawState = state; window.mWinAnimator.mDrawState = state;
} }
} }