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

Commit e3c9fc34 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Pass tap event from keyguard to magic portrait" into main

parents 7dac8644 27f8f5c0
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ abstract class LiveWallpaper : WallpaperService() {
        const val COMMAND_GOING_TO_SLEEP = "android.wallpaper.goingtosleep"
        const val COMMAND_PREVIEW_INFO = "android.wallpaper.previewinfo"
        const val COMMAND_LOCKSCREEN_LAYOUT_CHANGED = "android.wallpaper.lockscreen_layout_changed"
        const val COMMAND_LOCKSCREEN_TAP_POSITION = "android.wallpaper.lockscreen_tap_position"
        const val WALLPAPER_FLAG_NOT_FOUND = -1
    }

@@ -208,9 +209,7 @@ abstract class LiveWallpaper : WallpaperService() {
            return false
        }

        /**
         * Returns the information if the wallpaper is visible.
         */
        /** Returns the information if the wallpaper is visible. */
        fun isVisible(): Boolean {
            this.wallpaperServiceEngine?.let {
                return it.isVisible
@@ -414,6 +413,11 @@ abstract class LiveWallpaper : WallpaperService() {
                        onLockscreenLayoutChanged(extras)
                    }
                }
                COMMAND_LOCKSCREEN_TAP_POSITION -> {
                    if (extras != null) {
                        onLockscreenFocalAreaTap(extras)
                    }
                }
            }

            if (resultRequested) return extras
@@ -477,5 +481,11 @@ abstract class LiveWallpaper : WallpaperService() {
                (wallpaperEngine as LiveWallpaperEventListener).onLockscreenLayoutChanged(extras)
            }
        }

        fun onLockscreenFocalAreaTap(extras: Bundle) {
            if (wallpaperEngine is LiveWallpaperEventListener) {
                (wallpaperEngine as LiveWallpaperEventListener).onLockscreenFocalAreaTap(extras)
            }
        }
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -150,4 +150,11 @@ interface LiveWallpaperEventListener {
    // TODO: when smartspace is moved from below small clock to the right of the clock, we need to
    // change all smartspace bottom mentioned above to small clock bottom
    fun onLockscreenLayoutChanged(extras: Bundle) {}

    /**
     * Make wallpaper be able to react to short tap event on lockscreen. Tap should be within the
     * wallpaper focal area, extras contains position applied on wallpaper, including
     * "tapInWallpaperFocalAreaX" and "tapInWallpaperFocalAreaY".
     */
    fun onLockscreenFocalAreaTap(extras: Bundle) {}
}