diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index 2c4eac0e391b5..a24f84aa85b9c 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -195,8 +195,12 @@ class ActivityStack extends ConfigurationContai // How long we wait for the activity to tell us it has stopped before // giving up. This is a good amount of time because we really need this - // from the application in order to get its saved state. - private static final int STOP_TIMEOUT = 10 * 1000; + // from the application in order to get its saved state. Once the stop + // is complete we may start destroying client resources triggering + // crashes if the UI thread was hung. We put this timeout one second behind + // the ANR timeout so these situations will generate ANR instead of + // Surface lost or other errors. + private static final int STOP_TIMEOUT = 11 * 1000; // How long we wait until giving up on an activity telling us it has // finished destroying itself. diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index b9fb2e012e038..b911c7b85d232 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -256,6 +256,9 @@ public class NotificationManagerService extends SystemService { static final int LONG_DELAY = PhoneWindowManager.TOAST_WINDOW_TIMEOUT; static final int SHORT_DELAY = 2000; // 2 seconds + // 1 second past the ANR timeout. + static final int FINISH_TOKEN_TIMEOUT = 11 * 1000; + static final long[] DEFAULT_VIBRATE_PATTERN = {0, 250, 250, 250}; static final long SNOOZE_UNTIL_UNSPECIFIED = -1; @@ -4804,7 +4807,7 @@ public class NotificationManagerService extends SystemService { { mHandler.removeCallbacksAndMessages(token); Message m = Message.obtain(mHandler, MESSAGE_FINISH_TOKEN_TIMEOUT, token); - mHandler.sendMessageDelayed(m, 5); + mHandler.sendMessageDelayed(m, FINISH_TOKEN_TIMEOUT); } private void handleKillTokenTimeout(IBinder token)