From 780c46fc9197f7ecb258e2c229824749f9e93806 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Sun, 24 Jun 2012 12:15:38 -0700 Subject: [PATCH] Don't wait until boot timeout if there is no wallpaper. When launching only core apps, the wallpaper service is not started. Without this change the WM waits up to 30 seconds for the wallpaper window to be created even though it will never happen. This introduces a significant delay before the boot animation is dismissed so the user can enter a decryption password. Bug: 6263070 Change-Id: Ia975127a0bf09cf99818f7cc4fd6c0264b740ec6 --- .../java/com/android/server/SystemServer.java | 2 +- .../server/wm/WindowManagerService.java | 25 +++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index eaecd4c8edb09..9dd4a91f119a9 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -229,7 +229,7 @@ class ServerThread extends Thread { Slog.i(TAG, "Window Manager"); wm = WindowManagerService.main(context, power, factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL, - !firstBoot); + !firstBoot, onlyCore); ServiceManager.addService(Context.WINDOW_SERVICE, wm); inputManager = wm.getInputManagerService(); ServiceManager.addService(Context.INPUT_SERVICE, inputManager); diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index f84451eb299ea..6906ed9f56f0b 100755 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -758,9 +758,15 @@ public class WindowManagerService extends IWindowManager.Stub // The desired scaling factor for compatible apps. float mCompatibleScreenScale; + // If true, only the core apps and services are being launched because the device + // is in a special boot mode, such as being encrypted or waiting for a decryption password. + // For example, when this flag is true, there will be no wallpaper service. + final boolean mOnlyCore; + public static WindowManagerService main(Context context, - PowerManagerService pm, boolean haveInputMethods, boolean allowBootMsgs) { - WMThread thr = new WMThread(context, pm, haveInputMethods, allowBootMsgs); + PowerManagerService pm, boolean haveInputMethods, boolean allowBootMsgs, + boolean onlyCore) { + WMThread thr = new WMThread(context, pm, haveInputMethods, allowBootMsgs, onlyCore); thr.start(); synchronized (thr) { @@ -781,21 +787,23 @@ public class WindowManagerService extends IWindowManager.Stub private final PowerManagerService mPM; private final boolean mHaveInputMethods; private final boolean mAllowBootMessages; + private final boolean mOnlyCore; public WMThread(Context context, PowerManagerService pm, - boolean haveInputMethods, boolean allowBootMsgs) { + boolean haveInputMethods, boolean allowBootMsgs, boolean onlyCore) { super("WindowManager"); mContext = context; mPM = pm; mHaveInputMethods = haveInputMethods; mAllowBootMessages = allowBootMsgs; + mOnlyCore = onlyCore; } @Override public void run() { Looper.prepare(); WindowManagerService s = new WindowManagerService(mContext, mPM, - mHaveInputMethods, mAllowBootMessages); + mHaveInputMethods, mAllowBootMessages, mOnlyCore); android.os.Process.setThreadPriority( android.os.Process.THREAD_PRIORITY_DISPLAY); android.os.Process.setCanSelfBackground(false); @@ -858,10 +866,11 @@ public class WindowManagerService extends IWindowManager.Stub } private WindowManagerService(Context context, PowerManagerService pm, - boolean haveInputMethods, boolean showBootMsgs) { + boolean haveInputMethods, boolean showBootMsgs, boolean onlyCore) { mContext = context; mHaveInputMethods = haveInputMethods; mAllowBootMessages = showBootMsgs; + mOnlyCore = onlyCore; mLimitedAlphaCompositing = context.getResources().getBoolean( com.android.internal.R.bool.config_sf_limitedAlpha); mHeadless = "1".equals(SystemProperties.get(SYSTEM_HEADLESS, "0")); @@ -5191,7 +5200,8 @@ public class WindowManagerService extends IWindowManager.Stub Slog.i(TAG, "performEnableScreen: mDisplayEnabled=" + mDisplayEnabled + " mForceDisplayEnabled=" + mForceDisplayEnabled + " mShowingBootMessages=" + mShowingBootMessages - + " mSystemBooted=" + mSystemBooted, here); + + " mSystemBooted=" + mSystemBooted + + " mOnlyCore=" + mOnlyCore, here); } if (mDisplayEnabled) { return; @@ -5209,7 +5219,8 @@ public class WindowManagerService extends IWindowManager.Stub // wallpaper, don't bother waiting for it boolean haveWallpaper = false; boolean wallpaperEnabled = mContext.getResources().getBoolean( - com.android.internal.R.bool.config_enableWallpaperService); + com.android.internal.R.bool.config_enableWallpaperService) + && !mOnlyCore; boolean haveKeyguard = true; final int N = mWindows.size(); for (int i=0; i