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

Commit 1f38636c authored by Brad Fitzpatrick's avatar Brad Fitzpatrick Committed by Android (Google) Code Review
Browse files

Merge "Expose (internally only) the number of animations currently running."

parents a6ca66af 599ca299
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -1215,4 +1215,16 @@ public class ValueAnimator extends Animator {
        void onAnimationUpdate(ValueAnimator animation);

    }

    /**
     * Return the number of animations currently running.
     *
     * Used by StrictMode internally to annotate violations.  Only
     * called on the main thread.
     *
     * @hide
     */
    public static int getCurrentAnimationsCount() {
        return sAnimations.size();
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package android.os;

import android.animation.ValueAnimator;
import android.app.ActivityManagerNative;
import android.app.ApplicationErrorReport;
import android.util.Log;
@@ -1109,6 +1110,11 @@ public final class StrictMode {
         */
        public int durationMillis = -1;

        /**
         * The number of animations currently running.
         */
        public int numAnimationsRunning = 0;

        /**
         * Which violation number this was (1-based) since the last Looper loop,
         * from the perspective of the root caller (if it crossed any processes
@@ -1138,6 +1144,7 @@ public final class StrictMode {
            crashInfo = new ApplicationErrorReport.CrashInfo(tr);
            violationUptimeMillis = SystemClock.uptimeMillis();
            this.policy = policy;
            this.numAnimationsRunning = ValueAnimator.getCurrentAnimationsCount();
        }

        /**
@@ -1163,6 +1170,7 @@ public final class StrictMode {
            }
            durationMillis = in.readInt();
            violationNumThisLoop = in.readInt();
            numAnimationsRunning = in.readInt();
            violationUptimeMillis = in.readLong();
        }

@@ -1174,6 +1182,7 @@ public final class StrictMode {
            dest.writeInt(policy);
            dest.writeInt(durationMillis);
            dest.writeInt(violationNumThisLoop);
            dest.writeInt(numAnimationsRunning);
            dest.writeLong(violationUptimeMillis);
        }

@@ -1190,6 +1199,9 @@ public final class StrictMode {
            if (violationNumThisLoop != 0) {
                pw.println(prefix + "violationNumThisLoop: " + violationNumThisLoop);
            }
            if (numAnimationsRunning != 0) {
                pw.println(prefix + "numAnimationsRunning: " + numAnimationsRunning);
            }
            pw.println(prefix + "violationUptimeMillis: " + violationUptimeMillis);
        }

+3 −0
Original line number Diff line number Diff line
@@ -6676,6 +6676,9 @@ public final class ActivityManagerService extends ActivityManagerNative
            if (info.violationNumThisLoop != 0) {
                sb.append("Loop-Violation-Number: ").append(info.violationNumThisLoop).append("\n");
            }
            if (info.numAnimationsRunning != 0) {
                sb.append("Animations-Running: ").append(info.numAnimationsRunning).append("\n");
            }
            if (info != null && info.durationMillis != -1) {
                sb.append("Duration-Millis: ").append(info.durationMillis).append("\n");
            }