Skip to content

Commit 38cc896

Browse files
author
Dianne Hackborn
committed
Fix issue #5446988: WindowManager warns BOOT TIMEOUT,...
...dev.bootcomplete flags is set before boot animation is out Also: - Fix crash in recent apps if the intent for an old app didn't happen to have the new task flag set. - Fix issue where a crash in system UI would cause the crash dialog to be displayed below it, effectively locking the UI. Now the crash dialog for persistent processes is shown above everything else. Change-Id: I0312001a92beeae5f644c7c3e5c5e19f6716df36
1 parent f4b40de commit 38cc896

File tree

5 files changed

+78
-19
lines changed

5 files changed

+78
-19
lines changed

packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,8 @@ public void handleOnClick(View view) {
483483
} else {
484484
Intent intent = ad.intent;
485485
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
486-
| Intent.FLAG_ACTIVITY_TASK_ON_HOME);
486+
| Intent.FLAG_ACTIVITY_TASK_ON_HOME
487+
| Intent.FLAG_ACTIVITY_NEW_TASK);
487488
if (DEBUG) Log.v(TAG, "Starting activity " + intent);
488489
context.startActivity(intent);
489490
}

policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
import android.view.WindowManagerImpl;
129129
import android.view.WindowManagerPolicy;
130130
import android.view.KeyCharacterMap.FallbackAction;
131-
import android.view.WindowManagerPolicy.WindowManagerFuncs;
132131
import android.view.accessibility.AccessibilityEvent;
133132
import android.view.animation.Animation;
134133
import android.view.animation.AnimationUtils;
@@ -180,26 +179,26 @@ public class PhoneWindowManager implements WindowManagerPolicy {
180179
static final int PRIORITY_PHONE_LAYER = 7;
181180
// like the ANR / app crashed dialogs
182181
static final int SYSTEM_ALERT_LAYER = 8;
183-
// system-level error dialogs
184-
static final int SYSTEM_ERROR_LAYER = 9;
185182
// on-screen keyboards and other such input method user interfaces go here.
186-
static final int INPUT_METHOD_LAYER = 10;
183+
static final int INPUT_METHOD_LAYER = 9;
187184
// on-screen keyboards and other such input method user interfaces go here.
188-
static final int INPUT_METHOD_DIALOG_LAYER = 11;
185+
static final int INPUT_METHOD_DIALOG_LAYER = 10;
189186
// the keyguard; nothing on top of these can take focus, since they are
190187
// responsible for power management when displayed.
191-
static final int KEYGUARD_LAYER = 12;
192-
static final int KEYGUARD_DIALOG_LAYER = 13;
193-
static final int STATUS_BAR_SUB_PANEL_LAYER = 14;
194-
static final int STATUS_BAR_LAYER = 15;
195-
static final int STATUS_BAR_PANEL_LAYER = 16;
188+
static final int KEYGUARD_LAYER = 11;
189+
static final int KEYGUARD_DIALOG_LAYER = 12;
190+
static final int STATUS_BAR_SUB_PANEL_LAYER = 13;
191+
static final int STATUS_BAR_LAYER = 14;
192+
static final int STATUS_BAR_PANEL_LAYER = 15;
196193
// the on-screen volume indicator and controller shown when the user
197194
// changes the device volume
198-
static final int VOLUME_OVERLAY_LAYER = 17;
195+
static final int VOLUME_OVERLAY_LAYER = 16;
199196
// things in here CAN NOT take focus, but are shown on top of everything else.
200-
static final int SYSTEM_OVERLAY_LAYER = 18;
197+
static final int SYSTEM_OVERLAY_LAYER = 17;
201198
// the navigation bar, if available, shows atop most things
202-
static final int NAVIGATION_BAR_LAYER = 19;
199+
static final int NAVIGATION_BAR_LAYER = 18;
200+
// system-level error dialogs
201+
static final int SYSTEM_ERROR_LAYER = 19;
203202
// the drag layer: input for drag-and-drop is associated with this window,
204203
// which sits above all other focusable windows
205204
static final int DRAG_LAYER = 20;

services/java/com/android/server/am/ActivityManagerService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3427,8 +3427,10 @@ private final boolean forceStopPackageLocked(String name, int uid,
34273427
ac.removePackage(name);
34283428
}
34293429
}
3430-
mMainStack.resumeTopActivityLocked(null);
3431-
mMainStack.scheduleIdleLocked();
3430+
if (mBooted) {
3431+
mMainStack.resumeTopActivityLocked(null);
3432+
mMainStack.scheduleIdleLocked();
3433+
}
34323434
}
34333435

