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

Commit 8d7ac1d0 authored by Sherry Zhou's avatar Sherry Zhou
Browse files

Add onKeyguardAppearing to LiveWallpaperKeyguardEventListener

Bug: 395897130
Flag: EXEMPT, interface change
Test: manual test + presubmit

Change-Id: Ia8377ce1e3585ac20a90b59a20067bf81da5523b
parent d2fbea88
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ abstract class LiveWallpaper : WallpaperService() {
        const val COMMAND_PREVIEW_INFO = "android.wallpaper.previewinfo"
        const val COMMAND_LOCKSCREEN_LAYOUT_CHANGED = "android.wallpaper.lockscreen_layout_changed"
        const val COMMAND_LOCKSCREEN_TAP = "android.wallpaper.lockscreen_tap"
        const val COMMAND_KEYGUARD_APPEARING = "android.wallpaper.keyguardappearing"
        const val WALLPAPER_FLAG_NOT_FOUND = -1
    }

@@ -423,6 +424,9 @@ abstract class LiveWallpaper : WallpaperService() {
                        onLockscreenFocalAreaTap(x, y)
                    }
                }
                COMMAND_KEYGUARD_APPEARING -> {
                    onKeyguardAppearing()
                }
            }

            if (resultRequested) return extras
@@ -475,6 +479,12 @@ abstract class LiveWallpaper : WallpaperService() {
            }
        }

        fun onKeyguardAppearing() {
            if (wallpaperEngine is LiveWallpaperKeyguardEventListener) {
                (wallpaperEngine as LiveWallpaperKeyguardEventListener).onKeyguardAppearing()
            }
        }

        fun onPreviewInfoReceived(extras: Bundle?) {
            if (wallpaperEngine is LiveWallpaperEventListener) {
                (wallpaperEngine as LiveWallpaperEventListener).onPreviewInfoReceived(extras)
+2 −0
Original line number Diff line number Diff line
@@ -21,4 +21,6 @@ interface LiveWallpaperKeyguardEventListener {

    /** Called when the keyguard is going away. */
    fun onKeyguardGoingAway()

    fun onKeyguardAppearing()
}
+2 −0
Original line number Diff line number Diff line
@@ -152,6 +152,8 @@ class WeatherEngine(
        userPresenceController.onKeyguardGoingAway()
    }

    override fun onKeyguardAppearing() {}

    override fun onOffsetChanged(xOffset: Float, xOffsetStep: Float) {
        // No-op.
    }