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

Commit 2f126116 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Add logs for when we schedule and unschedule ClockDrawableWrapper

* Not sure what exactly to look for, but maybe we're not unscheduling
when the test ends or something.

Bug: 319168409
Change-Id: Ic282f8b36f522e02566278d982297432c3bdb1aa
parent 01db1b8c
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@ import java.util.function.IntFunction;
@TargetApi(Build.VERSION_CODES.O)
public class ClockDrawableWrapper extends AdaptiveIconDrawable implements BitmapInfo.Extender {

    public static boolean sRunningInTest = false;

    private static final String TAG = "ClockDrawableWrapper";

    private static final boolean DISABLE_SECONDS = true;
@@ -455,6 +457,9 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap

        @Override
        public void run() {
            if (sRunningInTest) {
                Log.d("b/319168409", "running this: " + this);
            }
            if (mAnimInfo.applyTime(mTime, mFG)) {
                invalidateSelf();
            } else {
@@ -468,6 +473,9 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
            if (visible) {
                reschedule();
            } else {
                if (sRunningInTest) {
                    Log.d("b/319168409", "unScheduling self invisible this: " + this);
                }
                unscheduleSelf(this);
            }
            return result;
@@ -477,10 +485,15 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
            if (!isVisible()) {
                return;
            }

            if (sRunningInTest) {
                Log.d("b/319168409", "unScheduling self this: " + this);
            }
            unscheduleSelf(this);
            final long upTime = SystemClock.uptimeMillis();
            final long step = TICK_MS; /* tick every 200 ms */
            if (sRunningInTest) {
                Log.d("b/319168409", "scheduling self this: " + this, new Throwable());
            }
            scheduleSelf(this, upTime - ((upTime % step)) + step);
        }