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

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

Merge cherrypicks of ['googleplex-android-review.googlesource.com/24103711',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/24103711', 'googleplex-android-review.googlesource.com/24081607'] into udc-release.

Change-Id: I55e7b000ec0130776efe3224cf770c1e8f47bb63
parents dac52959 417902ac
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -868,6 +868,11 @@ public abstract class WallpaperService extends Service {
         * This will trigger a {@link #onComputeColors()} call.
         */
        public void notifyColorsChanged() {
            if (mDestroyed) {
                Log.i(TAG, "Ignoring notifyColorsChanged(), Engine has already been destroyed.");
                return;
            }

            final long now = mClockFunction.get();
            if (now - mLastColorInvalidation < NOTIFY_COLORS_RATE_LIMIT_MS) {
                Log.w(TAG, "This call has been deferred. You should only call "
@@ -2226,7 +2231,11 @@ public abstract class WallpaperService extends Service {
            }
        }

        void detach() {
        /**
         * @hide
         */
        @VisibleForTesting
        public void detach() {
            if (mDestroyed) {
                return;
            }
@@ -2442,6 +2451,14 @@ public abstract class WallpaperService extends Service {
        }

        public void reportShown() {
            if (mEngine == null) {
                Log.i(TAG, "Can't report null engine as shown.");
                return;
            }
            if (mEngine.mDestroyed) {
                Log.i(TAG, "Engine was destroyed before we could draw.");
                return;
            }
            if (!mShownReported) {
                mShownReported = true;
                Trace.beginSection("WPMS.mConnection.engineShown");
+2 −5
Original line number Diff line number Diff line
@@ -12,12 +12,9 @@ class KeyguardClockFrame(
) : FrameLayout(context, attrs) {
    private var drawAlpha: Int = 255

    init {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null)
    }

    protected override fun onSetAlpha(alpha: Int): Boolean {
        drawAlpha = alpha
        // Ignore alpha passed from View, prefer to compute it from set values
        drawAlpha = (255 * this.alpha * transitionAlpha).toInt()
        return true
    }

+4 −0
Original line number Diff line number Diff line
dupin@google.com
santie@google.com
pomini@google.com
poultney@google.com
 No newline at end of file
+13 −0
Original line number Diff line number Diff line
@@ -85,4 +85,17 @@ public class WallpaperServiceTest {
        assertEquals("onAmbientModeChanged should have been called", 2, zoomChangedCount[0]);
    }

    @Test
    public void testNotifyColorsOfDestroyedEngine_doesntCrash() {
        WallpaperService service = new WallpaperService() {
            @Override
            public Engine onCreateEngine() {
                return new Engine();
            }
        };
        WallpaperService.Engine engine = service.onCreateEngine();
        engine.detach();

        engine.notifyColorsChanged();
    }
}