diff options
-rw-r--r-- | core/java/android/util/Log.java | 19 | ||||
-rw-r--r-- | core/java/android/util/Slog.java | 8 | ||||
-rw-r--r-- | core/java/com/android/internal/app/ProcessStats.java | 25 | ||||
-rw-r--r-- | services/java/com/android/server/am/ActiveServices.java | 20 | ||||
-rw-r--r-- | services/java/com/android/server/am/ServiceRecord.java | 7 | ||||
-rw-r--r-- | services/java/com/android/server/pm/Settings.java | 3 |
6 files changed, 46 insertions, 36 deletions
diff --git a/core/java/android/util/Log.java b/core/java/android/util/Log.java index 8c1cf5f..abd173a 100644 --- a/core/java/android/util/Log.java +++ b/core/java/android/util/Log.java @@ -253,7 +253,7 @@ public final class Log { * @param msg The message you would like logged. */ public static int wtf(String tag, String msg) { - return wtf(tag, msg, null); + return wtf(LOG_ID_MAIN, tag, msg, null, false); } /** @@ -262,7 +262,7 @@ public final class Log { * @hide */ public static int wtfStack(String tag, String msg) { - return wtfStack(LOG_ID_MAIN, tag, msg); + return wtf(LOG_ID_MAIN, tag, msg, null, true); } /** @@ -272,7 +272,7 @@ public final class Log { * @param tr An exception to log. */ public static int wtf(String tag, Throwable tr) { - return wtf(tag, tr.getMessage(), tr); + return wtf(LOG_ID_MAIN, tag, tr.getMessage(), tr, false); } /** @@ -283,18 +283,13 @@ public final class Log { * @param tr An exception to log. May be null. */ public static int wtf(String tag, String msg, Throwable tr) { - return wtf(LOG_ID_MAIN, tag, msg, tr); + return wtf(LOG_ID_MAIN, tag, msg, tr, false); } - static int wtfStack(int logId, String tag, String msg) { - TerribleFailure here = new TerribleFailure("here", null); - here.fillInStackTrace(); - return wtf(logId, tag, msg, here); - } - - static int wtf(int logId, String tag, String msg, Throwable tr) { + static int wtf(int logId, String tag, String msg, Throwable tr, boolean localStack) { TerribleFailure what = new TerribleFailure(msg, tr); - int bytes = println_native(logId, ASSERT, tag, msg + '\n' + getStackTraceString(tr)); + int bytes = println_native(logId, ASSERT, tag, msg + '\n' + + getStackTraceString(localStack ? what : tr)); sWtfHandler.onTerribleFailure(tag, what); return bytes; } diff --git a/core/java/android/util/Slog.java b/core/java/android/util/Slog.java index a5c22ff..70795bb 100644 --- a/core/java/android/util/Slog.java +++ b/core/java/android/util/Slog.java @@ -79,19 +79,19 @@ public final class Slog { } public static int wtf(String tag, String msg) { - return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null); + return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, false); } public static int wtfStack(String tag, String msg) { - return Log.wtfStack(Log.LOG_ID_SYSTEM, tag, msg); + return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, true); } public static int wtf(String tag, Throwable tr) { - return Log.wtf(Log.LOG_ID_SYSTEM, tag, tr.getMessage(), tr); + return Log.wtf(Log.LOG_ID_SYSTEM, tag, tr.getMessage(), tr, false); } public static int wtf(String tag, String msg, Throwable tr) { - return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, tr); + return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, tr, false); } public static int println(int priority, String tag, String msg) { diff --git a/core/java/com/android/internal/app/ProcessStats.java b/core/java/com/android/internal/app/ProcessStats.java index 430e43a..222e446 100644 --- a/core/java/com/android/internal/app/ProcessStats.java +++ b/core/java/com/android/internal/app/ProcessStats.java @@ -2918,29 +2918,38 @@ public final class ProcessStats implements Parcelable { } } - public void clearCurrentOwner(Object owner) { + public void clearCurrentOwner(Object owner, boolean silently) { if (mOwner == owner) { - mOwner = null; mProc.decActiveServices(mName); if (mStartedState != STATE_NOTHING || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) { long now = SystemClock.uptimeMillis(); if (mStartedState != STATE_NOTHING) { - Slog.wtfStack(TAG, "Service owner " + owner + " cleared while started: pkg=" - + mPackage + " service=" + mName + " proc=" + mProc); + if (!silently) { + Slog.wtfStack(TAG, "Service owner " + owner + + " cleared while started: pkg=" + mPackage + " service=" + + mName + " proc=" + mProc); + } setStarted(false, 0, now); } if (mBoundState != STATE_NOTHING) { - Slog.wtfStack(TAG, "Service owner " + owner + " cleared while bound: pkg=" - + mPackage + " service=" + mName + " proc=" + mProc); + if (!silently) { + Slog.wtfStack(TAG, "Service owner " + owner + + " cleared while bound: pkg=" + mPackage + " service=" + + mName + " proc=" + mProc); + } setBound(false, 0, now); } if (mExecState != STATE_NOTHING) { - Slog.wtfStack(TAG, "Service owner " + owner + " cleared while exec: pkg=" - + mPackage + " service=" + mName + " proc=" + mProc); + if (!silently) { + Slog.wtfStack(TAG, "Service owner " + owner + + " cleared while exec: pkg=" + mPackage + " service=" + + mName + " proc=" + mProc); + } setExecuting(false, 0, now); } } + mOwner = null; } } diff --git a/services/java/com/android/server/am/ActiveServices.java b/services/java/com/android/server/am/ActiveServices.java index b69a0c8..a64940c 100644 --- a/services/java/com/android/server/am/ActiveServices.java +++ b/services/java/com/android/server/am/ActiveServices.java @@ -1494,7 +1494,7 @@ public final class ActiveServices { } catch (Exception e) { Slog.w(TAG, "Exception when unbinding service " + r.shortName, e); - serviceDoneExecutingLocked(r, true, true); + serviceProcessGoneLocked(r); } } } @@ -1544,7 +1544,7 @@ public final class ActiveServices { } catch (Exception e) { Slog.w(TAG, "Exception when destroying service " + r.shortName, e); - serviceDoneExecutingLocked(r, true, true); + serviceProcessGoneLocked(r); } updateServiceForegroundLocked(r.app, false); } else { @@ -1570,7 +1570,7 @@ public final class ActiveServices { r.tracker.setStarted(false, memFactor, now); r.tracker.setBound(false, memFactor, now); if (r.executeNesting == 0) { - r.tracker.clearCurrentOwner(r); + r.tracker.clearCurrentOwner(r, false); r.tracker = null; } } @@ -1629,7 +1629,7 @@ public final class ActiveServices { s.app.thread.scheduleUnbindService(s, b.intent.intent.getIntent()); } catch (Exception e) { Slog.w(TAG, "Exception when unbinding service " + s.shortName, e); - serviceDoneExecutingLocked(s, true, true); + serviceProcessGoneLocked(s); } } @@ -1708,6 +1708,16 @@ public final class ActiveServices { } } + private void serviceProcessGoneLocked(ServiceRecord r) { + if (r.tracker != null) { + int memFactor = mAm.mProcessStats.getMemFactorLocked(); + long now = SystemClock.uptimeMillis(); + r.tracker.setExecuting(false, memFactor, now); + r.tracker.setBound(false, memFactor, now); + } + serviceDoneExecutingLocked(r, true, true); + } + private void serviceDoneExecutingLocked(ServiceRecord r, boolean inDestroying, boolean finishing) { if (DEBUG_SERVICE) Slog.v(TAG, "<<< DONE EXECUTING " + r @@ -1747,7 +1757,7 @@ public final class ActiveServices { r.tracker.setExecuting(false, mAm.mProcessStats.getMemFactorLocked(), SystemClock.uptimeMillis()); if (finishing) { - r.tracker.clearCurrentOwner(r); + r.tracker.clearCurrentOwner(r, false); r.tracker = null; } } diff --git a/services/java/com/android/server/am/ServiceRecord.java b/services/java/com/android/server/am/ServiceRecord.java index c47c1ac..cc1172a 100644 --- a/services/java/com/android/server/am/ServiceRecord.java +++ b/services/java/com/android/server/am/ServiceRecord.java @@ -335,12 +335,7 @@ final class ServiceRecord extends Binder { public void forceClearTracker() { if (tracker != null) { - int memFactor = ams.mProcessStats.getMemFactorLocked(); - long now = SystemClock.uptimeMillis(); - tracker.setStarted(false, memFactor, now); - tracker.setBound(false, memFactor, now); - tracker.setExecuting(false, memFactor, now); - tracker.clearCurrentOwner(this); + tracker.clearCurrentOwner(this, true); tracker = null; } } diff --git a/services/java/com/android/server/pm/Settings.java b/services/java/com/android/server/pm/Settings.java index 377c390..92fc6a4 100644 --- a/services/java/com/android/server/pm/Settings.java +++ b/services/java/com/android/server/pm/Settings.java @@ -2473,7 +2473,8 @@ final class Settings { } else if (tagName.equals("signing-keyset")) { long id = Long.parseLong(parser.getAttributeValue(null, "identifier")); packageSetting.keySetData.addSigningKeySet(id); - Slog.d(TAG, "Adding signing keyset " + Long.toString(id) + " to " + name); + if (false) Slog.d(TAG, "Adding signing keyset " + Long.toString(id) + + " to " + name); } else if (tagName.equals("defined-keyset")) { long id = Long.parseLong(parser.getAttributeValue(null, "identifier")); String alias = parser.getAttributeValue(null, "alias"); |