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

Commit b164f018 authored by Christopher Tate's avatar Christopher Tate Committed by Chris Tate
Browse files

Temporary tracking of JobStatus unprepare

For help diagnosing bug 37209909

Test: manual
Change-Id: If93ee0d25f462d5c8e954d3d7cbdc280b5d18c7e
parent a16d465a
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -107,6 +107,9 @@ public final class JobStatus {
    private GrantedUriPermissions uriPerms;
    private boolean prepared;

    static final boolean DEBUG_PREPARE = true;
    private Throwable unpreparedPoint = null;

    /**
     * Earliest point in the future at which this job will be eligible to run. A value of 0
     * indicates there is no delay constraint. See {@link #hasTimingDelayConstraint()}.
@@ -410,6 +413,9 @@ public final class JobStatus {
            return;
        }
        prepared = true;
        if (DEBUG_PREPARE) {
            unpreparedPoint = null;
        }
        final ClipData clip = job.getClipData();
        if (clip != null) {
            uriPerms = GrantedUriPermissions.createFromClip(am, clip, sourceUid, sourcePackageName,
@@ -420,9 +426,15 @@ public final class JobStatus {
    public void unprepareLocked(IActivityManager am) {
        if (!prepared) {
            Slog.wtf(TAG, "Hasn't been prepared: " + this);
            if (DEBUG_PREPARE && unpreparedPoint != null) {
                Slog.e(TAG, "Was already unprepared at ", unpreparedPoint);
            }
            return;
        }
        prepared = false;
        if (DEBUG_PREPARE) {
            unpreparedPoint = new Throwable().fillInStackTrace();
        }
        if (uriPerms != null) {
            uriPerms.revoke(am);
            uriPerms = null;