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

Commit a599b835 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11981331 from 1c51a67d to 24Q4-release

Change-Id: If8ea9cf0fcd9df79fe3d1ab567e62417efabb665
parents c56ee084 1c51a67d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -12,4 +12,4 @@ checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPL
ktlint_hook = ${REPO_ROOT}/prebuilts/ktlint/ktlint.py --no-verify-format -f ${PREUPLOAD_FILES}

[Tool Paths]
ktfmt = ${REPO_ROOT}/prebuilts/build-tools/common/framework/ktfmt.jar
ktfmt = ${REPO_ROOT}/external/ktfmt/ktfmt.sh
+0 −12
Original line number Diff line number Diff line
@@ -457,9 +457,6 @@ 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 {
@@ -473,9 +470,6 @@ 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;
@@ -485,15 +479,9 @@ 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);
        }

+12 −4
Original line number Diff line number Diff line
@@ -30,9 +30,11 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.DrawableWrapper;

import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.core.graphics.ColorUtils;

/**
 * A drawable used for drawing user badge. It draws a circle around the actual badge,
@@ -47,7 +49,8 @@ public class UserBadgeDrawable extends DrawableWrapper {
    private static final float SHADOW_RADIUS = 11.5f;
    private static final float SHADOW_OFFSET_Y = 0.25f;

    private static final int SHADOW_COLOR = 0x11000000;
    @VisibleForTesting
    static final int SHADOW_COLOR = 0x11000000;

    private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

@@ -90,10 +93,10 @@ public class UserBadgeDrawable extends DrawableWrapper {
            canvas.translate(b.left, b.top);
            canvas.scale(b.width() / VIEWPORT_SIZE, b.height() / VIEWPORT_SIZE);

            mPaint.setColor(SHADOW_COLOR);
            mPaint.setColor(blendDrawableAlpha(SHADOW_COLOR));
            canvas.drawCircle(CENTER, CENTER + SHADOW_OFFSET_Y, SHADOW_RADIUS, mPaint);

            mPaint.setColor(mBgColor);
            mPaint.setColor(blendDrawableAlpha(mBgColor));
            canvas.drawCircle(CENTER, CENTER, BG_RADIUS, mPaint);

            canvas.restoreToCount(saveCount);
@@ -101,6 +104,11 @@ public class UserBadgeDrawable extends DrawableWrapper {
        super.draw(canvas);
    }

    private @ColorInt int blendDrawableAlpha(@ColorInt int color) {
        int alpha = (int) (Color.valueOf(color).alpha() * getAlpha());
        return ColorUtils.setAlphaComponent(color, alpha);
    }

    @Override
    public void setColorFilter(@Nullable ColorFilter filter) {
        if (filter == null) {
+18 −8
Original line number Diff line number Diff line
@@ -38,12 +38,7 @@ internal class PerfettoViewCapture
internal constructor(private val context: Context, executor: Executor) :
    ViewCapture(RING_BUFFER_SIZE, DEFAULT_INIT_POOL_SIZE, executor) {

    private val mDataSource =
        ViewCaptureDataSource(
            { mActiveSessions.incrementAndGet() },
            {},
            { mActiveSessions.decrementAndGet() }
        )
    private val mDataSource = ViewCaptureDataSource({ onStart() }, {}, { onStop() })

    private val mActiveSessions = AtomicInteger(0)

@@ -60,8 +55,11 @@ internal constructor(private val context: Context, executor: Executor) :
    }

    init {
        enableOrDisableWindowListeners(false)

        Producer.init(InitArguments.DEFAULTS)
        val params =

        val dataSourceParams =
            DataSourceParams.Builder()
                .setBufferExhaustedPolicy(
                    DataSourceParams.PERFETTO_DS_BUFFER_EXHAUSTED_POLICY_STALL_AND_ABORT
@@ -69,7 +67,19 @@ internal constructor(private val context: Context, executor: Executor) :
                .setNoFlush(true)
                .setWillNotifyOnStop(false)
                .build()
        mDataSource.register(params)
        mDataSource.register(dataSourceParams)
    }

    fun onStart() {
        if (mActiveSessions.incrementAndGet() == 1) {
            enableOrDisableWindowListeners(true)
        }
    }

    fun onStop() {
        if (mActiveSessions.decrementAndGet() == 0) {
            enableOrDisableWindowListeners(false)
        }
    }

    @WorkerThread
+2 −1
Original line number Diff line number Diff line
@@ -32,5 +32,6 @@ vec4 main(float2 fragCoord) {
    half outline = smoothstep(0.1, 1.8, dY * 5.0);

    // Return the results in the R channel.
    return vec4(outline, 0., 0., 0.);
    // Also return alpha 1 avoid visual artifacts when it is used standalone.
    return vec4(outline, 0., 0., 1.);
}
Loading