diff options
5 files changed, 40 insertions, 15 deletions
diff --git a/core/java/android/app/ApplicationErrorReport.java b/core/java/android/app/ApplicationErrorReport.java index 6524c9a43e76..588125d0cc92 100644 --- a/core/java/android/app/ApplicationErrorReport.java +++ b/core/java/android/app/ApplicationErrorReport.java @@ -332,20 +332,31 @@ public class ApplicationErrorReport implements Parcelable { exceptionMessage = tr.getMessage(); // Populate fields with the "root cause" exception + Throwable rootTr = tr; while (tr.getCause() != null) { tr = tr.getCause(); + if (tr.getStackTrace() != null && tr.getStackTrace().length > 0) { + rootTr = tr; + } String msg = tr.getMessage(); if (msg != null && msg.length() > 0) { exceptionMessage = msg; } } - exceptionClassName = tr.getClass().getName(); - StackTraceElement trace = tr.getStackTrace()[0]; - throwFileName = trace.getFileName(); - throwClassName = trace.getClassName(); - throwMethodName = trace.getMethodName(); - throwLineNumber = trace.getLineNumber(); + exceptionClassName = rootTr.getClass().getName(); + if (rootTr.getStackTrace().length > 0) { + StackTraceElement trace = rootTr.getStackTrace()[0]; + throwFileName = trace.getFileName(); + throwClassName = trace.getClassName(); + throwMethodName = trace.getMethodName(); + throwLineNumber = trace.getLineNumber(); + } else { + throwFileName = "unknown"; + throwClassName = "unknown"; + throwMethodName = "unknown"; + throwLineNumber = 0; + } } /** diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java index 3b21590bbb9b..2c875c82e780 100644 --- a/core/java/android/net/Uri.java +++ b/core/java/android/net/Uri.java @@ -1689,7 +1689,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { return HierarchicalUri.readFrom(in); } - throw new AssertionError("Unknown URI type: " + type); + throw new IllegalArgumentException("Unknown URI type: " + type); } public Uri[] newArray(int size) { @@ -1996,7 +1996,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { parcel.writeInt(Representation.DECODED); parcel.writeString(decoded); } else { - throw new AssertionError(); + throw new IllegalArgumentException("Neither encoded nor decoded"); } } } @@ -2037,7 +2037,8 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { case Representation.DECODED: return fromDecoded(parcel.readString()); default: - throw new AssertionError(); + throw new IllegalArgumentException("Unknown representation: " + + representation); } } @@ -2221,7 +2222,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { case Representation.DECODED: return fromDecoded(parcel.readString()); default: - throw new AssertionError(); + throw new IllegalArgumentException("Bad representation: " + representation); } } diff --git a/core/java/com/android/internal/os/ProcessStats.java b/core/java/com/android/internal/os/ProcessStats.java index ea5ce09b7f38..e0e9a29714d1 100644 --- a/core/java/com/android/internal/os/ProcessStats.java +++ b/core/java/com/android/internal/os/ProcessStats.java @@ -19,6 +19,7 @@ package com.android.internal.os; import static android.os.Process.*; import android.os.Process; +import android.os.StrictMode; import android.os.SystemClock; import android.util.Slog; @@ -798,6 +799,10 @@ public class ProcessStats { } private String readFile(String file, char endChar) { + // Permit disk reads here, as /proc/meminfo isn't really "on + // disk" and should be fast. TODO: make BlockGuard ignore + // /proc/ and /sys/ files perhaps? + StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskReads(); FileInputStream is = null; try { is = new FileInputStream(file); @@ -822,6 +827,7 @@ public class ProcessStats { } catch (java.io.IOException e) { } } + StrictMode.setThreadPolicy(savedPolicy); } return null; } diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index 33b21ab3824a..ee0937dbd6bf 100644 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -276,10 +276,12 @@ final class ActivityStack { public void handleMessage(Message msg) { switch (msg.what) { case SLEEP_TIMEOUT_MSG: { - if (mService.isSleeping()) { - Slog.w(TAG, "Sleep timeout! Sleeping now."); - mSleepTimeout = true; - checkReadyForSleepLocked(); + synchronized (mService) { + if (mService.isSleeping()) { + Slog.w(TAG, "Sleep timeout! Sleeping now."); + mSleepTimeout = true; + checkReadyForSleepLocked(); + } } } break; case PAUSE_TIMEOUT_MSG: { @@ -775,7 +777,6 @@ final class ActivityStack { if (mService.mShuttingDown) { mService.notifyAll(); } - } public final Bitmap screenshotActivities(ActivityRecord who) { diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 5bc5f304042e..6c95e3531bea 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -8736,6 +8736,12 @@ public class WindowManagerService extends IWindowManager.Stub return; } + if (mDisplay == null || !mPolicy.isScreenOn()) { + // No need to freeze the screen before the system is ready or if + // the screen is off. + return; + } + mScreenFrozenLock.acquire(); mDisplayFrozen = true; |