Loading toruslib/torus-core/src/main/java/com/google/android/torus/core/wallpaper/LiveWallpaper.kt +12 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ abstract class LiveWallpaper : WallpaperService() { const val COMMAND_KEYGUARD_GOING_AWAY = "android.wallpaper.keyguardgoingaway" 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 WALLPAPER_FLAG_NOT_FOUND = -1 } Loading Loading @@ -385,6 +386,11 @@ abstract class LiveWallpaper : WallpaperService() { } COMMAND_KEYGUARD_GOING_AWAY -> onKeyguardGoingAway() COMMAND_PREVIEW_INFO -> onPreviewInfoReceived(extras) COMMAND_LOCKSCREEN_LAYOUT_CHANGED -> { if (extras != null) { onLockscreenLayoutChanged(extras) } } } if (resultRequested) return extras Loading Loading @@ -442,5 +448,11 @@ abstract class LiveWallpaper : WallpaperService() { (wallpaperEngine as LiveWallpaperEventListener).onPreviewInfoReceived(extras) } } fun onLockscreenLayoutChanged(extras: Bundle) { if (wallpaperEngine is LiveWallpaperEventListener) { (wallpaperEngine as LiveWallpaperEventListener).onLockscreenLayoutChanged(extras) } } } } toruslib/torus-core/src/main/java/com/google/android/torus/core/wallpaper/listener/LiveWallpaperEventListener.kt +17 −0 Original line number Diff line number Diff line Loading @@ -108,4 +108,21 @@ interface LiveWallpaperEventListener { * See [WallpaperService.shouldZoomOutWallpaper]. */ fun shouldZoomOutWallpaper() = false /** * React to COMMAND_LOCKSCREEN_LAYOUT_CHANGED from SystemUI. Current usage is to show the * remaining space in lockscreen to bound the position for wallpaper shape effects. We also pass * the bottom of smartspace as a reference. * * @param extras contains the necessary value from lockscreen layout currently for magic * portrait, it contains * - "screenLeft": the left of the screen * - "screenRight": the left of the screen * - "smartspaceBottom": the bottom of the smartspace date and weather part, not bc smartspace * - "shortCutTop": the top of the shortcut in locksreen * - "notificationBottom": the bottom of notifications in lockscreen With smartspaceBottom, * screenLeft, screenRight, shortCutTop, we can get the remaining space bounds in lockscreen * without notifications. And with notificationBottom, we have bounds with notifications */ fun onLockscreenLayoutChanged(extras: Bundle) {} } Loading
toruslib/torus-core/src/main/java/com/google/android/torus/core/wallpaper/LiveWallpaper.kt +12 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ abstract class LiveWallpaper : WallpaperService() { const val COMMAND_KEYGUARD_GOING_AWAY = "android.wallpaper.keyguardgoingaway" 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 WALLPAPER_FLAG_NOT_FOUND = -1 } Loading Loading @@ -385,6 +386,11 @@ abstract class LiveWallpaper : WallpaperService() { } COMMAND_KEYGUARD_GOING_AWAY -> onKeyguardGoingAway() COMMAND_PREVIEW_INFO -> onPreviewInfoReceived(extras) COMMAND_LOCKSCREEN_LAYOUT_CHANGED -> { if (extras != null) { onLockscreenLayoutChanged(extras) } } } if (resultRequested) return extras Loading Loading @@ -442,5 +448,11 @@ abstract class LiveWallpaper : WallpaperService() { (wallpaperEngine as LiveWallpaperEventListener).onPreviewInfoReceived(extras) } } fun onLockscreenLayoutChanged(extras: Bundle) { if (wallpaperEngine is LiveWallpaperEventListener) { (wallpaperEngine as LiveWallpaperEventListener).onLockscreenLayoutChanged(extras) } } } }
toruslib/torus-core/src/main/java/com/google/android/torus/core/wallpaper/listener/LiveWallpaperEventListener.kt +17 −0 Original line number Diff line number Diff line Loading @@ -108,4 +108,21 @@ interface LiveWallpaperEventListener { * See [WallpaperService.shouldZoomOutWallpaper]. */ fun shouldZoomOutWallpaper() = false /** * React to COMMAND_LOCKSCREEN_LAYOUT_CHANGED from SystemUI. Current usage is to show the * remaining space in lockscreen to bound the position for wallpaper shape effects. We also pass * the bottom of smartspace as a reference. * * @param extras contains the necessary value from lockscreen layout currently for magic * portrait, it contains * - "screenLeft": the left of the screen * - "screenRight": the left of the screen * - "smartspaceBottom": the bottom of the smartspace date and weather part, not bc smartspace * - "shortCutTop": the top of the shortcut in locksreen * - "notificationBottom": the bottom of notifications in lockscreen With smartspaceBottom, * screenLeft, screenRight, shortCutTop, we can get the remaining space bounds in lockscreen * without notifications. And with notificationBottom, we have bounds with notifications */ fun onLockscreenLayoutChanged(extras: Bundle) {} }