34343436
return didSomething;

services/java/com/android/server/am/AppErrorDialog.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import android.os.Handler;
2525
import android.os.Message;
2626
import android.util.Slog;
27+
import android.view.WindowManager;
2728

2829
class AppErrorDialog extends BaseErrorDialog {
2930
private final static String TAG = "AppErrorDialog";
@@ -73,6 +74,9 @@ public AppErrorDialog(Context context, AppErrorResult result, ProcessRecord app)
7374
setTitle(res.getText(com.android.internal.R.string.aerr_title));
7475
getWindow().addFlags(FLAG_SYSTEM_ERROR);
7576
getWindow().setTitle("Application Error: " + app.info.processName);
77+
if (app.persistent) {
78+
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR);
79+
}
7680

7781
// After the timeout, pretend the user clicked the quit button
7882
mHandler.sendMessageDelayed(

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

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ public class WindowManagerService extends IWindowManager.Stub
167167
static final boolean DEBUG_DRAG = false;
168168
static final boolean DEBUG_SCREEN_ON = false;
169169
static final boolean DEBUG_SCREENSHOT = false;
170+
static final boolean DEBUG_BOOT = false;
170171
static final boolean SHOW_SURFACE_ALLOC = false;
171172
static final boolean SHOW_TRANSACTIONS = false;
172173
static final boolean SHOW_LIGHT_TRANSACTIONS = false || SHOW_TRANSACTIONS;
@@ -4728,6 +4729,14 @@ public int[] getInputDeviceIds() {
47284729

47294730
public void enableScreenAfterBoot() {
47304731
synchronized(mWindowMap) {
4732+
if (DEBUG_BOOT) {
4733+
RuntimeException here = new RuntimeException("here");
4734+
here.fillInStackTrace();
4735+
Slog.i(TAG, "enableScreenAfterBoot: mDisplayEnabled=" + mDisplayEnabled
4736+
+ " mForceDisplayEnabled=" + mForceDisplayEnabled
4737+
+ " mShowingBootMessages=" + mShowingBootMessages
4738+
+ " mSystemBooted=" + mSystemBooted, here);
4739+
}
47314740
if (mSystemBooted) {
47324741
return;
47334742
}
@@ -4745,6 +4754,14 @@ public void enableScreenAfterBoot() {
47454754
}
47464755

47474756
void enableScreenIfNeededLocked() {
4757+
if (DEBUG_BOOT) {
4758+
RuntimeException here = new RuntimeException("here");
4759+
here.fillInStackTrace();
4760+
Slog.i(TAG, "enableScreenIfNeededLocked: mDisplayEnabled=" + mDisplayEnabled
4761+
+ " mForceDisplayEnabled=" + mForceDisplayEnabled
4762+
+ " mShowingBootMessages=" + mShowingBootMessages
4763+
+ " mSystemBooted=" + mSystemBooted, here);
4764+
}
47484765
if (mDisplayEnabled) {
47494766
return;
47504767
}
@@ -4767,6 +4784,14 @@ public void performBootTimeout() {
47674784

47684785
public void performEnableScreen() {
47694786
synchronized(mWindowMap) {
4787+
if (DEBUG_BOOT) {
4788+
RuntimeException here = new RuntimeException("here");
4789+
here.fillInStackTrace();
4790+
Slog.i(TAG, "performEnableScreen: mDisplayEnabled=" + mDisplayEnabled
4791+
+ " mForceDisplayEnabled=" + mForceDisplayEnabled
4792+
+ " mShowingBootMessages=" + mShowingBootMessages
4793+
+ " mSystemBooted=" + mSystemBooted, here);
4794+
}
47704795
if (mDisplayEnabled) {
47714796
return;
47724797
}
@@ -4780,10 +4805,22 @@ public void performEnableScreen() {
47804805
boolean haveBootMsg = false;
47814806
boolean haveApp = false;
47824807
boolean haveWallpaper = false;
4783-
boolean haveKeyguard = false;
4808+
boolean haveKeyguard = true;
47844809
final int N = mWindows.size();
47854810
for (int i=0; i<N; i++) {
47864811
WindowState w = mWindows.get(i);
4812+
if (w.mAttrs.type == WindowManager.LayoutParams.TYPE_KEYGUARD) {
4813+
// Only if there is a keyguard attached to the window manager
4814+
// will we consider ourselves as having a keyguard. If it
4815+
// isn't attached, we don't know if it wants to be shown or
4816+
// hidden. If it is attached, we will say we have a keyguard
4817+
// if the window doesn't want to be visible, because in that
4818+
// case it explicitly doesn't want to be shown so we should
4819+
// not delay turning the screen on for it.
4820+
boolean vis = w.mViewVisibility == View.VISIBLE
4821+
&& w.mPolicyVisibility;
4822+
haveKeyguard = !vis;
4823+
}
47874824
if (w.isVisibleLw() && !w.mObscured && !w.isDrawnLw()) {
47884825
return;
47894826
}
@@ -4800,7 +4837,7 @@ public void performEnableScreen() {
48004837
}
48014838
}
48024839

4803-
if (DEBUG_SCREEN_ON) {
4840+
if (DEBUG_SCREEN_ON || DEBUG_BOOT) {
48044841
Slog.i(TAG, "******** booted=" + mSystemBooted + " msg=" + mShowingBootMessages
48054842
+ " haveBoot=" + haveBootMsg + " haveApp=" + haveApp
48064843
+ " haveWall=" + haveWallpaper + " haveKeyguard=" + haveKeyguard);
@@ -4821,7 +4858,7 @@ public void performEnableScreen() {
48214858
}
48224859

48234860
mDisplayEnabled = true;
4824-
if (DEBUG_SCREEN_ON) Slog.i(TAG, "******************** ENABLING SCREEN!");
4861+
if (DEBUG_SCREEN_ON || DEBUG_BOOT) Slog.i(TAG, "******************** ENABLING SCREEN!");
48254862
if (false) {
48264863
StringWriter sw = new StringWriter();
48274864
PrintWriter pw = new PrintWriter(sw);
@@ -4852,6 +4889,14 @@ public void performEnableScreen() {
48524889
public void showBootMessage(final CharSequence msg, final boolean always) {
48534890
boolean first = false;
48544891
synchronized(mWindowMap) {
4892+
if (DEBUG_BOOT) {
4893+
RuntimeException here = new RuntimeException("here");
4894+
here.fillInStackTrace();
4895+
Slog.i(TAG, "showBootMessage: msg=" + msg + " always=" + always
4896+
+ " mAllowBootMessages=" + mAllowBootMessages
4897+
+ " mShowingBootMessages=" + mShowingBootMessages
4898+
+ " mSystemBooted=" + mSystemBooted, here);
4899+
}
48554900
if (!mAllowBootMessages) {
48564901
return;
48574902
}
@@ -4873,6 +4918,14 @@ public void showBootMessage(final CharSequence msg, final boolean always) {
48734918
}
48744919

48754920
public void hideBootMessagesLocked() {
4921+
if (DEBUG_BOOT) {
4922+
RuntimeException here = new RuntimeException("here");
4923+
here.fillInStackTrace();
4924+
Slog.i(TAG, "hideBootMessagesLocked: mDisplayEnabled=" + mDisplayEnabled
4925+
+ " mForceDisplayEnabled=" + mForceDisplayEnabled
4926+
+ " mShowingBootMessages=" + mShowingBootMessages
4927+
+ " mSystemBooted=" + mSystemBooted, here);
4928+
}
48764929
if (mShowingBootMessages) {
48774930
mShowingBootMessages = false;
48784931
mPolicy.hideBootMessages();

0 commit comments

Comments
 (0)