Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 827c5af0 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am e49a107a: Merge "Fix issue #11223335: APR: Lots of failures in procstats due to..." into klp-dev

* commit 'e49a107a':
  Fix issue #11223335: APR: Lots of failures in procstats due to...
parents 6ac67f47 e49a107a
Loading
Loading
Loading
Loading
+7 −12
Original line number Diff line number Diff line
@@ -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;
    }
+4 −4
Original line number Diff line number Diff line
@@ -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) {
+17 −8
Original line number Diff line number Diff line
@@ -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;
            }
        }

+15 −5
Original line number Diff line number Diff line
@@ -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;
                }
            }
+1 −6
Original line number Diff line number Diff line
@@ -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;
        }
    }
Loading