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

Commit c50157ce authored by Aurélien Pomini's avatar Aurélien Pomini
Browse files

New TorusEngine onWallpaperFlagsChanged() method

This forwards the event Engine.onWallpaperFlagsChanged()

Bug: 329855848
Test: Manual

Change-Id: If0af55a32e01007acf4f90c003e0a078dfd372f7
parent 463d5b79
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.google.android.torus.core.engine

import android.app.WallpaperManager
import com.google.android.torus.core.wallpaper.LiveWallpaper

/**
@@ -59,4 +60,11 @@ interface TorusEngine {
     * @param isLastActiveInstance Whether this was the last Engine instance in our Service.
     */
    fun destroy(isLastActiveInstance: Boolean = true)

    /**
     * Called when the engine changes its destination flag. The destination indicates whether
     * the wallpaper is drawn on home screen, lock screen, or both. It is a combination of
     * [WallpaperManager.FLAG_LOCK] and/or [WallpaperManager.FLAG_SYSTEM]
     */
    fun onWallpaperFlagsChanged(which: Int) {}
}
+5 −1
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import android.os.Bundle
import android.service.wallpaper.WallpaperService
import android.view.MotionEvent
import android.view.SurfaceHolder
import androidx.annotation.RequiresApi
import com.google.android.torus.core.content.ConfigurationChangeListener
import com.google.android.torus.core.engine.TorusEngine
import com.google.android.torus.core.engine.listener.TorusTouchListener
@@ -398,6 +397,11 @@ abstract class LiveWallpaper : WallpaperService() {
            }
        }

        override fun onWallpaperFlagsChanged(which: Int) {
            super.onWallpaperFlagsChanged(which)
            wallpaperEngine.onWallpaperFlagsChanged(which)
        }

        /**
         * This is overriding a hidden API [WallpaperService.shouldZoomOutWallpaper].
         */