Skip to content

Commit 780c46f

Browse files
author
Jeff Brown
committed
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
1 parent 08a746a commit 780c46f

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

services/java/com/android/server/SystemServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public void run() {
229229
Slog.i(TAG, "Window Manager");
230230
wm = WindowManagerService.main(context, power,
231231
factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL,
232-
!firstBoot);
232+
!firstBoot, onlyCore);
233233
ServiceManager.addService(Context.WINDOW_SERVICE, wm);
234234
inputManager = wm.getInputManagerService();
235235
ServiceManager.addService(Context.INPUT_SERVICE, inputManager);

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -758,9 +758,15 @@ public interface WindowChangeListener {
758758
// The desired scaling factor for compatible apps.
759759
float mCompatibleScreenScale;
760760

761+
// If true, only the core apps and services are being launched because the device
762+
// is in a special boot mode, such as being encrypted or waiting for a decryption password.
763+
// For example, when this flag is true, there will be no wallpaper service.
764+
final boolean mOnlyCore;
765+
761766
public static WindowManagerService main(Context context,
762-
PowerManagerService pm, boolean haveInputMethods, boolean allowBootMsgs) {
763-
WMThread thr = new WMThread(context, pm, haveInputMethods, allowBootMsgs);
767+
PowerManagerService pm, boolean haveInputMethods, boolean allowBootMsgs,
768+
boolean onlyCore) {
769+
WMThread thr = new WMThread(context, pm, haveInputMethods, allowBootMsgs, onlyCore);
764770
thr.start();
765771

766772
synchronized (thr) {
@@ -781,21 +787,23 @@ static class WMThread extends Thread {
781787
private final PowerManagerService mPM;
782788
private final boolean mHaveInputMethods;
783789
private final boolean mAllowBootMessages;
790+
private final boolean mOnlyCore;
784791

785792
public WMThread(Context context, PowerManagerService pm,
786-
boolean haveInputMethods, boolean allowBootMsgs) {
793+
boolean haveInputMethods, boolean allowBootMsgs, boolean onlyCore) {
787794
super("WindowManager");
788795
mContext = context;
789796
mPM = pm;
790797
mHaveInputMethods = haveInputMethods;
791798
mAllowBootMessages = allowBootMsgs;
799+
mOnlyCore = onlyCore;
792800
}
793801

794802
@Override
795803
public void run() {
796804
Looper.prepare();
797805
WindowManagerService s = new WindowManagerService(mContext, mPM,
798-
mHaveInputMethods, mAllowBootMessages);
806+
mHaveInputMethods, mAllowBootMessages, mOnlyCore);
799807
android.os.Process.setThreadPriority(
800808
android.os.Process.THREAD_PRIORITY_DISPLAY);
801809
android.os.Process.setCanSelfBackground(false);
@@ -858,10 +866,11 @@ public void run() {
858866
}
859867

860868
private WindowManagerService(Context context, PowerManagerService pm,
861-
boolean haveInputMethods, boolean showBootMsgs) {
869+
boolean haveInputMethods, boolean showBootMsgs, boolean onlyCore) {
862870
mContext = context;
863871
mHaveInputMethods = haveInputMethods;
864872
mAllowBootMessages = showBootMsgs;
873+
mOnlyCore = onlyCore;
865874
mLimitedAlphaCompositing = context.getResources().getBoolean(
866875
com.android.internal.R.bool.config_sf_limitedAlpha);
867876
mHeadless = "1".equals(SystemProperties.get(SYSTEM_HEADLESS, "0"));
@@ -5191,7 +5200,8 @@ public void performEnableScreen() {
51915200
Slog.i(TAG, "performEnableScreen: mDisplayEnabled=" + mDisplayEnabled
51925201
+ " mForceDisplayEnabled=" + mForceDisplayEnabled
51935202
+ " mShowingBootMessages=" + mShowingBootMessages
5194-
+ " mSystemBooted=" + mSystemBooted, here);
5203+
+ " mSystemBooted=" + mSystemBooted
5204+
+ " mOnlyCore=" + mOnlyCore, here);
51955205
}
51965206
if (mDisplayEnabled) {
51975207
return;
@@ -5209,7 +5219,8 @@ public void performEnableScreen() {
52095219
// wallpaper, don't bother waiting for it
52105220
boolean haveWallpaper = false;
52115221
boolean wallpaperEnabled = mContext.getResources().getBoolean(
5212-
com.android.internal.R.bool.config_enableWallpaperService);
5222+
com.android.internal.R.bool.config_enableWallpaperService)
5223+
&& !mOnlyCore;
52135224
boolean haveKeyguard = true;
52145225
final int N = mWindows.size();
52155226
for (int i=0; i<N; i++) {

0 commit comments

Comments
 (0)