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

Commit 27f8f5c0 authored by Sherry Zhou's avatar Sherry Zhou
Browse files

Pass tap event from keyguard to magic portrait

Test: presubmit
Bug: 370556290
Flag: EXEMPT magic portrait only

Change-Id: If520415129ea48e7cf7f943a29dfbfdc6d99a17f
parent 0ea36763
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) {}
}